A Spring Boot / Spring Batch application that migrates a COBOL account processing batch program to Java. It reads fixed-width account records, calculates interest, validates balances, and writes processed output — all modeled after the original COBOL copybook layouts.
- Java 17+
- Maven 3.8+ (or use the included
./mvnwwrapper)
No external database required — uses an embedded H2 instance for the Spring Batch job repository.
./mvnw spring-boot:runThis runs the batch job and exits. There is no web UI — it's a batch processor. Output is written to output/ACCT-OUT.DAT.
Fixed-width file at src/main/resources/input/ACCT-IN.DAT (63 chars per line):
| Position | Field | Format | Length |
|---|---|---|---|
| 1–10 | Customer ID | PIC 9(10) | 10 |
| 11–30 | Last Name | PIC X(20) | 20 |
| 31–45 | First Name | PIC X(15) | 15 |
| 46–59 | Balance | PIC S9(11)V99 | 14 |
| 60–61 | Account Type | SA or CH | 2 |
| 62–63 | Status | A/AC or C/CL | 2 |
- Closed accounts are skipped (return code
SK) - Savings accounts receive interest at the configured rate (default 3.25%)
- Checking accounts receive zero interest
- Balances below the minimum threshold (default $100) are flagged with return code
LB - All other active accounts get return code
OK
Fixed-width file at output/ACCT-OUT.DAT (40 chars per line):
| Position | Field | Format | Length |
|---|---|---|---|
| 1–10 | Customer ID | PIC 9(10) | 10 |
| 11–24 | New Balance | PIC S9(11)V99 | 14 |
| 25–38 | Interest | PIC S9(11)V99 | 14 |
| 39–40 | Return Code | OK, LB, or SK | 2 |
- Malformed input records are skipped (up to 100) and written to
output/dead-letter.dat - I/O errors cause immediate step failure so the job can be restarted from its checkpoint
All settings are in src/main/resources/application.yml:
batch.account.processing:
interest-rate: 0.0325 # Annual interest rate
min-balance: 100.00 # Minimum balance threshold
chunk-size: 500 # Records per transaction chunk
job:
input.file: classpath:input/ACCT-IN.DAT
output.file: file:output/ACCT-OUT.DAT
dead-letter.file: output/dead-letter.dat./mvnw testActuator endpoints are enabled for health and Prometheus metrics:
GET /actuator/healthGET /actuator/prometheusGET /actuator/metrics
Batch counters (batch.account.processing.totalRead, totalProcessed, totalSkipped) are registered as Micrometer gauges.
src/main/java/com/example/accountprocessing/
├── batch/ # Job config, reader/writer, processor, skip listener, counters
├── model/ # AccountRecord, AccountOutputRecord, enums
└── service/ # Interest calculation and balance validation