xxds is a C program that reads Variable Block (VB) format files and displays them in hexadecimal format with EBCDIC character representation.
xxds reads VB format files from standard input and prints them in a hex dump format similar to xxd or hexdump, but specifically designed for EBCDIC-encoded Variable Block files. The program processes records by reading the RDW containing a 2-byte big-endian length field, followed by the record data.
To build the program:
makeThis will compile xxds.c and create the xxds executable.
To install the program system-wide:
sudo make installThis will copy the executable to /usr/local/bin/.
Read from a file:
./xxds < input_file.vbOr pipe input:
cat input_file.vb | ./xxdsFor each record, the program prints:
-
Record Header:
Record: nnnn Length: nnnn Offset: xxxxxxxx- Record number (starting from 1)
- Record length in bytes
- File offset in hexadecimal
-
Hex Dump: Each 16-byte chunk is displayed as:
oooo: xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx ccccccccccccccccoooo: Offset within the record (4 hex digits)xxxxxxxx: Four groups of 4 bytes in hexadecimalcccccccccccccccc: EBCDIC character representation (unprintable chars shown as dots)
-
End of File Summary: Printed after the last record:
End of file: n record[s], nnnn byte[s] (xxxxxxxx)n: Total number of records readnnnn: Total number of bytes readxxxxxxxx: File size in hexadecimal
Record: 1 Length: 88 Offset: 00000000
0000: 00580000 00800050 D7C1E4E3 E2E4D4F0 .......&PAUTSUM0
0010: 00000000 00000000 00000000 00000000 ................
0020: 00000000 00000000 00000000 01010072 ................
0030: D7C1E4E3 C4E3D3F1 00000000 00000000 PAUTDTL1........
0040: 00000000 00000000 00000000 00000000 ................
0050: 00000000 020280CE ........
End of file: 1 record, 88 bytes (00000058)
- Reads Variable Block format files from stdin
- Displays records with hex dump and EBCDIC character representation
- Handles incomplete records gracefully
- Tracks record count and total byte count
- Uses EBCDIC Code Page 037 for character conversion
- Supports records up to 32K in size
VB format records consist of:
- 4 bytes: RDW consisting of:
- a big-endian 16-bit unsigned integer specifying the total record length (including the RDW itself)
- 2 flag bytes (ignored by this program)
- Remaining bytes: Record data (length - 4 bytes)
If a record is incomplete (file ends before the expected end of the record), the program will:
- Display the partial record data
- Print "Last record incomplete"
- Continue with the end-of-file summary
This program is licensed under the MIT License.