Files
cobol-java-v3/benchmark-programs/10-divide-50/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

964 B

10-divide-50 — 50-Division File Splitter

电信业务场景

请求书50分割。将请求书数据按50件一个文件进行分割输出,用于分批印刷或批量发送。

Demonstrates dividing input records into groups of 50:

  • PERFORM VARYING counter: Track record numbers across the loop
  • DIVIDE ... GIVING REMAINDER: Calculate file number from record count
  • Close-write cycle: Close old file, open new file at each boundary
  • Tested at boundary conditions: 50 (exact), 51 (one extra), 49 (one short)

Files

File Purpose
main-10-divide-50.cbl COBOL program (fixed format)
data-gen.sh Generate N test records (default 51)
run.sh Compile + run 3 test cases

Algorithm

DIVIDE record-count BY 50 GIVING Q REMAINDER R
IF R = 1 → open new FILE-OUT-NN
Write record to current file

Output Files

  • FILE-OUT-01.DAT: records 1-50
  • FILE-OUT-02.DAT: records 51-100
  • etc.