Mainframe modernization · Part 1
The 7 Rs of mainframe modernization in the age of coding agents
A wholesale distributor wants to offer a discount when a customer orders enough units. In this fictional example, the first option we’d price is a change to the COBOL job that already calculates prices on z/OS. If the change fits in the pricing routine and the job still finishes before statements go out, keeping it there may be the cheapest way to give sales what it needs.
Pricing and ledger posting share working data in the nightly job. The question is how much of it has to change each time sales adjusts a price. A coding agent can help investigate that question before anyone commits to moving the batch.
- Nightly COBOL job
- Change it on z/OSReplatformSeparate pricing
- Reconcile the close
Where the 7 Rs still help
AWS uses seven strategies to classify workloads for cloud migration. At a distributor, the ledger, the pricing rules and the reporting tools may each warrant a different choice. AWS migration strategies
| Strategy | What it means for the workload |
|---|---|
| Retire | Stop running it once its consumers no longer need it. |
| Retain | Continue operating it on the current platform. The team can still change the application. |
| Rehost | Move the application to compatible infrastructure with its runtime and code intact. |
| Relocate | Move a supported environment and its workloads together to another location on the same platform. |
| Repurchase | Replace the application with a product. |
| Replatform | Adopt another runtime or managed platform and adapt the application to run there. |
| Refactor or rearchitect | Change the code or redesign how the parts of the application work together. |
Microsoft distinguishes refactoring existing code from rearchitecting or rebuilding an application. That distinction matters here. Isolating a COBOL routine within the job is a smaller commitment than giving pricing its own component and making the ledger accept adjustments through a new interface. Either change can be made on z/OS. Microsoft migration strategies
Three ways to change the pricing batch
Change the existing job. Trace where the quantity and price enter the calculation and where the ledger first uses the result. If one COBOL routine can own the discount, the team can test it under the existing scheduler and restart procedures. Its cost and rehearsal time give the distributor a baseline for the other two options.
Replatform the batch. A firm data centre exit date changes the calculation. A compatible runtime could let the distributor move the existing design and add the discount there. The estimate has to cover the scheduler, file handling, Db2 access and licences. Pricing and posting would still share the same job after the move.
Give pricing its own component. If every price change requires coordinated changes to posting, pricing could own the discount calculation and send the ledger a signed amount, an adjustment ID, an invoice reference and an effective date. Finance would retain control of the accounting date. If the two components commit their work separately, the ledger could accept an adjustment just before the pricing job stops.
Take a credit of £12.50, adjustment ADJ-042, against invoice INV-318. It takes effect on April 28 and arrives on May 2, after the invoice has closed. Suppose finance requires the credit on the next statement, with the original invoice reference and a May 1 accounting date. If pricing stops after the ledger commits the adjustment but before the job records its progress, the restart can send ADJ-042 again.
In the distributor’s illustrative Db2 schema, posted_adjustments holds one row per committed business posting, even when the journal uses several lines. After the retry, look up the adjustment across all invoices so a credit posted to the wrong invoice stays visible.
SELECT invoice_id,
amount_gbp,
accounting_date,
COUNT(*) AS postings
FROM posted_adjustments
WHERE adjustment_id =
'ADJ-042'
GROUP BY invoice_id,
amount_gbp,
accounting_date;
Finance expects one result row for INV-318, with a signed amount of -12.50, an accounting date of May 1 and a posting count of one. An empty result means the credit is missing. Two identical credits give a count of two. A retry that credits a different invoice produces a second row.
A coding agent can start at the job step and follow the adjustment ID through the COBOL source, copybooks and Db2 definitions. Ask it to find where the job records its restart position and to cite the statements behind its answer. Give it the discount terms and it can draft the change in COBOL. If the proposed design separates pricing, have it implement the same correction across the new interface. The interesting comparison is how much work each version takes to get through the close. AWS source-linked requirements
What we use to make the decision
Before trying the change, run representative corrections on the existing job in a test environment and save its statement and ledger outputs. Use those records to check the behaviour finance wants to keep. For the new discount, sales and finance supply the expected amounts for orders below, at and above the threshold. The agent can write and run the comparisons. Keeping the expected values separate from its patch means a mistake in the calculation can show up in the test. Google batch comparison
Run the restart check on each viable path. For the arithmetic, try half-penny debits and credits and compare line amounts as well as the invoice total. Even two implementations using decimal arithmetic can disagree if one rounds each line and the other rounds the total. IBM COBOL rounding behaviour
To judge what the agent contributed, record which dependencies it traced correctly, where an engineer had to supply a missing link, and how long it took to get the patch and its tests accepted. Use the team’s own figures for a comparable pricing change if you want to claim a time saving.
Cost each path through a reconciled close. Include ongoing platform costs and the hours engineers spend correcting the patch, rerunning the job and investigating discrepancies with finance. For a move, add the work of transferring open invoices, running in parallel and rehearsing cutover. If a change in place meets the pricing need and the overnight window, keep it. If a data centre closure rules that out, check whether the existing job can meet the same window on a compatible runtime. A separate pricing component earns its cost when the team can show which planned changes it makes simpler and how it will recover a failed posting.
Part 2 follows the job, source and data needed to make that assessment.
← All parts in this series