Hacker News new | ask | show | jobs
by jvolkman 704 days ago
Since it looks like you're talking about North American freight rail, here's an example rail shipment waybill (taken from the CN implementation guide which I found online [1])

  ISA*00* *00* *02*CN *ZZ*GENERIC *230710*1339* U*00803*006298413*0*P*>
  GS*WB*CN*GENERIC*20230710*1336*98826*X*008030
  ST*417*988260001
  BX*00*R*PP*1257*CN*L*B*N****N
  BNX*R**S
  N9*BM*1257**20230710*1336
  DTM*168*20230710*1336*ET
  N7*CN*123456*213360*N*66700******RR****6711*M*****186*128***C214
  M7*12345
  N8*111111*20230710
  F9*070112*WATSON*SK*****071511*S0K4V0
  D9*093390*VANCOUVER*BC*****0093900*V5T1E1
  N1*SH*GENERIC CARLOAD INC*C5*1111111111111
  N3*123 FIRST ROAD
  N4*WATSON*SK*S0K 4V0*CA
  PER*IC*CONTACT NAME*TE*123-123-1234
  N1*CN*GENERIC CONSIGNEE CO*C5*2222222222222
  N3*12 SMITH STREET
  N4*VANCOUVER*BC*V5K 1P7*CA
  N1*PF*GENERIC CARLOAD INC*C5*1111111111111
  N3*123 FIRST ROAD
  N4*WATSON*SK*S0K 4V0*CA
  R2*CN*S****R
  LX*1
  L5*1*WALLBOARD*3275440*T
  L0*1***213360*N***1*CLD
  MEA*AI*VOL*250.6041*CR***15
  MEA**VWT*0.7167*KC***15
  SE*31*988260001
  GE*1*98826
  IEA*1*006298413
The F9 and D9 lines are the origin and destination stations, respectively. WATSON, SK and VANCOUVER, BC are regulated names and can be used to find actual station coordinates in an industry reference file. These are the start and end points of the shipment from a rail network perspective.

There's also a pre-baked route. In this example the route is just "R2*CN*S**R" which basically means the rail cars are never leaving CN (since it's a giant class 1 railroad and this is their example). But in your example of a cross country shipment, the route might look something like:

  R2*BNSF*S*CHGO
  R2*UP*1*PITTS
  R2*NS*2*PHILA
  R2*CSXT*D
In this example, the first name is the carrier for that leg, the second value is the role that carrier plays (S = shipper's carrier, 1 = first intermediate carrier, 2 = second intermediate carrier, D = delivery switch carrier), and the last name, if present, is the junction station where the two adjacent carriers will meet. Like the station city+state names before, these junction abbreviations are regulated and can be looked up in industry reference files to find more information. But assume that BNSF and UP are well aware of how they interchange at CHGO.

Of course the shipment probably came from some factory and is going to some other factory. Those addresses can be found in the N1*SH (shipper) and N1*CN (consignee) blocks. Obviously the railroad isn't going to drop a group of rail cars at the consignee's street address, but the "delivery switch carrier" railroad in charge of handling that last mile service will have an existing relationship with the consignee and know where to take the cars. They'll often have pre-arranged schedules for when a locomotive will arrive to bring new loads and pull away empties.

[1] https://www.cn.ca/-/media/files/customer-centre/customer-cen...