498
PGM( ) Function
Return Program Line
Formats
PGM(lineno[,prog_level][,ERR=stmtref])
Where:
lineno
Statement line number. Numeric expression. Use an integer from 1 to
64999. -1, -2, or -3 returns program names instead; see description below.
prog_level Optional numeric value indicating which program level to return.
stmtref
Program line number or label to transfer control to.
Returns
String, compiled format of statement.
Description
The PGM( ) function returns a string containing the internal (compiled) format of a
given program statement number. If the line number is -1, the main (level 1)
program name is returned; -2 returns the current program name and -3 returns the
complete name of the program as specified on the CALL/LOAD/PERFORM or RUN.
If the statement number does not exist, and an ERR= option is specified, ProvideX
returns Error #21: Statement number is invalid and transfers control to
stmtref. If the statement number does not exist, and the ERR= option is omitted,
ProvideX returns the next higher statement.
Examples
The following examples illustrate different uses for the PGM( ) function.
Example 1:
1030 SWAPTST:
2:
2:A$=PGM(-1)
2:B$=PGM(-2)
2:PRINT A$," | ",B$
C:\Program Files\Sage Software\ProvideX\PGM\PVX_MAINPR | C:\Program
Files\Sage Software\ProvideX\PGM\PVX_SUBPR
Example 2:
0010 ! testpgm.-3
0020 CALL PGN+";label1;additional info"
0030 STOP
0040 LABEL1:
0050 PRINT "pgm(-3)='",PGM(-3),"'"
0060 EXIT
pgm(-3)='C:\Program Files\Sage
Software\ProvideX\testpgm.-3;label1;additional info'