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

Input and Output Concepts
HP COBOL Manual for TNS/E Programs520347-003
26-8
Associating COBOL File Names With System File
Names
If you run the program PROG1 with this command, the system file $TE1.#E02 is
associated with the special name #TERM and, therefore, with the COBOL file name
HOME-TERMINAL.
PROG1 /TERM $TE1.#E02/
#TEMP
The special name #TEMP represents a temporary disk file on the default volume
(which is specified by the program’s startup message). When the program opens a file
that is assigned to #TEMP, the HP COBOL run-time routines create a disk file on the
default volume. When the program closes a temporary disk file, the file system purges
it. For more information about temporary disk files, see the Guardian Programmer’s
Guide.
In the program PROG1, these SELECT and ASSIGN clauses associate the COBOL
file name TEMPFILE with the special name #TEMP, which stands for the system file
name that the file system gave the temporary file.
SELECT TEMPFILE ASSIGN TO #TEMP
Equivalently, this ASSIGN command associates the COBOL file name TEMPFILE with
the special name #TEMP:
ASSIGN PROG1.TEMPFILE, #TEMP
#DYNAMIC
The special name #DYNAMIC represents the file specified with the run-time library
routine COBOL_ASSIGN_ during the execution of the current process.
If you want your HP COBOL program to accept or construct a file name and then open
the file with that name, you must:
1. Assign the COBOL file name to #DYNAMIC (in the file-control entry).
2. Associate #DYNAMIC with a system file name by calling the routine
COBOL_ASSIGN_.
3. Open the file (using its COBOL file name).
Suppose that you want your program to use a file that the user specifies at run time.
Following Step 1, you assign the COBOL file name (ADJUSTABLE in this example) to
the special name #DYNAMIC in the file-control entry:
SELECT ADJUSTABLE ASSIGN TO #DYNAMIC.