Turns a hex dump of an EBCDIC record file back into the binary record file, so it can be opened in RecordEditor with the matching COBOL copybook.
.hex (hex dump) --HexToEbcdic--> .dat (raw EBCDIC bytes)
--RecordEditor + copybook (CP037)--> readable records
This is one step of a three-step job. It is the step that has to be done on the filesystem, because RecordEditor wants a real file of bytes, not a wall of hex digits pasted into a text box.
javac HexToEbcdic.java
java HexToEbcdic input.hex output.datinput.hex is a text file of hex digits — the kind of dump you get from
od, xxd, or a BBS "recovered files" screen. Whitespace is stripped first, so
it can be spaced out however is convenient:
48 65 6C 6C 6F
That becomes 5 raw bytes in output.dat.
Then, in RecordEditor:
- Layout → the copybook (
CUST-MASTER,OBSERV-LOG,DONOR-HARVEST, …). - File → the
output.datthis program just wrote. - Code page →
CP037(USA/Canada). This is where the EBCDIC meaning actually gets applied — the tool's job ended one step earlier.
Get the code page right or every field is mojibake.
The bytes in a hex dump of an EBCDIC file are already EBCDIC. Converting them to text here would be a mistake: it would flatten a fixed-width record into a line of characters and destroy the byte offsets the copybook depends on. RecordEditor is the component that knows your copybook and can decode the fields in place, so the decoding belongs there.
The result: this program is deliberately dumb — pure hex → bytes — and that is what makes it composable. One plain transformation, no options, no modes.
- Whitespace is removed before parsing, so separators are optional.
- An odd number of hex digits is rejected — half a byte is ambiguous.
- Any non-hex character is rejected rather than skipped.
- On error it prints a message and exits without writing an output file, so a
failed run won't leave a half-written
.datbehind.
A JDK (javac and java). No external libraries.
telehack-bbs — the board whose
RECOVERED area produces these hex dumps. Its harvest.dat, erasure.dat and
observlog.dat are record files matching the copybooks shown alongside them.
MIT — see LICENSE.