In brief
Yes, mainframe batch processing can be moved to the cloud, but not in one move. There are three paths: running existing COBOL and JCL programs in a mainframe-emulating environment, automatic code conversion to another language, or rewriting the runs as new batch jobs, for example in Spring Batch on Kubernetes. The most work goes into the data (EBCDIC, packed decimals, VSAM), the processing window, and restart after an error, not into the code itself.
What exactly are we moving
A nightly run on a mainframe is not one program but a chain of jobs. A typical settlement run at a bank or an insurer consists of:
- JCL jobs that start the successive steps and point to datasets,
- COBOL programs that read, calculate, and write,
- system utilities, for example sorting (DFSORT) and dataset copying,
- sequential datasets, VSAM files, and Db2 for z/OS tables,
- a scheduler that enforces order, dependencies, and start times,
- restart procedures for when a step fails in the middle of the night.
Moving the programs alone, without the rest of the chain, does not work. That is why the first step is a full map of the run: steps, datasets, dependencies, durations, and the window in which the run has to fit. We describe how to gather such knowledge in the article COBOL and the mainframe: how to pass on knowledge before the experts leave.
Three paths to the cloud
| Path | What happens to the code | Advantages | Risks |
|---|---|---|---|
| Emulation (rehost) | COBOL and JCL run in a mainframe-compatible environment on servers in the cloud | Fewest changes to the logic, fast start | Dependence on the environment vendor, code still in COBOL |
| Automatic conversion (refactor) | A tool translates COBOL into Java or another language | A new platform and a new language | Code that is hard to read, logic with no fixes |
| Rewrite | New batch jobs based on reconstructed rules | Clean architecture, modern tools | Takes the longest, risk of missing rules |
Emulation passes the staffing problem along, because the code still has to be maintained in COBOL, but it lets you quickly get out of hardware costs. Conversion changes the language but not the logic: an automatically translated program looks like COBOL written in Java. A rewrite gives the most but requires full knowledge of the rules and comparison tests. We discuss general strategies for moving systems to the cloud in the article Cloud migration strategies: from rehost to refactor.
Data: the hardest part
In batch runs, trouble rarely comes from the code. It comes from the data.
- EBCDIC encoding. A mainframe stores text in EBCDIC, while cloud systems use ASCII or UTF-8. The conversion has to account for the code page with Polish characters and must not touch numeric fields.
- Packed decimals. COMP-3 (packed decimal) fields and binary numbers are stored in a file differently from text. Converting the whole file as text destroys the amounts.
- Sort order. EBCDIC sorts digits after letters, ASCII before letters. A run that assumes the mainframe order may give different results after migration, for example when merging two sorted files.
- VSAM and generation datasets. Indexed VSAM files and GDG datasets (successive generations of the same file) have no simple equivalent in the cloud. They have to be mapped to a database, object storage, or an emulating environment.
Each of these points can produce a difference of one grosz in a million records. That is why comparison tests on the full data volume are mandatory before the switchover.
It is also worth checking the data going out to other systems. A file that a mainframe run sends in the morning to a clearing bank or to a data warehouse must have exactly the same layout and encoding after migration, because the recipient usually does not know about the change and will not adapt its import.
The processing window and restart
For decades the mainframe has been optimized for one scenario: crunching a large volume of data within a given window, for example between the end-of-day close and the opening of branches. In the cloud, compute power is easy to add, but input and output throughput and database access often turn out to be the bottleneck.
Before migration, it is worth measuring:
- the duration of each step of the run on the current system,
- the data volume today and at the peak, for example at month end or year end,
- which steps can be parallelized and which must run in sequence.
The second matter is restart. A mainframe run can usually be resumed from a specific step after an error, and operators know the procedures. New batch jobs must have the same mechanism. Spring Batch records the execution state of steps and lets you resume an interrupted job, and Kubernetes runs jobs (Job, CronJob) with retries on failure. We discuss capacity planning for such systems in the article Capacity planning for transactional systems, and measurement before a change is shown in the scenario performance tests of a billing system during a tariff change.
How to start without risk to the nightly run
Migrating batch runs works best from the edges toward the center.
- A map of the run. Steps, datasets, dependencies, durations, and owners.
- Peripheral runs. Reports, exports to the data warehouse, runs that only read data from the mainframe. Moving them gives you experience without risk to settlements.
- Parallel running. The new version of the run works alongside the old one on the same data, and the results are compared automatically over several cycles, including month end.
- Switchover. Only after a series of matching comparisons does the new run take over production, while the old one stays for a while as a fallback.
For runs critical to settlements, it is worth calculating whether the migration is needed at all. Sometimes the better move is to leave the core on the mainframe and move to the cloud only what uses it. We write more about this decision in the article The mainframe in a bank: when to modernize and when to leave it.
Questions and answers
Can COBOL programs run in the cloud without being rewritten?
They can, in a mainframe-emulating environment that compiles and runs COBOL and JCL on servers in the cloud. This is the fastest path, because the logic does not change. You still have to move the data, map the VSAM files and the scheduler, and the team still has to know COBOL. Emulation is often a first stage, after which the runs are gradually rewritten.
Will the cloud process a nightly run faster than a mainframe?
There is no general answer. The cloud easily adds compute power, and independent steps can be processed in parallel. The mainframe, on the other hand, is very efficient at sequential processing of large files and at input and output operations. The outcome depends on the specific run, which is why step times are measured on the full data volume before a decision.
How do you check that a run in the cloud calculates the same?
By running the old and new versions in parallel on the same data and comparing the results automatically, record by record. The comparison covers several cycles, including month end and other days with unusual volume. Every difference has to be explained: some come from character encoding, packed decimals, or sort order, and some from errors the old system has had for years.
What replaces the mainframe job scheduler?
A scheduler that handles dependencies between jobs, calendars, restart from a step, and notifications, not just starting at a given time. It can be a batch scheduling tool the company already has, or a cloud service. A Kubernetes CronJob starts jobs at a set time, but complex dependencies need a separate orchestration tool.