JCL Interview Questions for Experienced Professionals
At this level, a person should not only be able to identify JCL syntax but also explain how to use it in real-world mainframe projects to maximise workloads and solve complex problems. Your responses must exhibit pragmatic understanding and application of concepts.
30. How do I use GDGs in JCL?
In an unordered list, I use Generation Data Groups (GDGs) to organise datasets that appear in chronological order (like daily input files). A GDG base can be constructed using IDCAMS, and each dataset can be described as a generation (+1, 0, -1). For example:
//STEP1 DD DSN=MY.GDG(+1),DISP=(NEW,CATLG,DELETE)
This sets up the next generation. If I wish to read the most recent one, I select (0). GDGs allow me to automate a daily/weekly job without the need to manually change dataset names.
31. How do I handle out-of-space errors (SB37, SD37, SE37)?
Based on my knowledge, I would state that these abends are caused when a dataset is deprived of primary or secondary space. I resolve these issues by:
- Increasing the primary and secondary space values contained within the SPACE parameter.
- Switching to a different UNIT or VOLUME with a larger capacity.
- Occasionally switching from TRACKS to CYLINDERS.
Example:
SPACE=(CYL,(50,10),RLSE)
This stops space abends by allocating additional cylinders.
32. What is the difference between system abend codes and user abend codes?
The difference between system abend codes and user abend codes is:
- Systems abends (Sxxx) are generated by the OS (i.e., S0C7 for a data exception, S0C4 for an invalid memory).
- User abends (Uxxx) are done by the program logic, usually through the use of the ABEND statement in COBOL or assembler.
As an example, when I encounter a U0016 abend, it often indicates that there has been a user-defined check that has failed.
Aspect |
System Abend Codes |
User Abend Codes |
Generated By |
Operating system (OS). |
User-written program/application. |
Cause |
Hardware/software errors, space issues, system failures. |
Logic errors, missing input, and custom program checks. |
Examples |
S0C7 (data exception), S322 (timeout). |
U0016 , U1001 . |
Handling |
Check system manuals and fix resource/space issues. |
Debug program logic or correct data issues. |
33. How do I use the TIME parameter in JCL?
I can assign the TIME variable anywhere in the JOB or at the STEP level.
Example:
//STEP1 EXEC PGM=MYPROG,TIME=(1,30)
This scenario assigns STEP1 for a minute and thirty seconds. For an unlimited time, I use TIME=MAX. In production, I assign limits mainly to stop jobs from running uncontrollably and using excess resources.
34. What is the difference between HOLD and TYPRUN=HOLD in JCL?
Here is the difference between HOLD and TYPRUN=HOLD:
- HOLD on JOB statement: Offers the ability to submit a job in the input queue, and the job stays there until the operator decides to release it.
- TYPRUN=HOLD: I can use this in tests or when I need an operator to check the job before the system executes it.
I use this when I am trying to troubleshoot sensitive production jobs.
35. How do I use symbolic parameters in JCL?
Symbolic parameters apply to my PROCs as they can be made ‘flexible’ and defined inside the PROC using &, and values supplied in the calling JCL.
In PROC
//STEP1 EXEC PGM=&PGM
In JCL:
//MYJOB JOB (ACCT)
//PROC1 PROC PGM=IEFBR14
In this instance, I can override &PGM when calling, which comes in handy when reusing procedures across different teams.
36. What is the use of the NOTIFY parameter?
When I submit jobs, I often want to know the completion status of the jobs. The NOTIFY parameter sends completion messages to my TSO ID. Example:
//MYJOB JOB (ACCT),'NAME',NOTIFY=&SYSUID
This type of automatic notification system works to my advantage, which is especially appreciated on jobs that take a considerable amount of time to complete.
37. What are generation data group limits, and how do I manage roll-off?
By default, a GDG base can contain 255 generations. When it reaches its capacity, it simply rolls off the oldest generation. That is, let’s say if limit=5, and I create (+1), it creates a 6th generation but rolls off the 1st generation. I do this by setting the limit based on the business needs.
38. What is DISP=SHR vs DISP=OLD?
Here is the difference between DISP=SHR and DISP=OLD:
- SHR: Allows concurrent read access. I use this when multiple jobs require the same input dataset.
- OLD: It provides exclusive control, meaning that until the job using the dataset file finishes, no other job can access it again. I use OLD when processing datasets to reduce the risk of someone else trying to use that dataset file at the same time.
Making that distinction is very important for production jobs.
DISP Type |
Meaning |
Usage Example |
DISP=SHR |
The dataset is shared for read/write by multiple jobs. |
Used for read-only datasets. |
DISP=OLD |
Exclusive control – no other job can use it. |
Used when the dataset must not be accessed simultaneously. |
DISP=MOD |
Append new records at the end of an existing dataset. If it doesn’t exist, it creates a new one. |
Useful in log datasets and report files. |
39. What are concatenated PROCLIBs in JCL?
A concatenated PROCLIB in JCL is a collection of Partitioned Datasets (PDSs) that are connected to create a single logical procedure library. This enables the system to look for procedures in a specified order across several libraries.
We have multiple PROCLIB DSNs in some projects. I concatenate them like this:
//JOB1 JOB (ACCT)
// JCLLIB ORDER=(PROCLIB1,PROCLIB2)
In this example, the system will search PROCLIB1 first, then PROCLIB2 for catalogued procedures. This offers some structure regarding which team or environment is associated with which documented procedures.
40. How do I use the TYPRUN=SCAN option?
To use the TYPRUN=SCAN option, you can place it in your job card. The TYPRUN=SCAN option will allow you to syntax check the JCL of the job without actually running the job. It’s handy for checking JCL for things like misspelt keywords, illegal characters, or unmatched parentheses before you submit the job for execution.
To use TYPRUN=SCAN, find your JOB statement. The first statement in your JCL is the JOB statement. Then type TYPRUN=SCAN. Add it as a keyword parameter as part of your JOB statement.
41. How do I override a dataset in PROC from the main JCL?
I override datasets by coding a DD statement in the calling JCL. For example, if the PROC has:
//STEP1 DD DSN=OLD.DATA,DISP=SHR
I can override in JCL like this:
//STEP1.DD DSN=NEW.DATA,DISP=SHR
I make this change to the JCL and do not modify the PROC so that I can use that PROC again in the future.
42. How do I use condition checking with abend codes?
Condition checking with ABEND codes, especially in a z/OS environment, enables us to execute JCL steps conditionally on whether or not a previous step has terminated abnormally. This is essential for directing job flow and executing recovery actions.
Methods of Condition Checking with ABEND Codes:
Checking Conditions with IF ABEND THEN Statements in JCL:
- This is the contemporary “best practice” approach to conditional processing in JCL. // IF ABEND THEN
- This checks if a previous step in the job stream terminated abnormally. If stepname.ABEND THEN
This checks whether the stepname is terminated abnormally.
- // IF (stepname.RC > 0 | stepname.ABEND) THEN
This checks for either a return code of greater than zero or an ABEND in stepname.
Example:
//STEP1 EXEC PGM=MYPROG1
// IF STEP1.ABEND THEN
//STEP2 EXEC PGM=ABEND_RECOVERY_PROG
// ELSE
//STEP3 EXEC PGM=NEXTPROG
// ENDIF
43. How do I optimise JCL jobs for better performance?
I optimise JCL jobs by:
- Using symbolic parameters: Symbolic parameters are variables that can be defined and used in JCL statements. They offer a method for changing the values of parameters rather than changing the code itself.
- Using conditional processing: Conditional processing is a process of controlling and optimising the JCL job, depending on the result of the previous step.
- Using restart and checkpoint features: Restart and checkpoint features are mechanisms that allow you to continue from a specific point of the JCL job if it is interrupted.
- Using optimal allocation and disposition: Allocation and disposition are parameters that define how the datasets used by the JCL job are created, accessed, and disposed of.
- Using performance tuning tools: Performance tuning tools are utilities that analyse and tune the performance of your JCL jobs.
Other Important JCL Questions
In addition to basic, intermediate, and advanced interview subjects, I have encountered many scenario-based and practical JCL questions. These are a few of the other important JCL areas I study for.
44. What are some common JCL utilities I’ve used?
From my experience, the most common JCL utilities are:
- IEBGENER: For copying datasets, printing, and creating members in PDS.
- IEBCOPY: For handling partitioned datasets (PDS).
- SORT/ICETOOL: For sorting, merging, and filtering data.
- IDCAMS: For creating, deleting, and REPRO VSAM files.
- IEFBR14: A “do-nothing” program used only to allocate or delete datasets.
- IEHMOVE: Moves or copies sequential datasets.
- IEHPROGM: Deleting and renaming datasets.
- IEHCOMPR: Used for data comparison in sequential datasets.
45. How do I create a new dataset in JCL?
I use the IEFBR14 utility program with a DD statement to create a new dataset in JCL. For example:
//STEP1 EXEC PGM=IEFBR14
//NEWFILE DD DSN=MY.NEW.DATASET,DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(5,2)),DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)
This creates a data set with defined space and DCB attributes. I am using DISP=(NEW, CATLG, DELETE) so it will catalogue the data set if successful or delete it if it abends.
46. How do I conditionally execute steps in JCL?
I use either the COND parameter or an IF/THEN/ELSE block.
- If I am using the COND parameter:
//STEP2 EXEC PGM=XYZ,COND=(0,NE,STEP1)
This means run STEP2 only if STEP1 did not end with a return code of 0.
- If I am using the IF/THEN/ELSE block, it looks like this:
// IF (STEP1.RC = 0) THEN
//STEP2 EXEC PGM=ABC
// ELSE
//STEP3 EXEC PGM=XYZ
// ENDIF
This allows jobs in JCL to be flexible and allows you to not run a step if it is not necessary.
47. How do I override a PROC parameter in JCL?
By overriding a PROC parameter in JCL, we are able to change parameter values that have been defined in a catalogued procedure without actually changing the procedure itself. This is achieved by invoking JCL.
To override parameters in EXEC statements in a PROC:
- Specify the parameter on the EXEC statement of the invoking JCL.
//STEPNAME EXEC PROCNAME,PARM1=NEWVALUE1,PARM2=NEWVALUE2
- STEPNAME is the name of the job step that is executing the PROC.
- PROCNAME is the name of the catalogued procedure.
- PARM1=NEWVALUE1 and PARM2=NEWVALUE2 are the parameters you want to override and their new values.
To override parameters in DD statements in a PROC:
- You need to identify the specific DD statement in the PROC that you want to override. This means you will need to know the step name in the PROC and the DD name.
- Code the overriding DD statement in the invoking JCL, following the EXEC statement that calls the PROC.
48. What is the purpose of the INCLUDE statement in JCL?
The JCL INCLUDE statement, inserted somewhere in the JCL stream of code, implements code or parameter lists that are commonly reused from an external member, improving reuse and maintenance of code.
INCLUDE allows me to retrieve external JCL statements that are stored in a member. Example:
// INCLUDE MEMBER=MYLIB(MYSTEP)
I use this to avoid repeating standard code (for example, DD statements). It’s similar to programming with header files.
49. How do I handle return codes in JCL?
In Job Control Language (JCL), return codes indicate the success or failure of the individual job step or program executing in the step. You must manage these return codes to control the process flow and execution of the JCL job.
Each step will generate a return code (RC), and I “check” these RC codes using COND or IF conditions. Example:
- RC=0 – Normal completion.
- RC=4 – Warning, but execution continues.
- RC=8/12/16 – Serious errors.
I will manage the job flow in production and prevent invalid output from processing by checking return codes.
50. What are concatenated datasets in JCL?
Concatenating datasets is combining two or more of the same type of datasets together, forming a single logical dataset that is accessed as a single unit. The purpose of concatenation is to allow a program (or a step in JCL with the DD statement) to read from multiple datasets one at a time without the need to separately access each dataset.
I can combine multiple input datasets into a single dataset descriptor (DD).
For example:
//INPUT DD DSN=DATA.FILE1,DISP=SHR
// DD DSN=DATA.FILE2,DISP=SHR
The program would read FILE1 first and then FILE2 as if it were a single dataset. I have done that for utilities such as SORT or copy jobs.
51. How do I suppress job output in JCL?
To suppress job output, we can use the OUTDISP parameter on the DD statement and specify OUTDISP=PURGE. This tells the Job Entry Subsystem (JES) to discard the output dataset after the run, rather than keeping it for printing or output review.
//SYSUT1 DD DSN=&&TEMP,DISP=(NEW,DELETE),UNIT=SYSDA,SPACE=(CYL,(1,1))
//SYSPRINT DD SYSOUT=*,OUTDISP=PURGE
In this example, the output of the job is suppressed by purging the SYSPRINT dataset, which normally contains program output or system messages.
52. What is the difference between JES2 and JES3 in JCL?
Here are the differences between JES2 and JES3 in JCL:
- JES2: Each job is handled independently; it is slightly easier to set up and mostly used in business applications.
- JES3: A centralised job scheduler, allowing multiple jobs to share devices, and is more suited to large multi-system environments.
In my project work, I mostly worked on JES2 since it is more widely installed.
Aspect |
JES2 |
JES3 |
Control |
Each job is managed independently. |
Centralized control over multiple jobs. |
Scheduling |
Job scheduling is decentralized. |
Job scheduling is centralized. |
Resource Handling |
Handles resources at the step level. |
Handles resources at the job level. |
Complexity |
Simpler, widely used. |
More complex, less common. |
Usage |
Suitable for small/medium workloads. |
Suitable for large, interdependent workloads. |
53. How do I resolve JCL abends like S0C7 and S322?
JCL abends are caused by data errors, so in order to fix an S0C7 Data Exception, I use the offset that has been provided to analyse the program’s listing and system output and identify the invalid data that is causing the problem. Increasing the TIME parameter on the job’s EXEC statement or setting it to NOLIMIT will allow for unlimited processing time for S322, which indicates that the job exceeded its CPU time limit.
Conclusion
While your preparation for a mainframe interview can seem like a lot on your plate, you can be confident with a solid understanding of JCL interview questions and answers. JCL interview questions and answers are important for any mainframe developer because they affect how jobs are executed, optimised, and debugged.
Always remember that interviewers are not just trying to see if you can write a JCL script, but they want to see how you think, troubleshoot or diagnose errors, and optimise jobs. You will be ready to ace your next mainframe interview if you practise with actual JCL scripts and review these JCL interview questions and answers.