Mainframe Path Start learning free
Beginner6 min readLesson 4 of 4

Batch and online: the two shapes of work

Nearly everything on a mainframe is either a batch job (submit it, walk away, read the output later) or an online transaction (a person or system asks, and gets an answer in milliseconds). Almost every mainframe role sits on one side of this line or spans both.

The two shapes side by side
Batch
Runs unattended, often overnightDescribed in JCLProcesses millions of recordsMeasured in elapsed time and CPUFailure = a job abends, you restart it
Online
Runs when someone asksDriven by a transaction IDProcesses one requestMeasured in response timeFailure = a user sees an error now

Batch, concretely

A batch job is a unit of work you describe in JCL and hand to the system. The system queues it, runs its steps in order, and keeps the output for you to read. Classic examples: apply today's transactions to the account master file, produce statements, calculate interest, load a data warehouse extract.

A batch job in its simplest form
//PAYRUN01 JOB (ACCT),'MONTHLY PAY',CLASS=A,MSGCLASS=X
//STEP010  EXEC PGM=PAYCALC
//INFILE   DD DSN=PROD.PAY.MASTER,DISP=SHR
//OUTFILE  DD DSN=PROD.PAY.RESULT,DISP=(NEW,CATLG,DELETE)
//SYSOUT   DD SYSOUT=*

That is five lines saying: run the program PAYCALC, give it this input file and that output file, and put its printed messages where I can read them. Everything else in JCL is elaboration on this idea.

Online, concretely

An online transaction is identified by a short transaction ID — usually four characters. A user types it, or another system sends it, and CICS starts a program to handle it. The program must answer quickly and must not hold resources while a human thinks.

The daily rhythm at most sites
Online day08:00–20:00 — CICS serves users
CutoffFiles close for the day
Batch window20:00–05:00 — the overnight schedule
Online dayFiles reopen, users return

Common mistakes

Writing online code that behaves like batch

Reading a million rows is fine in batch and fatal online. Online programs must do a small, bounded amount of work per call.

Assuming batch means slow

Batch means unattended and scheduled. A well-tuned batch job processing 200 million records is an extremely efficient piece of engineering.

Ignoring the schedule when changing a job

Batch jobs have predecessors and successors. Making one job slower can push a chain past the window even if the job itself still works.

What you will see at work

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
← The stack, from metal to your programBack to What is a mainframe?