COBOL Manual for TNS and TNS/R Programs

Program Execution
HP COBOL Manual for TNS and TNS/R Programs522555-006
12-23
ADD DEFINE Command
Usage Considerations:
TAPE DEFINE Provides the Only Way to Use Labeled Tapes
For details, see Section 25, Executing and Debugging HP COBOL Programs, and
the Guardian User’s Guide.
You Can Use SPOOL DEFINES instead of COBOLSPOOLOPEN
Special DEFAULTS DEFINE: =_DEFAULTS DEFINE
Processes can use the =_DEFAULTS DEFINE without referring to it explicitly. The
file system uses this DEFINE whenever it needs the values stored in the DEFINE’s
attributes. You cannot delete the =_DEFAULTS DEFINE or change its name.
ADD DEFINE Command
Your COBOL program can, in the ASSIGN clause of a file-control entry, associate a
DEFINE name with a COBOL file name, just as it would associate a file-system file
name with a COBOL file name. When the process compiled from that source attempts
to open that file, the file system looks for the stored set of attribute/value pairs and
uses them to complete the specification of the file before making it available to the
process. If it cannot make a file available (based on what it finds, or fails to find), the
open operation fails.
To create and name a DEFINE, you use the ADD DEFINE command. Suppose that
your current CLASS attribute has the value MAP. If your COBOL program includes this
file-control entry:
SELECT MARKET-ANALYSIS
ASSIGN TO "=MARKT"
ACCESS MODE IS DYNAMIC
RECORD KEY IS PRODUCT-CODE
FILE STATUS IS M-STAT.
Before executing your program, you must issue a command of this form:
>ADD DEFINE =MARKT, FILE \MAG.$EAST.APRIL.SALES
to associate the file SALES in subvolume APRIL on volume $EAST on system \MAG
with the name =MARKT.