Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
JCL Interview Questions For Freshers
2.1.
1. What is JCL (Job Control Language)?
2.2.
2. Does JCL support automatic restart?
2.3.
3. Explain the JOB statement in JCL?
2.4.
4. What are the benefits of using JCL?
2.5.
5. Explain different types of Job control statements or JCL statements.
2.6.
6. State the difference between positional parameter and keyword parameter in JCL.
2.7.
7. Explain some of the commonly used parameters in the EXEC statement.
2.8.
8. What is a temporary dataset in JCL? How to create a temporary dataset? 
2.9.
9. What are the symbolic parameters and why is it required?
2.10.
10. Explain the JCL EXEC statement?
2.11.
11. Explain the DD statement in JCL?
2.12.
12. What are different parameters for DD (Data Definition) statement?
2.13.
13. Explain the difference between JOBLIB and the STEPLIB statements.
2.14.
14. How can a JCL's syntax be checked without running it?
2.15.
15. Why include statement is used in a JCL?
3.
JCL Interview Questions for Experienced
3.1.
16. What does JCL's temporary dataset mean? How can a temporary dataset be made?
3.2.
17. What’s the use of symbol // in JCL?
3.3.
18. Which utility is used to run a COBOL-DB2 Program?
3.4.
19. Explain Msglevel parameter and its importance.
3.5.
20. What is the time parameter in JCL? Explain what does TIME=1440 mean?
3.6.
21. Explain DFSORT utility?
3.7.
22. What is a Generation Data Group (GDG)?
3.8.
23. What are the hierarchy levels in JCL?
3.9.
24. How do you create a temporary dataset? Where will you use them?
3.10.
25. How do you submit a job for execution?
3.11.
26. How can a Sort program be used to convert a Fixed Block (FB) file into a Variable Block (VB) file?
3.12.
27. How can a FB file convert to a VB file using the SORT program?
3.13.
28. What are “Cond=even” and “Cond=only”?
3.14.
29. Can you code instream data in PROC.
3.15.
30. Explain NOTCAT 2- GS.
4.
JCL Scenario-Based Interview Questions
4.1.
41. How would you handle a situation where a JCL job abends, and you need to restart it from a specific step?
4.2.
42. What would you do if a JCL job fails due to a missing dataset?
4.3.
43. How would you handle a job that takes too long to execute due to excessive resource usage?
4.4.
44. How do you execute the same step multiple times in a single job?
4.5.
45. How do you ensure that a specific step runs only if the previous step completes successfully?
4.6.
46. What would you do if a job needs to be executed on specific days of the week?
4.7.
47. How would you modify JCL to handle a dataset that needs to be updated conditionally?
4.8.
48. How would you pass parameters from one job to another in JCL?
4.9.
49. How would you handle a situation where a job requires exclusive access to a dataset?
4.10.
50. How do you handle conditional job execution based on multiple steps' return codes?
5.
JCL MCQ
5.1.
51. Which parameter is used to restart a JCL job from a specific step?
5.2.
52. What is the default disposition of a dataset if DISP is not specified?
5.3.
53. In JCL, what does the COND parameter do?
5.4.
54. Which of the following parameters in JCL is used to specify CPU time limit for a job?
5.5.
55. What does the DD statement define in a JCL job?
5.6.
56. What happens if DISP=MOD is used in the DD statement for a dataset?
5.7.
57. What is the purpose of the PGM parameter in JCL?
5.8.
58. In JCL, which utility is used for copying data from one dataset to another?
5.9.
59. What does DISP=OLD specify in the DD statement?
5.10.
60. What is the function of the SYSOUT parameter in JCL?
6.
Conclusion
Last Updated: Sep 30, 2024
Easy

JCL Interview Questions

Author Komal Shaw
0 upvote

Introduction

The MVS (Multiple Virtual Storage) Job Control Language (JCL) is a scripting and command language used to specify jobs (units of work) to the IBM mainframe operating system. JCL thus bridges your application program or jobs (such as COBOL, PL/1, etc.) and the mainframe OS (such as MVS, Z/OS). It mainly comprises task control statements (JOB, EXEC, and DD instructions), which instruct the OS on what must be done for a job/application program to function.

JCL Interview Questions

In a mainframe environment, programs can run in batch or online mode. JCL can be used to run a program in batch mode, which is the automatic execution of several programs or tasks on a computer.
 

Some JCL Interview Questions are important and must be done before an interview. So let us go through some of the top JCL Interview Questions. 

JCL Interview Questions For Freshers

Here are most asked JCL Interview Questions for freshers. 

1. What is JCL (Job Control Language)?

JCL or Job Control Language, this language controls jobs. On the IBM mainframe operating system, a scripting language called JCL is used to give instructions to the system for a batch process. It is a collection of instructions you program to inform the operating system of the action you wish to take. Occasionally, this set of statements is rather vast, but most jobs can be completed with just a tiny portion of them.
JCL instructions inform OS where to look for the necessary input, how to handle it, and what to do with the processed input's output.

2. Does JCL support automatic restart?

By using a specified keyword parameter, it is possible to have an automatic restart in JCL. One of those keywords used to restart is the RDkeyword. In most cases, it is successful in causing the program to end unexpectedly. We must weigh the significance of checkpoints, which specify the task execution at various places in the program in question, against the location of the automated restart.

3. Explain the JOB statement in JCL?

The Operating System (OS) in the spool and the scheduler receive the job identifier from the JOB statement. It is the JCL's opening control statement. The JOB statement's available parameters aid the OS in choosing the appropriate scheduler. It is helpful for alerting the user and determining how much CPU time is needed.

SYNTAX - //Job-name JOB Positional-param, Keyword-param

4. What are the benefits of using JCL?

JCL has many advantages, including the ability to merge and sort diverse data files, delete and create numerous data sets, use VSAM (Virtual Storage Access Method) Clusters and GDGs, and compare files with varied PDS (Partitioned Data Set) members.

5. Explain different types of Job control statements or JCL statements.

There are 3 JCL statements. A job specifies a certain workload that z/OS will handle. EXEC gives the name of an application program or JCL procedure that the system intends to execute. In the EXEC statement, DD specifies the program's or procedure's input and output.

6. State the difference between positional parameter and keyword parameter in JCL.

Position parameters in a program have a defined order; if you wish to skip a particular parameter, you must write a comma. It always adheres to JCL's job description. In contrast to positional parameters, keyword parameters can be entered in any sequence.

7. Explain some of the commonly used parameters in the EXEC statement.

The EXEC statement may also include roughly a dozen keyword parameters in addition to the two positional parameters. The system's intended program is identified by the PGM parameter. The system will execute the catalogued or in-stream procedure specified by the PROC parameter or procedure name.

8. What is a temporary dataset in JCL? How to create a temporary dataset? 

Data sets that are created and deleted in the same task are considered transitory data sets. Temporary datasets are dynamically allocated on disc by default. Dynamically allocated datasets may hold up to 3.1 MB of data and don't require DD statements in the JCL.

9. What are the symbolic parameters and why is it required?

In general, a parameter should be regarded as symbolic if it changes with each program execution. The process is made more adaptable by employing symbolic parameters. The process won't need to be changed every time a modest, frequent change is made elsewhere. The string of 1 to 7 alphanumeric characters is preceded by an ampersand (&) in symbolic parameters. You must follow & with an alphabetic character. JCL statements only allow symbolic parameters to appear in the operand field; they do not allow them to appear in the name or operation fields. If more than one symbolic argument is assigned to a PROC or EXEC statement, only the first is used.

10. Explain the JCL EXEC statement?

Numerous job steps can be included in a JCL, and a job step can either invoke a procedure or directly execute a program. JCL can therefore run one or more programs (job steps). The EXEC statement is the one that carries the job step program information. The EXEC statement's goal is to supply the necessary data. The software that runs during the job phase receives this information.

SYNTAX - //Step-name EXEC Positional-param, Keyword-param

11. Explain the DD statement in JCL?

The records are contained in datasets, which are mainframe files structured in a particular way. These files serve as fundamental data storage areas and are kept on the mainframe's Direct Access Storage Device (DASD) or Tapes. If a batch application is needed to manipulate these data, the physical dataset name and file format are coded in a JCL.
The dataset definition used in JCL can be found in the DD statement's help. A DD statement must specify the input and output resources needed for a work phase. These resources must be described in detail, including the dataset organization, the amount of storage required, and the record length.

12. What are different parameters for DD (Data Definition) statement?

The following are some of the key parameters for DD statement:-

  • DDNAME: Specifies a symbolic name for the data set, allowing the program to reference it by name rather than by data set name
     
  • DSN (Data Set Name): Specifies the name of the data set, which includes the high-level qualifier (HLQ) and the low-level qualifier (LLQ)
     
  • DISP (Disposition): Specifies how the system should handle the data set after completing the job step
     
  • SPACE: Defines the allocation and space management parameters for the data set, including attributes like primary space, secondary space, and space units

13. Explain the difference between JOBLIB and the STEPLIB statements.

In Job Control Language or JCL, JOBLIB specifies a library of programs or procedures that are available for all the steps within a job. STEPLIB specifies a library of programs or procedures that are specifically available to a particular job step.

14. How can a JCL's syntax be checked without running it?

By entering TYPERUN=SCAN on the JOB card or using JSCAN, we can examine the syntax of JCL without running it.

15. Why include statement is used in a JCL?

It serves as a substitute for STEPLIB. All the datasets defined in the included dataset will be searched when the dataset name is specified in the include statement.

JCL Interview Questions for Experienced

16. What does JCL's temporary dataset mean? How can a temporary dataset be made?

Temporary datasets are files that contain one or more records that are only required for the duration of work before being erased. They only need storage for the time necessary to finish the job, after which they are removed. These datasets are frequently expressed as DSN=&&name or just without a DSN. They enable us to pass the results of one phase to another in the same job.

17. What’s the use of symbol // in JCL?

It's a vital sign that's employed in JCL statements. This symbol must come first in every JCL statement. The JCL statements must be executed in accordance with a predetermined rule; otherwise, an error is thrown.
The (//) sign at the start of JCL statements is the first thing the JCL execution mechanism looks for. Runtime exceptions are avoided because of this.

18. Which utility is used to run a COBOL-DB2 Program?

The COBOL-DB2 program is executed using the IKJEFT01 function.

19. Explain Msglevel parameter and its importance.

The MSGLEVEL parameter in JCL (Job Control Language) specifies the level of messages to be displayed in the job's output. It is important for controlling the verbosity of job logs. Higher values provide more detailed messages that helps in debugging, but they can also result in larger output files. Lower values reduce the amount of details available in the output.

20. What is the time parameter in JCL? Explain what does TIME=1440 mean?

The JCL TIME keyword parameter, which is optional, defines how long a job may use the CPU. Simply put, TIME indicates the maximum amount of time that the CPU can be used to run the job. The TIME parameter can also be coded at the Job and Step levels. The system will automatically halt the JOB execution once the set execution time has passed. As a result, the Duration parameter will alert OS of the maximum CPU utilization period, and OS will automatically cancel the job once the specified time has passed.

21. Explain DFSORT utility?

A strong IBM tool is DFSORT. Datasets are copied, sorted, and combined using it. The input datasets are specified using the SORTIN and SORTINnn DD commands. The output data is chosen using the SORTOUT and OUTFIL commands. 
Using JCL, the utility application DFSORT processes or manipulates sequential files only for mainframes.

22. What is a Generation Data Group (GDG)?

A group of sequential or functionally linked datasets is referred to as a generation data group. Periodically, they are addressed by adding a new generation, getting rid of the eldest generation, and occasionally keeping older generations.

23. What are the hierarchy levels in JCL?

The hierarchies in JCL allow you to easily organize and execute complex job flows. Let's discuss these hierarchies.

  • Job Level: This is the highest level in JCL, which represents an entire job with multiple job steps.
     
  • Job Step Level: Each job can consist of one or more job steps, each defining a specific task or program to execute.
     
  • DD Statement Level: Within each job step, DD (Data Definition) statements define input and output data sets and their attributes.

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

Temporary datasets can be produced by either not specifying a DSNAME or by specifying the temporary file indicator as in DSN=&&TEMP. They are used by us to transmit the results of one phase to the next step in the same job. Once the project is finished, the dataset won't be held in reserve.

25. How do you submit a job for execution?

For each task to be completed on a mainframe, a job must be written and sent to the mainframe computer for processing. This is referred to as posting a job.
You can submit a JOB from your CICS application software in a variety of ways. We may accomplish this by writing your JCL straight to the JES Spool using the CICS Spool Interface instructions.

26. How can a Sort program be used to convert a Fixed Block (FB) file into a Variable Block (VB) file?

The SORT utility in JCL allows you to convert a Fixed Block (FB) file into a Variable Block (VB) file using the FTOV option. With the FTOV, fixed-length input records are transformed into variable length output records. In a VB file, each record includes an additional 4 bytes for the Record Descriptor Word (RDW), making the record length in the VB file equal to the RDW length (4 bytes) plus the actual record length. Let's take a look at an example.

SORT parameters:
SORT FIELDS=COPY
OUTFIL FNAMES=OUTPUTFILE,FTOV

 

In this example, OUTPUTFILE represents the VB output file. If you input an 80-byte FB file, the output will be an 84-byte VB file (including 4 bytes for the RDW).

27. How can a FB file convert to a VB file using the SORT program?

By using the FTOV option in the SORT application, an FB file can be converted to a VB file.

28. What are “Cond=even” and “Cond=only”?

CODE-EVEN: The current task step is carried out regardless of whether the preceding steps terminated abnormally when COND=EVEN is coded. If additional return code conditions (RCs) are coded alongside COND=EVEN, the job step will run even if none of the RCs are true.
CODE-ONLY: The current work step will only run if a previous step terminated abnormally thanks to the code COND=ONLY. If additional RC conditions are coded alongside COND=ONLY, the job step will run if neither of the additional RC conditions is true and any earlier job steps have abnormally failed.

29. Can you code instream data in PROC.

No, you cannot use instream data inside of a PROC. This is the rule. Most of the time, it is preferable to program a few dummy statements inside the PROC and replace the DD statements from the JCL before running it.

30. Explain NOTCAT 2- GS.

NOTCAT 2-GS is essentially an MVS (Multiple Virtual Storage) message informing the user that duplicate catalog data exists. This might occur, for example, if we wanted to create a new dataset with disp new, catlg but we already had one with DSN = "xxxx.yyyy". We can remedy the situation in this case by erasing the original data set and classifying the new one on the volume where it exists.

JCL Scenario-Based Interview Questions

41. How would you handle a situation where a JCL job abends, and you need to restart it from a specific step?

In JCL, when a job abends and you want to restart it from a specific step, you can use the RESTART parameter in the JOB statement. The syntax for this is:

//JOBNAME JOB (ACCOUNT),'DESC',RESTART=STEP5

In this example, the job will restart from STEP5. Ensure that the steps you are skipping do not impact the restarted step’s execution. If datasets or files were used in previous steps, they need to be managed to avoid conflicts.

42. What would you do if a JCL job fails due to a missing dataset?

If a JCL job fails due to a missing dataset, you can resolve the issue by creating the dataset before rerunning the job. You can also modify the JCL to include the DD DISP=MOD option in the dataset allocation to prevent the job from failing if the dataset is missing, allowing it to create a new dataset instead.

//DDNAME DD DSN=YOUR.DATASET,DISP=(MOD,CATLG,DELETE),...

The MOD option ensures that if the dataset does not exist, it is created.

43. How would you handle a job that takes too long to execute due to excessive resource usage?

If a job takes too long due to excessive resource usage, consider breaking the job into smaller steps or running the job in parallel by splitting the data. You can also optimize the job by revisiting the logic of the steps, ensuring efficient use of resources such as CPU, memory, and I/O.

Using the TIME parameter in the job card can also limit the CPU time for each step:

//JOBNAME JOB (ACCOUNT),'DESC',TIME=(,30)

This limits the execution time to 30 minutes, helping avoid long-running jobs.

44. How do you execute the same step multiple times in a single job?

You can execute the same step multiple times by using the IF/ELSE/ENDIF condition logic in JCL or by including the step multiple times with different labels. Alternatively, you can create a PROC (procedure) and invoke it multiple times.

For example:

//STEP1 EXEC PROC=MYPROC
//STEP2 EXEC PROC=MYPROC

This executes the same procedure twice within a job.

45. How do you ensure that a specific step runs only if the previous step completes successfully?

To ensure that a step runs only if the previous step completes successfully, you can use the COND parameter in JCL. The COND parameter controls the execution of steps based on the return codes of prior steps.

//STEP2 EXEC PGM=PROGRAM2,COND=(0,NE)

This ensures that STEP2 will run only if STEP1 completes with a return code of 0.

46. What would you do if a job needs to be executed on specific days of the week?

If a job needs to run only on specific days, you can schedule it using a scheduling tool like CA-7, OPC, or Control-M. Within the scheduling tool, you can specify the days of the week on which the job should be executed. JCL itself does not handle date-based scheduling but relies on external schedulers.

47. How would you modify JCL to handle a dataset that needs to be updated conditionally?

You can handle conditional dataset updates using the IF/THEN/ELSE/ENDIF statements in JCL. Based on the return code of a prior step, you can conditionally update a dataset in a subsequent step.

//IF STEP1.RC = 0 THEN
//STEP2 EXEC PGM=UPDATEPROG
//ENDIF

 

This logic ensures that STEP2 runs only if STEP1 completes with a return code of 0, allowing for conditional updates to the dataset.

48. How would you pass parameters from one job to another in JCL?

In JCL, you cannot directly pass parameters from one job to another. However, you can use datasets or temporary files to store the required data. The subsequent job can then read from these datasets using DD statements.

For example, the first job writes data to a dataset:

//STEP1 EXEC PGM=WRITEPROG
//DD1 DD DSN=YOUR.DATASET,DISP=(NEW,CATLG)

 

The second job reads from the same dataset:

//STEP1 EXEC PGM=READPROG
//DD1 DD DSN=YOUR.DATASET,DISP=SHR

49. How would you handle a situation where a job requires exclusive access to a dataset?

To handle a situation where exclusive access to a dataset is required, you can use the DISP=OLD parameter in the DD statement. This ensures that no other job can access the dataset while your job is executing.

//DDNAME DD DSN=YOUR.DATASET,DISP=OLD

If another job tries to access the dataset at the same time, it will wait until your job completes.

50. How do you handle conditional job execution based on multiple steps' return codes?

In JCL, you can handle conditional execution based on multiple steps' return codes by combining the COND parameter with specific conditions. You can check multiple return codes and specify which conditions should trigger the execution of the next step.

//STEP2 EXEC PGM=PROGRAM2,COND=((4,LT,STEP1),(8,GE,STEP3))

This example ensures that STEP2 executes if STEP1 returns a code greater than 4, or if STEP3 returns a code less than 8.

JCL MCQ

51. Which parameter is used to restart a JCL job from a specific step?

A) EXEC
B) RESTART
C) COND
D) TIME

Answer: B) RESTART

52. What is the default disposition of a dataset if DISP is not specified?

A) DISP=(OLD,DELETE)
B) DISP=(NEW,CATLG)
C) DISP=(SHR,KEEP)
D) DISP=(MOD,DELETE)

Answer: C) DISP=(SHR,KEEP)

53. In JCL, what does the COND parameter do?

A) Specifies time limitations for a job
B) Sets the execution condition for a step
C) Restarts a job from a specific step
D) Allocates datasets

Answer: B) Sets the execution condition for a step

54. Which of the following parameters in JCL is used to specify CPU time limit for a job?

A) TIME
B) RESTART
C) COND
D) CLASS

Answer: A) TIME

55. What does the DD statement define in a JCL job?

A) The job class
B) The time limit
C) Data sets to be used in the job
D) The restart point

Answer: C) Data sets to be used in the job

56. What happens if DISP=MOD is used in the DD statement for a dataset?

A) The dataset will be deleted after use
B) The dataset will be created if it does not exist and data will be appended
C) The dataset will be allocated for read-only access
D) The dataset will be cataloged

Answer: B) The dataset will be created if it does not exist and data will be appended

57. What is the purpose of the PGM parameter in JCL?

A) To specify the program name to be executed
B) To allocate memory for the job
C) To set the time limit for the program
D) To define the priority of the job

Answer: A) To specify the program name to be executed

58. In JCL, which utility is used for copying data from one dataset to another?

A) IEBGENER
B) SORT
C) IEBCOPY
D) IDCAMS

Answer: A) IEBGENER

59. What does DISP=OLD specify in the DD statement?

A) Dataset is shared among other jobs
B) Dataset will be created as new
C) Dataset is allocated exclusively for the job
D) Dataset will be deleted after execution

Answer: C) Dataset is allocated exclusively for the job

60. What is the function of the SYSOUT parameter in JCL?

A) Specifies the job step time
B) Directs the output to a specific device
C) Specifies the condition for step execution
D) Defines dataset disposition

Answer: B) Directs the output to a specific device

Conclusion

In this article, we have discussed JCL Interview Questions. It is a fundamental skill for anyone working in mainframe environments. Having a strong grasp of JCL concepts, commands, and common scenarios can significantly improve your ability to handle job scheduling, dataset management, and job execution efficiently. 

Also, do refer to JCL Interview Questions related articles:

Best wishes for your interview!🍀


Refer to our guided paths on Code360 to learn more about DSA, Competitive Programming, JavaScript, System Design, etc.

Enrol in our courses and refer to the mock test and problems available.

Take a look at the interview experiences and interview bundle for placement preparations.

Do upvote our blog to help other ninjas grow.

Happy Coding!

Live masterclass