# 34-sort — SORT Processing Program ## 电信业务场景 CDR排序。使用SORT语句对CDR明细进行排序(按主叫号码升序/降序、通话时长多键排序),支持INPUT/OUTPUT PROCEDURE。 ## Purpose Comprehensive demonstration of COBOL SORT statement capabilities, covering SR-N001 through SR-N010. ## Test Coverage | ID | Test | Description | |----|------|-------------| | SR-N001 | Ascending SORT | USING INPUT-FILE / GIVING OUTPUT-FILE, ASCENDING KEY | | SR-N002 | Descending SORT | DESCENDING KEY sort | | SR-N003 | Multi-key SORT | ASCENDING KEY + DESCENDING KEY (mixed) | | SR-N004 | INPUT PROCEDURE | FILTER-INPUT section, only records with VALUE > 200 | | SR-N005 | OUTPUT PROCEDURE | SUMMARIZE-OUTPUT with key break totals | | SR-N006 | 0-record SORT | Empty input file | | SR-N007 | 1-record SORT | Single record input | | SR-N008 | INPUT/OUTPUT PROCEDURE | Both procedures combined with editing | | SR-N009 | Duplicate key SORT | Three records with same key (stability check) | | SR-N010 | Descending multi-key | DESCENDING + ASCENDING combined | ## Key Techniques - SORT USING/GIVING - INPUT PROCEDURE / OUTPUT PROCEDURE - ASCENDING KEY / DESCENDING KEY - RELEASE statement (input procedure) - RETURN statement (output procedure) - Key break processing in output procedure