Skip to main content
Version: v0.0.7

Function: segmentCountMismatch()

segmentCountMismatch(position): 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). Corrected counts are emitted only on serializeX12(ix, { specClean: true, 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

X12Position

Returns

X12ParseWarning

Example

import { segmentCountMismatch } from "@cosyte/x12";
const w = segmentCountMismatch({ segmentIndex: 2, transactionIndex: 0, elementIndex: 1 });