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