Files
cobol-java-v3/benchmark-programs/23-select-condition

23-select-condition — SELECT Condition Simulation

电信业务场景

客户合同检索。使用索引文件模拟SELECT条件检索,通过START+READ NEXT实现条件匹配和范围查询。

Purpose

Simulates SQL SELECT with WHERE conditions using GnuCOBOL INDEXED files and START/READ NEXT operations.

Test Coverage

  1. Single record by key — READ with KEY IS (exact match WHERE)
  2. Range query — START with NOT LESS THAN, loop with upper bound check
  3. Zero results — Key not found, INVALID KEY handling
  4. Greater-than query — START with GREATER THAN, read all following records

Key Techniques

  • INDEXED file ORGANIZATION with DYNAMIC access
  • START for positioning (KEY IS GREATER THAN / NOT LESS THAN)
  • READ NEXT for sequential traversal
  • FILE STATUS checking
  • INVALID KEY / NOT INVALID KEY for conditional handling