Files
cobol-java-v3/benchmark-programs/34-sort/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

1.3 KiB

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