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

35 lines
961 B
Markdown

# 12-divide-100 — 100-Division File Splitter
## 电信业务场景
CDR数据100分割。将CDR数据按100件一个批处理单位进行分割,供后续系统处理。
Demonstrates dividing input records into groups of 100:
- **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: 100 (exact), 101 (one extra), 99 (one short)
## Files
| File | Purpose |
|------|---------|
| `main-12-divide-100.cbl` | COBOL program (fixed format) |
| `data-gen.sh` | Generate N test records (default 101) |
| `run.sh` | Compile + run 3 test cases |
## Algorithm
```
DIVIDE record-count BY 100 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-100
- FILE-OUT-02.DAT: records 101-200
- etc.