# 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.