100% Offline Reference
Offsets & REDEFINES
Calculating Exact COBOL Copybook Byte Offsets (REDEFINES, OCCURS & VB RDW)
Manual spreadsheet offset math breaks the moment a 2,000-line copybook introduces nested OCCURS multipliers, COMP-3 packed widths, or overlapping REDEFINES unions.
1. Three Non-Negotiable Copybook Offset Invariants
- 1-Based vs. 0-Based Indexing: Mainframe JCL `DFSORT` / `SYNCSORT` cards (`INCLUDE COND=(52,5,PD,GT,0)`) use 1-based start position + length, whereas JVM `ByteArray.copyOfRange(51, 56)` and Python `record[51:56]` use 0-based half-open slices. EbcdicPrism's Free-Tier hover tooltip displays both side by side.
REDEFINESUnion High-Water Mark: A `REDEFINES` clause rewinds the layout cursor back to the target sibling's start offset without advancing the primary cursor unless the redefining branch is wider than the target.- Fixed-Block (
FB) vs. Variable-Blocked 4-ByteRDW(VB): Variable-length mainframe datasets transferred with `RDW` enabled prepend `[LL_hi, LL_lo, 0x00, 0x00]` (where `LL` includes the 4-byte RDW itself) ahead of every logical record.

Frequently Asked Engineering Questions
How big is a COBOL COMP / BINARY (S9(4) vs S9(9)) field?
Under standard IBM Enterprise COBOL TRUNC(STD)/TRUNC(BIN) allocation: 1 to 4 digits occupy 2 bytes (halfword), 5 to 9 digits occupy 4 bytes (fullword), and 10 to 18 digits occupy 8 bytes (doubleword) in Big-Endian two's complement.
Inspect, Decode, Diff & PCI-Scrub Mainframe Dumps Offline in Your JetBrains IDE
Never upload regulated banking, card-network, or insurance .ebcdic extracts or proprietary .cpy schemas into browser hex viewers. EbcdicPrism Copybook Viewer runs 100% air-gapped inside IntelliJ IDEA, DataGrip, PyCharm, Rider, GoLand, and WebStorm with a forever-free core tier and a 14-day [Pro] trial.