ONCONDID Function

Purpose

Returns a FIXED BINARY(31,0) value that identifies the condition being handled by an ON-unit.

Syntax

ONCONDID()

or

ONCONDID

Description

ONCONDID is short for ON-condition identifier. It returns a FIXED BINARY(31,0) value that identifies the condition being handled by an ON-unit. It is in context in any ON-unit or one of its dynamic descendants. The values returned by the ONCONDID() built-in function when invoked from within an ON-unit are the following:

            area            = 1 
            attention       = 2 
            condition       = 3 
            conversion      = 4 
            endfile         = 5 
            endpage         = 6 
            error           = 7 
            finish          = 8 
            fixedoverflow   = 9 
            invalidop       = 10 
            key             = 11 
            name            = 12 
            overflow        = 13 
            record          = 14 
            size            = 15 
            storage         = 16 
            stringrange     = 17 
            stringsize      = 18 
            subscriptrange  = 19 
            transmit        = 20 
            undefinedfile   = 21 
            underflow       = 22 
            zerodivide      = 23

If ONCONDID() is used when not in context, a null string is returned.

Examples

dcl cond_area   fixed bin(31) value(1);
dcl cond_error  fixed bin(31) value(7);
dcl cond_finish fixed bin(31) value(8);
on anycondition
    begin;
       on error system;
       select(oncondid());
           when(cond_area)
               do;
                   /* process AREA condition */
               end;
          when(cond_finish)
               ;
           when(cond_error)
               do;
                  /* process ERROR condition */
               end;
           other
               ;
       end;
     end;

Restrictions

None.