TRAP


The TRAP statement temporarily halts execution at runtime to permit debugging. Debugging permits “browsing” through the statements in an ILF routine, setting and clearing TRAP statements in those event points, stepping through the statements or event points, and inspecting and/or modifying variables.

    ••••• TRAP
    (1)

(1) T/F execution conditions

Using the Statement

A TRAP statement can be used in any ILF routine in any event point in any process. The true/false indicators can be used to make a TRAP conditional. See Chapter 4-5: The Debugger for details on using the debugger.

Restrictions

TRAP is executed only when the application is invoked from “Test Application” within the application design utilities, or when invoked from the Toolbox there.

Statement Ignored

TRAP is ignored if the application is invoked from “Select Database.”

Example

In the following example, the TRAP statement allows the designer to explore and observe the execution of this routine, which assigns a batch control number to a group of adjustments.

          LABEL    :CHECK TRXCNTRL
          TRAP
          IF       TAR PARAM TRXCNTRL             EQ     1
    T     SET      TAR TRXCNTRL CONTROL NO         =  TAR PARAM ADJUST CONTROL
    T     COMPUTE  TAR PARAM ADJUST CONTROL       +      1
    T     SET      TAR TRXCNTRL APPLICATION       =      TAR
    T     SET      TAR TRXCNTRL FILE POSTED       =      ADJUSTMENTS
    T     SET      TAR TRXCNTRL OPERATOR ID       =  --- USER ID
    T     READ     TAR TRXCNTRL               HOLD 1 FT 1 BY TRXCNTRL KEY
    TT    GOTO     :CHECK TRXCNTRL