For any type of file (sequential, line sequential, indexed,
or relative) in your z/OS® or z/OS UNIX applications, you can define
the external name with either a ddname or an environment-variable
name. The external name is the name in the assignment-name of
the ASSIGN
clause.
About this task
If the file is in the z/OS UNIX file system,
you can use either a DD
definition or an environment
variable to define the file by specifying its path name with the PATH
keyword.
The
environment-variable name must be uppercase. The allowable attributes
for its value depend on the organization of the file being defined.
Because
you can define the external name in either of two ways, the COBOL
run time goes through the following steps to find the definition of
the file:
Procedure
- If the ddname is explicitly allocated, it is used. The
definition can be from a
DD
statement in JCL, an ALLOCATE
command
from TSO/E, or a user-initiated dynamic allocation.
- If the ddname is not explicitly allocated and an environment
variable of the same name is set, the value of the environment variable
is used.
The file is dynamically allocated
using the attributes specified by the environment variable. At a minimum,
you must specify either the PATH()
or DSN()
option.
All options and attributes must be in uppercase, except for the path-name suboption
of the PATH
option, which is case sensitive. You
cannot specify a temporary data-set name in the DSN()
option.
File
status code 98 results from any of the following cases:
- The contents (including a value of null or all blanks) of the
environment variable are not valid.
- The dynamic allocation of the file fails.
- The dynamic deallocation of the file fails.
The COBOL run time checks the contents of the environment
variable at each OPEN
statement. If a file with the
same external name was dynamically allocated by a previous OPEN
statement,
and the contents of the environment variable have changed since that OPEN
,
the run time dynamically deallocates the previous allocation and reallocates
the file using the options currently set in the environment variable.
If the contents of the environment variable have not changed, the
run time uses the current allocation.
- If neither a ddname nor an environment variable is defined,
the following steps occur:
- If the allocation is for a QSAM file and the
CBLQDA
runtime
option is in effect, CBLQDA
dynamic allocation processing
takes place for those eligible files. This type of "implicit" dynamic
allocation persists for the life of the run unit and cannot be reallocated.
- Otherwise, the allocation fails.
Results
The COBOL run time deallocates all dynamic allocations
at run unit termination, except for implicit CBLQDA
allocations.