👨💻 Technical ACs (Gherkin)
Context: The system is ready to process train manifest requests
GIVEN
The system is ready to process train manifest requests
Applied to: 1:Input Message Retrieval
WHEN
The system attempts to retrieve the next input message from the queue
THEN
If a message is available, processing continues; if no message is available, processing terminates
Context: A user submits a train manifest request with a specific SCAC code
GIVEN
A user submits a train manifest request with a specific SCAC code
Applied to: 2:SCAC Access Validation
WHEN
The system validates SCAC access permissions for the user
THEN
If SCAC access is invalid AND the request is not an AEI train send, the system generates error 36 and rolls back the transaction
Context: An input message is received for train manifest processing
GIVEN
An input message is received for train manifest processing
Applied to: 3:Request Type Validation
WHEN
The system examines the request type flags
THEN
The request must be classified as ADD, VERIFY, or NOTIFY; if none of these flags are set, the input is marked as invalid
Context: The system needs to validate estimated time of arrival dates
GIVEN
The system needs to validate estimated time of arrival dates
Applied to: 4:Date and Time Processing
WHEN
Date range calculations are performed
THEN
The system calculates N30 (minus 30 days), P05 (plus 5 days), N02 (minus 2 days), and P02 (plus 2 days) from current date for validation boundaries
Context: A user submits a train manifest with an estimated time of arrival
GIVEN
A user submits a train manifest with an estimated time of arrival
Applied to: 5:ETA Date Range Validation
WHEN
The system validates the ETA date against user-specific date ranges
THEN
For 'S' type users, ETA must be between N30 and P05 dates (error 25 if violated); for other users, ETA must be between N02 and P02 dates (error 35 if violated)
Context: A train manifest request requires Merlin communication capabilities
GIVEN
A train manifest request requires Merlin communication capabilities
Applied to: 6:Merlin ID Management
WHEN
The system validates Merlin ID configurations
THEN
Public, Supervisor, Customs, DC-P, and System FAX Merlin IDs must all exist in EMTZ table; missing IDs generate specific errors (4-8, 29)
Context: Train identification components are provided in the input
GIVEN
Train identification components are provided in the input
Applied to: 7:Train ID Construction
WHEN
The system constructs the customs train ID
THEN
Spaces in train number, day, from/to stations, and consist number are replaced with zeros to create a standardized format
Context: Train manifest contains origin and destination station codes
GIVEN
Train manifest contains origin and destination station codes
Applied to: 8:Station Information Validation
WHEN
The system validates station information
THEN
Station codes must exist in the station master data and associated station names and routing information must be retrievable
Context: A train manifest operation requires database record management
GIVEN
A train manifest operation requires database record management
Applied to: 9:Train Record Management
WHEN
The system performs train record operations
THEN
For ADD operations, existing train records are deleted and new records are inserted with SENT status; for other operations, records are retrieved for validation
Context: A train manifest contains a list of equipment
GIVEN
A train manifest contains a list of equipment
Applied to: 10:Equipment Data Extraction
WHEN
The system validates the equipment list
THEN
The equipment list must contain at least one entry (error 34 if none) and no more than 500 entries (error 28 if exceeded)
Context: Equipment requires waybill information for processing
GIVEN
Equipment requires waybill information for processing
Applied to: 11:Waybill Lookup Processing
WHEN
The system searches for waybill data
THEN
Primary lookup uses FWCARGET for latest waybill by car ID; if not found, secondary lookup uses FWCIIO for car inquiry; if still not found, tertiary lookup uses FWIQIO for waybill inquiry
Context: Primary waybill lookup has failed for equipment
GIVEN
Primary waybill lookup has failed for equipment
Applied to: 43:Waybill Inquiry Database Processing
WHEN
The system performs inquiry database processing
THEN
The system searches FWINQ inquiry records and processes waybill sequences to extract equipment and shipment information
Context: Equipment information is available for classification
GIVEN
Equipment information is available for classification
Applied to: 12:Equipment Type Classification
WHEN
The system determines equipment type
THEN
Equipment is classified as Unit (L,P,D,U), Van (V), SBU, ETU (E), or regular car based on equipment type codes
Context: Equipment has a designated load/empty status
GIVEN
Equipment has a designated load/empty status
Applied to: 13:Load/Empty Status Processing
WHEN
The system validates waybill requirements
THEN
Empty cars (LE = 'E') are allowed without waybill for ADD operations; loaded cars without waybill generate error 21 for ADD operations or report 'LOADED CAR - NO WAYBILL' for VERIFY operations
Context: Equipment requires CCN validation for customs processing
GIVEN
Equipment requires CCN validation for customs processing
Applied to: 15:CCN Database Lookup
WHEN
The system performs CCN database lookup
THEN
The system searches GCCCRT database using equipment ID and waybill information to retrieve existing CCN records and status
Context: A CCN record exists for equipment
GIVEN
A CCN record exists for equipment
Applied to: 16:CCN Status Validation
WHEN
The system validates CCN status
THEN
CCN status must be 'SENT', 'RETURN', 'MANUAL', 'RELEASE', 'ACK', or 'CSA-DLV'; invalid status generates error 24 for ADD operations or reports current status for VERIFY operations
Context: A CCN is being assigned to a train
GIVEN
A CCN is being assigned to a train
Applied to: 17:Train Assignment Validation
WHEN
The system checks for existing train assignments
THEN
If the CCN is already assigned to a different train, error 13 is generated to prevent duplicate assignments
Context: A flat car is carrying containers and waybill information is available
GIVEN
A flat car is carrying containers and waybill information is available
Applied to: 19:Container Processing
WHEN
The system processes container information
THEN
Container IDs are extracted from waybill cross-reference data and formatted using GCCCARFM utility for 12-character format
Context: Equipment is classified as empty or exempted from CCN requirements
GIVEN
Equipment is classified as empty or exempted from CCN requirements
Applied to: 20:Empty/Exempted Equipment Processing
WHEN
The system processes the equipment
THEN
Empty cars and exempted equipment types bypass CCN validation requirements and are processed with appropriate status indicators
Context: Equipment has been processed and status determined
GIVEN
Equipment has been processed and status determined
Applied to: 21:Equipment Status Totals Compilation
WHEN
The system compiles status totals
THEN
TOTAL-RELEASE counts equipment with 'RELEASE' or 'CSA-DLV' status; TOTAL-HAULAGE counts equipment with haulage rights; TOTAL-PROCEED counts equipment in transit between different stations; TOTAL-HELD-CCRA counts equipment with 'HOLD' or 'AGI-HOLD' status; TOTAL-HELD-DOCS counts equipment at same station with no broker entry
Context: Train manifest data has been validated and processed
GIVEN
Train manifest data has been validated and processed
Applied to: 22:EDI Transmission Processing
WHEN
The system transmits EDI transactions
THEN
EDI transactions are sent to appropriate trading partners and customs authorities with train and equipment information
Context: An AEI train send operation is performed
GIVEN
An AEI train send operation is performed
Applied to: 23:AEI Logging
WHEN
The system logs AEI activity
THEN
AEI send activity is logged regardless of processing errors for audit trail and tracking purposes
Context: Train manifest processing has completed
GIVEN
Train manifest processing has completed
Applied to: 24:Confirmation Message Generation
WHEN
The system generates confirmation messages
THEN
Successful operations generate confirmation messages to originating terminals; failed operations generate error notifications with appropriate error codes
Context: ADD operation completed successfully without errors
GIVEN
ADD operation completed successfully without errors
Applied to: 25:Canada Customs Trip Sheet Generation
WHEN
The system generates Canada customs trip sheets
THEN
Trip sheets include equipment details, waybill information, shipper/consignee data, and are sent to appropriate Canadian customs terminals
Context: VERIFY operation is requested for train manifest
GIVEN
VERIFY operation is requested for train manifest
Applied to: 26:Status Report Generation
WHEN
The system generates status reports
THEN
Status report includes equipment totals by category, detailed status information, transit status indicators, and up to 90 lines of US status messages
Context: Validation errors are detected during processing
GIVEN
Validation errors are detected during processing
Applied to: 27:Error Message Processing
WHEN
The system processes error messages
THEN
Error messages are formatted with appropriate error codes and descriptions, then distributed to supervisors and originating terminals for resolution
Context: Reports or notifications need to be distributed electronically
GIVEN
Reports or notifications need to be distributed electronically
Applied to: 28:Email/FAX Distribution
WHEN
The system processes email and FAX distribution
THEN
Email messages are limited to 699 lines per message; larger reports create continuation messages with 'CONTINUATION OF REPORT...' header; failed emails are sent to support team (OM01247, AEI9999)
Context: US-bound cargo requires trip sheet documentation
GIVEN
US-bound cargo requires trip sheet documentation
Applied to: 29:US Trip Sheet Generation
WHEN
The system generates US trip sheets
THEN
Trip sheets include equipment type descriptions, status mappings (RELEASE with export transit becomes 'EXPORT', transit status 'T' becomes 'TRANSIT', return status 'R' becomes 'RETURN'), and are distributed to US Merlin users
Context: Train manifest contains cargo with destination information
GIVEN
Train manifest contains cargo with destination information
Applied to: 30:Cargo Arrival Detection
WHEN
The system detects cargo arrivals
THEN
Cargo is identified as arriving when manifest destination codes match station codes; only non-ocean manifest cargo is processed for arrival notifications
Context: Arriving cargo has been detected at destination stations
GIVEN
Arriving cargo has been detected at destination stations
Applied to: 31:Cargo Arrival Notification
WHEN
The system processes arrival notifications
THEN
Arrival notices are created and sent to customs processing systems via GCT1481E transactions for appropriate handling
Context: Cargo requires return processing with new CCN creation
GIVEN
Cargo requires return processing with new CCN creation
Applied to: 32:Return CCN Creation
WHEN
The system creates return CCN records
THEN
New CCN records are created with 'RETURN' status, CCN key format includes type(6) + carrier(105) + E + equipment_id + waybill_date + sequence, and audit trail entries are created via GCX105 spawning
Context: CCN keys starting with '6105' (excluding 'I' type) require broker notification
GIVEN
CCN keys starting with '6105' (excluding 'I' type) require broker notification
Applied to: 33:Broker Notification Processing
WHEN
The system processes broker notifications
THEN
Notifications are sent to brokers only if current status is not 'RETURN' or 'MANUAL'; multiple notification methods are supported (X12, Merlin, Internet, FAX, Paper) with primary and secondary broker handling
Context: Equipment has US customs records requiring status processing
GIVEN
Equipment has US customs records requiring status processing
Applied to: 34:US Customs Status Processing
WHEN
The system processes US customs status
THEN
Bond types (IT, TR, MT, TE) are validated; warnings are generated for IT bond types, train vessel mismatches, in-transit location mismatches, and TIB date issues; arrival keys are tracked for specific bond types during ADD operations
Context: Canadian border processing requires special manifest creation
GIVEN
Canadian border processing requires special manifest creation
Applied to: 35:Special Manifest Processing
WHEN
The system processes special manifests
THEN
Special manifest records are created with record type 'CA' (Canadian), border code and station name from train data, and CCN keys are stored for processing
Context: A CCN exists for equipment validation
GIVEN
A CCN exists for equipment validation
Applied to: 36:CCN Usability Validation
WHEN
The system validates CCN usability
THEN
CCN is usable if equipment ID matches saved equipment ID AND (waybill number matches OR new bond created flag = 'Y'); if CCN exists with same equipment but different waybill and no new bond created, it's marked unusable; for VERIFY operations, 'CCN FOUND NOT USABLE' status message is added