COBOL Manual for TNS and TNS/R Programs

Program Execution
HP COBOL Manual for TNS and TNS/R Programs522555-006
12-20
Controlling the Propagation of DEFINEs
The statements of a COBOL program refer to files through a COBOL file name. The
ASSIGN clause in each file-control entry associates the COBOL file name with a
system-file-name, the name by which a file is known to the operating environment.
In the Guardian environment, the TACL command ASSIGN can override that
association and DEFINEs provide a different form of name redirection.
Suppose a program PROG1 includes a file-control entry for an fd-name of
MAJORACCT, and associates it with a system-file-name:
SELECT MAJORACCT
ASSIGN TO "\AKRON.$SLB.MAJ.ACC"
If you execute PROG1, when it opens MAJORACCT, the file it actually opens is
\AKRON.$SLB.MAJ.ACC.
If, when you execute the program, you want to redirect the assignment to a different
file, you can issue a command interpreter ASSIGN command such as
ASSIGN PROG1.MAJORACCT,\NICE.$FRNC.SIGNIF.CUST
and then run PROG1. When the COBOL program opens MAJORACCT, it opens the
file \NICE.$FRNC.SIGNIF.CUST.
If, however, the program had associated MAJORACCT with a define-name with a file-
control entry of the form
SELECT MAJORACCT
ASSIGN TO "=BIGGY"
then you would need to have a DEFINE named “=BIGGY” established at execution
time; otherwise, any OPEN statement would fail.
Controlling the Propagation of DEFINEs
You control whether or not the Guardian environment allows the creation and
processing of DEFINEs. Use the DEFMODE ON/OFF command to enable or disable
DEFINE creation and processing. Similarly, when one process starts another process,
the creator can specify a DEFMODE setting for the new process; if it does not specify
one, the new process inherits the DEFMODE setting of the creator.
DEFINE Names
Every DEFINE has a name. A name you give to a DEFINE must:
Consist of at least 2 and no more than 24 characters
Begin with an equals sign (=) followed by a letter
Continue with any combination of letters, digits, hyphens (-), underscores (_), and
carets (^).
HP has reserved the set of DEFINE names beginning with equals sign followed by
underscore (_) for future use.