Function: segmentCountMismatch()
segmentCountMismatch(
position,declared,actual):X12ParseWarning
Build an X12_SEGMENT_COUNT_MISMATCH warning. Emitted by the spec-clean
serializer when an SE-01 value does not equal the actual number of
segments in the transaction set it closes (ST through SE inclusive). Like
the group/transaction count factories, the serializer surfaces both values
verbatim and NEVER silently corrects them - corrected counts are emitted
only on serializeX12(ix, { recomputeCounts: true }). The parser does not
emit this code (it leaves SE-01 reconciliation to the emit half); it is a
Phase-8 serializer diagnostic.
Parameters
position
declared
string
actual
number
Returns
Example
import { segmentCountMismatch } from "@cosyte/x12";
const w = segmentCountMismatch(
{ segmentIndex: 2, interchangeIndex: 0, groupIndex: 0, transactionIndex: 0, elementIndex: 1 },
"6",
7,
);