Traps that are currently set (sys.Traps)ΒΆ

sys.Traps,,u4

Traps set by last trappable command

Specifies the traps which are currently set.

Every command which may set traps (such as file access and update commands, or the dialog statement) modifies sys.Traps. Firstly, the field is cleared. Then, bits are set in sys.Traps for every trappable condition which was found to be true. (A single command may generate more than one trap status.)

After the command has been executed, the bitwise and operator (&) can be used to test sys.Traps against the pre-defined trap codes, to determine which trappable conditions actually occurred. If sys.Traps is 0, no traps have been set; if sys.Traps has a non-zero value, then one or more traps have been set.

The bits remain set until the next execution of a command which has trappable outcomes.

Trap codes are defined in the include file $SCULPTOR/include/sculptor.h.


EXAMPLES

if (sys.Traps & TRAP_NSR) {
     NoRecord()
}

switch (sys.Traps) {
     case & TRAP_NSR:
          statements
          break

     case & TRAP_RIU:
          statements
          break
}

RELATED TOPICS

Traps