COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-156
OPEN
•
Record Prereading
To save execution time by overlapping reading and processing, the run-time
routines perform record prereading (starting the read for record n +1 when
returning record n to the program) when all of these conditions are true:
°
The file access mode is SEQUENTIAL.
°
The file is open for INPUT.
°
The file is either a disk file opened for PROTECTED use or a disk, tape,
terminal, or card reader opened for EXCLUSIVE use.
°
The process is not running as a process pair.
°
The file is not opened for timed I-O.
Example 9-48 shows an OPEN statement with a TIME LIMITS and a SYNCDEPTH
phrase and an OPEN statement without optional phrases.
Caution. Verify the OPEN statement does not meet prereading requirements when the
COBOL process does any of these, or the operation might begin with the wrong record:
•
Enters a TAL routine to do input or output
•
Executes the read operation as part of a TMF transaction (enters BEGINTRANSACTION,
executes a READ statement, then enters ENDTRANSACTION)
•
Executes a CLOSE NO REWIND statement on a tape file and subsequently executes an
OPEN NO REWIND statement on the same file to continue from the previous position
Example 9-48. OPEN Statements
?NONSTOP
IDENTIFICATION DIVISION.
...
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EMPLOYEE-MASTER ASSIGN TO "EMPMAST"
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC.
...
SELECT LISTING-FILE ASSIGN TO "LISTOUT"
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL.
...
PROCEDURE DIVISION.
...
OPEN I-O EMPLOYEE-MASTER WITH TIME LIMITS SYNCDEPTH 1
OPEN OUTPUT LISTING-FILE