CEEHDLU—Unregister user-written condition handler

CEEHDLU unregisters a user condition handler for the current stack frame. You do not necessarily need to use CEEHDLU to remove user-written condition handlers you registered with CEEHDLR. Any user-written condition handlers created through CEEHDLR and not unregistered by CEEHDLU are unregistered automatically by Language Environment, but only when the associated stack frame is removed from the stack.

Note: For information about restrictions on the use of CEEHDLU with PL/I, see z/OS Language Environment Programming Guide.
Read syntax diagramSkip visual syntax diagram
Syntax

>>-CEEHDLU--(--routine--,--fc--)-------------------------------><

routine (input)
An entry variable or constant for the routine to be unregistered as a user condition handler. This routine must be previously registered (with CEEHDLR) by the same stack frame that invokes CEEHDLU.
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.
CEE07S 1 0252 CEEHDLU was unable to find the requested user-written condition handler routine.

Usage notes

  • PL/I MTF consideration—CEEHDLU is not supported in PL/I MTF applications. This includes any CEEHDLR service called from a COBOL program in the application.
  • z/OS UNIX consideration—In multithread applications, CEEHDLU affects only the calling thread.

For more information

Examples

  1. Following an example of CEEHDLU called by C/C++.
    /*Module/File Name: EDCHDLU   */
    
    #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;
      _ENTRY routine;
      _INT4 token;
    
      /* set the routine structure to point to the handler */
      /* and use CEEHDLR to register the user handler      */
    
      token = 99;
      routine.address = (_POINTER)&handler;;
      routine.nesting = NULL;
    
      CEEHDLR(&routine,&token,&fc);
    
      /* verify that CEEHDLR was successful */
      if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
         printf("CEEHDLR failed with message number %d\n",
                fc.tok_msgno);
         exit (2999);
      }
     /* ⋮  */
      /* Unregister the condition handler */
      CEEHDLU(&routine,&fc);
    
      /* verify that CEEHDLU was successful */
      if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
         printf("CEEHDLU failed with message number %d\n",
                fc.tok_msgno);
         exit (2999);
      }
     /* ⋮  */
    }
    
    void handler(_FEEDBACK *fc, _INT4 *token, _INT4 *result,
                 _FEEDBACK *newfc) {
     /* ⋮  */
    }
  2. Following is an example of a COBOL program that unregisters a user-written condition handler.
    CBL LIB,QUOTE
          *Module/File Name: IGZTHDLU
          *************************************************
          **                                             **
          ** CBLHDLU - Call CEEHDLU to unregister a user **
          **           condition handler                 **
          **                                             **
          ** In this example, a call is made to CEEHDLU  **
          ** to unregister a user condition handler      **
          ** previously registered using CEEHDLR.        **
          **                                             **
          *************************************************
           IDENTIFICATION DIVISION.
           PROGRAM-ID. CBLHDLU.
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01  ROUTINE                 PROCEDURE-POINTER.
           01  TOKEN                   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.
    
           PROCEDURE DIVISION.
           PARA-CBLHDLR.
               SET ROUTINE TO ENTRY "HANDLER".
               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
               ELSE
                   DISPLAY "HANDLER REGISTERED"
               END-IF.
    
          *      ⋮
           PARA-CBLHDLU.
               CALL "CEEHDLU" USING ROUTINE, FC.
               IF NOT CEE000 of FC  THEN
                   DISPLAY "CEEHDLU failed with msg "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               ELSE
                   DISPLAY "HANDLER UNREGISTERED"
               END-IF.
    
               GOBACK.
    
           END PROGRAM CBLHDLU.
  3. Following is an example of a COBOL user-written condition handler that is registered by CBLHDLR and unregistered by CBLHDLU.
    CBL LIB,QUOTE,NOOPT,NODYNAM
          *Module/File Name: IGZTHAND
          *************************************************
          **                                             **
          ** DRVHAND - Drive sample program for COBOL    **
          **           user-written condition handler.   **
          **                                             **
          *************************************************
           IDENTIFICATION DIVISION.
           PROGRAM-ID. DRVHAND.
           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 "HANDLER".
               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.
              DISPLAY "Execution continues following "
                   "divide-by-zero exception".
            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 DRVHAND.
    
           IDENTIFICATION DIVISION.
           PROGRAM-ID. HANDLER.
           DATA DIVISION.
           WORKING-STORAGE SECTION.
    
           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-HANDLER.
               DISPLAY "Entered user handler for condition"
                  " with message number " Msg-No Of CURCOND
                  " -- will resume execution".
               SET RESUME TO TRUE.
    
               GOBACK.
           END PROGRAM HANDLER.