This is especially useful if the disk file is an object library.
CALL "C$MYFILE" USING PROGRAM-NAME GIVING CALL-STATUS
PROGRAM-NAME PIC X(n) | Indicates the name of the disk file containing the currently executing program, if known. The runtime will use as much space for the name of the file as the COBOL program allows. This parameter will contain the filename just as the runtime received it. For example, if an object library is loaded as ../ardir/myarlib.lib, and a program in myarlib.lib calls this routine, PROGRAM-NAME will have a value of ../ardir/myarlib.lib. |
CALL-STATUS PIC S99. | This parameter receives one of the following values:
1 - PROGRAM-NAME was filled successfully |
None.