JCL Interview Questions


What is JCL ?

JCL is Job Control Language and is used for Batch processing. The startup procedures of OS and standard products like CICS etc are written in JCL. It is interface between operating system(MVS) & application program. when 2 related programs are combined together on control statements is called job control language

What is the meaning of keyword in JCL?

A keyword in a JCL statement may appear in different places and is recognized by its name, eg. MSGCLASS in the JOB statement.

What are the differences between JES2 & JES3 ?

JES3 allocates datasets for all the steps before the job is scheduled. In JES2, allocation of datasets required by a step are done only just before the step executes

What are three major types of JCL statements? What are their functions?

JOB - indicates start of jobstream to the operating system and through parms coded on it, certain details about the job (time, region, message level, job accounting data).

EXEC – indicates the start of execution of a particular job step, be that step a program or a proc.

DD - is a data definition, which is used to describe the attributes of a data set (name, unit, type, space, disposition).

Describe the JOB statement, its meaning, syntax and significant keywords?

The JOB statement is the first in a JCL stream. Its format is // jobname, keyword JOB, accounting information in brackets and keywords, MSGCLASS, MSGLEVEL, NOTIFIY, CLASS, etc.

Describe the EXEC statement, its meaning, syntax and keywords?

The EXEC statement identifies the program to be executed via a PGM= program name keyword. Its format is //jobname EXEC PGM= program name. The PARM= keyword can be used to pass external values to the executing program.

Describe the DD statement, its meaning, syntax and keywords?

The DD statement links the external dataset name (DSN) to the DDNAME coded within the executing program. It links the file names within the program code to the file names know to the MVS operating system. The syntax is // ddname DD DSN=dataset name. Other keywords after DSN are DISP, DCB, SPACE, etc.

What is order of searching of the libraries in a JCL?

First any private libraries as specified in the STEPLIB or JOBLIB, then the system libraries such as SYS1.LINKLIB. The system libraries are specified in the link list.

How do you designate a comment in JCL?

The comment statement is //* followed by the comments.

What are the three basic types of statements in a jobstream?

JOB(one per jobstream) EXEC(one or more per job) DD(one or more per jobstep)

Name some of the JCL statements that are not allowed in procs.?

Some of the JCL statements which are not allowed in procedures are:

1. JOB, Delimiter(/*), or Null statements

2. JOBLIB or JOBCAT DD statements

3. DD * or DATA statements

4. Any JES2 or JES3 control statements

I have multiple jobs ( JCLs with several JOB cards ) in a member. What happens if I submit it?

Multiple jobs are submitted (as many jobs as the number of JOB cards).

What are the basic JCL Statements for a Job?

JOB : Identifies a job and supplies accounting info

EXEC : Identifies a job step by indicating the name of the program to be executed.

DD : Identifies a data set to be allocated for the job step

Delimiter(/*) : Marks the end of an in-stream dataset

Null(//) : Marks the end of a job

Comments(//*) : Provides Comments

PROC : Marks the beginning of a procedure

PEND : Marks the end of a procedure

OUTPUT : Supplies options for SYSOUT processing.

How is a dataset passed from one step to another?

A dataset is passed from one step to another based on what is coded on the DISP parameter. The dataset can only be passed to subsequent steps if PASS was used on the disposition parameter.

What is primary allocation for a dataset?

The space allocated when the dataset is first created.

What is the difference between primary and secondary allocations for a dataset?

Secondary allocation is done when more space is required than what has already been allocated.

What is STEPLIB, JOBLIB? What is it used for?

Specifies that the private library (or libraries) specified should be searched before the default system libraries in order to locate a program to be executed. STEPLIB applies only to the particular step, JOBLIB to all steps in the job.

How many extents are possible for a sequential file ? For a VSAM file ?

16 extents on a volume for a sequential file and 123 for a VSAM file.

What is model dataset label(Model DSCB)?

A model dataset label is a pattern for the dataset label created for any dataset named as a part of the GDG group. The system needs an existing dataset to serve as a model to supply the DCB parameters for the generation data group one wishes to create. The model dataset label must be cataloged. The model DSCB name is placed on the DCB parameter on the DD statement that creates the generation data group.

What is the difference between the JOBLIB and the STEPLIB statements?

The JOBLIB statement is placed after the JOB statement and is effective for all job steps. It cannot be placed in a cataloged procedure. The STEPLIB statement is placed after the EXEC statement and is effective for that job step only. Unlike the JOBLIB statement, the STEPLIB can be placed in a cataloged procedure.

What happens if both JOBLIB and STEPLIB are specified?

JOBLIB is ignored.

When you specify multiple datasets in a JOBLIB or STEPLIB, what factor determines the order?

The library with the largest block size should be the first one.

How to change default PROCLIB?

//ABCD JCLLIB ORDER=(ME.MYPROCLIB,SYS1.PROCLIB)

Why do you want to specify the REGION parameter in a JCL step?

To override the REGION defined at the JOB card level. REGION specifies the max region size. REGION=0K or 0M or omitting REGION means no limit will be applied.

What does the TIME parameter signify? What does TIME=1440 mean?

TIME parameter can be used to overcome S322 abends for programs that genuinely need more CPU time. TIME=1440 means no CPU time limit is to be applied to this step.

What is COND=EVEN?

Means execute this step even if any of the previous steps, terminated abnormally.

What is COND=ONLY?

Means execute this step only if any of the previous steps, terminated abnormally.

How do you check the syntax of a JCL without running it?

TYPERUN=SCAN on the JOB card or use JSCAN.

How do you overcome this limitation?

One way is to code SYSIN DD DUMMY in the PROC, and then override this from the JCL with instream data.

What is the purpose and meaning of the REGION keyword and what JCL statement is it associated with?

REGION specifies the maximum CPU memory allocated for a particular job or job step. If REGION is in the JOB card, it relates to the entire job; if in the EXEC statement, it relates to the job step.

What is the purpose and meaning of the TIME keyword and what JCL statement is it associated with?

TIME specifies the maximum CPU time allocated for a particular job or job step. If TIME is in the JOB card, it relates to the entire job; if in the EXEC statement, it relates to the job step.

How can trap abends in the JCL?

Use IF ABEND statement in the JCL.

What is RESTART? How is it invoked?

RESTART is a JOB statement keyword. It is used to restart the job at a specified step rather than at the beginning.

What is the meaning of the EXEC statement keyword, COND? What is its syntax?

COND specifies the conditions for executing the subsequent job step. The value after the COND= is compared to the return codes of the preceding steps and if the comparison is true, the step is bypassed.

What is the improvement to COND= in the latest version of MVS?

MVS now allows for an IF bracketed by an END IF around any job step to replace the COND= syntax. Again, if the IF statement is true, the step is bypassed.

What is the purpose of the PARM keyword in the EXEC statement?

The value after the PARM= specifies control information to be passed to the executing program of the job step.

What is the parameter to be passed in the job card for the unlimited time, irrespective of the job class?

TIME=1440

Definition of COND parameter in JCL ?

COND is a condition parameter, consists of 2 sub parameters, 1st - return code from the previous step, 2nd - condition. If COND is true, the step on which COND is coded will be BYPASSED.

What does the statements: typrun=scan and typrun=hold do in a JCL statement ?

typrun=scan checks the JCL for errors, typrun=hold holds the job until further notice.

What is a COND parameter in JCL?

COND means condition parameter. It is compared with system return code of previous step.

//step1 exec pgm=abcd
				//step2 exec pgm=xyz, cond=(4,lt)

step2 will be executed when system return code of step1 is less than 4.

What are three parameters you can specify on Job statement as well as on exec stmt?

Time, Region and Cond parameters

How do you restart a step in JCL?

Use RESTART=step name.

How many positional parameters are there in job statement?

There are two position parameters in job statement.

How to pass parameters to the program as the job is being executed?

By using 'parm' parameter in exec statement. The value mentioned here should be declared in linkage section in the program and process thru procedure division. This technique is very useful when you do not know the parameters at the time of coding the programs.

What does a disposition of (NEW, CATLG, DELETE) mean?

That this is a new dataset and needs to be allocated, to CATLG the dataset if the step is successful and to delete the dataset if the step abends.

What does a disposition of (NEW,CATLG,KEEP) mean?

That this is a new dataset and needs to be allocated, to CATLG the dataset if the step is successful and to KEEP but not CATLG the dataset if the step abends. Thus if the step abends, the dataset would not be catalogued and we would need to supply the vol. ser the next time we refer to it.

How to access a file that had a disposition of KEEP?

Need to supply Volume Serial Number VOL=SER=xxxx.

What does a disposition of (MOD, DELETE,DELETE) mean ?

The MOD will cause the dataset to be created (if it does not exist), and then the two DELETEs will cause the dataset to be deleted whether the step abends or not. This disposition is used to clear out a dataset at the beginning of a job.

How are datasets concatenated?

Datasets are concatenated by writing a normal DD statement for the first dataset and then adding a DD statement without a DDNAME for each dataset to be concatenated in the order they are to be read. The following is an example of three datasets concatenated:

		//YEARDAT	DD	DSN=JAN.DATA,DISP=SHR
//		DD	DSN=FEB.DATA,DISP=SHR
//		DD	DSN=MAR.DATA,DISP=SHR

What is the DD statement for a output file?

Unless allocated earlier, will have the following parameters: DISP=(NEW,CATLG,DELETE), UNIT , SPACE & DCB

What do you do if you do not want to keep all the space allocated to a dataset?

Specify the parameter RLSE ( release ) in the SPACE e.g. SPACE=(CYL,(50,50),RLSE)

What is DISP= (NEW,PASS,DELETE)?

This is a new file and create it, if the step terminates normally, pass it to the subsequent steps and if step abends, delete it. This dataset will not exist beyond the JCL.

How do you create a temporary dataset? Where will you use them?

Temporary datasets can be created either by not specifying any DSNAME or by specifying the temporary file indicator as in DSN=&&TEMP. We use them to carry the output of one step to another step in the same job. The dataset will not be retained once the job completes.

What are the valid DSORG values ?

PS - QSAM, PO - Partitioned, IS - ISAM

What is the difference between specifying DISP=OLD and DISP=SHR for a dataset?

DISP=OLD denotes exclusive control of the dataset; DISP=SHR means there is no exclusivity.

What is MOD and when would you use it?

DISP=MOD is used when the dataset can be extended, ie, you can add records at the end of an existing dataset.

What are the keywords associated with DCB? How can you specify DCB information? What is the OS precedence for obtaining that DCB information, ie. where does the system look for it first?

The keywords associated with the DCB parameter are LRECL, RECFM, BLKSIZE and DSORG. The DCB information can be supplied in the DD statement. The system looks for DCB information in the program code first.

What does the keyword DCB mean and what are some of the keywords associated with it?

DCB stands for data control block; it is a keyword for the DD statement used to describe datasets. Keywords associated with it are BLKSIZE, DEN, LRECL and RECFM.

What is the difference between BLKSIZE and LRECL?

LRECL is the logical record length , where as BLKSIZE is multiples of LRECL

What is the difference between specifying DISP=OLD and DISP=SHR for a dataset?

OLD specifies exclusive use of a dataset, SHR allows multiple jobs to concurrently access the dataset Note: When updating a dataset, you would normally use OLD.

How many parameters are there to a DISP statement and what are their uses?

There are three(3) parameters. Parameter 1: current data set disposition(new, shr, old, mod) Parameter 2: normal close action for data set (catlg, keep, delete) Parameter 3:abend action for data set (catlg, keep, delete).

On the DD statement, what is the main difference between creating a new sequential flat file and a partitioned dataset?

SPACE=(n,m) for a sequential file, SPACE=(n,m,p) for a PDS where n, m, and p are numbers. The p designates how many directory blocks to allocate.

When should DISP=MOD is used?

DISP=MOD is used to either extend an existing sequential dataset or to create a dataset if it does not exist. If the dataset exists, then records are appended to the dataset at the end of the existing dataset. If the dataset does not exist, the system treats MOD as if it were MOD can be used to add to a dataset that extends onto several volumes. Always specify a disposition of CATLG with MOD for cataloged datasets, even if they are already cataloged, so that any additional volume serial numbers will be recorded in the catalog.

What is a procedure?

A set of preceded JCL that can be modified through the use of parameters or override cards. Note: Procedures can be catalogued or instream.

What is a PROC? What is the difference between an instream and a catalogued PROC?

PROC stands for procedure. It is 'canned' JCL invoked by a PROC statement. An instream PROC is presented within the JCL; a catalogued PROC is referenced from a proclib partitioned dataset

How do you restart a PROC from a particular step?

In job card, specify RESTART=PROCSTEP.STEPNAME where PROCSTEP = name of the JCL step that invoked the PROC and STEPNAME = name of the PROC step where you want execution to start

A PROC has five steps. Step 3 has a condition code. How can you override/nullify this condition code?

Provide the override on the EXEC stmt in the JCL as follows:

//STEP001 EXEC procname, COND.stepname=value

All parameters on an EXEC stmt in the proc such as COND, PARM have to be overridden like this.

How do you override a specific DDNAME/SYSIN in PROC from a JCL?

//<STEPNAME.DD> DSN=...

Can you code instream data in a PROC ?

No.

What is the difference between catalogue procedure and In-Stream procedure?

In Stream procedures are set of JCL statements written between JOB and EXEC statements, start with PROC and end with PEND statement. Mainly used to test cataloged procedures. Cataloged procedure is cataloged on the procedure library and is called by specifying the procedure name on the EXEC statement.

What is the difference between a symbolic and an override in executing a PROC?

A symbolic is a PROC placeholder; the value for the symbolic is supplied when the PROC is invoked, eg. &symbol=value. An override replaces the PROC's statement with another one; it substitutes for the entire statement.

Can you execute a PROC from another PROC?

I did not know the answer and my interviewer said NO. Later I tried and executed PROC from a PROC, three levels deep. Manuals do not state any limit on PROC calling PROC, or nesting.

How do you skip a particular step in a proc/JOB?

Can use either condition codes or use the jcl control statement IF

What does IEBGENER do?

Used to copy one QSAM file to another. Source dataset should be described using SYSUT1 ddname. Destination dataset should be described using SYSUT2. IEBGENR can also do some reformatting of data by supplying control cards via SYSIN.

What is the difference between IEBGENER, IEBCOPY and REPRO in IDCAMS utility?

IEBGENER -- This is a dataset utility for copying sequential datasets which produces a PDS or a member from a sequential dataset.

IEBCOPY -- This is a dataset utility for copying one PDS to another or to merge PDSs.

REPRO -- This is for copying sequential datasets. More or less same as the IEBGENER.

What is a Dummy Utility and what it does ?

IEFBR14 is a Dummy utility and it is used for the sake of EXEC PGM= .... statement in JCL[when used it wouldn't perform any task]. e.g. While Allocating a dataset you don't have to run any utility [this could be done by giving disp=new inDD statement]. But for a PGM name must be given in EXEC statement, it is used.

What is a Generation Data Group (GDG)?

Generation Data Group is a group of chronologically or functionally related datasets. GDGs are processed periodically, often by adding a new generation, retaining previous generations, and sometimes discarding the oldest generation.

GDG - group of dataset that are logically or chronologically related, referred by name and a relative generation number - an integer which identifies the generation of a dataset and is coded in parentheses after dataset name. Absolute GDG name - GxxxxVyy, where xxxx-absolute gen. number, yy-version number. Can be sequential, direct, partitioned. (VSAM - no). Must always be cataloged.

How is a GDG base created?

A GDG base is created in the system catalog and keeps track of the generation numbers used for datasets in the group. IDCAMS utility is used to define the GDG base.

How are GDGs concatenated?

Generation Data Groups are concatenated by specifying each dataset name and the generation number for all generations of the generation data group. Otherwise to have all generations of a generation data group, omit the generation number. The DD statement will refer to all generations. The result is the same as if all individual datasets were concatenated. If generations are not on the same volume, this will not work.

Can we browse or edit the GDG dataset if it is a tape entry?

No, You can’t edit or browse the GDG if it resides on tape.

How is a new GDG coded?

A new GDG is coded as (+1) after the dataset name as follows: DSN=JAN.DATA(+1). This will cause all generations to be pushed down one level at the end of the job.

What is the error code SOC01 indicate ?

Operation exception error For e.g. a dataset open error

What is 'S0C7' abend?

Caused by invalid data in a numeric field.

What is a S0C4 error ?

Storage violation error - can be due to various reasons. e.g.: READING a file that is not open, invalid address referenced due to subscript error.

This error is faced when we execute the COBOL program. The main reason for this error is that a variable is defined with less characters and we are trying to move data which is larger than the actual storage space.

What are SD37, SB37, SE37 abends?

All indicate dataset out of space. SD37 - no secondary allocation was specified. SB37 - end of vol. and no further volumes specified. SE37 - Max. of 16 extents already allocated.

What is S322 abend ?

Indicates a time out abend. Your program has taken more CPU time than the default limit for the job class

What are the causes for S0C1, S0C4, S0C5, S0C7, S0CB abends ?

S0C1-May be due to

	1.Missing or misspelled DD name 
2.Read/Write to unopened dataset 
3.Read to dataset opened output 
4.Write to dataset opened input 
5.Called subprogram not found

S0C4-may be due to

	1.Missing Select statement(during compile) 
2.Bad Subscript/index 
3.Protection Exception 
4.Missing parameters on called subprogram 
5.Read/Write to unopened file 
6.Move data from/to unopened file

S0C5-May be due to

	1.Bad Subscript/index 
2.Closing an unopened dataset 
3.Bad exit from a perform 
4.Access to I/O area(FD) before read

S0C7-may be due to

	1.Numeric operation on non-numeric data 
2.Un-initialize working-storage 
3.Coding past the maximum allowed sub script

S0CB-may be due to

	1.Division by Zero 

How do you submit JCL via a Cobol program?

Use a file //dd1 DD sysout=(*,intrdr)write your JCL to this file.

How do you submit a JCL under CICS environment ?

Pass all the jcl codes to a COBOL variable (should be declare using OCCURS clause) and the write the line one by one to the spool using CICS commands like SPOOL Close SPOOL Open SPOOL Write .

How do you send the output of a COBOL program to a member of a PDS?

Code the DSN as PDS (member) with a DISP = SHR. The DISP applies to the PDS and not to a specific member.

I have a COBOL program that Accepts some input data. How do you code the JCL statement for this?

//SYSIN DD*
input data
input data
/*

Explain concatenating datasets?

Datasets can be grouped in a DD statement one after another, eg. in a JOBLIB statement where the load module can exist in one of many datasets.

What is the meaning of data definition name (ddname) and dataset name (dsname) in the DD statement?

Data definition name is the eight character designation after the // of the DD statement. It matches the internal name specified in the steps executing program. In COBOL that's the name specified after the ASSIGN in the SELECT ASSIGN statement. Dataset name is the operating system (MVS) name for the file.

How is the keyword DUMMY used in JCL?

For an output file DUMMY specifies that the output is to be discarded. For input it specifies that the file is empty.

What will happen if you attempt to restart a job in the middle of a JCL // IF .... // ENDIF?

Job will fall through to the ENDIF (not executing any steps), then resume execution with the first step AFTER the // ENDIF.

Why do you use a control card?

A control card can be a member of a pds or a sequential dataset and is used for storing the date fields, Definitions of VSAM files....etc. You use control card because you cannot use a instream procedure in a procedure. Generally you will be calling a Proc from your Jcl and you cannot code instream procedure in the Proc and so you will point to the dataset which is called control card.

How to pass the temp dataset form one JOB step to another?

By specifying the DISP as PASS for the temp dataset

Write a jcl to execute a job by 7 a.m on Jan 20,1999?

The code is : //*MAIN DEADLINE=(0700,B,012099)

What u mean by include statement in JCL ?

An include statement identifies a member of a pds or pdse that contains. This set of JCL statements is called an include group. The system replaces the include statement with the statements in the include group

The maximum number of in-stream procedure you can code in any JCL is ?

Fifteen(15).

What is the max block size for a Tape file?

It is 32,760.Based on that we can calculate efficient number of Records in a Block

Which is the most widely used batch performance monitor for DB2?

DB2PM

what do you mean By spooling? Expand SPOOL?

This is managed by JES. This is used for Queuing the Outputs that are intended for Printing and are first stored in SPOOLDASD.

For how long a job can be executed continuously in a mainframe?

248 DAYS

Max. No of DD statements in a job ?

3273

How much space OS allocates when you create a PS or PDS?

56 KB

Min no of member’s (PDS) in one directory block?

SIX(6)

The maximum number of steps in a job?

255

How much is memory space involved, when we code BLOCKSIZE,TRK & CYL ?

One block constitutes 32KB of formatted memory/ 42KB of Unformatted memory,6 blocks makes one Track & 15 Tracks makes one cylinder.

What is the difference between specifying DISP=OLD and DISP=SHR for a dataset?

OLD specifies exclusive use of a dataset, SHR allows multiple jobs to concurrently access the dataset Note: When updating a dataset, you would normally use OLD.

How many parameters are there to a DISP statement and what are their uses?

There are three(3) parameters. Parameter 1: current data set disposition(new, shr, old, mod) Parameter 2: normal close action for data set (catlg, keep, delete) Parameter 3:abend action for data set (catlg, keep, delete).

On the DD statement, what is the main difference between creating a new sequential flat file and a partitioned dataset?

SPACE=(n,m) for a sequential file, SPACE=(n,m,p) for a PDS where n, m, and p are numbers. The p designates how many directory blocks to allocate.

When should DISP=MOD is used?

DISP=MOD is used to either extend an existing sequential dataset or to create a dataset if it does not exist. If the dataset exists, then records are appended to the dataset at the end of the existing dataset. If the dataset does not exist, the system treats MOD as if it were MOD can be used to add to a dataset that extends onto several volumes. Always specify a disposition of CATLG with MOD for cataloged datasets, even if they are already cataloged, so that any additional volume serial numbers will be recorded in the catalog.

What is a procedure?

A set of preceded JCL that can be modified through the use of parameters or override cards. Note: Procedures can be catalogued or instream.

What is a PROC? What is the difference between an instream and a catalogued PROC?

PROC stands for procedure. It is 'canned' JCL invoked by a PROC statement. An instream PROC is presented within the JCL; a catalogued PROC is referenced from a proclib partitioned dataset

How do you restart a PROC from a particular step?

In job card, specify RESTART=PROCSTEP.STEPNAME where PROCSTEP = name of the JCL step that invoked the PROC and STEPNAME = name of the PROC step where you want execution to start

A PROC has five steps. Step 3 has a condition code. How can you override/nullify this condition code?

Provide the override on the EXEC stmt in the JCL as follows:

//STEP001 EXEC procname, COND.stepname=value

All parameters on an EXEC stmt in the proc such as COND, PARM have to be overridden like this.

How do you override a specific DDNAME/SYSIN in PROC from a JCL?

//<STEPNAME.DD> DSN=...

Can you code instream data in a PROC ?

No.