Sample code for a TRUE invoked at CICS termination
Note that the sample in Figure 1 is
a multipurpose program—that is, it is coded to be invoked at many task-related
user exit invocation points. However, to avoid the need to test for CICS® abends in
all of your multipurpose TRUEs, it is recommended that you use a separate
program for termination invocations. Figure 1. Sample code
for a task-related user exit program to be invoked at CICS termination (part 1)
JTRUE1A CSECT TERMINATION TRUE ENTRYPOINT
STM 14,12,12(13) Save registers
USING JTRUE1A,R3
LR R3,R15 Use R3 as base register
USING DFHUEPAR,R1 Address DFHUEPAR parameter list
L R2,UEPEXN
USING DFHUERTR,R2
CLI UERTFID,UERTCTER CICS Termination call?
BNE CONT No, so continue
L R10,UEPHMSA Address Host register save area
USING SA,R10
L R5,RSAR1 Get Caller's R1
USING DFHCTERM,R5
L R5,CTERML Get termination type
USING CTERMLIST,R5
TM CTERMTYPE,UERTCORD CICS orderly shutdown?
BO CONT Yes, so can use CICS services
TM CTERMTYPE,UERTCIMM CICS immediate shutdown?
BO CONT Yes, so can use CICS services
* ...
* ...
* Insert code here for any processing when CICS is abending
* (No CICS services should be used)
* ...
* ...
LM 14,12,12(13) Restore caller's registers
BSM 0,14 Return to caller
CONT DS 0H Continue in new CSECT
LM 14,12,12(13) Restore callers's registers
DROP R3
USING JTRUE1A,R15 Use R15 as temporary base register
L R15,=V(JTRUE1B) Get address of new CSECT
BR R15 Branch to new CSECT
DROP R15
LTORG
JTRUE1B CSECT POST TEST CSECT
DFHEIENT
LR R4,R1 Use R4 to address parm list
USING DFHUEPAR,R4 Address parm list
L R5,UEPEXN
USING DFHUERTR,R5
MVC DFHEIBP,UEPEIB
MVC DFHEICAP,=X'80000000'
* .....
* Insert code here for all types of call other than when CICS
* is abending
* (CICS services can be used)
* .....
EXIT DS 0H
DFHEIRET
*
LTORG
*
DFHCTERM DSECT
CTERML DS A
*
CTERMLIST DSECT
CTERMTYPE DS CL1
*
Figure 2. Sample code for a task-related user exit program to be invoked
at CICS termination (part 2)
DFHEISTG DSECT
*
* Local working storage for CSECT JTRUE1B
*
RSA DS 18F Register save area
SA DSECT Register save area DSECT
DS F
*
RSACB DS F +004
RSACF DS F +008
RSAR14 DS F +00C
RSAR15 DS F +010
RSAR0 DS F +014
RSAR1 DS F +018
RSAR2 DS F
RSAR3 DS F
RSAR4 DS F
RSAR5 DS F
RSAR6 DS F
RSAR7 DS F
RSAR8 DS F
RSAR9 DS F
RSAR10 DS F
RSAR11 DS F
RSAR12 DS F
DFHREGS
DFHUEXIT TYPE=RM
DFHEISTG
DFHEIEND
PRINT NOGEN
PRINT GEN
END