Sunday, 28 July 2013

JCL Restart Parameter.| RESTART in JCL | JCL RESTART Example.

JCL Restart COND
JCL Restart Parameter.

Today's tutorial. I will discuss the JCL RESTART Parameter. When a program Abends or the system fails, you may need to restart a job from the point where the failure occurred. OS/390 provides various facilities for doing that. So, let's start with the tutorial.

How to restart a job?

Jobs may terminate before they complete due to a program or system error. In either case, it’s possible to restart a job at a point other than at the beginning. To be specific, you can restart a job from a designated step (a step restart), or you can restart a step from a checkpoint within a program (a checkpoint restart). OS/390 provides two parameters for restarting a job. 

The RESTART parameter can be coded on the JOB statement to handle job failures, while the RD parameter can be coded on the JOB or EXEC statement to handle job or system failures. In addition, JES2 and JES3 both provide statements that restart jobs automatically in case of a system failure.

How to code checkpoints in your jobs?

Whenever you set-up the checkpoints for individual jobs-steps, the status of the executing program is stored periodically in a data-set assigned for that purpose. In case, the job terminates without successfully completing the job-step, it must be restarted from the last recorded checkpoint rather than having to start at the beginning of the step again.

  • Checkpoints can be set up on individual job steps so that periodic snapshots are taken of the executing program’s status and are stored in a designated data set. If the job terminates for whatever reason, it can be restarted from the last recorded checkpoint rather than from the beginning of the step.
  • Not all programming languages allow checkpoint recording. For those that do, refer to their language reference manuals for specific instructions on how to set up a checkpoint.
  • Use the CHKPT parameter on the DD statement to record a checkpoint whenever a multi-volume sequential data set reaches the end of a volume. Checkpoints are written for each volume except the last.
  • If you use the CHKPT parameter on a DD statement, be sure to include an SYSCKEOV DD statement that defines the data set where the checkpoints are stored. The SYSCKEOV data set must be a sequential or partitioned data set defined with DISP=MOD so that each new checkpoint is written beyond the previous one.

COBOL
Use the RERUN clause in the I-O-CONTROL paragraph of the Input-Output Section to generate checkpoints within a COBOL program. The ddname for the data-set that stores the checkpoints are specified in the RERUN clause.
PL/I
Use the CALL PLICKPT feature to generate checkpoints within a PL/I program. The ddname for the checkpoint the data set is SYSCHK.


The syntax for the CHKPT parameter of the DD statement CHKPT=EOV EOV - Requests a checkpoint at the end of the volume. 

A job step with end-of-volume checkpoints
//STEP1    EXEC PGM=EMPUPD
//INVOUT   DD   DSN=RC01.PAYINV.OUT,DISP=(NEW,KEEP,DEL),
//              UNIT=TAPE,VOL=SER=(TAPE01,TAPE02),CHKPT=EOV
//SYSCKEOV DD   DSN=CHECK.SAVE,DISP=MOD

RESTART parameter

The JOB RESTART parameter allows you to restart the job from a specified job step, procedure step, or checkpoint within a job step.

The syntax for the RESTART parameter of the JOB statement.

RESTART= ({* } [,checkid] )
         {stepname }
         {stepname.procstepname}

The two ways to use the RESTART parameter

A deferred step restart

//RCR01F JOB (99912),'RC TCTRNDEZ',RESTART=STEP3 
//RCR01G JOB (99912),'RC TRTELEOR',RESTART=STEP3.INV3020

A deferred checkpoint restart

//RCR01H JOB (99912),'A XYX', RESTART=(STEP2,CKPT4)
//SYSCHK   DD DSNAME=RC01.INFILE.CHECK,DISP=(OLD)

RD parameter for automatic restarts.

If a job abends due to a program or system failure, the entire job or the individual job steps within it can be automatically restarted if you code the RD parameter on the JOB or EXEC statement. The RD 
parameter can also be used to control checkpoint restarts. 

To have a job automatically restart after a system failure, code RD=R or RD=RNC on either the JOB or EXEC statement. If coded in the JOB statement, all of the job steps in the job are restarted. If coded on the EXEC statement, only the individual job step is restarted. An RD parameter in the JOB statement overrides any RD parameters specified in the EXEC statements. 

The system can perform an automatic restart on a job only if the job has a job journal. A job journal is a sequential data set that contains job-related control blocks needed for the restart. It’s an internal system file that’s not part of your JCL. 

Specifying RD=NR or RD=NC will prevent an automatic restart from occurring, so you’ll probably never code it that way. 

The syntax for the RD parameter of the JOB and EXEC statements

RD= {R} {RNC} {NR} {NC}

R
Restart, checkpoints allowed. This option allows the system to automatically restart execution of a job or job step from the beginning or from the last checkpoint.
RNC
Restart, no checkpoints. This option allows the system to perform an automatic step restart when the job or job step fails. Automatic and deferred checkpoint restarts aren’t allowed.
NR
No automatic restart, checkpoints allowed. This parameter suppresses automatic restarts but permits deferred checkpoint restarts.
NC
No automatic restart, no checkpoints. This option indicates that the system can’t perform an automatic step restart if the job or job step fails and that checkpoint restarts aren’t allowed.

The system will perform an automatic restart on a job or job step when:

- RD=R or RD=RNC is present on a JOB or EXEC statement
- The step to be restarted as a restartable abend code
- The operator authorizes the restart


A JOB statement that uses the RD parameter

//RC01RA JOB (99912),'RCTXIE',RD=R
An EXEC statement that uses the RD parameter

//STEP2 EXEC PGM=EMPOUPD,RD=RNC


No comments:

Post a comment