PROCEDURE command
The PROCEDURE command allows the definition of a group of commands that can be accessed by using the CALL procedure command. The CALL command is the only way to perform the commands within the PROCEDURE. PROCEDURE definitions remain in effect for the entire debug session.
The PROCEDURE keyword can be abbreviated only as PROC. PROCEDURE definitions can be subcommands of other PROCEDURE definitions. The name of a nested procedure has the scope of only the containing procedure. Session variables cannot be declared within a PROCEDURE definition.
In addition, a procedure must be defined before it is called on a CALL statement.
.---------. V | >>-name--:--PROCEDURE--;----command-+--END--;------------------><
- name
- A valid Debug Tool procedure name. It must be a valid identifier in the current programming language. The maximum length is 31 characters.
- command
- A valid Debug Tool command other than a declaration or PANEL command.
Usage notes
- Because the Debug Tool procedure names are always uppercase, the procedure names are converted to uppercase even for programming languages that have mixed-case symbols.
- If a GO or STEP command is issued within a procedure or a nested procedure, any statements following the GO or STEP in that procedure and the containing procedure are ignored. If control returns to Debug Tool, it returns to the statement following the CALL of the containing PROCEDURE.
- It is recommended that procedure names be chosen so that they are valid for all possible programming language settings throughout the entire Debug Tool debug session.
Examples
- When procedure proc1 is called, the values of
variables x, y, and z are
displayed.
proc1: PROCEDURE; LIST (x, y, z); END;
- Define a procedure named setat34 that sets a
breakpoint at statement 34. Procedure setat34 contains
a nested procedure lister that lists current statement
breakpoints. Procedure lister can be called only
from within setat34.
setat34: PROCEDURE; AT 34; lister: PROCEDURE; LIST AT STATEMENT; END; CALL lister; END;