z/OS Language Environment Programming Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


CEEITOK—Return initial condition token

z/OS Language Environment Programming Reference
SA38-0683-00

CEEITOK returns the condition that initially triggered the current condition. The current condition might be different from the initial condition if the initial condition has been promoted by a user-written condition handler.
Read syntax diagramSkip visual syntax diagram
Syntax

>>-CEEITOK--(--i_ctok--,--fc--)--------------------------------><

i_ctok (output)
A 12-byte condition token identifying the initial condition in the current active data block being processed.
fc (output)
A 12-byte feedback code, optional in some languages, that indicates the result of this service. If you choose to omit this parameter, refer to Invoking callable services for the appropriate syntax to indicate that the feedback code was omitted.

The following symbolic conditions can result from this service:

Code Severity Message number Message text
CEE000 0 The service completed successfully.
CEE35S 1 3260 No condition was active when a call to a condition management routine was made.

Usage notes

  • z/OS UNIX considerations—In multithread applications, CEEITOK affects only the calling thread. CEEITOK returns the initial token for the condition of the thread.

For more information

Examples

  1. Following is an example of CEEITOKC called by C/C++.
    /*Module/File Name: EDCITOK   */
    
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <leawi.h>
    #include <ceeedcct.h>
    
    #ifdef __cplusplus
       extern "C" {
    #endif
       void handler(_FEEDBACK *,_INT4 *,_INT4 *,_FEEDBACK *);
    #ifdef __cplusplus
       }
    #endif
    
    int main(void) {
    
      _FEEDBACK fc,condtok;
      _ENTRY routine;
      _INT4 token,qdata;
      _INT2 c_1,c_2,cond_case,sev,control;
      _CHAR3 facid;
      _INT4 isi;
    
      /* register condition handler */
      token = 99;
      routine.address = (_POINTER)&handler;;
      routine.nesting = NULL;
      CEEHDLR(&routine,&token,&fc);
      if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
          printf("CEEHDLR failed with message number %d\n",
                 fc.tok_msgno);
          exit(2999);
       }
      /* .
         .
         . */
      /* build the condition token */
      c_1 = 1;
      c_2 = 99;
      cond_case = 1;
      sev = 1;
      control = 0;
      memcpy(facid,"ZZZ",3);
      isi = 0;
      CEENCOD(&c_1,&c_2,&cond_case,&sev,&control,;
              facid,&isi,&condtok,&fc);
    
      if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
         printf("CEENCOD failed with message number %d\n",
                fc.tok_msgno);
         exit(2999);
      }
    
      /* ⋮ */
      /* signal the condition */
      CEESGL(&condtok,&qdata,&fc);
      if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
          printf("CEESGL failed with message number %d\n",
                 fc.tok_msgno);
          exit(2999);
       }
      /* ⋮ */
    }
    void handler(_FEEDBACK *fc, _INT4 *token, _INT4 *result,
                 _FEEDBACK *newfc) {
    
       _FEEDBACK orig_fc, itok_fc;
      /* ⋮ */
       /* get the original condition token */
       CEEITOK(&orig_fc, &itok_fc);
      if ( _FBCHECK ( itok_fc , CEE000 ) != 0 ) {
          printf("CEEITOK failed with message number %d\n",
                 itok_fc.tok_msgno);
          exit(2999);
       }
      /* ⋮ */
      *result = 10;
    }
  2. Following is an example of CEEITOKC called by COBOL.
    CBL LIB,QUOTE,NOOPT
          *Module/File Name: IGZTITOK
          *************************************************
          **                                             **
          ** Purpose:  Drive sample program for CEEITOK. **
          **                                             **
          *************************************************
           IDENTIFICATION DIVISION.
           PROGRAM-ID. DRVITOK.
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01  ROUTINE           PROCEDURE-POINTER.
           01  DENOMINATOR       PIC S9(9) BINARY.
           01  NUMERATOR         PIC S9(9) BINARY.
           01  RATIO             PIC S9(9) BINARY.
           01  TOKEN             PIC S9(9) BINARY VALUE 0.
           01  FC.
               02  Condition-Token-Value.
               COPY  CEEIGZCT.
                   03  Case-1-Condition-ID.
                       04  Severity    PIC S9(4) BINARY.
                       04  Msg-No      PIC S9(4) BINARY.
                   03  Case-2-Condition-ID
                             REDEFINES Case-1-Condition-ID.
                       04  Class-Code  PIC S9(4) BINARY.
                       04  Cause-Code  PIC S9(4) BINARY.
                   03  Case-Sev-Ctl    PIC X.
                   03  Facility-ID     PIC XXX.
               02  I-S-Info            PIC S9(9) BINARY.
    
           PROCEDURE DIVISION.
    
           REGISTER-HANDLER.
          *************************************************
          ** Register handler                            **
          *************************************************
               SET ROUTINE TO ENTRY "CBLITOK".
               CALL "CEEHDLR" USING ROUTINE, TOKEN, FC.
               IF  NOT CEE000 of FC  THEN
                   DISPLAY "CEEHDLR failed with msg "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               END-IF.
    
           RAISE-CONDITION.
          *************************************************
          ** Cause a zero-divide condition.              **
          *************************************************
               MOVE 0 TO DENOMINATOR.
               MOVE 1 TO NUMERATOR.
               DIVIDE NUMERATOR BY DENOMINATOR, GIVING RATIO.
           UNREGISTER-HANDLER.
          *************************************************
          ** UNregister handler                          **
          *************************************************
               CALL "CEEHDLU" USING ROUTINE, TOKEN, FC.
               IF NOT CEE000 of FC  THEN
                   DISPLAY "CEEHDLU failed with msg "
                       Msg-No of FC UPON CONSOLE
               END-IF.
               STOP RUN.
    
           END PROGRAM DRVITOK.
    
          *************************************************
          **                                             **
          ** Function: CEEITOK - Return initial          **
          **                     condition token         **
          **                                             **
          *************************************************
           IDENTIFICATION DIVISION.
           PROGRAM-ID. CBLITOK.
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01  ITOKEN.
               02  Condition-Token-Value.
               COPY  CEEIGZCT.
                   03  Case-1-Condition-ID.
                       04  Severity    PIC S9(4) BINARY.
                       04  Msg-No      PIC S9(4) BINARY.
                   03  Case-2-Condition-ID
                             REDEFINES Case-1-Condition-ID.
                       04  Class-Code  PIC S9(4) BINARY.
                       04  Cause-Code  PIC S9(4) BINARY.
                   03  Case-Sev-Ctl    PIC X.
                   03  Facility-ID     PIC XXX.
               02  I-S-Info            PIC S9(9) BINARY.
           01  FC.
               02  Condition-Token-Value.
               COPY  CEEIGZCT.
                   03  Case-1-Condition-ID.
                       04  Severity    PIC S9(4) BINARY.
                       04  Msg-No      PIC S9(4) BINARY.
                   03  Case-2-Condition-ID
                             REDEFINES Case-1-Condition-ID.
                       04  Class-Code  PIC S9(4) BINARY.
                       04  Cause-Code  PIC S9(4) BINARY.
                   03  Case-Sev-Ctl    PIC X.
                   03  Facility-ID     PIC XXX.
               02  I-S-Info            PIC S9(9) BINARY.
           LINKAGE SECTION.
           01  TOKEN                   PIC S9(9) BINARY.
           01  RESULT                  PIC S9(9) BINARY.
               88 RESUME                   VALUE 10.
           01  CURCOND.
               02  Condition-Token-Value.
               COPY  CEEIGZCT.
                   03  Case-1-Condition-ID.
                       04  Severity    PIC S9(4) BINARY.
                       04  Msg-No      PIC S9(4) BINARY.
                   03  Case-2-Condition-ID
                             REDEFINES Case-1-Condition-ID.
                       04  Class-Code  PIC S9(4) BINARY.
                       04  Cause-Code  PIC S9(4) BINARY.
                   03  Case-Sev-Ctl    PIC X.
                   03  Facility-ID     PIC XXX.
               02  I-S-Info            PIC S9(9) BINARY.
           01  NEWCOND.
               02  Condition-Token-Value.
               COPY  CEEIGZCT.
                   03  Case-1-Condition-ID.
                       04  Severity    PIC S9(4) BINARY.
                       04  Msg-No      PIC S9(4) BINARY.
                   03  Case-2-Condition-ID
                             REDEFINES Case-1-Condition-ID.
                       04  Class-Code  PIC S9(4) BINARY.
                       04  Cause-Code  PIC S9(4) BINARY.
                   03  Case-Sev-Ctl    PIC X.
                   03  Facility-ID     PIC XXX.
               02  I-S-Info            PIC S9(9) BINARY.
    
           PROCEDURE DIVISION USING CURCOND, TOKEN,
                                    RESULT, NEWCOND.
           PARA-CBLITOK.
               CALL "CEEITOK" USING ITOKEN, FC.
               IF  CEE000 of FC  THEN
                   DISPLAY "Initial condition has msg "
                       Msg-No of ITOKEN
               ELSE
                   DISPLAY "CEEITOK failed with msg "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               END-IF.
                PARA-HANDLER.
          ************************************************
          ** In user handler - resume execution         **
          ************************************************
               SET RESUME TO TRUE.
    
               GOBACK.
    
           END PROGRAM CBLITOK.
  3. Following is an example of CEEITOKC called by PL/I.
    *PROCESS OPT(0), MACRO;
     /* Module/File Name: IBMITOK                        */
     /****************************************************/
     /**                                                **/
     /** Function: CEEITOK - example of CEEITOK         **/
     /**                     invoked from PL/I ON-unit  **/
     /**                                                **/
     /****************************************************/
     IBMITOK:  PROCEDURE  OPTIONS(MAIN);
       %INCLUDE CEEIBMAW;
       %INCLUDE CEEIBMCT;
       DECLARE
          01 ITOKEN,                   /* Feedback token */
             03 MsgSev    REAL FIXED BINARY(15,0),
             03 MsgNo     REAL FIXED BINARY(15,0),
             03 Flags,
                05 Case      BIT(2),
                05 Severity  BIT(3),
                05 Control   BIT(3),
             03 FacID     CHAR(3),        /* Facility ID */
             03 ISI     /* Instance-Specific Information */
                      REAL FIXED BINARY(31,0),
          01 FC,                       /* Feedback token */
             03 MsgSev    REAL FIXED BINARY(15,0),
             03 MsgNo     REAL FIXED BINARY(15,0),
             03 Flags,
                05 Case      BIT(2),
                05 Severity  BIT(3),
                05 Control   BIT(3),
             03 FacID     CHAR(3),        /* Facility ID */
             03 ISI     /* Instance-Specific Information */
                      REAL FIXED BINARY(31,0),
          divisor     FIXED BINARY(31) INITIAL(0);
       ON  ZERODIVIDE  BEGIN;
          CALL CEEITOK ( ITOKEN, FC );
          IF  FBCHECK( FC, CEE000)  THEN  DO;
             PUT SKIP LIST('The initial condition for the '
                || 'current active block was message '
                || ITOKEN.MsgNo
                || ' for facility '|| ITOKEN.FacID );
             END;
          ELSE  DO;
             DISPLAY( 'CEEITOK failed with msg '
                || FC.MsgNo );
             CALL  CEEMSG( FC, 2, * );
             END;
          END /* ON ZeroDivide */;
       divisor = 15 / divisor  /* signals ZERODIVIDE */;
     END IBMITOK;

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014