Example 2

The following example shows the JCL and control statements required to copy to the output data set all the records written to a CICS general log. The records are copied in the CICS/ESA 4.1 format, and then deleted from the log stream.

Note that there are two jobsteps, the first to perform the copy step, and the second to perform the delete step. The delete step is dependent upon the copy step completing successfully. Also, the same TO= value is specified on both jobstep's SUBSYS card. This ensures that both jobs manipulate the same range of log data.

If TO= is omitted, and allowed to default to the current end of the logstream, there is the possibility of new log data being written to the logstream after the copy step, but before the delete step; this would then be deleted. To avoid this, it is recommended that the same TO= value be used for both jobsteps. Also, to avoid having to modify the TO= value every time the job is submitted, the year and Julian date are not specified. This causes the job to default to today's date. Therefore, the recommendation is to submit the job soon after the time specified on the TO= value. It should be noted that a TO= value close to midnight may cause problems. If the copy step were to run just before midnight, and the delete step just after midnight, the TO= value would default to different days, and there would be the potential for uncopied data being deleted.

Figure 1. DFHJUP program, example 2
//JNLCOPY1 JOB (accounting information),CLASS=A
//COPYJNL   EXEC PGM=DFHJUP
//STEPLIB   DD DSNAME=CICSTS54.CICS.SDFHLOAD,DISP=SHR
//SYSPRINT  DD SYSOUT=A,DCB=RECFM=FBA
//SYSUT1    DD DSNAME=CICSAA#.CICSDC1.JRNL001,
//             DCB=BLKSIZE=32760,
//             SUBSYS=(LOGR,DFHLGCNV,'TO=(,10:00)',COMPAT41)
 //SYSUT4    DD DSNAME=EXAMPLE1.COPY1,DISP=(NEW,CATLG),
//             UNIT=SYSDA,VOL=SER=USRPAK,
//             SPACE=(TRK,(3,1))
//SYSIN     DD *
*-----------------------------------------------------*
*    CONTROL STATEMENT : DEFAULTS           *
*                INPUT = SYSUT1                       *
*               OUTPUT = SYSUT4                       *
* SELECTION QUALIFIERS :                              *
*           1. DEFAULT = ALL INPUT RECORDS            *
*-----------------------------------------------------*
OPTION COPY
END
//CHKCOPY IF (COPYJNL.RC = 0) THEN
//IEFBR14   EXEC PGM=IEFBR14
//LOGSTRM DD DSNAME=CICSAA#.CICSDC1.JRNL001,
//         SUBSYS=(LOGR,DFHLGCNV,'TO=(,10:00)',DELETE)
//CHKCOPY ENDIF
*-----------------------------------------------------*
/*