Repository navigation
Description
What: a batch program that reads a KSDS sequentially (ORGANIZATION IS INDEXED, ACCESS MODE IS SEQUENTIAL, READ ... NEXT) gets the records in ascending key order. VSAM compares the key's bytes in the data code page: lower case before upper case, letters before digits. The generated service reads them with a bare findAll():
public List<CustRec> readAllCustFile() {
return custRecRepository.findAll();
}findAll() sends no ORDER BY, so the order is whatever the database hands back. This happens on every engine and every code page, even though #3822 (PR #3874) generates the <KEY>_SORT column that the CICS browse finders already order by. Nothing breaks visibly: the records just come back in a different order, which silently changes control breaks, merge/match logic, and the order of report lines.
Found by: the Cultural Gauntlet, part 3, dimension D (#3834). The estate is a PIC X(8) KSDS that CICS browses and a batch step reads sequentially. The generated table was created in real databases, 22 keys were written through the generated CobolRecords.sortKey, and the results were read back:
collation-static: fails in all 32 cells (4 targets × 8 columns).collation-db(--db): fails in all 24 executed cells (H2 2.2.224, PostgreSQL 16 with aCdatabase, PostgreSQL 16 with anen_US.UTF-8database). Every other probe passes in the same cells: STARTBR/READNEXT from LOW-VALUES and from a key, READPREV, and the duplicate on a trailing-space key.- PostgreSQL returns heap (insertion) order:
ZZ|abc|1A|ÆBLE|ABC|.... - H2 returns primary-key code-point order:
#1|123|1A|@1|A 1|.... - The mainframe (cp037) returns:
é1|ÄRGER|ÅS|ÑANDU|#1|@1|ØRE|abc|aBC|ÆBLE|A 1|A.1|A-1|Abc|ABC|A1|E1|NANDU|ZZ|1A|123.
- PostgreSQL returns heap (insertion) order:
Expected: a sequential READ of a KSDS reads in key order. For a String key under culture.key_collation: ebcdic that means ordering by the sort column, e.g. findAll(Sort.by("custKeySort")) or a derived findAllByOrderByCustKeySortAsc(). A numeric or binary key orders by the key itself. This only fixes order when the DB has a sort column; keys written by raw SQL still have none (#3874's limit).
Where: gitgalaxy/tools/cobol_to_java/cobol_to_java_repository_forge.py, the batch branch of the service ops (readAll{name} → findAll()).
Ledgered in: tests/cultural_gauntlet/baseline.txt (collation_*|*|collation-static, collation_*|*|collation-db). The fix lowers the baseline.
🤖 Generated with Claude Code
Activity
#3834 (part 3): the Cultural Gauntlet's DB collation, input data and …
#3945 / #3946 / #3949 / #3950: generated Java reads KSDS files in key…