Files
cobol-java-v3/benchmark-programs/07-keybreak-summary/README.md
T
NB-076 94400d50d4 feat: add benchmark-programs — 58 telecom COBOL test programs
作为子目录纳入系统,与核心测试管道协同

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 09:53:21 +08:00

1.0 KiB

07-keybreak-summary — Key Break Summary

电信业务场景

加入者月汇总。按客户ID进行key切汇总,计算每位客户当月的通话总量和总金额。输出每个客户的汇总记录。

Demonstrates the classic COBOL control-break (key break) pattern:

  • Read sorted input file grouped by KEY
  • Compare WS-PREV-KEY to detect key change
  • On key change: write summary (KEY, COUNT, TOTAL) and reset accumulators
  • At end-of-file: write final group summary
  • Accumulate grand total across all groups

Files

File Purpose
main-07-keybreak-summary.cbl COBOL program (fixed format)
data-gen.sh Generate sorted test data
run.sh Compile, run, verify output

Input Record

Field Type Length
KEY PIC X 10
AMOUNT PIC 9 10

Output Record

Field Type Notes
KEY PIC X(10) Group key
COUNT PIC Z(5)9 Record count in group
TOTAL PIC Z(9)9 Sum of AMOUNT in group