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

Example 178 COBOL_ASSIGN_ Routine
IDENTIFICATION DIVISION.
...
ENVIRONMENT DIVISION.
...
SPECIAL-NAMES.
FILE "$SYSTEM.SYSTEM.COBOLLIB" IS COBOLLIB.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT PARTNO ASSIGN #DYNAMIC.
DATA DIVISION.
...
WORKING-STORAGE SECTION.
01 PART-FILE-NAME PICTURE X(35).
01 ASSIGN-ERROR COMP PICTURE 9999.
PROCEDURE DIVISION.
SETUP.
DISPLAY "ENTER CHOSEN PART FILE NAME"
ACCEPT PART-FILE-NAME
ENTER "COBOL_ASSIGN_" OF COBOLLIB USING PARTNO
PART-FILE-NAME
GIVING ASSIGN-ERROR
IF ASSIGN-ERROR = 0
OPEN INPUT PARTNO
ELSE IF ASSIGN-ERROR = 1
...
COBOLFILEINFO
The COBOLFILEINFO routine is for the Guardian environment. In the OSS environment, use the
COBOL_FILE_INFO_ routine.
The COBOLFILEINFO routine is for these situations:
An application needs to perform some operation not defined in HP COBOL on a file normally
managed by the HP COBOL run-time routines. This application must obtain the file system file
number assigned when the file was opened.
An application can put the file-system file name of a file into an application-generated error
message.
As with any ENTER statement, you must either qualify the name COBOLFILEINFO with the
library-reference ZCOBDLL or include a SEARCH directive specifying ZCOBDLL to provide
automatic resolution of the reference. The general form of the ENTER statement to use
COBOLFILEINFO follows.
ZCOBDLL Routines 649