# Maintenance Burden

> [← Back to Summary](./summary.md) | [Remediation Plan →](./remediation-plan.md)

## High-Complexity Programs

### COACTUPC — 4,236 lines — 🔴 Critical
- **Source:** `app/cbl/COACTUPC.cbl`
- **Metrics:** 168 IF statements, 20 EVALUATEs, 64 PERFORMs, 51 GO TOs
- **Issue:** Far exceeds recommended COBOL program size (~500-1000 lines)
- **Impact:** Extremely difficult to understand, test, and modify
- **Recommendation:** Decompose into smaller programs (validation, display, update logic)

### COTRTLIC — 2,098 lines — 🟠 High
- **Source:** `app/app-transaction-type-db2/cbl/COTRTLIC.cbl`
- **Issue:** Large program combining list display, pagination, and delete operations
- **Recommendation:** Separate list/browse logic from delete operations

### COTRTUPC — 1,702 lines — 🟠 High
- **Source:** `app/app-transaction-type-db2/cbl/COTRTUPC.cbl`
- **Issue:** Complex add/edit form with extensive validation
- **Recommendation:** Extract validation into shared paragraphs or sub-programs

### COCRDUPC — 1,560 lines — 🟠 High
- **Source:** `app/cbl/COCRDUPC.cbl`
- **Metrics:** 148 IF statements, 21 GO TOs
- **Issue:** Complex card update with deeply nested validation logic

## GO TO Usage — 🟡 Medium

8 out of 31 base programs (26%) use GO TO statements:

| Program | GO TO Count | Impact |
|:--------|----------:|:-------|
| COACTUPC | 51 | 🔴 Severely impacts readability |
| COCRDUPC | 21 | 🟠 Difficult to follow control flow |
| COCRDLIC | 16 | 🟠 Complicates browse logic |
| CBSTM03A | 15 | 🟡 Batch flow harder to trace |
| CBSTM03B | 13 | 🟡 Sub-program flow unclear |
| COACTVWC | 9 | 🟡 Moderate impact |
| COCRDSLC | 9 | 🟡 Moderate impact |
| CORPT00C | 1 | 🟢 Minimal impact |

**Recommendation:** Refactor GO TO statements to use structured PERFORM THRU patterns.

## Unused Code — 🟢 Low

### UNUSED1Y.cpy
- **Source:** `app/cpy/UNUSED1Y.cpy`
- **Issue:** Not referenced by any COBOL program in the entire codebase
- **Recommendation:** Remove from repository after confirming non-use

### Duplicate Customer Record Definitions
- `CUSTREC.cpy` and `CVCUS01Y.cpy` both define customer record layouts
- CUSTREC.cpy uses tab indentation (non-standard for COBOL)
- CVCUS01Y.cpy uses standard space indentation
- **Recommendation:** Consolidate to a single customer record copybook

## Inconsistent Naming Conventions — 🟢 Low

### File Extension Casing
- Base programs: mixed `.cbl` and `.CBL` (CBSTM03A.CBL, CBSTM03B.CBL)
- Optional modules: mixed `.cbl` and `.CBL` (DBUNLDGS.CBL, PAUDBLOD.CBL, PAUDBUNL.CBL)
- Copybooks: mixed `.cpy` and `.CPY`
- JCL: mixed `.jcl` and `.JCL` (CREASTMT.JCL, FTPJCL.JCL, etc.)

**Recommendation:** Standardize on lowercase extensions throughout.

### Program Naming Prefix Convention
- `CO*` = Online CICS programs
- `CB*` = Batch programs
- `CS*` = Shared utility/copybook code
- `CV*` = VSAM data copybooks
- Exception: CUSTREC.cpy doesn't follow CV* pattern

## Copybook Proliferation — 🟡 Medium

62 copybooks across 4 directories creates a complex include hierarchy:
- `app/cpy/` — 30 files (data and utility copybooks)
- `app/cpy-bms/` — 17 files (BMS generated copybooks)
- `app/app-authorization-ims-db2-mq/cpy/` — 9 files + 2 BMS
- `app/app-transaction-type-db2/cpy/` — 2 files + 2 BMS

The CSLKPCDY.cpy copybook alone is 1,318 lines (lookup tables) — larger than most programs.

## COPY REPLACING Pattern — 🟡 Medium

COACTUPC uses `COPY CSSETATY REPLACING` 18+ times (lines 3208-3310), COTRTUPC uses it multiple times as well. This pattern:
- Makes the effective program much larger than the visible source
- Complicates debugging (preprocessed code differs from source)
- Creates repetitive patterns that could be simplified

---

*See also: [Complexity Analysis](../analysis/complexity-analysis.md) | [Remediation Plan](./remediation-plan.md)*
