Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 39
Handling Nowait I/O
contain the current file position in an internal format. Note that the current position
points to the start of the record that sequentially follows the last record read.
2. Continue processing the EDIT file.
3. Later when you want to return to the saved position, you simply restore the three
words to the block buffer and then reposition the file pointer by issuing the
SET^FILE SET^EDITREAD^REPOSITION operation.
The following example demonstrates the above sequence:
!Save the current position to return to later:
RETURN^POSITION ':=' EDBLKBUF[1] FOR 3 WORDS;
CALL READ^FILE(EDFILE,
READ^BUFFER,
BYTES^READ);
.
.
!Additional I/O to the EDIT file moves the current
!file position:
CALL READ^FILE(EDFILE,
READ^BUFFER,
BYTES^READ);
.
.
!Reposition the file pointer to return to saved position:
EDBLKBUF[1] ':=' RETURN^POSITION FOR 3 WORDS;
CALL SET^FILE(EDFILE,
SET^EDITREAD^POSITION);
!Read again the record that was read just after saving the
!position:
CALL READ^FILE(EDFILE,
READ^BUFFER,
BYTES^READ);
Handling Nowait I/O
SIO procedures can access files using waited or nowait I/O. With waited I/O, a
process waits for each I/O operation to finish before continuing. With nowait I/O, the
process initiates an I/O operation and then continues processing; your process then
executes in parallel with the I/O operation. Section 4, Using Nowait Input/Output,
provides a detailed discussion of waited and nowait I/O.
Waiting for One File
In its simplest form, a nowait I/O operation with SIO procedures consists of the
following steps: