Mainframe Batch Job Migration: The JCL, Scheduler, and Restart Logic That Code Conversion Leaves Behind

Converting COBOL or assembly programs does not convert the nightly cycle that runs them. Where batch logic sits in job control language, sort steps, and scheduler calendars, and what a government program should inventory and test before cutover.

Many government mainframe systems do their main work overnight. A cycle of several hundred jobs reads the day’s transactions, posts them to master files, and writes the files that other systems pick up in the morning.

A migration plan usually counts programs and lines of code. The cycle that runs those programs is written somewhere else: in job control language (JCL), in the control statements passed to sort utilities, in the scheduler’s definitions, and in operators’ run instructions. Each holds rules about what runs, in what order, on which days, and what happens after a failure. This post describes where those rules sit and what to test before cutover.

What a federal audit shows about cycles

The Treasury Inspector General for Tax Administration reviewed one of the largest conversions of this kind in a September 2024 audit. The Internal Revenue Service project converts two core programs of the Individual Master File from assembly language to Java, and the report states the success condition: the outputs of the new code must match those of the legacy system. The figures below describe the project as the audit found it in 2024.

Three details in the report apply to any batch migration.

First, testing was organized by cycle. To begin parallel operations, the project was required to run 38 cycles to completion with no defects. The project could not meet that criterion by the planned start date, and a different approach was approved.

Second, the calendar decided what could be tested. Key cycles were selected from different times of year, such as peak filing season, mid-year, and end-of-year. Among the concerns the project recorded were that parallel operations would not cover the peak filing season and that end-of-year cycles would not be fully tested before the planned cutover.

Third, elapsed time was a requirement. A service level agreement required the new code to process a cycle within three hours. An October 2023 briefing reported 4.6 hours. The goal was met after the number of logical partitions was increased from two to four.

Where batch logic sits outside the programs

A translated program can be correct while the migrated cycle is wrong, because these rules were never in the program.

Where the rule sitsWhat it decidesWhat to confirm on the target
Step conditions in JCLWhether a step runs, based on the return codes of earlier stepsEach condition is reproduced, including the cases where a step is skipped
Return codes set by programsWhether a result counts as clean, a warning, or a failureThe new program reports the same distinctions to the scheduler
Generation data groupsWhich version of a file a step reads and which it creates“Previous” and “current” resolve to the same files after a rerun
Utility control statementsWhich records a sort or copy step keeps, drops, or totalsThe selection rules exist somewhere in the new system and are tested
Scheduler definitionsOrder across jobs, run days, and holds after failureEvery predecessor, calendar rule, and exclusive resource is carried over

Step conditions are easy to misread. IBM’s JCL reference says of the COND parameter: “If any of the test conditions are satisfied, the system evaluates the COND parameter as true and bypasses the job step.” A true test means the step does not run. COND=(4,LT) on a step means “skip this step if 4 is less than the return code of any earlier step,” so the step runs only when every earlier step ended with a code of 4 or lower. Read the other way around, the job runs its error path on good nights.

Generation data groups let a job refer to files by position. IBM’s data set documentation describes the relative name as “a signed integer used to refer to the latest (0), the next to the latest (-1), and so forth, generation,” and notes that (+1) catalogs a new generation. On the target, those references usually become file names keyed by date, and someone has to decide what “previous” means after a holiday, a skipped run, or a rerun.

Sort steps deserve the same attention. The control statements given to a sort utility can include or omit records by field value and total amounts for records with equal keys. Such a step is a business rule with no program source behind it, and an inventory that counts only COBOL will miss it.

What changes on a modern scheduler

Target platforms document different assumptions about how a job runs. The Kubernetes CronJob documentation is a clear example. It states that a CronJob creates a job “approximately once per execution time of its schedule,” that in some circumstances “two Jobs might be created, or no Job might be created,” and that jobs should therefore be idempotent. The default concurrency policy allows runs to overlap, and without a specified time zone, schedules follow the controller’s local time.

A legacy posting job often assumes the opposite on each point: it runs exactly once per cycle, never overlaps itself, and starts at a time tied to the agency’s business day. A modern platform can meet all three once they are written down and configured, for example with a run control record that a job checks before posting, an explicit concurrency setting, and an explicit time zone.

Restart also differs. On the mainframe, a job that fails at step 7 of 12 is commonly restarted at step 7, following a run instruction. If the migrated job can only start from the top, steps 1 through 6 run twice. That is harmless for an extract and serious for a step that posts payments.

An illustrative example: one nightly cycle

The system and figures below are illustrative. A benefits system runs a nightly cycle of 340 jobs containing about 1,900 steps. The conversion plan covers 1,100 programs. An inventory of the job stream finds the following, none of it covered by program conversion alone.

Item found in the job streamCount (illustrative)
Steps with a run condition410
Sort or copy steps that select or total records46
Jobs that read a previous generation of a file18
Jobs that run only on certain days (month-end, quarter-end, fiscal year-end, day after a holiday)23
Jobs with a documented restart step other than the first31

The team plans a 30-day parallel run. Thirty days contain one month-end and may contain no quarter-end or fiscal year-end, so some of the 23 calendar-dependent jobs would never run before cutover. The team adds simulated cycles, running both systems on a copy of production data with the processing date set to September 30 and to the first business day after a holiday.

It also tests failure. For each of the 31 jobs with a restart point, the new job is stopped partway through and restarted, and the outputs are compared with a clean run. Two jobs post duplicate records on restart and are redesigned before go-live.

What to ask for before cutover

  • A job stream inventory. Every job, step, condition, input, and output, including utility control statements.
  • A dependency graph across jobs. Which job produces each file and which jobs consume it. See our post on dependency analysis before a migration.
  • A list of key cycles. Each calendar-dependent path, with evidence that it ran on both systems with matching outputs.
  • Batch window measurements. Elapsed time for a full cycle at production volume.
  • Restart tests. For each job that changes data, a record that it was stopped and restarted without duplicate or missing output.
  • Output comparison per cycle. Field-level comparison of every file the cycle produces. Our post on rounding, packed decimal, and sort order lists what such a comparison finds.

How QuantumWorks approaches this

PRISM analyzes a legacy codebase and maps its entry points, behavior, dependencies, and outputs, each anchored to file and line. Proposed changes pass through gates for compilation, tests, and behavioral equivalence, with a person approving or rejecting each one.

If your program is moving a batch cycle off a mainframe and needs to show that each night’s results still match, we would be glad to talk. Contact QuantumWorks.

  • Mainframe Batch Migration
  • JCL Conversion
  • Job Scheduling
  • Batch Window
  • Restart and Rerun
  • Parallel Operations
  • Legacy Systems

Working on a hard technical problem?

We work with government organizations, research institutions, and technology teams across cybersecurity, software, and autonomous systems.