COBOL Manual for TNS/E Programs (H06.03+)

Program Execution
HP COBOL Manual for TNS/E Programs520347-003
12-18
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.
Not accepted by FastSort SQL/MP or SQL/MX
Available from OSS
environment
Yes, but it can be used only to
access a Guardian disk file, tape
device, or spooler location
No
Table 12-1. Differences Between DEFINE and ASSIGN (page 2 of 2)
DEFINE ASSIGN