404 Rail Carrier Shipment Information (007040)

This is the standard X12 007040 spec, with 18 loops and 103 segment positions, as OpenEDI JSON, an ediFabric C# template and an ediFabric Native model. To change it for a trading partner, customize it in the EDI Spec Builder.

Loading the spec…
The spec as an OpenAPI 3 schema with x-openedi-* extensions, for ediFabric Native, ediFabric Cloud and the EDI Spec Builder. Download OpenEDI (171 KB) Generate classes
The ediFabric .NET template, class TS404. It needs the common segments, composites and codes of X12 007040, one download for every transaction in the version. Download C# (2 KB) Common files (233 KB)
The intermediary model ediFabric Native loads with set_map. Download Native (143 KB)

Use the 404 spec in your code

ediFabric .NET

Add the C# template and its common files to your project, or reference the template NuGet package, and read 404 files into TS404 objects. See ediFabric .NET.

ediFabric Native

Map version 007040 to the Native model with set_map, then parse 404 files to JSON from Python, Java, C or C#. See Convert between EDI and JSON.

OpenEDI

Select Customize in Spec Builder to copy the spec under your own name, change it for your partner, and parse files against it in EdiNation, ediFabric Native or ediFabric Cloud. Read about OpenEDI.

Generate 404 classes in Python, Java, Node.js, Go, Rust or C

ediFabric Native returns each 404 as JSON, with the property names of the OpenEDI schema. To work with that JSON as typed objects, generate classes from the OpenEDI file in your language and deserialize the JSON into TS404. Serialize the objects back to JSON to build EDI with ediFabric Native. The classes keep the loops, segments, lengths and code lists, but not the EDI data formats, so validate files with ediFabric Native. Read more in Generate a class from OpenEDI.

Python: datamodel-code-generator. Node.js: openapi-typescript. Java, Go, Rust and C: OpenAPI Generator.

For a sample file, the same data as JSON, and code to parse, validate and generate the 404, see the 404 transaction guide.

404 structure

Loops and segments of the standard 404, with their usage and maximum repeats.

IDNameUsageMax use
STTransaction Set HeaderMandatory1
ZC1ZC1Optional1
BXBXOptional1
BNXBNXOptional1
M3M3Mandatory1
N9N9Mandatory30
CMCMOptional2
M1M1Optional1
DTMDTMOptional5
Loop N7N7Mandatory500
N7N7Mandatory1
EMEMOptional1
Loop VCVCOptional36
VCVCMandatory1
Loop N1N1Optional2
N1N1Mandatory1
N3N3Optional2
N4N4Optional1
H3H3Optional1
M7M7Optional5
N5N5Optional1
ICICOptional1
IMIMOptional1
M12M12Optional2
Loop E1E1Optional2
E1E1Mandatory1
E4E4Optional1
E5E5Optional13
PIPIOptional1
GAGAOptional15
Loop REFREFOptional99
REFREFMandatory1
N9N9Optional10
N10N10Optional15
SMDSMDOptional1
VCVCOptional36
Loop L0L0Optional25
L0L0Mandatory1
MEAMEAOptional3
L1L1Optional10
Loop PIPIOptional30
PIPIMandatory1
CDCDOptional10
Loop N1N1Optional15
N1N1Mandatory1
N3N3Optional1
N4N4Optional1
PERPEROptional2
BLBLOptional12
NANAOptional10
F9F9Mandatory1
D9D9Mandatory1
Loop N1N1Mandatory15
N1N1Mandatory1
N2N2Optional2
N3N3Optional2
N4N4Optional1
REFREFOptional2
PERPEROptional2
BLBLOptional12
Loop S1S1Optional12
S1S1Mandatory1
S2S2Optional2
S9S9Optional1
N1N1Optional1
N2N2Optional1
N3N3Optional1
N4N4Optional1
PERPEROptional1
R2R2Mandatory13
R9R9Optional1
Loop E1E1Optional2
E1E1Mandatory1
E4E4Optional1
E5E5Optional13
PIPIOptional1
H3H3Optional20
PSPSOptional5
Loop LXLXMandatory25
LXLXMandatory1
L5L5Mandatory15
Loop L0L0Optional25
L0L0Mandatory1
MEAMEAOptional3
L1L1Optional10
Loop PIPIOptional30
PIPIMandatory1
CDCDOptional10
X1X1Optional6
Loop T1T1Optional64
T1T1Mandatory1
T2T2Optional30
T3T3Optional12
T6T6Optional1
T8T8Optional99
L3L3Optional1
Loop LSLSOptional1
LSLSMandatory1
Loop LH1LH1Optional1000
LH1LH1Mandatory1
LH2LH2Optional4
LH3LH3Optional10
LFHLFHOptional20
LEPLEPOptional3
LH4LH4Optional4
LHTLHTOptional3
LHRLHROptional10
PERPEROptional5
Loop N1N1Optional10
N1N1Mandatory1
N3N3Optional2
N4N4Optional1
PERPEROptional2
LELEMandatory1
PERPEROptional5
LH2LH2Optional6
LHRLHROptional1
LH6LH6Optional5
XHXHOptional1
X7X7Optional10
SETransaction Set TrailerMandatory1