COBOL Manual for TNS and TNS/R Programs
Input and Output Concepts
HP COBOL Manual for TNS and TNS/R Programs—522555-006
26-8
Associating COBOL File Names With System File
Names
#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 COBOLASSIGN (in the non-CRE environment) or COBOL_ASSIGN_ (in the
CRE) 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
COBOLASSIGN (in the non-CRE environment) or COBOL_ASSIGN_ (in the CRE).
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.