Returns the name of the program currently executing, the current program level, or the name of the program executing when an error occurred.
Syntax
PROGRAM([nLevel])
Returns
Character or Numeric
Arguments
nLevel
Specifies how many program levels back the program name is to be found. This parameter can range from 0 to the program nesting depth. A program can execute another program which can execute another program, and so on. Programs may be nested to 128 levels.
If you specify 0 or 1 for nLevel, PROGRAM( ) returns the name of the master program (the highest-level program). If nLevel exceeds the program nesting depth, PROGRAM( ) returns an empty string.
If you specify –1 for nLevel, PROGRAM( ) returns as a numeric value the current program level. PROGRAM(–1) always returns zero when issued from the Command window.
Remarks
PROGRAM( ) helps your program recover from errors. It is similar to SYS(16).
If used without an argument, PROGRAM( ) returns the name of the currently executing program.