MEDCLAIM/i is a healthcare benefit-adjudication application: it takes provider claims in,
edits and eligibility-checks them, then adjudicates each one against the member's live benefit
accumulator (deductible-met and out-of-pocket-met year-to-date), pays providers weekly, and closes
the books monthly and annually. The spine of the system is the accumulator: because adjudication reads it,
applies benefits against it, and writes it back, every claim pays differently because of the claims that
came before it. The benefit maths and the invariant plan liability + member responsibility =
allowed live in the RPG adjudication engine; the CL job cycles orchestrate the programs. This
manual is grounded entirely in the committed source of library MEDCLAIM
(claims-app/src/sources.mjs, src/seed.mjs, and the
test/hc_*.mjs drivers), and is honest where the application deliberately lacks a feature the
domain might imply.
MEDCLAIM/i administers the full life of a healthcare benefit claim:
Adjudication of a single claim follows a fixed pipeline, all in program HCADJUD:
allowed = billed × provider contract rate (network pricing, PVRATE) deductible part = min(allowed, plan deductible − deductible met) -> member pays whole remainder = allowed − deductible part plan share = remainder × plan coinsurance rate (PCOINS; POONCOI out-of-net) member share = remainder − plan share member resp = deductible part + member share then CAPPED so (out-of-pocket met + member resp) never exceeds the plan out-of-pocket maximum; the excess -> plan INVARIANT plan liability + member responsibility = allowed, ALWAYS
The accumulator (HCACCUM, one row per MEMBID, ACCYR) is what makes this
stateful: adjudication reads the member's DEDMET / OOPMET, applies benefits
against them, and writes them back, so the next claim for that member in that plan year pays differently.
The worked example the tests assert (GOLD plan, deductible 500.00, 80/20 co-insurance, OOP max 2000.00,
in-network rate 1.0000):
CLM000001 billed 800.00, deductible met 0.00: allowed 800.00; deductible min(800,500)=500.00 (member); remainder 300.00 plan 300×0.80=240.00; member 500+60=560.00; 240+560=800 INVARIANT OK accumulator now: deductible met 500.00, out-of-pocket met 560.00 CLM000002 billed 1000.00 (same member, deductible now met): deductible 0.00; plan 1000×0.80=800.00; member 200.00; accum OOP met 760.00 CLM000003 billed 8000.00 (OOP cap bites): member capped at 2000−760=1240.00; plan takes the rest 6760.00 (not 6400.00)
DAILY (HCDAILY) WEEKLY (HCWEEK) MONTHLY (HCMONTH)
-------------- -------------- -----------------
HCINTAKE edit HCPEND worklist HCGLDST GL distribution
HCELIG eligibility HCPAYRUN provider pay HCLOSSR loss ratio
HCADJUD ADJUDICATE HCREMIT remittance HCIBNR IBNR accrual
| | HCACCRP accum audit (COBOL)
v v
HCACCUM <---read/write-- HCCLM / HCCLML ANNUAL (HCYEAR)
(member accumulator) (claim hdr + lines) -----------------
| | HCYRSUM year summary
+--> HCLEDG <-- every posting program HCYRRST accumulator reset
(durable, re-runnable audit ledger) HCREENR re-enrolment sweep
ONLINE HCMENU (5250) --1--> HCMEMBIQ member benefit inquiry
--2--> HCCLMIQ claim inquiry (service-line subfile)
A daily event flows: a claim entered as CSTAT='E' → HCINTAKE validates it
to 'V' (or denies to 'D') → HCELIG tests coverage/network
→ HCADJUD prices it, applies benefits against HCACCUM, writes the header
and service-line amounts, and lays down the durable HCLEDG row that makes the claim
un-repeatable. Everything runs in library MEDCLAIM.
| Object | Type | Role |
|---|---|---|
| HCMEMB | PF | Member / subscriber enrolment master. |
| HCPLAN | PF | Benefit plan (deductible, co-insurance, OOP max). |
| HCPROV | PF | Provider network master (contract rate). |
| HCCLM | PF | Claim header (the workflow spine). |
| HCCLML | PF | Claim service lines (composite CLMNO,CLINE). |
| HCACCUM | PF | Member accumulator (composite MEMBID,ACCYR) — the heart. |
| HCPAY | PF | Provider payment / remittance header. |
| HCLEDG | PF | Durable adjudication / accounting ledger (re-run guard). |
| HCAPPL | PF | Denial appeal tracking. |
| HCWORK | PF | Pended-claim worklist. |
| HCCLMLF | LF | Claims keyed by MEMBID (member access path). |
| HCCLMLP | LF | Claim lines keyed by PROVID (provider access path). |
| HCGLDIST | SQL table | Claims-expense GL distribution (+ index HCGLDACC). |
| HCMEMBD / HCCLMD / HCMENUD | DSPF | Member inquiry / claim subfile / main menu. |
| HCREMP | PRTF | Provider remittance advice printer file. |
| HC* (17) | RPG / SQLRPGLE | Seed, intake, eligibility, adjudication, pend, pay, remit, GL, loss-ratio, IBNR, reset, re-enrol, appeal, summary, 2 inquiries, menu. |
| HCACCRP | ILE COBOL | Accumulator audit report. |
| HCSETUP | CL | Create every object & compile every program. |
| HCDAILY / HCWEEK / HCMONTH / HCYEAR | CL | The four job cycles. |
The full catalogue is 10 PFs + 2 LFs + 1 SQL table (with index), 4 DSPF/PRTF members, 17 RPG/SQLRPGLE programs + 1 ILE COBOL program, driven by 5 CL programs. Sections D and F expand each.
MEDCLAIM/i has no CICS transaction identifiers and no transid switch. On IBM i, each program is
reached by name from a 5250 command-entry line (or a JOBQ/scheduler for the batch cycles). Before
invoking anything, the job's library list must include MEDCLAIM — the tested jobs run
with LIBL = QSYS QGPL MEDCLAIM QTEMP and CURLIB = MEDCLAIM. Each CL cycle begins
with its own ADDLIBLE LIB(MEDCLAIM).
| To do this | Type on the command line |
|---|---|
| Open the operator main menu | CALL MEDCLAIM/HCMENU |
| Member benefit inquiry directly | CALL MEDCLAIM/HCMEMBIQ |
| Claim inquiry (service-line subfile) directly | CALL MEDCLAIM/HCCLMIQ |
| Build/compile the whole application | CALL MEDCLAIM/HCSETUP then CALL MEDCLAIM/HCREFLD |
| Run the daily adjudication cycle | CALL MEDCLAIM/HCDAILY (or SBMJOB it) |
| Run the weekly payment cycle | CALL MEDCLAIM/HCWEEK |
| Run the monthly close | CALL MEDCLAIM/HCMONTH |
| Run the annual plan-year roll | CALL MEDCLAIM/HCYEAR |
The batch programs take no CALL parameters. Unlike a control-row application, MEDCLAIM/i's
processing dates, batch numbers and plan year are compile-time literals inside the programs (e.g.
HCPEND/HCPAYRUN use run 202631, HCGLDST batch
202608, HCIBNR/HCYRRST plan year 2026/2027). A scheduled submission
is therefore a bare CALL; changing the processing period is a source change, not a data
change. Only HCMENU, HCMEMBIQ and HCCLMIQ are interactive.
HCCLM/HCCLML (in the
emulator, by the test drivers) with CSTAT='E'; the online programs are read-only inquiries.
MEDCLAIM/i is a claims adjudication system, not a data-entry front end.
HCMENU (HCMENUD). A plain menu: option 1 CALLs HCMEMBIQ, option
2 CALLs HCCLMIQ, any other non-blank option shows Invalid option.;
F3 ends the program. Control returns to the menu when a called inquiry exits.
HCMEMBIQ (HCMEMBD) is a plain (non-subfile) member benefit inquiry. Key a member id and
Enter; it CHAINs HCMEMB, the member's plan (HCPLAN) and
the member's plan-year accumulator (HCACCUM, key MEMBID, 2026), and renders the
enrolment plus the live derived position — deductible remaining and out-of-pocket remaining
are computed on the screen (PDEDUCT−DEDMET, floored at 0), not stored. An
unknown member shows Member not found. and clears the detail.
HCCLMIQ (HCCLMD) is the app's subfile screen. The DDS record LSFL under
control record LCTL pages the claim's service lines (SFLPAG(5),
SFLSIZ(20), ROLLUP/ROLLDOWN). Key a claim number and
Enter: it renders the header (member, billed, allowed, plan paid, member,
status) and loads one subfile row per adjudicated service line. The load order is deliberate — the
subfile is cleared, then loaded for the key just typed, then displayed — so an inquiry that
finds nothing never shows the previous claim's lines underneath.
| Field | Screen | Shows |
|---|---|---|
| IMEMB / ICLM | HCMEMBD / HCCLMD | The keyed member id / claim number (input/output). |
| DDREM / DOREM | HCMEMBD | Deductible / out-of-pocket remaining, derived live, floored at 0. |
| DCPLAN / DCMEMR | HCCLMD | Claim header plan paid / member responsibility. |
| SLINE..SMEMB | HCCLMD (LSFL) | Subfile line: number, service code, billed, allowed, plan pd, member. |
| DMSG | all | Highlighted status line (found / not found / invalid option). |
%editc(...:'K')
edit code into alphanumeric display fields (e.g. 1,240.00). The subfile line amounts are the
service-line values HCADJUD distributed pro rata from the header; on a two-line claim the two
rows correctly carry different amounts, with the last line absorbing the rounding residue.
Honest statement: MEDCLAIM/i does not model a true four-eyes maker–checker /
separate-authorization workflow. No batch program requires a second user to approve what a first user
posted: HCADJUD adjudicates, HCPAYRUN pays, and the annual reset runs, each in
one flow. The control model the application does have is enforced structurally:
HCPEND lifts out of the straight-
through flow any claim that needs a person: high-dollar plan liability over 5000.00 (P1),
out-of-network needing an authorisation check (P2), denied on an eligibility reason a human
can override (P3), or a suspected duplicate (P4). This is a review queue, not an
approval gate — a pended claim is not blocked from the payment run by the worklist alone.CSTAT:
HCINTAKE only edits 'E' claims, HCELIG and HCADJUD
only 'V', HCPAYRUN only pays 'A' (adjudicated) claims and stamps
them 'X'. A claim cannot skip a stage.HCAPPEAL: a
D3 denial (service date outside coverage — often a retroactive enrolment) is
overturned and the claim pushed back to 'V' for re-adjudication; everything else is
upheld. This is the review-and-correct loop.In sum, the control posture is a human worklist + status/state gating + a durable audit ledger + an independent audit report, all enforced in the data and program layer, rather than a segregation-of-duties approval workflow.
MEDCLAIM/i runs as four periodic cycles, each a CL program that CALLs its member programs in order: a
daily cycle (intake → eligibility → adjudication), a weekly cycle (worklist →
provider payment → remittance), a monthly cycle (GL → loss ratio → IBNR → accum
audit) and an annual cycle (year summary → accumulator reset → re-enrolment). All member
programs take no CALL parameters; their dates/periods are compile-time literals. The scheduled
idiom is a bare SBMJOB of the cycle:
-- submit a (parameterless) cycle as a batch job SBMJOB CMD(CALL PGM(MEDCLAIM/HCDAILY)) JOB(HCDAILY) -- or run a single member program directly CALL MEDCLAIM/HCADJUD
| Program | Cycle | Purpose | Reads | Writes / DSPLY |
|---|---|---|---|---|
| HCREFLD | setup | Seed plans, providers, members, opening accumulators. | — | HCPLAN(2) HCPROV(4) HCMEMB(4) HCACCUM(4); PLANS=2 PROVS=4 MEMBERS=4 ACCUMS=4. |
| HCINTAKE | daily 1 | Structural edit of entered claims. | HCCLM, HCCLML | CSTAT E→V or E→D (E1/E2/E3); VALID=/REJECT=/SKIP=. |
| HCELIG | daily 2 | Member coverage + provider network check. | HCCLM, HCMEMB, HCPROV | CSTAT V→D (D1..D5); PASS=/DENY=/SKIP=. |
| HCADJUD | daily 3 | THE adjudication engine (deductible, co-ins, OOP cap, line split). | HCCLM, HCCLML, HCMEMB, HCPLAN, HCPROV, HCACCUM | Claim & line amounts, HCACCUM update, HCLEDG 'J' row; ADJUDICATED=/SKIP=. |
| HCPEND | weekly 1 | Build the pended-claim worklist. | HCCLM, HCCLMLF, HCPROV | HCWORK rows (P1..P4); PENDED=/SKIP=. |
| HCPAYRUN | weekly 2 | Provider payment run (group plan liability by provider). | HCPROV, HCCLM | HCPAY per provider, CSTAT A→X, HCLEDG 'Y' row; PAYMENTS=/TOTAL=/SKIP=. |
| HCREMIT | weekly 3 | Print the provider remittance advice (EOB). | HCPAY, HCPROV, HCCLM | HCREMP spool; CLAIMS=/TOTAL=. |
| HCGLDST | monthly 1 | Balanced claims-expense GL distribution (embedded SQL). | HCCLM, HCGLDIST | HCGLDIST DR/CR pairs; BATCH=/ROWS=/INCURRED=. |
| HCLOSSR | monthly 2 | Medical loss ratio (incurred / earned premium). | HCMEMB, HCCLM | MEMBERS=/PREMIUM=/INCURRED=/MEMBRESP=/RATIO=. |
| HCIBNR | monthly 3 | IBNR accrual by completion factor 0.8000. | HCCLM, HCLEDG | HCLEDG 'B' row; REPORTED=/ULTIMATE=/ACCRUAL=/CLAIMS=. |
| HCACCRP | monthly 4 | Accumulator audit report (ILE COBOL). | HCACCUM | DEDMET/OOPMET/PAIDYTD/ACCUMS totals. |
| HCYRSUM | annual 1 | Year-end claims summary (read-only). | HCCLM | CLAIMS=/PAID=/DENIED=/BILLED=/ALLOWED=/PLAN=/MEMBER=. |
| HCYRRST | annual 2 | Accumulator reset: close 2026, open 2027 at zero. | HCACCUM, HCLEDG | HCLEDG 'Z' close row, new-year HCACCUM row; RESET=/SKIP=. |
| HCREENR | annual 3 | Roll continuing members into the new plan year. | HCMEMB | MEFFDT/MTRMDT rolled; RENEWED=/LAPSED=/SKIP=. |
| HCAPPEAL | ad hoc | Resolve filed appeals (overturn D3, push back to V). | HCAPPL, HCCLM | ASTAT F→O/U, CSTAT D→V on overturn; OVERTURNED=/UPHELD=/SKIP=. |
HCINTAKE edits every CSTAT='E' claim: no service lines → E1, line
billed total ≠ header billed → E2, missing/impossible service date → E3; clean
claims go to 'V'. HCELIG then tests each 'V' claim: member not found
D1, coverage terminated D2, service date outside the member's MEFFDT..MTRMDT
window D3, provider not found D4, provider not active D5. HCADJUD
adjudicates each surviving 'V' claim per section A.2 / F.1.
Expected DSPLY (the 6-claim oracle set: 4 adjudicate, 1 denied E2, 1 denied elig): HCINTAKE VALID=5 REJECT=1 SKIP=0 CLM000006 fails E2 (400 hdr vs 250 lines) HCELIG PASS=4 DENY=1 SKIP=1 CLM000005 denied (terminated member D2/D3) HCADJUD ADJUDICATED=4 SKIP=2
HCPEND builds the worklist (P1..P4). HCPAYRUN sweeps providers, totals each
provider's adjudicated ('A') plan liability, writes one HCPAY remittance, stamps
those claims 'X' with the payment number, and lays a HCLEDG 'Y' row.
HCREMIT prints the remittance advice (one provider block, one detail line per claim).
Expected DSPLY (cycles oracle): HCPEND PENDED=1 SKIP=... one P1: plan liability 16000.00 > 5000.00 HCPAYRUN PAYMENTS=3 TOTAL=18200 only plan liability is remitted, not member resp HCREMIT CLAIMS=4 TOTAL=18200.00
CPLANPD) is remitted to providers; the member
responsibility (CMEMRSP, 5800.00 in the oracle) is what the provider collects from the member
and is deliberately not in the payment run.
HCGLDST posts balanced DR/CR pairs into the SQL HCGLDIST table for the
movement since the last close: DR 6100-MEDCLM / CR 2100-CLMPAY
(incurred), DR 2100-CLMPAY / CR 1010-CASH (remitted), and a memo member-receivable
pair. HCLOSSR reports the medical loss ratio = incurred plan liability / earned premium, where
premium is active members × 450.00 PMPM (the enrolment file carries no premium — this is a
claims system, so the rate is a program literal). HCIBNR accrues incurred-but-not-reported by
completion factor: ultimate = reported / 0.8000, accrual = ultimate − reported.
HCACCRP (COBOL) audits the accumulator totals.
Expected DSPLY (cycles oracle): HCLOSSR MEMBERS=3 PREMIUM=1350.00 3 active members × 450.00 HCLOSSR INCURRED=18200.00 MEMBRESP=5800.00 HCLOSSR RATIO=13.4814 18200 / 1350, truncated into 7P4 HCIBNR REPORTED=18200.00 ULTIMATE=22750.00 HCIBNR ACCRUAL=4550.00 22750 − 18200
HCYRSUM reports the year's disposition (read-only). HCYRRST writes each
member's closing 2026 accumulator to HCLEDG ('Z') then opens a fresh 2027 accumulator
at zero. HCREENR rolls each active member's MEFFDT/MTRMDT to the 2027 window;
a genuinely terminated (MSTAT='T') member is left to lapse; a member already carrying 2027
dates is skipped.
'V' that
eligibility consumes; eligibility narrows the 'V' set that adjudication consumes. Running
adjudication before intake/eligibility would adjudicate un-edited, un-checked claims.HCADJUD sets CSTAT='A' and the plan
liability the payment run groups; the pended-worklist reasons (P1 high-dollar, P2 out-of-network) also
key off adjudicated amounts. Adjudicate before you pay.HCPAYRUN flips paid claims to 'X'; the GL
distribution's cash-settlement leg keys off 'X', and the loss ratio / IBNR read the
incurred plan liability. Pay before you close the month.HCYRRST) wipes the year's position;
run every month's close and the year summary first.'V', so the
next daily HCADJUD re-adjudicates it.All files are in library MEDCLAIM, grounded in the DDS/SQL in
claims-app/src/sources.mjs. Dates are stored as 8S 0 in YYYYMMDD
form (accumulator/plan year as 4S 0 YYYY); rates are packed 5P 4
(0.8000 = 80%); money is packed 11P 2 (or 13P 2 for GL totals). Every physical
file is UNIQUE-keyed.
| Field | Type | Meaning |
|---|---|---|
| MEMBID | 9A | Member id (K) — the enrolment spine, e.g. MB0000001. |
| MNAME | 30A | Member name. |
| MPLAN | 8A | Benefit plan id (→ HCPLAN). |
| MSUBID | 9A | Subscriber id (a dependent points at its subscriber). |
| MREL | 1A | S subscriber, D dependent. |
| MEFFDT / MTRMDT | 8S 0 | Coverage effective / termination dates — the eligibility window. |
| MSTAT | 1A | A active, T terminated, P pending re-enrolment. |
| MGROUP | 6A | Employer / group id. |
| Field | Type | Meaning |
|---|---|---|
| PLANID | 8A | Plan id (K). |
| PLDESC | 30A | Plan description. |
| PDEDUCT | 11P 2 | Annual individual deductible the member pays first. |
| PCOINS | 5P 4 | Plan's share of the post-deductible remainder (in-network). |
| POOPMAX | 11P 2 | Out-of-pocket maximum — caps total member liability. |
| PCOPAY | 11P 2 | Flat per-visit copay (carried; not applied by HCADJUD). |
| POONCOI | 5P 4 | Plan's lower coinsurance rate for out-of-network care. |
| PLSTAT | 1A | A active. |
Seeded plans: PLAN0001 GOLD 500/80/2000 (OON 0.6000, copay 25.00);
PLAN0002 SILVER 1000/70/4000 (OON 0.5000, copay 40.00).
| Field | Type | Meaning |
|---|---|---|
| PROVID | 9A | Provider id (K). |
| PVNAME | 30A | Provider name. |
| PVNET | 1A | I in-network, O out-of-network (drives which coinsurance rate applies). |
| PVRATE | 5P 4 | Contracted rate: allowed = billed × PVRATE. |
| PVSPEC | 3A | Specialty (benefit category). |
| PVSTAT | 1A | A active, T terminated (a claim against T denies D5). |
| PVTIN | 9A | Tax id. |
| Field | Type | Meaning |
|---|---|---|
| CLMNO | 9A | Claim number (K), e.g. CLM000001. |
| MEMBID / PROVID | 9A | Owning member / billing provider. |
| CSVCDT / CRCVDT | 8S 0 | Service date / received date. |
| CBILLED | 11P 2 | What the provider charged. |
| CALLOWD | 11P 2 | Network-allowed amount (set by HCADJUD). |
| CDEDAPP | 11P 2 | Deductible applied on this claim. |
| CPLANPD | 11P 2 | Plan liability. |
| CMEMRSP | 11P 2 | Member responsibility (CPLANPD+CMEMRSP=CALLOWD). |
| CSTAT | 1A | E entered, V validated, A adjudicated, X paid, D denied, P pended. |
| CDENCD | 2A | Denial reason code (E1..E3 / D1..D5). |
| CPLANYR | 4S 0 | Plan year (selects the accumulator). |
| CPAYNO | 9A | Remittance payment number once paid. |
| Field | Type | Meaning |
|---|---|---|
| CLMNO / CLINE | 9A / 3S 0 | Claim + line number (composite K). |
| LSVCCD | 5A | Procedure / service code. |
| LUNITS | 5P 2 | Quantity billed. |
| LBILLED | 11P 2 | Line billed amount (rolls up to CBILLED). |
| LALLOWD / LPLANPD / LMEMRSP | 11P 2 | Line allowed / plan / member, pro-rated from the header by HCADJUD. |
| LSTAT | 1A | A adjudicated. |
| PROVID | 9A | Billing provider (basis of HCCLMLP). |
| Field | Type | Meaning |
|---|---|---|
| MEMBID / ACCYR | 9A / 4S 0 | Member + plan year (composite K). |
| DEDMET | 11P 2 | Deductible satisfied year-to-date. |
| OOPMET | 11P 2 | Out-of-pocket spent year-to-date. |
| ACLMCNT | 5P 0 | Claims adjudicated against this accumulator. |
| APAIDYTD | 11P 2 | Plan liability paid year-to-date for this member. |
| ASTAT | 1A | A active. |
Seeded: one row per member for 2026, all at zero. The composite key means every guard
against it uses an RPG KLIST.
| Field | Type | Meaning |
|---|---|---|
| PAYNO | 9A | Payment number (K), PY + provider digits. |
| PROVID | 9A | Provider paid. |
| PAYRUN | 6S 0 | Payment-run number. |
| PAYAMT | 11P 2 | Total plan liability remitted. |
| PAYCNT | 5P 0 | Claims covered. |
| PAYDT | 8S 0 | Payment date. |
| PAYSTAT | 1A | I issued. |
| Field | Type | Meaning |
|---|---|---|
| LSEQ | 8S 0 | Sequence (K) — DISJOINT numeric range per program (see F.3); the re-run guard. |
| LTYPE | 1A | J adjudication, Y remittance, G GL, B IBNR, Z year-end. |
| LKEY | 9A | Business key (member / provider / etc.). |
| LDT | 8S 0 | Posting date. |
| LAMT / LAMT2 | 11P 2 | Primary / secondary amount (e.g. plan paid / member resp; IBNR accrual / reported base). |
| LREF | 9A | Reference (claim / payment / 'ACCRUAL'). |
| LMEMO | 30A | Free-text memo. |
| Field | Type | Meaning |
|---|---|---|
| APPLNO | 9A | Appeal number (K). |
| CLMNO / MEMBID | 9A | Appealed claim / member. |
| ADENCD | 2A | The denial code being appealed. |
| AFILEDT / ARESLDT | 8S 0 | Filed / resolved dates. |
| ASTAT | 1A | F filed, U upheld, O overturned. |
| AREASON | 30A | Appeal reason. |
| Field | Type | Meaning |
|---|---|---|
| WKSEQ | 8S 0 | Worklist sequence (K), derived from the claim (idempotent). |
| CLMNO | 9A | Pended claim. |
| WKRUN | 6S 0 | Run number. |
| WKRSN | 2A | Pend reason P1..P4 (see F.4). |
| WKAMT | 11P 2 | Amount at issue. |
| WKSTAT | 1A | O open. |
| WKMEMO | 30A | Memo. |
Columns GDSEQ, GDBATCH, GDACCT, GDDRCR, GDAMT, GDCAT, GDREF, GDDT. Written by
HCGLDST as balanced DR/CR pairs; index HCGLDACC on (GDACCT, GDDRCR).
Accounts used: 6100-MEDCLM, 2100-CLMPAY, 1010-CASH,
1210-MBRREC, 4100-MBROFF.
HCCLMLF (over HCCLM) keys claims by MEMBID for member-history and
duplicate-suspicion walks; HCCLMLP (over HCCLML) keys service lines by
PROVID for the provider payment/remittance walk. Both are non-unique by design.
MEDCLAIM (each CL cycle also
ADDLIBLEs it).SBMJOB CMD(CALL PGM(MEDCLAIM/HCDAILY)).CALL MEDCLAIM/HCMENU (option 1 member benefit,
option 2 claim / service-line subfile).HCWEEK; review the pended worklist (HCWORK) and
the remittance total; spool the remittance advice.CALL MEDCLAIM/HCAPPEAL; overturned claims return to
'V' and adjudicate on the next daily run.Post-checks after the daily cycle (against the 6-claim oracle in test/hc_daily.mjs):
HCINTAKE VALID=/REJECT= reconcile to the entered claims; a line/header mismatch shows as
E2 (e.g. header 400.00 vs lines 250.00).HCELIG PASS=/DENY=: a terminated member or a service date outside coverage is denied;
a denied claim carries no allowed amount and no plan liability.HCADJUD ADJUDICATED=: for every adjudicated claim, CPLANPD + CMEMRSP =
CALLOWD exactly, and the accumulator's DEDMET/OOPMET advanced.HCMONTH. Confirm the GL ROWS=/INCURRED=, the loss ratio
and the IBNR accrual DSPLYs, and the HCACCRP accumulator totals.HCYEAR: confirm the summary, that every 2026 accumulator was closed
to HCLEDG ('Z') and reset to a zero 2027 row, and re-enrolment renewed continuing
members (terminated members lapse).Reconciling figures (the same ones the cycles simulation checks against an independent JS oracle,
test/hc_cycles.mjs):
CPLANPD) over its 'A'
claims; grand total = SUM over all remittances (oracle: 18200.00 over 4 claims, 3 payments).CMEMRSP
is not in the payment run.HCACCRP's accumulator totals reconcile to the adjudicated claims.Every posting program is re-runnable by design: the durable ledger key is derived from a stable
business key (section F.3), and each program CHAINs that key with (EN) before it posts, so a
re-run finds the existing row and skips (SKIP= counts it) rather than double-posting.
| Situation | Behaviour | Action |
|---|---|---|
| Daily cycle re-run | Adjudicated claims have their HCLEDG 'J' row; HCADJUD CHAINs it and LEAVESRs. | Safe. Deductible is never applied twice, out-of-pocket never double-counted, accumulator not corrupted. |
| Weekly payment re-run | Each provider's HCLEDG 'Y' row is found; HCPAYRUN skips it. | Safe. RE-RUN PROOF: still exactly the same remittances/total, PAYMENTS=0 on the re-run. A provider is never paid twice. |
| Pended worklist re-run | Worklist key is claim-derived; the existing HCWORK row is found. | Safe no-op — the claim is not re-pended. |
| IBNR / year-end reset re-run | Plan-year / per-member ledger key already present. | Safe. A second accumulator reset would wipe the new year — the guard is the strictest in the app and blocks it. |
| Appeal already resolved | Only ASTAT='F' appeals are touched. | Safe no-op on re-run. |
| GL distribution re-run | See F.5 — the SQL insert is refused on a duplicate GDSEQ, and the row is only counted when SQLCOD=0. | Re-run posts only the movement since the last close; watch the honest cross-month limitation in F.5. |
All programs are in library MEDCLAIM, source in
claims-app/src/sources.mjs. The RPG is fixed-form C-specs with /free blocks; the
fixed-form/free-form mix in the inquiry and adjudication programs is deliberate (see the in-source
comments).
Per validated claim, in claim-number order:
WLSEQ = 10000000 + claim digits; CHAIN(EN)
HCLEDG; if present, skip (already adjudicated).WALLOW = CBILLED × PVRATE. Missing provider/
member/plan → skip.WCOINS = PCOINS, or
POONCOI when the provider is out-of-network (PVNET='O').HCACCUM by KLIST (MEMBID, ACCYR); read
DEDMET/OOPMET (0 if absent).WDAPP = clamp(PDEDUCT − DEDMET, 0, WALLOW), all the
member's.WREM = WALLOW − WDAPP; WPLAN = WREM ×
WCOINS; member share = WREM − WPLAN; WMRSP = share + WDAPP.WOOPRM = max(POOPMAX − OOPMET, 0); if WMRSP >
WOOPRM, WMRSP = WOOPRM. Then the invariant: WPLAN = WALLOW −
WMRSP.DEDMET += WDAPP, OOPMET += WMRSP, ACLMCNT += 1,
APAIDYTD += WPLAN; UPDATE (or WRITE a new row).KLIST (CLMNO, CLINE) before UPDATE (a partial key would match line 1 every time).CSTAT='A'.CSTAT='E'; validates lines-present / lines=header / valid date; sets 'V' or 'D'
(E1/E2/E3). Re-CHAINs the header after the service-line READEs.'V'; CHAINs member then provider; D1..D5. Re-CHAINs the claim after the member/
provider CHAINs.30000000 + provider digits.OFLIND(*IN90)); one provider block, one detail line per claim,
billed/allowed/plan/member.70000000 + plan year.90000000 + member digits); member re-enrolment sweep to the 2027 window.ASTAT='F'; a D3 denial is overturned (claim → 'V', CDENCD cleared), all else
upheld.HCLEDG.LSEQ carries a disjoint numeric range per program, and each key is derived
from a stable business key so a re-run recomputes the same key, the CHAIN(EN) guard
finds the existing row, and the program refuses rather than double-posting:
| Program | LTYPE | LSEQ formula |
|---|---|---|
| HCADJUD | J | 10000000 + claim digits |
| HCPEND | (HCWORK) | 20000000 + claim digits (worklist WKSEQ) |
| HCPAYRUN | Y | 30000000 + provider digits |
| HCGLDST | G | continues from MAX(GDSEQ) ≥ 50000000 (see F.5) |
| HCIBNR | B | 70000000 + plan year |
| HCYRRST | Z | 90000000 + member digits |
| Code | Set by | Meaning |
|---|---|---|
| E1 / E2 / E3 | HCINTAKE | No service lines / line-header billed mismatch / missing-impossible service date. |
| D1 / D2 / D3 | HCELIG | Member not found / coverage terminated / service date outside coverage window. |
| D4 / D5 | HCELIG | Provider not found / provider not active. |
| P1 / P2 / P3 / P4 | HCPEND | High-dollar plan liability / out-of-network auth / reviewable eligibility denial / suspected duplicate. |
| CSTAT | workflow | E entered, V validated, A adjudicated, X paid, D denied, P pended. |
| ASTAT | HCAPPEAL | F filed, U upheld, O overturned. |
CSTAT='E'); the online
programs are read-only inquiries (section B.1).HCADJUD implements deductible + co-insurance +
OOP cap; the flat per-visit copay field is stored on the plan but not used in the maths.GDSEQ by continuing from
MAX(GDSEQ); on a duplicate primary key the SQL insert is refused, and the code
correctly counts a row only when SQLCOD=0. The in-source comment is candid that an
earlier version derived GDSEQ from a per-run counter that restarted at zero, so month 2 rebuilt month
1's keys and the distribution silently stopped tracking the ledger while still printing a growing
incurred total. The committed program posts only the movement since the last close and checks
SQLCOD; operators should still reconcile the GL ROWS= against the expected
DR/CR pairs each month.billed × provider rate (PVRATE). Plan liability
and member responsibility always sum to it.CHAIN(EN), so a re-run skips rather than double-posts.