COBOL Manual for TNS and TNS/R Programs

Executing and Debugging HP COBOL Programs
HP COBOL Manual for TNS and TNS/R Programs522555-006
25-3
Overriding File Assignments Made at Compilation
Time
DEFINE Names
A DEFINE name begins with an equal sign (=) followed by a letter and up to 22
additional characters, which can be letters, digits, hyphens (-), underscores (_), and
circumflexes (^).
DEFINE Attributes
Every DEFINE has a CLASS attribute, which determines its other attributes. For
details, see the section of this manual that explains input-output for the system file that
you want to associate with the DEFINE name:
Overriding File Assignments Made at Compilation Time
To override a file assignment made at compile time—an assignment of a COBOL file
name to a system file name—you use an ASSIGN command.
Suppose that your program, PROG1, assigns the COBOL file name MAJORACCT to
the system file name \AKRON.$SLB.MAJ.ACC with this SELECT clause:
SELECT MAJORACCT ASSIGN TO "\AKRON.$SLB.MAJ.ACC"
When you execute PROG1 and it opens MAJORACCT, the file it actually opens is
\AKRON.$SLB.MAJ.ACC. Suppose that you want MAJORACCT to be another file,
\NICE.$FRNC.SIGNIF.CUST, instead. You can override the original file assignment
before executing PROG1 with the command:
ASSIGN PROG1.MAJORACCT,\NICE.$FRNC.SIGNIF.CUST
When you execute PROG1 and it opens MAJORACCT, the file it actually opens is
\NICE.$FRNC.SIGNIF.CUST rather than \AKRON.$SLB.MAJ.ACC.
Example 25-1. DEFINE Names
=NEWFILE
=FILE25
=TAPE-FILE
=FTEST_RESULTS
=JEFFS^FILE
System file is a ... Section Number and Name
Tape file Section 27, Tape Input and Output
Disk file Section 28, Disk Input and Output
Terminal Section 29, Terminal Input and Output
Printer or spooler Section 30, Printer and Spooler Output