Opening QSAM files
Before a program can use any
REWRITE statements to process records in a file,
first open the file by using an
OPEN statement works if both
of the following conditions are true:
- The file is available or has been dynamically allocated.
- The fixed file attributes coded in the ddname
the data-set label for the file match the attributes coded for that
file in the
Mismatches in the file-organization attributes, code set, maximum record size, or record format (fixed or variable) result in file status code 39, and the failure of the
OPENstatement. Mismatches in maximum record size and record format are not errors when opening files in the z/OS® UNIX file system.
For fixed-length QSAM files, if you code
RECORD CONTAINS 0in the
FDentry, the record size attributes are not in conflict. The record size is taken from the
DDstatement or the data-set label, and the
OPENstatement is successful.
CLOSE WITH LOCK so that the file cannot be opened
while the program is running.
REVERSED option of the
statement to process tape files in reverse order.
The file is positioned at the end,
READ statements read the data records in reverse
starting with the last record.
REVERSED option is supported only for files that
OPEN statement (Enterprise COBOL for z/OS Language Reference)