Home Interview Questions and Answers JCL Interview Questions and Answers For Freshers Part-1

jcl1.There is a concatenated input DD name with 3 datasets. How to override only one dataset in those 3 datasets?
Specify DD DUMMY in the overriding JCL for the ones, which are not overridden.

//STEP1.IN1 DD DUMMY
// DD DSN=MYDATA.URMI.IN2,DISP=SHR
// DD DUMMY

2.Current version of a GDG is used as input in step1 of a job and a new version is created as output. The output of step1 is used in step2 and the next version is created as output in step2. How do you reference each GDG version in each step?
Following piece of code shows the reference of each GDG version −

Step1 input: (0)
Step1 output: (+1)
Step2 input: (+1)
Step2 output: (+2)

3.How can you check if a file is empty using JCL?
When the file is used as input in IDCAMS, job completes with a warning (return code 4) if the file is empty.

4.A JCL has 4 steps and job abends. How to restart the job and run only step 2?
Specify RESTART = STEP2 in JOB statement. And include IF-THEN-ELSE construct as below−

//URMIIF JOB 1, CLASS=6, MSGCLASS=0, NOTIFY = &SYSUID,RESTART=STEP2
//*
//STEP1 EXEC
//STEP2 EXEC
//IF1 IF (STEP2.RC = 0 & STEP2.RC <> 0) THEN
//STEP3 EXEC
//STEP4 EXEC
//ENDIF

5.What are the ways of passing data to a COBOL program from JCL?
Data can be passed to a COBOL program through files, PARM parameter and SYSIN DD statement.

6.How can the same PROC be re-used and called by many JOBs?
The varying portion of the JCL can be specified using symbolic parameters in the JOB and the static parts can be specified in the PROC. For example, if the file name changes for every JOB that uses the PROC, then the varying portion of the file name can be coded in JCL using symbolic parameter.

//IN1 DD DSN = &ID.URMI.IN1, DISP = SHR //*Coded in PROC
ID=MYDATA1 is coded in JOB1, ID = MYDATA2 is coded in JOB2 and so on

7.How do you create a dataset in a JCL with the same file organisation as that of another existing dataset?
Use IEBGENER and pass existing file in SYSUT1. Pass new file in SYSUT2 and mention DCB=*.SYSUT1 to get the same DCB as that of SYSUT1 dataset.

8.How do you access an uncataloged dataset in a JCL?
By using the UNIT and VOL serial parameters in the dataset DD statement.

9.What are the statements that are not valid to be included in an INCLUDE statement?
Dummy DD statements, data card specifications, PROCs, JOB, PROC statements cannot be coded within an INCLUDE member. An INLCUDE statement can be coded within an INCLUDE member and further nesting can be done up to 15 levels.

10.A JCL has 2 steps. How to code the JCL such that if step1 abends, then step2 runs. Else, job terminates with step1?
Code COND = ONLY in STEP2.

You may also like

Leave a Comment