COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
– The COBOL program describes the records of the file as having an odd number of
characters, the file system description of the file does not include the
“odd-unstructured” attribute, and the file size is some integer multiple of (COBOL
record size plus 1).
– If the file code is 101 (EDIT format) because either the file already exists with that
code or an ASSIGN command with a CODE phrase has been processed for the file,
the file can be opened in INPUT, OUTPUT, or EXTEND modes. Opening the file for
OUTPUT deletes any existing records in the file and starts the line numbers at 1, and
increments by 1. Opening the file for EXTEND retains existing records and starts the
line numbers at 1 greater than the number of the last line in the file, and increments
by 1. An EDIT-format file cannot be opened for OUTPUT or EXTEND if the NONSTOP
directive has been specified.
– If the file code is 180 (line sequential, available only in the OSS environment).
– The file must be described as having fixed-length records (absence of the rec-1
TO phrase and the VARYING phrase in the RECORD clause).
– If the file is opened in EXTEND mode, the file position indicator is advanced to the
end of the file.
• Structured Disk Files Not Present at Run Time
The open mode determines what happens when a structured disk file is not present at run
time.
Table 66 Open Modes for Structured Disk Files Not Present at Run Time
ActionOpen Mode
When the SELECT clause for the file contains the word OPTIONAL, the OPEN statement
completes successfully, and COBOL simulates the existence of an empty disk file. If the
file is not described as OPTIONAL, the open operation fails.
INPUT
If a file is described with alternate-record keys, the open operation fails. A COBOL
program cannot create files with alternate keys. When the disk file is otherwise described,
COBOL creates the file (see Structured Disk Files Present at Run Time).
OUTPUT or EXTEND
or I-O
If the device name is associated with a proper file name (such as
$volumename.subvolname.filename), then the created file is permanent and continues
to exist after the program has closed it. If the device name is not associated with a proper
file name (that is, if its name has the form of just a volume name or is a special name
like #TEMP), the created file is temporary and disappears when it is closed.
The device name can be associated with a proper file name in any of these ways:
◦ By the ASSIGN clause at compile time
◦ By an ASSIGN command at run time
◦ By a DEFINE of class MAP at run time
• Structured Disk Files Present at Run Time
Certain requirements pertain to all files in this category:
◦ The organization declared for the file must be consistent with the actual organization of
the file (that is, if the file is declared ORGANIZATION SEQUENTIAL, the file must be
OPEN 385










