OSI/TS Configuration and Management Manual

Programming Examples
OSI/TS Configuration and Management Manual424831-001
C-9
C Example File-Transfer Program, Responder
The source code file for this example is provided as part of the OSI/TS software. It
resides (by default) in $SYSTEM.ZOSITS.EXPRGTC1B.
/********************************************************/
/* File: EXPRGC1B */
/* */
/* C file transfer program example: Responder */
/* */
/* 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 */
/*********************************************************/
/* 123456789012345678901234 */
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[514];
/******************************************************/
/* MAIN PROGRAM */
/******************************************************/
main ()
{
/* Assume more data */
buffer[0] = buffer[0] || MORE_DATA;
/* Copy the default subvol name */