JCL Technical Interview Questions Answers


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

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)

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.

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

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.

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


How do you create a dataset in a JCL with the same file organization 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.


How do you access an uncataloged dataset in a JCL?

By using the UNIT and VOL serial parameters in the dataset DD statement.


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.


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.


How to do automated RESTART when a job abends?

Using RD parameter in JOB/EXEC statement. The abend codes for which RESTART need to be performed can be mentioned in the SCHEDxx member of the IBM system parmlib library.


A JCL has 10 steps. How to run step3 and step7 (only) without using COND parameter or IF-THEN-ELSE?

Using IEBEDIT in a JCL, selected steps of another JCL can be run. In the above JCL, the input JCL with 10 steps is present in MYDATA.URMI.JOBS(INPUTJOB). STEP3 and STEP7 is specified in SYSIN of IEBEDIT, so that those two steps are run. //STEP001 EXEC PGM=IEBEDIT //SYSUT1 DD DSN=MYDATA.URMI.JOBS(INPUTJOB),DISP=SHR //SYSUT2 DD SYSOUT=(*,INTRDR) //SYSPRINT DD SYSOUT=* //SYSIN DD * EDIT TYPE=INCLUDE,STEPNAME=(STEP3,STEP7) /*


When does a dataset go uncataloged?

When it is defined with DISP = (NEW,KEEP) at the time of creation. In case of a GDG, least recent generation is uncataloged if the GDG base had been defined with NOEMPTY parameter when the LIMIT is reached. All generations are uncataloged when coded with EMPTY.


How can a GDG base be created in a JCL. What is the difference between EMPTY and SCRATCH parameter while defining/altering GDG base?

GDG base can be created using IDCAMS utility. EMPTY uncatalogued all the generations when the LIMIT is reached. SCRATCH physically deletes the generation, when it is uncatalogued. (LIMIT specifies the maximum number of versions that the GDG base can hold).


A dataset contains 2500 records. How can the last 1500 records copied to an output file?

In the SORT/ICETOOL program, SKIPREC = n can be used, which skips the first n records and then copies the rest to the output file. //JSTEP020 EXEC PGM=ICETOOL //TOOLMSG DD SYSOUT = * //DFSMSG DD SYSOUT = * //IN1 DD DSN = MYDATA.URMI.SKIPREC,DISP=SHR //OUT1 DD SYSOUT = * //TOOLIN DD * COPY FROM(IN1) TO(OUT1) USING(CTL1) /* //CTL1CNTL DD * SORT FIELDS = COPY SKIPREC = 1000 /*


How can a file of 3n records be split into 3 files each containing n records?

STARTREC and ENDREC restricts the READ from the input file on the specified record number. //URMISPLT EXEC PGM = SORT //SORTIN DD DSN=MYDATA.URMI.FILEIN,DISP=SHR //SORTOF01 DD DSN = MYDATA.URMI.FILEOUT1, // DISP = (NEW,CATLG,DELETE), // RECFM = FB, LRECL = 50 //SORTOF02 DD DSN = MYDATA.URMI.FILEOUT2, // DISP = (NEW, CATLG, DELETE), // RECFM = FB, LRECL = 50 //SORTOF03 DD DSN = MYDATA.URMI.FILEOUT3, // DISP = (NEW, CATLG, DELETE), // RECFM = FB, LRECL = 50 //SYSPRINT DD SYSOUT = * //SYSOUT DD SYSOUT = * //SYSUDUMP DD SYSOUT = * //SYSIN DD * SORT FIELDS = COPY OUTFIL FILES = 01,ENDREC=100 //*assuming input file has 300 records. OUTFIL FILES = 02, STARTREC = 101, ENDREC = 200 OUTFIL FILES = 03, STARTREC = 201 //*


When can a job time-out occur? How to overcome that?

A job time-out error can occur when the program takes more time than the time limit for the specified class. This is called a S322 abend. This error is encountered when there are some looping errors in the program and it does not reach completion. If the data processed in the program is genuinely huge and needs more time than the class limit, then the TIME parameter can be coded as TIME = 1440 to get infinite time until job completion.


In a JCL, a large volume dataset is loaded to a table using BMCLOAD in STEP1 and an image copy of the loaded table is taken using BMCCOPY in step2. Step2 abends because the image copy dataset cannot hold the volume of the table. How can this be rectified?

The SPACE parameter of the image copy dataset can be increased based on the volume of the table and the job can be restarted from step2


If the submitter of a job wants to inform another user about the job completion, how can it be done?

NOTIFY = userid of the person (not the submitter) can be specified in the JOB statement so that the user gets a notification with the return code upon job completion. But the job log is present in the spool under the submitter's userid only.


How can a FB file converted to VB file using SORT program?

FTOV option in SORT helps in converting FB to VB file. //URMIFTOV EXEC PGM = SORT //SORTIN DD * 123******* 4560000000 123****123 789 //SORTOF01 DD DSN = MYDATA.URMI.FILEOUT1, // DISP = (NEW, CATLG, DELETE), // RECFM = VB, LRECL = 54 //SORTOF02 DD DSN = MYDATA.URMI.FILEOUT2, // DISP = (NEW, CATLG, DELETE), // RECFM = VB, LRECL = 54 //SORTOF03 DD DSN = MYDATA.URMI.FILEOUT3, // DISP = (NEW, CATLG, DELETE), // RECFM = VB, LRECL = 54 //SYSPRINT DD SYSOUT = * //SYSOUT DD SYSOUT = * //SYSUDUMP DD SYSOUT = * //SYSIN DD * SORT FIELDS=COPY OUTFIL FNAMES = SORTOF01, FTOV, VLTRIM = C'*' //*removes trailing '*' OUTFIL FNAMES = SORTOF02, FTOV, VLTRIM = X'40'//*removes trailing space OUTFIL FNAMES = SORTOF03, FTOV, VLTRIM = X'00'//*removes trailing zeros //*.

What is a JCL?

JCL stands for Job Control Language which provides the specifications necessary to process a job. It is a set of control statements which provides the specifications necessary to process a job. It is a interface between programs & MVS operating system.


What does MVS stand for?

MVS stands for Multiple Virtual storage which is the operating system for the IBM mainframe systems.


Where & how do you code Identifier in JCL?

Identifiers are two slashes (//) starting from column number 1. All JCL statements starts with identifiers except for two exceptions - For a delimiter statement, /* starting in col 1 and for a comment statement , //* starting at col 1.


What are the various stages of Job processing?

Input → Conversion → Execution → Output → Hard copy → Purge


In Job processing, what happens in Conversion stage?

The JCL along with the PROC is converted into an interpreted text to be understood by JES and stored into a dataset, which we call as SPOOL.


In Job processing, what happens in Execution stage?

When the job reaches its highest priority, it is taken up for execution from the job queue. The JCL is read from the SPOOL, the program is executed and the output is redirected to the corresponding output destination as specified in the JCL.


What operation is performed by JOB statement?

Specifies the information required for SPOOLing of the job such as job id, priority of execution, user-id to be notified upon completion of the job.


How do you code a Null statement?

JCL is terminated by a null statement which is optional. For a null statement code only // starting from column 1. All the lines after this will not be executed.


What is the purpose of coding CLASS parameter in job statement?

Based on the time duration and the number of resources required by the job, companies assign different job classes. These can be visualized as individual schedulers used by the OS to receive the jobs. Placing the jobs in the right scheduler will aid in easy execution of the jobs. Some companies have different classes for jobs in test and production environment. Valid values for CLASS parameter are A to Z characters and 0 to 9 numeric (of length 1). Following is the syntax − CLASS=0 to 9 | A to Z


What is the purpose of coding NOTIFY parameter in job statement?

The system sends the success or failure message (Maximum Condition Code) to the user specified in this parameter. Syntax − NOTIFY = "userid | &SYSUID"


Which parameter is used to check the syntax of a JCL without executing it?

TYPRUN = SCAN checks the syntax errors of the JCL without executing it.


What is use of DSN parameter in DD statement?

The DSN parameter refers to the physical dataset name of a newly created or existing dataset. The DSN value can be made up of sub-names each of 1 to 8 characters length, separated by periods and of total length of 44 characters (alphanumeric).


What is use of DISP parameter in DD statement?

The DISP parameter is used to describe the status of the dataset, disposition at the end of the job step on normal and abnormal completion. DISP is not required in a DD statement only when the dataset gets created and deleted in the same job step (like the temporary datasets). Syntax − DISP = (status, normal-disposition, abnormal-disposition)


What is use of SPACE parameter in DD statement?

The SPACE parameter specifies the space required for the dataset in the DASD (Direct Access Storage Disk). Syntax − SPACE = (spcunits, (pri, sec, dir), RLSE)


What is use of DCB parameter in DD statement?

The Data Control Block (DCB) parameter details the physical characteristics of a dataset. This parameter is required for datasets that are newly created in the job step. LRECL is the length of each record held within the dataset. RECFM is the record format of the dataset.


How you will define a temporary dataset in JCL?

A temporary dataset is the one that is created and deleted within a job and is declared as DSN=&&TEMP. Do not mention the DSN parameters with this.


How you will the direct the data to spool using SYSOUT option?

Code SYSOUT = *, then the data will be directed to spool.


Which utility is used a dummy utility?

IEFBR14 is no operation utility. Used to return control to user and terminate. It is usually used to create empty dataset or delete an existing dataset.


What DISP parameter we mention for creation of temporary dataset so that we can use it in later steps?

DISP = (NEW,PASS). PASS is valid only for normal disposition. This is used when the dataset is to be passed and processed by the next job step in a JCL.


Which utility is used to run a COBOL-DB2 program?

IKJEFT01 utility is used to run a COBOL-DB2 program.


Which parameter is use to declare the name of dataset in DD statement?

DSN(Dataset Name) is used to declare the name of dataset in a DD statement.


Which statement is used to end the in-stream procedure in a JCL?

PEND statement is used to end the in-stream procedure.


If we want to use a GDG which is already created by some job, then how to use the reference of the last generation in a JCL?

To refer the latest generation of a GDG, we use the reference as (+0).


In order to execute step2 a job after a return code of 8 in step1, what condition you will code in step2?

COND=(12,LT,STEP1), it will read the condition as 12 less than 8, which is false, so this step will be executed.


What sort card you will use to copy the data from one dataset to another dataset?

In the SORT step mention the SYSIN & SYSOUT dataset name & in sort card code SORT FIELDS=COPY to copy data from input file to output file.


A CHKPT is the parameter coded for multi-volume QSAM datasets in a DD statement. When a CHKPT is coded as CHKPT=EOV, a checkpoint is written to the dataset specified in the SYSCKEOV statement at the end of each volume of the input/output multi-volume dataset. State whether true or false?

This statement is true.


Which utility is used to sort a file in JCL?

SORT utility is used to sort a file in a particular order based on the sort card.


Which utility is used to update PDS?

IEBUPDTE is used to update PDS.


What is use of SPACE parameter in DD statement?

The SPACE parameter specifies the space required for the dataset in the DASD (Direct Access Storage Disk). Syntax − SPACE = (spcunits, (pri, sec, dir), RLSE)


A SET statement is used to define commonly used symbolic across job steps or procedures. It initializes the previous values in the symbolic names. It has to be defined before the first use of the symbolic names in the JCL. State whether true or false?

This statement is true.


How much time Step2 will have for execution, if Step1 will take 2.5 minutes? //TXXXXXX JOB (XXXXX), ’XXXX’, TIME = 4 //STEP1 EXEC PGM = PR1, TIME = 4 //STEP2 EXEC PGM = PR2, TIME = 0

Answer −

The job TIME limit takes precedence over the step time limit. Step2 will have 1.5 minutes for execution. If it goes beyond that, this job will abend.


What will happen to Step2 if Step1 executes with RC=0? //TXXXXXX JOB (XXXXX), ’XXXX’ //STEP1 EXEC PGM = PR1 //STEP2 EXEC PGM = PR2, COND = (4, LE, STEP1)

Answer −

It will read the condition on step2 as 4 Less than 0, which is false, so step will be executed. If condition is true then only the step will be bypassed.


What will happen to Step2 if Step1 executes with RC=0? //TXXXXXX JOB (XXXXX), ’XXXX’ //STEP1 EXEC PGM = PR1 //STEP2 EXEC PGM = PR2, COND = (0, EQ, STEP1)

Answer −

It will read the condition on step2 as 0 EQUAL 0, which is true, so step will be bypassed. If condition is true then the step will be bypassed.


What will happen to Step2 if Step1 executes with RC=0? //TXXXXXX JOB (XXXXX), ’XXXX’ //STEP1 EXEC PGM = PR1 //STEP2 EXEC PGM = PR2, COND = ONLY

Answer −

Step2 will be bypassed as we have coded ONLY, which means Step will be executed only if the previous steps abend.


What will happen to Step2 if Step1 abend with some error? //TXXXXXX JOB (XXXXX), ’XXXX’ //STEP1 EXEC PGM = PR1 //STEP2 EXEC PGM = PR2, COND = ONLY

Answer −

Step2 will be executed as step1 abended and we have coded ONLY parameter which means this step will execute only if the previous steps abend.


What will happen to Step2 if Step1 abend with some error? //TXXXXXX JOB (XXXXX), ’XXXX’ //STEP1 EXEC PGM = PR1 //STEP2 EXEC PGM = PR2, COND = EVEN

Answer −

Step2 will be executed as we have coded EVEN which means this step will be executed even if all other steps abends or not. If you will code EVEN then step will be executed irrespective of results from other steps.


What will happen to Step2 if Step1 executes with RC=0? //TXXXXXX JOB (XXXXX), ’XXXX’ //STEP1 EXEC PGM = PR1 //STEP2 EXEC PGM = PR2, COND = EVEN

Answer −

Step2 will be executed as we have coded EVEN which means this step will be executed even if all other steps abends or not. If you will code EVEN then step will be executed irrespective of results from other steps.


Which step will be executed after Step1, if Step1 executes with RC=4? //TXXXXXX JOB (XXXXX), ’XXXX’ //STEP1 EXEC PGM = PR1 // IF STEP1.RC GT 0 THEN //STEP2 EXEC PGM = PR2 // ELSE //STEP3 EXEC PGM = PR3 // END-IF

Answer −

If condition is 4 Greater than 0 and this condition is true, so Step2 will be executed and Step3 will be bypassed.


How the file will be sorted if you will use the following sort card? //STEP1 EXEC PGM = SORT //SYSPRINT DD SYSOUT = * //SYSOUT DD SYSOUT = * //SORTIN DD DSN = input.data.set,DISP=SHR //SORTOUT DD DSN=output.data.set //SYSIN DD * SORT FIELDS = (1,06,CH,D) /*

Answer −

SORT FIELDS = (1,06,CH,D) instructs the utility to sort the file based on the CHARACTER field that starts from POSITION 1 and of LENGTH 6 in DESENDING order


What is the output of following JCL? //STEP1 EXEC PGM = SORT //SYSOUT DD SYSOUT = * //SORTIN DD DSN = input.file.name //SORTOUT DD DSN = output.file.name //SYSIN DD * SORT FIELDS = COPY SUM FIELDS = NONE /*

Answer −

It will copy the data from input file to output file and will eliminate the duplicates. SUM FIELDS=NONE is used to eliminate the duplicate rows.


What is the output of following JCL? //STEP1 EXEC PGM = SORT //SYSOUT DD SYSOUT = * //SORTIN DD DSN = input.file.name //SORTOUT DD DSN = output.file.name //SYSIN DD * SORT FIELDS = COPY INCLUDE=(1,6,CH,EQ,C'TUTORI') /*

Answer −

It will copy only those rows which starts from TUTORI from input file to output file.


PROC1 is a in-stream procedure in a JCL and with this name PROC1 one catalog procedure exists, then which procedure will be invoked - catalog or in-stream? //TXXXXX JOB ,, NOTIFY = &SYSUID // JCLLIB ORDER = (XXXXX.PROCLIB) //PROC1 PROC //STEP1 EXEC PGM = IEFBR14 //DD1 DD DSN = TXXXXX.TEST, SPACE = (TRK, (1,1)), // DCB = (RECFM = FB, BLKSIZE = 8000, LRECL = 80), // DISP = (NEW, DELETE) //PEND //STEP1 EXEC PROC1

Answer −

In-stream procedure will be invoked.


PROC1 is a in-stream procedure in a JCL and with this name PROC1 one catalog procedure exists, then which procedure will be invoked - catalog or in-stream? //TXXXXX JOB ,, NOTIFY = &SYSUID // JCLLIB ORDER = (XXXXX.PROCLIB) //STEP1 EXEC PROC1 //PROC1 PROC //STEP1 EXEC PGM = IEFBR14 //DD1 DD DSN = TXXXXX.TEST, SPACE = (TRK,(1,1)), // DCB=(RECFM = FB, BLKSIZE = 8000, LRECL = 80), // DISP=(NEW,DELETE) //PEND

Answer −

Catalog procedure will be invoked.


What will be the output of following JCL which is calling a catalog procedure? //TXXXXXJ JOB ,, NOTIFY = &SYSUID, CLASS = A, MSGCLASS = X // JCLLIB ORDER=XXXXX.PROC.LIBRARY //DATA1 EXEC PROC = PROC1, TIME = 3

Answer −

TIME parameter coded in PROCEDURE PROC1 will be replaced with TIME parameter overridden in the JCL i.e TIME = 3


What is the name of program which will be executed in the STEP1? //XXXXX JOB ,, NOTIFY = SYSUID, CLASS = A, MSGCLASS = X // SET A = PROG1 //STEP1 EXEC PGM = &A //DD1 DD DSN = FILE1, DISP = SHR

Answer −

SET statement is used to assign the values to symbolic parameters. So value of A is PROG1. So PROG1 will be executed in STEP1.


What is the output of following JCL? //STEP1 EXEC PGM = IEBEDIT //SYSUT1 DD DSN = XXXXXX.XXXX.XXXX(XXXXXXXX), DISP = SHR //SYSUT2 DD SYSOUT = (*,INTRDR) //SYSPRINT DD SYSOUT = * //SYSIN DD * EDIT TYPE = INCLUDE, STEPNAME = (STEP3,STEP7) /*

Answer −

It will execute only STEP3 & STEP4 This utility is used to run only particular steps in a JCL.
Previous Post Next Post