|
CEE3GRN gets the name
of the most current Language Environment-conforming
routine where a condition occurred. If there are nested conditions,
the most recently signaled condition is used.
Syntax
>>-CEE3GRN--(--name--,--fc--)----------------------------------><
- name (output)
- A fixed-length 80-character string (VSTRING), that contains the
name of the routine that was executing when the condition was raised. name is
left-justified within the field and right-padded with blanks. If there
are nested conditions, the most recently activated condition is used
to determine name.
- 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 consideration—In
multithread applications, CEE3GRN gets the name of the routine that
incurred the condition on the current thread.
Examples - Following is an example of CEE3GRN called by C/C++.
/*Module/File Name: EDC3GRN */
#include <stdio.h>
#include <string.h>
#include <leawi.h>
#include <stdlib.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);
}
/*
⋮ *//* set up any condition sev 2 or higher */
c_1 = 3;
c_2 = 99;
cond_case = 1;
sev = 3;
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 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) {
_CHAR80 name;
_FEEDBACK grnfc;
/* get name of the routine that signal the */
/* condition */
CEE3GRN(name,&grnfc);
if ( _FBCHECK ( grnfc , CEE000 ) != 0 ) {
printf("CEESGL failed with message number %d\n",
grnfc.tok_msgno);
exit (2999);
}
printf("the routine that called this condition");
printf(" handler is:\n %.80s\n",name);
*result = 10;
return;
}
- Following is an example of CEE3GRN called by COBOL.
CBL LIB,QUOTE,NOOPT
*Module/File Name: IGZT3GRN
*************************************************
** **
** DRV3GRN - Drive sample program for CEE3GRN. **
** **
*************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. DRV3GRN.
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 "CBL3GRN".
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 DRV3GRN. *************************************************
** **
** CBL3GRN - Call CEE3GRN to get the name of **
** the routine that incurred **
** the condition. **
** **
*************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CBL3GRN.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 RNAME PIC X(80).
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-CBL3GRN.
CALL "CEE3GRN" USING RNAME, FC.
IF CEE000 of FC THEN
DISPLAY "Name of routine which "
"incurred the condition is: " RNAME
ELSE
DISPLAY "CEE3GRN 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 CBL3GRN.
- Following is an example of CEE3GRN called by PL/I.
*PROCESS OPT(0), MACRO;
/* Module/File Name: IBM3GRN */
/****************************************************/
/** **/
/** Function: CEE3GRN - example of CEE3GRN **/
/** invoked from PL/I ON-unit **/
/** **/
/****************************************************/
IBM3GRN: PROCEDURE OPTIONS(MAIN);
%INCLUDE CEEIBMAW;
%INCLUDE CEEIBMCT;
DECLARE
RNAME CHAR(80),
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 CEE3GRN to get the name of the routine */
/* that incurred the most recently signalled */
/* condition */
CALL CEE3GRN ( RNAME, FC );
IF FBCHECK( FC, CEE000) THEN DO;
PUT SKIP LIST( 'The most recently signalled '
|| 'condition was incurred by ' || RNAME );
END;
ELSE DO;
DISPLAY( 'CEE3GRN failed with msg '
|| FC.MsgNo );
END;
END /* ON ZeroDivide */;
divisor = 15 / divisor /* signals ZERODIVIDE */;
END IBM3GRN;
|