Repository navigation
Description
Problem
The det translator ignores OBJECT-COMPUTER. PROGRAM COLLATING SEQUENCE IS alphabet in relation conditions: an alphanumeric IF A < B is translated as byte order whatever the program's collating sequence, silently. IBM (Enterprise COBOL 6.4 LR, OBJECT-COMPUTER paragraph) and GnuCOBOL both apply the program collating sequence to nonnumeric comparisons.
Evidence
gitgalaxy/tools/cobol_to_java/det/gen.py:self.program_collatingis read only by the SORT / MERGE translation (Gen.collating, COBOL translator: SORT/MERGE (RELEASE/RETURN) have no statement parser; JCL utility steps are not run #4268); condition translation never consults it.- Repro (found while landing the COBOL translator: SORT/MERGE (RELEASE/RETURN) have no statement parser; JCL utility steps are not run #4268 alphabet slice):
GnuCOBOL 3 (
OBJECT-COMPUTER. GG PROGRAM COLLATING SEQUENCE IS RV. SPECIAL-NAMES. ALPHABET RV IS 'z' THRU 'a'. 01 A PIC X VALUE 'a'. 01 B PIC X VALUE 'b'. IF A < B DISPLAY 'A<B' ELSE DISPLAY 'A>=B' END-IFcobc -std=ibm):A>=B. The det port:A<B. No hole, no refusal.
Fix direction
Either refuse by name (an alphanumeric relation condition <, >, <=, >=, or = under an alphabet with ALSO, in a program with a non-native PROGRAM COLLATING SEQUENCE), or route it through Sort.Collating's dual-order comparison (IBM order, stop where GnuCOBOL's differs, register D1), which #4268 added for SORT keys. Level-88 THRU ranges and SEARCH ALL keys are affected the same way.
Acceptance criteria
- A program with a non-native PROGRAM COLLATING SEQUENCE either translates its alphanumeric comparisons under it or refuses them by name
- A det program test against GnuCOBOL (the repro above)
Related: #4268, #4035, register D1.
🤖 Generated with Claude Code
Activity