Using the ReAttach feature
Transparent mode has a special ReAttach feature which has the ability to automatically recover from certain errors and ABENDs without the job step ever failing. This feature reduces operator intervention and unnecessary delays for restarts that don’t require programmer intervention.
By running under program QSATTACH, instead of under program QSTART, Transparent Mode applications can be retried after DB2 SQLCODE -911 and IMS U0777 deadlock/timeout errors and S0C7 or S0C9 ABENDs which were caused by bad data being read on the input driver file. In the case of the -911 SQLCODE and IMS U0777, the application is automatically restarted.
Software requirements for using the ReAttach feature:
- The application must follow the compile rules of Transparent Mode.
Features of ReAttach:
- Automatic in-flight Retries for DB2 and IMS Deadlock/Timeout errors. Number of retries set by installation option. Default=5.
- Automatic in-flight Recoveries for S0C7/S0C9 ABENDs due to bad data on the driver input sequential file. The failing Logical Unit of Work (LUW) is backed out and skipped upon restart. A User Exit may write the failing LUW out to an error file.
In the case of the S0C7/S0C9 ABENDs, the application is automatically restarted and the LUW on the input file is skipped. This LUW is considered to be one record unless the CALLCKPTAFTER=EXIT parameter of the QSCTRL1 SYSIN is used. Then the exit determines the size of the LUW. In that case, the exit is informed of the first record in the bad LUW and the exit specifies which records to skip. See member SAMEXIT2 on SAMPLIB for an example LUW exit which contains logic to skip bad data LUW’s. This exit also makes use of module QSPUT to write the bad records out to an error
file.
DB2 -911 and IMS U0777 retry support is provided automatically when using QSATTACH. S0C7 and S0C9 retry support is provided only for Transparent mode applications and must follow all rules for Transparent Mode applications. To specify support for S0C7 and S0C9 retries, use the QSCTRL1 SYSIN cards:
RECOVER=0C7
RECOVER=0C9
Both are optional cards which will enable retries of the specific ABENDs. Up to 5 retries will be attempted. This number is alterable as a shop default.
To use the ReAttach feature, specify PGM=QSATTACH on the EXEC card and specify a parm in the form of:
PARM=’dsnxN1’
where dsnx is the four-character DB2 subsystem id (ssid) to connect to.
Example: EXEC PGM=QSATTACH,PARM='DSNTN1'
If DB2 ssid is less than four characters, fill the remaining character spaces with blanks.
Example JCL Using Transparent Mode with the ReAttach Feature which automatically recovers from -911 SQLCODEs and additionally attempts to recover from 0C7 ABENDs caused by bad data on the driver file:
//STEP1 EXEC PGM=QSATTACH,PARM='DSNTN1'
//STEPLIB DD DSN=PROD.LOADLIB,DISP=SHR
// DD DSN=QSTART.LOADLIB,DISP=SHR
//INFILE DD DSN=PROD.INPUT.FILE,DISP=SHR
//OUTFILE DD DSN=PROD.OUTPUT.FILE,DISP=(MOD,CATLG,CATLG),...
//REPORT DD SYSOUT=*
//QSTART DD DSN=hlq.jobname,UNIT=SYSDA,SPACE=(TRK,0)
//QSREPT DD SYSOUT=*
//ERRFILE DD DSN=file.to.hold.bad.data.recs,DISP=(MOD,CATLG,CATLG),
// DCB=*.INFILE
//QSCTRL1 DD *
MAINPROG=YOURPROG
SUBPROG=PRODSUB1
DRIVERDD=INFILE
WSRESTORE=FIRST
EXCLUDEDD=REPORT
CALLCKPTAFTER=EXIT
RECOVER=0C7
PLAN=YOURPROG
PARM='001B'
In the example above, an exit program has been specified to route bad records to a dataset referenced by the ERRFILE DD. Since the bad records will be coming from the input file, the ERRFILE has the same attributes as INFILE.
Example JCL Using a QUICKSTART ready Application with the ReAttach Feature to recover from -911 SQLCODES, and using a DSNPARMS DD card to determine the Plan name. (The subsystem ID is ignored)
//STEP1 EXEC PGM=QSATTACH,PARM='DSNTY1'
//STEPLIB DD DSN=PROD.LOADLIB,DISP=SHR
// DD DSN=QSTART.LOADLIB,DISP=SHR
//INFILE DD DSN=PROD.INPUT.FILE,DISP=SHR
//OUTFILE DD DSN=PROD.OUTPUT.FILE,DISP=(MOD,CATLG,CATLG),...
//REPORT DD SYSOUT=*
//QSTART DD DSN=hlq.ANY.NAME,UNIT=SYSDA,SPACE=(TRK,0)
//DSNPARMS DD DSN=hlq.DSNT.YOURPROG.jobname,UNIT=SYSDA,SPACE=(TRK,0)
//QSREPT DD SYSOUT=*
//QSCTRL1 DD *
MAINPROG=YOURPROG
PARM='001B'
WSRESTORE=COMMIT
CALLCKPTAFTER=2
Related topic