You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When dealing with Japanese/Kanji (Double-Byte Character Sets or DBCS), IBM EBCDIC mixes single-byte English and double-byte Kanji by injecting hidden control bytes: 0x0E (Shift-Out) and 0x0F (Shift-In).
In CobolRecords.text(), we decode bytes into Java Strings using new String(rec, offset, length, charset). When the Charset decoder encounters SO/SI bytes, it consumes them. This means a 20-byte COBOL string on the mainframe might decode into a Java String of only 15 characters.
The Impact
COBOL strictly defines variables by byte-length, and modernization developers frequently use myString.substring() or myString.length() assuming it matches the COBOL definition. Because the Java string "shrunk" during decoding, any padding, substring, or fixed-width export logic in the generated Java will throw an IndexOutOfBoundsException or corrupt the adjacent data stream.
Required Action
Implement a CobolString wrapper or a paddedEbcdicString() helper in CobolRecords that retains the logical byte-width of the string (e.g., by padding with spaces if SO/SI bytes were consumed), ensuring Java string manipulations mirror the mainframe's memory geometry.
Activity
Fix #4039: generate CobolRecords / CobolEdit for every program to port (