OSI/FTAM Programming Guide

NonStop FTAM Programming Examples
HP NonStop OSI/FTAM Programming Guide528612-001
5-3
Reading a File: C Programming Example
check_status checks for status return values, error codes, and subcodes; displays
a message, deallocates the segment, and stops the program.
Comments provide more detailed information about what each routine does and how
you can modify the program to work differently, for instance, to use another document
type.
Reading a File: C Programming Example
1 /*********************************************************************/
2 /* */
3 /* Example in C - Reading a remote FTAM-3 file ( in Wait Mode ) */
4 /* */
5 /*********************************************************************/
6 /* */
7 /* Program Name: EXCREAF3 */
8 /* */
9 /* Program Description: */
10 /* */
11 /* This program, in wait mode, reads a remote FTAM-3 file and writes */
12 /* to a local FTAM-3 file. The data transfer is initiated and */
13 /* and managed by this application, which selects, opens, and then */
14 /* reads the remote file and receives data as indications from the */
15 /* remote system. The received data is then written to local file. */
16 /* The Guardian system procedure calls are used to open the local */
17 /* file and to write records to it. */
18 /* */
19 /* This program can handle files of up to 64 KB in size. Allowable */
20 /* Tandem file codes include: */
21 /* */
22 /* 0 - Enscribe unstructured binary file */
23 /* 891 - Enscribe entry-sequenced file with fixed record length */
24 /* 892 - Enscribe entry-sequenced file with variable record length */
25 /* */
26 /*********************************************************************/
27 /* */
28 /* NOTE : Before attempting to run this program, set the following */
29 /* items correctly: */
30 /* */
31 /* a) environmental variables */
32 /* b) required parameters for the FTM_INITIALIZE_REQ_ call */