Mainframe modernization · Part 2
Mainframe as-is analysis: facts for coding agents, and what they cost
Two Medicare home health claims from 2021 can each have four covered visits and still take different paths through the payment system. One qualifies for payment by the visit. The other goes through the calculation for a 30-day period. The difference is easy to miss if an agent gets the COBOL program and nobody gives it the rate tables.
The Centers for Medicare & Medicaid Services (CMS) published the production mainframe source for its 2021.3 Home Health Pricer. It later converted all ten Medicare Pricers from COBOL to Java and published the Java pricing logic too. A modernization team can follow the same decision through both implementations. CMS mainframe release, ZIP · CMS Pricer source and release history
- Four covered visits
- 1AA11 · threshold 41AB11 · threshold 5
- Period pricingPer-visit pricing
Why four visits can produce two payment methods
The 2021 group table, hrgtabl.txt, contains the rows 1AA11 20210101 010124 4 and 1AB11 20210101 011454 5. The last field is the visit threshold. In the COBOL driver’s 2000-GET-HRG paragraph, a matching group supplies both the weight and the threshold. An unknown group produces return code 70. These excerpts omit the listing’s sequence numbers. CMS COBOL, hhdrv213.txt lines 424–432, ZIP · CMS’s 2021 group table in CSV
SET HU1 TO 1.
SEARCH TB-HRG-DATA VARYING HU1
AT END
MOVE '70' TO HHA-PAY-RTC
WHEN TB-HRG (HU1) = HHA-HRG-INPUT-CODE
MOVE TB-HRG-WGTS (HU1) TO HHA-HRG-WGTS
MOVE TB-HRG-THRESHOLD (HU1)
TO L-HRG-THRESHOLD
END-SEARCH.
In hhcal213.txt, paragraph 1000-FINAL-PAYMENT adds covered visits across six disciplines. The comparison below uses that total and the threshold from the table. CMS COBOL, lines 577–580 of the calculator, ZIP
IF H-HHA-REVENUE-SUM1-6-QTY-ALL
< L-HRG-THRESHOLD
NEXT SENTENCE
ELSE
GO TO PEP-CHECK.
Below the threshold, NEXT SENTENCE resumes after the period at the end of GO TO PEP-CHECK. That keeps the claim on the low-utilization payment adjustment (LUPA) path, which pays by the visit. At equality, the ELSE jumps to the period-payment checks. Four visits therefore take the period path for 1AA11 and the per-visit path for 1AB11. A test using only the first group could pass with four hard-coded as the cutoff. CMS explanation of the payment groups, p. 5
The Java comparison looks reversed because the first rule handles the period-payment path. These are the opening lines of the branch in CalculatePartialEpisodePayment.calculate. CMS Home Health Java 2.6.0 source, ZIP
if (calculationContext.getPaymentData()
.getTotalQuantityOfCoveredVisits()
>= calculationContext.getHrgThreshold()) {
calculationContext
.setPartialEpisodePaymentCalculated();
// …
}
The flag links two rules. When the engine gets to CalculateLupaPayment.shouldExecute, it tests !calculationContext.isPartialEpisodePaymentCalculated(). Reaching the threshold therefore skips per-visit pricing in Java, just as the jump to PEP-CHECK does in COBOL.
We created two test claims for June 2021 and ran them through the released Java Pricer. Each had four skilled nursing visits. We changed only the payment group. For 1AA11, it returned $1,681.11, code 00 (final payment without an outlier). For 1AB11, it returned $533.25, code 06 (per-visit payment only). Both responses identified calculation version 2021.3. The COBOL side of this comparison comes from reading the archived source. Test requests, Java responses and rerun instructions
Where a rewrite can lose a cent
Take three physical therapy visits at the standard non-rural 2021 rate of $166.83 and the Allentown-area wage index of 0.9501. Those values come from revtabl.txt and cbsafile.txt. In paragraph 1050-LUPA, FED-ADJ1 holds the $500.49 base for those visits. These three statements calculate the physical therapy line. The separate add-on calculations between them are omitted. CMS COBOL, hhcal213.txt lines 814–833, ZIP
COMPUTE FED-LABOR-ADJ1 ROUNDED =
WIR-CBSA-WAGEIND * LABOR-PERCENT * FED-ADJ1.
COMPUTE FED-NON-LABOR-ADJ1 ROUNDED =
NONLABOR-PERCENT * FED-ADJ1.
COMPUTE H-HHA-REVENUE-COST (1) ROUNDED =
(FED-LABOR-ADJ1 + FED-NON-LABOR-ADJ1).
The labor share rounds to $361.87 (76.1% of $500.49, multiplied by 0.9501). The other 23.9% rounds to $119.62. A rewrite that adds the unrounded shares and rounds once gets $481.48. In the Java method HhaPricerContext.calculateAdjustedCost, look at where each setScale happens. CMS Java 2.6.0, HhaPricerContext.java lines 214–216, ZIP
final BigDecimal fedLaborAdj = getCbsaWageIndex()
.multiply(getLaborPercent())
.multiply(initialCost)
.setScale(2, RoundingMode.HALF_UP);
final BigDecimal fedNonLaborAdj = getNonLaborPercent()
.multiply(initialCost)
.setScale(2, RoundingMode.HALF_UP);
return fedLaborAdj.add(fedNonLaborAdj);
Both amounts are already at two decimal places when Java adds them. On our third test claim, it returned $481.49 on the physical therapy line and $0.00 for its add-on. Keeping that line in the replay gives a reviewer a place to look if the total changes by a cent. Three-visit request and Java response
Running the old code to check a claim
In the fictional distributor from Part 1, suppose the ledger accepts a £12.50 credit and the pricing job stops before it records how far it got. Give the agent the job step, the program that sends the adjustment and the record layout that carries its identifier. Ask where ADJ-042 is assigned and whether the retry sends that same identifier. Operations can then interrupt a test run at that point. Compare the statement and ledger before and after the retry. Count posted adjustments for that identifier as well as comparing their amounts. Google Cloud batch comparison
If the amounts disagree, give the reviewer the COBOL PIC and USAGE declarations, the deployed compiler’s ARITH setting, and the statement that rounds or truncates each intermediate value. The line amounts saved from the old job let the reviewer see which calculation first diverged. IBM COBOL rounding · IBM ARITH option
What Ergane hands to the team rebuilding the system
For one job, we’d hand over the entry point, the source revision behind each rule, the inputs and outputs from any replay, and the dependencies still open. With that material and the brief for the new system, an agent can follow a rule into the source, implement it in the replacement, and run the same inputs against both. For a new volume discount, sales or finance has to supply the terms customers should receive.
Some gaps change how much code belongs in the rebuild. Take a COBOL CALL whose program name comes from a variable. The source can identify the call site. Resolving the target for month-end may also take the routing configuration in effect that night and an execution record. Until someone can account for that target, we’d keep it in scope. An empty list of callers is a particularly poor reason to retire a program that a scheduler can start directly. AWS activity records
Across an estate, our approach is to map COBOL and PL/I entry points on IBM Z and RPG and CL entry points on IBM i, including the files and tables they share. We use Leiden, a graph clustering algorithm, to suggest programs worth reviewing together. If the proposed split puts pricing on one side and the only writer of its restart record on the other, the reviewer has a specific dependency to resolve before assigning the two pieces to separate teams. Leiden paper
Cloud and platform tools
Choose a tool for the evidence you need from your own estate. AWS Transform can export dependency data and source-linked requirements for selected COBOL and PL/I functions. AWS lists its mainframe modernization capability at no charge, with normal charges for resources you use. Google’s Mainframe Assessment Tool exports program reports and graph data. It waives the tool charge for migrations into Google Cloud, while compute, storage and other services can add cost. Check its support matrix per language and operation before relying on a particular export. AWS workflow · AWS pricing · Google exports · Google coverage · Google pricing
On IBM i, IBM documents an important limit in Bob’s Understand scanner. It builds relationships from compiled objects and can miss a call when the program name is held in a variable. On IBM Z, IBM published a separate example in which a model overlooked a caller whose filename differed from its COBOL program ID. Bring a caller you already know about to the evaluation. Ask the vendor to show how its tool found it or how an engineer would spot the gap. IBM i object scanning · IBM Z caller example
Market tools and licence costs
The public offers below use different units. In US dollars, a single pass over two million lines at AI/Cockpit’s listed rate works out to $5,620. That buys processing. Reviewing unresolved calls, preparing representative data and reconciling a month-end run still need a budget. Prices checked November 30, 2026.
| Offer | What the published price covers |
|---|---|
| AI/Cockpit Smart Engineering | $2.81 per 1,000 source lines processed for analysis and documentation. |
| CAST Imaging | $63,000 for 12 months for one application under two million lines. |
| Rhino.ai | $500,000 for 12 months for logic extraction up to five million lines. |
For a mixed estate, check which platform each feature covers. PKS eXplain documents COBOL, PL/I, assembler and JCL on the mainframe as well as RPG and CL on IBM i. It can export a syntax tree for use by other tools. ARCAD Observer cross-references RPG, CL and COBOL on IBM i. Its MCP server gives an agent access to repository information such as call chains and data use. Ask to see the exact query you need on the language you run. PKS language coverage and export · ARCAD Observer coverage · ARCAD MCP server
If you’re asking for a conversion quote, say which outputs the supplier has to reproduce. For example, Mechanical Orchard ties its negotiated credits to verified equivalence. For the distributor, we’d ask each bidder to price one adjustment all the way through a restart, identify who supplies the reference ledger records, and say who investigates a duplicate credit. That gives finance and engineering a basis for comparing the quotes. Imogen pricing model
Part 3 uses these facts to generate and verify modernized code.
← All parts in this series