X12 404 Rail Carrier Shipment Information Last updated: 2026-09-29
The 404 is the X12 rail carrier shipment information - the electronic bill of lading for rail. Shippers send it to the railroad to tender a car or container for movement.
BX and BNX describe the shipment and payment, N7 loops the rail equipment, N1 loops the parties, and L5, L0 and hazardous material segments describe the lading.
At a glance
- Standard
- X12
- Version
004010- Functional group
SR(GS01)- Sent by
- Shipper to rail carrier
- Responses
- 997
- ediFabric .NET template
TS404inEdiFabric.Templates.X12- OpenEDI definition
- View 404 in the spec library
404 structure
The full X12 404 layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 14 loops and 88 segment positions, in file order. Loops are shaded and their segments indented; Max use is how many times a segment or loop may repeat.
| Segment / loop | Name | Usage | Max use |
|---|---|---|---|
ST | Transaction Set Header | Mandatory | 1 |
ZC1 | Beginning Segment for Data Correction or Change | Optional | 1 |
BX | General Shipment Information | Optional | 1 |
BNX | Rail Shipment Information | Optional | 1 |
M3 | Release | Mandatory | 1 |
N9 | Reference Identification | Mandatory | 30 |
CM | Cargo Manifest | Optional | 2 |
M1 | Insurance | Optional | 1 |
DTM | Date/Time Reference | Optional | 5 |
| N7 loop | Equipment Details | Mandatory | 500 |
N7 | Equipment Details | Mandatory | 1 |
EM | Equipment Characteristics | Optional | 1 |
| VC loop | Motor Vehicle Control | Optional | 21 |
VC | Motor Vehicle Control | Mandatory | 1 |
| N1 loop | Name | Optional | 2 |
N1 | Name | Mandatory | 1 |
N3 | Address Information | Optional | 2 |
N4 | Geographic Location | Optional | 1 |
H3 | Special Handling Instructions | Optional | 1 |
M7 | Seal Numbers | Optional | 5 |
N5 | Equipment Ordered | Optional | 1 |
IC | Intermodal Chassis Equipment | Optional | 1 |
IM | Intermodal Movement Information | Optional | 1 |
M12 | In-bond Identifying Information | Optional | 2 |
| E1 loop | Empty Car Disposition - Pended Destination Consignee | Optional | 2 |
E1 | Empty Car Disposition - Pended Destination Consignee | Mandatory | 1 |
E4 | Empty Car Disposition - Pended Destination City | Optional | 1 |
E5 | Empty Car Disposition - Pended Destination Route | Optional | 13 |
PI | Price Authority Identification | Optional | 1 |
GA | Canadian Grain Information | Optional | 15 |
| REF loop | Reference Identification | Optional | 99 |
REF | Reference Identification | Mandatory | 1 |
N10 | Quantity and Description | Optional | 15 |
| N1 loop | Name | Optional | 5 |
N1 | Name | Mandatory | 1 |
N3 | Address Information | Optional | 1 |
N4 | Geographic Location | Optional | 1 |
NA | Cross-Reference Equipment | Optional | 10 |
F9 | Origin Station | Mandatory | 1 |
D9 | Destination Station | Mandatory | 1 |
| N1 loop | Name | Mandatory | 10 |
N1 | Name | Mandatory | 1 |
N2 | Additional Name Information | Optional | 2 |
N3 | Address Information | Optional | 2 |
N4 | Geographic Location | Optional | 1 |
REF | Reference Identification | Optional | 2 |
PER | Administrative Communications Contact | Optional | 2 |
BL | Billing Information | Optional | 12 |
| S1 loop | Stop-off Name | Optional | 12 |
S1 | Stop-off Name | Mandatory | 1 |
S2 | Stop-off Address | Optional | 2 |
S9 | Stop-off Station | Optional | 1 |
N1 | Name | Optional | 1 |
N2 | Additional Name Information | Optional | 1 |
N3 | Address Information | Optional | 1 |
N4 | Geographic Location | Optional | 1 |
PER | Administrative Communications Contact | Optional | 1 |
R2 | Route Information | Optional | 13 |
R9 | Route Code Identification | Optional | 1 |
| E1 loop | Empty Car Disposition - Pended Destination Consignee | Optional | 2 |
E1 | Empty Car Disposition - Pended Destination Consignee | Mandatory | 1 |
E4 | Empty Car Disposition - Pended Destination City | Optional | 1 |
E5 | Empty Car Disposition - Pended Destination Route | Optional | 13 |
PI | Price Authority Identification | Optional | 1 |
H3 | Special Handling Instructions | Optional | 20 |
PS | Protective Service Instructions | Optional | 5 |
| LX loop | Assigned Number | Mandatory | 25 |
LX | Assigned Number | Mandatory | 1 |
L5 | Description, Marks and Numbers | Mandatory | 15 |
| L0 loop | Line Item - Quantity and Weight | Optional | 25 |
L0 | Line Item - Quantity and Weight | Mandatory | 1 |
MEA | Measurements | Optional | 3 |
L1 | Rate and Charges | Optional | 10 |
PI | Price Authority Identification | Optional | 30 |
X1 | Export License | Optional | 6 |
| T1 loop | Transit Inbound Origin | Optional | 64 |
T1 | Transit Inbound Origin | Mandatory | 1 |
T2 | Transit Inbound Lading | Optional | 30 |
T3 | Transit Inbound Route | Optional | 12 |
T6 | Transit Inbound Rates | Optional | 1 |
T8 | Free-form Transit Data | Optional | 99 |
L3 | Total Weight and Charges | Optional | 1 |
| LS loop | Loop Header | Optional | 1 |
LS | Loop Header | Mandatory | 1 |
| LH1 loop | Hazardous Identification Information | Optional | 100 |
LH1 | Hazardous Identification Information | Mandatory | 1 |
LH2 | Hazardous Classification Information | Optional | 4 |
LH3 | Hazardous Material Shipping Name | Optional | 10 |
LFH | Freeform Hazardous Material Information | Optional | 20 |
LEP | EPA-Required Data | Optional | 3 |
LH4 | Canadian Dangerous Requirements | Optional | 1 |
LHT | Transborder Hazardous Requirements | Optional | 3 |
LHR | Hazardous Material Identifying Reference Numbers | Optional | 5 |
PER | Administrative Communications Contact | Optional | 5 |
LE | Loop Trailer | Mandatory | 1 |
PER | Administrative Communications Contact | Optional | 5 |
LH2 | Hazardous Classification Information | Optional | 6 |
LHR | Hazardous Material Identifying Reference Numbers | Optional | 1 |
LH6 | Hazardous Certification | Optional | 5 |
XH | Pro Forma - B13 Information | Optional | 1 |
X7 | Customs Information | Optional | 10 |
SE | Transaction Set Trailer | Mandatory | 1 |
Sample 404 file
A rail bill of lading for one car with its lading. Paste it into EdiNation to see every element named and validated.
ISA*00* *00* *16*SENDER1 *14*RECEIVER1 *071216*1406*U*00204*000000263*1*T*>~ GS*IN*SENDER1*RECEIVER1*20071216*1406*000000001*X*004010~ ST*404*0001~ BX*00*R*11**NS*L*B*N~ BNX*A**S~ M3*R*20000301*1116*LT~ N9*BM*2041247**20000301*1116*LT~ N7*CR*237522*80503*N*******RR~ M7*582127*582128~ F9**WARREN*MI~ D9**VALLEY PARK*MO~ N1*11*CORPAY SOLUTIONS~ N3*PO BOX 195199/2065 S CENTER RD~ N4*BURTON*MI*48519~ N1*CN*ST LOUIS ASSEMBLY I*93*04087~ N3*1001 N HIGHWAY DRIVE~ N4*FENTON*MO*63026~ N1*UC*ST LOUIS ASSEMBLY I*93*04087~ N3*1001 N HIGHWAY DRIVE~ N4*FENTON*MO*63026~ N1*SH*STERLING STAMPING*93*06215~ N3*35777 VAN DYKE RD~ N4*STERLING HEIGHTS*MI*48312~ R2*NS*R*ESTL~ R2*BNSF*1~ LX*1~ L5*1*AUTO PARTS*3714993*T~ L0*1***80503*N***42*RCK~ SE*27*0001~ GE*2*000000001~ IEA*1*000000263~
The same 404 as JSON
ediFabric turns every loop, segment and element into a named field. This is the transaction from the sample, in the JSON that ediFabric Native and Cloud return and accept.
{
"ST": {
"TransactionSetIdentifierCode_01": "404",
"TransactionSetControlNumber_02": "0001"
},
"BX": {
"TransactionSetPurposeCode_01": "00",
"TransportationMethodTypeCode_02": "R",
"ShipmentMethodofPayment_03": "11",
"StandardCarrierAlphaCode_05": "NS",
"WeightUnitCode_06": "L",
"ShipmentQualifier_07": "B",
"SectionSevenCode_08": "N"
},
"BNX": {
"ShipmentWeightCode_01": "A",
"BillingCode_03": "S"
},
"M3": {
"ReleaseCode_01": "R",
"Date_02": "20000301",
"Time_03": "1116",
"TimeCode_04": "LT"
},
"N9": [
{
"ReferenceIdentificationQualifier_01": "BM",
"ReferenceIdentification_02": "2041247",
"Date_04": "20000301",
"Time_05": "1116",
"TimeCode_06": "LT"
}
],
"N7Loop": [
{
"N7": {
"EquipmentInitial_01": "CR",
"EquipmentNumber_02": "237522",
"Weight_03": "80503",
"WeightQualifier_04": "N",
"EquipmentDescriptionCode_11": "RR"
},
"M7": [
{
"SealNumber_01": "582127",
"SealNumber_02": "582128"
}
]
}
],
"F9": {
"CityName_02": "WARREN",
"StateorProvinceCode_03": "MI"
},
"D9": {
"CityName_02": "VALLEY PARK",
"StateorProvinceCode_03": "MO"
},
"N1Loop": [
{
"N1": {
"EntityIdentifierCode_01": "11",
"Name_02": "CORPAY SOLUTIONS"
},
"N3": [
{
"AddressInformation_01": "PO BOX 195199/2065 S CENTER RD"
}
],
"N4": {
"CityName_01": "BURTON",
"StateorProvinceCode_02": "MI",
"PostalCode_03": "48519"
}
},
{
"N1": {
"EntityIdentifierCode_01": "CN",
"Name_02": "ST LOUIS ASSEMBLY I",
"IdentificationCodeQualifier_03": "93",
"IdentificationCode_04": "04087"
},
"N3": [
{
"AddressInformation_01": "1001 N HIGHWAY DRIVE"
}
],
"N4": {
"CityName_01": "FENTON",
"StateorProvinceCode_02": "MO",
"PostalCode_03": "63026"
}
},
{
"N1": {
"EntityIdentifierCode_01": "UC",
"Name_02": "ST LOUIS ASSEMBLY I",
"IdentificationCodeQualifier_03": "93",
"IdentificationCode_04": "04087"
},
"N3": [
{
"AddressInformation_01": "1001 N HIGHWAY DRIVE"
}
],
"N4": {
"CityName_01": "FENTON",
"StateorProvinceCode_02": "MO",
"PostalCode_03": "63026"
}
},
{
"N1": {
"EntityIdentifierCode_01": "SH",
"Name_02": "STERLING STAMPING",
"IdentificationCodeQualifier_03": "93",
"IdentificationCode_04": "06215"
},
"N3": [
{
"AddressInformation_01": "35777 VAN DYKE RD"
}
],
"N4": {
"CityName_01": "STERLING HEIGHTS",
"StateorProvinceCode_02": "MI",
"PostalCode_03": "48312"
}
}
],
"R2": [
{
"StandardCarrierAlphaCode_01": "NS",
"RoutingSequenceCode_02": "R",
"CityName_03": "ESTL"
},
{
"StandardCarrierAlphaCode_01": "BNSF",
"RoutingSequenceCode_02": "1"
}
],
"LXLoop": [
{
"LX": {
"AssignedNumber_01": "1"
},
"L5": [
{
"LadingLineItemNumber_01": "1",
"LadingDescription_02": "AUTO PARTS",
"CommodityCode_03": "3714993",
"CommodityCodeQualifier_04": "T"
}
],
"L0Loop": [
{
"L0": {
"LadingLineItemNumber_01": "1",
"Weight_04": "80503",
"WeightQualifier_05": "N",
"LadingQuantity_08": "42",
"PackagingFormCode_09": "RCK"
}
}
]
}
],
"SE": {
"NumberofIncludedSegments_01": "27",
"TransactionSetControlNumber_02": "0001"
}
}Parse and validate a 404 file
Read the file into typed objects with ediFabric .NET, convert it to JSON in process with the ediFabric Native bindings for Python, Java and C, or post it to the ediFabric Cloud REST API from any language.
using EdiFabric.Templates.X12004010; License.SetSerial("YOUR_SERIAL_KEY"); using (var stream = File.OpenRead(@"C:\edi\RailCarrierShipment.txt")) using (var reader = new X12Reader(stream, "EdiFabric.Templates.X12")) { var items = await reader.ReadToEndAsync(); foreach (var transaction in items.OfType<TS404>()) { if (transaction.IsValid(out MessageErrorContext errors)) Console.WriteLine($"{transaction.ST.TransactionSetControlNumber_02} is valid"); else Console.WriteLine(string.Join(Environment.NewLine, errors.Flatten())); } }
import json import edifabric_x12 as ef serial = "YOUR_SERIAL_KEY" ef.load_library() ef.set_serial(serial) ef.set_map(json.dumps({"default": serial, "maps": {}})) edi = open("RailCarrierShipment.txt", "rb").read() output, offset = ef.parse(edi, ef.ParseMode.JSON_VALIDATE) transactions = output[:offset] report = json.loads(output[offset:]) print(report["errors_count"])
import com.edifabric.nativex12.EdiFabricX12; import com.edifabric.nativex12.ParseMode; import com.edifabric.nativex12.ParseResult; String serial = "YOUR_SERIAL_KEY"; EdiFabricX12.loadLibrary(); EdiFabricX12.setSerial(serial); EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}"); String edi = Files.readString(Path.of("RailCarrierShipment.txt")); ParseResult result = EdiFabricX12.parse(edi, ParseMode.JSON_VALIDATE); System.out.println(result.getTransactions()); System.out.println(result.getReport());
#include "edifabric_x12.h" const char *serial = "YOUR_SERIAL_KEY"; ef_parse_result result; if (ef_load_library(NULL) != 0) return 1; ef_set_serial(serial); ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}"); char *edi = read_file("RailCarrierShipment.txt", NULL); /* helper in example_all_functions.c */ if (ef_parse(edi, EF_PARSE_JSON_VALIDATE, NULL, &result) == 0) { /* transactions = output[0 .. offset), report = output[offset .. length) */ fwrite(result.output.data, 1, (size_t)result.output.length, stdout); ef_free(result.output.data); }
curl -X POST 'https://api.edination.com/v2/x12/read' \ -H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \ -H 'Content-Type: application/octet-stream' \ --data-binary '@RailCarrierShipment.txt'
Generate a 404 file
Populate a TS404 object in .NET, or pass JSON in the shape shown above to ediFabric Native or ediFabric Cloud, and get a valid 404 file back.
using EdiFabric.Templates.X12004010; License.SetSerial("YOUR_SERIAL_KEY"); var transaction = new TS404(); // Transaction Set Identifier Code // = “404” (Rail Carrier Shipment Information) // Transaction Set Control Number = 0001 transaction.ST = new ST(); transaction.ST.TransactionSetIdentifierCode_01 = "404"; transaction.ST.TransactionSetControlNumber_02 = "0001"; // ... set the remaining loops and segments the same way // SegmentBuilders is in the Common project of the example repository using (var stream = new MemoryStream()) { using (var writer = new X12Writer(stream)) { writer.Write(SegmentBuilders.BuildIsa("1")); writer.Write(SegmentBuilders.BuildGs("1")); writer.Write(transaction); } Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray())); }
import json import edifabric_x12 as ef serial = "YOUR_SERIAL_KEY" ef.load_library() ef.set_serial(serial) ef.set_map(json.dumps({"default": serial, "maps": {}})) # the transactions JSON returned by ef.parse, edited or produced by your application transactions = open("RailCarrierShipment.json", "rb").read() edi = ef.build(transactions, postfix="\r\n") print(edi)
import com.edifabric.nativex12.EdiFabricX12; String serial = "YOUR_SERIAL_KEY"; EdiFabricX12.loadLibrary(); EdiFabricX12.setSerial(serial); EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}"); // the transactions JSON returned by parse, edited or produced by your application String transactions = Files.readString(Path.of("RailCarrierShipment.json")); String edi = EdiFabricX12.build(transactions, "\r\n"); System.out.println(edi);
#include "edifabric_x12.h" ef_buffer edi; if (ef_load_library(NULL) != 0) return 1; ef_set_serial("YOUR_SERIAL_KEY"); ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}"); /* the transactions JSON returned by ef_parse, edited or produced by your application */ char *transactions = read_file("RailCarrierShipment.json", NULL); if (ef_build(transactions, "\r\n", &edi) == 0) { fwrite(edi.data, 1, (size_t)edi.length, stdout); ef_free(edi.data); }
# the JSON returned by /read, edited or produced by your application curl -X POST 'https://api.edination.com/v2/x12/write' \ -H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \ -H 'Content-Type: application/json' \ --data-binary '@RailCarrierShipment.json' \ -o 'RailCarrierShipment.txt'
Complete ediFabric .NET example
A complete C# program for the X12 404, built on TS404 in EdiFabric.Templates.X12. The same code is in the ediFabric .NET examples on GitHub.
using EdiFabric.Core.Model.Edi;
using EdiFabric.Core.Model.Edi.X12;
using EdiFabric.Examples.X12.Common;
using EdiFabric.Framework.Readers;
using EdiFabric.Framework.Writers;
using EdiFabric.Templates.X12004010;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace EdiFabric.Examples.X12.T404
{
class Program
{
static void Main(string[] args)
{
SerialKey.Set(Common.SerialKey.Get());
Read();
Write();
}
///
/// Read Rail Carrier Shipment
///
static void Read()
{
var ediStream = File.OpenRead(Directory.GetCurrentDirectory() + @"\..\..\..\Files\X12\RailCarrierShipment.txt");
List ediItems;
using (var ediReader = new X12Reader(ediStream, "EdiFabric.Templates.X12"))
ediItems = ediReader.ReadToEnd().ToList();
var transactions = ediItems.OfType();
foreach (var transaction in transactions)
{
if (transaction.HasErrors)
{
// partially parsed
var errors = transaction.ErrorContext.Flatten();
}
}
}
///
/// Write Rail Carrier Shipment
///
static void Write()
{
var transaction = BuildRailCarrierShipment("1");
using (var stream = new MemoryStream())
{
using (var writer = new X12Writer(stream))
{
writer.Write(SegmentBuilders.BuildIsa("1"));
writer.Write(SegmentBuilders.BuildGs("1"));
writer.Write(transaction);
}
var ediString = stream.LoadToString();
}
}
///
/// Builds Rail Carrier Shipment.
/// Original from https://ps.nafta.extra.fcagroup.com/sites/itb-ebus/shared%20Documents/404RailCarrierShipmentInformation.pdf
///
static TS404 BuildRailCarrierShipment(string controlNumber)
{
var result = new TS404();
// Transaction Set Identifier Code
// = “404” (Rail Carrier Shipment Information)
// Transaction Set Control Number = 0001
result.ST = new ST();
result.ST.TransactionSetIdentifierCode_01 = "404";
result.ST.TransactionSetControlNumber_02 = controlNumber.PadLeft(9, '0');
// Transaction Set Purpose Code = “00” (Original)
// Transportation Method/ Type Code = “R” (Rail)
// Shipment Method of Payment
// = “11” (Rule 11 Shipment)
// Standard Carrier Alpha Code = NS
// Weight Unit Code = ”L” (Pounds)
// Shipment Qualifier
// = “B” (Bill of Lading for Individual Shipment)
// Section Seven Code = “N” (Not in Effect)
result.BX = new BX();
result.BX.TransactionSetPurposeCode_01 = "00";
result.BX.TransportationMethodTypeCode_02 = "R";
result.BX.ShipmentMethodofPayment_03 = "11";
result.BX.StandardCarrierAlphaCode_05 = "NS";
result.BX.WeightUnitCode_06 = "L";
result.BX.ShipmentQualifier_07 = "B";
result.BX.SectionSevenCode_08 = "N";
// Shipment Weight Code
// = “A” (Shipper's Weight Agreement)
// Billing Code = “S” (Single Shipment Billing)
result.BNX = new BNX();
result.BNX.ShipmentWeightCode_01 = "A";
result.BNX.BillingCode_03 = "S";
// Release Code = “R” (Released with Billing Data)
// Date = 03 / 01 / 2000
// Time = 11:16
// Time Code = “LT” (Local Time)
result.M3 = new M3();
result.M3.ReleaseCode_01 = "R";
result.M3.Date_02 = "20000301";
result.M3.Time_03 = "1116";
result.M3.TimeCode_04 = "LT";
// Repeating N9
result.N9 = new List();
// Reference Identification Qualifier
// = “BM” (Bill of Lading Number)
// Reference Identification = 2041247
// Date = 03 / 01 / 2000
// Time = 11:16
// Time Code = “LT” (Local Time)
var n9 = new N9();
n9.ReferenceIdentificationQualifier_01 = "BM";
n9.ReferenceIdentification_02 = "2041247";
n9.Date_04 = "20000301";
n9.Time_05 = "1116";
n9.TimeCode_06 = "LT";
result.N9.Add(n9);
// Repeating N7 Loops
result.N7Loop = new List();
// Begin N7 Loop
var n7Loop1 = new Loop_N7_404();
// Equipment Initial = CR
// Equipment Number = 237522
// Weight = 80,503
// Weight Qualifier = “N” (Actual Net Weight)
// Equipment Description Code = “RR” (Rail Car)
n7Loop1.N7 = new N7();
n7Loop1.N7.EquipmentInitial_01 = "CR";
n7Loop1.N7.EquipmentNumber_02 = "237522";
n7Loop1.N7.Weight_03 = "80503";
n7Loop1.N7.WeightQualifier_04 = "N";
n7Loop1.N7.EquipmentDescriptionCode_11 = "RR";
// Repeating M7
n7Loop1.M7 = new List();
// Seal Number = 582127
// Seal Number = 582128
var m7 = new M7();
m7.SealNumber_01 = "582127";
m7.SealNumber_02 = "582128";
n7Loop1.M7.Add(m7);
// End N7 Loop
result.N7Loop.Add(n7Loop1);
// City Name = WARREN
// State or Province Code = MI
result.F9 = new F9();
result.F9.CityName_02 = "WARREN";
result.F9.StateorProvinceCode_03 = "MI";
// City Name = VALLEY PARK
// State or Province Code = MO
result.D9 = new D9();
result.D9.CityName_02 = "VALLEY PARK";
result.D9.StateorProvinceCode_03 = "MO";
// Repeating N1 Loops
result.N1Loop = new List();
// Begin N1 Loop 1
var n1Loop1 = new Loop_N1_404_3();
// Entity Identifier Code = “11”
// (Party to be billed < AAR Accounting Rule 11 >)
// Name = CORPAY SOLUTIONS
n1Loop1.N1 = new N1();
n1Loop1.N1.EntityIdentifierCode_01 = "11";
n1Loop1.N1.Name_02 = "CORPAY SOLUTIONS";
// Repeating N3
n1Loop1.N3 = new List();
// Address Information
// = PO BOX 195199 / 2065 S CENTER RD
var n31 = new N3();
n31.AddressInformation_01 = "PO BOX 195199/2065 S CENTER RD";
n1Loop1.N3.Add(n31);
// City Name = BURTON
// State or Province Code = MI
// Postal Code = 48519
n1Loop1.N4 = new N4();
n1Loop1.N4.CityName_01 = "BURTON";
n1Loop1.N4.StateorProvinceCode_02 = "MI";
n1Loop1.N4.PostalCode_03 = "48519";
// End N1 Loop 1
result.N1Loop.Add(n1Loop1);
// Begin N1 Loop 2
var n1Loop2 = new Loop_N1_404_3();
// Entity Identifier Code = “CN” (Consignee)
// Name = ST LOUIS ASSEMBLY I
// Identification Code Qualifier
// = “93” (Code assigned by the organization
// originating the transaction set)
// Identification Code = 04087
n1Loop2.N1 = new N1();
n1Loop2.N1.EntityIdentifierCode_01 = "CN";
n1Loop2.N1.Name_02 = "ST LOUIS ASSEMBLY I";
n1Loop2.N1.IdentificationCodeQualifier_03 = "93";
n1Loop2.N1.IdentificationCode_04 = "04087";
// Repeating N3
n1Loop2.N3 = new List();
// Address Information
// = 1001 N HIGHWAY DRIVE
var n32 = new N3();
n32.AddressInformation_01 = "1001 N HIGHWAY DRIVE";
n1Loop2.N3.Add(n32);
// City Name = FENTON
// State or Province Code = MO
// Postal Code = 63026
n1Loop2.N4 = new N4();
n1Loop2.N4.CityName_01 = "FENTON";
n1Loop2.N4.StateorProvinceCode_02 = "MO";
n1Loop2.N4.PostalCode_03 = "63026";
// End N1 Loop 2
result.N1Loop.Add(n1Loop2);
// Begin N1 Loop 3
var n1Loop3 = new Loop_N1_404_3();
// Entity Identifier Code
// = “UC” (Ultimate Consignee)
// Name = ST LOUIS ASSEMBLY I
// Identification Code Qualifier
// = “93” (Code assigned by the organization
// originating the transaction set)
// Identification Code = 04087
n1Loop3.N1 = new N1();
n1Loop3.N1.EntityIdentifierCode_01 = "UC";
n1Loop3.N1.Name_02 = "ST LOUIS ASSEMBLY I";
n1Loop3.N1.IdentificationCodeQualifier_03 = "93";
n1Loop3.N1.IdentificationCode_04 = "04087";
// Repeating N3
n1Loop3.N3 = new List();
// Address Information
// = 1001 N HIGHWAY DRIVE
var n33 = new N3();
n33.AddressInformation_01 = "1001 N HIGHWAY DRIVE";
n1Loop3.N3.Add(n33);
// City Name = FENTON
// State or Province Code = MO
// Postal Code = 63026
n1Loop3.N4 = new N4();
n1Loop3.N4.CityName_01 = "FENTON";
n1Loop3.N4.StateorProvinceCode_02 = "MO";
n1Loop3.N4.PostalCode_03 = "63026";
// End N1 Loop 3
result.N1Loop.Add(n1Loop3);
// Begin N1 Loop 4
var n1Loop4 = new Loop_N1_404_3();
// Entity Identifier Code = “SH” (Shipper)
// Name = STERLING STAMPING
// Identification Code Qualifier
// = “93” (Code assigned by the organization
// originating the transaction set)
// Identification Code = 06215
n1Loop4.N1 = new N1();
n1Loop4.N1.EntityIdentifierCode_01 = "SH";
n1Loop4.N1.Name_02 = "STERLING STAMPING";
n1Loop4.N1.IdentificationCodeQualifier_03 = "93";
n1Loop4.N1.IdentificationCode_04 = "06215";
// Repeating N3
n1Loop4.N3 = new List();
// Address = 35777 VAN DYKE RD
var n34 = new N3();
n34.AddressInformation_01 = "35777 VAN DYKE RD";
n1Loop4.N3.Add(n34);
// City Name = STERLING HEIGHTS
// State or Province Code = MI
// Postal Code = 48312
n1Loop4.N4 = new N4();
n1Loop4.N4.CityName_01 = "STERLING HEIGHTS";
n1Loop4.N4.StateorProvinceCode_02 = "MI";
n1Loop4.N4.PostalCode_03 = "48312";
// End N1 Loop 4
result.N1Loop.Add(n1Loop4);
// Repeating R2
result.R2 = new List();
// Standard Carrier Alpha Code = NS
// Routing Sequence Code
// = “R” (Origin Carrier, Rule 11 Shipment)
// City Name = ESTL
var r21 = new R2();
r21.StandardCarrierAlphaCode_01 = "NS";
r21.RoutingSequenceCode_02 = "R";
r21.CityName_03 = "ESTL";
result.R2.Add(r21);
// Standard Carrier Alpha Code = BNSF
// Routing Sequence Code
// = “1” (1st Carrier after Origin Carrier)
var r22 = new R2();
r22.StandardCarrierAlphaCode_01 = "BNSF";
r22.RoutingSequenceCode_02 = "1";
result.R2.Add(r22);
// Repeating LX Loops
result.LXLoop = new List();
// Begin LX Loop
var lxLoop1 = new Loop_LX_404();
// Assigned Number = 1
lxLoop1.LX = new LX();
lxLoop1.LX.AssignedNumber_01 = "1";
// Repeating L5
lxLoop1.L5 = new List();
// Lading Line Item Number = 1
// Lading Description = AUTO PARTS
// Commodity Code = 3714993
// Commodity Code Qualifier
// = “T” (Standard Transportation Commodity
// Code)
var l5 = new L5();
l5.LadingLineItemNumber_01 = "1";
l5.LadingDescription_02 = "AUTO PARTS";
l5.CommodityCode_03 = "3714993";
l5.CommodityCodeQualifier_04 = "T";
lxLoop1.L5.Add(l5);
// Repeating L0 Loops
lxLoop1.L0Loop = new List();
// Begin L0 Loop
var l0Loop1 = new Loop_L0_404();
// Lading Line Item Number = 1
// Weight = 80,503
// Weight Qualifier = “N” (Actual Net Weight)
// Lading Quantity = 42
// Packaging Form Code = “RCK” (Rack)
l0Loop1.L0 = new L0();
l0Loop1.L0.LadingLineItemNumber_01 = "1";
l0Loop1.L0.Weight_04 = "80503";
l0Loop1.L0.WeightQualifier_05 = "N";
l0Loop1.L0.LadingQuantity_08 = "42";
l0Loop1.L0.PackagingFormCode_09 = "RCK";
// End L0 Loop
lxLoop1.L0Loop.Add(l0Loop1);
// End LX Loop
result.LXLoop.Add(lxLoop1);
return result;
}
}
}More operations in ediFabric .NET
404 questions
Is the 404 the rail bill of lading?
Yes. It carries the same information as the paper bill of lading and is how rail shipments are tendered electronically in North America.
How is hazardous material described?
With the LH1, LH2, LH3 and LH4 segments and the emergency contact information required for rail.
How is the equipment identified?
N7 carries the equipment initial and number (for example a railcar mark), with weights and seal numbers in related segments.
How do I parse and generate X12 404 files in .NET, Python, Java and C?
In .NET, install EdiFabric and EdiFabric.Templates.X12, read the file with X12Reader into TS404 objects and write them back with X12Writer. From Python, Java or C, use ediFabric Native, which converts 404 files to JSON and JSON back to X12 inside your process. From any other language, post the file to the ediFabric Cloud REST API.
Resources
Parse your first X12 404 in five minutes
The Community plan is free forever and needs no credit card. It includes ediFabric .NET, Native and Cloud with one serial key.
Sign up free Validate EDI files free