| 
       PROGRAM-NAME( n )
       | 
| 
       /* Note this program should be run as a subroutine. */
        /* The deeper the nesting, the better the illustration. */ DEFINE VARIABLE level AS INTEGER NO-UNDO INITIAL 1. REPEAT WHILE PROGRAM-NAME(level) <> ?: DISPLAY LEVEL PROGRAM-NAME(level) FORMAT "x(30)". level = level + 1. END. | 
 If you execute a procedure directly from the Procedure Editor or the AppBuilder, then PROGRAM-NAME(1) returns the name of a temporary file rather than the name of the actual procedure file.
If you execute a procedure directly from the Procedure Editor or the AppBuilder, then PROGRAM-NAME(1) returns the name of a temporary file rather than the name of the actual procedure file.
   The PROGRAM-NAME function is useful when developing on-line help. For example, you can use the following code in your help routine to produce a program trace:
The PROGRAM-NAME function is useful when developing on-line help. For example, you can use the following code in your help routine to produce a program trace:
  | 
       DEFINE VARIABLE ix    AS INTEGER   NO-UNDO INITIAL 2.
        DEFINE VARIABLE plist AS CHARACTER NO-UNDO FORMAT "x(70)". FORM plist WITH FRAME what-prog OVERLAY ROW 10 CENTERED 5 DOWN NO-LABELS TITLE " Program Trace ". /* ix = 2, so skip the current routine: PROGRAM-NAME(1) */ DO WHILE PROGRAM-NAME(ix) <> ?: IF ix = 2 THEN plist = "Currently in : " + PROGRAM-NAME(ix). ELSE plist = "Which was called by: " + PROGRAM-NAME(ix). ix = ix + 1. DISPLAY plist WITH FRAME what-prog. DOWN WITH FRAME what-prog. END. PAUSE. HIDE FRAME what-prog. | 
 If the procedure you reference is an internal procedure, then PROGRAM-NAME returns a string with the following form:
If the procedure you reference is an internal procedure, then PROGRAM-NAME returns a string with the following form:
  | 
       "internal-procedure-namesource-file-name"
       | 
 If the procedure you reference is a user interface trigger associated with a widget, then PROGRAM-NAME returns a string with the following form:
If the procedure you reference is a user interface trigger associated with a widget, then PROGRAM-NAME returns a string with the following form:
  | 
       "USER-INTERFACE-TRIGGER source-file-name"
       | 
 If the procedure you reference is a user interface trigger that uses the ANYWHERE keyword, then PROGRAM-NAME returns a string with the following form:
If the procedure you reference is a user interface trigger that uses the ANYWHERE keyword, then PROGRAM-NAME returns a string with the following form:
  | 
       "SYSTEM-TRIGGER source-file-name"
       | 
 If the procedure you reference is a session database trigger, then PROGRAM-NAME returns a string with the following form:
If the procedure you reference is a session database trigger, then PROGRAM-NAME returns a string with the following form:
  | 
       "type-TRIGGER source-file-name"
       | 
 If the call stack contains a method reference, then PROGRAM-NAME returns a string with the following form:
If the call stack contains a method reference, then PROGRAM-NAME returns a string with the following form:
  | 
       "method-nameclass-file-name"
       |