PGM() Function - Get Program Text

Syntax

PGM(int{,ERR=lineref})

Description

For BBj-specific information, see the PGM() Function - BBj.

The PGM() function returns the compiled form of a specified line from the current workspace program. PGM() is commonly used in conjunction with the LST() function.

Parameter

Description

int

Program line number.

If the line does not exist, the first line greater than int is returned.

  • If int is -1, the workspace program name is returned, even within a public program.

  • If int is -2, the current program name is returned.

  • If int is 65536, the variable table for the current workspace program is returned. See the CPL() function for additional information on the variable table.

ERR=lineref

Branch to be taken if an error occurs during execution.

NOTE: If PGM() is used to get program lines in a public program, it returns the appropriate compiled format from the workspace program, not from itself.

Examples

>LET PGM$=PGM(10)

PGM$ returns the compiled format of statement 10.

>LIST
0010 PRINT LST(PGM(10))
>RUN
0010 PRINT LST(PGM(10))

See Also

Functions - Alphabetical Listing