Exchange/RJE Manual

Programming Considerations
Using the Exchange/RJE Programmatic Interface
104698 Tandem Computers Incorporated 4–3
3. After the message initiating the I/O operation has been sent, the operating system
resumes the execution of your program.
4. The process performs the I/O operation. Concurrently, your program continues
executing.
5. When the process has finished the I/O operation, it passes a message to the
operating system indicating the completion of the I/O operation. This step may
happen after Step 6 below.
6. Your program calls AWAITIO to wait for (or check on) the completion of the I/O
operation initiated in Step 1. Depending on how you code the call to AWAITIO,
either your program can wait (suspend) until the I/O operation is completed or
your program can continue executing even if the I/O operation is not yet complete
(in which case your program must call AWAITIO again to complete the I/O
operation).
7. Assuming that you code the call to AWAITIO to wait for completion of the I/O
operation (or that the I/O operation has completed already), the operating system
sets the condition code indicating the success or failure of the I/O operation and
resumes the execution of your program.
The above description assumes a single outstanding nowait I/O operation on a single
file. In practice, this is not always the case. To identify individual I/O operations
when several operations can be outstanding at once, the I/O procedures use a “tag”
parameter. The tag parameter is a number your program assigns to each nowait I/O
operation. The AWAITIO procedure returns this number to your program when that
I/O operation has completed. Your program then examines the returned tag
parameter to identify which I/O operation has completed.
The Exchange/RJE line server allows only one outstanding nowait I/O operation at a
time. For some programs, this can make the use of the tag parameter unnecessary.
However, a program may require the tag parameter to identify I/O operations
performed on other files. In this case, the tag parameter is required on a call to
AWAITIO if that call can complete an I/O operation against one of the files with
several outstanding nowait I/O operations.
Advantages and Disadvantages
An important decision in the design of any program is the choice between wait and
nowait I/O operations. Each file used by your program can be opened for wait or
nowait I/O operations. A single program can perform nowait I/O operations on some
files while performing wait I/O operations on other files.
Advantage of Wait I/O. The advantage of wait I/O operations is their simplicity. They
are easy to design and code. Wait I/O operations do not require calls to AWAITIO,
and they do not require any code to keep track of multiple outstanding I/O
operations.