Forwarded email — 850 purchase order

A purchase order pasted straight out of a forwarded email: an email header sits before the ISA, four ISA elements were trimmed below their fixed width, and IEA01 claims two functional groups when there is one.

The interchange as submitted

Repaired what it could — the findings below remain and x12-tidy cannot fix them automatically. 2 passes · A pass reported findings but changed nothing; they cannot be auto-repaired. · corrected text differs from the input

Corrected interchange

Envelope

SenderZZ / NORTHWINDFrom ISA05 (qualifier) and ISA06 (ID).
ReceiverZZ / CONTOSOFrom ISA07 (qualifier) and ISA08 (ID).
Usage indicatorPISA15 — P = production, T = test, I = information.
Interchange version00401ISA12 — the interchange control version number.
Date / time240401 0915ISA09 and ISA10 — when the interchange was prepared.
Functional groups1GS segments counted while walking the payload; IEA01 is checked against this.
Transaction sets1ST segments counted; each group's GE01 is checked against its own count.
Segments10Total segments in the cleansed payload; each SE01 is checked against its set's count.

Repair passes

The Byte column is the offset into the submitted text where the flagged structure begins; ISA-line findings share a number, and a dash means the finding isn't tied to one spot.

Pass 1 1 fatal 4 error 1 warning changed the interchange

410 bytes in → 350 bytes out.

SeverityCodeByteFinding
FATAL structure.functional-group-count-mismatch IEA01 does not match the number of functional groups found IEA01 is b'2' but 1 functional group(s) were found.

IEA01 (Number of Included Functional Groups) must equal the actual count of GS segments in the interchange.

ERROR isa.element-width 88 An ISA element is not its fixed width ISA02 is 3 byte(s); padded with spaces to its fixed width of 10.

Every ISA element has a fixed width -- ISA06 is 15 bytes, ISA13 is 9, and so on. This element was shorter (space-padded on the right to fit) or longer only by trailing spaces (trimmed). The value itself is unchanged. A sender that right-trims blank fixed-width fields is the usual cause. This is an error, not a warning: the ISA line is no longer 105 bytes, and conventional VAN services and fixed-offset parsers cannot read the interchange at all until it is repaired.

ERROR isa.element-width 88 An ISA element is not its fixed width ISA04 is 3 byte(s); padded with spaces to its fixed width of 10.

Every ISA element has a fixed width -- ISA06 is 15 bytes, ISA13 is 9, and so on. This element was shorter (space-padded on the right to fit) or longer only by trailing spaces (trimmed). The value itself is unchanged. A sender that right-trims blank fixed-width fields is the usual cause. This is an error, not a warning: the ISA line is no longer 105 bytes, and conventional VAN services and fixed-offset parsers cannot read the interchange at all until it is repaired.

ERROR isa.element-width 88 An ISA element is not its fixed width ISA06 is 9 byte(s); padded with spaces to its fixed width of 15.

Every ISA element has a fixed width -- ISA06 is 15 bytes, ISA13 is 9, and so on. This element was shorter (space-padded on the right to fit) or longer only by trailing spaces (trimmed). The value itself is unchanged. A sender that right-trims blank fixed-width fields is the usual cause. This is an error, not a warning: the ISA line is no longer 105 bytes, and conventional VAN services and fixed-offset parsers cannot read the interchange at all until it is repaired.

ERROR isa.element-width 88 An ISA element is not its fixed width ISA08 is 7 byte(s); padded with spaces to its fixed width of 15.

Every ISA element has a fixed width -- ISA06 is 15 bytes, ISA13 is 9, and so on. This element was shorter (space-padded on the right to fit) or longer only by trailing spaces (trimmed). The value itself is unchanged. A sender that right-trims blank fixed-width fields is the usual cause. This is an error, not a warning: the ISA line is no longer 105 bytes, and conventional VAN services and fixed-offset parsers cannot read the interchange at all until it is repaired.

WARNING isa.leading-bytes 0 Bytes precede the ISA segment 88 byte(s) precede the ISA segment (b'Subject: FW: Q1 reorder - please confirm\r\nFrom: purchasing@northwind-traders.example\r\n\r\n'); stripped before parsing.

One or more bytes appear before the ISA segment. A conformant X12 file begins with 'ISA' as its very first byte. Common causes are a UTF-8 byte-order mark, whitespace, or transport headers left in by the sender. x12-tidy strips them and continues; the reported bytes are what was removed.

Pass 2 1 fatal no change

350 bytes in → 350 bytes out.

SeverityCodeByteFinding
FATAL structure.functional-group-count-mismatch IEA01 does not match the number of functional groups found IEA01 is b'2' but 1 functional group(s) were found.

IEA01 (Number of Included Functional Groups) must equal the actual count of GS segments in the interchange.