# EDI 322 Terminal Operations: Ramp Activity Guide

> EDI 322 explained: terminal and intermodal ramp events, the Q5, N7, R4 and N9 segments, status codes, a live sample, and how it relates to the 315 and 214.

<QuickAnswer>
The EDI 322 Terminal Operations and Intermodal Ramp Activity is the X12 transaction a marine terminal, rail ramp or railroad sends to report what happened to equipment at a terminal: discharged from a vessel, loaded on rail, in-gated, out-gated and similar events. Each 322 carries a status code, date and time, the container or trailer, and the location.
</QuickAnswer>

**The EDI 322 is how terminals and rail ramps tell everyone else what they did with the box.** A marine terminal discharges a container, a trucker pulls it out of the gate, a port operator ramps it onto a railcar, a railroad unloads it at an inland ramp. Each of those moves is recorded by whoever operates the facility, and the 322 is the X12 message that reports it to the ocean carrier, the railroad or the customer that needs to know.

This guide covers what the 322 reports, who sends it to whom, how it relates to the [315](/guides/edi/315-status-details-ocean) container status feed, every segment you will map, a live sample with a discharge and an out-gate at Los Angeles, and the errors that leave terminal events out of the shipment record.

<EDIGuideCTA
  transactionType="322"
  headline="Tie terminal events back to the orders in the box"
  body="A gate move matters because of what is inside the container. OrderSync reads purchase orders in any format, from EDI 850s to PDFs, emails and spreadsheets, matches items and units to your catalog, and sends clean order data to your ERP."
/>

## What Is an EDI 322?

**An EDI 322 is the Terminal Operations and Intermodal Ramp Activity transaction set defined by [ASC X12](https://x12.org/products/transaction-sets), used to report terminal operations and intermodal ramp activity for equipment.** It is built around one event per transaction: a `Q5` status at the top, then one or more pieces of equipment, each with its own location, vessel, parties and references. The 322 travels in functional group `SO` (the `GS01` value), the same group as the 304.

Authoritative references for 322 work:

- The [X12 transaction set catalog](https://x12.org/products/transaction-sets) defines the 322 structure and the shipment status code list used in `Q5`
- [Stedi's X12 004010 reference for the 322](https://www.stedi.com/edi/x12-004010/322) lists the segments, elements and code values for release 004010
- [CN's 322 implementation guide for port operators](https://www.cn.ca/-/media/files/customer-centre/customer-centre-documents/322-implementation-guide-for-port-operators-4010.pdf) is a public example of a port operator sending 322s to a railroad as containers are ramped onto railcars, with a full sample message
- [CN's customer 322 implementation guide](https://www.cn.ca/-/media/files/customer-centre/customer-centre-documents/322-implementation-guide-4010-en.pdf) shows the other direction: a railroad sending intermodal events to its customers, with the status codes it offers
- The [BIC container prefix register](https://www.bic-code.org/) governs the four-letter owner codes in ISO 6346 container numbers, which the 322 carries in `N7`

**Who sends it?** Whoever operates the facility or the move: a marine terminal operator, a port operator ramping containers to rail, or a railroad reporting ramp events. Chassis providers also publish 322 implementation guides.

**Who receives it?** The party that needs the event: the ocean carrier whose container it is, the railroad taking it inland, or a shipper, consignee or forwarder that subscribed to a railroad's feed.

**When is it sent?** As events happen or on a schedule. The CN guides describe both: port operators send 322s as containers are ramped, and CN's customer feed can be scheduled at intervals through the day.

**Why does it matter?** The terminal and the ramp are where containers sit, and where storage and free time are counted. A carrier that does not get the terminal's discharge and gate events cannot send accurate 315s to its customers, and a railroad that does not get the port operator's ramp events cannot track what is on its trains.

## The 322 in the Ocean Flow

| Set | X12 name | Usually sent by | What it does |
|---|---|---|---|
| **[300](/guides/edi/300-reservation-booking-request-ocean)** | Reservation (Booking Request) (Ocean) | Booking party | Asks for space |
| **[301](/guides/edi/301-confirmation-ocean)** | Confirmation (Ocean) | Ocean carrier | Confirms the booking |
| **[304](/guides/edi/304-shipping-instructions)** | Shipping Instructions | Booking party | Bill of lading details |
| **[310](/guides/edi/310-freight-receipt-and-invoice-ocean)** | Freight Receipt and Invoice (Ocean) | Ocean carrier | Bill of lading data and charges |
| **[315](/guides/edi/315-status-details-ocean)** | Status Details (Ocean) | Ocean carrier | Container events to the shipper, consignee or forwarder |
| **322** | Terminal Operations and Intermodal Ramp Activity | Terminal, port operator or railroad | Events at terminals and ramps |

The 300 to 310 documents set up the booking and the bill of lading. The 315 and the 322 report what happens to the containers afterwards, from different sources. A common pattern: the terminal records the discharge and the out-gate and sends 322s to the ocean carrier, and the carrier passes the same events on to its customers as 315s. On rail moves, the railroad may send 322s directly to the customer. Who sends what is set by the trading partner agreements, so confirm the flow with each partner.

## Q5 Status Codes in a 322

The event is coded in `Q501`, X12 data element 157 (Shipment Status Code), the same element the 315 uses in `B403` and the 214 in `AT701`. Each terminal or railroad uses its own subset. These codes appear in published 322 guides and the X12 list:

| Code | X12 meaning | Where you will see it |
|---|---|---|
| `UV` | Unloaded From Vessel | Marine terminal: container discharged |
| `AE` | Loaded on Vessel | Marine terminal: container loaded for export |
| `I` | In-Gate | Terminal or ramp: container entered |
| `OA` | Out-Gate | Terminal or ramp: container left, usually on a truck |
| `AL` | Loaded on Rail | Port operator or ramp: container on a railcar |
| `RL` | Rail Departure from Origin Intermodal Ramp | Railroad: train departed |
| `AR` | Rail Arrival at Destination Intermodal Ramp | Railroad: arrived at the inland ramp |
| `UR` | Unloaded from a Rail Car | Railroad: off the train at the ramp |
| `NT` | Notification | Railroad: customer notified |
| `TM` | Intra-Terminal Movement | Terminal: moved within the facility |
| `VA` / `VD` | Vessel Arrival / Vessel Departure | Vessel events at the terminal |

The CN customer guide lists a longer set, including bad order and repair events and interchange events between railroads, and uses an `NF` event to carry the last free day of storage when the customer asks for it. Codes like that come from the partner's guide only, so log any code you do not recognise and look it up there.

## Interactive Example: Discharge and Out-Gate at Los Angeles

A fictional marine terminal operator at Los Angeles (`SOUTHBAYCT`) reports two events to the ocean carrier (SCAC `BLUQ`) for container `QXZU4128732`. One interchange carries two 322 transactions. The first reports `UV`, unloaded from vessel, on 20 November at 11:42 local time. The second reports `OA`, out-gate, on 21 November at 13:52, and adds an `N1` for the drayage carrier that pulled the container. In both, `N7` identifies the container with its check digit, type and owner SCAC, `M7` gives the seal, `V1` the vessel and voyage, `R4` the terminal and `N9` the bill of lading and booking numbers. All names, numbers and codes are fictional. The carrier's own [315 import milestones sample](/guides/edi/315-status-details-ocean) reports the same two events to the importer.

Use the **Plain English** tab for a readable summary, or click any segment to break it down element by element.

<EDISample id="322-terminal-discharge-and-out-gate" />

## 322 Structure at a Glance

The table follows X12 release 004010. Most of the 322 sits inside the `N7` loop, so one transaction can report the same event for many pieces of equipment.

| Area | Segment | Name | Usage in the standard | Notes |
|---|---|---|---|---|
| Heading | **ST** | Transaction Set Header | Mandatory | `ST01` = `322` |
| Heading | **ZC1** | Beginning Segment for Data Correction or Change | Optional | Used when correcting an earlier event |
| Heading | **Q5** | Status Details | Mandatory | The event, date, time and place |
| Detail loop | **N7** | Equipment Details | Mandatory, up to 1000 | One loop per container, trailer or chassis |
| N7 loop | **V4** | Cargo Location Reference | Optional | Where the cargo is |
| N7 loop | **DTM** | Date/Time Reference | Optional, up to 2 | Dates for the equipment |
| N7 loop | **M7** | Seal Numbers | Optional, up to 5 | Seals |
| N7 loop | **W09** | Equipment and Temperature | Optional | Reefer settings |
| N7 loop | **W2** | Equipment Identification | Optional | Equipment and its load or empty status |
| N7 loop | **NA** | Cross-Reference Equipment | Optional, up to 30 | Railcar, chassis or other linked equipment |
| N7 loop | **V1** | Vessel Identification | Optional | Vessel and voyage |
| N7 loop | **R4 / DTM** | Port or Terminal, Date/Time | Mandatory, up to 20 | Terminal or ramp locations |
| N7 loop | **N1 / N3 / N4** | Name and address | Optional, up to 10 | Parties such as the trucker or consignee |
| N7 loop | **N9** | Reference Identification | Optional, up to 10 | B/L, booking, waybill, pick-up numbers |
| N7 loop | **L0 / L5 / H1** | Cargo lines | Optional | Quantity, description, hazardous material |
| Summary | **SE** | Transaction Set Trailer | Mandatory | Segment count and control number |

## Key Segments Explained

### Q5: Status Details

```
Q5*UV*20261120*1142*LT~
```

| Element | Name | Example | What it means |
|---|---|---|---|
| **Q501** | Shipment Status Code | `UV` | The event (see the status code table) |
| **Q502** | Date | `20261120` | Date of the event |
| **Q503** | Time | `1142` | Time of the event |
| **Q504** | Time Code | `LT` | `LT` local time. `Q503` and `Q504` travel together |
| **Q505** | Status Reason Code | | Why, when a reason is given |
| **Q506 / Q507 / Q508** | City, State or Province, Country | | Where, in words, when sent |
| **Q509 / Q510** | Equipment Initial, Equipment Number | | Equipment, when the partner puts it here as well as in `N7` |

The CN customer guide notes that its default is universal time and local time is an option. Always read `Q504` before you compare a terminal event with a vessel schedule or a truck appointment.

### N7: Equipment Details

```
N7*QXZU*412873*9210*G*******CN*BLUQ*****K*2****45G1~
```

| Element | Name | Example | What it means |
|---|---|---|---|
| **N701** | Equipment Initial | `QXZU` | Owner prefix |
| **N702** | Equipment Number | `412873` | Serial number |
| **N703 / N704** | Weight, Weight Qualifier | `9210` / `G` | Weight and its type |
| **N705** | Tare Weight | | Tare, when sent |
| **N711** | Equipment Description Code | `CN` | `CN` container |
| **N712** | Standard Carrier Alpha Code | `BLUQ` | The equipment owner's SCAC |
| **N717** | Weight Unit Code | `K` | Kilograms |
| **N718** | Equipment Number Check Digit | `2` | ISO 6346 check digit |
| **N722** | Equipment Type | `45G1` | 40-foot high cube general-purpose |

The `N7` opens the loop that carries everything else about the equipment. If a 322 reports a vessel discharge for 300 containers, it carries 300 `N7` loops under a single `Q5`.

### V1: Vessel Identification

```
V1*9700017*MERIDIAN HARBOR*LR*118E*BLUQ***L~
```

`V101` is the vessel code (here a Lloyd's or IMO number, qualified by `V108` = `L`), `V102` the name, `V103` the flag, `V104` the voyage and `V105` the carrier. Vessel and voyage let the receiver group all the containers from one discharge.

### R4: Terminal or Ramp

```
R4*D*UN*USLAX*LOS ANGELES*US*SOUTH BAY CONTAINER TERMINAL~
```

| Element | Name | Example | What it means |
|---|---|---|---|
| **R401** | Port or Terminal Function Code | `D` | The role of the location |
| **R402** | Location Qualifier | `UN` | `UN` UN/LOCODE; rail guides often use SPLC codes instead |
| **R403** | Location Identifier | `USLAX` | Location code |
| **R404** | Port Name | `LOS ANGELES` | Name |
| **R405** | Country Code | `US` | Country |
| **R406** | Terminal Name | `SOUTH BAY CONTAINER TERMINAL` | Terminal |

Function codes and location schemes vary more on the 322 than on the 315. Marine terminals often report against the port of discharge or loading. The CN port operator guide uses `6` origin rail terminal and `7` destination rail terminal with Canadian and US SPLC codes. Map what each partner sends rather than assuming one scheme.

### N1 and N9: Parties and References

```
N1*MC*HARBORLINE DRAYAGE INC*2*HLDY~
N9*BM*BLUQSHA2611045~
N9*BN*BK7730412~
```

`N101` = `MC` names a motor carrier, here the drayage company that pulled the container on the out-gate, with its SCAC in `N104` (qualifier `2` in `N103`). The `N9` references tie the event to the shipment: `BM` bill of lading, `BN` booking, and on rail moves `WY` waybill number and `P8` pick-up number, as the CN guides show. The bill of lading number is the key you will use to join 322 events to the [310](/guides/edi/310-freight-receipt-and-invoice-ocean) and the [315](/guides/edi/315-status-details-ocean) feed.

## EDI 322 vs 315, 214 and 313

| Document | Mode | Sent by | Purpose |
|---|---|---|---|
| **322 Terminal Operations and Intermodal Ramp Activity** | Terminal and rail | Terminal operator, port operator or railroad | Equipment events at terminals and ramps |
| **[315 Status Details (Ocean)](/guides/edi/315-status-details-ocean)** | Ocean | Ocean carrier | Container events to customers, coded in `B4` |
| **[214 Shipment Status Message](/guides/edi/214-transportation-carrier-shipment-status)** | Truck and other modes | Carrier | Shipment events, coded in `AT7` |
| **313 Shipment Status Inquiry (Ocean)** | Ocean | Shipper, consignee or forwarder | Asks a carrier for status |

All three status messages share the shipment status code list, so a `UV` or `OA` means the same thing whichever set it arrives in. The difference is the source and the shape. The 315 is the ocean carrier's account to its customer, one container per message in most guides. The 322 is the facility's account, often many containers per message, and focused on equipment rather than the shipment. The 214 is the truck carrier's account of the drayage leg that follows the out-gate, often tendered with a [204](/guides/edi/204-motor-carrier-load-tender) and billed with a [210](/guides/edi/210-motor-carrier-freight-invoice). Join all three on the container number and you have one timeline.

## Common 322 Errors and How to Prevent Them

| Error | What happens | Prevention |
|---|---|---|
| **Time zone ignored** | Events appear hours early or late against vessel and truck schedules | Read `Q504` and convert before storing |
| **Only the first `N7` read** | Most containers in a multi-equipment 322 are missed | Loop over every `N7` and apply the `Q5` event to each |
| **Container number formats differ** | Events do not match the container on file | Normalize prefix, serial and check digit, and validate the check digit |
| **Location scheme assumed** | Rail ramp SPLC codes read as UN/LOCODEs, or the reverse | Read `R402` and keep a location table per partner |
| **Corrections applied as new events** | A wrong event stays in the history next to the right one | Handle `ZC1` corrections as the partner's guide describes |
| **Unknown codes dropped** | Bad orders, holds and free time events go unseen | Store any unmapped `Q501` code and alert on it |
| **322 and 315 events double-counted** | The same out-gate appears twice | Deduplicate on container, status code and event time |

## 322 Implementation Checklist

Before your first live 322 feed from a terminal, port operator or railroad:

- Get the partner's 322 implementation guide and confirm the X12 version in `GS08` (004010 is common) and the `SO` functional group
- Get its list of `Q501` status codes and add any partner-specific ones to your mapping
- Confirm whether times are local or universal, and how `Q504` is used
- Confirm how many `N7` loops a transaction can carry and whether events for one container can arrive in different transactions
- Agree the location scheme in `R4` (UN/LOCODE, SPLC or the partner's own codes)
- Confirm which references come in `N9`, and map the bill of lading and booking numbers to your shipments
- Decide how 322 events and 315 events for the same container are merged
- Confirm the 997 or 824 you will send back
- Test a single event, a multi-container event, a correction and a rail ramp sequence if the move goes inland by rail

If you are mapping ocean and rail EDI for the first time, our [EDI document types reference](/edi-document-types) shows where these sets sit beside the [850 purchase order](/guides/edi/850-purchase-order) and the [856 ASN](/guides/edi/856-ship-notice). The [SCAC code glossary entry](/glossary/scac-code) explains the carrier codes the 322 uses for equipment owners and truckers.

## Where OrderSync Fits

A terminal event tells you where the container is. To act on it, you need to know which purchase orders are inside and who is waiting for them, and that record starts with orders that often arrive as EDI 850s, PDFs, emails and spreadsheets.

OrderSync reads inbound orders in any format, matches customers, items and units to your catalog, and outputs clean ERP data or valid X12. Paste any 322 into the [free EDI inspector](/edi-inspector) to see it parsed segment by segment with a plain-English summary and any structural errors explained, or [book a 15-minute walkthrough](/book-call) to see your own orders processed.

## Frequently Asked Questions

<div className="not-prose">

### What is an EDI 322?

The EDI 322 Terminal Operations and Intermodal Ramp Activity is the X12 transaction used to report equipment events at marine terminals and intermodal rail ramps, such as unloaded from vessel, in-gate, out-gate, loaded on rail and unloaded from rail. Each message carries a Q5 status with date and time and an N7 loop for each piece of equipment.

### Who sends the EDI 322?

The party that operates the facility or the move: a marine terminal operator, a port operator loading containers onto rail, or a railroad reporting ramp events. It goes to the ocean carrier, the railroad or a customer that subscribed to the feed.

### What is the difference between EDI 322 and EDI 315?

The 315 is the ocean carrier's status message to its customers, with the event in the B4 segment. The 322 is the terminal's or railroad's report of equipment activity, with the event in Q5 and one N7 loop per container. Terminal 322 events often feed the carrier's 315s.

### Where is the status code in a 322?

In Q501, the first element of the Q5 Status Details segment. It uses X12 element 157, the same shipment status code list as the 315 and the 214, so codes like UV, I, OA, AL and UR mean the same thing in each.

### Can one 322 cover more than one container?

Yes. The Q5 event sits at the top of the transaction and the N7 loop can repeat up to 1000 times in release 004010, so one 322 can report the same event, such as a vessel discharge, for many containers.

### What functional group and version does the 322 use?

The 322 travels in functional group SO, the value in GS01, shared with the 304. Many partner guides use X12 release 004010, and the version is named in GS08.

### Do I need the 322 if I already get 315s?

Importers and shippers usually get what they need from the carrier's 315s. The 322 matters most to ocean carriers, railroads, terminals and companies with direct rail or terminal feeds. If you receive both, merge them on container number, status and time so events are not counted twice.

</div>
