Figure 1 shows an example of entry and exit code for a generic service.
MYSERV CSECT
MYSERV AMODE 31
MYSERV RMODE ANY
USING *,15
B PROLOG Branch around header text
DC C'some text'
DC C'compile date/time'
PROLOG EQU *
DROP 15
BSM R14,0
BAKR 14,0 Save callers info on stack
LAE 12,0 Clear access register 12
LR 12,15 Load reg 15 into 12
PROGSTRT EQU *
USING MYSERV,12 Set up base register
* addressability
.
.
.
Get dynamic area for program
.. STORAGE OBTAIN or CELLPOOL or own scheme ...
.
.
Free dynamic area for program
.
.
.
RETURN L 0,REASON_CODE Put reason code in reg 0
L 15,RETURN_CODE Put return code in reg 15
PR
The example uses the instructions BAKR and PR to replace standard linkage. With these instructions, you no longer need to pass the save area in a register.
If the callable service ends abnormally, ICSF takes a system dump. The ICSF service functional recovery routine (FRR) PROTECTS an installation-defined service. You can, however, write your own recovery routine.