COBOL Manual for TNS/E Programs (H06.03+)
Procedure Division Verbs
HP COBOL Manual for TNS/E Programs—520347-003
9-143
OPEN
If some process already has a file open SHARED for any access mode except
OUTPUT, another process can open the same file SHARED for any access mode.
If some process already has a file open SHARED for OUTPUT, no other process
can open the file (because the OPEN would delete all the records in the file).
If some process already has a file open SHARED for INPUT access mode, another
process can open the same file PROTECTED for any access mode.
If some process already has a file open PROTECTED for INPUT access mode,
another process can also open the same file PROTECTED for INPUT access
mode.
All other combinations of access mode and exclusion mode cause the open
operation to fail.
•
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-46 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










