Skip to content

About

Turn a hex dump of an EBCDIC record file back into a binary record file, for opening in RecordEditor with a COBOL copybook.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

hextoebcdic

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.

Use

javac HexToEbcdic.java
java HexToEbcdic input.hex output.dat

input.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:

  1. Layout → the copybook (CUST-MASTER, OBSERV-LOG, DONOR-HARVEST, …).
  2. File → the output.dat this program just wrote.
  3. 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.

Why the tool does no EBCDIC work itself

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.

Behaviour

  • 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 .dat behind.

Requirements

A JDK (javac and java). No external libraries.

See also

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.

License

MIT — see LICENSE.

About

Turn a hex dump of an EBCDIC record file back into a binary record file, for opening in RecordEditor with a COBOL copybook.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages