Expand description
KOBOLD.JSON.PARSE.1 (FAIL-CLOSED) – reconstruct the original record bytes from a packet + copybook.
Two paths:
- If the packet carries
raw_hexfor its leaf fields (anAudit/Evidencepacket), reconstruct the exact bytes from the hex (KOBOLD.JSON.ROUNDTRIP.1: bytes -> packet -> bytes are identical). - If the packet is value-only (
Compact), re-encode each declared field’s value into its PIC bytes, failing closed on overflow or an invalid value – a value too long for an alphanumeric field, or a non-numeric value into a numeric field, yields aFinding, never a silent truncation/coercion.
On any failure the whole reconstruction fails closed: it returns Err(findings), not partial bytes.
It is independent of GnuCOBOL/libcob.
Functions§
- decode_
hex - Decode a lowercase/uppercase hex string into bytes, fail-closed on odd length / non-hex.
- parse_
into KOBOLD.JSON.PARSE.1– reconstruct the record bytes declared bycopybookfrompacket.