Exchange/SNA Manual
Step-by-Step Instructions
Using the Exchange/SNA Programmatic Interface
104700 Tandem Computers Incorporated 4–13
Receiving Files
Use the READ procedure to read the records sent from the host system to the specified
subdevice (that is, the subdevice you opened). The basic procedure for receiving a file
is outlined below. These steps assume you have already performed steps 1 (start line
server), 2 (open device for read-only access), and 3 (set operational parameters), as
outlined above.
1. Open the file in which the received records are to be written.
2. Call READ (or WRITEREAD) and read a record from the subdevice. If you use
WRITEREAD, it must specify read-only (write count set to 0).
3. Call WRITE (or WRITEREAD) and write the received record to the file.
4. Repeat Steps 2 and 3 until an EDS (a type 1 FM header with end destination
selection specified) is received from the host system. This is indicated by the call
to READ returning with error number 1 (EOF or EDS received).
The above procedure assumes that all I/O operations are wait I/O operations. The
above procedure needs to be modified if your program is using nowait I/O
operations. For example, if your program uses nowait I/O operations with the file to
which the receive records are written, the loop in Steps 2, 3, and 4 above could be
replaced by the steps shown below.
1. Call READ and read the first record sent from the host system to the subdevice.
This is a wait I/O operation.
2. Call WRITE and write the record that was received from the host system by the
line server to the file. This is a nowait I/O operation.
3. Call READ and read the next record sent from the host system to the subdevice.
This is a wait I/O operation. However, it begins before the preceding WRITE has
completed; both operations are performed concurrently.
4. Call AWAITIO and wait for the call to WRITE to complete.
5. Repeat Steps 2 through 4 until the host system sends an EDS for the specified
subdevice. This is indicated by the call to READ returning with error number 1
(EOF or EDS received).
The above procedure illustrates just one of many ways to use nowait I/O operations to
receive files. Note that little benefit can be gained from using nowait I/O operations
with both the line server and the file. This is because there is nothing to do while both
READ and WRITE are in progress.
Both Sending and Receiving
Different classes of subdevices are used for send and receive operations. Card-reader
subdevices are used for send operations; printer and punch subdevices are used for
receive operations. Your program can perform send and receive operations
sequentially or simultaneously as long as your program uses the appropriate class of
subdevice for each operation.