OSI/TS Configuration and Management Manual

Programming Examples
OSI/TS Configuration and Management Manual424831-001
C-7
C Example File-Transfer Program, Requester
C Example File-Transfer Program, Requester
Before running this program, your OSI/TS subsystem must be configured and running.
Before compiling the source code, you must first replace the file and process names with
names that reflect your environment, as described in the first comment box in the code.
The source code file for this example is provided as part of the OSI/TS software. It
resides (by default) in $SYSTEM.ZOSITS.EXPRGC1A.
/********************************************************/
/* File: EXPRGC1A */
/* */
/* C file transfer program example: Requester */
/* */
/* 1) Replace "src" with the name of the file you */
/* want to transfer. */
/* 2) Replace "dst" with the name you want used to */
/* generate a file for the transferred copy. */
/* 3) Make sure that two TSP SUs are configured and */
/* replace $tsp1.#s00001 and $tsp2.#s00001 with */
/* the correct names. */
/* 4) Replace "vol" and "subvol" with the correct names.*/
/* 5) Compile and RUN. */
/* */
/********************************************************/
#pragma NOXMEM
#include <stdio.h> nolist
#include <string.h> nolist
#include <stdlib.h> nolist
#include <cextdecs(open,control,read,write,close,\
setmodenowait,create,purge,\
awaitio,fnameexpand)> nolist
#define MORE_DATA 000001 /* bit 15 is set to 1 */
#define NOMORE_DATA 0;
/****************************************************/
/* DATA STRUCTURE DECLARATION */
/****************************************************/
/* 123456789012345678 */
char srcex_file_name[] = "src ";
char dsex_file_name[] = "dst ";
char ext_dev_send[] = "$tsp1.#s00001 ";
char ext_dev_rcv[] = "$tsp2.#s00001 ";
char s_subvol[] = "$vol subvol ";
int default_subvol[10];
int osi_dev_rcv[20];
int osi_dev_send[20];
int dest_file_name[20];
int source_file_name[20];
int osnum,snum,ornum,dnum,count_read;
int rec_len_send = 1024;
int rec_len_rcv = 1024;
int buffer[1025];
/****************************************************/
/* MAIN PROGRAM */
/****************************************************/