CONDITION

The CONDITION function returns the condition information associated with the current trapped condition.

Read syntax diagramSkip visual syntax diagram CONDITION( option )
See Conditions and condition traps for a description of condition traps. You can request the following information:
  • The name of the current trapped condition
  • Any descriptive string associated with that condition
  • The instruction processed as a result of the condition trap (CALL or SIGNAL)
  • The status of the trapped condition.
To select the information to return, use the following options. (Only the capitalized and highlighted letter is needed; all characters following it are ignored.)
Condition name
returns the name of the current trapped condition.
Description
returns any descriptive string associated with the current trapped condition. If no description is available, returns a null string.
Instruction
returns either CALL or SIGNAL, the keyword for the instruction processed when the current condition was trapped. This is the default if you omit option.
Status
returns the status of the current trapped condition. This can change during processing, and can be:
  • ON - the condition is enabled
  • OFF - the condition is disabled
  • DELAY - any new occurrence of the condition is delayed or ignored.

If no condition has been trapped, the CONDITION function returns a null string in all four cases.

Examples

CONDITION()            ->    'CALL'        /* perhaps */
CONDITION('C')         ->    'FAILURE'
CONDITION('I')         ->    'CALL'
CONDITION('D')         ->    'FailureTest'
CONDITION('S')         ->    'OFF'        /* perhaps */
Note: The CONDITION function returns condition information that is saved and restored across subroutine calls (including those a CALL ON condition trap causes). Therefore, after a subroutine called with CALL ON trapname has returned, the current trapped condition reverts to the condition that was current before the CALL took place (which might be none). CONDITION returns the values it returned before the condition was trapped.