JCL Faqs: JCL Questions Amit Sethi Page 1 of 51
JCL Faqs: JCL Questions Amit Sethi Page 1 of 51
Identifier field: The two forward slashes (//) are required to identify each
JCL statement.
Operand field: This field must appear one or more spaces after the
operation field. Multiple operands in one statement are separated from
each other via commas.
Comments: can be specified one space after the last operand in any JCL
statement. Can be identified by means of //*
6. JOB Statement and its Parameters What are the various parameters
that are generally coded on JOB statement?
Following are some of the parameters that are used on JOB statements.
16. 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.
17. How does the system determine the priority of a job for
execution?
First the system determines which job has the highest class. Each class
has a job queue with jobs of different priorities. The system will select
the job for execution that has the highest PRTY (0 thru 15) 15 is the
highest priority.
24. How do you pass parameters to the program as the job is being
executed?
By using ‘PARM’ parameter in the EXEC statement or through sysin
statement.
25. What are three parameters you can specify on Job statement as
well as on exec stmt ?
Time, Region and Cond parameters
should be declared in linkage section in the program.
27. What are the DD statements used for Peripheral I/O devices?
37. How does the system get information about the block size?
DCB info comes from :-
1) Program - FD: BLOCK CONTAINS 3 RECORDS RECORD CONTAINS 100
CHARACTERS
2) The label - like a tape
3) From the VTOC - for Dasd
4) From the JCL - DCB=BLKSIZE=nnn.
40. How do you describe the input data which is a part of the input
job stream?
You should use either DD * or DD Data.
47. How do you read input that is mentioned in the sysin card of JCL
through COBOL program?
Using ACCEPT Statement
48. What is the DD name, where all your DISPLAY statements will be
routed?
SYSOUT
Conditions
The COND parameter coded on the JOB statement applies to all job steps
within that job, and it overrides the COND parameters coded on the EXEC
statement.
53. How do you specify a COND parameter for a job step so that the
step will never be executed?
COND=(0,LE) or COND=(4095,GE).
Procedures-Cataloged/Instream
There are two types of procedures in JCL. They are called instream
procedure and catalogued procedure.
74. 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.
Dispositions
81. 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). 2: normal close action for data set
(catlg, keep, delete) Parameter 3:abend action for data set (catlg, keep,
delete).
93. 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)
97. The disp in the JCL is MOD and the program opens the file in
OUTPUT mode. What happens ? The disp in the JCL is SHR and the
pgm opens the file in EXTEND mode. What happens ?
Records will be written to end of file (append) when a WRITE is done in
both cases.
ABENDs
Utiliies
120. I have a COBOL program that ACCEPT 's some input data. How do
you code the JCL statement for this? (How do you code in-stream
data in a JCL?)
//SYSIN DD*
input data
/*
GDGs
123. How do you refer a current(or latest) GDG dataset in the JCL ?
Using Dataset name (0)
124. How do you mention in the JCL, when you want to create a new
GDG data set ? How do you refer the same dataset in the next
step?
Using dataset name (+1) , Dataset name(+1) only.
The catalogue information of GDG will not be updated until the
completion of job.
126. Do all versions of the GDG have to be of the same record length ?
No, the DCB of the model dataset can be overridden when you allocate
new versions.
Misc
133. What is the difference between static call & Dynamic call?
In the case of Static call, the called program is a stand alone program, it
is an executable program . During run time we can call it in our called
program. As about Dynamic call , the called program is not an executable
program it can executed thru the called program
134. I have multiple jobs ( JCL 's 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).
135. How do you run a COBOL batch program from a JCL? How do you
run a COBOL/DB2 program?
To run a non DB2 COBOL program:
//STEP001 EXEC PGM=MYPROG
To run a DB2 COBOL program:
//STEP001 EXEC PGM=IKJEFT01
//SYSTSIN DD *
DSN SYSTEM(....)
RUN PROGRAM(MYPROG)
PLAN(.....) LIB(....) PARMS(...)
/*
137. 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.
139. How do you pass parameters to the programs the job is being
executed ?
By using 'PARM' parameter in EXEC statement. The values mentioned
here should be declared in linkage section in the program and process
through Procedure division. This technique is very useful when you do
not know the parameters at the time of coding the programs.
147. How will you pass data to a batch program from JCL.
Either using PARM parameter or through SYSIN statement.
148. How will you start a JCL when some of the steps already executed
are to be by passed ?
Using RESTART parameter in the JOB statement.
149. How you will by pass one step, depending on the Return code of
the previous step. How will you by pass more than one step in a
JCL?
Using COND coded on the particular step.
Using COND coded on the JOB statement.
152. How would you limit the time allotted for a job to forty-five
seconds?
With a TIME Parm on the JOB statement in the form: TIME=(, 45).
153. What will make this step run if COND parm is COND=(0,NE)?
Run if return codes from any previous step(s) were equal to zero. Skip
this step if the return code from any previous steps is not equal to zero
(0,NE).
155. How do you change LASTCC and MAXCC values in the JCL?
Using SET command like SET MAXCC = 8.
Eg
In the cobol program the input-output section is coded as below and file
accessed using VSAM file.
157. Explain Job Entry System. What are the differences between JES2
& JES3 ?
JES is used to accept jobs and run them on one of several computers
connected together in a network. JES consists of statements placed
before or after the JOB statement to direct Jobs to the computer in a
network. (i) In JES2 computers are connected in a network, and each
computer is termed as a node. In JES3 several computers are connected
closely together and all of the scheduling is done by a single computer
that is called a global processor. (ii) In JES2 each computer in a network
can select jobs from it's queue (decentralized system), while in JES3 the
global processor schedules the jobs in queue to itself or to the other
computers connected to it (centralized system). (iii) 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. (iv) All the jobs are placed in single Job Queue in JES2 & JES3.
They can also route the output to some destination. JES2 statements can
not be placed in a cataloged Procedure.
Secondary allocation is done when more space is required than what has
already been
allocated.
3. 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.
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.
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.
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.
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.
11. How do you create a temporary dataset? Where will you use
them?
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.
Can use either condition codes or use the jcl control statement IF (only in
ESA JCL)
14. A PROC has five steps. Step 3 has a condition code. How can
you override/nullify this condition code? - GS
//<stepname.dd> DSN=...
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.
Indicates a time out abend. Your program has taken more CPU time than the
default
limit for the job class. Could indicate an infinite loop.
22. What does the TIME parameter signify ? What does TIME=1440
mean ?
Means execute this step even if any of the previous steps, terminated
abnormally.
Means execute this step only if any of the previous steps, terminated
abnormally.
25. How do you check the syntax of a JCL without running it?
Used to copy one QSAM file to another. Source dataset should be described
using
SYSUT1 ddname. Destination dataset should be decribed using SYSUT2.
IEBGENR
can also do some reformatting of data by supplying control cards via SYSIN.
Code the DSN as pds(member) with a DISP of SHR. The disp applies to the
pds and
not to a specific member.
Multiple jobs are submitted (as many jobs as the number of JOB cards).
29. I have a COBOL program that ACCEPTs some input data. How
do you code the JCL statment for this? ( How do you code instream
data in a JCL? )
//SYSIN DD*
input data
input data
/*
One way is to code SYSIN DD DUMMY in the PROC, and then override this
from the JCL with instream data.
32. How do you run a COBOL batch program from a JCL? How do
you run a COBOL/DB2 program?
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.
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
linklist.
JOBLIB is ignored.
The library with the largest block size should be the first one.
Records will be written to end of file (append) when a WRITE is done in both
cases.
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.
1Q. If a region parameter is specified in both the job card and the step card, which one does
the system use ?
1A. The job card overrides the step card.
2Q. If multiple COND parameters are specified on a step, is the relationship between the
parameters a logical “AND” or a logical “OR” ?
2A. A logical “OR” - at least the condition specified must be true to bypass the step.
6Q. When creating a dataset, how do you tell the system to free up unused space when the
dataset is closed ?
6A. Specify RLSE.
7Q. If the first subparameter in the DISP parameter is not coded what will be the default
?
7A. The first subparameter defaults to NEW.
9Q. What is the purpose of the COND parameter in the EXEC statement ?
9A. To conditionally control the execution of a job step based on the outcome of a prior job
step. The parameter is compared with the actual return code and if the compare is true,
processing terminates.
23Q. Can you place an instream PROC anywhere within the body of the JCL ?
23A. No. The PROC must precede the first EXEC statement of the JCL.
29Q. If a Ddname is in the JCL but not in the program, what will happen at execution
time?
29A. Nothing.
38Q. If the TYPE parameter is omitted from the LABEL parameter of a tape, what
type of labels are assumed ?
38A. Standard labels.
48Q. How does the system know that a data set is temporary ?
48A. && in DSN
55Q. If no disposition is coded for a temporary data set, when is the data set deleted ?
55A. At the end-of-job.
60Q. What is the maximum number of times the secondary space allocation will be
attempted ?
60A. 15
62Q. If you have a job that creates the next (or new) generation of a data set, what is the value
assigned to the DSN ?
62A. +1
72Q. How are symbolic parameters identified and how are they used ?
72A. Symbolic parameters begin with an ampersand (&). They provide an alternative method
of modifying parameters on the DD statement.
77Q. How do you code a DD statement to prevent a tape data set from being mounted until the
program opens the data set ?
78Q. For what purpose are RETPD and EXPDT used, and how do they differ ?
78A. They are used to assign retention periods to data sets. Retpd assigns a specific number of
days from 0 to 9,999. Expdt assigns a year and a day from 001 to 366 within the year.
80Q. A system 0013 abend is an error during the execution of an open macro. What are the
most common reasons for this error ?
80A. 1. Conflicting or incomplete DCB subparameters.
2. No block size in the DD DUMMY.
3. Member name specified in the DD not found.
Open this file and write the JCL statements into this file.
Example:
Q: How to pass the temp dataset form one JOB step to another?
A: By specifying the DISP as PASS for the temp dataset
Q: What is JCL?
A: It is an interface between operating system (MVS) & the
application program. When two related programs are combined
together on control statements, it is called job control language
Q: What is a GDG?
A: 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 generation
number, yy-version number.
GDGs can be sequential, direct, partitioned. (VSAM - no). They must
always be cataloged.
Advantages - all datasets have the same name and system keeps
track of adding new and retaining previous generations and deleting
oldest successive generation. To create a GDG we create a GDG index
in the system catalog with IDCAMS utility and then a model
(prototype, DSCB) on the same volume to supply DCB information.
Empty - when limit is reached all members are removed from the
index, otherwise only oldest. Scratch-removed members are
uncataloged & deleted, otherwise - removed & uncataloged, but
remain in the system (not members of GDG any more). GDG number
is updated at the end of the job. If number is not specified all
generations will be processed from the beginning
Q: What is DSNDB06?
A: This is the Place where DB2 Catalog resides;
Q: How many parameters are there to a DISP statement and what are
their uses.
A: 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)
Q: What is COMP?
A: COMP - HALF WORD BINARY
Q: What is a PROCEDURE?
A: A set of precoded JCL that can be modified through the use of
parameters or override cards. Note: Procedures can be catalogued or
instream.
Q3. Describe the JOB statement, its meaning, syntax and significant keywords.
A3. 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.
Q4. Describe the EXEC statement, its meaning, syntax and keywords.
A4. 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.
A5. 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.
Q6. What is a PROC? What is the difference between an instream and a catalogued
PROC?
A7. 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.
A9. GDG stands for generation data group. It is a dataset with versions that can
be referenced absolutely or relatively. It is defined by an IDCAMS define
generation datagroup execution.
Q11. What is the difference between specifying DISP=OLD and DISP=SHR for a
dataset?
A11. DISP=OLD denotes exclusive control of the dataset; DISP=SHR means there is
no exclusivity.
A12. DISP=MOD is used when the dataset can be extended, ie, you can add records
at the end of an existing dataset.
Q13. 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?
A13. The keywords associated with the DCB parameter are LRECL, RECFM, BLKSIZE
and DSORG. The DCB information can be supplied in the DD statement. The sysem
looks for DCB information in the program code first.
A15. 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. (If this answer confuses you,
welcome to the club - memorize it and don't ask questions!)
A16. 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.
Q17. What is the purpose of the PARM keyword in the EXEC statement?
A17. The value after the PARM= specifies control information to be passed to the
executing program of the job step.
Q18. What is the purpose and meaning of the REGION keyword and what JCL
statement is it associated with?
A18. 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.
Q19. What is the purpose and meaning of the TIME keyword and what JCL statement
is it associated with?
A19. 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.
Q20. What is the meaning of data definition name (ddname) and dataset name
(dsname) in the DD statement?
A20. 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.
A21. For an output file DUMMY specifies that the output is to be discarded. For
input it specifies that the file is empty.
Q22. What does the keyword DCB mean and what are some of the keywords associated
with it?
A22. 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.
Question: GDG?
Answer: 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. Advantage - all datasets have the same name and system keeps
track of adding new and retaining previous generations and deleting oldest successive
generation. To create a GDG we create a GDG index in the system catalog with IDCAMS
utility and then a model (prototype, DSCB) on the same volume to supply DCB information.
Empty - when limit is reached all members are removed from the index, otherwise only oldest.
Scratch-removed members are uncataloged & deleted, otherwise - removed & uncataloged, but
remain in the system (not members of GDG any more). GDG number is updated at the end of
the job. If number is not specified all generations will be processed from the beginning
Question: What is the difference between IEBGENER, IEBCOPY and REPRO in IDCAMS
utility?
Answer: IEBGENER -- This is a dataset utility for copying sequential datasets which produces a
PDS or a member from a sequntial 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.RAVI
Answer: Use a file //dd1 DD sysout=(*,intrdr)write your JCL to this file. Pl some on try this out.
Question: What are three major types of JCL statements? What are their functions?
Answer: JOB, EXEC, DD. 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).
IDMS
Q1. What is the difference between a schema and a subschema?
A1. The schema is the physical arrangement of the data as it appears in the
DBMS. The subschema is the logical view of the data as it appears to the
application program.
Q4. Explain the difference between record occurrence and record type.
Q5. What is the difference between local and central version operating modes?
A5. In local there is no IDMS System running above the DBMS. It's the more
efficient mode but lacks the recovery and integrity facilities of the central
version (CV) control program. In CV many application programs access the
database through a single copy of the DBMS.
A8. A junction record is a member record type that allows for many-to-many
relationship between its two owner records. For a school database the CLASS
record is a junction for the TEACHER and SUBJECT record types.
A9. Calc is based on a symbolic value which is used to determine the target
page. Via mode is for members only. Via records are stored near to their owners.
In direct mode the target is specified by the user and is stored as close as
possible to that page.
A10. A set is an owner record and, optionally, its member records. There are
three types of pointers: next, prior and owner, but only next is required. There
are five possible orders for arrangements of sets; they are: first - insert at
beginning, last - insert at end of set, next - insert after current of set,
prior - insert prior to current of set and sorted - insert according to sort
value.
A11. The READY prepares a database area for access by DML functions.
A12. It writes a checkpoint to the Journal File and releases any record locks.
A13. It rolls back (reverses) all database updates to the point of the last
rollback or to the beginning of the run-unit.
A15. IDD is the Integrated Data Dictionary. It contains information about the
elements, record types, sets, maps and dialogues within the database.
Q16. What is the meaning of the return codes 0307 and 0326?
A17. It generates a bind run-unit and binds all the records for the sub-schema
the program is referencing.
A18. Autostatus is a protocol mode which causes the expansion of each DML
statement to include a 'perform IDMS-Status' statement.
A19. It places a record in the database based on the location mode specified.
A20. It will connect to all sets where it is defined as an automatic member. The
store requires that currency be established for all these set occurrences.
A21. The old joke - where the programmer thinks he is, but the DBMS knows he
isn't. Currency is the location within the database during run-unit execution.
There are four levels of currency: current of run-unit is the record occurrence
of the last successful find or obtain; current of record type is for the most
recent of each record type; current of record set is the most recent within each
set and current of area is within each area.
Q22. If the stored record is not defined as automatic of a set, how can it be
stored as a member of the set.
A22. Store the record then connect it to each set where it is a manual member.
Q23. So manual and automatic are the connect options for a set. What are the
disconnect options.
Q24. Distinguish among erase, erase permanent, erase selective and erase all.
A24. Erase cancels the membership of a record in specific set occurrences and
removes only the named record. Erase permanent removes the specific record and
all mandatory occurrences it owns. It disconnects all optional members. Erase
selective removes the record, all mandatory members and all optional members not
connected to other sets. It disconnects those that are connected. Erase all
removes the specified record and all the mandatory and optional records it owns.
A25. IDMS uses record locks to prevent another run-unit from updating the same
record.
Q26. What are the types of record locks and how are they set?
A26. Locks may be shared or exclusive. Shared means that other run units can
retrieve the record but can not modify it. Exclusive means that other run units
can neither retrieve nor modify it. Record locks may be implicit or explicit.
Implicit locks are set in the ready statement usage clause. Explicit locks are
set using either the keep statement or keep option of the find/obtain command.
A28. nn29 means that two run units are waiting to set locks on the same record
and are in deadlock.
A29. An area sweep accesses records on the basis of the physical location in a
database area. It can be total, meaning a record by record search of the area,
or it can be of occurrences of records of a specific type.
Q30. Why would you use find and get rather than an obtain?
A30. Find tells you whether the record is actually in the database. If it is not
found you save the overhead of an obtain.
Q31. When you are obtaining next within a set and get a end of set return code,
on what record are you now current?
A32. A bind associates record types with the program work area; for run unit and
records it is the first command issued in the program.
Q34. Is there a application program coding difference between local and central
version mode?
A34. No. The mode is specified via the SYSCTL DD card in the JCL.
Q35. If you are current on the owner of a set, what is the difference between an
obtain next and obtain first?
A35. No difference. There is a difference between obtain first and obtain next
for an area sweep, but not when current on the owner in a set.