JCL Realtime (Scenario based) Interview Questions (1 - 10)
1. State the purpose of the NOTIFY statement in JCL.
The NOTIFY parameter in JCL is used to send a completion message to a specific TSO user when a job finishes execution. For example:
//JOBNAME JOB 'TEST JOB',NOTIFY=&SYSUID
2. How do you pass parameters from one job to another?
Parameters can be passed from one job to another using the following methods:
- Using a Dataset: The first job writes parameters to a dataset. The second job reads the dataset as input.
//JOB1 JOB ... //STEP1 EXEC PGM=MYPROG1 //OUT DD DSN=MY.PARM.DATA,DISP=(NEW,CATLG,DELETE)
//JOB2 JOB ... //STEP1 EXEC PGM=MYPROG2 //IN DD DSN=MY.PARM.DATA,DISP=SHR
- Using the SYSOUT and Internal Reader (INTRDR): The first job dynamically writes JCL to SYSOUT=(*,INTRDR), submitting a new job.
- Using Symbolic Parameters and JCL INCLUDE: The first job updates a JCL member containing symbolic parameters. The second job includes that member.
3. How do you run multiple jobs in a sequential manner in JCL?
To ensure that multiple jobs run one after another (sequentially), you can use the following methods:
- Job Dependency Using Job Scheduler (Preferred Method): Use a job scheduler like Control-M, CA-7, or Tivoli Workload Scheduler to define job dependencies.
- Manual Job Submission (Next Job Submitted by Previous Job): Use INTRDR to submit the next job dynamically.
- Chaining Jobs Using Dataset Dependency: Use a dataset trigger, where the second job waits for a dataset created by the first job.
- Using Job Class and JES2 Execution Order: Jobs in the same class execute sequentially if JES2 processes them in FIFO order.
4. How do you run multiple jobs in parallel in JCL?
To execute multiple jobs simultaneously (in parallel), you can use the following methods:
- Submit Independent Jobs Without Dependencies: Simply submit multiple jobs; JES2/JES3 will schedule them in parallel based on system resources.
- Use Different Job Classes: Assign different job CLASS values to prevent queueing delays.
- Submit Jobs Dynamically from a COBOL or REXX Program: Write jobs to INTRDR (Internal Reader) for parallel execution.
5. How do you control the execution of a JCL based on the return code of a previous job step?
You can control job step execution based on the return code (RC) of a previous step using the following methods:
- Using the COND Parameter: Skips a step based on the return code from a previous step.
- Using IF/THEN/ELSE: Provides better control for multiple conditions.
- Using SET MAXCC in IDCAMS: Overrides the MAXCC value to influence subsequent steps.
6. How do you run a JCL in a test environment before executing it in production?
To test a JCL before executing it in production, follow these methods:
- Use a Test JOB Class: Assign a test-specific JOB class to restrict execution to a test environment.
- Use a Test Dataset Prefix: Replace production datasets with test datasets to avoid affecting live data.
- Use TYPRUN=SCAN to Validate JCL Syntax: Checks for syntax errors without executing the job.
- Submit JCL in a Development/Test LPAR or Region: Run the job in a test LPAR or JES region before moving it to production.
- Use a Controlled Test System with Limited Resources: Set job execution parameters (TIME=5, MSGCLASS=X) to limit impact.
7. How can we convert a FB (Fixed block) file to VB (Variable block) file using a sort program?
You can use DFSORT or ICETOOL to convert a Fixed Block (FB) file to a Variable Block (VB) file as shown below -
//MATEPKD JOB (123),'MTH',NOTIFY=&SYSUID
//*
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=MATEPK.SORT.INPUT02,DISP=SHR
//FBOUTP DD DSN=MATEPK.SORT.OUTPT02,
// SPACE=(CYL,(1,1),RLSE),
// DISP=(NEW,CATLG,DELETE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=FBOUTP,VTOF,OUTREC=(5,80)
/*
- OUTFIL FNAMES=FBOUTP,.. - Specifies the output is Fixed block file.
- OUTFIL FNAMES=..,VTOF,.. - Specifies the conversion is Variable to Fixed.
- OUTFIL FNAMES=..,OUTREC=(5,80) - Copies from 5th to 80th byte of the input file to output file.
8. Does JCL support Automatic start? If yes, then explain how.
Restarting JCL automatically through a predefined keyword parameter, such as the RD (Restart definition) keyword, is possible. RD stands for restart definition. RD parameter used to -
- Allow JES to perform an automatic job restart after the job failure.
- Allow the operator to perform an automatic job or a checkpoint restart if a job fails.
9. If you have seven jobs to do, but you want to hold one at the same time, how can I accomplish this?
We can accomplish this using the following methods:
- Use the TYPRUN=HOLD Parameter: Submits the job but keeps it in a held state until manually released.
- Use JOB HOLD in the JES2 Console: Submit the job normally and then hold it manually from the JES2 console.
- Use Job Scheduler (e.g., Control-M, CA-7): Define dependencies in a job scheduler to hold one job while running others.
10. How can a Sort program be used to convert a Fixed Block (FB) file into a Variable Block (VB) file?
//MATEPKD JOB (123),'MTH',NOTIFY=&SYSUID
//*
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=MATEPK.SORT.INPUT01,DISP=SHR
//VBOUTP DD DSN=MATEPK.SORT.OUTPT01,
// SPACE=(CYL,(1,1),RLSE),
// DISP=(NEW,CATLG,DELETE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=VBOUTP,FTOV
/*
OUTFIL FNAMES=VBOUTP,FTOV - Specifies the output is VB, and FTOV specifies that the conversion is Fixed to Variable.