COBOL Module 12
Mainframe batch concepts: data sets, JCL and compilation (IBM z/OS) interview questions
Interview questions on “Mainframe batch concepts: data sets, JCL and compilation (IBM z/OS)”.
Warm-up questions
Short questions with short answers, each answered in full.
-
Fresher to mid
What do (0), (-1) and (+1) mean after the name of a generation data group in JCL?
-
Fresher to mid
How does a COBOL program on z/OS find the data set it reads, and why can the data set change without a new compile?
-
Fresher to mid
What is RC in a JCL IF statement, and how does a COBOL program set it?
Answered in the lesson JCL procedures, symbols and conditional steps
-
Fresher to mid
What do IBM's procedures IGYWC, IGYWCL and IGYWCLG do, and what must a job that calls them supply?
Answered in the lesson Compiling, link-editing and utility steps
Questions with model answers
What each question tests, the first step of a good answer and the follow-ups to expect.
-
Fresher to mid
A nightly job has two steps: POST writes BANK.PROD.TXN.DAILY(+1), and REPORT, which used to be a job of its own, now runs as step 2 and still names BANK.PROD.TXN.DAILY(0). Branch totals now lag one day behind. Explain it, fix it, and say how you would test the fix.
- What it tests
- How relative generation numbers resolve inside one job under GDGBIAS=JOB, and testing a change to a GDG job before it touches production generations.
- First step
- Compare the absolute names the job log shows for each step's allocation. In the lesson's model POST wrote G0004V00 as (+1) while (0) in the same job still meant G0003V00, so REPORT read the day before.
- Follow-ups
-
- Why did the same JCL work while REPORT was a job of its own?
- Would GDGBIAS=STEP fix it, and what else would it change?
- How do you test the change without touching production generations?
From the lesson z/OS data sets, catalogs and GDGs
Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.Opening the model answers with your pass…
Model answers open with any MySmartCoPilot pass.
- Pro pass · 1 week₹79$2.99
- 30 days₹179$5.99
- 1 year₹1,699$45
One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.
Passes can’t be bought right now, so the model answers can’t be opened at the moment. If you have a pass, enter your licence key.
It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).
In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
A COBOL program has read a supplier's fixed 80-byte extract for years. After a change on the supplier's side, its OPEN fails with file status 39, and the data set is now VB with LRECL=84. What is wrong, how do you confirm it, and what are your options?
- What it tests
- Knowing that a program's record format and length must match the data set's, reading a data set's attributes, and weighing a change to the program against a change to the feed.
- First step
- Read the data set's RECFM, LRECL and BLKSIZE from the ISPF data set list and compare them with the program's FD and RECORDING MODE. IBM gives status 39 for a mismatch in record format or record length, and fixed against variable is one.
- Follow-ups
-
- Why does LRECL=84 suggest that the records are still 80 bytes of data?
- What changes in the program if it accepts VB records?
- How do you stop the next change on the supplier side from failing at run time?
From the lesson z/OS data sets, catalogs and GDGs
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
An extract step writes a new data set with DISP=(NEW,CATLG,CATLG). Last night it abended at record 4 of 5, yet the next step ended with return code 0 and the totals downstream were short. Explain what happened, how you would change the job, and how you clean up.
- What it tests
- Reading the abnormal disposition, why CATLG on a failure is dangerous for a new output, and recovering a job that left a partial data set cataloged.
- First step
- Read the job log for the extract step's completion code and what the system did with its output at the end of the step. Then count the records in the data set the next step read, and compare the count with the input's.
- Follow-ups
-
- What should the DISP be, and why?
- How do you clean up before the rerun?
- When would you keep a failed step's output on purpose?
From the lesson JCL jobs, steps and DD statements
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
A production posting job ended with return code 0 every night for a week, yet nothing was posted. Its input DD had been changed to DD DUMMY in a test copy that was promoted by mistake. Why was the run silent, and how do you make such a mistake fail loudly?
- What it tests
- What DD DUMMY gives a program, why return code 0 does not prove the work was done, and checks in and around the program that catch an empty run.
- First step
- Compare the job's DD statements with the version before, and read the program's counts in SYSOUT. DD DUMMY gives the end of the file on the first READ, so a program that never checks how much it read ends with return code 0.
- Follow-ups
-
- Which check in the program would have caught it?
- Which check outside the program would have caught it?
- When is DD DUMMY the right choice?
From the lesson JCL jobs, steps and DD statements
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Fresher to mid
A step that writes the daily posting file with SPACE=(TRK,(100,50)) has run for years. After two branches merged, the day's file grew from 400,000 to 1,200,000 records of 80 bytes, and the step abended with B37. Explain the abend with numbers, and size the new SPACE.
- What it tests
- Working out tracks from records and block size on a 3390, how secondary amounts grow a data set, B37 against D37, and sizing with room to grow.
- First step
- Work out how many records a 3390 track holds at the file's block size and how many tracks the new day needs. Then work out the most tracks the SPACE value can give the data set on one volume, and compare the two.
- Follow-ups
-
- Why did 400,000 records fit?
- Why B37 and not D37?
- What would you code, and what else would you change?
From the lesson JCL jobs, steps and DD statements
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
A team replaced IF (RC < 8) THEN REPORT ELSE NOTIFY ENDIF with COND parameters: COND=(8,LE) on REPORT and COND=(8,GT) on NOTIFY. Months later a night on which POST ended with 12 paged nobody. Explain why, and write a version that works.
- What it tests
- Reading COND as a bypass test checked against every earlier step, the difference between RC in IF and the codes COND tests, and rewriting conditions without changing behaviour.
- First step
- Take the failed night's return codes, step by step, and evaluate each COND test of NOTIFY against them, noting which ones are true. Then compare the result with what the IF version decided on the same codes.
- Follow-ups
-
- Why did REPORT still behave correctly?
- How would you write the NOTIFY condition with COND, if you had to?
- How do you prove a rewrite changes nothing?
From the lesson JCL procedures, symbols and conditional steps
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
A cataloged procedure moved from test to production. Its first production night ended with return code 0, but the branch summary was cataloged as BANK.PRODRPT instead of BANK.PROD.RPT, and the job that mails the summary found no data set. Find the cause, fix it, and stop it from happening again.
- What it tests
- How symbols are delimited in JCL, why a wrong substitution can still give a valid name, and checks that catch it before production.
- First step
- Find the statement in the procedure that builds the summary's name, and expand it by hand with the production value of the symbol. Compare the result character by character with the name the mailing job reads.
- Follow-ups
-
- Did it really work in test?
- Why did no rule refuse the name?
- Which check would have caught it before production?
From the lesson JCL procedures, symbols and conditional steps
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
A month-end job writes BANK.PROD.STMT(+1) in STEP1 and BANK.PROD.STMT(+2) in STEP2; STEP3 prints both and abended. The operator restarted at STEP3 without changing the JCL, and STEP3 failed again. What went wrong, and what are the two correct ways to recover?
- What it tests
- What relative generation numbers mean in a restarted job, the difference between a step restart and a rerun from the top, and the clean-up each one needs.
- First step
- List the catalog of BANK.PROD.STMT now and write down which generations the failed run created. Then work out what (+1) and (+2) mean for a run that starts with that catalog.
- Follow-ups
-
- Why did the restart fail?
- How do you restart at STEP3 correctly?
- When would you rerun from the top instead, and what must happen first?
From the lesson JCL procedures, symbols and conditional steps
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 2 minutes
-
Mid to senior
A change to a posting program compiled with return code 8 under IGYWCL. The load module was promoted, and in production the program produced wrong totals. How did it get through, what do you check first, and how do you stop builds like it?
- What it tests
- Reading compiler return codes and the COND test of IGYWCL's link-edit step, why an E-level compile still produces a program, and gating builds on the compile result.
- First step
- Open the compile listing and find every E-level message, with the statement the compiler changed to correct it. Then read the job log: the LKED step ran because its COND test bypasses it only after a compile return code above 8.
- Follow-ups
-
- What did the compiler do to the statements it reported?
- Where would you put the gate: in the procedure, the pipeline or both?
- Is a W-level compile safe to promote?
From the lesson Compiling, link-editing and utility steps
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
Unit tests built with cobc -std=ibm pass on developers' laptops. On z/OS, built with the shop's defaults, a PIC S9(4) COMP counter that received 12345 holds 2345, while the laptop build kept 12345. Explain the difference and make the two builds agree.
- What it tests
- How the TRUNC option treats binary items, matching local compiler settings to z/OS defaults, and deciding which behaviour the program should rely on.
- First step
- Compare the options in effect on both sides: the z/OS compiler listing prints them, and on the laptop the cobc command line and its dialect file decide how binary items are truncated.
- Follow-ups
-
- Which result is right?
- Which cobc flags match the z/OS build?
- How should the program change so it no longer depends on the option?
From the lesson Compiling, link-editing and utility steps
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 2 minutes
-
Fresher to mid
A sort step with SORT FIELDS=(1,3,CH,A,14,9,ZD,D) put the posted records in branch and amount order for years. After the posted file was changed from FB to VB, the step still ends with return code 0, but the order looks random. What happened, and how do you fix and check it?
- What it tests
- How DFSORT numbers positions in fixed-length and variable-length records, and checking a sort statement against a record layout before a change goes live.
- First step
- Lay the record layout next to the sort statement and work out which bytes each field of the statement reads in a VB record, remembering what sits in front of the data of every variable-length record.
- Follow-ups
-
- Why did the step not fail?
- What is the corrected statement?
- How would you test a sort statement before the next format change?
From the lesson Compiling, link-editing and utility steps
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes