The following example shows how an exit program can customize changing and deleting
journal receivers. This exit program only processes journal receivers when it is called
at the pre-change exit point (C1), the post-change exit point (C2), or the pre-check
exit point (D0).
When called at the pre-change exit point, the sample exit program handles changing any
journal receiver in library MYLIB. For any other journal library, MIMIX handles change
management processing.
When called at the post-change exit point, the exit program saves the recently detached
journal receiver if the journal is in library ABCLIB. (The recently detached journal
receiver was the attached receiver at the pre-change exit point.)
When called at the pre-check exit point, if the journal library is TEAMLIB, the exit
program saves the journal receiver to tape and allows MIMIX receiver delete management
to continue processing.
Sample journal receiver management
exit program
/*--------------------------------------------------------------*/
/* Program....: DMJREXIT */
/* Description: Example user exit program using CL */
/*--------------------------------------------------------------*/
PGM PARM(&RETURN &FUNCTION &JRNDEF &SYSTEM +
&RESERVED1 &JRNNAME &JRNLIB &RCVNAME +
&RCVLIB &SEQOPT &THRESHOLD &RESERVED2 +
&RESERVED3)
|
DCL VAR(&RETURN) TYPE(*CHAR) LEN(1)
DCL VAR(&FUNCTION) TYPE(*CHAR) LEN(2)
DCL VAR(&JRNDEF) TYPE(*CHAR) LEN(10)
DCL VAR(&SYSTEM) TYPE(*CHAR) LEN(8)
DCL VAR(&RESERVED1) TYPE(*CHAR) LEN(10)
DCL VAR(&JRNNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JRNLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&RCVNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&RCVLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&SEQOPT) TYPE(*CHAR) LEN(6)
DCL VAR(&THRESHOLD) TYPE(*DEC) LEN(15 5)
DCL VAR(&RESERVED2) TYPE(*CHAR) LEN(1)
DCL VAR(&RESERVED3) TYPE(*CHAR) LEN(1)
|
/*--------------------------------------------------------------*/
/* Constants and misc. variables */
/*--------------------------------------------------------------*/
DCL VAR(&STOP) TYPE(*CHAR) LEN(1) VALUE('0')
DCL VAR(&CONTINUE) TYPE(*CHAR) LEN(1) VALUE('1')
DCL VAR(&PRECHG) TYPE(*CHAR) LEN(2) VALUE('C1')
DCL VAR(&POSTCHG) TYPE(*CHAR) LEN(2) VALUE('C2')
DCL VAR(&PRECHK) TYPE(*CHAR) LEN(2) VALUE('D0')
DCL VAR(&PREDLT) TYPE(*CHAR) LEN(2) VALUE('D1')
DCL VAR(&POSTDLT) TYPE(*CHAR) LEN(2) VALUE('D2')
DCL VAR(&RTNJRNE) TYPE(*CHAR) LEN(165)
DCL VAR(&PRVRCV) TYPE(*CHAR) LEN(10)
DCL VAR(&PRVRLIB) TYPE(*CHAR) LEN(10)
|
/*--------------------------------------------------------------*/
/* MAIN */
/*--------------------------------------------------------------*/
CHGVAR &RETURN &CONTINUE /* Continue processing receiver*/
/*--------------------------------------------------------------*/
/* Handle processing for the pre-change exit point. */
/*--------------------------------------------------------------*/
IF (&FUNCTION *EQ &PRECHG) THEN(DO)
/*--------------------------------------------------------------*/
/* If the journal library is my library(MYLIB), exit program */
/* will do the changing of the receivers. */
/*--------------------------------------------------------------*/
IF (&JRNLIB *EQ 'MYLIB') THEN(DO)
IF (&THRESHOLD *GT 0) THEN(DO)
CRTJRNRCV JRNRCV(&RCVLIB/NEWRCV0000) +
THRESHOLD(&THRESHOLD)
CHGJRN JRN(&JRNLIB/&JRNNAME) +
JRNRCV(&RCVLIB/NEWRCV0000) SEQOPT(&SEQOPT)
ENDDO /* There has been a threshold change */
ELSE (CHGJRN JRN(&JRNLIB/&JRNNAME) JRNRCV(*GEN) +
SEQOPT(&SEQOPT)) /* No threshold change */
CHGVAR &RETURN &STOP /* Stop processing entry */
ENDDO /* &JRNLIB is MYLIB */
ENDDO /* &FUNCTION *EQ &PRECHG */
/*--------------------------------------------------------------*/
/* At the post-change user exit point if the journal library is */
/* ABCLIB, save the just detached journal receiver. */
/*--------------------------------------------------------------*/
ELSE IF (&FUNCTION *EQ &POSTCHG) THEN(DO)
IF COND(&JRNLIB *EQ 'ABCLIB') THEN(DO)
RTVJRNE JRN(&JRNLIB/&JRNNAME) +
RCVRNG(&RCVLIB/&RCVNAME) FROMENTLRG(*FIRST) +
RTNJRNE(&RTNJRNE)
/*----------------------------------------------------------*/
/* Retrieve the journal entry, extract the previous receiver*/
/* name and library to do the save with. */
/*----------------------------------------------------------*/
CHGVAR &PRVRCV (%SUBSTRING(&RTNJRNE 126 10))
CHGVAR &PRVRLIB (%SUBSTRING(&RTNJRNE 136 10))
SAVOBJ OBJ(&PRVRCV) LIB(&PRVRLIB) DEV(TAP02) +
OBJTYPE(*JRNRCV) /* Save detached receiver */
ENDDO /* &JRNLIB is ABCLIB */
ENDDO /* &FUNCTION is &POSTCHG */
/*--------------------------------------------------------------*/
/* Handle processing for the pre-check exit point. */
/*--------------------------------------------------------------*/
ELSE IF (&FUNCTION *EQ &PRECHK) THEN(DO)
IF (&JRNLIB *EQ 'TEAMLIB') THEN( +
SAVOBJ OBJ(&RCVNAME) LIB(&RCVLIB) DEV(TAP01) +
OBJTYPE(*JRNRCV))
ENDDO /* &FUNCTION is &PRECHK */
ENDPGM
|