How to automatically restart a job in case of S0C7 Abend
z/OS Batch environment
Customer needs to use restart feature when S0C7 abend occurs
COMMIT control based on the number of records read from a sequential file, with automatic restart in case of an S0C7 ABEND
Program Flow
The program reads the file SEQ001 sequentially. For each record read:
a) Updates the corresponding record in the VSAMKS file;
b) Update corresponding record in DB2 TABLE;
c) Writes a line to the REPORT file.
JCL
//JOB000O3 JOB (1),SMRT,CLASS=A,MSGCLASS=X
//* ALLOCATE GDG FILE USED AS OUTPUT IN THE NEXT STEP
//DEFINE EXEC PGM=IEFBR14
//OUTFILE DD DSN=VALOD02.DEMO.RAI.DEMOPK.REPORT(+1),
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(15,15),RLSE),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//SYSPRINT DD SYSOUT=*
/*
//*--------------------------------------------------------------------*
//* RUN COBOL APPLICATION WITH SMART/RESTART
//*--------------------------------------------------------------------*
//MAIN EXEC PGM=SAMPLEO3
//*
//STEPLIB DD DISP=SHR,DSN=SHARE.USER.LOAD
// DD DISP=SHR,DSN=SHARE.RAI.R200.DCAEXIT
// DD DISP=SHR,DSN=SHARE.RAI.R200.CRAILOAD
// DD DISP=SHR,DSN=SHARE.RAI.R200.CRAIDCA
// DD DISP=SHR,DSN=DB66.PRIVATE.SDSNEXIT
// DD DISP=SHR,DSN=SHARE.DB2.DB2C10.SDSNLOAD
// DD DISP=SHR,DSN=CEE.SCEERUN
// DD DISP=SHR,DSN=CEE.SCEERUN2
//*
//*SRSOFF DD DUMMY <------------------
//*
//SYSOUT DD SYSOUT=*
//SRSPRINT DD SYSOUT=*
//SRSDUMP DD DUMMY
//SYSUDUMP DD SYSOUT=*
//*
//SRSCHECK DD DISP=SHR,DSN=SHARE.USER.DCACKPTV
//SRSSKIP DD DISP=SHR,DSN=SHARE.USER.DCASKIP --> USED TO WRITE RECORDS DISCARDED IN PROCESSING
//SEQ001 DD DISP=SHR,DSN=SHARE.USER.SEQ001
//VSAMKS DD DISP=SHR,DSN=SHARE.USER.VSAMKS
//REPORT DD DISP=OLD,DSN=SHARE.USER.REPORT(+1)
//RAINPUT DD *
PRINT_CNTL(YES) -----+
MSGDD(SRSPRINT) |
MSG_DISPLAY(DEBUG) |
* |
DBMS(DB2) > GENERAL USE PARAMETERS. CAN BE CONFIGURED IN THE SYSTEM DEFAULT PANELS
RMI(SRSRDB2) |
ATTACH(RRSAF) |
SYSTEM(DB66) |
PLANEXIT(NONE) |
INIT_STYLE(END) |
VERIFY_JID(NO) -----+
*
* CLEAR_CKPT(BEFORE) --> FORCE CHECKPOINT FILE CLEAN
*
PLAN(DEMORAI)
COMMIT_FILE(COUNT,SEQ001,10) --> PERFORMS A COMMIT EVERY 10 RECORDS (SEQ001) READ
VSAM_SEQ_OUT(REPOSITION) --> REPOSITIONS VSAM FILES THAT HAVE BEEN SET AS OUTPUT
RECOVER(ONLY,(VSAMKS)) --> RECOVERY FOR NON-SEQUENTIAL VSAM FILES
REPOSITION(ALL) --> REPOSITIONS SEQUENCE FILES
SKIP_RECORD(SKIP,INFILE,ONLY) --> IN CASE OF ABEND IGNORE THE RECORD
REPO_STYLE(AFTER,ALL) --> RESTART FROM NEXT RECORD
ABEND_TRAP((S0C7,R)) --> AUTOMATIC RESTART IN CASE OF ABEND S0C7
AUTO_RECOVER(ON,5) --> LIMITS THE NUMBER OF AUTOMATIC RESTARTS TO 5
**