Skip to content

Globe: EBCDIC Collation Inverts ASCII/Java Business Logic (1 vs A) #3986

Closed

Description

@squid-protocol

Part of GitGalaxy Tours the Globe 🌍

The Defect

EBCDIC and ASCII (Java) have fundamentally inverted sorting rules for alphanumeric characters:

  • EBCDIC Collation: Letters > Numbers (e.g., A is 0xC1, 0 is 0xF0) -> 0 > A evaluates to TRUE.
  • ASCII Collation: Numbers < Letters (e.g., A is 0x41, 0 is 0x30) -> 0 > A evaluates to FALSE.

The Impact

If a COBOL program contains business logic like IF CUSTOMER-ID > 'A' (perhaps to check if an ID starts with a letter instead of a number), translating this directly into Java as if (customerId.compareTo(A) > 0) will yield the exact opposite boolean result. This silently corrupts the execution path of the application.

Required Action

While PR #3822 beautifully handled database sorting (codePageSortKey), we need a runtime utility for standard conditional logic. The Java generator must translate alphanumeric COBOL >, <, >=, and <= operators into a wrapper method like CobolCompare.ebcdic(val1, val2) rather than using native Java .compareTo(), ensuring runtime business logic perfectly matches the mainframe.

Activity

  1. added
    data-integrity
    legacy-modernization
    on Sep 28, 2026
  2. added a commit that references this issue on Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    data-integritylegacy-modernizationpriority: medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions