Ensuring that file attributes match your program
When the fixed file attributes in the DD
statement
or the data-set label and the attributes that are coded for that file
in the SELECT
clause and FD
entry
are not consistent, an OPEN
statement in your program
might not work.
Mismatches
in the attributes for file organization, record format (fixed or variable),
record length, or the code set result in file status code 39 and the
failure of the OPEN
statement. An exception exists
for files in the z/OS® UNIX file system: mismatches
in record format and record length do not cause an error.
To prevent common file status 39 problems, follow the guidelines for processing existing or new files.
If you have not made a file
available with a DD
statement or a TSO ALLOCATE
command,
and your COBOL program specifies that the file be created, Enterprise COBOL dynamically allocates the
file. When the file is opened, the file attributes that are coded
in your program are used. You do not have to worry about file attribute
conflicts.
Remember that information in the JCL or environment variable overrides information in the data-set label.