Returns the name of the program at a specified program level, the name of the currently executing program, the current program level, or the name of the program executing when an error occurred.

PROGRAM([nLevel])

Parameters

nLevel

Specifies the number of program levels to search for the program name. The nLevel parameter can range from 0 to the program nesting depth. For more information about program nesting levels, see maximum number of DO calls in Visual FoxPro System Capacities.

When nLevel is omitted, PROGRAM( ) returns the name of the currently executing program. If you specify 0 or 1 for nLevel, PROGRAM( ) returns the name of the master program, or the highest-level program.

If you specify –1 for nLevel, PROGRAM( ) returns the current program level as a numeric value. However, using PROGRAM(–1) in the Command window always returns zero (0).

If nLevel exceeds the program nesting depth, PROGRAM( ) returns an empty string ("").

Expand imageReturn Value

Expand imageRemarks

Expand imageExample

Expand imageSee Also