Exchange/RJE Manual

Step-by-Step Instructions
Using the Exchange/RJE Programmatic Interface
104698 Tandem Computers Incorporated 4–17
Sending and Receiving in the Same Program
If your program both sends and receives, the following rules govern the actions
required to switch operations.
Switching from Sending to Receiving. To switch from sending to receiving, your program
must perform the following steps.
1. After the last file has been sent, send an EOT (end of transmission) to the remote
system by calling the CONTROL procedure with the operation parameter equal to
13.
2. Call SETMODE with the function parameter equal to 43 to specify the parameters
for the receive operation.
3. Call READ, which accepts a line bid from the remote system and then receives the
first message block from the remote system. If the remote system does not bid for
the line, the READ call returns with an operation timed-out error (error number
162).
Switching from Receiving to Sending. To switch from receiving to sending, your program
must perform the following steps.
1. Continue reading (calls to READ) until the remote system sends an EOT (end of
transmission). When the EOT is read, the call to READ returns error number 1
(end of file).
2. Call SETMODE with the function parameter equal to 42 to specify the parameters
for the send operation.
3. Call WRITE with the first record to be sent to the remote system. WRITE also bids
for the line. If the remote system does not accept the bid, WRITE returns error
number 168 (NAK received). (Note that several other errors, such as error
numbers 167 and 171, are also possible depending on how the bid is rejected.)
If your program needs to send something to the remote system before receiving an
EOT from the remote system, your program can call the CONTROL procedure with
the operation parameter equal to 13, which sends an EOT to the remote system. This is
a request for the remote system to abort the current operation and resynchronize with
the local system.
The remote system may or may not honor the request. If the remote system honors the
request, it will send an EOT in response and your program can continue with the steps
outlined above. If the remote system does not honor the request, it will continue
sending data. Either way, your program should continue reading until an EOT is
received.
Step 9: Disconnect There are two cases to consider when determining the action required to disconnect
from the data communications line. One case is when your program has been
receiving data from the remote system. The other case is when your program has been
sending data to the remote system. If your program has been both sending and
receiving, the relevant operation is the one your program performed last.