Some control interval splits involve data being moved to two new
control intervals, and control area splits normally involve many control
intervals' contents being moved. In these cases, VSAM exits to the
JRNAD routine for each separate movement of data to a new control
interval.
You might also want to use the JRNAD exit to maintain shared or
exclusive control over certain data or index control intervals; and
in some cases, in your exit routine you can reject the request for
certain processing of the control intervals. For example, if you used
this exit to maintain information about a data set in a shared environment,
you might reject a request for a control interval or control area
split because the split might adversely affect other users of the
data set.
Figure 1 is a skeleton program
USERPROG with a user exit routine USEREXIT. It demonstrates the use
of the JRNAD exit routine to cancel a request for a control interval
or control area split.
Figure 1. Example of a JRNAD exit Part 1 of 2USERPROG CSECT
SAVE(R14,R12) Standard entry code
.
.
.
BLDVRP BUFFERS=(512(3)), Build resource pool X
KEYLEN=4, X
STRNO=4, X
TYPE=LSR, X
SHRPOOL=1, X
RMODE31=ALL
OPEN (DIRACB) Logically connect KSDS1
.
.
.
PUT RPL=DIRRPL This PUT causes the exit routine USEREXIT
to be taken with an exit code X'50' if
there is a CI or CA split
LTR R15,R15 Check return code from PUT
BZ NOCANCEL Retcode = 0 if USEREXIT did not cancel
CI/CA split
= 8 if cancel was issued, if
we know a CI or CA split
occurred
.
. Process the cancel situation
.
NOCANCEL . Process the noncancel situation
.
.
CLOSE (DIRACB) Disconnect KSDS1
DLVRP TYPE=LSR,SHRPOOL=1 Delete the resource pool
.
.
.
RETURN Return to caller.
.
.
.
DIRACB ACB AM=VSAM, X
DDNAME=KSDS1, X
BUFND=3, X
BUFNI=2, X
MACRF=(KEY,DDN,SEQ,DIR,OUT,LSR), X
SHRPOOL=1, X
EXLST=EXITLST
Figure 2. Example of a JRNAD exit Part 2 of 2*
DIRRPL RPL AM=VSAM, X
ACB=DIRACB, X
AREA=DATAREC, X
AREALEN=128, X
ARG=KEYNO, X
KEYLEN=4, X
OPTCD=(KEY,DIR,FWD,SYN,NUP,WAITX), X
RECLEN=128
*
DATAREC DC CL128'DATA RECORD TO BE PUT TO KSDS1'
KEYNO DC F'0' Search key argument for RPL
EXITLST EXLST AM=VSAM,JRNAD=(JRNADDR,A,L)
JRNADDR DC CL8'USEREXIT' Name of user exit routine
END End of USERPROG
USEREXIT CSECT On entry to this exit routine, R1 points
to the JRNAD parameter list and R14 points
back to VSAM.
.
. Nonstandard entry code -- need not save
. the registers at caller's save area and,
. since user exit routines are reentrant for
. most applications, save R1 and R14 at some
. registers only if R1 and R14 are to be
. destroyed
.
CLI 20(R1),X'50' USEREXIT called because of CI/CA split?
BNE EXIT No. Return to VSAM
MVI 21(R1),X'8C' Tell VSAM that user wants to cancel split
.
.
.
EXIT . Nonstandard exit code -- restore R1 and
. R14 from save registers
BR R14 Return to VSAM which returns to USERPROG
if cancel is specified
END End of USEREXIT