Skip to main content

Module parse

Module parse 

Source
Expand description

KOBOLD.CSV.PARSE.1 + KOBOLD.CSV.ROUNDTRIP.1 (FAIL-CLOSED) – parse a COMPACT extract back into record bytes, and prove the round trip.

parse_into takes a Compact (header + value rows) CSV produced against copybook and re-encodes each field value into its declared PIC bytes, returning one reconstructed record per row. It FAILS CLOSED (a Finding, never a truncation/coercion) on:

  • a value too long for an alphanumeric field (VALUE_OVERFLOW),
  • a non-numeric value into a numeric field (NUMERIC_INVALID), too many integer/fraction digits, a sign on an unsigned field,
  • a header whose column names do not match the copybook’s leaf field names (HEADER_MISMATCH),
  • a data row whose column count differs from the header (COLUMN_COUNT),
  • a malformed CSV line (the dialect reader’s own findings bubble up).

roundtrip proves records -> Compact CSV -> parse_into -> identical bytes, reporting per-record honestly when a value-only compact extract legitimately does NOT round-trip (e.g. a numeric field whose stored zoned form differs from its canonical render, so re-encoding yields the canonical – not the original – bytes).

This module is independent of GnuCOBOL/libcob.

Structs§

RoundtripRecord
The per-record outcome of a roundtrip proof.
RoundtripReport
The full result of a roundtrip proof over a record set.

Functions§

parse_into
KOBOLD.CSV.PARSE.1 – reconstruct record bytes from a Compact CSV csv_text against copybook.
roundtrip
KOBOLD.CSV.ROUNDTRIP.1 – prove records -> Compact CSV -> parse_into -> identical bytes.