C$WRU
The C$WRU library routine returns the name of the program that has called the currently running program.
Note - This routine is supported for RM/COBOL compatibility. In order to know the name of the caller program, you should consider using C$CALLEDBY instead.
Syntax:
 CALL "C$WRU" USING programName,
                    programLine, programIntraLine
             GIVING returnCode.
Parameters:
programName
PIC X(n)
Receives the name of the calling program.
If this routine is called by the main program, "RUNCOBOL" is returned.
programLine
PIC 9(n)
Receives 0.
programIntraLine
PIC 9(n)
Receives 0.
Return code:
returnCode can be any signed numeric data item and provides additional information:
1
The currently running program has been called by another isCOBOL program.
0
The caller program name couldn’t be retrieved. Possible causes are:
The current program is the main program, the one started on the command line
The caller program is either a Java class or a C function, not a COBOL program
The current program was loaded from iscobol.remote.code_prefix
The caller program has a CLASS-ID instead of a PROGRAM-ID.
-1
Missing or invalid parameter.
Examples:
Example - Retrieve the name of the calling program
*> define calling-program as pic x(n)
*> define foo-1 and foo-2 as pic 9
 
call "c$wru" using calling-program, foo-1, foo-2.