MODULE 1 · FIRST STEPS · 8/8

Challenge: the batch run sheet

20 min60 XPExercise

Time to put the module together. Every night, the operations team at a bank runs dozens of batch jobs. For each one, the job prints a run sheet to SYSOUT so the morning shift can see what ran, who was on duty, and sign it off.

You'll write the program that prints it. It uses everything from this module:

  • all four divisions in the right order, with a comment block at the top
  • fixed-format layout: headers in Area A, statements in Area B
  • WORKING-STORAGE fields with the right PIC for each value
  • ACCEPT to read four lines of SYSIN
  • DISPLAY mixing literals and fields, including a literal that contains quotes

Watch the padding

The job name is held in a PIC X(8) field, because z/OS job names are at most eight characters. A shorter name such as GLPOST is padded with spaces to eight, and those spaces show up whenever the field is displayed in the middle of a line:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. PADDING.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-JOB-NAME      PIC X(8).
       PROCEDURE DIVISION.
           ACCEPT WS-JOB-NAME.
           DISPLAY "JOB " WS-JOB-NAME " DONE".
           STOP RUN.

With input GLPOST this prints JOB GLPOST DONE. That is exactly what a real COBOL report does, and the expected output of this challenge includes that padding. Don't try to remove it.

On the job

Run sheets like this are why operators can answer "did last night's payroll finish, and who ran it?" in seconds. Clear, fixed-layout output is a feature, not an afterthought.

Your task

Print the nightly batch run sheet. SYSIN has four lines, in this order:

Line Content Field to use
1 Job name, up to 8 characters WS-JOB-NAME PIC X(8)
2 Operator name, up to 20 characters WS-OPERATOR PIC X(20)
3 Number of steps run, 1–99 WS-STEPS PIC 9(2)
4 Run date as YYYYMMDD WS-RUN-DATE PIC 9(8)

For the input

PAYRUN01
JANE DOE
7
20260924

the output must be exactly:

*----------------------------------------*
* NIGHTLY BATCH RUN SHEET                *
*----------------------------------------*
RUN DATE : 20260924
OPERATOR : JANE DOE
JOB PAYRUN01 COMPLETED IN 07 STEPS
OPERATOR'S SIGN-OFF: "________"

Requirements:

  • Add the missing ENVIRONMENT DIVISION so the program has all four.
  • Read all four values with ACCEPT before displaying anything.
  • The job name keeps its padding: a 6-character job name is followed by two extra spaces before COMPLETED.
fixed format
Run your program to see its output here. The first visible test's input and datasets are used.
Submit to grade your program against every test.