Bits In Glass
BIG Pega COE Team

Detailed Acceptance Criteria (ACs)

Category: GCX016ER

This report presents the exact business rules dynamically extracted from the legacy system. Rules are formatted in an Agile/BDD Given/When/Then structure, offering a bridge between business requirements and technical implementation constraints. Component rules have been logically grouped into feature sets.

🎯 GCX016ER Scope Detected: Extracted 3573 rules, Optimally Merged into 244 Feature Scenarios.
R-GCX016E-cbl-00001 (+58) File: GCX016E.cbl Overview Rules Merged 59 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Overview Rules':
  • Context - the system needs to process messages from gc350.exp.input queue:
    For 1:MQ Message Retrieval:
    When message retrieval is initiated, then messages are retrieved from queue and completion codes are evaluated to determine message availability status.
  • Context - messages have been retrieved from the queue with completion codes:
    For Messages Available?:
    When completion code is not ok and reason code is 2033, then set message not available flag.
  • Context - message completion is ok:
    For Messages Available?:
    When backout count is not zero, then skip message and set skip message flag.
    For Messages Available?:
    When backout count is zero, then set good message found flag for processing.
  • Context - valid messages are available for processing:
    For 91:Message Array Initialization:
    When message id is gcw016, then process messages directly varying ws-line from 1 until max entries or end found.
  • Context - message array has been initialized:
    For Message Type?:
    When message contains train-related segments (m10 with vessel/train info), then route to train processing path.
    For Message Type?:
    When message contains cargo-related segments (x4, n7), then route to cargo processing path.
  • Context - m10 segment contains vessel name information:
    For 2:Train Identification and Validation:
    When vessel name starts with 'train' or 'day', then continue processing without additional validation.
  • Context - vessel name does not start with 'train' or 'day':
    For 2:Train Identification and Validation:
    When train lookup is performed against train list, then if train not found, generate error message to merlin system.
  • Context - v9 segment contains event code hmi:
    For 3:Train Hold Processing - HMI:
    When train hold event is processed, then set train held status and log hold message to merlin system.
  • Context - v9 segment contains event code hre:
    For 4:Train Hold Release Processing - HRE:
    When train hold release event is processed, then remove train hold status and log release message to merlin system.
  • Context - v9 segment contains event code pod or aad:
    For 5:Train Arrival Processing - POD/AAD:
    When train arrival event is processed, then process train arrival and update arrival status in system.
  • Context - v9 segment contains event code rc:
    For 6:Train Review Complete Processing - RC:
    When review complete event is processed, then set review completed status for the train.
  • Context - v9 segment contains event code oca:
    For 7:Train Not Arrived Processing - OCA:
    When train not arrived event is processed, then handle arrival cancellation for the train.
  • Context - v9 segment contains event code coc:
    For 8:Train Arrival Cancellation - COC:
    When train arrival cancellation is processed, then process arrival cancellation with different logic based on current arrival status.
  • Context - v9 segment contains event code lck:
    For 9:Train Lock Processing - LCK:
    When train lock event is processed, then set train locked status.
  • Context - v9 segment contains event code ulc:
    For 10:Train Unlock Processing - ULC:
    When train unlock event is processed and train is currently locked, then remove train lock status.
  • Context - v9 segment contains event code sei:
    For 11:Train Seizure Processing - SEI:
    When train seizure event is processed, then set train seized status.
  • Context - v9 segment contains event code ser:
    For 12:Train Seizure Release Processing - SER:
    When train seizure release event is processed, then remove train seize status.
  • Context - v9 segment contains event code cae:
    For 13:Train All Clear Processing - CAE:
    When train all clear event is processed, then set all clear status for the train.
  • Context - event code is hmi or sei:
    For 105:Equipment Hold Processing by VID Segment:
    When vid segments are present for equipment-specific processing, then process associated vid segments for equipment-specific holds.
  • Context - event code is hre or ser:
    For 106:Equipment Release Processing by VID Segment:
    When vid segments are present for equipment-specific processing, then process associated vid segments for equipment-specific releases.
  • Context - x4 segment contains disposition code and processing parameters:
    For Cargo Lookup Method?:
    When processing type is by bond number, then route to bond-based cargo processing.
    For Cargo Lookup Method?:
    When processing type is by car id and waybill, then route to car/waybill-based cargo processing.
  • Context - disposition code requires bond-based processing:
    For 21:Cargo Processing by Bond:
    When bond number is identified from x4 segment, then process all cargos with matching bond number.
  • Context - disposition code requires car/waybill-based processing:
    For 22:Cargo Processing by Car/Waybill:
    When car id and waybill are identified from segments, then process all cargos with matching car id and waybill.
  • Context - disposition code requires individual cargo processing:
    For 23:Individual Cargo Processing:
    When single cargo is identified from segments, then process individual us cargo with disposition code.
  • Context - cargo requires status segment processing:
    For 42:S09 Status Segment Processing:
    When s09 segments are fetched for cargo, then create or replace s09 segments for cargo records and manage status arrays with sequence numbers.
  • Context - cargo is not cprs shipment:
    For 42:S09 Status Segment Processing:
    When n7 segment data contains car information, then update car id from n7 segment data.
  • Context - cargo is cprs shipment:
    For 42:S09 Status Segment Processing:
    When car id processing is performed, then clear car id information.
    For 50:CPRS Bond Processing:
    When bond processing is required, then apply cprs-specific bond processing rules.
  • Context - disposition code needs validation:
    For 43:Disposition Code Table Lookup:
    When dc table lookup is performed, then retrieve disposition code details from dc table.
  • Context - status array contains existing disposition codes:
    For 44:Duplicate Disposition Code Detection:
    When new disposition code is being added, then search existing status array for matching disposition codes and check entry numbers and quantities for exact matches.
  • Context - new disposition code has counterpart logic defined:
    For 45:Counterpart Disposition Code Removal:
    When counterpart disposition codes exist in status array, then remove counterpart disposition codes from status array.
  • Context - disposition code is 95:
    For 24:Disposition Code 95 Processing:
    When entry numbers match existing bond information, then clear bond information from cargo record.
  • Context - disposition code requires in-bond processing:
    For 25:In-Bond Broker Processing:
    When entry number and broker information are provided, then update broker entry numbers with validation and set in-bond information for entry types 61, 62, 63, 69.
  • Context - disposition code is snp:
    For 26:SNP Processing:
    When snp processing is initiated, then process snp disposition with specific business logic.
  • Context - status array has been updated with disposition codes:
    For 57:Status Array Verification:
    When status array verification is performed, then verify status array integrity and sequence numbers.
  • Context - status array contains multiple disposition codes:
    For 58:Individual Status Analysis:
    When individual status analysis is performed, then analyze each status code for hold, release, ptt, and other status flags.
  • Context - all disposition codes have been processed and analyzed:
    For 59:Complex Cargo Status Evaluation:
    When final status determination is required, then apply status hierarchy: manual release → released, fda hold → holdfda, ptt with quantity check → ptt, hold combinations → various hold statuses, release with quantity validation → relsd or holdpcs, export/arrival → export/arrival, default → ack or proceed.
  • Context - multiple cargos exist with same car id and waybill:
    For 65:Multi-Cargo Processing by Car/Waybill:
    When multi-cargo processing is initiated, then process all related cargos and verify release status for each ccn.
  • Context - cargo status is set to export:
    For 68:Export Notification Processing:
    When export processing is performed, then set export status, clear destination index, and generate appropriate notifications.
  • Context - cargo status is set to arrival:
    For 69:Arrival Notification Processing:
    When arrival processing is performed, then update arrival flags and dates based on location.
  • Context - cargo lookup returns no existing cargo:
    For 70:New Cargo Record Creation:
    When new cargo creation is required, then create new cargo record with cprs vs regular shipment handling and automatically spawn gct0162e for new cargos.
  • Context - cargo is identified as foreign shipment:
    For 175:New Foreign Cargo Record Creation:
    When foreign cargo creation is required, then create foreign cargo record with appropriate international processing flags.
  • Context - m10 segments contain foreign manifest information:
    For 176:Foreign Manifest Building from M10 Segments:
    When foreign manifest building is initiated, then build foreign manifest structure from m10 segment data.
  • Context - table operations are required for various business processes:
    For 76:Generic Table I/O Interface:
    When generic table interface is called, then perform table read/write operations with appropriate error handling.
  • Context - cargo processing requires merlin notification:
    For 77:Comprehensive Merlin Message Formatting:
    When merlin message formatting is initiated, then include disposition code messages unless manual/auto release, add car id, waybill, us ccn, date/time, special comments up to 3 lines, k1 comments up to 4 lines, and quantity impact information.
  • Context - k1 segment contains cp rail identifiers:
    For 77:Comprehensive Merlin Message Formatting:
    When k1 segment contains 'director of customs, cp rail' or 'canadian pacific limited' or 'canadian pacific railway co', then create broker bond creation message for cp rail.
  • Context - cargo status has been determined and requires external integration:
    For 80:Cargo Status Integration:
    When integration is initiated and equipment type is valid (containers, trailers, chassis, etc.) and status is not ptt/ptt-ex for held/partial held cargos, then map cargo status to integration system status descriptions and process only hold, ptt, ptt-ex, or release statuses.
  • Context - process type is 4e and cargo status is release:
    For 80:Cargo Status Integration:
    When release status verification is performed, then verify full release before setting 'release' status in integration system.
  • Context - disposition code is freight forwarder type:
    For 85:CIH Hold Email Notification:
    When email notification is required and freight forwarder has internet capability, then route email to freight forwarder email address, otherwise route to default merlin id.
  • Context - email notification fails to primary recipients:
    For 85:CIH Hold Email Notification:
    When email failure is detected, then resend email to backup recipients (aei9999, om01247).
  • Context - merlin message is ready for distribution:
    For 88:Merlin Message Distribution:
    When message type is error message, then route to 'in' destination.
  • Context - merlin message is informational type:
    For 88:Merlin Message Distribution:
    When info message routing is performed, then route to 'in' plus sd segment merlin ids.
  • Context - merlin message is release type:
    For 88:Merlin Message Distribution:
    When release message routing is performed, then route to sd segment merlin ids only.
  • Context - merlin message is unrelease type:
    For 88:Merlin Message Distribution:
    When unrelease message routing is performed, then route to om01247 plus sd cancel merlin ids.
  • Context - merlin message is export type:
    For 88:Merlin Message Distribution:
    When export message routing is performed, then route based on equipment type classification.
  • Context - primary merlin id is invalid:
    For 88:Merlin Message Distribution:
    When merlin id validation fails, then reroute to om01247 with error notification.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process messages from GC350.EXP.INPUT queue
GIVEN
The system needs to process messages from GC350.EXP.INPUT queue
Applied to: 1:MQ Message Retrieval
WHEN
Message retrieval is initiated
THEN
Messages are retrieved from queue and completion codes are evaluated to determine message availability status
Context: Messages have been retrieved from the queue with completion codes
GIVEN
Messages have been retrieved from the queue with completion codes
Applied to: Messages Available?
WHEN
Completion code is not OK and reason code is 2033
THEN
Set message not available flag
Context: Message completion is OK
GIVEN
Message completion is OK
Applied to: Messages Available?
WHEN
Backout count is not zero
THEN
Skip message and set skip message flag
Applied to: Messages Available?
WHEN
Backout count is zero
THEN
Set good message found flag for processing
Context: Valid messages are available for processing
GIVEN
Valid messages are available for processing
Applied to: 91:Message Array Initialization
WHEN
Message ID is GCW016
THEN
Process messages directly varying WS-LINE from 1 until max entries or end found
Context: Message array has been initialized
GIVEN
Message array has been initialized
Applied to: Message Type?
WHEN
Message contains train-related segments (M10 with vessel/train info)
THEN
Route to train processing path
Applied to: Message Type?
WHEN
Message contains cargo-related segments (X4, N7)
THEN
Route to cargo processing path
Context: M10 segment contains vessel name information
GIVEN
M10 segment contains vessel name information
Applied to: 2:Train Identification and Validation
WHEN
Vessel name starts with 'TRAIN' or 'DAY'
THEN
Continue processing without additional validation
Context: Vessel name does not start with 'TRAIN' or 'DAY'
GIVEN
Vessel name does not start with 'TRAIN' or 'DAY'
Applied to: 2:Train Identification and Validation
WHEN
Train lookup is performed against train list
THEN
If train not found, generate error message to Merlin system
Context: V9 segment contains event code HMI
GIVEN
V9 segment contains event code HMI
Applied to: 3:Train Hold Processing - HMI
WHEN
Train hold event is processed
THEN
Set train held status and log hold message to Merlin system
Context: V9 segment contains event code HRE
GIVEN
V9 segment contains event code HRE
Applied to: 4:Train Hold Release Processing - HRE
WHEN
Train hold release event is processed
THEN
Remove train hold status and log release message to Merlin system
Context: V9 segment contains event code POD or AAD
GIVEN
V9 segment contains event code POD or AAD
Applied to: 5:Train Arrival Processing - POD/AAD
WHEN
Train arrival event is processed
THEN
Process train arrival and update arrival status in system
Context: V9 segment contains event code RC
GIVEN
V9 segment contains event code RC
Applied to: 6:Train Review Complete Processing - RC
WHEN
Review complete event is processed
THEN
Set review completed status for the train
Context: V9 segment contains event code OCA
GIVEN
V9 segment contains event code OCA
Applied to: 7:Train Not Arrived Processing - OCA
WHEN
Train not arrived event is processed
THEN
Handle arrival cancellation for the train
Context: V9 segment contains event code COC
GIVEN
V9 segment contains event code COC
Applied to: 8:Train Arrival Cancellation - COC
WHEN
Train arrival cancellation is processed
THEN
Process arrival cancellation with different logic based on current arrival status
Context: V9 segment contains event code LCK
GIVEN
V9 segment contains event code LCK
Applied to: 9:Train Lock Processing - LCK
WHEN
Train lock event is processed
THEN
Set train locked status
Context: V9 segment contains event code ULC
GIVEN
V9 segment contains event code ULC
Applied to: 10:Train Unlock Processing - ULC
WHEN
Train unlock event is processed and train is currently locked
THEN
Remove train lock status
Context: V9 segment contains event code SEI
GIVEN
V9 segment contains event code SEI
Applied to: 11:Train Seizure Processing - SEI
WHEN
Train seizure event is processed
THEN
Set train seized status
Context: V9 segment contains event code SER
GIVEN
V9 segment contains event code SER
Applied to: 12:Train Seizure Release Processing - SER
WHEN
Train seizure release event is processed
THEN
Remove train seize status
Context: V9 segment contains event code CAE
GIVEN
V9 segment contains event code CAE
Applied to: 13:Train All Clear Processing - CAE
WHEN
Train all clear event is processed
THEN
Set all clear status for the train
Context: Event code is HMI or SEI
GIVEN
Event code is HMI or SEI
Applied to: 105:Equipment Hold Processing by VID Segment
WHEN
VID segments are present for equipment-specific processing
THEN
Process associated VID segments for equipment-specific holds
Context: Event code is HRE or SER
GIVEN
Event code is HRE or SER
Applied to: 106:Equipment Release Processing by VID Segment
WHEN
VID segments are present for equipment-specific processing
THEN
Process associated VID segments for equipment-specific releases
Context: X4 segment contains disposition code and processing parameters
GIVEN
X4 segment contains disposition code and processing parameters
Applied to: Cargo Lookup Method?
WHEN
Processing type is by bond number
THEN
Route to bond-based cargo processing
Applied to: Cargo Lookup Method?
WHEN
Processing type is by car ID and waybill
THEN
Route to car/waybill-based cargo processing
Context: Disposition code requires bond-based processing
GIVEN
Disposition code requires bond-based processing
Applied to: 21:Cargo Processing by Bond
WHEN
Bond number is identified from X4 segment
THEN
Process all cargos with matching bond number
Context: Disposition code requires car/waybill-based processing
GIVEN
Disposition code requires car/waybill-based processing
Applied to: 22:Cargo Processing by Car/Waybill
WHEN
Car ID and waybill are identified from segments
THEN
Process all cargos with matching car ID and waybill
Context: Disposition code requires individual cargo processing
GIVEN
Disposition code requires individual cargo processing
Applied to: 23:Individual Cargo Processing
WHEN
Single cargo is identified from segments
THEN
Process individual US cargo with disposition code
Context: Cargo requires status segment processing
GIVEN
Cargo requires status segment processing
Applied to: 42:S09 Status Segment Processing
WHEN
S09 segments are fetched for cargo
THEN
Create or replace S09 segments for cargo records and manage status arrays with sequence numbers
Context: Cargo is not CPRS shipment
GIVEN
Cargo is not CPRS shipment
Applied to: 42:S09 Status Segment Processing
WHEN
N7 segment data contains car information
THEN
Update car ID from N7 segment data
Context: Cargo is CPRS shipment
GIVEN
Cargo is CPRS shipment
Applied to: 42:S09 Status Segment Processing
WHEN
Car ID processing is performed
THEN
Clear car ID information
Applied to: 50:CPRS Bond Processing
WHEN
Bond processing is required
THEN
Apply CPRS-specific bond processing rules
Context: Disposition code needs validation
GIVEN
Disposition code needs validation
Applied to: 43:Disposition Code Table Lookup
WHEN
DC table lookup is performed
THEN
Retrieve disposition code details from DC table
Context: Status array contains existing disposition codes
GIVEN
Status array contains existing disposition codes
Applied to: 44:Duplicate Disposition Code Detection
WHEN
New disposition code is being added
THEN
Search existing status array for matching disposition codes and check entry numbers and quantities for exact matches
Context: New disposition code has counterpart logic defined
GIVEN
New disposition code has counterpart logic defined
Applied to: 45:Counterpart Disposition Code Removal
WHEN
Counterpart disposition codes exist in status array
THEN
Remove counterpart disposition codes from status array
Context: Disposition code is 95
GIVEN
Disposition code is 95
Applied to: 24:Disposition Code 95 Processing
WHEN
Entry numbers match existing bond information
THEN
Clear bond information from cargo record
Context: Disposition code requires in-bond processing
GIVEN
Disposition code requires in-bond processing
Applied to: 25:In-Bond Broker Processing
WHEN
Entry number and broker information are provided
THEN
Update broker entry numbers with validation and set in-bond information for entry types 61, 62, 63, 69
Context: Disposition code is SNP
GIVEN
Disposition code is SNP
Applied to: 26:SNP Processing
WHEN
SNP processing is initiated
THEN
Process SNP disposition with specific business logic
Context: Status array has been updated with disposition codes
GIVEN
Status array has been updated with disposition codes
Applied to: 57:Status Array Verification
WHEN
Status array verification is performed
THEN
Verify status array integrity and sequence numbers
Context: Status array contains multiple disposition codes
GIVEN
Status array contains multiple disposition codes
Applied to: 58:Individual Status Analysis
WHEN
Individual status analysis is performed
THEN
Analyze each status code for hold, release, PTT, and other status flags
Context: All disposition codes have been processed and analyzed
GIVEN
All disposition codes have been processed and analyzed
Applied to: 59:Complex Cargo Status Evaluation
WHEN
Final status determination is required
THEN
Apply status hierarchy: Manual Release → Released, FDA Hold → HOLDFDA, PTT with quantity check → PTT, Hold combinations → Various hold statuses, Release with quantity validation → RELSD or HOLDPCS, Export/Arrival → EXPORT/ARRIVAL, Default → ACK or PROCEED
Context: Multiple cargos exist with same car ID and waybill
GIVEN
Multiple cargos exist with same car ID and waybill
Applied to: 65:Multi-Cargo Processing by Car/Waybill
WHEN
Multi-cargo processing is initiated
THEN
Process all related cargos and verify release status for each CCN
Context: Cargo status is set to export
GIVEN
Cargo status is set to export
Applied to: 68:Export Notification Processing
WHEN
Export processing is performed
THEN
Set export status, clear destination index, and generate appropriate notifications
Context: Cargo status is set to arrival
GIVEN
Cargo status is set to arrival
Applied to: 69:Arrival Notification Processing
WHEN
Arrival processing is performed
THEN
Update arrival flags and dates based on location
Context: Cargo lookup returns no existing cargo
GIVEN
Cargo lookup returns no existing cargo
Applied to: 70:New Cargo Record Creation
WHEN
New cargo creation is required
THEN
Create new cargo record with CPRS vs regular shipment handling and automatically spawn GCT0162E for new cargos
Context: Cargo is identified as foreign shipment
GIVEN
Cargo is identified as foreign shipment
Applied to: 175:New Foreign Cargo Record Creation
WHEN
Foreign cargo creation is required
THEN
Create foreign cargo record with appropriate international processing flags
Context: M10 segments contain foreign manifest information
GIVEN
M10 segments contain foreign manifest information
Applied to: 176:Foreign Manifest Building from M10 Segments
WHEN
Foreign manifest building is initiated
THEN
Build foreign manifest structure from M10 segment data
Context: Table operations are required for various business processes
GIVEN
Table operations are required for various business processes
Applied to: 76:Generic Table I/O Interface
WHEN
Generic table interface is called
THEN
Perform table read/write operations with appropriate error handling
Context: Cargo processing requires Merlin notification
GIVEN
Cargo processing requires Merlin notification
Applied to: 77:Comprehensive Merlin Message Formatting
WHEN
Merlin message formatting is initiated
THEN
Include disposition code messages unless manual/auto release, add car ID, waybill, US CCN, date/time, special comments up to 3 lines, K1 comments up to 4 lines, and quantity impact information
Context: K1 segment contains CP Rail identifiers
GIVEN
K1 segment contains CP Rail identifiers
Applied to: 77:Comprehensive Merlin Message Formatting
WHEN
K1 segment contains 'DIRECTOR OF CUSTOMS, CP RAIL' or 'CANADIAN PACIFIC LIMITED' or 'CANADIAN PACIFIC RAILWAY CO'
THEN
Create broker bond creation message for CP Rail
Context: Cargo status has been determined and requires external integration
GIVEN
Cargo status has been determined and requires external integration
Applied to: 80:Cargo Status Integration
WHEN
Integration is initiated and equipment type is valid (containers, trailers, chassis, etc.) and status is not PTT/PTT-EX for held/partial held cargos
THEN
Map cargo status to integration system status descriptions and process only HOLD, PTT, PTT-EX, or RELEASE statuses
Context: Process type is 4E and cargo status is release
GIVEN
Process type is 4E and cargo status is release
Applied to: 80:Cargo Status Integration
WHEN
Release status verification is performed
THEN
Verify full release before setting 'RELEASE' status in integration system
Context: Disposition code is freight forwarder type
GIVEN
Disposition code is freight forwarder type
Applied to: 85:CIH Hold Email Notification
WHEN
Email notification is required and freight forwarder has internet capability
THEN
Route email to freight forwarder email address, otherwise route to default Merlin ID
Context: Email notification fails to primary recipients
GIVEN
Email notification fails to primary recipients
Applied to: 85:CIH Hold Email Notification
WHEN
Email failure is detected
THEN
Resend email to backup recipients (AEI9999, OM01247)
Context: Merlin message is ready for distribution
GIVEN
Merlin message is ready for distribution
Applied to: 88:Merlin Message Distribution
WHEN
Message type is error message
THEN
Route to 'IN' destination
Context: Merlin message is informational type
GIVEN
Merlin message is informational type
Applied to: 88:Merlin Message Distribution
WHEN
Info message routing is performed
THEN
Route to 'IN' plus SD segment Merlin IDs
Context: Merlin message is release type
GIVEN
Merlin message is release type
Applied to: 88:Merlin Message Distribution
WHEN
Release message routing is performed
THEN
Route to SD segment Merlin IDs only
Context: Merlin message is unrelease type
GIVEN
Merlin message is unrelease type
Applied to: 88:Merlin Message Distribution
WHEN
Unrelease message routing is performed
THEN
Route to OM01247 plus SD cancel Merlin IDs
Context: Merlin message is export type
GIVEN
Merlin message is export type
Applied to: 88:Merlin Message Distribution
WHEN
Export message routing is performed
THEN
Route based on equipment type classification
Context: Primary Merlin ID is invalid
GIVEN
Primary Merlin ID is invalid
Applied to: 88:Merlin Message Distribution
WHEN
Merlin ID validation fails
THEN
Reroute to OM01247 with error notification
R-GCX016E-cbl-00060 (+10) File: GCX016E.cbl MQ Message Retrieval Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MQ Message Retrieval':
  • Context - a message is being processed for customs edi transactions:
    For Check Message Type for GCW016:
    When the message id is gcw016, then skip mq processing and use internal message structure directly.
  • Context - the system needs to retrieve customs messages from mq:
    For Establish MQ Connection:
    When mq connection is initiated, then connect to mq system and prepare for queue operations.
  • Context - mq connection is established:
    For Open GC350.EXP.INPUT Queue:
    When queue open operation is requested for gc350.exp.input, then open the queue for reading customs export messages.
  • Context - an attempt to open gc350.exp.input queue has been made:
    For Queue Open Successful?:
    When queue open operation completes, then if queue opens successfully, proceed to message loading; otherwise set message not available.
  • Context - the gc350.exp.input queue is open and accessible:
    For Execute MQGET to Retrieve Message:
    When mqget operation is executed, then retrieve the next available customs message from the queue.
  • Context - mqget operation has been executed on the customs queue:
    For Message Available?:
    When message completion code is evaluated, then if completion code is ok, message is available; if reason code 2033, no message available; otherwise message error occurred.
  • Context - a customs message is available from the queue:
    For Backout Count Valid?:
    When message backout count is checked, then if backout count is zero, message is good for processing; if backout count is not zero, skip the message.
  • Context - a customs message is available and has valid backout count:
    For Set Good Message Flag:
    When message validation is complete, then set good message flag to indicate message is ready for processing.
  • Context - a customs message is available but has invalid backout count:
    For Set Skip Message Flag:
    When message backout count validation fails, then set skip message flag to bypass processing of this message.
  • Context - mqget operation has been attempted on customs queue:
    For Set Message Not Available Flag:
    When no message is available or queue open failed or message error occurred, then set message not available flag to indicate no messages to process.
  • Context - a message processing result has been determined (good, skip, or not available):
    For Continue Loading?:
    When loading continuation is evaluated, then if more messages needed and conditions allow, continue loading; otherwise complete message loading process.
👨‍💻 Technical ACs (Gherkin)
Context: A message is being processed for customs EDI transactions
GIVEN
A message is being processed for customs EDI transactions
Applied to: Check Message Type for GCW016
WHEN
The message ID is GCW016
THEN
Skip MQ processing and use internal message structure directly
Context: The system needs to retrieve customs messages from MQ
GIVEN
The system needs to retrieve customs messages from MQ
Applied to: Establish MQ Connection
WHEN
MQ connection is initiated
THEN
Connect to MQ system and prepare for queue operations
Context: MQ connection is established
GIVEN
MQ connection is established
Applied to: Open GC350.EXP.INPUT Queue
WHEN
Queue open operation is requested for GC350.EXP.INPUT
THEN
Open the queue for reading customs export messages
Context: An attempt to open GC350.EXP.INPUT queue has been made
GIVEN
An attempt to open GC350.EXP.INPUT queue has been made
Applied to: Queue Open Successful?
WHEN
Queue open operation completes
THEN
If queue opens successfully, proceed to message loading; otherwise set message not available
Context: The GC350.EXP.INPUT queue is open and accessible
GIVEN
The GC350.EXP.INPUT queue is open and accessible
Applied to: Execute MQGET to Retrieve Message
WHEN
MQGET operation is executed
THEN
Retrieve the next available customs message from the queue
Context: MQGET operation has been executed on the customs queue
GIVEN
MQGET operation has been executed on the customs queue
Applied to: Message Available?
WHEN
Message completion code is evaluated
THEN
If completion code is OK, message is available; if reason code 2033, no message available; otherwise message error occurred
Context: A customs message is available from the queue
GIVEN
A customs message is available from the queue
Applied to: Backout Count Valid?
WHEN
Message backout count is checked
THEN
If backout count is zero, message is good for processing; if backout count is not zero, skip the message
Context: A customs message is available and has valid backout count
GIVEN
A customs message is available and has valid backout count
Applied to: Set Good Message Flag
WHEN
Message validation is complete
THEN
Set good message flag to indicate message is ready for processing
Context: A customs message is available but has invalid backout count
GIVEN
A customs message is available but has invalid backout count
Applied to: Set Skip Message Flag
WHEN
Message backout count validation fails
THEN
Set skip message flag to bypass processing of this message
Context: MQGET operation has been attempted on customs queue
GIVEN
MQGET operation has been attempted on customs queue
Applied to: Set Message Not Available Flag
WHEN
No message is available or queue open failed or message error occurred
THEN
Set message not available flag to indicate no messages to process
Context: A message processing result has been determined (good, skip, or not available)
GIVEN
A message processing result has been determined (good, skip, or not available)
Applied to: Continue Loading?
WHEN
Loading continuation is evaluated
THEN
If more messages needed and conditions allow, continue loading; otherwise complete message loading process
R-GCX016E-cbl-00071 (+5) File: GCX016E.cbl Train Identification and Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Identification and Validation':
  • Context - a vessel name is provided in the m10 segment:
    For Extract Train ID from Vessel Name:
    When the vessel name starts with 'train' or 'day', then the system continues with train processing without additional validation.
  • Context - a vessel name that does not start with 'train' or 'day':
    For Query GCWTL Train List Segments:
    When the system searches the train list using gccutrio, then if the train is found in gcwtl segments, processing continues; if not found, an error is generated.
  • Context - a train lookup has been performed:
    For Generate Train Not Found Error:
    When the train is not found in the gcwtl train list segments, then the system generates a train not found error message for merlin notification.
  • Context - a train has been successfully found in the system:
    For Apply CPRS Special Processing:
    When the train is identified as a cprs train, then the system applies cprs-specific processing rules and continues with train processing.
  • Context - train validation has been completed:
    For Continue with Train Processing:
    When the train is either a valid train/day named vessel or found in the train list, then the system sets the train found flag and continues with subsequent train processing operations.
  • Context - a vessel name that requires train validation:
    For Call GCCUTRIO to Lookup Train:
    When the vessel name does not match train or day naming patterns, then the system calls gccutrio service to lookup the train in external train records.
👨‍💻 Technical ACs (Gherkin)
Context: A vessel name is provided in the M10 segment
GIVEN
A vessel name is provided in the M10 segment
Applied to: Extract Train ID from Vessel Name
WHEN
The vessel name starts with 'TRAIN' or 'DAY'
THEN
The system continues with train processing without additional validation
Context: A vessel name that does not start with 'TRAIN' or 'DAY'
GIVEN
A vessel name that does not start with 'TRAIN' or 'DAY'
Applied to: Query GCWTL Train List Segments
WHEN
The system searches the train list using GCCUTRIO
THEN
If the train is found in GCWTL segments, processing continues; if not found, an error is generated
Context: A train lookup has been performed
GIVEN
A train lookup has been performed
Applied to: Generate Train Not Found Error
WHEN
The train is not found in the GCWTL train list segments
THEN
The system generates a train not found error message for Merlin notification
Context: A train has been successfully found in the system
GIVEN
A train has been successfully found in the system
Applied to: Apply CPRS Special Processing
WHEN
The train is identified as a CPRS train
THEN
The system applies CPRS-specific processing rules and continues with train processing
Context: Train validation has been completed
GIVEN
Train validation has been completed
Applied to: Continue with Train Processing
WHEN
The train is either a valid TRAIN/DAY named vessel or found in the train list
THEN
The system sets the train found flag and continues with subsequent train processing operations
Context: A vessel name that requires train validation
GIVEN
A vessel name that requires train validation
Applied to: Call GCCUTRIO to Lookup Train
WHEN
The vessel name does not match TRAIN or DAY naming patterns
THEN
The system calls GCCUTRIO service to lookup the train in external train records
R-GCX016E-cbl-00077 (+9) File: GCX016E.cbl Train Hold Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Hold Processing':
  • Context - a v9 segment with hmi disposition code is received:
    For Validate Train ID from M10 Segment:
    When the system processes the m10 segment to extract train identification, then the train id is validated and made available for subsequent hold processing.
  • Context - a train id has been extracted from the m10 segment:
    For Train Found in System?:
    When the system searches for the train in the gcwtl train list segments, then the system determines if the train exists and routes processing accordingly.
  • Context - a train exists in the gcwtl train list segments:
    For Retrieve Train Record from GCWTL:
    When the system needs to process a hold disposition for the train, then the complete train record is retrieved from gcwtl for status updates.
  • Context - a valid train record has been retrieved from gcwtl:
    For Set Train Hold Status Flag:
    When an hmi disposition code is being processed, then the train hold status flag is set to indicate the train is held.
  • Context - the train hold status flag has been set:
    For Update Train Status in Database:
    When the system completes hold processing, then the updated train status is written back to the gcwtl database.
  • Context - a train has been successfully placed on hold:
    For Log Hold Action with Timestamp:
    When the hold status has been updated in the database, then a log entry is created with the hold action and current timestamp for audit purposes.
  • Context - a train hold action has been logged:
    For Generate Merlin Hold Notification Message:
    When the system needs to notify stakeholders of the hold, then a merlin hold notification message is generated with train details and hold information.
  • Context - a merlin hold notification message has been generated:
    For Send Hold Notification to Recipients:
    When the system processes notification distribution, then the hold notification is sent to all designated recipients through the merlin message system.
  • Context - a train id from m10 segment does not exist in gcwtl train list:
    For Generate Train Not Found Error:
    When the system attempts to process an hmi hold disposition, then a train not found error is generated for the invalid train id.
  • Context - a train not found error has been generated:
    For Send Error Message to Default Recipient:
    When the system needs to notify about the processing error, then the error message is sent to the default recipient for error handling and resolution.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with HMI disposition code is received
GIVEN
A V9 segment with HMI disposition code is received
Applied to: Validate Train ID from M10 Segment
WHEN
The system processes the M10 segment to extract train identification
THEN
The train ID is validated and made available for subsequent hold processing
Context: A train ID has been extracted from the M10 segment
GIVEN
A train ID has been extracted from the M10 segment
Applied to: Train Found in System?
WHEN
The system searches for the train in the GCWTL train list segments
THEN
The system determines if the train exists and routes processing accordingly
Context: A train exists in the GCWTL train list segments
GIVEN
A train exists in the GCWTL train list segments
Applied to: Retrieve Train Record from GCWTL
WHEN
The system needs to process a hold disposition for the train
THEN
The complete train record is retrieved from GCWTL for status updates
Context: A valid train record has been retrieved from GCWTL
GIVEN
A valid train record has been retrieved from GCWTL
Applied to: Set Train Hold Status Flag
WHEN
An HMI disposition code is being processed
THEN
The train hold status flag is set to indicate the train is held
Context: The train hold status flag has been set
GIVEN
The train hold status flag has been set
Applied to: Update Train Status in Database
WHEN
The system completes hold processing
THEN
The updated train status is written back to the GCWTL database
Context: A train has been successfully placed on hold
GIVEN
A train has been successfully placed on hold
Applied to: Log Hold Action with Timestamp
WHEN
The hold status has been updated in the database
THEN
A log entry is created with the hold action and current timestamp for audit purposes
Context: A train hold action has been logged
GIVEN
A train hold action has been logged
Applied to: Generate Merlin Hold Notification Message
WHEN
The system needs to notify stakeholders of the hold
THEN
A Merlin hold notification message is generated with train details and hold information
Context: A Merlin hold notification message has been generated
GIVEN
A Merlin hold notification message has been generated
Applied to: Send Hold Notification to Recipients
WHEN
The system processes notification distribution
THEN
The hold notification is sent to all designated recipients through the Merlin message system
Context: A train ID from M10 segment does not exist in GCWTL train list
GIVEN
A train ID from M10 segment does not exist in GCWTL train list
Applied to: Generate Train Not Found Error
WHEN
The system attempts to process an HMI hold disposition
THEN
A train not found error is generated for the invalid train ID
Context: A train not found error has been generated
GIVEN
A train not found error has been generated
Applied to: Send Error Message to Default Recipient
WHEN
The system needs to notify about the processing error
THEN
The error message is sent to the default recipient for error handling and resolution
R-GCX016E-cbl-00087 (+9) File: GCX016E.cbl Train Hold Release Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Hold Release Processing':
  • Context - an hre disposition code is received and a vid segment is present in the message:
    For Process VID Segment for Individual Equipment:
    When the system processes the hold release event, then the system processes vid segment for individual equipment hold release instead of train-level processing.
  • Context - equipment-specific hold release is being processed and the equipment has an active hold counter:
    For Decrement Equipment Hold Counter:
    When the vid segment is processed for hold release, then the equipment hold counter is decremented by one.
  • Context - equipment hold counter has been decremented:
    For Hold Counter = 0?:
    When the system checks the equipment hold counter value, then if the hold counter equals zero then proceed to remove equipment hold flag else proceed to log hold release action.
  • Context - equipment hold counter equals zero:
    For Remove Equipment Hold Flag:
    When all holds on the equipment have been released, then the equipment hold status flag is removed from the equipment record.
  • Context - an hre disposition code is received and no vid segment is present in the message:
    For Process Train-Level Hold Release:
    When the system processes the hold release event, then the system processes train-level hold release for the entire train.
  • Context - train-level hold release is being processed:
    For Remove Train Hold Status Flag:
    When the system processes the train hold release, then the train hold status flag is removed from the train record.
  • Context - a hold release action has been processed (either equipment-specific or train-level):
    For Log Hold Release Action:
    When the hold release processing is completed, then the hold release action is logged in the system audit trail.
  • Context - hold release action has been logged:
    For Update Train Status in Database:
    When the system completes hold release processing, then the train status is updated in the database with the current hold release information.
  • Context - train status has been updated in the database:
    For Generate Merlin Notification Message:
    When the hold release processing is nearly complete, then a merlin notification message is generated containing hold release details.
  • Context - a merlin notification message has been generated:
    For Send Hold Release Notification:
    When the system is ready to send notifications, then the hold release notification is transmitted to the designated recipients.
👨‍💻 Technical ACs (Gherkin)
Context: An HRE disposition code is received AND a VID segment is present in the message
GIVEN
An HRE disposition code is received AND a VID segment is present in the message
Applied to: Process VID Segment for Individual Equipment
WHEN
The system processes the hold release event
THEN
The system processes VID segment for individual equipment hold release instead of train-level processing
Context: Equipment-specific hold release is being processed AND the equipment has an active hold counter
GIVEN
Equipment-specific hold release is being processed AND the equipment has an active hold counter
Applied to: Decrement Equipment Hold Counter
WHEN
The VID segment is processed for hold release
THEN
The equipment hold counter is decremented by one
Context: Equipment hold counter has been decremented
GIVEN
Equipment hold counter has been decremented
Applied to: Hold Counter = 0?
WHEN
The system checks the equipment hold counter value
THEN
IF the hold counter equals zero THEN proceed to remove equipment hold flag ELSE proceed to log hold release action
Context: Equipment hold counter equals zero
GIVEN
Equipment hold counter equals zero
Applied to: Remove Equipment Hold Flag
WHEN
All holds on the equipment have been released
THEN
The equipment hold status flag is removed from the equipment record
Context: An HRE disposition code is received AND no VID segment is present in the message
GIVEN
An HRE disposition code is received AND no VID segment is present in the message
Applied to: Process Train-Level Hold Release
WHEN
The system processes the hold release event
THEN
The system processes train-level hold release for the entire train
Context: Train-level hold release is being processed
GIVEN
Train-level hold release is being processed
Applied to: Remove Train Hold Status Flag
WHEN
The system processes the train hold release
THEN
The train hold status flag is removed from the train record
Context: A hold release action has been processed (either equipment-specific or train-level)
GIVEN
A hold release action has been processed (either equipment-specific or train-level)
Applied to: Log Hold Release Action
WHEN
The hold release processing is completed
THEN
The hold release action is logged in the system audit trail
Context: Hold release action has been logged
GIVEN
Hold release action has been logged
Applied to: Update Train Status in Database
WHEN
The system completes hold release processing
THEN
The train status is updated in the database with the current hold release information
Context: Train status has been updated in the database
GIVEN
Train status has been updated in the database
Applied to: Generate Merlin Notification Message
WHEN
The hold release processing is nearly complete
THEN
A Merlin notification message is generated containing hold release details
Context: A Merlin notification message has been generated
GIVEN
A Merlin notification message has been generated
Applied to: Send Hold Release Notification
WHEN
The system is ready to send notifications
THEN
The hold release notification is transmitted to the designated recipients
R-GCX016E-cbl-00097 (+13) File: GCX016E.cbl Train Arrival Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Arrival Processing':
  • Context - a train arrival event (pod/aad disposition code) is being processed:
    For Train ID Suffix Check:
    When the system examines the train id suffix, then if the train id ends with suffix 't', classify as export manifest train, otherwise classify as import manifest train.
  • Context - a train has been classified as export manifest train (suffix 't'):
    For Export Manifest Train - Suffix 'T':
    When the train arrival processing begins, then execute export manifest pre-arrival processing procedures.
  • Context - a train has been classified as import manifest train (no suffix 't'):
    For Import Manifest Train - No Suffix 'T':
    When the train arrival processing begins, then execute standard import manifest arrival processing procedures.
  • Context - an export manifest train is being processed for arrival:
    For Export Manifest Port Validation:
    When the system validates the port location, then if the port is valid for export operations, proceed with export manifest arrival flag setting, otherwise redirect to import manifest processing.
  • Context - an export manifest train has passed port validation:
    For Set Export Manifest Arrival Flag:
    When the arrival processing continues, then set the export manifest arrival flag to indicate successful export arrival.
  • Context - a train is either an import manifest train or an export train that failed port validation:
    For Set Standard Arrival Flag:
    When the arrival processing continues, then set the standard arrival flag to indicate train arrival.
  • Context - a train arrival flag has been set (either export or standard):
    For Set Train Arrival Date from V9 Segment:
    When the system processes the v9 segment containing arrival information, then extract the arrival date from the v9 segment and assign it as the train's official arrival date.
  • Context - the train arrival date has been successfully assigned:
    For Set Train Arrived Status Flag:
    When the system updates train status information, then set the train arrived status flag to indicate the train has completed arrival processing.
  • Context - the train arrived status flag has been set:
    For US Cargo Arrival Processing:
    When the system continues with cargo processing, then initiate arrival processing for all us cargo manifests associated with this train.
  • Context - us cargo arrival processing has been initiated:
    For Send AEI Arrival Messages:
    When the system processes aei notification requirements, then generate and send aei arrival messages to notify relevant parties of train arrival.
  • Context - aei arrival messages have been sent:
    For Send Email Notifications:
    When the system processes notification distribution, then send email notifications to configured recipients about the train arrival event.
  • Context - k1 remark message processing for trains has been completed:
    For Log Train Arrival Action:
    When the system finalizes arrival processing, then create a log entry documenting the train arrival action with relevant details.
  • Context - the train arrival action has been logged:
    For Update Train Status in Database:
    When the system commits status changes, then update the train status information in the database to reflect the completed arrival.
  • Context - the train status has been updated in the database:
    For Generate Merlin Arrival Notification:
    When the system generates external notifications, then create and send a merlin arrival notification message to inform the merlin system of the train arrival.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event (POD/AAD disposition code) is being processed
GIVEN
A train arrival event (POD/AAD disposition code) is being processed
Applied to: Train ID Suffix Check
WHEN
The system examines the train ID suffix
THEN
If the train ID ends with suffix 'T', classify as export manifest train, otherwise classify as import manifest train
Context: A train has been classified as export manifest train (suffix 'T')
GIVEN
A train has been classified as export manifest train (suffix 'T')
Applied to: Export Manifest Train - Suffix 'T'
WHEN
The train arrival processing begins
THEN
Execute export manifest pre-arrival processing procedures
Context: A train has been classified as import manifest train (no suffix 'T')
GIVEN
A train has been classified as import manifest train (no suffix 'T')
Applied to: Import Manifest Train - No Suffix 'T'
WHEN
The train arrival processing begins
THEN
Execute standard import manifest arrival processing procedures
Context: An export manifest train is being processed for arrival
GIVEN
An export manifest train is being processed for arrival
Applied to: Export Manifest Port Validation
WHEN
The system validates the port location
THEN
If the port is valid for export operations, proceed with export manifest arrival flag setting, otherwise redirect to import manifest processing
Context: An export manifest train has passed port validation
GIVEN
An export manifest train has passed port validation
Applied to: Set Export Manifest Arrival Flag
WHEN
The arrival processing continues
THEN
Set the export manifest arrival flag to indicate successful export arrival
Context: A train is either an import manifest train or an export train that failed port validation
GIVEN
A train is either an import manifest train or an export train that failed port validation
Applied to: Set Standard Arrival Flag
WHEN
The arrival processing continues
THEN
Set the standard arrival flag to indicate train arrival
Context: A train arrival flag has been set (either export or standard)
GIVEN
A train arrival flag has been set (either export or standard)
Applied to: Set Train Arrival Date from V9 Segment
WHEN
The system processes the V9 segment containing arrival information
THEN
Extract the arrival date from the V9 segment and assign it as the train's official arrival date
Context: The train arrival date has been successfully assigned
GIVEN
The train arrival date has been successfully assigned
Applied to: Set Train Arrived Status Flag
WHEN
The system updates train status information
THEN
Set the train arrived status flag to indicate the train has completed arrival processing
Context: The train arrived status flag has been set
GIVEN
The train arrived status flag has been set
Applied to: US Cargo Arrival Processing
WHEN
The system continues with cargo processing
THEN
Initiate arrival processing for all US cargo manifests associated with this train
Context: US cargo arrival processing has been initiated
GIVEN
US cargo arrival processing has been initiated
Applied to: Send AEI Arrival Messages
WHEN
The system processes AEI notification requirements
THEN
Generate and send AEI arrival messages to notify relevant parties of train arrival
Context: AEI arrival messages have been sent
GIVEN
AEI arrival messages have been sent
Applied to: Send Email Notifications
WHEN
The system processes notification distribution
THEN
Send email notifications to configured recipients about the train arrival event
Context: K1 remark message processing for trains has been completed
GIVEN
K1 remark message processing for trains has been completed
Applied to: Log Train Arrival Action
WHEN
The system finalizes arrival processing
THEN
Create a log entry documenting the train arrival action with relevant details
Context: The train arrival action has been logged
GIVEN
The train arrival action has been logged
Applied to: Update Train Status in Database
WHEN
The system commits status changes
THEN
Update the train status information in the database to reflect the completed arrival
Context: The train status has been updated in the database
GIVEN
The train status has been updated in the database
Applied to: Generate Merlin Arrival Notification
WHEN
The system generates external notifications
THEN
Create and send a Merlin arrival notification message to inform the Merlin system of the train arrival
R-GCX016E-cbl-00111 (+12) File: GCX016E.cbl Train Review Complete Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Review Complete Processing':
  • Context - a v9 segment is received with a disposition code:
    For Validate RC Disposition Code:
    When the system processes the v9 segment, then the disposition code must be 'rc' to proceed with review complete processing.
  • Context - a train record exists in the system:
    For Is Train Export Manifest?:
    When the system needs to determine if it's an export manifest train, then the system checks the train id suffix to identify export manifest trains.
  • Context - a train id is available for processing:
    For Train ID ends with 'T'?:
    When the system checks the train id suffix, then if the train id ends with 't', it is classified as an export manifest train, otherwise it is processed as a regular train.
  • Context - a train has been identified as an export manifest train:
    For Mark as Export Manifest Train:
    When the system processes the train classification, then the train is marked with export manifest status for subsequent processing.
  • Context - a valid rc disposition code has been processed for a train:
    For Set Review Complete Flag:
    When the system updates the train status, then the review complete flag is set to indicate completion of the review process.
  • Context - the review complete flag has been set for a train:
    For Update Train Status in GCWTL:
    When the system updates the train records, then the train status is updated in the gcwtl train list segments with the new review complete status.
  • Context - a train review complete action has been processed:
    For Log Review Complete Action:
    When the system completes the status update, then the review complete action is logged with appropriate details for audit purposes.
  • Context - a train review complete action has been logged:
    For Generate Merlin Notification Message:
    When the system prepares notifications, then a merlin notification message is generated containing the review complete details.
  • Context - a review complete notification is being prepared:
    For K1 Remark Message Present?:
    When the system checks for additional remark information, then if k1 remark messages are present, they are processed for inclusion in the notification, otherwise the notification proceeds without remarks.
  • Context - k1 remark messages are present in the transaction:
    For Process K1 Free-Form Text:
    When the system processes the k1 segments, then the free-form text from k1 segments is extracted and formatted for inclusion in notifications.
  • Context - k1 free-form text has been processed:
    For Add K1 Comments to Notification:
    When the system builds the notification message, then the processed k1 comments are added to the notification message content.
  • Context - a complete review complete notification message has been prepared:
    For Send Review Complete Notification:
    When the system sends the notification, then the notification is transmitted through the merlin messaging system to appropriate recipients.
  • Context - the review complete notification has been sent:
    For Update Train Processing Status:
    When the system finalizes the review complete processing, then the train processing status is updated to indicate successful completion of review complete processing.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment is received with a disposition code
GIVEN
A V9 segment is received with a disposition code
Applied to: Validate RC Disposition Code
WHEN
The system processes the V9 segment
THEN
The disposition code must be 'RC' to proceed with review complete processing
Context: A train record exists in the system
GIVEN
A train record exists in the system
Applied to: Is Train Export Manifest?
WHEN
The system needs to determine if it's an export manifest train
THEN
The system checks the train ID suffix to identify export manifest trains
Context: A train ID is available for processing
GIVEN
A train ID is available for processing
Applied to: Train ID ends with 'T'?
WHEN
The system checks the train ID suffix
THEN
If the train ID ends with 'T', it is classified as an export manifest train, otherwise it is processed as a regular train
Context: A train has been identified as an export manifest train
GIVEN
A train has been identified as an export manifest train
Applied to: Mark as Export Manifest Train
WHEN
The system processes the train classification
THEN
The train is marked with export manifest status for subsequent processing
Context: A valid RC disposition code has been processed for a train
GIVEN
A valid RC disposition code has been processed for a train
Applied to: Set Review Complete Flag
WHEN
The system updates the train status
THEN
The review complete flag is set to indicate completion of the review process
Context: The review complete flag has been set for a train
GIVEN
The review complete flag has been set for a train
Applied to: Update Train Status in GCWTL
WHEN
The system updates the train records
THEN
The train status is updated in the GCWTL train list segments with the new review complete status
Context: A train review complete action has been processed
GIVEN
A train review complete action has been processed
Applied to: Log Review Complete Action
WHEN
The system completes the status update
THEN
The review complete action is logged with appropriate details for audit purposes
Context: A train review complete action has been logged
GIVEN
A train review complete action has been logged
Applied to: Generate Merlin Notification Message
WHEN
The system prepares notifications
THEN
A Merlin notification message is generated containing the review complete details
Context: A review complete notification is being prepared
GIVEN
A review complete notification is being prepared
Applied to: K1 Remark Message Present?
WHEN
The system checks for additional remark information
THEN
If K1 remark messages are present, they are processed for inclusion in the notification, otherwise the notification proceeds without remarks
Context: K1 remark messages are present in the transaction
GIVEN
K1 remark messages are present in the transaction
Applied to: Process K1 Free-Form Text
WHEN
The system processes the K1 segments
THEN
The free-form text from K1 segments is extracted and formatted for inclusion in notifications
Context: K1 free-form text has been processed
GIVEN
K1 free-form text has been processed
Applied to: Add K1 Comments to Notification
WHEN
The system builds the notification message
THEN
The processed K1 comments are added to the notification message content
Context: A complete review complete notification message has been prepared
GIVEN
A complete review complete notification message has been prepared
Applied to: Send Review Complete Notification
WHEN
The system sends the notification
THEN
The notification is transmitted through the Merlin messaging system to appropriate recipients
Context: The review complete notification has been sent
GIVEN
The review complete notification has been sent
Applied to: Update Train Processing Status
WHEN
The system finalizes the review complete processing
THEN
The train processing status is updated to indicate successful completion of review complete processing
R-GCX016E-cbl-00124 (+13) File: GCX016E.cbl Train Not Arrived Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Not Arrived Processing':
  • Context - a v9 segment with oca disposition code is received:
    For Validate Train ID from M10 Segment:
    When the system processes the m10 segment for train identification, then the train id must be extracted and validated from the m10 segment data.
  • Context - a train id has been extracted from the m10 segment:
    For Train Found in System?:
    When the system searches the train list database, then if the train is not found in the system, processing should branch to warning generation, otherwise continue to status checking.
  • Context - a valid train id exists in the system:
    For Check Current Train Status:
    When the system accesses the train status information, then the current train status must be retrieved for arrival status evaluation.
  • Context - the current train status has been retrieved:
    For Train Already Arrived?:
    When the system evaluates the train's arrival status, then if the train has already arrived, generate a warning; if not arrived, proceed with oca disposition processing.
  • Context - either the train is not found in the system or the train has already arrived:
    For Generate Train Not Arrived Warning:
    When an oca disposition code is processed, then a train not arrived warning message must be generated and logged.
  • Context - a train exists in the system and has not yet arrived:
    For Log OCA Disposition Action:
    When an oca disposition code is processed, then the oca disposition action must be logged in the system audit trail.
  • Context - an oca disposition has been successfully logged for a non-arrived train:
    For Set Train Re-Arrival Flag:
    When the system processes the arrival cancellation, then a re-arrival flag must be set to enable future arrival processing for this train.
  • Context - the re-arrival flag has been set for the train:
    For Update Train Status to Not Arrived:
    When the system updates the train status database, then the train status must be changed to 'not arrived' to reflect the cancelled arrival.
  • Context - either a warning condition exists or the train status has been updated to not arrived:
    For Create Merlin Notification Message:
    When the system prepares notifications, then a merlin notification message must be created with appropriate train and disposition information.
  • Context - a merlin notification message is being created:
    For Include K1 Remark Messages if Present:
    When k1 segment remark messages exist in the current transaction, then the k1 remark messages must be included in the merlin notification message.
  • Context - a merlin notification message has been created with or without k1 remarks:
    For Send Warning to Operations Team:
    When the system delivers the notification, then the warning message must be sent to the operations team via the merlin messaging system.
  • Context - the warning has been sent to the operations team:
    For Trigger Re-Arrival Process:
    When the system completes the oca processing, then the re-arrival process must be triggered to allow the train to be processed for arrival again in the future.
  • Context - the re-arrival process has been triggered:
    For Log Processing Complete:
    When all oca processing steps are completed, then a processing complete log entry must be created to document the successful completion of oca handling.
  • Context - oca processing has been completed and logged:
    For Continue to Next Message Segment:
    When the system finishes the current segment processing, then processing must continue to the next message segment in the transaction.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with OCA disposition code is received
GIVEN
A V9 segment with OCA disposition code is received
Applied to: Validate Train ID from M10 Segment
WHEN
The system processes the M10 segment for train identification
THEN
The train ID must be extracted and validated from the M10 segment data
Context: A train ID has been extracted from the M10 segment
GIVEN
A train ID has been extracted from the M10 segment
Applied to: Train Found in System?
WHEN
The system searches the train list database
THEN
If the train is not found in the system, processing should branch to warning generation, otherwise continue to status checking
Context: A valid train ID exists in the system
GIVEN
A valid train ID exists in the system
Applied to: Check Current Train Status
WHEN
The system accesses the train status information
THEN
The current train status must be retrieved for arrival status evaluation
Context: The current train status has been retrieved
GIVEN
The current train status has been retrieved
Applied to: Train Already Arrived?
WHEN
The system evaluates the train's arrival status
THEN
If the train has already arrived, generate a warning; if not arrived, proceed with OCA disposition processing
Context: Either the train is not found in the system OR the train has already arrived
GIVEN
Either the train is not found in the system OR the train has already arrived
Applied to: Generate Train Not Arrived Warning
WHEN
An OCA disposition code is processed
THEN
A train not arrived warning message must be generated and logged
Context: A train exists in the system and has not yet arrived
GIVEN
A train exists in the system and has not yet arrived
Applied to: Log OCA Disposition Action
WHEN
An OCA disposition code is processed
THEN
The OCA disposition action must be logged in the system audit trail
Context: An OCA disposition has been successfully logged for a non-arrived train
GIVEN
An OCA disposition has been successfully logged for a non-arrived train
Applied to: Set Train Re-Arrival Flag
WHEN
The system processes the arrival cancellation
THEN
A re-arrival flag must be set to enable future arrival processing for this train
Context: The re-arrival flag has been set for the train
GIVEN
The re-arrival flag has been set for the train
Applied to: Update Train Status to Not Arrived
WHEN
The system updates the train status database
THEN
The train status must be changed to 'Not Arrived' to reflect the cancelled arrival
Context: Either a warning condition exists OR the train status has been updated to not arrived
GIVEN
Either a warning condition exists OR the train status has been updated to not arrived
Applied to: Create Merlin Notification Message
WHEN
The system prepares notifications
THEN
A Merlin notification message must be created with appropriate train and disposition information
Context: A Merlin notification message is being created
GIVEN
A Merlin notification message is being created
Applied to: Include K1 Remark Messages if Present
WHEN
K1 segment remark messages exist in the current transaction
THEN
The K1 remark messages must be included in the Merlin notification message
Context: A Merlin notification message has been created with or without K1 remarks
GIVEN
A Merlin notification message has been created with or without K1 remarks
Applied to: Send Warning to Operations Team
WHEN
The system delivers the notification
THEN
The warning message must be sent to the operations team via the Merlin messaging system
Context: The warning has been sent to the operations team
GIVEN
The warning has been sent to the operations team
Applied to: Trigger Re-Arrival Process
WHEN
The system completes the OCA processing
THEN
The re-arrival process must be triggered to allow the train to be processed for arrival again in the future
Context: The re-arrival process has been triggered
GIVEN
The re-arrival process has been triggered
Applied to: Log Processing Complete
WHEN
All OCA processing steps are completed
THEN
A processing complete log entry must be created to document the successful completion of OCA handling
Context: OCA processing has been completed and logged
GIVEN
OCA processing has been completed and logged
Applied to: Continue to Next Message Segment
WHEN
The system finishes the current segment processing
THEN
Processing must continue to the next message segment in the transaction
R-GCX016E-cbl-00138 (+15) File: GCX016E.cbl Train Arrival Cancellation Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Arrival Cancellation':
  • Context - a v9 segment is received with coc disposition code:
    For V9 Segment with COC Disposition Code Received:
    When the system processes the v9 segment, then the system initiates train arrival cancellation processing.
  • Context - a train id is provided from m10 segment data:
    For Validate Train ID from M10 Segment:
    When the system validates the train identification, then the system confirms train id is valid and accessible for cancellation processing.
  • Context - a train id has been validated from m10 segment:
    For Train Found in System?:
    When the system searches for the train in the train list, then the system determines if the train exists and can proceed with cancellation or must log an error.
  • Context - a train id cannot be found in the train management system:
    For Log Train Not Found Error:
    When the system attempts to process train arrival cancellation, then the system logs a train not found error and terminates the cancellation process.
  • Context - a valid train has been found in the system:
    For Check Current Train Status:
    When the system checks the train's current status, then the system retrieves current train status information for cancellation decision making.
  • Context - the current train status has been retrieved:
    For Train Currently Arrived?:
    When the system evaluates if the train is currently in arrived status, then the system determines whether to proceed with arrival cancellation or log a warning for non-arrived trains.
  • Context - a train is currently in arrived status and cancellation is requested:
    For Cancel Train Arrival Status:
    When the system processes the arrival cancellation, then the system removes the arrival status from the train record.
  • Context - train arrival status has been cancelled:
    For Update Train Arrival Date to Null:
    When the system updates train arrival information, then the system sets the train arrival date to null.
  • Context - train arrival date has been nullified:
    For Clear Train Arrival Flags:
    When the system completes arrival cancellation processing, then the system clears all train arrival flags and indicators.
  • Context - train arrival flags have been cleared:
    For Log COC Arrival Cancellation Action:
    When the system completes the cancellation process, then the system logs the coc arrival cancellation action for audit purposes.
  • Context - coc arrival cancellation action has been logged:
    For Generate Train Arrival Cancellation Warning:
    When the system generates operational notifications, then the system creates a train arrival cancellation warning message.
  • Context - a train is not currently in arrived status:
    For Log Warning - Train Not Previously Arrived:
    When the system processes a coc cancellation request, then the system logs a warning that the train was not previously arrived.
  • Context - train arrival cancellation warning has been generated or non-arrived warning has been logged:
    For Create Merlin Notification Message:
    When the system prepares business notifications, then the system creates a formatted merlin notification message.
  • Context - a merlin notification message has been created:
    For Send Notification to Business Users:
    When the system sends business notifications, then the system delivers the notification to appropriate business users.
  • Context - notification has been sent to business users:
    For Update Train Status in Database:
    When the system finalizes the cancellation process, then the system updates the train status information in the database.
  • Context - train status has been updated in the database or error has been logged:
    For Process Complete:
    When the system finishes all cancellation processing steps, then the system marks the train arrival cancellation process as complete.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment is received with COC disposition code
GIVEN
A V9 segment is received with COC disposition code
Applied to: V9 Segment with COC Disposition Code Received
WHEN
The system processes the V9 segment
THEN
The system initiates train arrival cancellation processing
Context: A train ID is provided from M10 segment data
GIVEN
A train ID is provided from M10 segment data
Applied to: Validate Train ID from M10 Segment
WHEN
The system validates the train identification
THEN
The system confirms train ID is valid and accessible for cancellation processing
Context: A train ID has been validated from M10 segment
GIVEN
A train ID has been validated from M10 segment
Applied to: Train Found in System?
WHEN
The system searches for the train in the train list
THEN
The system determines if the train exists and can proceed with cancellation or must log an error
Context: A train ID cannot be found in the train management system
GIVEN
A train ID cannot be found in the train management system
Applied to: Log Train Not Found Error
WHEN
The system attempts to process train arrival cancellation
THEN
The system logs a train not found error and terminates the cancellation process
Context: A valid train has been found in the system
GIVEN
A valid train has been found in the system
Applied to: Check Current Train Status
WHEN
The system checks the train's current status
THEN
The system retrieves current train status information for cancellation decision making
Context: The current train status has been retrieved
GIVEN
The current train status has been retrieved
Applied to: Train Currently Arrived?
WHEN
The system evaluates if the train is currently in arrived status
THEN
The system determines whether to proceed with arrival cancellation or log a warning for non-arrived trains
Context: A train is currently in arrived status and cancellation is requested
GIVEN
A train is currently in arrived status and cancellation is requested
Applied to: Cancel Train Arrival Status
WHEN
The system processes the arrival cancellation
THEN
The system removes the arrival status from the train record
Context: Train arrival status has been cancelled
GIVEN
Train arrival status has been cancelled
Applied to: Update Train Arrival Date to Null
WHEN
The system updates train arrival information
THEN
The system sets the train arrival date to null
Context: Train arrival date has been nullified
GIVEN
Train arrival date has been nullified
Applied to: Clear Train Arrival Flags
WHEN
The system completes arrival cancellation processing
THEN
The system clears all train arrival flags and indicators
Context: Train arrival flags have been cleared
GIVEN
Train arrival flags have been cleared
Applied to: Log COC Arrival Cancellation Action
WHEN
The system completes the cancellation process
THEN
The system logs the COC arrival cancellation action for audit purposes
Context: COC arrival cancellation action has been logged
GIVEN
COC arrival cancellation action has been logged
Applied to: Generate Train Arrival Cancellation Warning
WHEN
The system generates operational notifications
THEN
The system creates a train arrival cancellation warning message
Context: A train is not currently in arrived status
GIVEN
A train is not currently in arrived status
Applied to: Log Warning - Train Not Previously Arrived
WHEN
The system processes a COC cancellation request
THEN
The system logs a warning that the train was not previously arrived
Context: Train arrival cancellation warning has been generated or non-arrived warning has been logged
GIVEN
Train arrival cancellation warning has been generated or non-arrived warning has been logged
Applied to: Create Merlin Notification Message
WHEN
The system prepares business notifications
THEN
The system creates a formatted Merlin notification message
Context: A Merlin notification message has been created
GIVEN
A Merlin notification message has been created
Applied to: Send Notification to Business Users
WHEN
The system sends business notifications
THEN
The system delivers the notification to appropriate business users
Context: Notification has been sent to business users
GIVEN
Notification has been sent to business users
Applied to: Update Train Status in Database
WHEN
The system finalizes the cancellation process
THEN
The system updates the train status information in the database
Context: Train status has been updated in the database or error has been logged
GIVEN
Train status has been updated in the database or error has been logged
Applied to: Process Complete
WHEN
The system finishes all cancellation processing steps
THEN
The system marks the train arrival cancellation process as complete
R-GCX016E-cbl-00154 (+11) File: GCX016E.cbl Train Lock Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Lock Processing':
  • Context - a v9 segment contains event code lck for train lock processing:
    For Receive LCK Disposition Code for Train:
    When the system processes the v9 segment with lck event code, then the system initiates train lock processing workflow.
  • Context - an m10 segment contains vessel/train information:
    For Validate Train ID from M10 Segment:
    When the system processes the m10 segment for train identification, then the system extracts and validates the train id for further processing.
  • Context - a train id has been extracted from m10 segment and vessel name does not start with 'train' or 'day':
    For Train Found in System?:
    When the system searches the train list for the specified train id, then the system determines if the train exists in the system or generates train not found error if train does not exist.
  • Context - a train has been found in the system:
    For Retrieve Current Train Status:
    When the system needs to process a lock request for the train, then the system retrieves the current status information for the train.
  • Context - current train status has been retrieved:
    For Train Already Locked?:
    When the system evaluates the train's current lock status, then the system determines if the train is already locked or proceeds with lock processing if not already locked.
  • Context - a train is not currently locked:
    For Set Train Lock Status Flag:
    When the system processes a lck disposition code for the train, then the system sets the train locked status flag.
  • Context - train lock status flag has been set:
    For Update Train Record in Database:
    When the system commits the lock status change, then the system updates the train record in the database with the new lock status.
  • Context - train record has been updated with lock status:
    For Log Train Lock Action:
    When the system completes the lock processing, then the system logs the train lock action with relevant details.
  • Context - train lock action has been logged:
    For Generate Merlin Notification Message:
    When the system processes notification requirements, then the system generates a merlin notification message for the train lock event.
  • Context - merlin notification message has been generated:
    For Send Lock Confirmation to Business Users:
    When the system processes user notification requirements, then the system sends lock confirmation to appropriate business users.
  • Context - a train id has been validated and the train does not exist in the train list:
    For Generate Error Message - Train Not Found:
    When the system attempts to process a lock request for non-existent train, then the system generates an error message indicating train not found.
  • Context - a train's current status shows it is already locked:
    For Generate Warning - Train Already Locked:
    When the system processes a lck disposition code for the already locked train, then the system generates a warning message indicating the train is already locked.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment contains event code LCK for train lock processing
GIVEN
A V9 segment contains event code LCK for train lock processing
Applied to: Receive LCK Disposition Code for Train
WHEN
The system processes the V9 segment with LCK event code
THEN
The system initiates train lock processing workflow
Context: An M10 segment contains vessel/train information
GIVEN
An M10 segment contains vessel/train information
Applied to: Validate Train ID from M10 Segment
WHEN
The system processes the M10 segment for train identification
THEN
The system extracts and validates the train ID for further processing
Context: A train ID has been extracted from M10 segment AND vessel name does not start with 'TRAIN' or 'DAY'
GIVEN
A train ID has been extracted from M10 segment AND vessel name does not start with 'TRAIN' or 'DAY'
Applied to: Train Found in System?
WHEN
The system searches the train list for the specified train ID
THEN
The system determines if the train exists in the system OR generates train not found error if train does not exist
Context: A train has been found in the system
GIVEN
A train has been found in the system
Applied to: Retrieve Current Train Status
WHEN
The system needs to process a lock request for the train
THEN
The system retrieves the current status information for the train
Context: Current train status has been retrieved
GIVEN
Current train status has been retrieved
Applied to: Train Already Locked?
WHEN
The system evaluates the train's current lock status
THEN
The system determines if the train is already locked OR proceeds with lock processing if not already locked
Context: A train is not currently locked
GIVEN
A train is not currently locked
Applied to: Set Train Lock Status Flag
WHEN
The system processes a LCK disposition code for the train
THEN
The system sets the train locked status flag
Context: Train lock status flag has been set
GIVEN
Train lock status flag has been set
Applied to: Update Train Record in Database
WHEN
The system commits the lock status change
THEN
The system updates the train record in the database with the new lock status
Context: Train record has been updated with lock status
GIVEN
Train record has been updated with lock status
Applied to: Log Train Lock Action
WHEN
The system completes the lock processing
THEN
The system logs the train lock action with relevant details
Context: Train lock action has been logged
GIVEN
Train lock action has been logged
Applied to: Generate Merlin Notification Message
WHEN
The system processes notification requirements
THEN
The system generates a Merlin notification message for the train lock event
Context: Merlin notification message has been generated
GIVEN
Merlin notification message has been generated
Applied to: Send Lock Confirmation to Business Users
WHEN
The system processes user notification requirements
THEN
The system sends lock confirmation to appropriate business users
Context: A train ID has been validated AND the train does not exist in the train list
GIVEN
A train ID has been validated AND the train does not exist in the train list
Applied to: Generate Error Message - Train Not Found
WHEN
The system attempts to process a lock request for non-existent train
THEN
The system generates an error message indicating train not found
Context: A train's current status shows it is already locked
GIVEN
A train's current status shows it is already locked
Applied to: Generate Warning - Train Already Locked
WHEN
The system processes a LCK disposition code for the already locked train
THEN
The system generates a warning message indicating the train is already locked
R-GCX016E-cbl-00166 (+10) File: GCX016E.cbl Train Unlock Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Unlock Processing':
  • Context - a v9 segment is received with event code ulc:
    For Receive ULC Disposition Code in V9 Segment:
    When the system processes the v9 segment, then the system initiates train unlock processing workflow.
  • Context - an unlock request is being processed:
    For Validate Train ID from M10 Segment:
    When the system needs to identify the target train, then the system retrieves and validates train identification from the m10 segment.
  • Context - a train id has been extracted from the m10 segment:
    For Train Found in System?:
    When the system searches for the train in the train list, then if the train is found, processing continues; if not found, an error is generated.
  • Context - a valid train has been identified in the system:
    For Retrieve Current Train Status:
    When the system needs to process an unlock request, then the system retrieves the current lock status of the train.
  • Context - the current train status has been retrieved:
    For Train Currently Locked?:
    When the system evaluates whether unlock operation should proceed, then if train is locked, unlock proceeds; if not locked, a warning is generated.
  • Context - a train is currently in locked status:
    For Update Train Status to Unlocked:
    When a valid unlock request is processed, then the system updates the train status to unlocked.
  • Context - a train status has been successfully updated to unlocked:
    For Log Train Unlock Action:
    When the unlock operation completes, then the system logs the unlock action with timestamp and train details.
  • Context - a train unlock action has been logged:
    For Generate Merlin Notification Message:
    When the system needs to notify stakeholders, then the system generates a merlin notification message with unlock details.
  • Context - a merlin notification message has been generated:
    For Send Train Unlock Confirmation:
    When the system completes unlock processing, then the system sends unlock confirmation to the requesting party.
  • Context - a train id has been provided for unlock processing:
    For Generate Error Message - Train Not Found:
    When the train cannot be found in the system, then the system generates an error message indicating train not found.
  • Context - a valid train has been identified for unlock processing:
    For Generate Warning - Train Not Locked:
    When the train is not currently in locked status, then the system generates a warning message indicating train is not locked.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment is received with event code ULC
GIVEN
A V9 segment is received with event code ULC
Applied to: Receive ULC Disposition Code in V9 Segment
WHEN
The system processes the V9 segment
THEN
The system initiates train unlock processing workflow
Context: An unlock request is being processed
GIVEN
An unlock request is being processed
Applied to: Validate Train ID from M10 Segment
WHEN
The system needs to identify the target train
THEN
The system retrieves and validates train identification from the M10 segment
Context: A train ID has been extracted from the M10 segment
GIVEN
A train ID has been extracted from the M10 segment
Applied to: Train Found in System?
WHEN
The system searches for the train in the train list
THEN
If the train is found, processing continues; if not found, an error is generated
Context: A valid train has been identified in the system
GIVEN
A valid train has been identified in the system
Applied to: Retrieve Current Train Status
WHEN
The system needs to process an unlock request
THEN
The system retrieves the current lock status of the train
Context: The current train status has been retrieved
GIVEN
The current train status has been retrieved
Applied to: Train Currently Locked?
WHEN
The system evaluates whether unlock operation should proceed
THEN
If train is locked, unlock proceeds; if not locked, a warning is generated
Context: A train is currently in locked status
GIVEN
A train is currently in locked status
Applied to: Update Train Status to Unlocked
WHEN
A valid unlock request is processed
THEN
The system updates the train status to unlocked
Context: A train status has been successfully updated to unlocked
GIVEN
A train status has been successfully updated to unlocked
Applied to: Log Train Unlock Action
WHEN
The unlock operation completes
THEN
The system logs the unlock action with timestamp and train details
Context: A train unlock action has been logged
GIVEN
A train unlock action has been logged
Applied to: Generate Merlin Notification Message
WHEN
The system needs to notify stakeholders
THEN
The system generates a Merlin notification message with unlock details
Context: A Merlin notification message has been generated
GIVEN
A Merlin notification message has been generated
Applied to: Send Train Unlock Confirmation
WHEN
The system completes unlock processing
THEN
The system sends unlock confirmation to the requesting party
Context: A train ID has been provided for unlock processing
GIVEN
A train ID has been provided for unlock processing
Applied to: Generate Error Message - Train Not Found
WHEN
The train cannot be found in the system
THEN
The system generates an error message indicating train not found
Context: A valid train has been identified for unlock processing
GIVEN
A valid train has been identified for unlock processing
Applied to: Generate Warning - Train Not Locked
WHEN
The train is not currently in locked status
THEN
The system generates a warning message indicating train is not locked
R-GCX016E-cbl-00177 (+15) File: GCX016E.cbl Train Seizure Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Seizure Processing':
  • Context - a v9 segment contains event code 'sei' for train seizure:
    For SEI Disposition Code Received for Train:
    When the system processes the v9 segment with sei event code, then the system initiates train seizure processing workflow.
  • Context - an m10 segment contains vessel/train identification information:
    For Validate Train ID from M10 Segment:
    When the system processes the m10 segment for train seizure, then the system extracts the train id and prepares it for validation.
  • Context - a train id has been extracted from the m10 segment:
    For Train Found in System?:
    When the system searches for the train in the train list, then the system determines if the train exists and is valid for seizure processing.
  • Context - a valid train has been found in the system:
    For Retrieve Current Train Status:
    When the system needs to process a seizure request, then the system retrieves the current train status including seizure flag.
  • Context - the current train status has been retrieved:
    For Train Already Seized?:
    When the system checks if the train is already seized, then if train seizure flag is 'y', skip processing; otherwise proceed with seizure.
  • Context - a train is not currently seized and seizure processing is required:
    For Set Train Seizure Flag to 'Y':
    When the system processes the seizure request, then the system sets the train seizure flag to 'y'.
  • Context - the train seizure flag has been set to 'y':
    For Update Train Status in Database:
    When the system needs to save the status change, then the system updates the train record in the database with the new seizure status.
  • Context - a train has been successfully seized:
    For Log Seizure Action with Timestamp:
    When the system completes the seizure status update, then the system logs the seizure action with current date and time.
  • Context - a train seizure has been logged successfully:
    For Generate Merlin Notification Message:
    When the system needs to notify stakeholders, then the system generates a merlin notification message with seizure details.
  • Context - a merlin notification message has been generated for train seizure:
    For Send Seizure Notification to Customs:
    When the system sends notifications to relevant parties, then the system sends the seizure notification to customs authorities.
  • Context - a train has been seized and notifications sent:
    For Update Train Equipment List Status:
    When the system processes equipment associated with the train, then the system updates the equipment list status to reflect the train seizure.
  • Context - the train equipment list has been updated:
    For Mark All Equipment in Train as Seized:
    When the system processes individual equipment items, then the system marks each equipment item in the train as seized.
  • Context - train seizure processing is in progress and k1 segments may be present:
    For Process K1 Remark Messages if Present:
    When the system checks for k1 remark segments, then if k1 segments exist, the system processes the remark messages and includes them in seizure documentation.
  • Context - a train id has been extracted but the train is not found in the system:
    For Generate Error Message - Train Not Found:
    When the system cannot locate the train for seizure processing, then the system generates an error message indicating train not found.
  • Context - a train is found in the system but is already seized:
    For Skip Processing - Already Seized:
    When the system checks the current seizure status, then the system skips seizure processing and continues to completion.
  • Context - all seizure processing steps have been completed or skipped appropriately:
    For Complete Train Seizure Processing:
    When the system reaches the end of seizure processing, then the system completes the train seizure processing and returns control to the main workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment contains event code 'SEI' for train seizure
GIVEN
A V9 segment contains event code 'SEI' for train seizure
Applied to: SEI Disposition Code Received for Train
WHEN
The system processes the V9 segment with SEI event code
THEN
The system initiates train seizure processing workflow
Context: An M10 segment contains vessel/train identification information
GIVEN
An M10 segment contains vessel/train identification information
Applied to: Validate Train ID from M10 Segment
WHEN
The system processes the M10 segment for train seizure
THEN
The system extracts the train ID and prepares it for validation
Context: A train ID has been extracted from the M10 segment
GIVEN
A train ID has been extracted from the M10 segment
Applied to: Train Found in System?
WHEN
The system searches for the train in the train list
THEN
The system determines if the train exists and is valid for seizure processing
Context: A valid train has been found in the system
GIVEN
A valid train has been found in the system
Applied to: Retrieve Current Train Status
WHEN
The system needs to process a seizure request
THEN
The system retrieves the current train status including seizure flag
Context: The current train status has been retrieved
GIVEN
The current train status has been retrieved
Applied to: Train Already Seized?
WHEN
The system checks if the train is already seized
THEN
If train seizure flag is 'Y', skip processing; otherwise proceed with seizure
Context: A train is not currently seized and seizure processing is required
GIVEN
A train is not currently seized and seizure processing is required
Applied to: Set Train Seizure Flag to 'Y'
WHEN
The system processes the seizure request
THEN
The system sets the train seizure flag to 'Y'
Context: The train seizure flag has been set to 'Y'
GIVEN
The train seizure flag has been set to 'Y'
Applied to: Update Train Status in Database
WHEN
The system needs to save the status change
THEN
The system updates the train record in the database with the new seizure status
Context: A train has been successfully seized
GIVEN
A train has been successfully seized
Applied to: Log Seizure Action with Timestamp
WHEN
The system completes the seizure status update
THEN
The system logs the seizure action with current date and time
Context: A train seizure has been logged successfully
GIVEN
A train seizure has been logged successfully
Applied to: Generate Merlin Notification Message
WHEN
The system needs to notify stakeholders
THEN
The system generates a Merlin notification message with seizure details
Context: A Merlin notification message has been generated for train seizure
GIVEN
A Merlin notification message has been generated for train seizure
Applied to: Send Seizure Notification to Customs
WHEN
The system sends notifications to relevant parties
THEN
The system sends the seizure notification to customs authorities
Context: A train has been seized and notifications sent
GIVEN
A train has been seized and notifications sent
Applied to: Update Train Equipment List Status
WHEN
The system processes equipment associated with the train
THEN
The system updates the equipment list status to reflect the train seizure
Context: The train equipment list has been updated
GIVEN
The train equipment list has been updated
Applied to: Mark All Equipment in Train as Seized
WHEN
The system processes individual equipment items
THEN
The system marks each equipment item in the train as seized
Context: Train seizure processing is in progress and K1 segments may be present
GIVEN
Train seizure processing is in progress and K1 segments may be present
Applied to: Process K1 Remark Messages if Present
WHEN
The system checks for K1 remark segments
THEN
If K1 segments exist, the system processes the remark messages and includes them in seizure documentation
Context: A train ID has been extracted but the train is not found in the system
GIVEN
A train ID has been extracted but the train is not found in the system
Applied to: Generate Error Message - Train Not Found
WHEN
The system cannot locate the train for seizure processing
THEN
The system generates an error message indicating train not found
Context: A train is found in the system but is already seized
GIVEN
A train is found in the system but is already seized
Applied to: Skip Processing - Already Seized
WHEN
The system checks the current seizure status
THEN
The system skips seizure processing and continues to completion
Context: All seizure processing steps have been completed or skipped appropriately
GIVEN
All seizure processing steps have been completed or skipped appropriately
Applied to: Complete Train Seizure Processing
WHEN
The system reaches the end of seizure processing
THEN
The system completes the train seizure processing and returns control to the main workflow
R-GCX016E-cbl-00193 (+17) File: GCX016E.cbl Train Seizure Release Processing Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Seizure Release Processing':
  • Context - a v9 segment with event code ser is received for a train:
    For Receive SER Disposition Code for Train:
    When the system processes the ser disposition code, then the train seizure release workflow is initiated.
  • Context - an m10 segment contains train identification information:
    For Validate Train ID from M10 Segment:
    When the system processes seizure release for the train, then the train id is extracted and validated from the m10 segment.
  • Context - a train id is provided for seizure release processing:
    For Train Found in System?:
    When the system looks up the train in the train list, then the system determines if the train exists and is valid for processing.
  • Context - a valid train exists in the system:
    For Check Current Train Seizure Status:
    When the system processes a seizure release request, then the current seizure status of the train is retrieved and evaluated.
  • Context - a train's current seizure status has been retrieved:
    For Train Currently Seized?:
    When the system evaluates if seizure release is applicable, then the system determines if the train is currently seized and can be released.
  • Context - a train is currently in seized status:
    For Release Train from Seizure Status:
    When a valid seizure release request is processed, then the train's seizure status is cleared and the train is released.
  • Context - a train has been released from seizure status:
    For Update Train Status Flags:
    When the seizure release processing continues, then all relevant train status flags are updated to reflect the new status.
  • Context - a train seizure release has been successfully processed:
    For Log Seizure Release Action:
    When the system completes the status update, then the seizure release action is logged with relevant details.
  • Context - a train seizure release has been processed:
    For Process Individual Equipment in Train:
    When the system processes associated equipment, then each piece of equipment in the train is individually evaluated for seizure release.
  • Context - individual equipment is being processed for seizure release:
    For Equipment Seized?:
    When the system evaluates each piece of equipment, then the system determines if the equipment is currently in seized status.
  • Context - equipment is currently in seized status:
    For Release Equipment from Seizure:
    When the train seizure release is processed, then the individual equipment is released from seizure status.
  • Context - equipment has been released from seizure:
    For Update Equipment Seizure Counter:
    When the seizure release processing continues, then the equipment seizure counter is updated to reflect the release.
  • Context - current equipment processing is complete:
    For Continue to Next Equipment:
    When more equipment exists in the train, then the system moves to process the next piece of equipment.
  • Context - all equipment in the train has been processed for seizure release:
    For Generate Train Seizure Release Notification:
    When the seizure release processing is complete, then a train seizure release notification is generated.
  • Context - a train seizure release notification has been generated:
    For Send Notification to Business Users:
    When the notification is ready for distribution, then the notification is sent to appropriate business users.
  • Context - a train id is provided for seizure release:
    For Generate Train Not Found Error:
    When the train cannot be found in the system, then a train not found error is generated and processing stops.
  • Context - a train exists but is not currently in seized status:
    For Log Warning - Train Not Seized:
    When a seizure release request is processed, then a warning is logged indicating the train is not seized and processing continues.
  • Context - all seizure release processing steps have been executed:
    For Complete Seizure Release Processing:
    When the workflow reaches completion, then the seizure release processing is marked as complete.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with event code SER is received for a train
GIVEN
A V9 segment with event code SER is received for a train
Applied to: Receive SER Disposition Code for Train
WHEN
The system processes the SER disposition code
THEN
The train seizure release workflow is initiated
Context: An M10 segment contains train identification information
GIVEN
An M10 segment contains train identification information
Applied to: Validate Train ID from M10 Segment
WHEN
The system processes seizure release for the train
THEN
The train ID is extracted and validated from the M10 segment
Context: A train ID is provided for seizure release processing
GIVEN
A train ID is provided for seizure release processing
Applied to: Train Found in System?
WHEN
The system looks up the train in the train list
THEN
The system determines if the train exists and is valid for processing
Context: A valid train exists in the system
GIVEN
A valid train exists in the system
Applied to: Check Current Train Seizure Status
WHEN
The system processes a seizure release request
THEN
The current seizure status of the train is retrieved and evaluated
Context: A train's current seizure status has been retrieved
GIVEN
A train's current seizure status has been retrieved
Applied to: Train Currently Seized?
WHEN
The system evaluates if seizure release is applicable
THEN
The system determines if the train is currently seized and can be released
Context: A train is currently in seized status
GIVEN
A train is currently in seized status
Applied to: Release Train from Seizure Status
WHEN
A valid seizure release request is processed
THEN
The train's seizure status is cleared and the train is released
Context: A train has been released from seizure status
GIVEN
A train has been released from seizure status
Applied to: Update Train Status Flags
WHEN
The seizure release processing continues
THEN
All relevant train status flags are updated to reflect the new status
Context: A train seizure release has been successfully processed
GIVEN
A train seizure release has been successfully processed
Applied to: Log Seizure Release Action
WHEN
The system completes the status update
THEN
The seizure release action is logged with relevant details
Context: A train seizure release has been processed
GIVEN
A train seizure release has been processed
Applied to: Process Individual Equipment in Train
WHEN
The system processes associated equipment
THEN
Each piece of equipment in the train is individually evaluated for seizure release
Context: Individual equipment is being processed for seizure release
GIVEN
Individual equipment is being processed for seizure release
Applied to: Equipment Seized?
WHEN
The system evaluates each piece of equipment
THEN
The system determines if the equipment is currently in seized status
Context: Equipment is currently in seized status
GIVEN
Equipment is currently in seized status
Applied to: Release Equipment from Seizure
WHEN
The train seizure release is processed
THEN
The individual equipment is released from seizure status
Context: Equipment has been released from seizure
GIVEN
Equipment has been released from seizure
Applied to: Update Equipment Seizure Counter
WHEN
The seizure release processing continues
THEN
The equipment seizure counter is updated to reflect the release
Context: Current equipment processing is complete
GIVEN
Current equipment processing is complete
Applied to: Continue to Next Equipment
WHEN
More equipment exists in the train
THEN
The system moves to process the next piece of equipment
Context: All equipment in the train has been processed for seizure release
GIVEN
All equipment in the train has been processed for seizure release
Applied to: Generate Train Seizure Release Notification
WHEN
The seizure release processing is complete
THEN
A train seizure release notification is generated
Context: A train seizure release notification has been generated
GIVEN
A train seizure release notification has been generated
Applied to: Send Notification to Business Users
WHEN
The notification is ready for distribution
THEN
The notification is sent to appropriate business users
Context: A train ID is provided for seizure release
GIVEN
A train ID is provided for seizure release
Applied to: Generate Train Not Found Error
WHEN
The train cannot be found in the system
THEN
A train not found error is generated and processing stops
Context: A train exists but is not currently in seized status
GIVEN
A train exists but is not currently in seized status
Applied to: Log Warning - Train Not Seized
WHEN
A seizure release request is processed
THEN
A warning is logged indicating the train is not seized and processing continues
Context: All seizure release processing steps have been executed
GIVEN
All seizure release processing steps have been executed
Applied to: Complete Seizure Release Processing
WHEN
The workflow reaches completion
THEN
The seizure release processing is marked as complete
R-GCX016E-cbl-00211 (+11) File: GCX016E.cbl Train All Clear Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train All Clear Processing':
  • Context - a cae disposition code is received for a specific train:
    For Receive CAE Disposition Code for Train:
    When the system processes the cae event code, then the train all clear processing is initiated.
  • Context - a cae disposition code is being processed for a train:
    For Validate Train Exists in System:
    When the system checks the train list segments, then the train existence is validated against the gcwtl train list.
  • Context - train existence validation has been completed:
    For Train Found?:
    When the system evaluates if the train was found in the train list, then processing continues to set all clear status if train exists, otherwise error processing is initiated.
  • Context - a valid train has been found in the system:
    For Set Train All Clear Status Flag:
    When the cae disposition code is processed, then the train all clear status flag is set to indicate the train is cleared for export.
  • Context - a train all clear status flag has been set:
    For Clear Any Previous Hold Status:
    When the system processes the all clear action, then any previous hold status flags are cleared to ensure clean all clear state.
  • Context - train all clear status has been set and previous holds cleared:
    For Update Train Status in Database:
    When the system commits the status changes, then the train status is updated in the database with the new all clear status.
  • Context - train status has been successfully updated in the database:
    For Log All Clear Action:
    When the all clear processing is completed, then an audit log entry is created documenting the all clear action with timestamp and train details.
  • Context - all clear action has been logged successfully:
    For Generate Merlin Notification Message:
    When the system generates notifications, then a merlin notification message is created containing train details and all clear status information.
  • Context - merlin notification message has been generated:
    For Send All Clear Confirmation:
    When the system sends the notification, then the all clear confirmation is transmitted to the merlin system for distribution.
  • Context - train validation has failed and train was not found:
    For Generate Train Not Found Error:
    When the system processes the validation failure, then a train not found error message is generated with relevant train identification details.
  • Context - train not found error has been generated:
    For Send Error Message to Merlin:
    When the system transmits the error notification, then the error message is sent to merlin system to notify relevant parties of the processing failure.
  • Context - either all clear confirmation has been sent or error message has been transmitted:
    For Process Complete:
    When the processing workflow reaches completion, then the cae all clear processing is marked as complete and control returns to main processing flow.
👨‍💻 Technical ACs (Gherkin)
Context: A CAE disposition code is received for a specific train
GIVEN
A CAE disposition code is received for a specific train
Applied to: Receive CAE Disposition Code for Train
WHEN
The system processes the CAE event code
THEN
The train all clear processing is initiated
Context: A CAE disposition code is being processed for a train
GIVEN
A CAE disposition code is being processed for a train
Applied to: Validate Train Exists in System
WHEN
The system checks the train list segments
THEN
The train existence is validated against the GCWTL train list
Context: Train existence validation has been completed
GIVEN
Train existence validation has been completed
Applied to: Train Found?
WHEN
The system evaluates if the train was found in the train list
THEN
Processing continues to set all clear status if train exists, otherwise error processing is initiated
Context: A valid train has been found in the system
GIVEN
A valid train has been found in the system
Applied to: Set Train All Clear Status Flag
WHEN
The CAE disposition code is processed
THEN
The train all clear status flag is set to indicate the train is cleared for export
Context: A train all clear status flag has been set
GIVEN
A train all clear status flag has been set
Applied to: Clear Any Previous Hold Status
WHEN
The system processes the all clear action
THEN
Any previous hold status flags are cleared to ensure clean all clear state
Context: Train all clear status has been set and previous holds cleared
GIVEN
Train all clear status has been set and previous holds cleared
Applied to: Update Train Status in Database
WHEN
The system commits the status changes
THEN
The train status is updated in the database with the new all clear status
Context: Train status has been successfully updated in the database
GIVEN
Train status has been successfully updated in the database
Applied to: Log All Clear Action
WHEN
The all clear processing is completed
THEN
An audit log entry is created documenting the all clear action with timestamp and train details
Context: All clear action has been logged successfully
GIVEN
All clear action has been logged successfully
Applied to: Generate Merlin Notification Message
WHEN
The system generates notifications
THEN
A Merlin notification message is created containing train details and all clear status information
Context: Merlin notification message has been generated
GIVEN
Merlin notification message has been generated
Applied to: Send All Clear Confirmation
WHEN
The system sends the notification
THEN
The all clear confirmation is transmitted to the Merlin system for distribution
Context: Train validation has failed and train was not found
GIVEN
Train validation has failed and train was not found
Applied to: Generate Train Not Found Error
WHEN
The system processes the validation failure
THEN
A train not found error message is generated with relevant train identification details
Context: Train not found error has been generated
GIVEN
Train not found error has been generated
Applied to: Send Error Message to Merlin
WHEN
The system transmits the error notification
THEN
The error message is sent to Merlin system to notify relevant parties of the processing failure
Context: Either all clear confirmation has been sent or error message has been transmitted
GIVEN
Either all clear confirmation has been sent or error message has been transmitted
Applied to: Process Complete
WHEN
The processing workflow reaches completion
THEN
The CAE all clear processing is marked as complete and control returns to main processing flow
R-GCX016E-cbl-00223 (+13) File: GCX016E.cbl Equipment Hold Release Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Hold Release Processing':
  • Context - a vid segment is received with hre disposition code:
    For Validate Equipment ID in VID Segment:
    When the system processes the vid segment equipment id field, then the equipment id must contain non-blank, valid alphanumeric data to proceed with hold release processing.
  • Context - a valid equipment id from vid segment:
    For Look up Equipment in Train Consist:
    When the system searches the train consist list for the equipment, then the equipment must be found in the train consist to proceed with hold release processing.
  • Context - equipment exists in the train consist:
    For Check Current Equipment Hold Status:
    When the system checks the equipment's current hold status, then the equipment must currently have a hold flag set to proceed with hold release.
  • Context - equipment is currently held with hold flag set:
    For Remove Equipment Hold Flag:
    When hre disposition code is processed for the equipment, then the system removes the hold flag from the equipment record.
  • Context - equipment hold flag has been removed:
    For Update Equipment Status in Train List:
    When the system updates the train list, then the equipment status in the train list is updated to reflect the released status.
  • Context - equipment hold has been successfully released:
    For Decrement Train Hold Counter:
    When the system updates train-level counters, then the train hold counter is decremented by one to reflect the equipment release.
    For Log Equipment Hold Release Action:
    When the system performs logging operations, then an audit record is created documenting the equipment hold release action with timestamp and equipment details.
  • Context - train hold counter has been decremented:
    For All Equipment Released?:
    When the system checks if any equipment remains held, then if train hold counter equals zero, all equipment is considered released; otherwise equipment remains held.
  • Context - all equipment in the train has been released from hold:
    For Update Train Hold Status to Released:
    When the system updates the train status, then the train hold status is set to released.
  • Context - equipment hold release has been logged:
    For Generate Equipment Release Notification:
    When the system generates notifications, then internal notifications are created to inform relevant parties of the equipment release.
  • Context - equipment release notification has been generated:
    For Send Merlin Message for Equipment Release:
    When the system sends external notifications, then a merlin message is sent containing equipment release details to external systems.
  • Context - vid segment contains invalid or blank equipment id:
    For Generate Error - Invalid Equipment ID:
    When equipment id validation fails, then an error is generated indicating invalid equipment id and processing stops.
  • Context - valid equipment id that does not exist in train consist:
    For Generate Error - Equipment Not Found:
    When equipment lookup in train consist fails, then an error is generated indicating equipment not found in train and processing stops.
  • Context - equipment exists in train but is not currently held:
    For Generate Warning - Equipment Not Held:
    When hold release is attempted on non-held equipment, then a warning is generated indicating equipment is not held and processing continues.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment is received with HRE disposition code
GIVEN
A VID segment is received with HRE disposition code
Applied to: Validate Equipment ID in VID Segment
WHEN
The system processes the VID segment equipment ID field
THEN
The equipment ID must contain non-blank, valid alphanumeric data to proceed with hold release processing
Context: A valid equipment ID from VID segment
GIVEN
A valid equipment ID from VID segment
Applied to: Look up Equipment in Train Consist
WHEN
The system searches the train consist list for the equipment
THEN
The equipment must be found in the train consist to proceed with hold release processing
Context: Equipment exists in the train consist
GIVEN
Equipment exists in the train consist
Applied to: Check Current Equipment Hold Status
WHEN
The system checks the equipment's current hold status
THEN
The equipment must currently have a hold flag set to proceed with hold release
Context: Equipment is currently held with hold flag set
GIVEN
Equipment is currently held with hold flag set
Applied to: Remove Equipment Hold Flag
WHEN
HRE disposition code is processed for the equipment
THEN
The system removes the hold flag from the equipment record
Context: Equipment hold flag has been removed
GIVEN
Equipment hold flag has been removed
Applied to: Update Equipment Status in Train List
WHEN
The system updates the train list
THEN
The equipment status in the train list is updated to reflect the released status
Context: Equipment hold has been successfully released
GIVEN
Equipment hold has been successfully released
Applied to: Decrement Train Hold Counter
WHEN
The system updates train-level counters
THEN
The train hold counter is decremented by one to reflect the equipment release
Applied to: Log Equipment Hold Release Action
WHEN
The system performs logging operations
THEN
An audit record is created documenting the equipment hold release action with timestamp and equipment details
Context: Train hold counter has been decremented
GIVEN
Train hold counter has been decremented
Applied to: All Equipment Released?
WHEN
The system checks if any equipment remains held
THEN
If train hold counter equals zero, all equipment is considered released; otherwise equipment remains held
Context: All equipment in the train has been released from hold
GIVEN
All equipment in the train has been released from hold
Applied to: Update Train Hold Status to Released
WHEN
The system updates the train status
THEN
The train hold status is set to released
Context: Equipment hold release has been logged
GIVEN
Equipment hold release has been logged
Applied to: Generate Equipment Release Notification
WHEN
The system generates notifications
THEN
Internal notifications are created to inform relevant parties of the equipment release
Context: Equipment release notification has been generated
GIVEN
Equipment release notification has been generated
Applied to: Send Merlin Message for Equipment Release
WHEN
The system sends external notifications
THEN
A Merlin message is sent containing equipment release details to external systems
Context: VID segment contains invalid or blank equipment ID
GIVEN
VID segment contains invalid or blank equipment ID
Applied to: Generate Error - Invalid Equipment ID
WHEN
Equipment ID validation fails
THEN
An error is generated indicating invalid equipment ID and processing stops
Context: Valid equipment ID that does not exist in train consist
GIVEN
Valid equipment ID that does not exist in train consist
Applied to: Generate Error - Equipment Not Found
WHEN
Equipment lookup in train consist fails
THEN
An error is generated indicating equipment not found in train and processing stops
Context: Equipment exists in train but is not currently held
GIVEN
Equipment exists in train but is not currently held
Applied to: Generate Warning - Equipment Not Held
WHEN
Hold release is attempted on non-held equipment
THEN
A warning is generated indicating equipment is not held and processing continues
R-GCX016E-cbl-00237 (+10) File: GCX016E.cbl Equipment Seizure Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Seizure Processing':
  • Context - a vid segment is received for equipment processing:
    For Disposition Code = SEI?:
    When the system checks the disposition code from the previous x4 segment, then processing continues only if the disposition code equals sei, otherwise the equipment seizure process is skipped.
  • Context - an equipment id has been extracted from the vid segment:
    For Equipment ID Valid?:
    When the system validates the equipment id format, then the equipment id must be in valid format with proper initial and number components, otherwise generate invalid equipment id error.
  • Context - a valid equipment id has been provided for seizure:
    For Equipment Found in Train?:
    When the system searches the train consist for the equipment, then the equipment must exist in the train list, otherwise generate equipment not found error.
  • Context - equipment exists in the train and seizure is requested:
    For Equipment Already Seized?:
    When the system checks the current seizure status of the equipment, then if equipment is already seized, generate equipment already seized error, otherwise proceed with seizure.
  • Context - equipment is found in train and is not currently seized:
    For Set Equipment Seizure Flag:
    When the seizure request is processed, then set the equipment seizure flag to indicate the equipment is now seized.
  • Context - equipment seizure flag has been set:
    For Update Equipment Status in Train List:
    When the system updates the train consist information, then update the equipment status in the train list to show seized status.
  • Context - equipment status has been updated to seized in the train list:
    For Increment Train Seizure Counter:
    When the system updates train-level seizure tracking, then increment the train seizure counter by one to reflect the additional seized equipment.
  • Context - equipment has been successfully seized and counters updated:
    For Log Equipment Seizure Action:
    When the system logs the seizure action, then create a log entry with equipment id, seizure timestamp, and action details for audit purposes.
  • Context - equipment seizure has been logged successfully:
    For Generate Seizure Confirmation Message:
    When the system generates confirmation messaging, then create a seizure confirmation message with equipment details and seizure status.
  • Context - individual equipment has been seized and confirmation message generated:
    For Update Train Status if All Equipment Seized:
    When the system evaluates overall train seizure status, then if all equipment in the train is now seized, update the train status to fully seized, otherwise maintain partial seizure status.
  • Context - train status has been evaluated and updated as needed:
    For Send Equipment Seizure Notification:
    When the system dispatches seizure notifications, then send equipment seizure notification to appropriate recipients including equipment details and seizure confirmation.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment is received for equipment processing
GIVEN
A VID segment is received for equipment processing
Applied to: Disposition Code = SEI?
WHEN
The system checks the disposition code from the previous X4 segment
THEN
Processing continues only if the disposition code equals SEI, otherwise the equipment seizure process is skipped
Context: An equipment ID has been extracted from the VID segment
GIVEN
An equipment ID has been extracted from the VID segment
Applied to: Equipment ID Valid?
WHEN
The system validates the equipment ID format
THEN
The equipment ID must be in valid format with proper initial and number components, otherwise generate invalid equipment ID error
Context: A valid equipment ID has been provided for seizure
GIVEN
A valid equipment ID has been provided for seizure
Applied to: Equipment Found in Train?
WHEN
The system searches the train consist for the equipment
THEN
The equipment must exist in the train list, otherwise generate equipment not found error
Context: Equipment exists in the train and seizure is requested
GIVEN
Equipment exists in the train and seizure is requested
Applied to: Equipment Already Seized?
WHEN
The system checks the current seizure status of the equipment
THEN
If equipment is already seized, generate equipment already seized error, otherwise proceed with seizure
Context: Equipment is found in train and is not currently seized
GIVEN
Equipment is found in train and is not currently seized
Applied to: Set Equipment Seizure Flag
WHEN
The seizure request is processed
THEN
Set the equipment seizure flag to indicate the equipment is now seized
Context: Equipment seizure flag has been set
GIVEN
Equipment seizure flag has been set
Applied to: Update Equipment Status in Train List
WHEN
The system updates the train consist information
THEN
Update the equipment status in the train list to show seized status
Context: Equipment status has been updated to seized in the train list
GIVEN
Equipment status has been updated to seized in the train list
Applied to: Increment Train Seizure Counter
WHEN
The system updates train-level seizure tracking
THEN
Increment the train seizure counter by one to reflect the additional seized equipment
Context: Equipment has been successfully seized and counters updated
GIVEN
Equipment has been successfully seized and counters updated
Applied to: Log Equipment Seizure Action
WHEN
The system logs the seizure action
THEN
Create a log entry with equipment ID, seizure timestamp, and action details for audit purposes
Context: Equipment seizure has been logged successfully
GIVEN
Equipment seizure has been logged successfully
Applied to: Generate Seizure Confirmation Message
WHEN
The system generates confirmation messaging
THEN
Create a seizure confirmation message with equipment details and seizure status
Context: Individual equipment has been seized and confirmation message generated
GIVEN
Individual equipment has been seized and confirmation message generated
Applied to: Update Train Status if All Equipment Seized
WHEN
The system evaluates overall train seizure status
THEN
If all equipment in the train is now seized, update the train status to fully seized, otherwise maintain partial seizure status
Context: Train status has been evaluated and updated as needed
GIVEN
Train status has been evaluated and updated as needed
Applied to: Send Equipment Seizure Notification
WHEN
The system dispatches seizure notifications
THEN
Send equipment seizure notification to appropriate recipients including equipment details and seizure confirmation
R-GCX016E-cbl-00248 (+14) File: GCX016E.cbl Equipment Seizure Release Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Seizure Release Processing':
  • Context - a ser disposition code is received for equipment seizure release:
    For Receive SER Disposition Code for Equipment:
    When the system processes the disposition code request, then the system initiates equipment seizure release processing workflow.
  • Context - a vid segment contains equipment identification data:
    For Process VID Segment for Equipment ID:
    When the system processes the vid segment, then the equipment id is extracted and prepared for seizure release validation.
  • Context - an equipment id is provided for seizure release:
    For Equipment Found in Train?:
    When the system searches for the equipment in the train equipment list, then the system determines if the equipment exists in the train and proceeds accordingly or generates equipment not found error.
  • Context - equipment exists in the train consist:
    For Validate Equipment Seizure Status:
    When the system validates the equipment's current seizure status, then the system determines if the equipment is currently seized and eligible for release.
  • Context - equipment seizure status has been validated:
    For Equipment Currently Seized?:
    When the system checks if the equipment is currently seized, then the system proceeds with seizure release if equipment is seized or generates warning if equipment is not seized.
  • Context - equipment is currently seized and eligible for release:
    For Remove Equipment Seizure Flag:
    When the system processes the seizure release request, then the seizure flag is removed from the equipment record.
  • Context - equipment seizure flag has been removed:
    For Update Equipment Status in Train:
    When the system updates the train equipment list, then the equipment status is updated to reflect the seizure release in the train consist.
  • Context - equipment status has been updated in the train:
    For Decrement Train Seizure Counter:
    When the system processes the seizure release, then the train seizure counter is decremented by one.
  • Context - train seizure counter has been decremented:
    For All Equipment Released from Seizure?:
    When the system checks if any equipment remains seized in the train, then the system determines if all equipment is released from seizure and proceeds accordingly.
  • Context - all equipment in the train has been released from seizure:
    For Clear Train Seizure Status:
    When the system processes the final seizure release, then the train seizure status is cleared and the train is no longer considered seized.
  • Context - equipment seizure release has been processed:
    For Log Equipment Seizure Release Action:
    When the system completes the seizure release action, then the seizure release action is logged with equipment details and timestamp.
  • Context - equipment seizure release action has been logged:
    For Generate Merlin Notification Message:
    When the system prepares external notifications, then a merlin notification message is generated with seizure release details.
  • Context - merlin notification message has been generated:
    For Send Equipment Release Notification:
    When the system sends external notifications, then the equipment seizure release notification is transmitted to relevant external systems.
  • Context - equipment id is provided for seizure release:
    For Generate Error - Equipment Not Found:
    When the equipment cannot be found in the train equipment list, then an equipment not found error is generated and processing terminates.
  • Context - equipment exists in the train but is not currently seized:
    For Generate Warning - Equipment Not Seized:
    When a seizure release request is processed for non-seized equipment, then a warning is generated indicating equipment is not seized and processing continues.
👨‍💻 Technical ACs (Gherkin)
Context: A SER disposition code is received for equipment seizure release
GIVEN
A SER disposition code is received for equipment seizure release
Applied to: Receive SER Disposition Code for Equipment
WHEN
The system processes the disposition code request
THEN
The system initiates equipment seizure release processing workflow
Context: A VID segment contains equipment identification data
GIVEN
A VID segment contains equipment identification data
Applied to: Process VID Segment for Equipment ID
WHEN
The system processes the VID segment
THEN
The equipment ID is extracted and prepared for seizure release validation
Context: An equipment ID is provided for seizure release
GIVEN
An equipment ID is provided for seizure release
Applied to: Equipment Found in Train?
WHEN
The system searches for the equipment in the train equipment list
THEN
The system determines if the equipment exists in the train and proceeds accordingly or generates equipment not found error
Context: Equipment exists in the train consist
GIVEN
Equipment exists in the train consist
Applied to: Validate Equipment Seizure Status
WHEN
The system validates the equipment's current seizure status
THEN
The system determines if the equipment is currently seized and eligible for release
Context: Equipment seizure status has been validated
GIVEN
Equipment seizure status has been validated
Applied to: Equipment Currently Seized?
WHEN
The system checks if the equipment is currently seized
THEN
The system proceeds with seizure release if equipment is seized or generates warning if equipment is not seized
Context: Equipment is currently seized and eligible for release
GIVEN
Equipment is currently seized and eligible for release
Applied to: Remove Equipment Seizure Flag
WHEN
The system processes the seizure release request
THEN
The seizure flag is removed from the equipment record
Context: Equipment seizure flag has been removed
GIVEN
Equipment seizure flag has been removed
Applied to: Update Equipment Status in Train
WHEN
The system updates the train equipment list
THEN
The equipment status is updated to reflect the seizure release in the train consist
Context: Equipment status has been updated in the train
GIVEN
Equipment status has been updated in the train
Applied to: Decrement Train Seizure Counter
WHEN
The system processes the seizure release
THEN
The train seizure counter is decremented by one
Context: Train seizure counter has been decremented
GIVEN
Train seizure counter has been decremented
Applied to: All Equipment Released from Seizure?
WHEN
The system checks if any equipment remains seized in the train
THEN
The system determines if all equipment is released from seizure and proceeds accordingly
Context: All equipment in the train has been released from seizure
GIVEN
All equipment in the train has been released from seizure
Applied to: Clear Train Seizure Status
WHEN
The system processes the final seizure release
THEN
The train seizure status is cleared and the train is no longer considered seized
Context: Equipment seizure release has been processed
GIVEN
Equipment seizure release has been processed
Applied to: Log Equipment Seizure Release Action
WHEN
The system completes the seizure release action
THEN
The seizure release action is logged with equipment details and timestamp
Context: Equipment seizure release action has been logged
GIVEN
Equipment seizure release action has been logged
Applied to: Generate Merlin Notification Message
WHEN
The system prepares external notifications
THEN
A Merlin notification message is generated with seizure release details
Context: Merlin notification message has been generated
GIVEN
Merlin notification message has been generated
Applied to: Send Equipment Release Notification
WHEN
The system sends external notifications
THEN
The equipment seizure release notification is transmitted to relevant external systems
Context: Equipment ID is provided for seizure release
GIVEN
Equipment ID is provided for seizure release
Applied to: Generate Error - Equipment Not Found
WHEN
The equipment cannot be found in the train equipment list
THEN
An equipment not found error is generated and processing terminates
Context: Equipment exists in the train but is not currently seized
GIVEN
Equipment exists in the train but is not currently seized
Applied to: Generate Warning - Equipment Not Seized
WHEN
A seizure release request is processed for non-seized equipment
THEN
A warning is generated indicating equipment is not seized and processing continues
R-GCX016E-cbl-00263 (+8) File: GCX016E.cbl Export Manifest Train Arrival Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Manifest Train Arrival':
  • Context - a train arrival event is received with pod or aad disposition code and train id has been extracted from m10 vessel name segment:
    For Train ID ends with 'T'?:
    When the system checks the last character of the train id, then if the train id ends with 't', identify as export manifest train, otherwise identify as import manifest train.
  • Context - train id ends with 't' indicating export manifest train:
    For Identify as Export Manifest Train:
    When the system processes the train identification, then set train type as export manifest and proceed to port validation for export processing.
  • Context - train id does not end with 't':
    For Identify as Import Manifest Train:
    When the system processes the train identification, then set train type as import manifest and route to standard import processing workflow.
  • Context - export manifest train has been identified and arrival port has been extracted from p4 location segment:
    For Port Designated for Export Manifests?:
    When the system validates the port designation, then if port is designated for export manifests, proceed with export processing, otherwise route to standard import processing.
  • Context - export manifest train has been validated and port is designated for export processing:
    For Set Export Manifest Train Status:
    When the system processes the export manifest train arrival, then set train status to export manifest arrived and prepare for subsequent processing steps.
  • Context - export manifest train status has been set and v9 segment contains arrival date/time information:
    For Update Train Arrival Date from V9 Segment:
    When the system processes the arrival date update, then extract and record the arrival date and time from v9 segment into the train record.
  • Context - export manifest train arrival date has been updated successfully:
    For Log Export Manifest Train Arrival:
    When the system completes the arrival processing, then create audit log entry recording the export manifest train arrival with train id, port, and arrival timestamp.
  • Context - export manifest train arrival has been logged successfully:
    For Generate Export Manifest Arrival Notification:
    When the system generates arrival notifications, then create and send export manifest arrival notification containing train details, arrival information, and routing to appropriate recipients.
  • Context - train is identified as import type or export train port is not designated for export processing:
    For Route to Standard Import Processing:
    When the system determines processing route, then route train to standard import processing workflow and complete processing according to import procedures.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event is received with POD or AAD disposition code and train ID has been extracted from M10 vessel name segment
GIVEN
A train arrival event is received with POD or AAD disposition code and train ID has been extracted from M10 vessel name segment
Applied to: Train ID ends with 'T'?
WHEN
The system checks the last character of the train ID
THEN
If the train ID ends with 'T', identify as export manifest train, otherwise identify as import manifest train
Context: Train ID ends with 'T' indicating export manifest train
GIVEN
Train ID ends with 'T' indicating export manifest train
Applied to: Identify as Export Manifest Train
WHEN
The system processes the train identification
THEN
Set train type as export manifest and proceed to port validation for export processing
Context: Train ID does not end with 'T'
GIVEN
Train ID does not end with 'T'
Applied to: Identify as Import Manifest Train
WHEN
The system processes the train identification
THEN
Set train type as import manifest and route to standard import processing workflow
Context: Export manifest train has been identified and arrival port has been extracted from P4 location segment
GIVEN
Export manifest train has been identified and arrival port has been extracted from P4 location segment
Applied to: Port Designated for Export Manifests?
WHEN
The system validates the port designation
THEN
If port is designated for export manifests, proceed with export processing, otherwise route to standard import processing
Context: Export manifest train has been validated and port is designated for export processing
GIVEN
Export manifest train has been validated and port is designated for export processing
Applied to: Set Export Manifest Train Status
WHEN
The system processes the export manifest train arrival
THEN
Set train status to export manifest arrived and prepare for subsequent processing steps
Context: Export manifest train status has been set and V9 segment contains arrival date/time information
GIVEN
Export manifest train status has been set and V9 segment contains arrival date/time information
Applied to: Update Train Arrival Date from V9 Segment
WHEN
The system processes the arrival date update
THEN
Extract and record the arrival date and time from V9 segment into the train record
Context: Export manifest train arrival date has been updated successfully
GIVEN
Export manifest train arrival date has been updated successfully
Applied to: Log Export Manifest Train Arrival
WHEN
The system completes the arrival processing
THEN
Create audit log entry recording the export manifest train arrival with train ID, port, and arrival timestamp
Context: Export manifest train arrival has been logged successfully
GIVEN
Export manifest train arrival has been logged successfully
Applied to: Generate Export Manifest Arrival Notification
WHEN
The system generates arrival notifications
THEN
Create and send export manifest arrival notification containing train details, arrival information, and routing to appropriate recipients
Context: Train is identified as import type OR export train port is not designated for export processing
GIVEN
Train is identified as import type OR export train port is not designated for export processing
Applied to: Route to Standard Import Processing
WHEN
The system determines processing route
THEN
Route train to standard import processing workflow and complete processing according to import procedures
R-GCX016E-cbl-00272 (+9) File: GCX016E.cbl Import Manifest Train Arrival Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Import Manifest Train Arrival':
  • Context - a train arrival event (pod/aad disposition code) is being processed:
    For Train ID Suffix Check:
    When the system checks the train id suffix, then if train id ends with suffix 't', route to export manifest processing, otherwise route to import manifest processing.
  • Context - a train is being processed for import manifest arrival:
    For Set Train Arrival Status:
    When the train arrival status needs to be established, then set the train arrival status flag to indicate the train has arrived for import processing.
  • Context - a train arrival is being processed and v9 segment contains date/time information:
    For Update Train Arrival Date from V9 Segment:
    When the train arrival date needs to be recorded, then extract and set the train arrival date from the v9 segment timestamp.
  • Context - a train is arriving and may have an existing hold status:
    For Clear Train Hold Status if Held:
    When the train arrival is being processed, then if the train is currently held, clear the hold status to allow normal processing.
  • Context - a train has completed arrival processing steps:
    For Set Train as Arrived in System:
    When the system needs to record the train's arrived status, then set the system flag to indicate the train is now arrived and available for cargo operations.
  • Context - a train has arrived and contains us cargo manifests:
    For Process US Cargo Arrival Notifications:
    When cargo arrival notifications need to be processed, then process arrival notifications for all us cargos associated with this train.
  • Context - a train has arrived and aei notification is configured:
    For Send AEI Messages for Train Arrival:
    When external systems need to be notified of the train arrival, then generate and send aei messages containing train arrival information to configured recipients.
  • Context - a train arrival has been processed:
    For Update Train Status Flags:
    When train status information needs to be updated in the system, then update all relevant train status flags including arrival status, hold status, and operational flags.
  • Context - a train arrival has been successfully processed:
    For Log Train Arrival Action:
    When system audit trail needs to be maintained, then create log entry documenting the train arrival action with timestamp and relevant details.
  • Context - a train arrival has been completely processed:
    For Generate Train Arrival Confirmation:
    When confirmation of successful processing is required, then generate train arrival confirmation message with processing results and status.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event (POD/AAD disposition code) is being processed
GIVEN
A train arrival event (POD/AAD disposition code) is being processed
Applied to: Train ID Suffix Check
WHEN
The system checks the train ID suffix
THEN
If train ID ends with suffix 'T', route to export manifest processing, otherwise route to import manifest processing
Context: A train is being processed for import manifest arrival
GIVEN
A train is being processed for import manifest arrival
Applied to: Set Train Arrival Status
WHEN
The train arrival status needs to be established
THEN
Set the train arrival status flag to indicate the train has arrived for import processing
Context: A train arrival is being processed and V9 segment contains date/time information
GIVEN
A train arrival is being processed and V9 segment contains date/time information
Applied to: Update Train Arrival Date from V9 Segment
WHEN
The train arrival date needs to be recorded
THEN
Extract and set the train arrival date from the V9 segment timestamp
Context: A train is arriving and may have an existing hold status
GIVEN
A train is arriving and may have an existing hold status
Applied to: Clear Train Hold Status if Held
WHEN
The train arrival is being processed
THEN
If the train is currently held, clear the hold status to allow normal processing
Context: A train has completed arrival processing steps
GIVEN
A train has completed arrival processing steps
Applied to: Set Train as Arrived in System
WHEN
The system needs to record the train's arrived status
THEN
Set the system flag to indicate the train is now arrived and available for cargo operations
Context: A train has arrived and contains US cargo manifests
GIVEN
A train has arrived and contains US cargo manifests
Applied to: Process US Cargo Arrival Notifications
WHEN
Cargo arrival notifications need to be processed
THEN
Process arrival notifications for all US cargos associated with this train
Context: A train has arrived and AEI notification is configured
GIVEN
A train has arrived and AEI notification is configured
Applied to: Send AEI Messages for Train Arrival
WHEN
External systems need to be notified of the train arrival
THEN
Generate and send AEI messages containing train arrival information to configured recipients
Context: A train arrival has been processed
GIVEN
A train arrival has been processed
Applied to: Update Train Status Flags
WHEN
Train status information needs to be updated in the system
THEN
Update all relevant train status flags including arrival status, hold status, and operational flags
Context: A train arrival has been successfully processed
GIVEN
A train arrival has been successfully processed
Applied to: Log Train Arrival Action
WHEN
System audit trail needs to be maintained
THEN
Create log entry documenting the train arrival action with timestamp and relevant details
Context: A train arrival has been completely processed
GIVEN
A train arrival has been completely processed
Applied to: Generate Train Arrival Confirmation
WHEN
Confirmation of successful processing is required
THEN
Generate train arrival confirmation message with processing results and status
R-GCX016E-cbl-00282 (+14) File: GCX016E.cbl Export Manifest Port Validation Merged 15 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Manifest Port Validation':
  • Context - a train arrival event is received with a train id:
    For Train ID has 'T' suffix?:
    When the system checks if the train id has a 't' suffix, then the train is classified as export manifest if suffix is 't', otherwise as import manifest and if train id has 't' suffix, identify as export manifest train, otherwise route to standard import processing.
  • Context - an export manifest train arrives at a specific port and the port code is extracted from p4 location segment:
    For Port Designated for Export Manifests?:
    When the system looks up the port in the export manifest port configuration table, then the port is validated as authorized for export manifests if found in the table, otherwise validation fails.
  • Context - an export manifest train arrives at a port and the port is validated as authorized for export manifests:
    For Set Export Manifest Port Flag:
    When the port validation succeeds, then the system sets the export manifest port flag and continues with export manifest processing.
  • Context - an export manifest train arrives at a port and the port is not found in the export manifest port configuration table:
    For Generate Port Validation Error:
    When the port validation fails, then the system generates a port validation error and logs the invalid port for export manifest incident.
  • Context - a train arrival event is received and either the train id does not have 't' suffix or the export manifest port validation fails:
    For Route to Standard Import Processing:
    When the train is classified as import manifest or export port validation fails, then the system routes the train to standard import processing workflow.
  • Context - a train id has been validated to contain a 't' suffix:
    For Identify as Export Manifest Train:
    When the system processes the train classification, then the train is identified and flagged as an export manifest train for export-specific business rule application.
  • Context - an export manifest train has been identified:
    For Extract Arrival Port from P4 Segment:
    When the system processes the p4 location segment, then the arrival port information is extracted from the p4 segment for further validation.
  • Context - an arrival port has been extracted from the p4 segment:
    For Lookup Port Configuration in System Tables:
    When the system looks up the port configuration in system tables, then port configuration data is retrieved to determine export manifest processing eligibility.
  • Context - port configuration data has been retrieved from system tables:
    For Port Designated for Export Manifests?:
    When the system checks if the port is designated for export manifests, then if port is designated for export manifests, proceed with export processing, otherwise generate port validation error.
  • Context - the arrival port has been validated as designated for export manifests:
    For Apply Export Manifest Business Rules:
    When the system applies export manifest business rules, then export-specific business rules are applied to the manifest processing workflow.
  • Context - export manifest business rules have been applied successfully:
    For Process as Export Manifest Arrival:
    When the system processes the export manifest arrival, then the train arrival is processed using export manifest specific procedures and status updates.
  • Context - the arrival port is not designated for export manifests:
    For Generate Port Validation Error:
    When the system generates a port validation error, then a port validation error is created indicating the port cannot process export manifests.
  • Context - a train id does not have a 't' suffix:
    For Route to Standard Import Processing:
    When the system routes the processing, then the train is routed to standard import processing workflow instead of export processing.
  • Context - port validation processing has been completed (either successful export processing, error generation, or import routing):
    For Log Port Validation Result:
    When the system logs the validation result, then the port validation result and processing outcome are logged for audit trail and system monitoring.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event is received with a train ID
GIVEN
A train arrival event is received with a train ID
Applied to: Train ID has 'T' suffix?
WHEN
The system checks if the train ID has a 'T' suffix
THEN
The train is classified as export manifest if suffix is 'T', otherwise as import manifest AND If train ID has 'T' suffix, identify as export manifest train, otherwise route to standard import processing
Context: An export manifest train arrives at a specific port AND the port code is extracted from P4 location segment
GIVEN
An export manifest train arrives at a specific port AND the port code is extracted from P4 location segment
Applied to: Port Designated for Export Manifests?
WHEN
The system looks up the port in the export manifest port configuration table
THEN
The port is validated as authorized for export manifests if found in the table, otherwise validation fails
Context: An export manifest train arrives at a port AND the port is validated as authorized for export manifests
GIVEN
An export manifest train arrives at a port AND the port is validated as authorized for export manifests
Applied to: Set Export Manifest Port Flag
WHEN
The port validation succeeds
THEN
The system sets the export manifest port flag and continues with export manifest processing
Context: An export manifest train arrives at a port AND the port is not found in the export manifest port configuration table
GIVEN
An export manifest train arrives at a port AND the port is not found in the export manifest port configuration table
Applied to: Generate Port Validation Error
WHEN
The port validation fails
THEN
The system generates a port validation error and logs the invalid port for export manifest incident
Context: A train arrival event is received AND either the train ID does not have 'T' suffix OR the export manifest port validation fails
GIVEN
A train arrival event is received AND either the train ID does not have 'T' suffix OR the export manifest port validation fails
Applied to: Route to Standard Import Processing
WHEN
The train is classified as import manifest or export port validation fails
THEN
The system routes the train to standard import processing workflow
Context: A train ID has been validated to contain a 'T' suffix
GIVEN
A train ID has been validated to contain a 'T' suffix
Applied to: Identify as Export Manifest Train
WHEN
The system processes the train classification
THEN
The train is identified and flagged as an export manifest train for export-specific business rule application
Context: An export manifest train has been identified
GIVEN
An export manifest train has been identified
Applied to: Extract Arrival Port from P4 Segment
WHEN
The system processes the P4 location segment
THEN
The arrival port information is extracted from the P4 segment for further validation
Context: An arrival port has been extracted from the P4 segment
GIVEN
An arrival port has been extracted from the P4 segment
Applied to: Lookup Port Configuration in System Tables
WHEN
The system looks up the port configuration in system tables
THEN
Port configuration data is retrieved to determine export manifest processing eligibility
Context: Port configuration data has been retrieved from system tables
GIVEN
Port configuration data has been retrieved from system tables
Applied to: Port Designated for Export Manifests?
WHEN
The system checks if the port is designated for export manifests
THEN
If port is designated for export manifests, proceed with export processing, otherwise generate port validation error
Context: The arrival port has been validated as designated for export manifests
GIVEN
The arrival port has been validated as designated for export manifests
Applied to: Apply Export Manifest Business Rules
WHEN
The system applies export manifest business rules
THEN
Export-specific business rules are applied to the manifest processing workflow
Context: Export manifest business rules have been applied successfully
GIVEN
Export manifest business rules have been applied successfully
Applied to: Process as Export Manifest Arrival
WHEN
The system processes the export manifest arrival
THEN
The train arrival is processed using export manifest specific procedures and status updates
Context: The arrival port is not designated for export manifests
GIVEN
The arrival port is not designated for export manifests
Applied to: Generate Port Validation Error
WHEN
The system generates a port validation error
THEN
A port validation error is created indicating the port cannot process export manifests
Context: A train ID does not have a 'T' suffix
GIVEN
A train ID does not have a 'T' suffix
Applied to: Route to Standard Import Processing
WHEN
The system routes the processing
THEN
The train is routed to standard import processing workflow instead of export processing
Context: Port validation processing has been completed (either successful export processing, error generation, or import routing)
GIVEN
Port validation processing has been completed (either successful export processing, error generation, or import routing)
Applied to: Log Port Validation Result
WHEN
The system logs the validation result
THEN
The port validation result and processing outcome are logged for audit trail and system monitoring
R-GCX016E-cbl-00287 (+11) File: GCX016E.cbl AEI Notification Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AEI Notification Processing':
  • Context - a train arrival event has been detected:
    For Train Type?:
    When the system evaluates the train's manifest type, then the train is classified as either export manifest train (suffix 't') or import manifest train for appropriate aei processing.
  • Context - an export manifest train has arrived at a port:
    For Port Valid for Export?:
    When the system validates the port's export processing capabilities, then the port is either confirmed as valid for export processing or flagged as invalid, determining the processing path.
  • Context - an export manifest train has arrived and the port is valid for export processing:
    For Process Export Manifest Arrival:
    When the system processes the export manifest arrival, then export-specific aei processing is initiated with appropriate export manifest handling procedures.
  • Context - either an import manifest train has arrived or an export train has arrived at a port invalid for export processing:
    For Process Import Manifest Arrival:
    When the system processes the manifest arrival, then import-specific aei processing is initiated with appropriate import manifest handling procedures.
  • Context - a train arrival has been processed (either export or import):
    For Identify US Cargo on Train:
    When the system scans the train's cargo manifest, then all us cargo shipments on the train are identified and flagged for aei notification processing.
  • Context - us cargo has been identified on an arriving train:
    For Generate AEI Arrival Messages:
    When the system generates aei arrival messages, then automatic equipment identification messages are created containing arrival details for each us cargo shipment.
  • Context - aei arrival messages have been generated:
    For Send Equipment Identification Data:
    When the system sends equipment identification data, then equipment identification information is transmitted to designated recipients and systems.
  • Context - equipment identification data has been sent:
    For Create Email Notifications:
    When the system creates email notifications, then email notifications are generated with aei arrival details for appropriate distribution.
  • Context - email notifications have been created:
    For Distribute AEI Messages:
    When the system distributes aei messages, then all aei messages and notifications are sent to their designated recipients and integrated systems.
  • Context - aei messages have been distributed:
    For Log AEI Processing Actions:
    When the system logs aei processing actions, then all aei notification activities are recorded in the system log for audit and tracking purposes.
  • Context - aei processing actions have been logged:
    For Update Train Arrival Status:
    When the system updates train arrival status, then the train's status is updated to indicate successful completion of aei notification processing.
  • Context - train arrival status has been updated:
    For Complete AEI Notification Processing:
    When the system completes aei notification processing, then all aei notification processing activities are finalized and the workflow is marked as complete.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event has been detected
GIVEN
A train arrival event has been detected
Applied to: Train Type?
WHEN
The system evaluates the train's manifest type
THEN
The train is classified as either export manifest train (suffix 'T') or import manifest train for appropriate AEI processing
Context: An export manifest train has arrived at a port
GIVEN
An export manifest train has arrived at a port
Applied to: Port Valid for Export?
WHEN
The system validates the port's export processing capabilities
THEN
The port is either confirmed as valid for export processing or flagged as invalid, determining the processing path
Context: An export manifest train has arrived and the port is valid for export processing
GIVEN
An export manifest train has arrived and the port is valid for export processing
Applied to: Process Export Manifest Arrival
WHEN
The system processes the export manifest arrival
THEN
Export-specific AEI processing is initiated with appropriate export manifest handling procedures
Context: Either an import manifest train has arrived or an export train has arrived at a port invalid for export processing
GIVEN
Either an import manifest train has arrived or an export train has arrived at a port invalid for export processing
Applied to: Process Import Manifest Arrival
WHEN
The system processes the manifest arrival
THEN
Import-specific AEI processing is initiated with appropriate import manifest handling procedures
Context: A train arrival has been processed (either export or import)
GIVEN
A train arrival has been processed (either export or import)
Applied to: Identify US Cargo on Train
WHEN
The system scans the train's cargo manifest
THEN
All US cargo shipments on the train are identified and flagged for AEI notification processing
Context: US cargo has been identified on an arriving train
GIVEN
US cargo has been identified on an arriving train
Applied to: Generate AEI Arrival Messages
WHEN
The system generates AEI arrival messages
THEN
Automatic Equipment Identification messages are created containing arrival details for each US cargo shipment
Context: AEI arrival messages have been generated
GIVEN
AEI arrival messages have been generated
Applied to: Send Equipment Identification Data
WHEN
The system sends equipment identification data
THEN
Equipment identification information is transmitted to designated recipients and systems
Context: Equipment identification data has been sent
GIVEN
Equipment identification data has been sent
Applied to: Create Email Notifications
WHEN
The system creates email notifications
THEN
Email notifications are generated with AEI arrival details for appropriate distribution
Context: Email notifications have been created
GIVEN
Email notifications have been created
Applied to: Distribute AEI Messages
WHEN
The system distributes AEI messages
THEN
All AEI messages and notifications are sent to their designated recipients and integrated systems
Context: AEI messages have been distributed
GIVEN
AEI messages have been distributed
Applied to: Log AEI Processing Actions
WHEN
The system logs AEI processing actions
THEN
All AEI notification activities are recorded in the system log for audit and tracking purposes
Context: AEI processing actions have been logged
GIVEN
AEI processing actions have been logged
Applied to: Update Train Arrival Status
WHEN
The system updates train arrival status
THEN
The train's status is updated to indicate successful completion of AEI notification processing
Context: Train arrival status has been updated
GIVEN
Train arrival status has been updated
Applied to: Complete AEI Notification Processing
WHEN
The system completes AEI notification processing
THEN
All AEI notification processing activities are finalized and the workflow is marked as complete
R-GCX016E-cbl-00299 (+11) File: GCX016E.cbl Cargo Processing by Bond Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Processing by Bond':
  • Context - an x4 segment contains disposition code information with bond number data:
    For Extract Bond Number from X4 Segment:
    When the system processes the x4 segment for bond-based cargo processing, then the bond number is extracted and stored for subsequent cargo lookup operations.
  • Context - a valid customs bond number has been extracted from the x4 segment:
    For 126: Cargo Database Lookup by Bond Number:
    When the system performs a database lookup using the bond number as search criteria, then all cargo records matching the bond number are identified and made available for processing.
  • Context - a database lookup has been performed using a customs bond number:
    For Cargo Records Found?:
    When the system evaluates the search results, then if cargo records are found, processing continues with the first record; if no records are found, bond processing is terminated.
  • Context - cargo records exist for the specified bond number:
    For Retrieve First Cargo Record by Bond:
    When the system begins processing cargo records for the bond, then the first cargo record is retrieved and prepared for individual cargo processing.
  • Context - a cargo record has been retrieved for processing:
    For Process Individual Cargo Record:
    When the system processes the individual cargo record, then the cargo record is prepared for disposition code application and status updates.
  • Context - a cargo record is being processed and a disposition code exists from the x4 segment:
    For Apply Disposition Code to Cargo:
    When the system applies the disposition code to the cargo, then the disposition code is processed according to its type (hold, release, proceed, etc.) and appropriate cargo actions are determined.
  • Context - a disposition code has been applied to a cargo record:
    For Update Cargo Status:
    When the system updates the cargo status, then the cargo status is modified according to the disposition code requirements and status change records are created.
  • Context - one cargo record has been processed for a bond number:
    For Check for Additional Cargo Records:
    When the system checks for additional cargo records with the same bond, then the system identifies whether more cargo records exist for continued processing.
  • Context - the system has checked for additional cargo records with the same bond number:
    For More Cargo with Same Bond?:
    When the evaluation determines if more records exist, then if more records exist, processing continues with the next record; if no more records exist, bond processing summary is generated.
  • Context - additional cargo records exist for the same bond number:
    For Retrieve Next Cargo Record:
    When the system retrieves the next cargo record, then the next cargo record is obtained and prepared for individual cargo processing.
  • Context - all cargo records associated with a bond number have been processed:
    For Generate Bond Processing Summary:
    When the system generates a bond processing summary, then a summary report is created containing details of all cargo records processed and their final status.
  • Context - bond processing summary has been generated:
    For Create Merlin Notification for Bond:
    When the system creates merlin notifications for the bond processing, then appropriate merlin messages are generated and routed to relevant parties regarding the bond processing results.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment contains disposition code information with bond number data
GIVEN
An X4 segment contains disposition code information with bond number data
Applied to: Extract Bond Number from X4 Segment
WHEN
The system processes the X4 segment for bond-based cargo processing
THEN
The bond number is extracted and stored for subsequent cargo lookup operations
Context: A valid customs bond number has been extracted from the X4 segment
GIVEN
A valid customs bond number has been extracted from the X4 segment
Applied to: 126: Cargo Database Lookup by Bond Number
WHEN
The system performs a database lookup using the bond number as search criteria
THEN
All cargo records matching the bond number are identified and made available for processing
Context: A database lookup has been performed using a customs bond number
GIVEN
A database lookup has been performed using a customs bond number
Applied to: Cargo Records Found?
WHEN
The system evaluates the search results
THEN
If cargo records are found, processing continues with the first record; if no records are found, bond processing is terminated
Context: Cargo records exist for the specified bond number
GIVEN
Cargo records exist for the specified bond number
Applied to: Retrieve First Cargo Record by Bond
WHEN
The system begins processing cargo records for the bond
THEN
The first cargo record is retrieved and prepared for individual cargo processing
Context: A cargo record has been retrieved for processing
GIVEN
A cargo record has been retrieved for processing
Applied to: Process Individual Cargo Record
WHEN
The system processes the individual cargo record
THEN
The cargo record is prepared for disposition code application and status updates
Context: A cargo record is being processed and a disposition code exists from the X4 segment
GIVEN
A cargo record is being processed and a disposition code exists from the X4 segment
Applied to: Apply Disposition Code to Cargo
WHEN
The system applies the disposition code to the cargo
THEN
The disposition code is processed according to its type (hold, release, proceed, etc.) and appropriate cargo actions are determined
Context: A disposition code has been applied to a cargo record
GIVEN
A disposition code has been applied to a cargo record
Applied to: Update Cargo Status
WHEN
The system updates the cargo status
THEN
The cargo status is modified according to the disposition code requirements and status change records are created
Context: One cargo record has been processed for a bond number
GIVEN
One cargo record has been processed for a bond number
Applied to: Check for Additional Cargo Records
WHEN
The system checks for additional cargo records with the same bond
THEN
The system identifies whether more cargo records exist for continued processing
Context: The system has checked for additional cargo records with the same bond number
GIVEN
The system has checked for additional cargo records with the same bond number
Applied to: More Cargo with Same Bond?
WHEN
The evaluation determines if more records exist
THEN
If more records exist, processing continues with the next record; if no more records exist, bond processing summary is generated
Context: Additional cargo records exist for the same bond number
GIVEN
Additional cargo records exist for the same bond number
Applied to: Retrieve Next Cargo Record
WHEN
The system retrieves the next cargo record
THEN
The next cargo record is obtained and prepared for individual cargo processing
Context: All cargo records associated with a bond number have been processed
GIVEN
All cargo records associated with a bond number have been processed
Applied to: Generate Bond Processing Summary
WHEN
The system generates a bond processing summary
THEN
A summary report is created containing details of all cargo records processed and their final status
Context: Bond processing summary has been generated
GIVEN
Bond processing summary has been generated
Applied to: Create Merlin Notification for Bond
WHEN
The system creates Merlin notifications for the bond processing
THEN
Appropriate Merlin messages are generated and routed to relevant parties regarding the bond processing results
R-GCX016E-cbl-00311 (+12) File: GCX016E.cbl Cargo Processing by Car/Waybill Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Processing by Car/Waybill':
  • Context - an n7 equipment segment is available for processing:
    For Extract Equipment ID from N7 Segment:
    When the system processes the n7 segment to extract equipment information, then the equipment initial and equipment number are extracted and combined to form the equipment id.
  • Context - an n7 equipment segment contains waybill information:
    For Extract Waybill Number from N7 Segment:
    When the system processes the n7 segment for waybill data, then the waybill number is extracted from the n7 segment.
  • Context - equipment initial and equipment number have been extracted from n7 segment:
    For Format Car ID Using Standard Rules:
    When the system needs to create a standardized car id, then the car id is formatted by combining equipment initial and equipment number according to standard formatting rules.
  • Context - a formatted car id and waybill number are available:
    For Search Cargo Database by Car/Waybill Index:
    When the system searches for existing cargo records, then the system queries the cargo database using the car/waybill index to find matching records.
  • Context - a search has been performed on the cargo database using car id and waybill:
    For Cargo Records Found?:
    When the system evaluates the search results, then the system determines if cargo records were found and routes processing accordingly.
  • Context - cargo records exist for the car id and waybill combination:
    For Retrieve First Cargo Record:
    When the system needs to begin processing cargo records, then the first cargo record matching the criteria is retrieved for processing.
  • Context - a cargo record has been retrieved for processing:
    For Process Individual Cargo Record:
    When the system processes the cargo record, then the cargo record is processed with applicable disposition codes, status updates, and business rule validations.
  • Context - one cargo record has been processed for a car/waybill combination:
    For More Records Exist?:
    When the system checks for additional matching records, then the system determines if more cargo records exist with the same car id and waybill and continues processing if found.
  • Context - additional cargo records exist for the same car id and waybill combination:
    For Retrieve Next Cargo Record:
    When the system continues processing multiple records, then the next cargo record in the sequence is retrieved for processing.
  • Context - a subsequent cargo record has been retrieved for the same car/waybill combination:
    For Process Next Individual Cargo Record:
    When the system processes this additional cargo record, then the cargo record is processed with the same disposition codes, status updates, and business rule validations as previous records.
  • Context - no existing cargo records were found for the car/waybill combination:
    For CPRS Traffic?:
    When the system evaluates the traffic type, then the system determines if this is cprs traffic and routes to appropriate processing.
  • Context - no existing cargo records exist and the traffic is identified as cprs:
    For Create New CPRS Cargo Record:
    When the system creates a new cargo record, then a new cprs cargo record is created with appropriate cprs-specific attributes and processing rules.
  • Context - car/waybill processing has been completed:
    For Log Car/Waybill Processing Action:
    When the system finalizes the processing step, then the processing actions and results are logged for audit trail and business tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 equipment segment is available for processing
GIVEN
An N7 equipment segment is available for processing
Applied to: Extract Equipment ID from N7 Segment
WHEN
The system processes the N7 segment to extract equipment information
THEN
The equipment initial and equipment number are extracted and combined to form the equipment ID
Context: An N7 equipment segment contains waybill information
GIVEN
An N7 equipment segment contains waybill information
Applied to: Extract Waybill Number from N7 Segment
WHEN
The system processes the N7 segment for waybill data
THEN
The waybill number is extracted from the N7 segment
Context: Equipment initial and equipment number have been extracted from N7 segment
GIVEN
Equipment initial and equipment number have been extracted from N7 segment
Applied to: Format Car ID Using Standard Rules
WHEN
The system needs to create a standardized car ID
THEN
The car ID is formatted by combining equipment initial and equipment number according to standard formatting rules
Context: A formatted car ID and waybill number are available
GIVEN
A formatted car ID and waybill number are available
Applied to: Search Cargo Database by Car/Waybill Index
WHEN
The system searches for existing cargo records
THEN
The system queries the cargo database using the car/waybill index to find matching records
Context: A search has been performed on the cargo database using car ID and waybill
GIVEN
A search has been performed on the cargo database using car ID and waybill
Applied to: Cargo Records Found?
WHEN
The system evaluates the search results
THEN
The system determines if cargo records were found and routes processing accordingly
Context: Cargo records exist for the car ID and waybill combination
GIVEN
Cargo records exist for the car ID and waybill combination
Applied to: Retrieve First Cargo Record
WHEN
The system needs to begin processing cargo records
THEN
The first cargo record matching the criteria is retrieved for processing
Context: A cargo record has been retrieved for processing
GIVEN
A cargo record has been retrieved for processing
Applied to: Process Individual Cargo Record
WHEN
The system processes the cargo record
THEN
The cargo record is processed with applicable disposition codes, status updates, and business rule validations
Context: One cargo record has been processed for a car/waybill combination
GIVEN
One cargo record has been processed for a car/waybill combination
Applied to: More Records Exist?
WHEN
The system checks for additional matching records
THEN
The system determines if more cargo records exist with the same car ID and waybill and continues processing if found
Context: Additional cargo records exist for the same car ID and waybill combination
GIVEN
Additional cargo records exist for the same car ID and waybill combination
Applied to: Retrieve Next Cargo Record
WHEN
The system continues processing multiple records
THEN
The next cargo record in the sequence is retrieved for processing
Context: A subsequent cargo record has been retrieved for the same car/waybill combination
GIVEN
A subsequent cargo record has been retrieved for the same car/waybill combination
Applied to: Process Next Individual Cargo Record
WHEN
The system processes this additional cargo record
THEN
The cargo record is processed with the same disposition codes, status updates, and business rule validations as previous records
Context: No existing cargo records were found for the car/waybill combination
GIVEN
No existing cargo records were found for the car/waybill combination
Applied to: CPRS Traffic?
WHEN
The system evaluates the traffic type
THEN
The system determines if this is CPRS traffic and routes to appropriate processing
Context: No existing cargo records exist and the traffic is identified as CPRS
GIVEN
No existing cargo records exist and the traffic is identified as CPRS
Applied to: Create New CPRS Cargo Record
WHEN
The system creates a new cargo record
THEN
A new CPRS cargo record is created with appropriate CPRS-specific attributes and processing rules
Context: Car/waybill processing has been completed
GIVEN
Car/waybill processing has been completed
Applied to: Log Car/Waybill Processing Action
WHEN
The system finalizes the processing step
THEN
The processing actions and results are logged for audit trail and business tracking purposes
R-GCX016E-cbl-00324 (+10) File: GCX016E.cbl Individual Cargo Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Individual Cargo Processing':
  • Context - a cargo ccn (container control number) is provided for processing:
    For Cargo Found in System?:
    When the system searches for the cargo record in the database, then if the cargo record is found, proceed with processing; if not found, generate an error message indicating cargo not available.
  • Context - a disposition code is received for cargo processing:
    For Valid Disposition Code?:
    When the system validates the disposition code against the dc table, then if the disposition code exists in the dc table, continue processing; if not found, generate an error message for invalid disposition code.
  • Context - a disposition code is being added to a cargo's status array:
    For Duplicate Found?:
    When the system searches the existing status array for the same disposition code with matching entry number and quantity, then if an exact duplicate is found, skip processing and continue; if no duplicate exists, proceed with adding the disposition code.
  • Context - a new disposition code is being added that has defined counterpart codes in the dc table:
    For Remove Counterpart Codes:
    When the system processes the counterpart removal logic, then remove all counterpart disposition codes from the status array before adding the new disposition code.
  • Context - disposition codes have been processed and the status array is updated:
    For Status Change Required?:
    When the system evaluates all disposition codes in the status array to determine the final cargo status, then if the evaluated status differs from the current cargo status, proceed with status update; otherwise, complete processing without changes.
  • Context - the cargo has release disposition codes in its status array:
    For Calculate Release Quantities:
    When the system calculates the total released quantity by summing all release quantities from disposition codes, then update the cargo's released quantity field with the calculated total and determine if the cargo is fully released, partially released, or held.
    For Set Release Flags:
    When the system validates that the release quantity meets or exceeds the cargo quantity, then set the released flag to true and update the cargo status to relsd (released) or holdpcs (hold pieces) based on partial release conditions.
  • Context - the cargo has hold disposition codes in its status array:
    For Set Hold Flags:
    When the system evaluates hold codes for border holds, destination holds, or fda holds, then set the corresponding hold flags (held at border, held at destination, held for fda) and update the cargo status to reflect the hold condition.
  • Context - the cargo has a proceed disposition code and entry type is 61, 62, 63, or 69:
    For Process In-Bond Entry:
    When the system processes the proceed status, then update the cargo's in-bond information including broker details, bond numbers, and entry information, and set the cargo status to proceed.
  • Context - the cargo has arrival or export disposition codes in its status array:
    For Update Arrival/Export Flags:
    When the system processes arrival or export status changes, then for arrival codes, set arrival flag and update arrival date; for export codes, set export flag and clear destination index; update cargo status to arrival or export accordingly.
  • Context - a cargo status has been updated with new disposition codes:
    For Generate Status Notifications:
    When the system determines notification requirements based on the status change and freight forwarder setup, then generate merlin messages for brokers, send email notifications to freight forwarders if configured, and make iis calls for equipment tracking as appropriate.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo CCN (Container Control Number) is provided for processing
GIVEN
A cargo CCN (Container Control Number) is provided for processing
Applied to: Cargo Found in System?
WHEN
The system searches for the cargo record in the database
THEN
If the cargo record is found, proceed with processing; if not found, generate an error message indicating cargo not available
Context: A disposition code is received for cargo processing
GIVEN
A disposition code is received for cargo processing
Applied to: Valid Disposition Code?
WHEN
The system validates the disposition code against the DC table
THEN
If the disposition code exists in the DC table, continue processing; if not found, generate an error message for invalid disposition code
Context: A disposition code is being added to a cargo's status array
GIVEN
A disposition code is being added to a cargo's status array
Applied to: Duplicate Found?
WHEN
The system searches the existing status array for the same disposition code with matching entry number and quantity
THEN
If an exact duplicate is found, skip processing and continue; if no duplicate exists, proceed with adding the disposition code
Context: A new disposition code is being added that has defined counterpart codes in the DC table
GIVEN
A new disposition code is being added that has defined counterpart codes in the DC table
Applied to: Remove Counterpart Codes
WHEN
The system processes the counterpart removal logic
THEN
Remove all counterpart disposition codes from the status array before adding the new disposition code
Context: Disposition codes have been processed and the status array is updated
GIVEN
Disposition codes have been processed and the status array is updated
Applied to: Status Change Required?
WHEN
The system evaluates all disposition codes in the status array to determine the final cargo status
THEN
If the evaluated status differs from the current cargo status, proceed with status update; otherwise, complete processing without changes
Context: The cargo has release disposition codes in its status array
GIVEN
The cargo has release disposition codes in its status array
Applied to: Calculate Release Quantities
WHEN
The system calculates the total released quantity by summing all release quantities from disposition codes
THEN
Update the cargo's released quantity field with the calculated total and determine if the cargo is fully released, partially released, or held
Applied to: Set Release Flags
WHEN
The system validates that the release quantity meets or exceeds the cargo quantity
THEN
Set the released flag to true and update the cargo status to RELSD (Released) or HOLDPCS (Hold Pieces) based on partial release conditions
Context: The cargo has hold disposition codes in its status array
GIVEN
The cargo has hold disposition codes in its status array
Applied to: Set Hold Flags
WHEN
The system evaluates hold codes for border holds, destination holds, or FDA holds
THEN
Set the corresponding hold flags (held at border, held at destination, held for FDA) and update the cargo status to reflect the hold condition
Context: The cargo has a proceed disposition code and entry type is 61, 62, 63, or 69
GIVEN
The cargo has a proceed disposition code and entry type is 61, 62, 63, or 69
Applied to: Process In-Bond Entry
WHEN
The system processes the proceed status
THEN
Update the cargo's in-bond information including broker details, bond numbers, and entry information, and set the cargo status to PROCEED
Context: The cargo has arrival or export disposition codes in its status array
GIVEN
The cargo has arrival or export disposition codes in its status array
Applied to: Update Arrival/Export Flags
WHEN
The system processes arrival or export status changes
THEN
For arrival codes, set arrival flag and update arrival date; for export codes, set export flag and clear destination index; update cargo status to ARRIVAL or EXPORT accordingly
Context: A cargo status has been updated with new disposition codes
GIVEN
A cargo status has been updated with new disposition codes
Applied to: Generate Status Notifications
WHEN
The system determines notification requirements based on the status change and freight forwarder setup
THEN
Generate Merlin messages for brokers, send email notifications to freight forwarders if configured, and make IIS calls for equipment tracking as appropriate
R-GCX016E-cbl-00335 (+11) File: GCX016E.cbl Disposition Code 95 Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code 95 Processing':
  • Context - a disposition code 95 is being processed for bond cancellation:
    For Validate DC95 in Disposition Code Table:
    When the system looks up dc95 in the disposition code table, then the system confirms dc95 is a valid disposition code or generates an error if not found.
    For Clear M12 Bond Data:
    When the system clears bond information, then all m12 bond segment data is removed from the cargo record.
    For Clear Broker QP Information:
    When the system clears bond-related information, then all broker qp (qualified person) information is removed from the cargo record.
    For Reset In-Bond Entry Status:
    When the system resets bond information, then the in-bond entry status is reset to indicate no active bond.
  • Context - a valid disposition code 95 is being processed:
    For Clear BOL Type Code:
    When the system processes the bond cancellation, then the bol type code is cleared from the cargo record.
  • Context - a disposition code 95 is being processed:
    For Clear Bond Number Index & Clear Bond Owner Information:
    When the system processes bond cancellation, then the bond number index is cleared from the cargo record and bond owner information is cleared from the cargo record.
    For Generate Error Message - Invalid DC95:
    When the system cannot find dc95 in the disposition code table, then an error message is generated indicating invalid disposition code 95.
  • Context - a disposition code 95 has been processed and bond information cleared:
    For Update Cargo Status Array:
    When the system updates cargo status, then the cargo status array is updated to reflect the bond cancellation with appropriate status codes.
    For Log Bond Cancellation Action:
    When the system completes bond cancellation processing, then the bond cancellation action is logged with relevant cargo and bond details.
  • Context - a disposition code 95 has been processed and bond cancellation completed:
    For Generate Merlin Notification:
    When the system generates notifications, then a merlin notification is generated to inform relevant parties of the bond cancellation.
  • Context - all bond information has been cleared for disposition code 95:
    For Update Database with Cleared Bond Info:
    When the system updates the database, then the cargo database is updated with all cleared bond fields and updated status information.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code 95 is being processed for bond cancellation
GIVEN
A disposition code 95 is being processed for bond cancellation
Applied to: Validate DC95 in Disposition Code Table
WHEN
The system looks up DC95 in the disposition code table
THEN
The system confirms DC95 is a valid disposition code or generates an error if not found
Applied to: Clear M12 Bond Data
WHEN
The system clears bond information
THEN
All M12 bond segment data is removed from the cargo record
Applied to: Clear Broker QP Information
WHEN
The system clears bond-related information
THEN
All broker QP (Qualified Person) information is removed from the cargo record
Applied to: Reset In-Bond Entry Status
WHEN
The system resets bond information
THEN
The in-bond entry status is reset to indicate no active bond
Context: A valid disposition code 95 is being processed
GIVEN
A valid disposition code 95 is being processed
Applied to: Clear BOL Type Code
WHEN
The system processes the bond cancellation
THEN
The BOL type code is cleared from the cargo record
Context: A disposition code 95 is being processed
GIVEN
A disposition code 95 is being processed
Applied to: Clear Bond Number Index & Clear Bond Owner Information
WHEN
The system processes bond cancellation
THEN
The bond number index is cleared from the cargo record AND Bond owner information is cleared from the cargo record
Applied to: Generate Error Message - Invalid DC95
WHEN
The system cannot find DC95 in the disposition code table
THEN
An error message is generated indicating invalid disposition code 95
Context: A disposition code 95 has been processed and bond information cleared
GIVEN
A disposition code 95 has been processed and bond information cleared
Applied to: Update Cargo Status Array
WHEN
The system updates cargo status
THEN
The cargo status array is updated to reflect the bond cancellation with appropriate status codes
Applied to: Log Bond Cancellation Action
WHEN
The system completes bond cancellation processing
THEN
The bond cancellation action is logged with relevant cargo and bond details
Context: A disposition code 95 has been processed and bond cancellation completed
GIVEN
A disposition code 95 has been processed and bond cancellation completed
Applied to: Generate Merlin Notification
WHEN
The system generates notifications
THEN
A Merlin notification is generated to inform relevant parties of the bond cancellation
Context: All bond information has been cleared for disposition code 95
GIVEN
All bond information has been cleared for disposition code 95
Applied to: Update Database with Cleared Bond Info
WHEN
The system updates the database
THEN
The cargo database is updated with all cleared bond fields and updated status information
R-GCX016E-cbl-00362 (+9) File: GCX016E.cbl SNP Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'SNP Processing':
  • Context - an edi message is received for snp processing:
    For Entry Type Code Present?:
    When the system checks for the presence of an entry type code in the message, then if entry type code is present, proceed to validation; if not present, skip entry type processing.
  • Context - an entry type code is present in the edi message:
    For Valid EDI Format?:
    When the system validates the format of the entry type code, then if format is valid, proceed to conversion; if invalid, generate error message.
  • Context - a valid edi entry type code needs to be converted to internal format:
    For Code Found in Array?:
    When the system searches the conversion array for the edi code, then if code is found in array, set internal entry type code; if not found, generate error message.
  • Context - an internal entry type code has been successfully set:
    For Entry Type = 61, 62, 63, or 69?:
    When the system checks if the entry type is 61, 62, 63, or 69, then if entry type matches in-bond codes, set master in-bond flag; otherwise proceed to border crossing check.
  • Context - the entry type code is identified as 61, 62, 63, or 69:
    For Set Master In-Bond Flag:
    When the system processes the in-bond entry type, then set the master in-bond flag to indicate special in-bond processing is required.
  • Context - entry type processing is in progress:
    For Border Crossing Scenario?:
    When the system evaluates if this is a border crossing scenario, then if border crossing is detected, apply border crossing logic; otherwise update cargo record directly.
  • Context - a border crossing scenario has been identified:
    For Apply Border Crossing Logic:
    When the system applies border crossing logic, then execute special border crossing processing rules and update cargo accordingly.
  • Context - entry type has been successfully processed and validated:
    For Update Cargo Record with Entry Type:
    When the system updates the cargo record, then store the internal entry type code and any associated flags in the cargo record.
  • Context - entry type conversion has been completed successfully:
    For Log Entry Type Conversion:
    When the system logs the conversion activity, then create audit log entry showing original edi code, converted internal code, and processing timestamp.
  • Context - entry type validation or conversion has failed:
    For Generate Error Message:
    When the system encounters an invalid format or unknown code, then generate appropriate error message indicating the nature of the entry type processing failure.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI message is received for SNP processing
GIVEN
An EDI message is received for SNP processing
Applied to: Entry Type Code Present?
WHEN
The system checks for the presence of an entry type code in the message
THEN
If entry type code is present, proceed to validation; if not present, skip entry type processing
Context: An entry type code is present in the EDI message
GIVEN
An entry type code is present in the EDI message
Applied to: Valid EDI Format?
WHEN
The system validates the format of the entry type code
THEN
If format is valid, proceed to conversion; if invalid, generate error message
Context: A valid EDI entry type code needs to be converted to internal format
GIVEN
A valid EDI entry type code needs to be converted to internal format
Applied to: Code Found in Array?
WHEN
The system searches the conversion array for the EDI code
THEN
If code is found in array, set internal entry type code; if not found, generate error message
Context: An internal entry type code has been successfully set
GIVEN
An internal entry type code has been successfully set
Applied to: Entry Type = 61, 62, 63, or 69?
WHEN
The system checks if the entry type is 61, 62, 63, or 69
THEN
If entry type matches in-bond codes, set master in-bond flag; otherwise proceed to border crossing check
Context: The entry type code is identified as 61, 62, 63, or 69
GIVEN
The entry type code is identified as 61, 62, 63, or 69
Applied to: Set Master In-Bond Flag
WHEN
The system processes the in-bond entry type
THEN
Set the master in-bond flag to indicate special in-bond processing is required
Context: Entry type processing is in progress
GIVEN
Entry type processing is in progress
Applied to: Border Crossing Scenario?
WHEN
The system evaluates if this is a border crossing scenario
THEN
If border crossing is detected, apply border crossing logic; otherwise update cargo record directly
Context: A border crossing scenario has been identified
GIVEN
A border crossing scenario has been identified
Applied to: Apply Border Crossing Logic
WHEN
The system applies border crossing logic
THEN
Execute special border crossing processing rules and update cargo accordingly
Context: Entry type has been successfully processed and validated
GIVEN
Entry type has been successfully processed and validated
Applied to: Update Cargo Record with Entry Type
WHEN
The system updates the cargo record
THEN
Store the internal entry type code and any associated flags in the cargo record
Context: Entry type conversion has been completed successfully
GIVEN
Entry type conversion has been completed successfully
Applied to: Log Entry Type Conversion
WHEN
The system logs the conversion activity
THEN
Create audit log entry showing original EDI code, converted internal code, and processing timestamp
Context: Entry type validation or conversion has failed
GIVEN
Entry type validation or conversion has failed
Applied to: Generate Error Message
WHEN
The system encounters an invalid format or unknown code
THEN
Generate appropriate error message indicating the nature of the entry type processing failure
R-GCX016E-cbl-00372 (+7) File: GCX016E.cbl Canadian Border Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Border Processing':
  • Context - a cross-border cargo record is received for processing:
    For Extract US Port Code from Cargo Data:
    When the system processes the cargo data, then the us port code is extracted from the cargo record for border location mapping.
  • Context - a us port code has been extracted from cargo data:
    For Access Canadian Border Location Mapping Table:
    When the system needs to determine the corresponding canadian border location, then the canadian border location mapping table is accessed for lookup.
    For Generate Error for Unmapped Port Code:
    When the us port code is not found in the canadian border location mapping table, then an error is generated indicating the port code cannot be mapped to a canadian border location.
  • Context - a us port code has been extracted from cargo data and the mapping table is accessed:
    For US Port Code Found in Mapping?:
    When the system searches for the us port code in the mapping table, then the system determines if a corresponding canadian border location mapping exists.
  • Context - a us port code exists in the canadian border location mapping table:
    For Retrieve Corresponding Canadian Border Location Name:
    When the system finds a valid mapping entry, then the corresponding canadian border location name is retrieved from the mapping table.
  • Context - a canadian border location name has been successfully retrieved from the mapping table:
    For Update Cargo Record with Canadian Border Location:
    When the system processes the mapping result, then the cargo record is updated with the canadian border location information.
  • Context - a cargo record has been updated with canadian border location information:
    For Log Border Location Mapping:
    When the border location mapping is completed, then an audit log entry is created documenting the border location mapping operation.
  • Context - border location mapping has been completed successfully or an error has been generated for unmapped port code:
    For Continue Cargo Processing with Border Location:
    When the border location processing step is finished, then the system continues with the next step in the cargo processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A cross-border cargo record is received for processing
GIVEN
A cross-border cargo record is received for processing
Applied to: Extract US Port Code from Cargo Data
WHEN
The system processes the cargo data
THEN
The US port code is extracted from the cargo record for border location mapping
Context: A US port code has been extracted from cargo data
GIVEN
A US port code has been extracted from cargo data
Applied to: Access Canadian Border Location Mapping Table
WHEN
The system needs to determine the corresponding Canadian border location
THEN
The Canadian border location mapping table is accessed for lookup
Applied to: Generate Error for Unmapped Port Code
WHEN
The US port code is not found in the Canadian border location mapping table
THEN
An error is generated indicating the port code cannot be mapped to a Canadian border location
Context: A US port code has been extracted from cargo data and the mapping table is accessed
GIVEN
A US port code has been extracted from cargo data and the mapping table is accessed
Applied to: US Port Code Found in Mapping?
WHEN
The system searches for the US port code in the mapping table
THEN
The system determines if a corresponding Canadian border location mapping exists
Context: A US port code exists in the Canadian border location mapping table
GIVEN
A US port code exists in the Canadian border location mapping table
Applied to: Retrieve Corresponding Canadian Border Location Name
WHEN
The system finds a valid mapping entry
THEN
The corresponding Canadian border location name is retrieved from the mapping table
Context: A Canadian border location name has been successfully retrieved from the mapping table
GIVEN
A Canadian border location name has been successfully retrieved from the mapping table
Applied to: Update Cargo Record with Canadian Border Location
WHEN
The system processes the mapping result
THEN
The cargo record is updated with the Canadian border location information
Context: A cargo record has been updated with Canadian border location information
GIVEN
A cargo record has been updated with Canadian border location information
Applied to: Log Border Location Mapping
WHEN
The border location mapping is completed
THEN
An audit log entry is created documenting the border location mapping operation
Context: Border location mapping has been completed successfully or an error has been generated for unmapped port code
GIVEN
Border location mapping has been completed successfully or an error has been generated for unmapped port code
Applied to: Continue Cargo Processing with Border Location
WHEN
The border location processing step is finished
THEN
The system continues with the next step in the cargo processing workflow
R-GCX016E-cbl-00380 (+8) File: GCX016E.cbl FDA Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FDA Processing':
  • Context - a cargo has an a1 disposition code for fda processing:
    For A1 Disposition Code Processing:
    When the system processes the a1 disposition code, then the system retrieves the n9 reference number segment and formats the fda reference number with fda pn prefix.
  • Context - a cargo has an a3 disposition code for fda processing:
    For A3 Disposition Code Processing:
    When the system processes the a3 disposition code, then the system retrieves the n9 reference number segment and formats the fda reference number with fda prefix.
  • Context - fda disposition code processing is required:
    For Retrieve N9 Reference Number Segment:
    When the system needs to process fda reference numbers, then the system retrieves the n9 reference number segment from the cargo database.
  • Context - an a1 disposition code is being processed and n9 reference number segment is retrieved:
    For Format FDA Reference Number with FDA PN Prefix:
    When the system formats the fda reference number, then the system applies fda pn prefix to the reference number.
  • Context - an a3 disposition code is being processed and n9 reference number segment is retrieved:
    For Format FDA Reference Number with FDA Prefix:
    When the system formats the fda reference number, then the system applies fda prefix to the reference number.
  • Context - fda reference number has been formatted with appropriate prefix:
    For Reposition Existing N9 Data:
    When the system updates the n9 segment, then the system repositions existing n9 data to maintain proper segment structure.
  • Context - n9 data has been repositioned and fda reference number is formatted:
    For Update N9 Reference Segment:
    When the system updates the n9 reference segment, then the system updates the n9 reference segment with the formatted fda reference number.
  • Context - n9 reference segment has been updated with fda reference number:
    For Replace N9 Segment in Database:
    When the system persists the changes, then the system replaces the n9 segment in the cargo database with the updated information.
  • Context - fda processing has been completed and n9 segment has been updated in database:
    For Log FDA Processing Action:
    When the system completes fda processing, then the system logs the fda processing action for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo has an A1 disposition code for FDA processing
GIVEN
A cargo has an A1 disposition code for FDA processing
Applied to: A1 Disposition Code Processing
WHEN
The system processes the A1 disposition code
THEN
The system retrieves the N9 reference number segment and formats the FDA reference number with FDA PN prefix
Context: A cargo has an A3 disposition code for FDA processing
GIVEN
A cargo has an A3 disposition code for FDA processing
Applied to: A3 Disposition Code Processing
WHEN
The system processes the A3 disposition code
THEN
The system retrieves the N9 reference number segment and formats the FDA reference number with FDA prefix
Context: FDA disposition code processing is required
GIVEN
FDA disposition code processing is required
Applied to: Retrieve N9 Reference Number Segment
WHEN
The system needs to process FDA reference numbers
THEN
The system retrieves the N9 reference number segment from the cargo database
Context: An A1 disposition code is being processed and N9 reference number segment is retrieved
GIVEN
An A1 disposition code is being processed and N9 reference number segment is retrieved
Applied to: Format FDA Reference Number with FDA PN Prefix
WHEN
The system formats the FDA reference number
THEN
The system applies FDA PN prefix to the reference number
Context: An A3 disposition code is being processed and N9 reference number segment is retrieved
GIVEN
An A3 disposition code is being processed and N9 reference number segment is retrieved
Applied to: Format FDA Reference Number with FDA Prefix
WHEN
The system formats the FDA reference number
THEN
The system applies FDA prefix to the reference number
Context: FDA reference number has been formatted with appropriate prefix
GIVEN
FDA reference number has been formatted with appropriate prefix
Applied to: Reposition Existing N9 Data
WHEN
The system updates the N9 segment
THEN
The system repositions existing N9 data to maintain proper segment structure
Context: N9 data has been repositioned and FDA reference number is formatted
GIVEN
N9 data has been repositioned and FDA reference number is formatted
Applied to: Update N9 Reference Segment
WHEN
The system updates the N9 reference segment
THEN
The system updates the N9 reference segment with the formatted FDA reference number
Context: N9 reference segment has been updated with FDA reference number
GIVEN
N9 reference segment has been updated with FDA reference number
Applied to: Replace N9 Segment in Database
WHEN
The system persists the changes
THEN
The system replaces the N9 segment in the cargo database with the updated information
Context: FDA processing has been completed and N9 segment has been updated in database
GIVEN
FDA processing has been completed and N9 segment has been updated in database
Applied to: Log FDA Processing Action
WHEN
The system completes FDA processing
THEN
The system logs the FDA processing action for audit trail
R-GCX016E-cbl-00389 (+19) File: GCX016E.cbl Freight Forwarder Email Notifications Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Freight Forwarder Email Notifications':
  • Context - a cih hold has been detected for a cargo:
    For Search Broker Database for Freight Forwarder Disposition Codes:
    When the system searches the broker name table for freight forwarder disposition codes, then the system identifies whether freight forwarder disposition codes exist for the cargo.
  • Context - a search has been performed in the broker database for freight forwarder disposition codes:
    For Freight Forwarder Found?:
    When the system evaluates the search results, then if a freight forwarder is found, continue processing; otherwise, complete the process without further action.
  • Context - a freight forwarder has been found in the broker database:
    For Retrieve Cargo Segment Data from GCSUSS03/GCSUSS07:
    When the system needs cargo segment information, then the system retrieves cargo segment data from both gcsuss03 and gcsuss07 databases.
  • Context - cargo segment data has been retrieved from gcsuss03 and gcsuss07:
    For Extract Freight Forwarder Information:
    When the system processes the cargo segment data, then the system extracts freight forwarder identification and contact information.
  • Context - freight forwarder information has been extracted from cargo segment data:
    For Lookup Freight Forwarder Name from Broker Tables:
    When the system searches the broker name tables (gcst2rt), then the system retrieves the complete freight forwarder name and details.
  • Context - the freight forwarder name has been successfully looked up:
    For Retrieve Freight Forwarder Email Address:
    When the system searches the broker email address table (gcstbrt), then the system retrieves the freight forwarder's email address.
  • Context - an email address lookup has been performed for the freight forwarder:
    For Valid Email Address?:
    When the system evaluates the retrieved email address, then if a valid email address exists, continue with email notification; otherwise, complete the process without sending email.
  • Context - a valid email address has been found for the freight forwarder:
    For Build Comprehensive Email Content:
    When the system prepares the email notification, then the system creates a structured email content framework ready for detailed information inclusion.
  • Context - email content structure has been built:
    For Include Equipment Details:
    When the system adds equipment information to the email, then the email includes equipment type, identification numbers, and related equipment details.
  • Context - equipment details have been included in the email:
    For Include Waybill Information:
    When the system adds waybill information to the email, then the email includes waybill numbers and associated shipping documentation details.
  • Context - waybill information has been included in the email:
    For Include CCN and Content Description:
    When the system adds ccn and content information to the email, then the email includes the cargo control number and detailed description of cargo contents.
  • Context - ccn and content description have been included in the email:
    For Include Origin/Destination Stations:
    When the system adds location information to the email, then the email includes origin station, destination station, and routing information.
  • Context - origin and destination station information has been included in the email:
    For Include Disposition Information:
    When the system adds disposition information to the email, then the email includes disposition codes, hold reasons, and any special handling instructions.
  • Context - complete email content has been built with all required information:
    For Send Email Notification:
    When the system attempts to send the email notification, then the system transmits the email to the freight forwarder's email address.
  • Context - an email notification has been sent to the freight forwarder:
    For Email Delivery Successful?:
    When the system receives delivery confirmation or failure notification, then if delivery is successful, log the success; otherwise, initiate retry process.
  • Context - email delivery has been confirmed as successful:
    For Log Successful Delivery:
    When the system processes the successful delivery confirmation, then the system creates a log entry recording the successful email delivery with timestamp and recipient information.
  • Context - email delivery has failed:
    For Retry Email Delivery:
    When the system has not reached the retry limit, then the system attempts to resend the email notification.
  • Context - email delivery has failed and a retry attempt is being considered:
    For Retry Limit Reached?:
    When the system checks the current retry count against the maximum retry limit, then if retry limit is not reached, continue retry attempts; otherwise, log delivery failure and complete process.
  • Context - email delivery has failed and retry limit has been reached:
    For Log Delivery Failure:
    When the system processes the final delivery failure, then the system creates a log entry recording the email delivery failure with error details and attempted recipient information.
  • Context - email notification process has reached a terminal state (success, failure, or no freight forwarder found):
    For Process Complete:
    When the system finalizes the notification process, then the system marks the freight forwarder notification process as complete and returns control to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A CIH hold has been detected for a cargo
GIVEN
A CIH hold has been detected for a cargo
Applied to: Search Broker Database for Freight Forwarder Disposition Codes
WHEN
The system searches the broker name table for freight forwarder disposition codes
THEN
The system identifies whether freight forwarder disposition codes exist for the cargo
Context: A search has been performed in the broker database for freight forwarder disposition codes
GIVEN
A search has been performed in the broker database for freight forwarder disposition codes
Applied to: Freight Forwarder Found?
WHEN
The system evaluates the search results
THEN
If a freight forwarder is found, continue processing; otherwise, complete the process without further action
Context: A freight forwarder has been found in the broker database
GIVEN
A freight forwarder has been found in the broker database
Applied to: Retrieve Cargo Segment Data from GCSUSS03/GCSUSS07
WHEN
The system needs cargo segment information
THEN
The system retrieves cargo segment data from both GCSUSS03 and GCSUSS07 databases
Context: Cargo segment data has been retrieved from GCSUSS03 and GCSUSS07
GIVEN
Cargo segment data has been retrieved from GCSUSS03 and GCSUSS07
Applied to: Extract Freight Forwarder Information
WHEN
The system processes the cargo segment data
THEN
The system extracts freight forwarder identification and contact information
Context: Freight forwarder information has been extracted from cargo segment data
GIVEN
Freight forwarder information has been extracted from cargo segment data
Applied to: Lookup Freight Forwarder Name from Broker Tables
WHEN
The system searches the broker name tables (GCST2RT)
THEN
The system retrieves the complete freight forwarder name and details
Context: The freight forwarder name has been successfully looked up
GIVEN
The freight forwarder name has been successfully looked up
Applied to: Retrieve Freight Forwarder Email Address
WHEN
The system searches the broker email address table (GCSTBRT)
THEN
The system retrieves the freight forwarder's email address
Context: An email address lookup has been performed for the freight forwarder
GIVEN
An email address lookup has been performed for the freight forwarder
Applied to: Valid Email Address?
WHEN
The system evaluates the retrieved email address
THEN
If a valid email address exists, continue with email notification; otherwise, complete the process without sending email
Context: A valid email address has been found for the freight forwarder
GIVEN
A valid email address has been found for the freight forwarder
Applied to: Build Comprehensive Email Content
WHEN
The system prepares the email notification
THEN
The system creates a structured email content framework ready for detailed information inclusion
Context: Email content structure has been built
GIVEN
Email content structure has been built
Applied to: Include Equipment Details
WHEN
The system adds equipment information to the email
THEN
The email includes equipment type, identification numbers, and related equipment details
Context: Equipment details have been included in the email
GIVEN
Equipment details have been included in the email
Applied to: Include Waybill Information
WHEN
The system adds waybill information to the email
THEN
The email includes waybill numbers and associated shipping documentation details
Context: Waybill information has been included in the email
GIVEN
Waybill information has been included in the email
Applied to: Include CCN and Content Description
WHEN
The system adds CCN and content information to the email
THEN
The email includes the Cargo Control Number and detailed description of cargo contents
Context: CCN and content description have been included in the email
GIVEN
CCN and content description have been included in the email
Applied to: Include Origin/Destination Stations
WHEN
The system adds location information to the email
THEN
The email includes origin station, destination station, and routing information
Context: Origin and destination station information has been included in the email
GIVEN
Origin and destination station information has been included in the email
Applied to: Include Disposition Information
WHEN
The system adds disposition information to the email
THEN
The email includes disposition codes, hold reasons, and any special handling instructions
Context: Complete email content has been built with all required information
GIVEN
Complete email content has been built with all required information
Applied to: Send Email Notification
WHEN
The system attempts to send the email notification
THEN
The system transmits the email to the freight forwarder's email address
Context: An email notification has been sent to the freight forwarder
GIVEN
An email notification has been sent to the freight forwarder
Applied to: Email Delivery Successful?
WHEN
The system receives delivery confirmation or failure notification
THEN
If delivery is successful, log the success; otherwise, initiate retry process
Context: Email delivery has been confirmed as successful
GIVEN
Email delivery has been confirmed as successful
Applied to: Log Successful Delivery
WHEN
The system processes the successful delivery confirmation
THEN
The system creates a log entry recording the successful email delivery with timestamp and recipient information
Context: Email delivery has failed
GIVEN
Email delivery has failed
Applied to: Retry Email Delivery
WHEN
The system has not reached the retry limit
THEN
The system attempts to resend the email notification
Context: Email delivery has failed and a retry attempt is being considered
GIVEN
Email delivery has failed and a retry attempt is being considered
Applied to: Retry Limit Reached?
WHEN
The system checks the current retry count against the maximum retry limit
THEN
If retry limit is not reached, continue retry attempts; otherwise, log delivery failure and complete process
Context: Email delivery has failed and retry limit has been reached
GIVEN
Email delivery has failed and retry limit has been reached
Applied to: Log Delivery Failure
WHEN
The system processes the final delivery failure
THEN
The system creates a log entry recording the email delivery failure with error details and attempted recipient information
Context: Email notification process has reached a terminal state (success, failure, or no freight forwarder found)
GIVEN
Email notification process has reached a terminal state (success, failure, or no freight forwarder found)
Applied to: Process Complete
WHEN
The system finalizes the notification process
THEN
The system marks the freight forwarder notification process as complete and returns control to the calling process
R-GCX016E-cbl-00409 (+12) File: GCX016E.cbl Cargo Status Array Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Array Processing':
  • Context - a cargo record exists in the system:
    For Initialize Empty Status Arrays:
    When no s09 status segments are found in the database for the cargo, then the system initializes empty s09a status arrays with zero occurrence counts and clears all status tracking variables.
  • Context - s09 status segments exist in the database for a cargo:
    For Populate S09A Status Arrays from Database:
    When the system retrieves the status segments, then the system populates the s09a status arrays with disposition codes, quantities, entry numbers, and sequence information from each database segment.
  • Context - status arrays contain existing disposition code entries:
    For Track Maximum Sequence Numbers:
    When processing status array data, then the system identifies and tracks the maximum sequence number for each status array type to determine the next available sequence number for new entries.
  • Context - a new disposition code is being processed for a cargo:
    For Duplicate Code Check:
    When the system searches existing status arrays, then if a disposition code with identical code, entry number, and quantity already exists, the system flags it as a duplicate; otherwise, it is marked as a new code.
  • Context - a disposition code is confirmed as new and not duplicate:
    For Add New Status Entry to Array:
    When adding the code to the status array, then the system creates a new status array entry with the disposition code, quantity, entry number, date/time, and assigns the next sequential number while incrementing the array occurrence count.
  • Context - a disposition code matches an existing entry in the status array:
    For Update Existing Status Entry:
    When processing the disposition code update, then the system updates the existing status array entry with new quantity, date/time, and other relevant information while maintaining the original sequence number.
  • Context - a disposition code has defined counterpart codes in the system:
    For Remove Counterpart Disposition Codes:
    When adding the primary disposition code to the status array, then the system identifies and removes any existing counterpart disposition codes from the status arrays and decrements the occurrence counts accordingly.
  • Context - status array entries have been added, updated, or removed:
    For Reorganize Array Sequences:
    When finalizing status array changes, then the system reorganizes the arrays by reassigning sequential numbers starting from 1, compacting the arrays to eliminate empty slots, and updating occurrence counts.
  • Context - status arrays have been modified with new or updated disposition codes:
    For Calculate Status Array Changes:
    When calculating the impact of changes, then the system determines how the changes affect release quantities, hold status, and overall cargo processing status based on the disposition code types and quantities.
  • Context - status arrays have been processed and finalized in memory:
    For Convert Arrays to Database Format:
    When preparing to update the database, then the system converts the s09a status arrays into s09 database segment format with proper field mapping, data formatting, and segment structure.
  • Context - status segments have been converted to database format:
    For Replace Status Segments in Database:
    When updating the cargo record in the database, then the system replaces the existing s09 status segments with the updated segments and commits the changes to maintain data integrity.
  • Context - a cargo is not a cprs shipment and n7 equipment data is available:
    For Update Car ID Information:
    When processing car id updates, then the system updates the cargo record with car id information from the n7 segment, including equipment initial and number, while preserving existing data for cprs shipments.
  • Context - status arrays have been modified for a cargo:
    For Track Status Change History:
    When completing status array processing, then the system creates history records documenting the status changes, including timestamps, disposition codes added or removed, and the resulting cargo status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Initialize Empty Status Arrays
WHEN
No S09 status segments are found in the database for the cargo
THEN
The system initializes empty S09A status arrays with zero occurrence counts and clears all status tracking variables
Context: S09 status segments exist in the database for a cargo
GIVEN
S09 status segments exist in the database for a cargo
Applied to: Populate S09A Status Arrays from Database
WHEN
The system retrieves the status segments
THEN
The system populates the S09A status arrays with disposition codes, quantities, entry numbers, and sequence information from each database segment
Context: Status arrays contain existing disposition code entries
GIVEN
Status arrays contain existing disposition code entries
Applied to: Track Maximum Sequence Numbers
WHEN
Processing status array data
THEN
The system identifies and tracks the maximum sequence number for each status array type to determine the next available sequence number for new entries
Context: A new disposition code is being processed for a cargo
GIVEN
A new disposition code is being processed for a cargo
Applied to: Duplicate Code Check
WHEN
The system searches existing status arrays
THEN
If a disposition code with identical code, entry number, and quantity already exists, the system flags it as a duplicate; otherwise, it is marked as a new code
Context: A disposition code is confirmed as new and not duplicate
GIVEN
A disposition code is confirmed as new and not duplicate
Applied to: Add New Status Entry to Array
WHEN
Adding the code to the status array
THEN
The system creates a new status array entry with the disposition code, quantity, entry number, date/time, and assigns the next sequential number while incrementing the array occurrence count
Context: A disposition code matches an existing entry in the status array
GIVEN
A disposition code matches an existing entry in the status array
Applied to: Update Existing Status Entry
WHEN
Processing the disposition code update
THEN
The system updates the existing status array entry with new quantity, date/time, and other relevant information while maintaining the original sequence number
Context: A disposition code has defined counterpart codes in the system
GIVEN
A disposition code has defined counterpart codes in the system
Applied to: Remove Counterpart Disposition Codes
WHEN
Adding the primary disposition code to the status array
THEN
The system identifies and removes any existing counterpart disposition codes from the status arrays and decrements the occurrence counts accordingly
Context: Status array entries have been added, updated, or removed
GIVEN
Status array entries have been added, updated, or removed
Applied to: Reorganize Array Sequences
WHEN
Finalizing status array changes
THEN
The system reorganizes the arrays by reassigning sequential numbers starting from 1, compacting the arrays to eliminate empty slots, and updating occurrence counts
Context: Status arrays have been modified with new or updated disposition codes
GIVEN
Status arrays have been modified with new or updated disposition codes
Applied to: Calculate Status Array Changes
WHEN
Calculating the impact of changes
THEN
The system determines how the changes affect release quantities, hold status, and overall cargo processing status based on the disposition code types and quantities
Context: Status arrays have been processed and finalized in memory
GIVEN
Status arrays have been processed and finalized in memory
Applied to: Convert Arrays to Database Format
WHEN
Preparing to update the database
THEN
The system converts the S09A status arrays into S09 database segment format with proper field mapping, data formatting, and segment structure
Context: Status segments have been converted to database format
GIVEN
Status segments have been converted to database format
Applied to: Replace Status Segments in Database
WHEN
Updating the cargo record in the database
THEN
The system replaces the existing S09 status segments with the updated segments and commits the changes to maintain data integrity
Context: A cargo is not a CPRS shipment and N7 equipment data is available
GIVEN
A cargo is not a CPRS shipment and N7 equipment data is available
Applied to: Update Car ID Information
WHEN
Processing car ID updates
THEN
The system updates the cargo record with car ID information from the N7 segment, including equipment initial and number, while preserving existing data for CPRS shipments
Context: Status arrays have been modified for a cargo
GIVEN
Status arrays have been modified for a cargo
Applied to: Track Status Change History
WHEN
Completing status array processing
THEN
The system creates history records documenting the status changes, including timestamps, disposition codes added or removed, and the resulting cargo status
R-GCX016E-cbl-00422 (+72) File: GCX016E.cbl Multi Merged 73 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Multi':
  • Context - a lead manifest is being processed:
    For Check for Follower Manifests?:
    When the system checks for associated follower manifests, then all linked follower manifests are identified and prepared for processing.
  • Context - a follower manifest is identified for processing and a lead manifest ccn exists:
    For Lead Manifest CCN differs from US CCN Key?:
    When the lead manifest ccn is compared to the current us ccn key, then if the lead manifest ccn differs from the us ccn key, special action processing is initiated, otherwise standard follower processing continues.
  • Context - a follower manifest requires processing and the lead manifest ccn differs from us ccn and the message type is gcw016:
    For Prepare 350 Special Action Messages:
    When the system prepares the follower manifest message, then a special action code of 350 is set in the message for proper routing and processing.
  • Context - a follower manifest message is being prepared and disposition codes exist for the cargo:
    For Include Disposition Codes in Message:
    When the message content is assembled, then all relevant disposition codes are included in the follower manifest message.
  • Context - a follower manifest message is being prepared and quantity information exists:
    For Include Quantities in Message:
    When the message content is assembled, then all relevant quantity information is included in the follower manifest message.
  • Context - a follower manifest message is being prepared and entry numbers exist:
    For Include Entry Numbers in Message:
    When the message content is assembled, then all relevant entry numbers are included in the follower manifest message.
  • Context - a follower manifest message has been prepared with all required information:
    For Spawn GCT0162E Transaction for Follower Processing:
    When the system is ready to process the follower manifest, then a gct0162e transaction is spawned with the prepared message content for follower manifest processing.
  • Context - a follower manifest is being processed and a lead manifest exists:
    For Link Follower to Lead Manifest:
    When the follower manifest processing is completed, then the follower manifest is properly linked to its lead manifest for tracking and reporting purposes.
  • Context - all follower manifests have been processed and linked to their lead manifest:
    For Update Comprehensive Cargo Tracking:
    When the multi-manifest processing is completing, then the comprehensive cargo tracking system is updated with all manifest relationships and cargo status information.
  • Context - a cargo record with car id and waybill number exists in the system:
    For Start Multi-Cargo Processing by Car/Waybill:
    When multi-cargo processing is triggered for car/waybill combination, then system begins coordinated processing of all related cargo records.
  • Context - car id and waybill number are provided for cargo lookup:
    For Retrieve First Cargo Record by Car ID and Waybill:
    When system searches for cargo records with matching car id and waybill, then first matching cargo record is retrieved for processing.
  • Context - a search for cargo records by car id and waybill has been performed:
    For Cargo Record Found?:
    When system evaluates the search results, then processing continues if cargo record found, otherwise processing terminates.
  • Context - a valid cargo record exists for processing:
    For Process Individual Cargo Record:
    When individual cargo processing is initiated, then cargo record is processed according to disposition codes and status rules.
  • Context - a cargo record is being processed:
    For Analyze Cargo Hold Status:
    When system evaluates cargo hold status, then hold status is analyzed to determine next processing steps.
  • Context - cargo record contains disposition codes:
    For Manual Release Present?:
    When system evaluates disposition codes for manual release, then if manual release present, cargo bypasses hold checks; otherwise continue hold evaluation.
  • Context - cargo does not have manual release status:
    For Check Various Hold Types:
    When system checks for various hold types in cargo status, then hold types are identified and classified for appropriate processing.
  • Context - cargo status is being evaluated for holds:
    For Border Hold?:
    When system checks for border hold indicators, then if border hold exists, processing continues to release verification; otherwise check next hold type.
  • Context - cargo does not have border hold and status is being evaluated:
    For Destination Hold?:
    When system checks for destination hold indicators, then if destination hold exists, processing continues to release verification; otherwise check next hold type.
  • Context - cargo does not have border or destination hold and status is being evaluated:
    For FDA Hold?:
    When system checks for fda hold indicators, then if fda hold exists, processing continues to release verification; otherwise check piece count hold.
  • Context - cargo does not have border, destination, or fda hold and status is being evaluated:
    For Piece Count Hold?:
    When system checks for piece count hold indicators, then if piece count hold exists, processing continues to release verification; otherwise retrieve next cargo record.
  • Context - current cargo record processing is complete and no holds prevent continuation:
    For Retrieve Next Cargo Record with Same Car/Waybill:
    When system searches for additional cargo records with same car id and waybill, then next matching cargo record is retrieved for processing.
  • Context - a search for additional cargo records with same car id and waybill has been performed:
    For More Records with Same Car/Waybill?:
    When system evaluates search results for more records, then if more records exist, continue processing; otherwise proceed to release verification.
  • Context - all cargo records with same car id and waybill have been processed:
    For Verify Release Status Across All Records:
    When system verifies release status across all related records, then release status is verified for coordinated notification and database updates.
  • Context - release status has been verified across all related cargo records:
    For All Records Released?:
    When system evaluates if all records are in released status, then if all records released, generate comprehensive notification; otherwise generate status change notification.
  • Context - all cargo records with same car id and waybill are in released status:
    For Generate Comprehensive Release Notification:
    When comprehensive release notification is triggered, then complete release notification is generated for all stakeholders.
  • Context - cargo status changes have occurred during processing:
    For Create Merlin Notification for Status Changes:
    When merlin notification creation is triggered, then status change notifications are created and routed to appropriate recipients.
  • Context - cargo status changes and notifications have been processed:
    For Update Cargo Status in Database:
    When database update is initiated, then all cargo status changes are committed to the database.
  • Context - all cargo records have been processed and database updates completed:
    For End Multi-Cargo Processing:
    When multi-cargo processing reaches completion, then processing terminates successfully for the car/waybill group.
  • Context - a lead manifest with an associated ccn and a current us ccn key are available:
    For Lead Manifest CCN differs from US CCN Key?:
    When the system compares the lead manifest ccn with the us ccn key, then if the lead manifest ccn differs from the us ccn key, proceed with follower manifest processing, otherwise complete multi-manifest processing.
  • Context - a follower manifest has been identified for processing:
    For Prepare Follower Manifest Data:
    When the system prepares follower manifest data, then all required manifest data elements including cargo information, quantities, and entry numbers are prepared for message creation.
  • Context - a follower manifest requires processing and the message type is gcw016:
    For Create 350 Special Action Message:
    When the system creates a special action message, then a message with special action code 350 is created and general information is copied for the follower manifest.
  • Context - a follower manifest message is being prepared and disposition codes exist:
    For Include Disposition Codes in Message:
    When the system includes disposition codes in the message, then all relevant disposition codes are included in the follower manifest message for downstream processing.
  • Context - a follower manifest message is being prepared and cargo quantities are available:
    For Include Cargo Quantities in Message:
    When the system includes cargo quantities in the message, then all relevant cargo quantities are included in the follower manifest message.
  • Context - a follower manifest message is being prepared and entry numbers exist:
    For Include Entry Numbers in Message:
    When the system includes entry numbers in the message, then all relevant entry numbers are included in the follower manifest message.
  • Context - a follower manifest message has been prepared with all required data:
    For Spawn GCT0162E Transaction for Follower Processing:
    When the system spawns the gct0162e transaction, then the gct0162e transaction is initiated with the prepared follower manifest message for processing.
  • Context - a follower manifest and its corresponding lead manifest are identified:
    For Link Follower Manifest to Lead Manifest:
    When the system links the follower manifest to the lead manifest, then the relationship between the follower and lead manifest is established for comprehensive tracking.
  • Context - a follower manifest has been processed and linked to its lead manifest:
    For Update Comprehensive Cargo Tracking:
    When the system updates comprehensive cargo tracking, then the cargo tracking system is updated with complete follower manifest information for full visibility.
  • Context - a follower manifest processing action has been completed:
    For Log Follower Manifest Processing Action:
    When the system logs the processing action, then the follower manifest processing action is recorded in the system log for audit and monitoring purposes.
  • Context - one follower manifest has been processed and there may be additional follower manifests:
    For More Follower Manifests?:
    When the system checks for more follower manifests to process, then if more follower manifests exist, continue processing the next one, otherwise complete multi-manifest processing.
  • Context - a car id and waybill number combination exists from previous n7 segment processing:
    For Retrieve First Cargo Record by Car ID and Waybill:
    When the system needs to process multiple cargo records with the same car and waybill, then the system retrieves the first cargo record matching the car id and waybill combination from the us cargo root segments.
  • Context - a search has been performed for cargo records by car id and waybill:
    For Cargo Record Found?:
    When the system evaluates the search results, then if a cargo record is found, continue with individual cargo processing, otherwise end the multi-cargo processing.
  • Context - a cargo record has been retrieved with matching car id and waybill:
    For Process Individual Cargo Record:
    When the system processes the individual cargo record, then the system applies the current disposition code processing logic to the cargo record.
  • Context - an individual cargo record is being processed with current disposition code context:
    For Update Cargo Status and Disposition Codes:
    When the system updates the cargo record, then the system applies the disposition code to the cargo's status array and updates the cargo status according to disposition code processing rules.
  • Context - one cargo record has been processed for a car id and waybill combination:
    For Check for Additional Cargo Records with Same Car/Waybill:
    When the system checks for additional records, then the system searches the cargo database for other records with the same car id and waybill combination.
  • Context - a search has been performed for additional cargo records with the same car id and waybill:
    For More Records with Same Car/Waybill?:
    When the system evaluates the search results, then if more records are found, retrieve the next record for processing, otherwise proceed to release status verification.
  • Context - additional cargo records exist with the same car id and waybill combination:
    For Retrieve Next Cargo Record:
    When the system retrieves the next record, then the system fetches the next cargo record from the us cargo root segments for processing.
  • Context - all cargo records with the same car id and waybill have been processed:
    For Verify Release Status Across All Records:
    When the system verifies release status across all records, then the system examines the release status of each processed cargo record to determine overall release state.
  • Context - release status has been verified across all cargo records with the same car id and waybill:
    For All Records Have Same Release Status?:
    When the system evaluates status consistency, then if all records have the same release status, generate comprehensive release notification, otherwise proceed to create merlin notifications for status changes.
  • Context - all cargo records with the same car id and waybill have consistent release status:
    For Generate Comprehensive Release Notification:
    When the system generates release notification, then the system creates a comprehensive release notification covering all related cargo records.
  • Context - cargo records have been processed and comprehensive release notification generated:
    For Generate Export Notification if Applicable:
    When the system evaluates export notification requirements, then if any cargo records have export status or export-related disposition codes, generate appropriate export notifications.
  • Context - export notifications have been processed for applicable cargo records:
    For Generate Arrival Notification if Applicable:
    When the system evaluates arrival notification requirements, then if any cargo records have arrival status or arrival-related disposition codes, generate appropriate arrival notifications.
  • Context - cargo records with the same car id and waybill do not have consistent release status or arrival notifications have been processed:
    For Create Merlin Notification for Status Changes:
    When the system creates merlin notifications, then the system generates appropriate merlin messages for each cargo status change including disposition code details and cargo information.
  • Context - all notifications have been generated for cargo records with the same car id and waybill:
    For Update Final Status for All Related Records:
    When the system updates final status, then the system commits all status changes and disposition code updates to all related cargo records in the database.
  • Context - a cargo record requires multi-cargo status verification:
    For Start Multi-Cargo Status Verification:
    When the multi-cargo status verification process is initiated, then the verification process begins and prepares to retrieve related cargo records.
  • Context - a car id and waybill number are provided for verification:
    For Retrieve All Cargo Records with Same Car ID and Waybill:
    When the system searches for related cargo records, then all cargo records with matching car id and waybill number are retrieved from the cargo database.
  • Context - a search for cargo records with matching car id and waybill has been performed:
    For More Records Found?:
    When the system checks for additional unprocessed records, then if more records exist, continue processing individual records, otherwise proceed to status comparison.
  • Context - an individual cargo record is selected for processing:
    For Process Individual Cargo Record:
    When the record processing begins, then the cargo record is prepared for hold status analysis.
  • Context - a cargo record is being processed for status verification:
    For Analyze Cargo Hold Status:
    When the hold status analysis is performed, then the system evaluates all hold conditions and release status for the cargo.
  • Context - a cargo record is being analyzed for release status:
    For Check Manual Release Status:
    When the system checks for manual release indicators, then if manual release is found, skip other hold checks and mark as released, otherwise continue with hold type evaluation.
  • Context - a cargo record without manual release is being processed:
    For Check Various Hold Types:
    When hold type evaluation begins, then the system proceeds to check border holds, destination holds, fda holds, and piece count holds.
  • Context - a cargo record is being evaluated for hold conditions:
    For Evaluate Border Hold:
    When border hold status is checked, then the system determines if border hold conditions apply to the cargo.
    For Evaluate Destination Hold:
    When destination hold status is checked, then the system determines if destination hold conditions apply to the cargo.
    For Evaluate FDA Hold:
    When fda hold status is checked, then the system determines if fda hold conditions apply to the cargo.
    For Evaluate Piece Count Hold:
    When piece count hold status is checked, then the system determines if piece count hold conditions apply based on quantity validation.
  • Context - all hold conditions have been evaluated for a cargo record:
    For Determine Individual Record Release Status:
    When the final release status is determined, then the cargo record is classified as either released or held based on the evaluation results.
  • Context - an individual cargo record's release status has been determined:
    For Store Record Status in Verification Array:
    When the status is stored in the verification array, then the record's release status is added to the array for later comparison with other related records.
  • Context - all related cargo records have been processed and their statuses stored:
    For Compare All Record Statuses:
    When status comparison is performed, then the system compares all record statuses to determine if they are consistent.
  • Context - all related cargo record statuses have been compared:
    For All Records Have Consistent Release Status?:
    When consistency verification is performed, then if all records have consistent release status, generate comprehensive release notification, otherwise create status mismatch warning.
  • Context - all related cargo records have consistent release status:
    For Generate Comprehensive Release Notification:
    When comprehensive release notification is generated, then a notification is created confirming the consistent release status across all related records.
  • Context - related cargo records have inconsistent release statuses:
    For Create Release Status Mismatch Warning:
    When status mismatch warning is created, then a warning is generated indicating the inconsistency in release statuses among related records.
  • Context - multi-cargo status verification has been completed:
    For Update Multi-Cargo Release Flag:
    When the multi-cargo release flag is updated, then the flag is set to reflect the overall release status of all related cargo records.
    For Log Status Verification Results:
    When results logging is performed, then the verification results, including any warnings or notifications, are logged for audit purposes.
  • Context - all multi-cargo status verification activities have been completed:
    For End Multi-Cargo Status Verification:
    When the verification process ends, then the process is completed and control is returned to the calling procedure.
👨‍💻 Technical ACs (Gherkin)
Context: A lead manifest is being processed
GIVEN
A lead manifest is being processed
Applied to: Check for Follower Manifests?
WHEN
The system checks for associated follower manifests
THEN
All linked follower manifests are identified and prepared for processing
Context: A follower manifest is identified for processing AND a lead manifest CCN exists
GIVEN
A follower manifest is identified for processing AND a lead manifest CCN exists
Applied to: Lead Manifest CCN differs from US CCN Key?
WHEN
The lead manifest CCN is compared to the current US CCN key
THEN
If the lead manifest CCN differs from the US CCN key, special action processing is initiated, otherwise standard follower processing continues
Context: A follower manifest requires processing AND the lead manifest CCN differs from US CCN AND the message type is GCW016
GIVEN
A follower manifest requires processing AND the lead manifest CCN differs from US CCN AND the message type is GCW016
Applied to: Prepare 350 Special Action Messages
WHEN
The system prepares the follower manifest message
THEN
A special action code of 350 is set in the message for proper routing and processing
Context: A follower manifest message is being prepared AND disposition codes exist for the cargo
GIVEN
A follower manifest message is being prepared AND disposition codes exist for the cargo
Applied to: Include Disposition Codes in Message
WHEN
The message content is assembled
THEN
All relevant disposition codes are included in the follower manifest message
Context: A follower manifest message is being prepared AND quantity information exists
GIVEN
A follower manifest message is being prepared AND quantity information exists
Applied to: Include Quantities in Message
WHEN
The message content is assembled
THEN
All relevant quantity information is included in the follower manifest message
Context: A follower manifest message is being prepared AND entry numbers exist
GIVEN
A follower manifest message is being prepared AND entry numbers exist
Applied to: Include Entry Numbers in Message
WHEN
The message content is assembled
THEN
All relevant entry numbers are included in the follower manifest message
Context: A follower manifest message has been prepared with all required information
GIVEN
A follower manifest message has been prepared with all required information
Applied to: Spawn GCT0162E Transaction for Follower Processing
WHEN
The system is ready to process the follower manifest
THEN
A GCT0162E transaction is spawned with the prepared message content for follower manifest processing
Context: A follower manifest is being processed AND a lead manifest exists
GIVEN
A follower manifest is being processed AND a lead manifest exists
Applied to: Link Follower to Lead Manifest
WHEN
The follower manifest processing is completed
THEN
The follower manifest is properly linked to its lead manifest for tracking and reporting purposes
Context: All follower manifests have been processed and linked to their lead manifest
GIVEN
All follower manifests have been processed and linked to their lead manifest
Applied to: Update Comprehensive Cargo Tracking
WHEN
The multi-manifest processing is completing
THEN
The comprehensive cargo tracking system is updated with all manifest relationships and cargo status information
Context: A cargo record with car ID and waybill number exists in the system
GIVEN
A cargo record with car ID and waybill number exists in the system
Applied to: Start Multi-Cargo Processing by Car/Waybill
WHEN
Multi-cargo processing is triggered for car/waybill combination
THEN
System begins coordinated processing of all related cargo records
Context: Car ID and waybill number are provided for cargo lookup
GIVEN
Car ID and waybill number are provided for cargo lookup
Applied to: Retrieve First Cargo Record by Car ID and Waybill
WHEN
System searches for cargo records with matching car ID and waybill
THEN
First matching cargo record is retrieved for processing
Context: A search for cargo records by car ID and waybill has been performed
GIVEN
A search for cargo records by car ID and waybill has been performed
Applied to: Cargo Record Found?
WHEN
System evaluates the search results
THEN
Processing continues if cargo record found, otherwise processing terminates
Context: A valid cargo record exists for processing
GIVEN
A valid cargo record exists for processing
Applied to: Process Individual Cargo Record
WHEN
Individual cargo processing is initiated
THEN
Cargo record is processed according to disposition codes and status rules
Context: A cargo record is being processed
GIVEN
A cargo record is being processed
Applied to: Analyze Cargo Hold Status
WHEN
System evaluates cargo hold status
THEN
Hold status is analyzed to determine next processing steps
Context: Cargo record contains disposition codes
GIVEN
Cargo record contains disposition codes
Applied to: Manual Release Present?
WHEN
System evaluates disposition codes for manual release
THEN
If manual release present, cargo bypasses hold checks; otherwise continue hold evaluation
Context: Cargo does not have manual release status
GIVEN
Cargo does not have manual release status
Applied to: Check Various Hold Types
WHEN
System checks for various hold types in cargo status
THEN
Hold types are identified and classified for appropriate processing
Context: Cargo status is being evaluated for holds
GIVEN
Cargo status is being evaluated for holds
Applied to: Border Hold?
WHEN
System checks for border hold indicators
THEN
If border hold exists, processing continues to release verification; otherwise check next hold type
Context: Cargo does not have border hold and status is being evaluated
GIVEN
Cargo does not have border hold and status is being evaluated
Applied to: Destination Hold?
WHEN
System checks for destination hold indicators
THEN
If destination hold exists, processing continues to release verification; otherwise check next hold type
Context: Cargo does not have border or destination hold and status is being evaluated
GIVEN
Cargo does not have border or destination hold and status is being evaluated
Applied to: FDA Hold?
WHEN
System checks for FDA hold indicators
THEN
If FDA hold exists, processing continues to release verification; otherwise check piece count hold
Context: Cargo does not have border, destination, or FDA hold and status is being evaluated
GIVEN
Cargo does not have border, destination, or FDA hold and status is being evaluated
Applied to: Piece Count Hold?
WHEN
System checks for piece count hold indicators
THEN
If piece count hold exists, processing continues to release verification; otherwise retrieve next cargo record
Context: Current cargo record processing is complete and no holds prevent continuation
GIVEN
Current cargo record processing is complete and no holds prevent continuation
Applied to: Retrieve Next Cargo Record with Same Car/Waybill
WHEN
System searches for additional cargo records with same car ID and waybill
THEN
Next matching cargo record is retrieved for processing
Context: A search for additional cargo records with same car ID and waybill has been performed
GIVEN
A search for additional cargo records with same car ID and waybill has been performed
Applied to: More Records with Same Car/Waybill?
WHEN
System evaluates search results for more records
THEN
If more records exist, continue processing; otherwise proceed to release verification
Context: All cargo records with same car ID and waybill have been processed
GIVEN
All cargo records with same car ID and waybill have been processed
Applied to: Verify Release Status Across All Records
WHEN
System verifies release status across all related records
THEN
Release status is verified for coordinated notification and database updates
Context: Release status has been verified across all related cargo records
GIVEN
Release status has been verified across all related cargo records
Applied to: All Records Released?
WHEN
System evaluates if all records are in released status
THEN
If all records released, generate comprehensive notification; otherwise generate status change notification
Context: All cargo records with same car ID and waybill are in released status
GIVEN
All cargo records with same car ID and waybill are in released status
Applied to: Generate Comprehensive Release Notification
WHEN
Comprehensive release notification is triggered
THEN
Complete release notification is generated for all stakeholders
Context: Cargo status changes have occurred during processing
GIVEN
Cargo status changes have occurred during processing
Applied to: Create Merlin Notification for Status Changes
WHEN
Merlin notification creation is triggered
THEN
Status change notifications are created and routed to appropriate recipients
Context: Cargo status changes and notifications have been processed
GIVEN
Cargo status changes and notifications have been processed
Applied to: Update Cargo Status in Database
WHEN
Database update is initiated
THEN
All cargo status changes are committed to the database
Context: All cargo records have been processed and database updates completed
GIVEN
All cargo records have been processed and database updates completed
Applied to: End Multi-Cargo Processing
WHEN
Multi-cargo processing reaches completion
THEN
Processing terminates successfully for the car/waybill group
Context: A lead manifest with an associated CCN and a current US CCN key are available
GIVEN
A lead manifest with an associated CCN and a current US CCN key are available
Applied to: Lead Manifest CCN differs from US CCN Key?
WHEN
The system compares the lead manifest CCN with the US CCN key
THEN
If the lead manifest CCN differs from the US CCN key, proceed with follower manifest processing, otherwise complete multi-manifest processing
Context: A follower manifest has been identified for processing
GIVEN
A follower manifest has been identified for processing
Applied to: Prepare Follower Manifest Data
WHEN
The system prepares follower manifest data
THEN
All required manifest data elements including cargo information, quantities, and entry numbers are prepared for message creation
Context: A follower manifest requires processing and the message type is GCW016
GIVEN
A follower manifest requires processing and the message type is GCW016
Applied to: Create 350 Special Action Message
WHEN
The system creates a special action message
THEN
A message with special action code 350 is created and general information is copied for the follower manifest
Context: A follower manifest message is being prepared and disposition codes exist
GIVEN
A follower manifest message is being prepared and disposition codes exist
Applied to: Include Disposition Codes in Message
WHEN
The system includes disposition codes in the message
THEN
All relevant disposition codes are included in the follower manifest message for downstream processing
Context: A follower manifest message is being prepared and cargo quantities are available
GIVEN
A follower manifest message is being prepared and cargo quantities are available
Applied to: Include Cargo Quantities in Message
WHEN
The system includes cargo quantities in the message
THEN
All relevant cargo quantities are included in the follower manifest message
Context: A follower manifest message is being prepared and entry numbers exist
GIVEN
A follower manifest message is being prepared and entry numbers exist
Applied to: Include Entry Numbers in Message
WHEN
The system includes entry numbers in the message
THEN
All relevant entry numbers are included in the follower manifest message
Context: A follower manifest message has been prepared with all required data
GIVEN
A follower manifest message has been prepared with all required data
Applied to: Spawn GCT0162E Transaction for Follower Processing
WHEN
The system spawns the GCT0162E transaction
THEN
The GCT0162E transaction is initiated with the prepared follower manifest message for processing
Context: A follower manifest and its corresponding lead manifest are identified
GIVEN
A follower manifest and its corresponding lead manifest are identified
Applied to: Link Follower Manifest to Lead Manifest
WHEN
The system links the follower manifest to the lead manifest
THEN
The relationship between the follower and lead manifest is established for comprehensive tracking
Context: A follower manifest has been processed and linked to its lead manifest
GIVEN
A follower manifest has been processed and linked to its lead manifest
Applied to: Update Comprehensive Cargo Tracking
WHEN
The system updates comprehensive cargo tracking
THEN
The cargo tracking system is updated with complete follower manifest information for full visibility
Context: A follower manifest processing action has been completed
GIVEN
A follower manifest processing action has been completed
Applied to: Log Follower Manifest Processing Action
WHEN
The system logs the processing action
THEN
The follower manifest processing action is recorded in the system log for audit and monitoring purposes
Context: One follower manifest has been processed and there may be additional follower manifests
GIVEN
One follower manifest has been processed and there may be additional follower manifests
Applied to: More Follower Manifests?
WHEN
The system checks for more follower manifests to process
THEN
If more follower manifests exist, continue processing the next one, otherwise complete multi-manifest processing
Context: A car ID and waybill number combination exists from previous N7 segment processing
GIVEN
A car ID and waybill number combination exists from previous N7 segment processing
Applied to: Retrieve First Cargo Record by Car ID and Waybill
WHEN
The system needs to process multiple cargo records with the same car and waybill
THEN
The system retrieves the first cargo record matching the car ID and waybill combination from the US cargo root segments
Context: A search has been performed for cargo records by car ID and waybill
GIVEN
A search has been performed for cargo records by car ID and waybill
Applied to: Cargo Record Found?
WHEN
The system evaluates the search results
THEN
If a cargo record is found, continue with individual cargo processing, otherwise end the multi-cargo processing
Context: A cargo record has been retrieved with matching car ID and waybill
GIVEN
A cargo record has been retrieved with matching car ID and waybill
Applied to: Process Individual Cargo Record
WHEN
The system processes the individual cargo record
THEN
The system applies the current disposition code processing logic to the cargo record
Context: An individual cargo record is being processed with current disposition code context
GIVEN
An individual cargo record is being processed with current disposition code context
Applied to: Update Cargo Status and Disposition Codes
WHEN
The system updates the cargo record
THEN
The system applies the disposition code to the cargo's status array and updates the cargo status according to disposition code processing rules
Context: One cargo record has been processed for a car ID and waybill combination
GIVEN
One cargo record has been processed for a car ID and waybill combination
Applied to: Check for Additional Cargo Records with Same Car/Waybill
WHEN
The system checks for additional records
THEN
The system searches the cargo database for other records with the same car ID and waybill combination
Context: A search has been performed for additional cargo records with the same car ID and waybill
GIVEN
A search has been performed for additional cargo records with the same car ID and waybill
Applied to: More Records with Same Car/Waybill?
WHEN
The system evaluates the search results
THEN
If more records are found, retrieve the next record for processing, otherwise proceed to release status verification
Context: Additional cargo records exist with the same car ID and waybill combination
GIVEN
Additional cargo records exist with the same car ID and waybill combination
Applied to: Retrieve Next Cargo Record
WHEN
The system retrieves the next record
THEN
The system fetches the next cargo record from the US cargo root segments for processing
Context: All cargo records with the same car ID and waybill have been processed
GIVEN
All cargo records with the same car ID and waybill have been processed
Applied to: Verify Release Status Across All Records
WHEN
The system verifies release status across all records
THEN
The system examines the release status of each processed cargo record to determine overall release state
Context: Release status has been verified across all cargo records with the same car ID and waybill
GIVEN
Release status has been verified across all cargo records with the same car ID and waybill
Applied to: All Records Have Same Release Status?
WHEN
The system evaluates status consistency
THEN
If all records have the same release status, generate comprehensive release notification, otherwise proceed to create Merlin notifications for status changes
Context: All cargo records with the same car ID and waybill have consistent release status
GIVEN
All cargo records with the same car ID and waybill have consistent release status
Applied to: Generate Comprehensive Release Notification
WHEN
The system generates release notification
THEN
The system creates a comprehensive release notification covering all related cargo records
Context: Cargo records have been processed and comprehensive release notification generated
GIVEN
Cargo records have been processed and comprehensive release notification generated
Applied to: Generate Export Notification if Applicable
WHEN
The system evaluates export notification requirements
THEN
If any cargo records have export status or export-related disposition codes, generate appropriate export notifications
Context: Export notifications have been processed for applicable cargo records
GIVEN
Export notifications have been processed for applicable cargo records
Applied to: Generate Arrival Notification if Applicable
WHEN
The system evaluates arrival notification requirements
THEN
If any cargo records have arrival status or arrival-related disposition codes, generate appropriate arrival notifications
Context: Cargo records with the same car ID and waybill do not have consistent release status OR arrival notifications have been processed
GIVEN
Cargo records with the same car ID and waybill do not have consistent release status OR arrival notifications have been processed
Applied to: Create Merlin Notification for Status Changes
WHEN
The system creates Merlin notifications
THEN
The system generates appropriate Merlin messages for each cargo status change including disposition code details and cargo information
Context: All notifications have been generated for cargo records with the same car ID and waybill
GIVEN
All notifications have been generated for cargo records with the same car ID and waybill
Applied to: Update Final Status for All Related Records
WHEN
The system updates final status
THEN
The system commits all status changes and disposition code updates to all related cargo records in the database
Context: A cargo record requires multi-cargo status verification
GIVEN
A cargo record requires multi-cargo status verification
Applied to: Start Multi-Cargo Status Verification
WHEN
The multi-cargo status verification process is initiated
THEN
The verification process begins and prepares to retrieve related cargo records
Context: A car ID and waybill number are provided for verification
GIVEN
A car ID and waybill number are provided for verification
Applied to: Retrieve All Cargo Records with Same Car ID and Waybill
WHEN
The system searches for related cargo records
THEN
All cargo records with matching car ID and waybill number are retrieved from the cargo database
Context: A search for cargo records with matching car ID and waybill has been performed
GIVEN
A search for cargo records with matching car ID and waybill has been performed
Applied to: More Records Found?
WHEN
The system checks for additional unprocessed records
THEN
If more records exist, continue processing individual records, otherwise proceed to status comparison
Context: An individual cargo record is selected for processing
GIVEN
An individual cargo record is selected for processing
Applied to: Process Individual Cargo Record
WHEN
The record processing begins
THEN
The cargo record is prepared for hold status analysis
Context: A cargo record is being processed for status verification
GIVEN
A cargo record is being processed for status verification
Applied to: Analyze Cargo Hold Status
WHEN
The hold status analysis is performed
THEN
The system evaluates all hold conditions and release status for the cargo
Context: A cargo record is being analyzed for release status
GIVEN
A cargo record is being analyzed for release status
Applied to: Check Manual Release Status
WHEN
The system checks for manual release indicators
THEN
If manual release is found, skip other hold checks and mark as released, otherwise continue with hold type evaluation
Context: A cargo record without manual release is being processed
GIVEN
A cargo record without manual release is being processed
Applied to: Check Various Hold Types
WHEN
Hold type evaluation begins
THEN
The system proceeds to check border holds, destination holds, FDA holds, and piece count holds
Context: A cargo record is being evaluated for hold conditions
GIVEN
A cargo record is being evaluated for hold conditions
Applied to: Evaluate Border Hold
WHEN
Border hold status is checked
THEN
The system determines if border hold conditions apply to the cargo
Applied to: Evaluate Destination Hold
WHEN
Destination hold status is checked
THEN
The system determines if destination hold conditions apply to the cargo
Applied to: Evaluate FDA Hold
WHEN
FDA hold status is checked
THEN
The system determines if FDA hold conditions apply to the cargo
Applied to: Evaluate Piece Count Hold
WHEN
Piece count hold status is checked
THEN
The system determines if piece count hold conditions apply based on quantity validation
Context: All hold conditions have been evaluated for a cargo record
GIVEN
All hold conditions have been evaluated for a cargo record
Applied to: Determine Individual Record Release Status
WHEN
The final release status is determined
THEN
The cargo record is classified as either released or held based on the evaluation results
Context: An individual cargo record's release status has been determined
GIVEN
An individual cargo record's release status has been determined
Applied to: Store Record Status in Verification Array
WHEN
The status is stored in the verification array
THEN
The record's release status is added to the array for later comparison with other related records
Context: All related cargo records have been processed and their statuses stored
GIVEN
All related cargo records have been processed and their statuses stored
Applied to: Compare All Record Statuses
WHEN
Status comparison is performed
THEN
The system compares all record statuses to determine if they are consistent
Context: All related cargo record statuses have been compared
GIVEN
All related cargo record statuses have been compared
Applied to: All Records Have Consistent Release Status?
WHEN
Consistency verification is performed
THEN
If all records have consistent release status, generate comprehensive release notification, otherwise create status mismatch warning
Context: All related cargo records have consistent release status
GIVEN
All related cargo records have consistent release status
Applied to: Generate Comprehensive Release Notification
WHEN
Comprehensive release notification is generated
THEN
A notification is created confirming the consistent release status across all related records
Context: Related cargo records have inconsistent release statuses
GIVEN
Related cargo records have inconsistent release statuses
Applied to: Create Release Status Mismatch Warning
WHEN
Status mismatch warning is created
THEN
A warning is generated indicating the inconsistency in release statuses among related records
Context: Multi-cargo status verification has been completed
GIVEN
Multi-cargo status verification has been completed
Applied to: Update Multi-Cargo Release Flag
WHEN
The multi-cargo release flag is updated
THEN
The flag is set to reflect the overall release status of all related cargo records
Applied to: Log Status Verification Results
WHEN
Results logging is performed
THEN
The verification results, including any warnings or notifications, are logged for audit purposes
Context: All multi-cargo status verification activities have been completed
GIVEN
All multi-cargo status verification activities have been completed
Applied to: End Multi-Cargo Status Verification
WHEN
The verification process ends
THEN
The process is completed and control is returned to the calling procedure
R-GCX016E-cbl-00431 (+16) File: GCX016E.cbl US Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US':
  • Context - a cargo record is being processed:
    For Identify Transit Cargo:
    When the system evaluates cargo routing and destination information, then the cargo is flagged for transit processing if it meets us-canada-us movement criteria.
  • Context - a cargo has been identified for potential transit processing:
    For Cargo Moving Through Canada?:
    When the system checks if the cargo routing involves movement through canadian territory, then the cargo is processed for canadian transit if routing goes through canada, otherwise standard processing continues.
  • Context - a cargo requires canadian transit processing:
    For Map US Port to Canadian Border Location:
    When the system needs to identify the canadian border location, then the us port is mapped to the corresponding canadian border crossing location using border location mapping tables.
  • Context - a canadian border location has been identified for the cargo:
    For Search Canadian Cargo Database:
    When the system searches the canadian cargo database using cargo identifiers, then the system retrieves matching canadian cargo records from gccc-cargo-root database.
  • Context - the system has searched the canadian cargo database:
    For Canadian Manifest Found?:
    When the search results are evaluated for matching manifests, then processing continues with equipment validation if canadian manifest found, otherwise error is generated.
  • Context - a canadian manifest has been found for the cargo:
    For Validate Equipment ID Match:
    When the system compares equipment ids between us and canadian records, then the equipment ids must match exactly for the records to be linked for transit processing.
  • Context - equipment id validation has been performed:
    For Equipment ID Matches?:
    When the system evaluates the match results, then cross-border tracking link is created if equipment ids match, otherwise error is generated for no canadian match.
  • Context - equipment ids match between us and canadian cargo records:
    For Create Cross-Border Tracking Link:
    When the system creates cross-border tracking relationships, then a tracking link is established connecting the us and canadian cargo records for transit monitoring.
  • Context - a cross-border tracking link has been created:
    For Update Transit Status:
    When the system updates cargo status information, then the cargo status is updated to reflect transit processing status and cross-border movement tracking.
  • Context - canadian cargo records are being evaluated for transit processing:
    For Exclude Deleted Canadian Records:
    When the system checks the status of canadian records, then records marked as deleted are excluded from transit processing consideration.
    For Exclude New Bond Created Records:
    When the system checks for new bond created status, then records with new bond created status are excluded from transit processing consideration.
  • Context - valid canadian records have been identified and linked:
    For Process Transit Routing:
    When the system processes transit routing information, then transit routing data is processed and updated for cross-border movement tracking.
  • Context - transit routing has been processed:
    For Update US Destination Information:
    When the system updates destination information, then the final us destination information is updated to reflect the cargo's ultimate destination after canadian transit.
  • Context - us destination information has been updated for transit cargo:
    For Generate Transit Notification:
    When the system generates processing notifications, then transit processing notifications are generated and sent to appropriate parties for cross-border movement tracking.
  • Context - transit notifications have been generated:
    For Log Transit Processing:
    When the system logs processing activities, then all transit processing activities are logged with timestamps and details for audit trail and tracking purposes.
  • Context - no canadian manifest is found or equipment ids do not match:
    For Generate Error - No Canadian Match:
    When the system cannot establish cross-border tracking, then an error is generated indicating no canadian match found and standard processing continues.
  • Context - cargo does not require canadian transit processing or transit processing has failed:
    For Continue Standard Processing:
    When the system determines standard processing should continue, then standard cargo processing procedures are followed without transit-specific handling.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed
GIVEN
A cargo record is being processed
Applied to: Identify Transit Cargo
WHEN
The system evaluates cargo routing and destination information
THEN
The cargo is flagged for transit processing if it meets US-Canada-US movement criteria
Context: A cargo has been identified for potential transit processing
GIVEN
A cargo has been identified for potential transit processing
Applied to: Cargo Moving Through Canada?
WHEN
The system checks if the cargo routing involves movement through Canadian territory
THEN
The cargo is processed for Canadian transit if routing goes through Canada, otherwise standard processing continues
Context: A cargo requires Canadian transit processing
GIVEN
A cargo requires Canadian transit processing
Applied to: Map US Port to Canadian Border Location
WHEN
The system needs to identify the Canadian border location
THEN
The US port is mapped to the corresponding Canadian border crossing location using border location mapping tables
Context: A Canadian border location has been identified for the cargo
GIVEN
A Canadian border location has been identified for the cargo
Applied to: Search Canadian Cargo Database
WHEN
The system searches the Canadian cargo database using cargo identifiers
THEN
The system retrieves matching Canadian cargo records from GCCC-CARGO-ROOT database
Context: The system has searched the Canadian cargo database
GIVEN
The system has searched the Canadian cargo database
Applied to: Canadian Manifest Found?
WHEN
The search results are evaluated for matching manifests
THEN
Processing continues with equipment validation if Canadian manifest found, otherwise error is generated
Context: A Canadian manifest has been found for the cargo
GIVEN
A Canadian manifest has been found for the cargo
Applied to: Validate Equipment ID Match
WHEN
The system compares equipment IDs between US and Canadian records
THEN
The equipment IDs must match exactly for the records to be linked for transit processing
Context: Equipment ID validation has been performed
GIVEN
Equipment ID validation has been performed
Applied to: Equipment ID Matches?
WHEN
The system evaluates the match results
THEN
Cross-border tracking link is created if equipment IDs match, otherwise error is generated for no Canadian match
Context: Equipment IDs match between US and Canadian cargo records
GIVEN
Equipment IDs match between US and Canadian cargo records
Applied to: Create Cross-Border Tracking Link
WHEN
The system creates cross-border tracking relationships
THEN
A tracking link is established connecting the US and Canadian cargo records for transit monitoring
Context: A cross-border tracking link has been created
GIVEN
A cross-border tracking link has been created
Applied to: Update Transit Status
WHEN
The system updates cargo status information
THEN
The cargo status is updated to reflect transit processing status and cross-border movement tracking
Context: Canadian cargo records are being evaluated for transit processing
GIVEN
Canadian cargo records are being evaluated for transit processing
Applied to: Exclude Deleted Canadian Records
WHEN
The system checks the status of Canadian records
THEN
Records marked as deleted are excluded from transit processing consideration
Applied to: Exclude New Bond Created Records
WHEN
The system checks for new bond created status
THEN
Records with new bond created status are excluded from transit processing consideration
Context: Valid Canadian records have been identified and linked
GIVEN
Valid Canadian records have been identified and linked
Applied to: Process Transit Routing
WHEN
The system processes transit routing information
THEN
Transit routing data is processed and updated for cross-border movement tracking
Context: Transit routing has been processed
GIVEN
Transit routing has been processed
Applied to: Update US Destination Information
WHEN
The system updates destination information
THEN
The final US destination information is updated to reflect the cargo's ultimate destination after Canadian transit
Context: US destination information has been updated for transit cargo
GIVEN
US destination information has been updated for transit cargo
Applied to: Generate Transit Notification
WHEN
The system generates processing notifications
THEN
Transit processing notifications are generated and sent to appropriate parties for cross-border movement tracking
Context: Transit notifications have been generated
GIVEN
Transit notifications have been generated
Applied to: Log Transit Processing
WHEN
The system logs processing activities
THEN
All transit processing activities are logged with timestamps and details for audit trail and tracking purposes
Context: No Canadian manifest is found or equipment IDs do not match
GIVEN
No Canadian manifest is found or equipment IDs do not match
Applied to: Generate Error - No Canadian Match
WHEN
The system cannot establish cross-border tracking
THEN
An error is generated indicating no Canadian match found and standard processing continues
Context: Cargo does not require Canadian transit processing or transit processing has failed
GIVEN
Cargo does not require Canadian transit processing or transit processing has failed
Applied to: Continue Standard Processing
WHEN
The system determines standard processing should continue
THEN
Standard cargo processing procedures are followed without transit-specific handling
R-GCX016E-cbl-00448 (+16) File: GCX016E.cbl Cargo Lookup by Bond Index Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Lookup by Bond Index':
  • Context - an incoming message contains bond number information in the message structure:
    For Extract Bond Number from Message:
    When the system processes the message to extract the bond number, then the bond number is extracted from the message and made available for validation.
  • Context - a bond number has been extracted from the message:
    For Bond Number Valid?:
    When the system validates the bond number format and content, then if the bond number is valid, processing continues; if invalid, an error is generated.
  • Context - a valid bond number has been extracted and validated:
    For Set Bond Number as Search Key:
    When the system prepares for cargo database lookup, then the bond number is set as the search key for cargo record retrieval.
  • Context - a bond number search key has been configured:
    For Call GCCUSIO2 Database Access:
    When the system needs to retrieve cargo records from the database, then the gccusio2 database access module is called with the bond number search key.
  • Context - database access has been initiated with a bond number search key:
    For Search GCSUSRT Cargo Root Segments:
    When the system searches the gcsusrt cargo root segments table, then all cargo records with matching bond numbers are identified for retrieval.
  • Context - a search has been performed on cargo root segments using bond number:
    For First Cargo Record Found?:
    When the system evaluates the search results, then if at least one cargo record is found, processing continues; if no records found, bond not found error is generated.
  • Context - at least one cargo record exists with the specified bond number:
    For Retrieve First Cargo Record:
    When the system retrieves cargo records, then the first matching cargo record is retrieved and made available for processing.
  • Context - the first cargo record has been successfully retrieved:
    For Set Cargo Found Flag:
    When the system updates processing status, then the cargo found flag is set to indicate successful cargo location.
  • Context - the first cargo record has been retrieved and cargo found flag is set:
    For Check for Additional Records:
    When the system checks for additional records with the same bond number, then the system determines if more cargo records exist with the same bond number.
  • Context - additional record check has been performed:
    For More Records with Same Bond?:
    When the system evaluates if more records exist with the same bond number, then if more records exist, they are retrieved; if no more records, processing continues with current records.
  • Context - additional cargo records exist with the same bond number:
    For Retrieve Next Cargo Record:
    When the system retrieves the next cargo record, then the next matching cargo record is retrieved and prepared for processing.
  • Context - a cargo record has been retrieved (first or subsequent):
    For Add to Cargo Processing List:
    When the system manages the cargo processing list, then the cargo record is added to the processing list for subsequent operations.
  • Context - all cargo records with the bond number have been retrieved and added to processing list:
    For Set Bond Index for Processing:
    When the system prepares for cargo processing operations, then the bond index is configured for processing all associated cargo records.
  • Context - bond index has been configured and all cargo records are in the processing list:
    For Return Cargo Records for Processing:
    When the cargo lookup operation completes successfully, then all cargo records associated with the bond number are returned for processing.
  • Context - a bond number search has been performed and no cargo records were found:
    For Generate Bond Not Found Error:
    When the system processes the empty search result, then a bond not found error is generated for the specified bond number.
  • Context - a bond not found error has been generated:
    For Log Bond Lookup Failure:
    When the system handles the error condition, then the bond lookup failure is logged with relevant details for audit purposes.
  • Context - bond lookup failure has been logged:
    For Continue with Next Message:
    When the system completes error handling for the current message, then processing continues with the next available message in the queue.
👨‍💻 Technical ACs (Gherkin)
Context: An incoming message contains bond number information in the message structure
GIVEN
An incoming message contains bond number information in the message structure
Applied to: Extract Bond Number from Message
WHEN
The system processes the message to extract the bond number
THEN
The bond number is extracted from the message and made available for validation
Context: A bond number has been extracted from the message
GIVEN
A bond number has been extracted from the message
Applied to: Bond Number Valid?
WHEN
The system validates the bond number format and content
THEN
If the bond number is valid, processing continues; if invalid, an error is generated
Context: A valid bond number has been extracted and validated
GIVEN
A valid bond number has been extracted and validated
Applied to: Set Bond Number as Search Key
WHEN
The system prepares for cargo database lookup
THEN
The bond number is set as the search key for cargo record retrieval
Context: A bond number search key has been configured
GIVEN
A bond number search key has been configured
Applied to: Call GCCUSIO2 Database Access
WHEN
The system needs to retrieve cargo records from the database
THEN
The GCCUSIO2 database access module is called with the bond number search key
Context: Database access has been initiated with a bond number search key
GIVEN
Database access has been initiated with a bond number search key
Applied to: Search GCSUSRT Cargo Root Segments
WHEN
The system searches the GCSUSRT cargo root segments table
THEN
All cargo records with matching bond numbers are identified for retrieval
Context: A search has been performed on cargo root segments using bond number
GIVEN
A search has been performed on cargo root segments using bond number
Applied to: First Cargo Record Found?
WHEN
The system evaluates the search results
THEN
If at least one cargo record is found, processing continues; if no records found, bond not found error is generated
Context: At least one cargo record exists with the specified bond number
GIVEN
At least one cargo record exists with the specified bond number
Applied to: Retrieve First Cargo Record
WHEN
The system retrieves cargo records
THEN
The first matching cargo record is retrieved and made available for processing
Context: The first cargo record has been successfully retrieved
GIVEN
The first cargo record has been successfully retrieved
Applied to: Set Cargo Found Flag
WHEN
The system updates processing status
THEN
The cargo found flag is set to indicate successful cargo location
Context: The first cargo record has been retrieved and cargo found flag is set
GIVEN
The first cargo record has been retrieved and cargo found flag is set
Applied to: Check for Additional Records
WHEN
The system checks for additional records with the same bond number
THEN
The system determines if more cargo records exist with the same bond number
Context: Additional record check has been performed
GIVEN
Additional record check has been performed
Applied to: More Records with Same Bond?
WHEN
The system evaluates if more records exist with the same bond number
THEN
If more records exist, they are retrieved; if no more records, processing continues with current records
Context: Additional cargo records exist with the same bond number
GIVEN
Additional cargo records exist with the same bond number
Applied to: Retrieve Next Cargo Record
WHEN
The system retrieves the next cargo record
THEN
The next matching cargo record is retrieved and prepared for processing
Context: A cargo record has been retrieved (first or subsequent)
GIVEN
A cargo record has been retrieved (first or subsequent)
Applied to: Add to Cargo Processing List
WHEN
The system manages the cargo processing list
THEN
The cargo record is added to the processing list for subsequent operations
Context: All cargo records with the bond number have been retrieved and added to processing list
GIVEN
All cargo records with the bond number have been retrieved and added to processing list
Applied to: Set Bond Index for Processing
WHEN
The system prepares for cargo processing operations
THEN
The bond index is configured for processing all associated cargo records
Context: Bond index has been configured and all cargo records are in the processing list
GIVEN
Bond index has been configured and all cargo records are in the processing list
Applied to: Return Cargo Records for Processing
WHEN
The cargo lookup operation completes successfully
THEN
All cargo records associated with the bond number are returned for processing
Context: A bond number search has been performed and no cargo records were found
GIVEN
A bond number search has been performed and no cargo records were found
Applied to: Generate Bond Not Found Error
WHEN
The system processes the empty search result
THEN
A bond not found error is generated for the specified bond number
Context: A bond not found error has been generated
GIVEN
A bond not found error has been generated
Applied to: Log Bond Lookup Failure
WHEN
The system handles the error condition
THEN
The bond lookup failure is logged with relevant details for audit purposes
Context: Bond lookup failure has been logged
GIVEN
Bond lookup failure has been logged
Applied to: Continue with Next Message
WHEN
The system completes error handling for the current message
THEN
Processing continues with the next available message in the queue
R-GCX016E-cbl-00465 (+16) File: GCX016E.cbl Cargo Lookup by Car ID Index Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Lookup by Car ID Index':
  • Context - a car equipment initial and number are provided from n7 segment:
    For Format Car ID using Standard Rules:
    When the system needs to create a car id key for cargo lookup, then the car id is formatted by concatenating equipment initial and number with proper spacing and validation.
  • Context - a formatted car id key exists:
    For Search Cargo Database by Car ID:
    When the system searches for cargo records in the database, then the system queries both us cargo root segments and car id index tables to find matching records.
  • Context - a database search has been performed for a car id:
    For Cargo Record Found?:
    When the system evaluates the search results, then if a cargo record is found, retrieve the existing record; otherwise proceed to cprs traffic check.
  • Context - a cargo record exists in the database for the car id:
    For Retrieve Existing Cargo Record:
    When the system needs to process the cargo, then the existing cargo record is retrieved and made available for further processing.
  • Context - no cargo record was found in the initial database search:
    For Is CPRS Traffic?:
    When the system evaluates the traffic type, then if the cargo is identified as cprs traffic, apply cprs special processing; otherwise generate error message for missing cargo.
  • Context - cargo is identified as cprs traffic and no initial record was found:
    For Apply CPRS Special Processing:
    When cprs special processing is triggered, then the system handles scac unknown scenarios and performs us-ccn key renumbering for cprs-specific lookup.
  • Context - cprs traffic is being processed:
    For Handle SCAC Unknown Scenarios:
    When the scac code is unknown or not available, then the system applies default scac handling rules and prepares for key renumbering.
  • Context - cprs traffic requires special key handling:
    For Perform US-CCN Key Renumbering:
    When us-ccn key renumbering is performed, then the system creates an updated lookup key using cprs-specific numbering rules.
  • Context - a renumbered us-ccn key has been created for cprs traffic:
    For Search Again with Updated Key:
    When the system searches the database again, then the system queries the cargo database using the updated cprs key.
  • Context - cprs special processing and secondary search have been completed:
    For Record Found After CPRS Processing?:
    When the system evaluates the search results, then if a record is found, retrieve the existing cargo record; otherwise create a new cprs cargo record.
  • Context - no cargo record exists after cprs processing and secondary search:
    For Create New CPRS Cargo Record:
    When a new cprs cargo record needs to be created, then the system initiates creation of a new cargo record with cprs-specific attributes.
  • Context - a new cprs cargo record is being created:
    For Initialize New Record with Car ID:
    When the record initialization process begins, then the new record is populated with the car id and basic identification information.
  • Context - a new cprs cargo record is being initialized:
    For Set CPRS-Specific Flags:
    When cprs-specific attributes need to be set, then the system applies cprs-specific flags, processing indicators, and business rule markers.
  • Context - a new cprs cargo record has been fully initialized:
    For Insert New Record into Database:
    When the record is ready for database storage, then the system inserts the new record into the us cargo root segments database.
  • Context - a new cprs cargo record has been successfully inserted into the database:
    For Log CPRS Cargo Creation:
    When audit logging is required, then the system creates log entries documenting the cprs cargo creation event.
  • Context - a cargo record has been found or created successfully:
    For Return Cargo Record for Processing:
    When the lookup process is complete, then the system returns the cargo record to the calling process for further business operations.
  • Context - no cargo record exists and the traffic is not cprs type:
    For Generate Error Message for Missing Cargo:
    When the cargo lookup process fails, then the system generates an error message indicating the cargo could not be located for the given car id.
👨‍💻 Technical ACs (Gherkin)
Context: A car equipment initial and number are provided from N7 segment
GIVEN
A car equipment initial and number are provided from N7 segment
Applied to: Format Car ID using Standard Rules
WHEN
The system needs to create a car ID key for cargo lookup
THEN
The car ID is formatted by concatenating equipment initial and number with proper spacing and validation
Context: A formatted car ID key exists
GIVEN
A formatted car ID key exists
Applied to: Search Cargo Database by Car ID
WHEN
The system searches for cargo records in the database
THEN
The system queries both US cargo root segments and car ID index tables to find matching records
Context: A database search has been performed for a car ID
GIVEN
A database search has been performed for a car ID
Applied to: Cargo Record Found?
WHEN
The system evaluates the search results
THEN
If a cargo record is found, retrieve the existing record; otherwise proceed to CPRS traffic check
Context: A cargo record exists in the database for the car ID
GIVEN
A cargo record exists in the database for the car ID
Applied to: Retrieve Existing Cargo Record
WHEN
The system needs to process the cargo
THEN
The existing cargo record is retrieved and made available for further processing
Context: No cargo record was found in the initial database search
GIVEN
No cargo record was found in the initial database search
Applied to: Is CPRS Traffic?
WHEN
The system evaluates the traffic type
THEN
If the cargo is identified as CPRS traffic, apply CPRS special processing; otherwise generate error message for missing cargo
Context: Cargo is identified as CPRS traffic and no initial record was found
GIVEN
Cargo is identified as CPRS traffic and no initial record was found
Applied to: Apply CPRS Special Processing
WHEN
CPRS special processing is triggered
THEN
The system handles SCAC unknown scenarios and performs US-CCN key renumbering for CPRS-specific lookup
Context: CPRS traffic is being processed
GIVEN
CPRS traffic is being processed
Applied to: Handle SCAC Unknown Scenarios
WHEN
The SCAC code is unknown or not available
THEN
The system applies default SCAC handling rules and prepares for key renumbering
Context: CPRS traffic requires special key handling
GIVEN
CPRS traffic requires special key handling
Applied to: Perform US-CCN Key Renumbering
WHEN
US-CCN key renumbering is performed
THEN
The system creates an updated lookup key using CPRS-specific numbering rules
Context: A renumbered US-CCN key has been created for CPRS traffic
GIVEN
A renumbered US-CCN key has been created for CPRS traffic
Applied to: Search Again with Updated Key
WHEN
The system searches the database again
THEN
The system queries the cargo database using the updated CPRS key
Context: CPRS special processing and secondary search have been completed
GIVEN
CPRS special processing and secondary search have been completed
Applied to: Record Found After CPRS Processing?
WHEN
The system evaluates the search results
THEN
If a record is found, retrieve the existing cargo record; otherwise create a new CPRS cargo record
Context: No cargo record exists after CPRS processing and secondary search
GIVEN
No cargo record exists after CPRS processing and secondary search
Applied to: Create New CPRS Cargo Record
WHEN
A new CPRS cargo record needs to be created
THEN
The system initiates creation of a new cargo record with CPRS-specific attributes
Context: A new CPRS cargo record is being created
GIVEN
A new CPRS cargo record is being created
Applied to: Initialize New Record with Car ID
WHEN
The record initialization process begins
THEN
The new record is populated with the car ID and basic identification information
Context: A new CPRS cargo record is being initialized
GIVEN
A new CPRS cargo record is being initialized
Applied to: Set CPRS-Specific Flags
WHEN
CPRS-specific attributes need to be set
THEN
The system applies CPRS-specific flags, processing indicators, and business rule markers
Context: A new CPRS cargo record has been fully initialized
GIVEN
A new CPRS cargo record has been fully initialized
Applied to: Insert New Record into Database
WHEN
The record is ready for database storage
THEN
The system inserts the new record into the US cargo root segments database
Context: A new CPRS cargo record has been successfully inserted into the database
GIVEN
A new CPRS cargo record has been successfully inserted into the database
Applied to: Log CPRS Cargo Creation
WHEN
Audit logging is required
THEN
The system creates log entries documenting the CPRS cargo creation event
Context: A cargo record has been found or created successfully
GIVEN
A cargo record has been found or created successfully
Applied to: Return Cargo Record for Processing
WHEN
The lookup process is complete
THEN
The system returns the cargo record to the calling process for further business operations
Context: No cargo record exists and the traffic is not CPRS type
GIVEN
No cargo record exists and the traffic is not CPRS type
Applied to: Generate Error Message for Missing Cargo
WHEN
The cargo lookup process fails
THEN
The system generates an error message indicating the cargo could not be located for the given car ID
R-GCX016E-cbl-00482 (+15) File: GCX016E.cbl Cargo Lookup by Car/Waybill Combination Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Lookup by Car/Waybill Combination':
  • Context - equipment initial and equipment number are provided from n7 segment:
    For Format Car ID using Standard Rules:
    When system needs to format car id for cargo lookup, then system concatenates equipment initial and equipment number to create standardized car id format.
  • Context - formatted car id and waybill number are available:
    For Build Car/Waybill Search Key:
    When system prepares to search for cargo records, then system builds composite search key using car id and waybill number combination.
  • Context - car/waybill search key is constructed:
    For Search GCSUSRT Database by Car/Waybill Index:
    When system searches gcsusrt database using car/waybill index, then system retrieves cargo records matching the car/waybill combination.
  • Context - database search for car/waybill combination is completed:
    For First Cargo Record Found?:
    When system checks search results, then system determines if first cargo record exists and proceeds with retrieval or handles not found scenario.
  • Context - first cargo record exists for car/waybill combination:
    For Retrieve First Cargo Record:
    When system retrieves the first matching cargo record, then system loads cargo record data for processing.
  • Context - first cargo record is successfully retrieved:
    For Store Cargo Information:
    When system processes the cargo record data, then system stores cargo information in working storage for further processing.
  • Context - first cargo record is processed and stored:
    For Search for Additional Records with Same Car/Waybill:
    When system searches for additional records with same car/waybill, then system identifies all remaining cargo records with matching car/waybill combination.
  • Context - search for additional cargo records is completed:
    For More Records Found?:
    When system evaluates search results for more records, then system determines if additional records exist and continues retrieval or proceeds to next processing step.
  • Context - additional cargo records exist for car/waybill combination:
    For Retrieve Next Cargo Record:
    When system retrieves next matching cargo record, then system loads additional cargo record data for processing.
  • Context - additional cargo record is successfully retrieved:
    For Add to Cargo Collection:
    When system processes the additional cargo record, then system adds cargo record to the collection and continues search for more records.
  • Context - all cargo records for car/waybill combination are collected:
    For CPRS Traffic?:
    When system checks cargo characteristics for cprs traffic indicators, then system determines if cprs special handling rules should be applied.
  • Context - cargo is identified as cprs traffic:
    For Apply CPRS Handling Rules:
    When system applies cprs handling rules, then system clears car id information and applies cprs-specific processing logic.
  • Context - car id is formatted and cprs processing is completed if applicable:
    For Validate Car ID Format:
    When system validates car id format, then system ensures car id meets format requirements and is ready for processing.
  • Context - all cargo records are retrieved, validated, and processed:
    For Return All Matching Cargo Records:
    When system completes cargo lookup operation, then system returns complete collection of matching cargo records for further processing.
  • Context - no cargo records exist for the specified car/waybill combination:
    For Handle Cargo Not Found Scenario:
    When system handles cargo not found scenario, then system logs the not found condition and continues processing without cargo records.
  • Context - cargo lookup operation is completed with or without results:
    For Log Search Results:
    When system logs search results, then system records search outcome including number of records found or not found status.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment initial and equipment number are provided from N7 segment
GIVEN
Equipment initial and equipment number are provided from N7 segment
Applied to: Format Car ID using Standard Rules
WHEN
System needs to format car ID for cargo lookup
THEN
System concatenates equipment initial and equipment number to create standardized car ID format
Context: Formatted car ID and waybill number are available
GIVEN
Formatted car ID and waybill number are available
Applied to: Build Car/Waybill Search Key
WHEN
System prepares to search for cargo records
THEN
System builds composite search key using car ID and waybill number combination
Context: Car/waybill search key is constructed
GIVEN
Car/waybill search key is constructed
Applied to: Search GCSUSRT Database by Car/Waybill Index
WHEN
System searches GCSUSRT database using car/waybill index
THEN
System retrieves cargo records matching the car/waybill combination
Context: Database search for car/waybill combination is completed
GIVEN
Database search for car/waybill combination is completed
Applied to: First Cargo Record Found?
WHEN
System checks search results
THEN
System determines if first cargo record exists and proceeds with retrieval or handles not found scenario
Context: First cargo record exists for car/waybill combination
GIVEN
First cargo record exists for car/waybill combination
Applied to: Retrieve First Cargo Record
WHEN
System retrieves the first matching cargo record
THEN
System loads cargo record data for processing
Context: First cargo record is successfully retrieved
GIVEN
First cargo record is successfully retrieved
Applied to: Store Cargo Information
WHEN
System processes the cargo record data
THEN
System stores cargo information in working storage for further processing
Context: First cargo record is processed and stored
GIVEN
First cargo record is processed and stored
Applied to: Search for Additional Records with Same Car/Waybill
WHEN
System searches for additional records with same car/waybill
THEN
System identifies all remaining cargo records with matching car/waybill combination
Context: Search for additional cargo records is completed
GIVEN
Search for additional cargo records is completed
Applied to: More Records Found?
WHEN
System evaluates search results for more records
THEN
System determines if additional records exist and continues retrieval or proceeds to next processing step
Context: Additional cargo records exist for car/waybill combination
GIVEN
Additional cargo records exist for car/waybill combination
Applied to: Retrieve Next Cargo Record
WHEN
System retrieves next matching cargo record
THEN
System loads additional cargo record data for processing
Context: Additional cargo record is successfully retrieved
GIVEN
Additional cargo record is successfully retrieved
Applied to: Add to Cargo Collection
WHEN
System processes the additional cargo record
THEN
System adds cargo record to the collection and continues search for more records
Context: All cargo records for car/waybill combination are collected
GIVEN
All cargo records for car/waybill combination are collected
Applied to: CPRS Traffic?
WHEN
System checks cargo characteristics for CPRS traffic indicators
THEN
System determines if CPRS special handling rules should be applied
Context: Cargo is identified as CPRS traffic
GIVEN
Cargo is identified as CPRS traffic
Applied to: Apply CPRS Handling Rules
WHEN
System applies CPRS handling rules
THEN
System clears car ID information and applies CPRS-specific processing logic
Context: Car ID is formatted and CPRS processing is completed if applicable
GIVEN
Car ID is formatted and CPRS processing is completed if applicable
Applied to: Validate Car ID Format
WHEN
System validates car ID format
THEN
System ensures car ID meets format requirements and is ready for processing
Context: All cargo records are retrieved, validated, and processed
GIVEN
All cargo records are retrieved, validated, and processed
Applied to: Return All Matching Cargo Records
WHEN
System completes cargo lookup operation
THEN
System returns complete collection of matching cargo records for further processing
Context: No cargo records exist for the specified car/waybill combination
GIVEN
No cargo records exist for the specified car/waybill combination
Applied to: Handle Cargo Not Found Scenario
WHEN
System handles cargo not found scenario
THEN
System logs the not found condition and continues processing without cargo records
Context: Cargo lookup operation is completed with or without results
GIVEN
Cargo lookup operation is completed with or without results
Applied to: Log Search Results
WHEN
System logs search results
THEN
System records search outcome including number of records found or not found status
R-GCX016E-cbl-00498 (+18) File: GCX016E.cbl Cargo 350 Message Logging Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo 350 Message Logging':
  • Context - a disposition code is received for cargo processing:
    For Disposition Code Type?:
    When the system evaluates the disposition code type, then the system must categorize it as hold, release, arrival, export, seizure, status information, or cancellation action type.
  • Context - a disposition code is classified as a hold action type:
    For Log Hold Action:
    When the system processes the hold disposition code, then the system must log the hold action with disposition code details and action description.
  • Context - a disposition code is classified as a release action type:
    For Log Release Action:
    When the system processes the release disposition code, then the system must log the release action with disposition code details and action description.
  • Context - a disposition code is classified as an arrival action type:
    For Log Arrival Action:
    When the system processes the arrival disposition code, then the system must log the arrival action with disposition code details and action description.
  • Context - a disposition code is classified as an export action type:
    For Log Export Action:
    When the system processes the export disposition code, then the system must log the export action with disposition code details and action description.
  • Context - a disposition code is classified as a seizure action type:
    For Log Seizure Action:
    When the system processes the seizure disposition code, then the system must log the seizure action with disposition code details and action description.
  • Context - a disposition code is classified as status information type:
    For Log Status Information:
    When the system processes the status information disposition code, then the system must log the status information with disposition code details and action description.
  • Context - a disposition code is classified as a cancellation action type:
    For Log Cancellation Action:
    When the system processes the cancellation disposition code, then the system must log the cancellation action with disposition code details and action description.
  • Context - a disposition code action has been categorized and logged:
    For Prepare Log Message:
    When the system prepares the log message structure, then the system must create a standardized message format ready for timestamp, equipment, disposition, and user information.
  • Context - a log message structure has been prepared for cargo disposition action:
    For Add Timestamp Information:
    When the system adds timestamp information to the log message, then the system must include the current processing timestamp in the log message.
  • Context - a log message has timestamp information added:
    For Add Equipment Details:
    When the system adds equipment details to the log message, then the system must include equipment id, waybill number, and us-ccn in the log message.
  • Context - a log message has equipment details added:
    For Add Disposition Code Details:
    When the system adds disposition code details to the log message, then the system must include the disposition code and corresponding action description in the log message.
  • Context - a log message has disposition code details added:
    For Add User Information:
    When the system adds user information to the log message, then the system must include the user id who initiated the disposition code action in the log message.
  • Context - a complete log message with all required information has been prepared:
    For Spawn GCT1051E Transaction:
    When the system spawns gct1051e transaction for logging, then the system must invoke gct1051e transaction with the complete log message for processing.
  • Context - gct1051e transaction has been spawned with the log message:
    For Write to Audit Trail:
    When the system writes to the audit trail, then the system must permanently store the cargo disposition log message in the audit trail database.
  • Context - the audit trail write operation has been attempted:
    For Logging Successful?:
    When the system validates logging success, then the system must determine if the logging was successful or if an error occurred during the process.
  • Context - the cargo disposition logging has been validated as successful:
    For Continue Processing:
    When the system continues processing, then the system must proceed with the next step in the cargo processing workflow.
  • Context - the cargo disposition logging has been validated as unsuccessful:
    For Handle Logging Error:
    When the system handles the logging error, then the system must implement appropriate error handling procedures and may generate error notifications.
  • Context - the cargo disposition logging process has either completed successfully or error handling has been performed:
    For End Logging Process:
    When the system ends the logging process, then the system must properly terminate the logging process and clean up any resources used.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received for cargo processing
GIVEN
A disposition code is received for cargo processing
Applied to: Disposition Code Type?
WHEN
The system evaluates the disposition code type
THEN
The system must categorize it as Hold, Release, Arrival, Export, Seizure, Status Information, or Cancellation action type
Context: A disposition code is classified as a hold action type
GIVEN
A disposition code is classified as a hold action type
Applied to: Log Hold Action
WHEN
The system processes the hold disposition code
THEN
The system must log the hold action with disposition code details and action description
Context: A disposition code is classified as a release action type
GIVEN
A disposition code is classified as a release action type
Applied to: Log Release Action
WHEN
The system processes the release disposition code
THEN
The system must log the release action with disposition code details and action description
Context: A disposition code is classified as an arrival action type
GIVEN
A disposition code is classified as an arrival action type
Applied to: Log Arrival Action
WHEN
The system processes the arrival disposition code
THEN
The system must log the arrival action with disposition code details and action description
Context: A disposition code is classified as an export action type
GIVEN
A disposition code is classified as an export action type
Applied to: Log Export Action
WHEN
The system processes the export disposition code
THEN
The system must log the export action with disposition code details and action description
Context: A disposition code is classified as a seizure action type
GIVEN
A disposition code is classified as a seizure action type
Applied to: Log Seizure Action
WHEN
The system processes the seizure disposition code
THEN
The system must log the seizure action with disposition code details and action description
Context: A disposition code is classified as status information type
GIVEN
A disposition code is classified as status information type
Applied to: Log Status Information
WHEN
The system processes the status information disposition code
THEN
The system must log the status information with disposition code details and action description
Context: A disposition code is classified as a cancellation action type
GIVEN
A disposition code is classified as a cancellation action type
Applied to: Log Cancellation Action
WHEN
The system processes the cancellation disposition code
THEN
The system must log the cancellation action with disposition code details and action description
Context: A disposition code action has been categorized and logged
GIVEN
A disposition code action has been categorized and logged
Applied to: Prepare Log Message
WHEN
The system prepares the log message structure
THEN
The system must create a standardized message format ready for timestamp, equipment, disposition, and user information
Context: A log message structure has been prepared for cargo disposition action
GIVEN
A log message structure has been prepared for cargo disposition action
Applied to: Add Timestamp Information
WHEN
The system adds timestamp information to the log message
THEN
The system must include the current processing timestamp in the log message
Context: A log message has timestamp information added
GIVEN
A log message has timestamp information added
Applied to: Add Equipment Details
WHEN
The system adds equipment details to the log message
THEN
The system must include equipment ID, waybill number, and US-CCN in the log message
Context: A log message has equipment details added
GIVEN
A log message has equipment details added
Applied to: Add Disposition Code Details
WHEN
The system adds disposition code details to the log message
THEN
The system must include the disposition code and corresponding action description in the log message
Context: A log message has disposition code details added
GIVEN
A log message has disposition code details added
Applied to: Add User Information
WHEN
The system adds user information to the log message
THEN
The system must include the user ID who initiated the disposition code action in the log message
Context: A complete log message with all required information has been prepared
GIVEN
A complete log message with all required information has been prepared
Applied to: Spawn GCT1051E Transaction
WHEN
The system spawns GCT1051E transaction for logging
THEN
The system must invoke GCT1051E transaction with the complete log message for processing
Context: GCT1051E transaction has been spawned with the log message
GIVEN
GCT1051E transaction has been spawned with the log message
Applied to: Write to Audit Trail
WHEN
The system writes to the audit trail
THEN
The system must permanently store the cargo disposition log message in the audit trail database
Context: The audit trail write operation has been attempted
GIVEN
The audit trail write operation has been attempted
Applied to: Logging Successful?
WHEN
The system validates logging success
THEN
The system must determine if the logging was successful or if an error occurred during the process
Context: The cargo disposition logging has been validated as successful
GIVEN
The cargo disposition logging has been validated as successful
Applied to: Continue Processing
WHEN
The system continues processing
THEN
The system must proceed with the next step in the cargo processing workflow
Context: The cargo disposition logging has been validated as unsuccessful
GIVEN
The cargo disposition logging has been validated as unsuccessful
Applied to: Handle Logging Error
WHEN
The system handles the logging error
THEN
The system must implement appropriate error handling procedures and may generate error notifications
Context: The cargo disposition logging process has either completed successfully or error handling has been performed
GIVEN
The cargo disposition logging process has either completed successfully or error handling has been performed
Applied to: End Logging Process
WHEN
The system ends the logging process
THEN
The system must properly terminate the logging process and clean up any resources used
R-GCX016E-cbl-00517 (+12) File: GCX016E.cbl K1 Remark Message Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'K1 Remark Message Processing':
  • Context - a k1 segment is received for processing:
    For Message Type?:
    When the system evaluates the message context to determine processing type, then the k1 segment is classified as either train message or cargo message for appropriate processing workflow.
  • Context - a k1 segment contains free-form text data:
    For Extract Free-Form Text:
    When the system processes the k1 segment, then the free-form text content is extracted and prepared for validation.
  • Context - free-form text has been extracted from k1 segment:
    For Text Valid?:
    When the system validates the text content, then the text is either accepted as valid for further processing or rejected if it fails validation criteria.
  • Context - a valid k1 message is classified as train-related:
    For Store K1 Message for Train:
    When the system processes the validated k1 content, then the k1 message is stored in train message repository for inclusion in train notifications.
  • Context - a valid k1 message is classified as cargo-related:
    For Store K1 Message for Cargo:
    When the system processes the validated k1 content, then the k1 message is stored in cargo message repository for inclusion in cargo notifications.
  • Context - a k1 message has been stored for either train or cargo processing:
    For Log K1 Message Action:
    When the system completes k1 message storage, then the k1 message processing action is logged with appropriate details for audit purposes.
  • Context - a k1 message has been logged and processed:
    For Associate with Disposition Code:
    When the system identifies related disposition codes, then the k1 message is associated with the appropriate disposition code for combined processing.
  • Context - a k1 message is associated with a disposition code:
    For Special K1 Type?:
    When the system evaluates k1 content for special processing requirements, then the k1 message is classified as either requiring special bond creation processing or standard remark processing.
  • Context - a k1 message contains canadian pacific railway identifiers such as 'director of customs, cp rail', 'canadian pacific limited', or 'canadian pacific railway co':
    For Canadian Pacific Railway Bond Creation:
    When the system processes the special k1 type, then a broker bond creation message is generated for canadian pacific railway processing.
  • Context - a k1 message does not require special bond creation processing:
    For Standard K1 Remark:
    When the system processes the k1 message type, then the k1 message is processed as a standard remark for inclusion in notifications.
  • Context - a k1 message has been processed as either special bond creation or standard remark:
    For Add to Merlin Message:
    When the system prepares merlin notifications, then the k1 message content is added to appropriate merlin messages for distribution.
  • Context - k1 messages are included in cargo and train notifications:
    For Format K1 Comments:
    When the system formats the notification content, then k1 comments are formatted with up to 4 lines of k1 segment comments as available and properly structured for recipient systems.
  • Context - k1 comments have been formatted for notifications:
    For Integrate with Status Updates:
    When the system processes status updates for cargo or train operations, then the formatted k1 comments are integrated with status updates to provide complete information context.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 segment is received for processing
GIVEN
A K1 segment is received for processing
Applied to: Message Type?
WHEN
The system evaluates the message context to determine processing type
THEN
The K1 segment is classified as either train message or cargo message for appropriate processing workflow
Context: A K1 segment contains free-form text data
GIVEN
A K1 segment contains free-form text data
Applied to: Extract Free-Form Text
WHEN
The system processes the K1 segment
THEN
The free-form text content is extracted and prepared for validation
Context: Free-form text has been extracted from K1 segment
GIVEN
Free-form text has been extracted from K1 segment
Applied to: Text Valid?
WHEN
The system validates the text content
THEN
The text is either accepted as valid for further processing or rejected if it fails validation criteria
Context: A valid K1 message is classified as train-related
GIVEN
A valid K1 message is classified as train-related
Applied to: Store K1 Message for Train
WHEN
The system processes the validated K1 content
THEN
The K1 message is stored in train message repository for inclusion in train notifications
Context: A valid K1 message is classified as cargo-related
GIVEN
A valid K1 message is classified as cargo-related
Applied to: Store K1 Message for Cargo
WHEN
The system processes the validated K1 content
THEN
The K1 message is stored in cargo message repository for inclusion in cargo notifications
Context: A K1 message has been stored for either train or cargo processing
GIVEN
A K1 message has been stored for either train or cargo processing
Applied to: Log K1 Message Action
WHEN
The system completes K1 message storage
THEN
The K1 message processing action is logged with appropriate details for audit purposes
Context: A K1 message has been logged and processed
GIVEN
A K1 message has been logged and processed
Applied to: Associate with Disposition Code
WHEN
The system identifies related disposition codes
THEN
The K1 message is associated with the appropriate disposition code for combined processing
Context: A K1 message is associated with a disposition code
GIVEN
A K1 message is associated with a disposition code
Applied to: Special K1 Type?
WHEN
The system evaluates K1 content for special processing requirements
THEN
The K1 message is classified as either requiring special bond creation processing or standard remark processing
Context: A K1 message contains Canadian Pacific Railway identifiers such as 'DIRECTOR OF CUSTOMS, CP RAIL', 'CANADIAN PACIFIC LIMITED', or 'CANADIAN PACIFIC RAILWAY CO'
GIVEN
A K1 message contains Canadian Pacific Railway identifiers such as 'DIRECTOR OF CUSTOMS, CP RAIL', 'CANADIAN PACIFIC LIMITED', or 'CANADIAN PACIFIC RAILWAY CO'
Applied to: Canadian Pacific Railway Bond Creation
WHEN
The system processes the special K1 type
THEN
A broker bond creation message is generated for Canadian Pacific Railway processing
Context: A K1 message does not require special bond creation processing
GIVEN
A K1 message does not require special bond creation processing
Applied to: Standard K1 Remark
WHEN
The system processes the K1 message type
THEN
The K1 message is processed as a standard remark for inclusion in notifications
Context: A K1 message has been processed as either special bond creation or standard remark
GIVEN
A K1 message has been processed as either special bond creation or standard remark
Applied to: Add to Merlin Message
WHEN
The system prepares Merlin notifications
THEN
The K1 message content is added to appropriate Merlin messages for distribution
Context: K1 messages are included in cargo and train notifications
GIVEN
K1 messages are included in cargo and train notifications
Applied to: Format K1 Comments
WHEN
The system formats the notification content
THEN
K1 comments are formatted with up to 4 lines of K1 segment comments as available and properly structured for recipient systems
Context: K1 comments have been formatted for notifications
GIVEN
K1 comments have been formatted for notifications
Applied to: Integrate with Status Updates
WHEN
The system processes status updates for cargo or train operations
THEN
The formatted K1 comments are integrated with status updates to provide complete information context
R-GCX016E-cbl-00530 (+11) File: GCX016E.cbl CPRS Cargo Not Found Error Processing Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CPRS Cargo Not Found Error Processing':
  • Context - a cprs cargo lookup request is initiated:
    For Cargo Found in System?:
    When the system searches for the cargo in the database, then the system determines if the cargo exists and routes to appropriate processing path.
  • Context - cargo is not found in the system:
    For Check CPRS Traffic Flag:
    When the system checks the cprs traffic designation flag, then the system identifies whether this is cprs traffic requiring special error handling.
  • Context - the cprs traffic flag has been checked for cargo not found in system:
    For Is CPRS Traffic?:
    When the system evaluates if the cargo is designated as cprs traffic, then if cprs traffic, generate specific error message; otherwise continue with normal processing.
  • Context - cargo is not found in system and is designated as cprs traffic:
    For Generate CPRS Cargo Not Found Error:
    When the system initiates error message generation, then a cprs-specific cargo not found error message is created.
  • Context - a cprs cargo not found error is being generated:
    For Format Error Message with Car ID:
    When the system formats the error message, then the car id information is included in the error message format.
  • Context - the error message is being formatted with car id:
    For Include Equipment Details in Error:
    When equipment details are available for the cargo, then equipment information is included in the error message.
  • Context - the error message includes equipment details:
    For Add Waybill Information to Error:
    When waybill information is available, then waybill information is added to the error message.
  • Context - the error message content is complete with all required information:
    For Set Error Message Type:
    When the system sets the message type, then the error message is classified with the appropriate type for cprs cargo not found scenarios.
  • Context - the cprs error message is formatted and typed:
    For Send Error to Merlin System:
    When the system sends the error to merlin, then the error message is transmitted to the merlin system for distribution.
  • Context - the error message has been sent to merlin system:
    For Log CPRS Error for Audit:
    When the system performs audit logging, then the cprs error is recorded in audit logs with appropriate details.
  • Context - cprs error has been processed and logged:
    For Continue Processing Other Cargo:
    When the system continues with remaining processing, then normal cargo processing workflow resumes for other cargo items.
  • Context - cargo is found in the system:
    For Normal Cargo Processing:
    When the system initiates cargo processing, then cargo follows the normal processing workflow without error handling.
👨‍💻 Technical ACs (Gherkin)
Context: A CPRS cargo lookup request is initiated
GIVEN
A CPRS cargo lookup request is initiated
Applied to: Cargo Found in System?
WHEN
The system searches for the cargo in the database
THEN
The system determines if the cargo exists and routes to appropriate processing path
Context: Cargo is not found in the system
GIVEN
Cargo is not found in the system
Applied to: Check CPRS Traffic Flag
WHEN
The system checks the CPRS traffic designation flag
THEN
The system identifies whether this is CPRS traffic requiring special error handling
Context: The CPRS traffic flag has been checked for cargo not found in system
GIVEN
The CPRS traffic flag has been checked for cargo not found in system
Applied to: Is CPRS Traffic?
WHEN
The system evaluates if the cargo is designated as CPRS traffic
THEN
If CPRS traffic, generate specific error message; otherwise continue with normal processing
Context: Cargo is not found in system and is designated as CPRS traffic
GIVEN
Cargo is not found in system and is designated as CPRS traffic
Applied to: Generate CPRS Cargo Not Found Error
WHEN
The system initiates error message generation
THEN
A CPRS-specific cargo not found error message is created
Context: A CPRS cargo not found error is being generated
GIVEN
A CPRS cargo not found error is being generated
Applied to: Format Error Message with Car ID
WHEN
The system formats the error message
THEN
The car ID information is included in the error message format
Context: The error message is being formatted with car ID
GIVEN
The error message is being formatted with car ID
Applied to: Include Equipment Details in Error
WHEN
Equipment details are available for the cargo
THEN
Equipment information is included in the error message
Context: The error message includes equipment details
GIVEN
The error message includes equipment details
Applied to: Add Waybill Information to Error
WHEN
Waybill information is available
THEN
Waybill information is added to the error message
Context: The error message content is complete with all required information
GIVEN
The error message content is complete with all required information
Applied to: Set Error Message Type
WHEN
The system sets the message type
THEN
The error message is classified with the appropriate type for CPRS cargo not found scenarios
Context: The CPRS error message is formatted and typed
GIVEN
The CPRS error message is formatted and typed
Applied to: Send Error to Merlin System
WHEN
The system sends the error to Merlin
THEN
The error message is transmitted to the Merlin system for distribution
Context: The error message has been sent to Merlin system
GIVEN
The error message has been sent to Merlin system
Applied to: Log CPRS Error for Audit
WHEN
The system performs audit logging
THEN
The CPRS error is recorded in audit logs with appropriate details
Context: CPRS error has been processed and logged
GIVEN
CPRS error has been processed and logged
Applied to: Continue Processing Other Cargo
WHEN
The system continues with remaining processing
THEN
Normal cargo processing workflow resumes for other cargo items
Context: Cargo is found in the system
GIVEN
Cargo is found in the system
Applied to: Normal Cargo Processing
WHEN
The system initiates cargo processing
THEN
Cargo follows the normal processing workflow without error handling
R-GCX016E-cbl-00542 (+11) File: GCX016E.cbl Train Not Arrived Warning Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Not Arrived Warning':
  • Context - an oca disposition code is received for a train and m10 segment contains train identification information:
    For Validate Train ID from M10 Segment:
    When the system processes the m10 segment to extract and validate train id, then the train id is validated against available train data for further processing.
  • Context - a validated train id from m10 segment processing:
    For Train Found in USCS System?:
    When the system searches for the train in uscs train list segments, then if train is found, proceed to arrival status check or if train is not found, generate train not arrived warning.
  • Context - a train exists in the uscs system:
    For Check Train Arrival Status:
    When the system checks the train's current arrival status information, then the arrival status is retrieved and made available for arrival validation.
  • Context - train arrival status information is available:
    For Train Already Arrived?:
    When the system evaluates if the train status indicates it has already arrived, then if train has already arrived, end oca processing or if train has not arrived, generate train not arrived warning.
  • Context - train is not found in uscs system or train exists but has not arrived:
    For Generate Train Not Arrived Warning:
    When the system processes oca disposition code for the train, then a train not arrived warning is generated for further processing.
  • Context - a train not arrived warning has been generated:
    For Log Warning Message with Train Details:
    When the system logs the warning message, then warning message is recorded with complete train details including train id and relevant context information.
  • Context - warning message with train details has been logged:
    For Create Merlin Warning Notification:
    When the system creates merlin notification for the warning, then merlin warning notification is created and prepared for delivery to operations team.
  • Context - merlin warning notification is being created:
    For Include Train ID and Location Information:
    When the system includes train and location information in the notification, then train id and location information are included in the warning notification for complete operational context.
  • Context - warning notification includes train id and location information:
    For Set Re-arrival Process Flag:
    When the system sets re-arrival process flag for the train, then re-arrival process flag is set to ensure proper handling when train actually arrives.
  • Context - warning notification is complete with train details and re-arrival flag is set:
    For Send Warning to Operations Team:
    When the system sends the warning to operations team, then warning notification is successfully delivered to operations team for immediate attention.
  • Context - warning has been sent to operations team:
    For Update Train Status for Re-processing:
    When the system updates train status for re-processing, then train status is updated to indicate warning condition and readiness for re-processing upon actual arrival.
  • Context - train has already arrived or train status has been updated for re-processing after warning:
    For End OCA Processing:
    When the system completes oca processing, then oca disposition code processing is completed and system is ready for next transaction.
👨‍💻 Technical ACs (Gherkin)
Context: An OCA disposition code is received for a train AND M10 segment contains train identification information
GIVEN
An OCA disposition code is received for a train AND M10 segment contains train identification information
Applied to: Validate Train ID from M10 Segment
WHEN
The system processes the M10 segment to extract and validate train ID
THEN
The train ID is validated against available train data for further processing
Context: A validated train ID from M10 segment processing
GIVEN
A validated train ID from M10 segment processing
Applied to: Train Found in USCS System?
WHEN
The system searches for the train in USCS train list segments
THEN
If train is found, proceed to arrival status check OR if train is not found, generate train not arrived warning
Context: A train exists in the USCS system
GIVEN
A train exists in the USCS system
Applied to: Check Train Arrival Status
WHEN
The system checks the train's current arrival status information
THEN
The arrival status is retrieved and made available for arrival validation
Context: Train arrival status information is available
GIVEN
Train arrival status information is available
Applied to: Train Already Arrived?
WHEN
The system evaluates if the train status indicates it has already arrived
THEN
If train has already arrived, end OCA processing OR if train has not arrived, generate train not arrived warning
Context: Train is not found in USCS system OR train exists but has not arrived
GIVEN
Train is not found in USCS system OR train exists but has not arrived
Applied to: Generate Train Not Arrived Warning
WHEN
The system processes OCA disposition code for the train
THEN
A train not arrived warning is generated for further processing
Context: A train not arrived warning has been generated
GIVEN
A train not arrived warning has been generated
Applied to: Log Warning Message with Train Details
WHEN
The system logs the warning message
THEN
Warning message is recorded with complete train details including train ID and relevant context information
Context: Warning message with train details has been logged
GIVEN
Warning message with train details has been logged
Applied to: Create Merlin Warning Notification
WHEN
The system creates Merlin notification for the warning
THEN
Merlin warning notification is created and prepared for delivery to operations team
Context: Merlin warning notification is being created
GIVEN
Merlin warning notification is being created
Applied to: Include Train ID and Location Information
WHEN
The system includes train and location information in the notification
THEN
Train ID and location information are included in the warning notification for complete operational context
Context: Warning notification includes train ID and location information
GIVEN
Warning notification includes train ID and location information
Applied to: Set Re-arrival Process Flag
WHEN
The system sets re-arrival process flag for the train
THEN
Re-arrival process flag is set to ensure proper handling when train actually arrives
Context: Warning notification is complete with train details and re-arrival flag is set
GIVEN
Warning notification is complete with train details and re-arrival flag is set
Applied to: Send Warning to Operations Team
WHEN
The system sends the warning to operations team
THEN
Warning notification is successfully delivered to operations team for immediate attention
Context: Warning has been sent to operations team
GIVEN
Warning has been sent to operations team
Applied to: Update Train Status for Re-processing
WHEN
The system updates train status for re-processing
THEN
Train status is updated to indicate warning condition and readiness for re-processing upon actual arrival
Context: Train has already arrived OR train status has been updated for re-processing after warning
GIVEN
Train has already arrived OR train status has been updated for re-processing after warning
Applied to: End OCA Processing
WHEN
The system completes OCA processing
THEN
OCA disposition code processing is completed and system is ready for next transaction
R-GCX016E-cbl-00554 (+13) File: GCX016E.cbl Train Arrival Cancellation Warning Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Arrival Cancellation Warning':
  • Context - a message segment contains a disposition code:
    For Receive COC Disposition Code:
    When the disposition code is 'coc', then the system initiates train arrival cancellation processing.
  • Context - an m10 segment contains vessel/train information:
    For Validate Train ID from M10 Segment:
    When processing a coc disposition code, then the system extracts the train id from the m10 segment for validation.
  • Context - a train id has been extracted from the m10 segment:
    For Train Found in System?:
    When the system searches for the train in the train list, then the system determines if the train exists or not found.
    For Generate Train Not Found Error:
    When the train is not found in the train list, then the system generates a train not found error message.
  • Context - a valid train has been found in the system:
    For Log Train Arrival Cancellation Action:
    When processing a coc disposition code for train arrival cancellation, then the system logs the cancellation action with train details and timestamp.
  • Context - a train arrival cancellation has been logged:
    For Update Train Status to Cancel Arrival:
    When the train status needs to be updated, then the system sets the train status to cancel arrival state.
  • Context - a train has an existing arrival date:
    For Clear Train Arrival Date:
    When the train arrival is being cancelled, then the system clears the train arrival date field.
  • Context - a train has arrival flags set:
    For Reset Train Arrival Flags:
    When the train arrival is being cancelled, then the system resets all train arrival flags to their initial state.
  • Context - a train arrival has been successfully cancelled:
    For Generate CBP Cancellation Warning Message:
    When cbp notification is required, then the system generates a cbp cancellation warning message.
  • Context - a cbp cancellation warning message needs to be created:
    For Format Warning with Train Details:
    When formatting the message content, then the system includes train id, cancellation timestamp, and relevant train details in the message.
  • Context - a k1 segment contains cancellation reason comments:
    For Include Cancellation Reason from K1 Segment:
    When formatting the cbp warning message, then the system includes the cancellation reason from the k1 segment in the warning message.
  • Context - a formatted cbp cancellation warning message is ready:
    For Send Warning to Merlin Message System:
    When the message needs to be transmitted, then the system sends the warning message to the merlin message system.
  • Context - a train arrival cancellation has been processed and message sent:
    For Log Cancellation Event for Audit Trail:
    When creating audit trail records, then the system logs the complete cancellation event with all relevant details for audit purposes.
  • Context - a train not found error has been generated:
    For Send Error Message to Operations:
    When operations notification is required, then the system sends the error message to operations personnel for resolution.
👨‍💻 Technical ACs (Gherkin)
Context: A message segment contains a disposition code
GIVEN
A message segment contains a disposition code
Applied to: Receive COC Disposition Code
WHEN
The disposition code is 'COC'
THEN
The system initiates train arrival cancellation processing
Context: An M10 segment contains vessel/train information
GIVEN
An M10 segment contains vessel/train information
Applied to: Validate Train ID from M10 Segment
WHEN
Processing a COC disposition code
THEN
The system extracts the train ID from the M10 segment for validation
Context: A train ID has been extracted from the M10 segment
GIVEN
A train ID has been extracted from the M10 segment
Applied to: Train Found in System?
WHEN
The system searches for the train in the train list
THEN
The system determines if the train exists or not found
Applied to: Generate Train Not Found Error
WHEN
The train is not found in the train list
THEN
The system generates a train not found error message
Context: A valid train has been found in the system
GIVEN
A valid train has been found in the system
Applied to: Log Train Arrival Cancellation Action
WHEN
Processing a COC disposition code for train arrival cancellation
THEN
The system logs the cancellation action with train details and timestamp
Context: A train arrival cancellation has been logged
GIVEN
A train arrival cancellation has been logged
Applied to: Update Train Status to Cancel Arrival
WHEN
The train status needs to be updated
THEN
The system sets the train status to cancel arrival state
Context: A train has an existing arrival date
GIVEN
A train has an existing arrival date
Applied to: Clear Train Arrival Date
WHEN
The train arrival is being cancelled
THEN
The system clears the train arrival date field
Context: A train has arrival flags set
GIVEN
A train has arrival flags set
Applied to: Reset Train Arrival Flags
WHEN
The train arrival is being cancelled
THEN
The system resets all train arrival flags to their initial state
Context: A train arrival has been successfully cancelled
GIVEN
A train arrival has been successfully cancelled
Applied to: Generate CBP Cancellation Warning Message
WHEN
CBP notification is required
THEN
The system generates a CBP cancellation warning message
Context: A CBP cancellation warning message needs to be created
GIVEN
A CBP cancellation warning message needs to be created
Applied to: Format Warning with Train Details
WHEN
Formatting the message content
THEN
The system includes train ID, cancellation timestamp, and relevant train details in the message
Context: A K1 segment contains cancellation reason comments
GIVEN
A K1 segment contains cancellation reason comments
Applied to: Include Cancellation Reason from K1 Segment
WHEN
Formatting the CBP warning message
THEN
The system includes the cancellation reason from the K1 segment in the warning message
Context: A formatted CBP cancellation warning message is ready
GIVEN
A formatted CBP cancellation warning message is ready
Applied to: Send Warning to Merlin Message System
WHEN
The message needs to be transmitted
THEN
The system sends the warning message to the Merlin message system
Context: A train arrival cancellation has been processed and message sent
GIVEN
A train arrival cancellation has been processed and message sent
Applied to: Log Cancellation Event for Audit Trail
WHEN
Creating audit trail records
THEN
The system logs the complete cancellation event with all relevant details for audit purposes
Context: A train not found error has been generated
GIVEN
A train not found error has been generated
Applied to: Send Error Message to Operations
WHEN
Operations notification is required
THEN
The system sends the error message to operations personnel for resolution
R-GCX016E-cbl-00568 (+9) File: GCX016E.cbl Cargo Search by Car ID Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Search by Car ID':
  • Context - a raw car identification needs to be processed for cargo search:
    For Format Car ID using Standard Rules:
    When the system applies standard car id formatting rules, then the car id is formatted according to business standards for consistent cargo matching.
  • Context - a formatted car id and partial ccn are available for cargo search:
    For Phase 1: Search with Partial CCN and Car ID:
    When the system searches the us cargo root segments using both partial ccn and car id as search criteria, then the system returns cargo records that match both the partial ccn and car id combination.
  • Context - a search has been performed using partial ccn and car id:
    For Cargo Found with Partial CCN?:
    When the system evaluates the search results, then if cargo records are found, proceed to return found cargo; if no records found, initiate secondary search phase.
  • Context - primary search with partial ccn and car id found no matching cargo records:
    For Phase 2: Search with Car ID Only:
    When the system searches the us cargo root segments using only car id as search criteria, then the system returns all cargo records that match the car id regardless of ccn.
  • Context - a secondary search has been performed using only car id:
    For Cargo Found with Car ID Only?:
    When the system evaluates the search results, then if cargo records are found, proceed to handle scac scenarios; if no records found, handle cargo not found scenario.
  • Context - cargo records were found using car id only search and scac information may be unknown:
    For Handle SCAC Unknown Scenarios:
    When the system processes the found cargo records, then the system handles scac unknown scenarios and prepares cargo for ccn key renumbering.
  • Context - cargo records require ccn key renumbering due to scac unknown scenarios:
    For Perform US-CCN Key Renumbering:
    When the system performs us-ccn key renumbering process, then the cargo records are updated with proper ccn keys for accurate cargo tracking.
  • Context - cargo records have been successfully found and processed through either primary or secondary search:
    For Return Found Cargo Record:
    When the system completes cargo record processing, then the found cargo record is returned to the requesting process for further business operations.
  • Context - both primary and secondary cargo searches have failed to locate any matching cargo records:
    For Handle Cargo Not Found Scenario:
    When the system processes the cargo not found scenario, then the system initiates appropriate error handling procedures for missing cargo situations.
  • Context - cargo search has failed and the cargo may be related to cprs operations:
    For Generate CPRS Error Message if Applicable:
    When the system determines cprs error message generation is applicable, then a cprs-specific error message is generated to inform users of the cargo search failure.
👨‍💻 Technical ACs (Gherkin)
Context: A raw car identification needs to be processed for cargo search
GIVEN
A raw car identification needs to be processed for cargo search
Applied to: Format Car ID using Standard Rules
WHEN
The system applies standard car ID formatting rules
THEN
The car ID is formatted according to business standards for consistent cargo matching
Context: A formatted car ID and partial CCN are available for cargo search
GIVEN
A formatted car ID and partial CCN are available for cargo search
Applied to: Phase 1: Search with Partial CCN and Car ID
WHEN
The system searches the US cargo root segments using both partial CCN and car ID as search criteria
THEN
The system returns cargo records that match both the partial CCN and car ID combination
Context: A search has been performed using partial CCN and car ID
GIVEN
A search has been performed using partial CCN and car ID
Applied to: Cargo Found with Partial CCN?
WHEN
The system evaluates the search results
THEN
If cargo records are found, proceed to return found cargo; if no records found, initiate secondary search phase
Context: Primary search with partial CCN and car ID found no matching cargo records
GIVEN
Primary search with partial CCN and car ID found no matching cargo records
Applied to: Phase 2: Search with Car ID Only
WHEN
The system searches the US cargo root segments using only car ID as search criteria
THEN
The system returns all cargo records that match the car ID regardless of CCN
Context: A secondary search has been performed using only car ID
GIVEN
A secondary search has been performed using only car ID
Applied to: Cargo Found with Car ID Only?
WHEN
The system evaluates the search results
THEN
If cargo records are found, proceed to handle SCAC scenarios; if no records found, handle cargo not found scenario
Context: Cargo records were found using car ID only search and SCAC information may be unknown
GIVEN
Cargo records were found using car ID only search and SCAC information may be unknown
Applied to: Handle SCAC Unknown Scenarios
WHEN
The system processes the found cargo records
THEN
The system handles SCAC unknown scenarios and prepares cargo for CCN key renumbering
Context: Cargo records require CCN key renumbering due to SCAC unknown scenarios
GIVEN
Cargo records require CCN key renumbering due to SCAC unknown scenarios
Applied to: Perform US-CCN Key Renumbering
WHEN
The system performs US-CCN key renumbering process
THEN
The cargo records are updated with proper CCN keys for accurate cargo tracking
Context: Cargo records have been successfully found and processed through either primary or secondary search
GIVEN
Cargo records have been successfully found and processed through either primary or secondary search
Applied to: Return Found Cargo Record
WHEN
The system completes cargo record processing
THEN
The found cargo record is returned to the requesting process for further business operations
Context: Both primary and secondary cargo searches have failed to locate any matching cargo records
GIVEN
Both primary and secondary cargo searches have failed to locate any matching cargo records
Applied to: Handle Cargo Not Found Scenario
WHEN
The system processes the cargo not found scenario
THEN
The system initiates appropriate error handling procedures for missing cargo situations
Context: Cargo search has failed and the cargo may be related to CPRS operations
GIVEN
Cargo search has failed and the cargo may be related to CPRS operations
Applied to: Generate CPRS Error Message if Applicable
WHEN
The system determines CPRS error message generation is applicable
THEN
A CPRS-specific error message is generated to inform users of the cargo search failure
R-GCX016E-cbl-00578 (+11) File: GCX016E.cbl S09 Status Segment Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'S09 Status Segment Processing':
  • Context - a cargo processing request is initiated:
    For Cargo Record Found?:
    When the system checks for the existence of the cargo record, then if cargo record exists, proceed to fetch status segments; if not, initialize empty status arrays.
  • Context - a valid cargo record exists:
    For Fetch S09 Status Segments from Database:
    When the system fetches s09 status segments from the database, then all status segments associated with the cargo are retrieved for processing.
  • Context - status segment fetch operation has completed:
    For Status Segments Exist?:
    When the system checks if any status segments were found, then if segments exist, populate status arrays from database; if not, initialize empty arrays.
  • Context - no status segments exist for the cargo or cargo record not found:
    For Initialize Empty Status Arrays:
    When the system initializes status processing, then empty status arrays are created to prepare for new status information.
  • Context - status segments exist in the database for the cargo:
    For Populate Status Arrays from Database Segments:
    When the system populates status arrays, then all existing status information is loaded into memory arrays for processing.
  • Context - status arrays are populated from database segments:
    For Track Maximum Sequence Numbers:
    When the system processes sequence numbers, then the maximum sequence number is tracked for future segment creation.
  • Context - status arrays are initialized (either empty or populated from database):
    For Process Status Array Updates:
    When the system processes status updates from disposition codes or events, then status arrays are modified according to business rules for holds, releases, and other status changes.
  • Context - status array updates have been processed:
    For Status Array Modified?:
    When the system checks for modifications, then if arrays were modified, convert to database format and update; if not, end processing.
  • Context - status arrays have been modified during processing:
    For Convert Status Arrays to Database Format:
    When the system converts arrays to database format, then status information is formatted into s09 segments ready for database storage.
  • Context - status arrays have been converted to database format and cargo is not cprs type:
    For Update Car ID Information for Non-CPRS Cargo:
    When the system updates car id information, then car identification data is updated in the cargo record based on n7 segment information.
  • Context - status segments have been formatted for database storage and car id has been updated:
    For Replace Status Segments in Database:
    When the system replaces status segments in the database, then all modified status information is persisted to the gcsuss09 database.
  • Context - status segments have been replaced in the database:
    For Confirm Status Segment Updates:
    When the system confirms the update operation, then status segment processing is confirmed as complete and successful.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing request is initiated
GIVEN
A cargo processing request is initiated
Applied to: Cargo Record Found?
WHEN
The system checks for the existence of the cargo record
THEN
If cargo record exists, proceed to fetch status segments; if not, initialize empty status arrays
Context: A valid cargo record exists
GIVEN
A valid cargo record exists
Applied to: Fetch S09 Status Segments from Database
WHEN
The system fetches S09 status segments from the database
THEN
All status segments associated with the cargo are retrieved for processing
Context: Status segment fetch operation has completed
GIVEN
Status segment fetch operation has completed
Applied to: Status Segments Exist?
WHEN
The system checks if any status segments were found
THEN
If segments exist, populate status arrays from database; if not, initialize empty arrays
Context: No status segments exist for the cargo OR cargo record not found
GIVEN
No status segments exist for the cargo OR cargo record not found
Applied to: Initialize Empty Status Arrays
WHEN
The system initializes status processing
THEN
Empty status arrays are created to prepare for new status information
Context: Status segments exist in the database for the cargo
GIVEN
Status segments exist in the database for the cargo
Applied to: Populate Status Arrays from Database Segments
WHEN
The system populates status arrays
THEN
All existing status information is loaded into memory arrays for processing
Context: Status arrays are populated from database segments
GIVEN
Status arrays are populated from database segments
Applied to: Track Maximum Sequence Numbers
WHEN
The system processes sequence numbers
THEN
The maximum sequence number is tracked for future segment creation
Context: Status arrays are initialized (either empty or populated from database)
GIVEN
Status arrays are initialized (either empty or populated from database)
Applied to: Process Status Array Updates
WHEN
The system processes status updates from disposition codes or events
THEN
Status arrays are modified according to business rules for holds, releases, and other status changes
Context: Status array updates have been processed
GIVEN
Status array updates have been processed
Applied to: Status Array Modified?
WHEN
The system checks for modifications
THEN
If arrays were modified, convert to database format and update; if not, end processing
Context: Status arrays have been modified during processing
GIVEN
Status arrays have been modified during processing
Applied to: Convert Status Arrays to Database Format
WHEN
The system converts arrays to database format
THEN
Status information is formatted into S09 segments ready for database storage
Context: Status arrays have been converted to database format AND cargo is not CPRS type
GIVEN
Status arrays have been converted to database format AND cargo is not CPRS type
Applied to: Update Car ID Information for Non-CPRS Cargo
WHEN
The system updates car ID information
THEN
Car identification data is updated in the cargo record based on N7 segment information
Context: Status segments have been formatted for database storage AND car ID has been updated
GIVEN
Status segments have been formatted for database storage AND car ID has been updated
Applied to: Replace Status Segments in Database
WHEN
The system replaces status segments in the database
THEN
All modified status information is persisted to the GCSUSS09 database
Context: Status segments have been replaced in the database
GIVEN
Status segments have been replaced in the database
Applied to: Confirm Status Segment Updates
WHEN
The system confirms the update operation
THEN
Status segment processing is confirmed as complete and successful
R-GCX016E-cbl-00590 (+6) File: GCX016E.cbl Disposition Code Table Lookup Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Table Lookup':
  • Context - a disposition code is received from an x4 segment:
    For Search DC Table for Disposition Code:
    When the system searches the dc table for the disposition code, then the system retrieves disposition code information if found or flags as invalid if not found.
  • Context - a disposition code has been found in the dc table:
    For Set Valid Disposition Code Flag:
    When the disposition code information is successfully retrieved, then the system sets the valid disposition code flag to allow continued processing.
  • Context - a disposition code is not found in the dc table:
    For Generate Merlin Error Message:
    When the table lookup returns no matching record, then the system generates a merlin error message and sets invalid disposition code flag.
  • Context - a valid disposition code is found in the dc table:
    For Validate Code Processing Rules:
    When the system validates the code processing rules, then the system confirms the code can be processed according to established business rules.
  • Context - an invalid disposition code flag has been set:
    For Log Unknown Disposition Code:
    When the system processes the invalid code, then the system logs the unknown disposition code for audit and monitoring purposes.
  • Context - a disposition code has been validated and flagged as valid:
    For Continue Processing with Valid Code:
    When all processing rules have been satisfied, then the system continues with normal cargo processing using the validated disposition code.
  • Context - a disposition code has been flagged as invalid:
    For Skip Processing for Invalid Code:
    When the invalid code flag is set, then the system skips further processing for that cargo to prevent errors.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received from an X4 segment
GIVEN
A disposition code is received from an X4 segment
Applied to: Search DC Table for Disposition Code
WHEN
The system searches the DC table for the disposition code
THEN
The system retrieves disposition code information if found or flags as invalid if not found
Context: A disposition code has been found in the DC table
GIVEN
A disposition code has been found in the DC table
Applied to: Set Valid Disposition Code Flag
WHEN
The disposition code information is successfully retrieved
THEN
The system sets the valid disposition code flag to allow continued processing
Context: A disposition code is not found in the DC table
GIVEN
A disposition code is not found in the DC table
Applied to: Generate Merlin Error Message
WHEN
The table lookup returns no matching record
THEN
The system generates a Merlin error message and sets invalid disposition code flag
Context: A valid disposition code is found in the DC table
GIVEN
A valid disposition code is found in the DC table
Applied to: Validate Code Processing Rules
WHEN
The system validates the code processing rules
THEN
The system confirms the code can be processed according to established business rules
Context: An invalid disposition code flag has been set
GIVEN
An invalid disposition code flag has been set
Applied to: Log Unknown Disposition Code
WHEN
The system processes the invalid code
THEN
The system logs the unknown disposition code for audit and monitoring purposes
Context: A disposition code has been validated and flagged as valid
GIVEN
A disposition code has been validated and flagged as valid
Applied to: Continue Processing with Valid Code
WHEN
All processing rules have been satisfied
THEN
The system continues with normal cargo processing using the validated disposition code
Context: A disposition code has been flagged as invalid
GIVEN
A disposition code has been flagged as invalid
Applied to: Skip Processing for Invalid Code
WHEN
The invalid code flag is set
THEN
The system skips further processing for that cargo to prevent errors
R-GCX016E-cbl-00597 (+6) File: GCX016E.cbl Duplicate Disposition Code Detection Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Duplicate Disposition Code Detection':
  • Context - a cargo status array (s09a) needs to be checked for existing disposition codes:
    For Status Array Empty?:
    When the system accesses the status array to determine if it contains any entries, then if the status array is empty, set no duplicates found flag and skip duplicate detection process.
  • Context - a new disposition code and an existing status array entry:
    For Disposition Code Match?:
    When the system compares the disposition code values, then if the disposition codes match exactly, proceed to sequence number validation, otherwise continue to next array entry.
  • Context - two disposition codes that match and their respective sequence numbers:
    For Same Sequence Number?:
    When the system compares the sequence numbers of the matching disposition codes, then if sequence numbers are identical, mark as exact duplicate found, otherwise check date/time stamps for partial match.
  • Context - two matching disposition codes with different sequence numbers and their date/time stamps:
    For Same Date/Time?:
    When the system compares the date and time stamp values, then if date/time stamps are identical, mark as duplicate with different time, otherwise continue search process.
  • Context - completed search through status array with duplicate detection flags:
    For Duplicate Found?:
    When the system evaluates whether any duplicate conditions were identified during the search, then if any duplicate was found (exact or temporal), set duplicate detection flag and prepare duplicate handling, otherwise return no duplicate status.
  • Context - a status array with multiple entries and current search position:
    For More Array Entries?:
    When the system checks if there are remaining entries to process in the array, then if more entries exist, get next status entry for comparison, otherwise proceed to duplicate evaluation.
  • Context - a confirmed duplicate disposition code with its details:
    For Log Duplicate Information:
    When the system needs to record the duplicate detection event, then log the duplicate disposition code information including sequence numbers, date/time stamps, and duplicate type for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status array (S09A) needs to be checked for existing disposition codes
GIVEN
A cargo status array (S09A) needs to be checked for existing disposition codes
Applied to: Status Array Empty?
WHEN
The system accesses the status array to determine if it contains any entries
THEN
If the status array is empty, set no duplicates found flag and skip duplicate detection process
Context: A new disposition code and an existing status array entry
GIVEN
A new disposition code and an existing status array entry
Applied to: Disposition Code Match?
WHEN
The system compares the disposition code values
THEN
If the disposition codes match exactly, proceed to sequence number validation, otherwise continue to next array entry
Context: Two disposition codes that match and their respective sequence numbers
GIVEN
Two disposition codes that match and their respective sequence numbers
Applied to: Same Sequence Number?
WHEN
The system compares the sequence numbers of the matching disposition codes
THEN
If sequence numbers are identical, mark as exact duplicate found, otherwise check date/time stamps for partial match
Context: Two matching disposition codes with different sequence numbers and their date/time stamps
GIVEN
Two matching disposition codes with different sequence numbers and their date/time stamps
Applied to: Same Date/Time?
WHEN
The system compares the date and time stamp values
THEN
If date/time stamps are identical, mark as duplicate with different time, otherwise continue search process
Context: Completed search through status array with duplicate detection flags
GIVEN
Completed search through status array with duplicate detection flags
Applied to: Duplicate Found?
WHEN
The system evaluates whether any duplicate conditions were identified during the search
THEN
If any duplicate was found (exact or temporal), set duplicate detection flag and prepare duplicate handling, otherwise return no duplicate status
Context: A status array with multiple entries and current search position
GIVEN
A status array with multiple entries and current search position
Applied to: More Array Entries?
WHEN
The system checks if there are remaining entries to process in the array
THEN
If more entries exist, get next status entry for comparison, otherwise proceed to duplicate evaluation
Context: A confirmed duplicate disposition code with its details
GIVEN
A confirmed duplicate disposition code with its details
Applied to: Log Duplicate Information
WHEN
The system needs to record the duplicate detection event
THEN
Log the duplicate disposition code information including sequence numbers, date/time stamps, and duplicate type for audit trail
R-GCX016E-cbl-00604 (+7) File: GCX016E.cbl Counterpart Disposition Code Removal Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Counterpart Disposition Code Removal':
  • Context - a cargo has existing hold disposition codes in its status array and a new release disposition code is being processed:
    For Remove Hold Codes when Release Code Added:
    When the system processes the release disposition code and identifies conflicting hold codes in the status array, then the system removes all conflicting hold disposition codes from the status array and maintains the release code as the active status.
  • Context - a cargo has existing release disposition codes in its status array and a new hold disposition code is being processed:
    For Remove Release Codes when Hold Code Added:
    When the system processes the hold disposition code and identifies conflicting release codes in the status array, then the system removes all conflicting release disposition codes from the status array and maintains the hold code as the active status.
  • Context - a cargo has existing status information codes in its status array and new status information codes are being processed:
    For Remove Superseded Status Information Codes:
    When the system identifies that existing status information codes are superseded by the new codes, then the system removes the outdated status information codes from the status array and retains only the current status information.
  • Context - a cargo has disposition codes in its status array and some codes have been marked as cancelled or superseded:
    For Remove Cancelled Disposition Codes:
    When the system processes disposition code updates and identifies cancelled or superseded codes, then the system removes all cancelled and superseded disposition codes from the status array and maintains only active disposition codes.
  • Context - disposition codes have been removed from the cargo status array:
    For Update Status Array Sequence Numbers:
    When the removal process is complete and gaps exist in the sequence numbering, then the system renumbers all remaining disposition codes in sequential order and maintains proper array indexing.
  • Context - disposition codes have been removed from the status array and gaps exist in the array structure:
    For Reorganize Status Array Structure:
    When the code removal process is complete, then the system compacts the status array by moving remaining codes to fill gaps and maintains proper array structure without empty slots.
  • Context - counterpart disposition codes are being removed from a cargo status array:
    For Log Counterpart Code Removal Action:
    When the removal action is executed, then the system logs the removal action with details of which codes were removed and the reason for removal and the timestamp of the action.
  • Context - counterpart disposition codes have been removed from the status array:
    For Validate Status Array Integrity:
    When the removal and reorganization process is complete, then the system validates that no conflicting codes remain and all sequence numbers are properly ordered and the array structure is consistent.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo has existing hold disposition codes in its status array AND a new release disposition code is being processed
GIVEN
A cargo has existing hold disposition codes in its status array AND a new release disposition code is being processed
Applied to: Remove Hold Codes when Release Code Added
WHEN
The system processes the release disposition code AND identifies conflicting hold codes in the status array
THEN
The system removes all conflicting hold disposition codes from the status array AND maintains the release code as the active status
Context: A cargo has existing release disposition codes in its status array AND a new hold disposition code is being processed
GIVEN
A cargo has existing release disposition codes in its status array AND a new hold disposition code is being processed
Applied to: Remove Release Codes when Hold Code Added
WHEN
The system processes the hold disposition code AND identifies conflicting release codes in the status array
THEN
The system removes all conflicting release disposition codes from the status array AND maintains the hold code as the active status
Context: A cargo has existing status information codes in its status array AND new status information codes are being processed
GIVEN
A cargo has existing status information codes in its status array AND new status information codes are being processed
Applied to: Remove Superseded Status Information Codes
WHEN
The system identifies that existing status information codes are superseded by the new codes
THEN
The system removes the outdated status information codes from the status array AND retains only the current status information
Context: A cargo has disposition codes in its status array AND some codes have been marked as cancelled or superseded
GIVEN
A cargo has disposition codes in its status array AND some codes have been marked as cancelled or superseded
Applied to: Remove Cancelled Disposition Codes
WHEN
The system processes disposition code updates AND identifies cancelled or superseded codes
THEN
The system removes all cancelled and superseded disposition codes from the status array AND maintains only active disposition codes
Context: Disposition codes have been removed from the cargo status array
GIVEN
Disposition codes have been removed from the cargo status array
Applied to: Update Status Array Sequence Numbers
WHEN
The removal process is complete AND gaps exist in the sequence numbering
THEN
The system renumbers all remaining disposition codes in sequential order AND maintains proper array indexing
Context: Disposition codes have been removed from the status array AND gaps exist in the array structure
GIVEN
Disposition codes have been removed from the status array AND gaps exist in the array structure
Applied to: Reorganize Status Array Structure
WHEN
The code removal process is complete
THEN
The system compacts the status array by moving remaining codes to fill gaps AND maintains proper array structure without empty slots
Context: Counterpart disposition codes are being removed from a cargo status array
GIVEN
Counterpart disposition codes are being removed from a cargo status array
Applied to: Log Counterpart Code Removal Action
WHEN
The removal action is executed
THEN
The system logs the removal action with details of which codes were removed AND the reason for removal AND the timestamp of the action
Context: Counterpart disposition codes have been removed from the status array
GIVEN
Counterpart disposition codes have been removed from the status array
Applied to: Validate Status Array Integrity
WHEN
The removal and reorganization process is complete
THEN
The system validates that no conflicting codes remain AND all sequence numbers are properly ordered AND the array structure is consistent
R-GCX016E-cbl-00612 (+13) File: GCX016E.cbl Manual Release Request Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manual Release Request Processing':
  • Context - a manual release request is received with a disposition code:
    For Validate Disposition Code in DC Table:
    When the system looks up the disposition code in the dc table, then the system confirms the code exists and is valid for manual release processing.
  • Context - a disposition code has been validated in the dc table:
    For Valid Manual Release Code?:
    When the system checks if the code type allows manual release operations, then processing continues if authorized, otherwise an error is generated.
  • Context - a valid manual release code is being processed:
    For Duplicate Code Found?:
    When the system searches existing status arrays for the same disposition code, then processing is skipped if duplicate found, otherwise continues with adding the code.
  • Context - a manual release code is being added to cargo status:
    For Remove Counterpart Hold Codes:
    When the system identifies existing hold codes that conflict with the release, then all counterpart hold codes are removed from the status array before adding the release code.
  • Context - counterpart hold codes have been removed and no duplicates exist:
    For Add Manual Release Code to Status Array:
    When the system processes the manual release code, then the manual release code is added to the cargo's status array with appropriate sequence number.
  • Context - a manual release code has been added to the status array:
    For Update Release Quantities:
    When the system processes quantity information from the release request, then the cargo's released quantity is updated to reflect the manual release amount.
  • Context - release quantities have been updated for manual release:
    For Log Manual Release Action:
    When the system completes the manual release processing, then an audit record is created documenting the manual release action with timestamp and user information.
  • Context - manual release has been logged and quantities updated:
    For Evaluate Final Cargo Status:
    When the system evaluates all disposition codes in the status array, then the final cargo status is determined based on the hierarchy of all active disposition codes.
  • Context - final cargo status has been evaluated:
    For Cargo Fully Released?:
    When the system compares released quantities against total cargo quantities, then cargo is marked as fully released if all quantities are released, otherwise marked as partially released.
  • Context - cargo has been determined to be fully released:
    For Generate Release Notification:
    When the system processes the full release status, then a release notification is generated for appropriate parties including brokers and freight forwarders.
  • Context - release notification has been generated or cargo is partially released:
    For Update Cargo Status Flags:
    When the system updates the cargo record, then all relevant status flags are updated to reflect the current release state of the cargo.
  • Context - a manual release request contains an invalid disposition code:
    For Generate Error Message:
    When the disposition code validation fails, then an error message is generated indicating the invalid code and processing is terminated.
  • Context - a manual release code already exists in the cargo's status array:
    For Skip Processing:
    When the system detects the duplicate during processing, then processing is skipped for this code and continues with next item without error.
  • Context - cargo status flags have been updated or error/skip condition occurred:
    For Send Merlin Notification:
    When the system completes manual release processing, then appropriate notifications are sent through merlin system to relevant parties based on the processing outcome.
👨‍💻 Technical ACs (Gherkin)
Context: A manual release request is received with a disposition code
GIVEN
A manual release request is received with a disposition code
Applied to: Validate Disposition Code in DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The system confirms the code exists and is valid for manual release processing
Context: A disposition code has been validated in the DC table
GIVEN
A disposition code has been validated in the DC table
Applied to: Valid Manual Release Code?
WHEN
The system checks if the code type allows manual release operations
THEN
Processing continues if authorized, otherwise an error is generated
Context: A valid manual release code is being processed
GIVEN
A valid manual release code is being processed
Applied to: Duplicate Code Found?
WHEN
The system searches existing status arrays for the same disposition code
THEN
Processing is skipped if duplicate found, otherwise continues with adding the code
Context: A manual release code is being added to cargo status
GIVEN
A manual release code is being added to cargo status
Applied to: Remove Counterpart Hold Codes
WHEN
The system identifies existing hold codes that conflict with the release
THEN
All counterpart hold codes are removed from the status array before adding the release code
Context: Counterpart hold codes have been removed and no duplicates exist
GIVEN
Counterpart hold codes have been removed and no duplicates exist
Applied to: Add Manual Release Code to Status Array
WHEN
The system processes the manual release code
THEN
The manual release code is added to the cargo's status array with appropriate sequence number
Context: A manual release code has been added to the status array
GIVEN
A manual release code has been added to the status array
Applied to: Update Release Quantities
WHEN
The system processes quantity information from the release request
THEN
The cargo's released quantity is updated to reflect the manual release amount
Context: Release quantities have been updated for manual release
GIVEN
Release quantities have been updated for manual release
Applied to: Log Manual Release Action
WHEN
The system completes the manual release processing
THEN
An audit record is created documenting the manual release action with timestamp and user information
Context: Manual release has been logged and quantities updated
GIVEN
Manual release has been logged and quantities updated
Applied to: Evaluate Final Cargo Status
WHEN
The system evaluates all disposition codes in the status array
THEN
The final cargo status is determined based on the hierarchy of all active disposition codes
Context: Final cargo status has been evaluated
GIVEN
Final cargo status has been evaluated
Applied to: Cargo Fully Released?
WHEN
The system compares released quantities against total cargo quantities
THEN
Cargo is marked as fully released if all quantities are released, otherwise marked as partially released
Context: Cargo has been determined to be fully released
GIVEN
Cargo has been determined to be fully released
Applied to: Generate Release Notification
WHEN
The system processes the full release status
THEN
A release notification is generated for appropriate parties including brokers and freight forwarders
Context: Release notification has been generated or cargo is partially released
GIVEN
Release notification has been generated or cargo is partially released
Applied to: Update Cargo Status Flags
WHEN
The system updates the cargo record
THEN
All relevant status flags are updated to reflect the current release state of the cargo
Context: A manual release request contains an invalid disposition code
GIVEN
A manual release request contains an invalid disposition code
Applied to: Generate Error Message
WHEN
The disposition code validation fails
THEN
An error message is generated indicating the invalid code and processing is terminated
Context: A manual release code already exists in the cargo's status array
GIVEN
A manual release code already exists in the cargo's status array
Applied to: Skip Processing
WHEN
The system detects the duplicate during processing
THEN
Processing is skipped for this code and continues with next item without error
Context: Cargo status flags have been updated or error/skip condition occurred
GIVEN
Cargo status flags have been updated or error/skip condition occurred
Applied to: Send Merlin Notification
WHEN
The system completes manual release processing
THEN
Appropriate notifications are sent through Merlin system to relevant parties based on the processing outcome
R-GCX016E-cbl-00626 (+13) File: GCX016E.cbl Disposition Code Removal Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Removal Processing':
  • Context - a disposition code removal request is received:
    For Validate Removal Request Parameters:
    When the system validates the removal request parameters, then the request must contain valid disposition code, entry number, and quantity information to proceed with removal processing.
  • Context - a validated disposition code removal request and cargo status array:
    For Disposition Code Exists in Status Array?:
    When the system searches for the target disposition code in the status array, then if the disposition code exists in the array, proceed with removal process, otherwise generate error message for code not found.
  • Context - a disposition code that exists in the cargo status array:
    For Locate Disposition Code Position:
    When the system searches through the status array entries, then the system must locate the exact array position and sequence number of the target disposition code.
  • Context - a located disposition code in the status array and current cargo status:
    For Removal Allowed?:
    When the system evaluates removal authorization rules, then if the code can be removed without violating business constraints, authorize removal, otherwise deny and generate error.
  • Context - an authorized disposition code removal request with located array position:
    For Remove Code from Status Array:
    When the system executes the removal operation, then the disposition code must be completely removed from the status array while preserving array integrity.
  • Context - a status array with a removed disposition code creating a gap in sequence:
    For Reorganize Status Array Sequence:
    When the system reorganizes the array structure, then all remaining disposition codes must be resequenced to eliminate gaps and maintain proper chronological order.
  • Context - a reorganized status array with one less disposition code:
    For Update Array Counter:
    When the system updates array management counters, then the status array counter must be decremented by one to accurately reflect the current number of active disposition codes.
  • Context - a successfully removed disposition code from cargo status array:
    For Log Removal Action:
    When the system logs the removal action, then an audit entry must be created containing cargo identifier, removed disposition code, removal timestamp, and user information.
  • Context - a successfully completed disposition code removal with updated status array:
    For Generate Removal Confirmation:
    When the system generates removal confirmation, then a confirmation message must be created containing cargo details, removed disposition code, and updated status information.
  • Context - a cargo with updated status array after disposition code removal:
    For Update Cargo Status:
    When the system updates the cargo record, then the cargo record must be updated with the new status array and any derived status changes resulting from the removal.
  • Context - a cargo record with updated status array after disposition code removal:
    For Trigger Status Re-evaluation:
    When the system triggers status re-evaluation process, then the cargo's overall status must be recalculated based on remaining disposition codes using standard status determination rules.
  • Context - a cargo with updated status after disposition code removal and re-evaluation:
    For Send Status Change Notification:
    When the system sends status change notifications, then notifications must be sent to brokers, freight forwarders, and other stakeholders based on cargo notification rules and new status.
  • Context - a disposition code removal request that cannot be processed due to validation failure or authorization denial:
    For Generate Error Message:
    When the system generates an error message, then an error message must be created explaining why the removal failed and what corrective action is needed.
  • Context - a failed disposition code removal request with generated error message:
    For Log Removal Failure:
    When the system logs the removal failure, then a failure audit entry must be created containing cargo identifier, attempted disposition code, failure reason, and timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code removal request is received
GIVEN
A disposition code removal request is received
Applied to: Validate Removal Request Parameters
WHEN
The system validates the removal request parameters
THEN
The request must contain valid disposition code, entry number, and quantity information to proceed with removal processing
Context: A validated disposition code removal request and cargo status array
GIVEN
A validated disposition code removal request and cargo status array
Applied to: Disposition Code Exists in Status Array?
WHEN
The system searches for the target disposition code in the status array
THEN
If the disposition code exists in the array, proceed with removal process, otherwise generate error message for code not found
Context: A disposition code that exists in the cargo status array
GIVEN
A disposition code that exists in the cargo status array
Applied to: Locate Disposition Code Position
WHEN
The system searches through the status array entries
THEN
The system must locate the exact array position and sequence number of the target disposition code
Context: A located disposition code in the status array and current cargo status
GIVEN
A located disposition code in the status array and current cargo status
Applied to: Removal Allowed?
WHEN
The system evaluates removal authorization rules
THEN
If the code can be removed without violating business constraints, authorize removal, otherwise deny and generate error
Context: An authorized disposition code removal request with located array position
GIVEN
An authorized disposition code removal request with located array position
Applied to: Remove Code from Status Array
WHEN
The system executes the removal operation
THEN
The disposition code must be completely removed from the status array while preserving array integrity
Context: A status array with a removed disposition code creating a gap in sequence
GIVEN
A status array with a removed disposition code creating a gap in sequence
Applied to: Reorganize Status Array Sequence
WHEN
The system reorganizes the array structure
THEN
All remaining disposition codes must be resequenced to eliminate gaps and maintain proper chronological order
Context: A reorganized status array with one less disposition code
GIVEN
A reorganized status array with one less disposition code
Applied to: Update Array Counter
WHEN
The system updates array management counters
THEN
The status array counter must be decremented by one to accurately reflect the current number of active disposition codes
Context: A successfully removed disposition code from cargo status array
GIVEN
A successfully removed disposition code from cargo status array
Applied to: Log Removal Action
WHEN
The system logs the removal action
THEN
An audit entry must be created containing cargo identifier, removed disposition code, removal timestamp, and user information
Context: A successfully completed disposition code removal with updated status array
GIVEN
A successfully completed disposition code removal with updated status array
Applied to: Generate Removal Confirmation
WHEN
The system generates removal confirmation
THEN
A confirmation message must be created containing cargo details, removed disposition code, and updated status information
Context: A cargo with updated status array after disposition code removal
GIVEN
A cargo with updated status array after disposition code removal
Applied to: Update Cargo Status
WHEN
The system updates the cargo record
THEN
The cargo record must be updated with the new status array and any derived status changes resulting from the removal
Context: A cargo record with updated status array after disposition code removal
GIVEN
A cargo record with updated status array after disposition code removal
Applied to: Trigger Status Re-evaluation
WHEN
The system triggers status re-evaluation process
THEN
The cargo's overall status must be recalculated based on remaining disposition codes using standard status determination rules
Context: A cargo with updated status after disposition code removal and re-evaluation
GIVEN
A cargo with updated status after disposition code removal and re-evaluation
Applied to: Send Status Change Notification
WHEN
The system sends status change notifications
THEN
Notifications must be sent to brokers, freight forwarders, and other stakeholders based on cargo notification rules and new status
Context: A disposition code removal request that cannot be processed due to validation failure or authorization denial
GIVEN
A disposition code removal request that cannot be processed due to validation failure or authorization denial
Applied to: Generate Error Message
WHEN
The system generates an error message
THEN
An error message must be created explaining why the removal failed and what corrective action is needed
Context: A failed disposition code removal request with generated error message
GIVEN
A failed disposition code removal request with generated error message
Applied to: Log Removal Failure
WHEN
The system logs the removal failure
THEN
A failure audit entry must be created containing cargo identifier, attempted disposition code, failure reason, and timestamp
R-GCX016E-cbl-00640 (+7) File: GCX016E.cbl Status Information Code Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Information Code Processing':
  • Context - a status information disposition code is received for processing and the cargo has existing s09a status array segments:
    For Search Existing S09A Status Arrays:
    When the system searches through all existing status array entries for the same disposition code, then the system identifies whether the status information code already exists in the status array.
  • Context - a status information disposition code is being processed and the same disposition code already exists in the cargo's status array:
    For Skip Processing - Code Already Exists:
    When the system detects the duplicate status information code, then the system skips adding the disposition code and continues to the next disposition code for processing.
  • Context - a new status information disposition code needs to be added to the cargo's status array and the status array has a maximum capacity limit:
    For Validate Available Space in Status Array:
    When the system checks the current number of entries against the maximum allowed entries, then the system determines whether there is available space for the new status information code.
  • Context - a status information disposition code needs to be added and the cargo's status array has reached maximum capacity:
    For Generate Array Full Warning:
    When the system attempts to insert the new status information code, then the system generates an array full warning and continues processing the next disposition code.
  • Context - a status information disposition code is not found in the existing status array and there is available space in the status array:
    For Insert New Status Information Code:
    When the system processes the status information disposition code, then the system inserts the new status information code into the next available position in the status array.
  • Context - a new status information disposition code has been successfully inserted into the status array:
    For Update Status Array Sequence Counter:
    When the insertion is completed, then the system increments the status array sequence counter to reflect the new entry count.
  • Context - a status information disposition code has been successfully added to the cargo's status array:
    For Set Status Information Flag:
    When the status information code insertion is completed, then the system sets the status information flag to indicate the presence of status information codes.
  • Context - a status information disposition code has been successfully added to the cargo's status array and the status information flag has been set:
    For Log Status Information Code Addition:
    When the status information processing is completed, then the system logs the status information code addition for audit trail purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A status information disposition code is received for processing AND the cargo has existing S09A status array segments
GIVEN
A status information disposition code is received for processing AND the cargo has existing S09A status array segments
Applied to: Search Existing S09A Status Arrays
WHEN
The system searches through all existing status array entries for the same disposition code
THEN
The system identifies whether the status information code already exists in the status array
Context: A status information disposition code is being processed AND the same disposition code already exists in the cargo's status array
GIVEN
A status information disposition code is being processed AND the same disposition code already exists in the cargo's status array
Applied to: Skip Processing - Code Already Exists
WHEN
The system detects the duplicate status information code
THEN
The system skips adding the disposition code AND continues to the next disposition code for processing
Context: A new status information disposition code needs to be added to the cargo's status array AND the status array has a maximum capacity limit
GIVEN
A new status information disposition code needs to be added to the cargo's status array AND the status array has a maximum capacity limit
Applied to: Validate Available Space in Status Array
WHEN
The system checks the current number of entries against the maximum allowed entries
THEN
The system determines whether there is available space for the new status information code
Context: A status information disposition code needs to be added AND the cargo's status array has reached maximum capacity
GIVEN
A status information disposition code needs to be added AND the cargo's status array has reached maximum capacity
Applied to: Generate Array Full Warning
WHEN
The system attempts to insert the new status information code
THEN
The system generates an array full warning AND continues processing the next disposition code
Context: A status information disposition code is not found in the existing status array AND there is available space in the status array
GIVEN
A status information disposition code is not found in the existing status array AND there is available space in the status array
Applied to: Insert New Status Information Code
WHEN
The system processes the status information disposition code
THEN
The system inserts the new status information code into the next available position in the status array
Context: A new status information disposition code has been successfully inserted into the status array
GIVEN
A new status information disposition code has been successfully inserted into the status array
Applied to: Update Status Array Sequence Counter
WHEN
The insertion is completed
THEN
The system increments the status array sequence counter to reflect the new entry count
Context: A status information disposition code has been successfully added to the cargo's status array
GIVEN
A status information disposition code has been successfully added to the cargo's status array
Applied to: Set Status Information Flag
WHEN
The status information code insertion is completed
THEN
The system sets the status information flag to indicate the presence of status information codes
Context: A status information disposition code has been successfully added to the cargo's status array AND the status information flag has been set
GIVEN
A status information disposition code has been successfully added to the cargo's status array AND the status information flag has been set
Applied to: Log Status Information Code Addition
WHEN
The status information processing is completed
THEN
The system logs the status information code addition for audit trail purposes
R-GCX016E-cbl-00648 (+19) File: GCX016E.cbl Hold and Release Code Processing Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hold and Release Code Processing':
  • Context - a disposition code is received for cargo processing:
    For Disposition Code Type?:
    When the system evaluates the disposition code type, then the code is classified as either a hold code or release code based on the disposition code table definition.
  • Context - a hold or release disposition code needs to be added to cargo status array:
    For Code Already Exists?:
    When the system searches the existing status array for the same disposition code with matching entry number and quantity, then if an exact match is found, the duplicate processing is skipped, otherwise the code is processed.
  • Context - a hold disposition code is validated and not a duplicate:
    For Add Hold Code to Status Array:
    When the system processes the hold code addition, then the hold code is added to the status array with sequence number, entry number, quantity, location, and date/time information.
  • Context - a release disposition code is validated and not a duplicate:
    For Add Release Code to Status Array:
    When the system processes the release code addition, then the release code is added to the status array with sequence number, entry number, release quantity, location, and date/time information.
  • Context - a new hold or release code is being added to the status array:
    For Remove Counterpart Codes:
    When the system identifies counterpart codes that conflict with the new code, then all conflicting counterpart codes are removed from the status array before adding the new code.
  • Context - a hold disposition code has been successfully added to the status array:
    For Set Cargo Hold Status:
    When the system processes hold code implications, then the cargo hold status is set with appropriate hold type (border hold, destination hold, fda hold) based on the disposition code.
  • Context - cargo hold status has been set for a disposition code:
    For Update Hold Flags:
    When the system updates hold-related information, then hold flags are updated including held at border flag, held at destination flag, held for fda flag, and hold location information.
  • Context - a release disposition code is being processed:
    For Calculate Release Quantities:
    When the system calculates release quantities, then release quantities are calculated based on the disposition code quantity, existing released quantities, and total cargo quantities with validation that release does not exceed available quantities.
    For Remove Conflicting Hold Codes:
    When the system identifies conflicting hold codes in the status array, then all hold codes that conflict with the release are removed from the status array before processing the release.
  • Context - a release disposition code has been processed and quantities calculated:
    For Set Cargo Release Status:
    When the system sets cargo release status, then the cargo release status is updated with release type, release quantities, and release location based on the disposition code.
  • Context - cargo release status has been set for a disposition code:
    For Update Release Flags:
    When the system updates release-related information, then release flags are updated including released flag, ptt flag, ptt exam flag, and release quantity information.
  • Context - a release disposition code is being evaluated:
    For Manual Release?:
    When the system checks if the code represents a manual release, then the code is identified as manual release if it originates from transaction gct1071e or has manual release indicators.
  • Context - a manual release disposition code is identified:
    For Process Manual Release Request:
    When the system processes the manual release request, then the manual release is processed with special validation, broker verification, and immediate release status setting.
  • Context - a manual release request has been processed:
    For Log Manual Release Action:
    When the system logs the manual release action, then the manual release action is logged with user information, timestamp, release details, and audit trail information.
  • Context - a release disposition code is being evaluated and is not a manual release:
    For Auto Release?:
    When the system checks if the code represents an automatic release, then the code is identified as automatic release if it has arl (auto release) indicators or meets automatic release criteria.
  • Context - an automatic release disposition code is identified:
    For Process Automatic Release:
    When the system processes the automatic release, then the automatic release is processed with system validation, automatic broker assignment, and immediate release status setting.
  • Context - an automatic release is being processed:
    For Validate Release Conditions:
    When the system validates release conditions, then all release conditions are validated including cargo status, hold status, quantity availability, and regulatory compliance before allowing the release.
  • Context - hold or release codes have been added or removed from the status array:
    For Update Status Array Sequence:
    When the system updates status array sequencing, then all status array entries are renumbered with proper sequence numbers and the array count is updated.
  • Context - a hold disposition code has been processed and cargo status updated:
    For Generate Hold Notification:
    When the system generates hold notifications, then hold notifications are sent to brokers, freight forwarders, and other relevant parties with hold details, reason, and required actions.
  • Context - a release disposition code has been processed and cargo status updated:
    For Generate Release Notification:
    When the system generates release notifications, then release notifications are sent to brokers, freight forwarders, and other relevant parties with release details, quantities, and pickup authorization.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received for cargo processing
GIVEN
A disposition code is received for cargo processing
Applied to: Disposition Code Type?
WHEN
The system evaluates the disposition code type
THEN
The code is classified as either a hold code or release code based on the disposition code table definition
Context: A hold or release disposition code needs to be added to cargo status array
GIVEN
A hold or release disposition code needs to be added to cargo status array
Applied to: Code Already Exists?
WHEN
The system searches the existing status array for the same disposition code with matching entry number and quantity
THEN
If an exact match is found, the duplicate processing is skipped, otherwise the code is processed
Context: A hold disposition code is validated and not a duplicate
GIVEN
A hold disposition code is validated and not a duplicate
Applied to: Add Hold Code to Status Array
WHEN
The system processes the hold code addition
THEN
The hold code is added to the status array with sequence number, entry number, quantity, location, and date/time information
Context: A release disposition code is validated and not a duplicate
GIVEN
A release disposition code is validated and not a duplicate
Applied to: Add Release Code to Status Array
WHEN
The system processes the release code addition
THEN
The release code is added to the status array with sequence number, entry number, release quantity, location, and date/time information
Context: A new hold or release code is being added to the status array
GIVEN
A new hold or release code is being added to the status array
Applied to: Remove Counterpart Codes
WHEN
The system identifies counterpart codes that conflict with the new code
THEN
All conflicting counterpart codes are removed from the status array before adding the new code
Context: A hold disposition code has been successfully added to the status array
GIVEN
A hold disposition code has been successfully added to the status array
Applied to: Set Cargo Hold Status
WHEN
The system processes hold code implications
THEN
The cargo hold status is set with appropriate hold type (border hold, destination hold, FDA hold) based on the disposition code
Context: Cargo hold status has been set for a disposition code
GIVEN
Cargo hold status has been set for a disposition code
Applied to: Update Hold Flags
WHEN
The system updates hold-related information
THEN
Hold flags are updated including held at border flag, held at destination flag, held for FDA flag, and hold location information
Context: A release disposition code is being processed
GIVEN
A release disposition code is being processed
Applied to: Calculate Release Quantities
WHEN
The system calculates release quantities
THEN
Release quantities are calculated based on the disposition code quantity, existing released quantities, and total cargo quantities with validation that release does not exceed available quantities
Applied to: Remove Conflicting Hold Codes
WHEN
The system identifies conflicting hold codes in the status array
THEN
All hold codes that conflict with the release are removed from the status array before processing the release
Context: A release disposition code has been processed and quantities calculated
GIVEN
A release disposition code has been processed and quantities calculated
Applied to: Set Cargo Release Status
WHEN
The system sets cargo release status
THEN
The cargo release status is updated with release type, release quantities, and release location based on the disposition code
Context: Cargo release status has been set for a disposition code
GIVEN
Cargo release status has been set for a disposition code
Applied to: Update Release Flags
WHEN
The system updates release-related information
THEN
Release flags are updated including released flag, PTT flag, PTT exam flag, and release quantity information
Context: A release disposition code is being evaluated
GIVEN
A release disposition code is being evaluated
Applied to: Manual Release?
WHEN
The system checks if the code represents a manual release
THEN
The code is identified as manual release if it originates from transaction GCT1071E or has manual release indicators
Context: A manual release disposition code is identified
GIVEN
A manual release disposition code is identified
Applied to: Process Manual Release Request
WHEN
The system processes the manual release request
THEN
The manual release is processed with special validation, broker verification, and immediate release status setting
Context: A manual release request has been processed
GIVEN
A manual release request has been processed
Applied to: Log Manual Release Action
WHEN
The system logs the manual release action
THEN
The manual release action is logged with user information, timestamp, release details, and audit trail information
Context: A release disposition code is being evaluated and is not a manual release
GIVEN
A release disposition code is being evaluated and is not a manual release
Applied to: Auto Release?
WHEN
The system checks if the code represents an automatic release
THEN
The code is identified as automatic release if it has ARL (Auto Release) indicators or meets automatic release criteria
Context: An automatic release disposition code is identified
GIVEN
An automatic release disposition code is identified
Applied to: Process Automatic Release
WHEN
The system processes the automatic release
THEN
The automatic release is processed with system validation, automatic broker assignment, and immediate release status setting
Context: An automatic release is being processed
GIVEN
An automatic release is being processed
Applied to: Validate Release Conditions
WHEN
The system validates release conditions
THEN
All release conditions are validated including cargo status, hold status, quantity availability, and regulatory compliance before allowing the release
Context: Hold or release codes have been added or removed from the status array
GIVEN
Hold or release codes have been added or removed from the status array
Applied to: Update Status Array Sequence
WHEN
The system updates status array sequencing
THEN
All status array entries are renumbered with proper sequence numbers and the array count is updated
Context: A hold disposition code has been processed and cargo status updated
GIVEN
A hold disposition code has been processed and cargo status updated
Applied to: Generate Hold Notification
WHEN
The system generates hold notifications
THEN
Hold notifications are sent to brokers, freight forwarders, and other relevant parties with hold details, reason, and required actions
Context: A release disposition code has been processed and cargo status updated
GIVEN
A release disposition code has been processed and cargo status updated
Applied to: Generate Release Notification
WHEN
The system generates release notifications
THEN
Release notifications are sent to brokers, freight forwarders, and other relevant parties with release details, quantities, and pickup authorization
R-GCX016E-cbl-00668 (+16) File: GCX016E.cbl CPRS Bond Processing Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CPRS Bond Processing':
  • Context - a cargo record is being processed for bond assignment:
    For CPRS Cargo Identified?:
    When the system checks the cargo type or carrier information, then the cargo is identified as cprs cargo if it meets cprs criteria, otherwise it is processed as regular cargo.
  • Context - a cprs cargo has been identified for bond processing:
    For Retrieve CPRS Bond Information:
    When the system accesses the us cargo root record, then current bond number, broker information, and bond status are retrieved from the cargo record.
  • Context - cprs bond information has been retrieved:
    For Validate Bond Assignment:
    When the system validates the bond assignment against cargo entry type and requirements, then the bond assignment is confirmed as valid or flagged for correction.
  • Context - bond assignment validation has been completed:
    For Bond Already Assigned?:
    When the system checks if a bond number already exists for the cargo, then if bond number exists and is valid, proceed to update existing bond, otherwise create new bond assignment.
  • Context - cprs cargo does not have an existing valid bond assignment:
    For Create New Bond Assignment:
    When the system creates a new bond assignment, then a new bond number is assigned to the cargo and bond creation is logged.
  • Context - cprs cargo has an existing valid bond assignment:
    For Update Existing Bond:
    When the system updates the bond information, then existing bond record is updated with current cargo processing information and status.
  • Context - bond assignment has been created or updated:
    For Process Broker Bond Information:
    When the system processes broker bond information, then broker details are validated and associated with the bond assignment.
  • Context - broker bond information processing has started:
    For Broker Information Available?:
    When the system checks for available broker information in the broker table, then if broker information exists, assign broker to bond, otherwise set default broker information.
  • Context - broker information is available for the bond:
    For Assign Broker to Bond:
    When the system assigns the broker to the bond, then broker id, name, and contact information are associated with the bond record.
  • Context - broker information is not available for the bond:
    For Set Default Broker Information:
    When the system sets default broker information, then default broker id and standard broker information are assigned to the bond.
  • Context - broker has been assigned to the bond or default broker information has been set:
    For Update Bond Owner Information:
    When the system updates bond owner information, then bond owner details are updated with current broker information and ownership status.
  • Context - bond owner information has been updated:
    For Clear Previous Bond Data:
    When the system clears previous bond data, then any conflicting or outdated bond information is removed from the cargo record.
  • Context - previous bond data has been cleared:
    For Set CPRS Bond Flags:
    When the system sets cprs bond flags, then cprs-specific flags are set to indicate bond type, processing status, and special handling requirements.
  • Context - cprs bond flags have been set:
    For Log Bond Assignment Action:
    When the system logs the bond assignment action, then bond assignment details, timestamp, and processing information are recorded in the status segments.
  • Context - bond assignment action has been logged:
    For Generate Bond Creation Notification:
    When the system generates bond creation notification, then notification message is prepared with bond details, cargo information, and routing instructions.
  • Context - bond creation notification has been generated:
    For Send K1 Message for Bond Creation:
    When the system sends k1 message for bond creation, then k1 message with bond creation details is transmitted to the appropriate recipients.
  • Context - k1 message for bond creation has been sent:
    For Update Cargo Record with Bond Info:
    When the system updates the cargo record with bond information, then cargo record is updated with complete bond assignment details, broker information, and processing status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for bond assignment
GIVEN
A cargo record is being processed for bond assignment
Applied to: CPRS Cargo Identified?
WHEN
The system checks the cargo type or carrier information
THEN
The cargo is identified as CPRS cargo if it meets CPRS criteria, otherwise it is processed as regular cargo
Context: A CPRS cargo has been identified for bond processing
GIVEN
A CPRS cargo has been identified for bond processing
Applied to: Retrieve CPRS Bond Information
WHEN
The system accesses the US cargo root record
THEN
Current bond number, broker information, and bond status are retrieved from the cargo record
Context: CPRS bond information has been retrieved
GIVEN
CPRS bond information has been retrieved
Applied to: Validate Bond Assignment
WHEN
The system validates the bond assignment against cargo entry type and requirements
THEN
The bond assignment is confirmed as valid or flagged for correction
Context: Bond assignment validation has been completed
GIVEN
Bond assignment validation has been completed
Applied to: Bond Already Assigned?
WHEN
The system checks if a bond number already exists for the cargo
THEN
If bond number exists and is valid, proceed to update existing bond, otherwise create new bond assignment
Context: CPRS cargo does not have an existing valid bond assignment
GIVEN
CPRS cargo does not have an existing valid bond assignment
Applied to: Create New Bond Assignment
WHEN
The system creates a new bond assignment
THEN
A new bond number is assigned to the cargo and bond creation is logged
Context: CPRS cargo has an existing valid bond assignment
GIVEN
CPRS cargo has an existing valid bond assignment
Applied to: Update Existing Bond
WHEN
The system updates the bond information
THEN
Existing bond record is updated with current cargo processing information and status
Context: Bond assignment has been created or updated
GIVEN
Bond assignment has been created or updated
Applied to: Process Broker Bond Information
WHEN
The system processes broker bond information
THEN
Broker details are validated and associated with the bond assignment
Context: Broker bond information processing has started
GIVEN
Broker bond information processing has started
Applied to: Broker Information Available?
WHEN
The system checks for available broker information in the broker table
THEN
If broker information exists, assign broker to bond, otherwise set default broker information
Context: Broker information is available for the bond
GIVEN
Broker information is available for the bond
Applied to: Assign Broker to Bond
WHEN
The system assigns the broker to the bond
THEN
Broker ID, name, and contact information are associated with the bond record
Context: Broker information is not available for the bond
GIVEN
Broker information is not available for the bond
Applied to: Set Default Broker Information
WHEN
The system sets default broker information
THEN
Default broker ID and standard broker information are assigned to the bond
Context: Broker has been assigned to the bond or default broker information has been set
GIVEN
Broker has been assigned to the bond or default broker information has been set
Applied to: Update Bond Owner Information
WHEN
The system updates bond owner information
THEN
Bond owner details are updated with current broker information and ownership status
Context: Bond owner information has been updated
GIVEN
Bond owner information has been updated
Applied to: Clear Previous Bond Data
WHEN
The system clears previous bond data
THEN
Any conflicting or outdated bond information is removed from the cargo record
Context: Previous bond data has been cleared
GIVEN
Previous bond data has been cleared
Applied to: Set CPRS Bond Flags
WHEN
The system sets CPRS bond flags
THEN
CPRS-specific flags are set to indicate bond type, processing status, and special handling requirements
Context: CPRS bond flags have been set
GIVEN
CPRS bond flags have been set
Applied to: Log Bond Assignment Action
WHEN
The system logs the bond assignment action
THEN
Bond assignment details, timestamp, and processing information are recorded in the status segments
Context: Bond assignment action has been logged
GIVEN
Bond assignment action has been logged
Applied to: Generate Bond Creation Notification
WHEN
The system generates bond creation notification
THEN
Notification message is prepared with bond details, cargo information, and routing instructions
Context: Bond creation notification has been generated
GIVEN
Bond creation notification has been generated
Applied to: Send K1 Message for Bond Creation
WHEN
The system sends K1 message for bond creation
THEN
K1 message with bond creation details is transmitted to the appropriate recipients
Context: K1 message for bond creation has been sent
GIVEN
K1 message for bond creation has been sent
Applied to: Update Cargo Record with Bond Info
WHEN
The system updates the cargo record with bond information
THEN
Cargo record is updated with complete bond assignment details, broker information, and processing status
R-GCX016E-cbl-00685 (+12) File: GCX016E.cbl Cargo Arrival Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Arrival Processing':
  • Context - a cargo disposition code is being processed:
    For Arrival Disposition Code Received?:
    When the system checks if the disposition code indicates an arrival event, then the system proceeds with arrival processing if arrival disposition code is present, otherwise skips arrival processing.
  • Context - an arrival disposition code has been received:
    For Valid Border/Destination Location?:
    When the system validates the arrival location against valid border and destination locations, then the system continues arrival processing if location is valid, otherwise generates location error message and skips processing.
  • Context - a valid arrival location has been confirmed:
    For Set Cargo Arrival Flag:
    When the system processes the arrival event, then the cargo arrival flag is set to indicate arrival status.
  • Context - cargo arrival flag has been set:
    For Clear Bond Start Date:
    When the system processes bond-related information for the arrived cargo, then the bond start date is cleared to reset bond timing.
  • Context - bond start date has been cleared for arrived cargo:
    For Set Arrival Index:
    When the system assigns location tracking information, then an arrival index is set to identify the specific arrival location.
  • Context - arrival index has been set for the cargo:
    For Calculate Cargo Age:
    When the system calculates cargo timing information, then cargo age is calculated based on arrival date and relevant timing factors.
  • Context - cargo age has been calculated:
    For Update Cargo Status to Arrived:
    When the system updates cargo status information, then the cargo status is updated to 'arrived' to reflect current state.
  • Context - cargo status has been updated to arrived:
    For Generate Arrival Notification:
    When the system processes notification requirements, then an arrival notification is generated for internal tracking and reporting.
  • Context - arrival notification has been generated:
    For Send AEI Notification Message:
    When the system processes external notification requirements, then an aei notification message is sent to external systems for equipment tracking.
  • Context - aei notification message has been sent:
    For Log Arrival Action:
    When the system processes audit and logging requirements, then the arrival action is logged for audit trail and historical tracking.
  • Context - arrival action has been logged:
    For Update Destination Index:
    When the system updates location tracking information, then the destination index is updated to reflect the current cargo location.
  • Context - destination index has been updated:
    For Trigger GCCIIS Status Update:
    When the system processes external system synchronization requirements, then a gcciis status update is triggered to synchronize cargo information with external systems.
  • Context - an arrival location validation has failed:
    For Generate Location Error Message:
    When the system detects an invalid border or destination location, then a location error message is generated to notify of the invalid location.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo disposition code is being processed
GIVEN
A cargo disposition code is being processed
Applied to: Arrival Disposition Code Received?
WHEN
The system checks if the disposition code indicates an arrival event
THEN
The system proceeds with arrival processing if arrival disposition code is present, otherwise skips arrival processing
Context: An arrival disposition code has been received
GIVEN
An arrival disposition code has been received
Applied to: Valid Border/Destination Location?
WHEN
The system validates the arrival location against valid border and destination locations
THEN
The system continues arrival processing if location is valid, otherwise generates location error message and skips processing
Context: A valid arrival location has been confirmed
GIVEN
A valid arrival location has been confirmed
Applied to: Set Cargo Arrival Flag
WHEN
The system processes the arrival event
THEN
The cargo arrival flag is set to indicate arrival status
Context: Cargo arrival flag has been set
GIVEN
Cargo arrival flag has been set
Applied to: Clear Bond Start Date
WHEN
The system processes bond-related information for the arrived cargo
THEN
The bond start date is cleared to reset bond timing
Context: Bond start date has been cleared for arrived cargo
GIVEN
Bond start date has been cleared for arrived cargo
Applied to: Set Arrival Index
WHEN
The system assigns location tracking information
THEN
An arrival index is set to identify the specific arrival location
Context: Arrival index has been set for the cargo
GIVEN
Arrival index has been set for the cargo
Applied to: Calculate Cargo Age
WHEN
The system calculates cargo timing information
THEN
Cargo age is calculated based on arrival date and relevant timing factors
Context: Cargo age has been calculated
GIVEN
Cargo age has been calculated
Applied to: Update Cargo Status to Arrived
WHEN
The system updates cargo status information
THEN
The cargo status is updated to 'Arrived' to reflect current state
Context: Cargo status has been updated to arrived
GIVEN
Cargo status has been updated to arrived
Applied to: Generate Arrival Notification
WHEN
The system processes notification requirements
THEN
An arrival notification is generated for internal tracking and reporting
Context: Arrival notification has been generated
GIVEN
Arrival notification has been generated
Applied to: Send AEI Notification Message
WHEN
The system processes external notification requirements
THEN
An AEI notification message is sent to external systems for equipment tracking
Context: AEI notification message has been sent
GIVEN
AEI notification message has been sent
Applied to: Log Arrival Action
WHEN
The system processes audit and logging requirements
THEN
The arrival action is logged for audit trail and historical tracking
Context: Arrival action has been logged
GIVEN
Arrival action has been logged
Applied to: Update Destination Index
WHEN
The system updates location tracking information
THEN
The destination index is updated to reflect the current cargo location
Context: Destination index has been updated
GIVEN
Destination index has been updated
Applied to: Trigger GCCIIS Status Update
WHEN
The system processes external system synchronization requirements
THEN
A GCCIIS status update is triggered to synchronize cargo information with external systems
Context: An arrival location validation has failed
GIVEN
An arrival location validation has failed
Applied to: Generate Location Error Message
WHEN
The system detects an invalid border or destination location
THEN
A location error message is generated to notify of the invalid location
R-GCX016E-cbl-00698 (+17) File: GCX016E.cbl Cargo Export Processing Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Export Processing':
  • Context - a disposition code has been received for cargo processing:
    For Export Disposition Code Received?:
    When the system evaluates the disposition code type, then the system identifies if it is an export disposition code and proceeds with export processing or skips to completion.
  • Context - an export disposition code has been received with location information:
    For Validate Export Location:
    When the system validates the export location against valid export ports, then the system confirms the location is valid for export processing.
  • Context - an export location has been specified in the disposition code:
    For Valid Export Port?:
    When the system checks the location against the valid export port table, then the system either confirms the port is valid and continues processing or generates an error for invalid ports.
  • Context - a valid export port has been confirmed for the cargo:
    For Set Export Status Flag:
    When the system processes the export disposition code, then the system sets the export status flag to active in the cargo record.
  • Context - the export status flag has been set for the cargo:
    For Clear Destination Index:
    When the system processes the export status change, then the system clears the destination index field to remove domestic destination references.
  • Context - the destination index has been cleared for the export cargo:
    For Update Export Date/Time:
    When the system finalizes the export status change, then the system updates the export date and time fields with the current timestamp.
  • Context - the export date and time have been updated for the cargo:
    For Check Previous Export Status:
    When the system checks the cargo's previous processing history, then the system retrieves the current export status to determine if duplicate processing should be prevented.
  • Context - the system has checked the cargo's previous export status:
    For Already Exported?:
    When the system evaluates if the cargo already has an active export status, then the system either skips duplicate processing or continues with new export notification.
  • Context - the cargo has already been processed for export:
    For Skip Duplicate Export:
    When the system detects duplicate export processing, then the system skips the export notification and completes processing without generating duplicate messages.
  • Context - the cargo has not been previously exported:
    For Generate Export Notification:
    When the system processes the export status change, then the system generates a new export notification message for distribution.
  • Context - an export notification needs to be generated:
    For Format Export Message:
    When the system creates the export message, then the system formats the message with proper export notification headers and structure.
  • Context - the export message format has been established:
    For Include Cargo Details:
    When the system populates the message content, then the system includes cargo identification, quantities, and relevant cargo details in the export message.
  • Context - cargo details have been included in the export message:
    For Add Location Information:
    When the system completes the message content, then the system adds the export port code, location name, and relevant geographic information to the message.
  • Context - the export notification message has been fully formatted with cargo and location details:
    For Send Export Notification:
    When the system is ready to distribute the notification, then the system sends the export notification to designated recipients and systems.
  • Context - the export notification has been successfully sent:
    For Update Cargo Record:
    When the system finalizes the export processing, then the system updates the cargo record in the database with the export status, date, time, and location information.
  • Context - the cargo record has been updated with export information:
    For Log Export Action:
    When the system completes the export processing workflow, then the system creates a log entry documenting the export action, timestamp, and processing details.
  • Context - all export processing steps have been completed successfully or skipped appropriately:
    For Export Processing Complete:
    When the system reaches the end of export processing logic, then the system marks the export processing as complete and returns control to the main processing flow.
  • Context - an invalid export port has been detected or other validation has failed:
    For Generate Error Message:
    When the system cannot proceed with export processing, then the system generates an appropriate error message describing the export processing failure.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code has been received for cargo processing
GIVEN
A disposition code has been received for cargo processing
Applied to: Export Disposition Code Received?
WHEN
The system evaluates the disposition code type
THEN
The system identifies if it is an export disposition code and proceeds with export processing or skips to completion
Context: An export disposition code has been received with location information
GIVEN
An export disposition code has been received with location information
Applied to: Validate Export Location
WHEN
The system validates the export location against valid export ports
THEN
The system confirms the location is valid for export processing
Context: An export location has been specified in the disposition code
GIVEN
An export location has been specified in the disposition code
Applied to: Valid Export Port?
WHEN
The system checks the location against the valid export port table
THEN
The system either confirms the port is valid and continues processing or generates an error for invalid ports
Context: A valid export port has been confirmed for the cargo
GIVEN
A valid export port has been confirmed for the cargo
Applied to: Set Export Status Flag
WHEN
The system processes the export disposition code
THEN
The system sets the export status flag to active in the cargo record
Context: The export status flag has been set for the cargo
GIVEN
The export status flag has been set for the cargo
Applied to: Clear Destination Index
WHEN
The system processes the export status change
THEN
The system clears the destination index field to remove domestic destination references
Context: The destination index has been cleared for the export cargo
GIVEN
The destination index has been cleared for the export cargo
Applied to: Update Export Date/Time
WHEN
The system finalizes the export status change
THEN
The system updates the export date and time fields with the current timestamp
Context: The export date and time have been updated for the cargo
GIVEN
The export date and time have been updated for the cargo
Applied to: Check Previous Export Status
WHEN
The system checks the cargo's previous processing history
THEN
The system retrieves the current export status to determine if duplicate processing should be prevented
Context: The system has checked the cargo's previous export status
GIVEN
The system has checked the cargo's previous export status
Applied to: Already Exported?
WHEN
The system evaluates if the cargo already has an active export status
THEN
The system either skips duplicate processing or continues with new export notification
Context: The cargo has already been processed for export
GIVEN
The cargo has already been processed for export
Applied to: Skip Duplicate Export
WHEN
The system detects duplicate export processing
THEN
The system skips the export notification and completes processing without generating duplicate messages
Context: The cargo has not been previously exported
GIVEN
The cargo has not been previously exported
Applied to: Generate Export Notification
WHEN
The system processes the export status change
THEN
The system generates a new export notification message for distribution
Context: An export notification needs to be generated
GIVEN
An export notification needs to be generated
Applied to: Format Export Message
WHEN
The system creates the export message
THEN
The system formats the message with proper export notification headers and structure
Context: The export message format has been established
GIVEN
The export message format has been established
Applied to: Include Cargo Details
WHEN
The system populates the message content
THEN
The system includes cargo identification, quantities, and relevant cargo details in the export message
Context: Cargo details have been included in the export message
GIVEN
Cargo details have been included in the export message
Applied to: Add Location Information
WHEN
The system completes the message content
THEN
The system adds the export port code, location name, and relevant geographic information to the message
Context: The export notification message has been fully formatted with cargo and location details
GIVEN
The export notification message has been fully formatted with cargo and location details
Applied to: Send Export Notification
WHEN
The system is ready to distribute the notification
THEN
The system sends the export notification to designated recipients and systems
Context: The export notification has been successfully sent
GIVEN
The export notification has been successfully sent
Applied to: Update Cargo Record
WHEN
The system finalizes the export processing
THEN
The system updates the cargo record in the database with the export status, date, time, and location information
Context: The cargo record has been updated with export information
GIVEN
The cargo record has been updated with export information
Applied to: Log Export Action
WHEN
The system completes the export processing workflow
THEN
The system creates a log entry documenting the export action, timestamp, and processing details
Context: All export processing steps have been completed successfully or skipped appropriately
GIVEN
All export processing steps have been completed successfully or skipped appropriately
Applied to: Export Processing Complete
WHEN
The system reaches the end of export processing logic
THEN
The system marks the export processing as complete and returns control to the main processing flow
Context: An invalid export port has been detected or other validation has failed
GIVEN
An invalid export port has been detected or other validation has failed
Applied to: Generate Error Message
WHEN
The system cannot proceed with export processing
THEN
The system generates an appropriate error message describing the export processing failure
R-GCX016E-cbl-00716 (+13) File: GCX016E.cbl Cancel Arrival Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cancel Arrival Processing':
  • Context - a cargo record exists in the system:
    For Cargo Has Arrival Status?:
    When cancel arrival processing is triggered for the cargo, then system checks if cargo has arrival status and only proceeds with cancellation if arrival status exists, otherwise skips cancellation processing.
  • Context - cargo has been validated to have arrival status:
    For Reset Arrival Flag to False:
    When arrival cancellation is authorized and processed, then system sets the cargo arrival flag to false to indicate cargo is no longer in arrived status.
  • Context - cargo arrival flag has been reset to false:
    For Clear Arrival Date Information:
    When arrival cancellation processing continues, then system clears all arrival date and time fields from the cargo record.
  • Context - arrival date information has been cleared from cargo record:
    For Update Cargo Status Arrays:
    When status array processing is performed, then system updates cargo status arrays to remove arrival-related status entries and recalculate current status.
  • Context - cargo status arrays have been updated for cancellation:
    For Remove Arrival Disposition Codes:
    When disposition code processing is performed, then system removes all arrival-related disposition codes from cargo status array.
  • Context - arrival disposition codes have been removed from cargo:
    For Restore Previous Bond Information:
    When bond information restoration is processed, then system restores the cargo's previous bond number and related bond information that existed before arrival processing.
  • Context - previous bond information has been restored to cargo:
    For Recalculate Cargo Age:
    When cargo age calculation is performed, then system recalculates cargo age using original entry date and current date, excluding the cancelled arrival period.
  • Context - cargo age has been recalculated after cancellation:
    For Clear Destination Index:
    When destination processing is performed, then system clears the destination index field to remove destination-specific routing information.
  • Context - destination index has been cleared for the cargo:
    For Multiple Cargo Records with Same Car/Waybill?:
    When system checks for related cargo records, then system identifies if multiple cargo records exist with the same car id and waybill number and processes them as a batch if found, otherwise processes single cargo.
  • Context - multiple cargo records with same car id and waybill have been identified:
    For Process All Related Cargo Records:
    When batch processing is initiated, then system applies the same arrival cancellation processing to all related cargo records with matching car id and waybill number.
  • Context - all related cargo records have been processed for arrival cancellation:
    For Verify All Records Updated:
    When verification process is executed, then system confirms that all cargo records with matching car id and waybill have been successfully updated with cancellation changes.
  • Context - all cargo records have been verified as updated or single cargo processing is complete:
    For Generate Arrival Cancellation Notification:
    When notification generation is triggered, then system creates arrival cancellation notification message with cargo details and cancellation information.
  • Context - arrival cancellation notification has been generated:
    For Update Audit Trail:
    When audit trail processing is performed, then system records arrival cancellation transaction in audit trail with timestamp, user information, and affected cargo details.
  • Context - audit trail has been updated with cancellation transaction:
    For Send Merlin Notification Message:
    When merlin message transmission is initiated, then system sends arrival cancellation notification message through merlin system to appropriate recipients.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Cargo Has Arrival Status?
WHEN
Cancel arrival processing is triggered for the cargo
THEN
System checks if cargo has arrival status and only proceeds with cancellation if arrival status exists, otherwise skips cancellation processing
Context: Cargo has been validated to have arrival status
GIVEN
Cargo has been validated to have arrival status
Applied to: Reset Arrival Flag to False
WHEN
Arrival cancellation is authorized and processed
THEN
System sets the cargo arrival flag to false to indicate cargo is no longer in arrived status
Context: Cargo arrival flag has been reset to false
GIVEN
Cargo arrival flag has been reset to false
Applied to: Clear Arrival Date Information
WHEN
Arrival cancellation processing continues
THEN
System clears all arrival date and time fields from the cargo record
Context: Arrival date information has been cleared from cargo record
GIVEN
Arrival date information has been cleared from cargo record
Applied to: Update Cargo Status Arrays
WHEN
Status array processing is performed
THEN
System updates cargo status arrays to remove arrival-related status entries and recalculate current status
Context: Cargo status arrays have been updated for cancellation
GIVEN
Cargo status arrays have been updated for cancellation
Applied to: Remove Arrival Disposition Codes
WHEN
Disposition code processing is performed
THEN
System removes all arrival-related disposition codes from cargo status array
Context: Arrival disposition codes have been removed from cargo
GIVEN
Arrival disposition codes have been removed from cargo
Applied to: Restore Previous Bond Information
WHEN
Bond information restoration is processed
THEN
System restores the cargo's previous bond number and related bond information that existed before arrival processing
Context: Previous bond information has been restored to cargo
GIVEN
Previous bond information has been restored to cargo
Applied to: Recalculate Cargo Age
WHEN
Cargo age calculation is performed
THEN
System recalculates cargo age using original entry date and current date, excluding the cancelled arrival period
Context: Cargo age has been recalculated after cancellation
GIVEN
Cargo age has been recalculated after cancellation
Applied to: Clear Destination Index
WHEN
Destination processing is performed
THEN
System clears the destination index field to remove destination-specific routing information
Context: Destination index has been cleared for the cargo
GIVEN
Destination index has been cleared for the cargo
Applied to: Multiple Cargo Records with Same Car/Waybill?
WHEN
System checks for related cargo records
THEN
System identifies if multiple cargo records exist with the same car ID and waybill number and processes them as a batch if found, otherwise processes single cargo
Context: Multiple cargo records with same car ID and waybill have been identified
GIVEN
Multiple cargo records with same car ID and waybill have been identified
Applied to: Process All Related Cargo Records
WHEN
Batch processing is initiated
THEN
System applies the same arrival cancellation processing to all related cargo records with matching car ID and waybill number
Context: All related cargo records have been processed for arrival cancellation
GIVEN
All related cargo records have been processed for arrival cancellation
Applied to: Verify All Records Updated
WHEN
Verification process is executed
THEN
System confirms that all cargo records with matching car ID and waybill have been successfully updated with cancellation changes
Context: All cargo records have been verified as updated OR single cargo processing is complete
GIVEN
All cargo records have been verified as updated OR single cargo processing is complete
Applied to: Generate Arrival Cancellation Notification
WHEN
Notification generation is triggered
THEN
System creates arrival cancellation notification message with cargo details and cancellation information
Context: Arrival cancellation notification has been generated
GIVEN
Arrival cancellation notification has been generated
Applied to: Update Audit Trail
WHEN
Audit trail processing is performed
THEN
System records arrival cancellation transaction in audit trail with timestamp, user information, and affected cargo details
Context: Audit trail has been updated with cancellation transaction
GIVEN
Audit trail has been updated with cancellation transaction
Applied to: Send Merlin Notification Message
WHEN
Merlin message transmission is initiated
THEN
System sends arrival cancellation notification message through Merlin system to appropriate recipients
R-GCX016E-cbl-00730 (+11) File: GCX016E.cbl Cancel Export Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cancel Export Processing':
  • Context - a cancel export disposition code is received for a cargo:
    For Validate Cancel Export Request:
    When the system processes the cancel export request, then the system validates the request parameters and ensures the cargo exists and is accessible.
  • Context - a cancel export request is being processed for a cargo:
    For Export Status Currently Active?:
    When the system checks the current cargo status, then the system determines if export status is currently active and proceeds only if export status exists.
  • Context - a cargo has active export status that needs to be cancelled:
    For Retrieve Current Export Information:
    When the system needs to process the export cancellation, then the system retrieves current export date, destination information, and export status flags from the cargo record.
  • Context - a cargo export cancellation is being processed and current export information has been retrieved:
    For Clear Export Status Flag:
    When the system clears the export status, then the export status flag is set to inactive or cleared in the cargo record.
  • Context - a cargo export status is being cancelled and export status flag has been cleared:
    For Reset Export Date Fields:
    When the system resets export date information, then export date fields are cleared or reset to null values in the cargo record.
  • Context - a cargo export is being cancelled and export date fields have been reset:
    For Clear Destination Index:
    When the system clears destination information, then the destination index is cleared or reset in the cargo record.
  • Context - a cargo export has been cancelled and destination index has been cleared:
    For Restore Previous Cargo Status:
    When the system restores the previous cargo status, then the cargo status is reverted to the status it had before export processing, typically 'ack' or previous processing status.
  • Context - a cargo export has been cancelled and previous status has been restored:
    For Update Cargo Status Arrays:
    When the system updates status tracking arrays, then the s09 status arrays are updated to remove export-related status entries and add cancellation status information.
  • Context - a cargo export has been cancelled and status arrays have been updated:
    For Generate Cancel Export Notification:
    When the system generates export cancellation notification, then a notification message is created containing cargo details, cancellation information, and relevant business data for stakeholders.
  • Context - an export cancellation notification has been generated:
    For Log Cancel Export Action:
    When the system logs the cancellation action, then the export cancellation action is recorded with timestamp, user information, cargo details, and cancellation reason for audit trail.
  • Context - an export cancellation has been logged and notification prepared:
    For Send Notification to Business Users:
    When the system sends notifications to business users, then export cancellation notifications are sent to brokers, freight forwarders, and other relevant parties via merlin messaging system or email.
  • Context - all export cancellation processing has been completed and notifications sent:
    For Update Cargo Record in Database:
    When the system updates the cargo record in the database, then the cargo record is updated in the database with all export cancellation changes, including cleared export status, reset dates, restored previous status, and updated status arrays.
👨‍💻 Technical ACs (Gherkin)
Context: A cancel export disposition code is received for a cargo
GIVEN
A cancel export disposition code is received for a cargo
Applied to: Validate Cancel Export Request
WHEN
The system processes the cancel export request
THEN
The system validates the request parameters and ensures the cargo exists and is accessible
Context: A cancel export request is being processed for a cargo
GIVEN
A cancel export request is being processed for a cargo
Applied to: Export Status Currently Active?
WHEN
The system checks the current cargo status
THEN
The system determines if export status is currently active and proceeds only if export status exists
Context: A cargo has active export status that needs to be cancelled
GIVEN
A cargo has active export status that needs to be cancelled
Applied to: Retrieve Current Export Information
WHEN
The system needs to process the export cancellation
THEN
The system retrieves current export date, destination information, and export status flags from the cargo record
Context: A cargo export cancellation is being processed and current export information has been retrieved
GIVEN
A cargo export cancellation is being processed and current export information has been retrieved
Applied to: Clear Export Status Flag
WHEN
The system clears the export status
THEN
The export status flag is set to inactive or cleared in the cargo record
Context: A cargo export status is being cancelled and export status flag has been cleared
GIVEN
A cargo export status is being cancelled and export status flag has been cleared
Applied to: Reset Export Date Fields
WHEN
The system resets export date information
THEN
Export date fields are cleared or reset to null values in the cargo record
Context: A cargo export is being cancelled and export date fields have been reset
GIVEN
A cargo export is being cancelled and export date fields have been reset
Applied to: Clear Destination Index
WHEN
The system clears destination information
THEN
The destination index is cleared or reset in the cargo record
Context: A cargo export has been cancelled and destination index has been cleared
GIVEN
A cargo export has been cancelled and destination index has been cleared
Applied to: Restore Previous Cargo Status
WHEN
The system restores the previous cargo status
THEN
The cargo status is reverted to the status it had before export processing, typically 'ACK' or previous processing status
Context: A cargo export has been cancelled and previous status has been restored
GIVEN
A cargo export has been cancelled and previous status has been restored
Applied to: Update Cargo Status Arrays
WHEN
The system updates status tracking arrays
THEN
The S09 status arrays are updated to remove export-related status entries and add cancellation status information
Context: A cargo export has been cancelled and status arrays have been updated
GIVEN
A cargo export has been cancelled and status arrays have been updated
Applied to: Generate Cancel Export Notification
WHEN
The system generates export cancellation notification
THEN
A notification message is created containing cargo details, cancellation information, and relevant business data for stakeholders
Context: An export cancellation notification has been generated
GIVEN
An export cancellation notification has been generated
Applied to: Log Cancel Export Action
WHEN
The system logs the cancellation action
THEN
The export cancellation action is recorded with timestamp, user information, cargo details, and cancellation reason for audit trail
Context: An export cancellation has been logged and notification prepared
GIVEN
An export cancellation has been logged and notification prepared
Applied to: Send Notification to Business Users
WHEN
The system sends notifications to business users
THEN
Export cancellation notifications are sent to brokers, freight forwarders, and other relevant parties via Merlin messaging system or email
Context: All export cancellation processing has been completed and notifications sent
GIVEN
All export cancellation processing has been completed and notifications sent
Applied to: Update Cargo Record in Database
WHEN
The system updates the cargo record in the database
THEN
The cargo record is updated in the database with all export cancellation changes, including cleared export status, reset dates, restored previous status, and updated status arrays
R-GCX016E-cbl-00742 (+19) File: GCX016E.cbl Release Quantity Management Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Quantity Management':
  • Context - a cargo record exists in the system:
    For Retrieve Current Cargo Release Quantity:
    When the release quantity management process is initiated, then the current release quantity is retrieved from the cargo record and stored for processing.
  • Context - a cargo status array (s09a) contains disposition codes:
    For Get Disposition Code from Status Array:
    When processing release quantity calculations, then the disposition code is extracted from the status array for further processing.
  • Context - a disposition code has been extracted from the status array:
    For Lookup Disposition Code in DC Table:
    When the system needs to determine the disposition code's action type, then the disposition code is looked up in the dc table to retrieve its configuration.
  • Context - a disposition code lookup has been performed in the dc table:
    For Disposition Code Found?:
    When the system checks if the disposition code was found, then if the disposition code is not found, an error message is generated for unknown disposition code.
  • Context - a valid disposition code exists in the dc table:
    For Get Disposition Code Action Type:
    When the system processes the disposition code, then the action type is retrieved from the dc table configuration.
  • Context - a disposition code action type has been determined:
    For Action Type?:
    When the system processes the quantity impact, then if action type is 'add', quantity is added to release quantity; if action type is 'subtract', quantity is subtracted from release quantity; if action type is 'status info only', no quantity change is made.
  • Context - a disposition code has action type 'add':
    For Add to Release Quantity:
    When the quantity impact is processed, then the disposition code quantity is added to the current release quantity.
  • Context - a disposition code has action type 'subtract':
    For Subtract from Release Quantity:
    When the quantity impact is processed, then the disposition code quantity is subtracted from the current release quantity.
  • Context - a disposition code has action type 'status info only':
    For No Quantity Change:
    When the quantity impact is processed, then no change is made to the current release quantity.
  • Context - release quantity has been calculated based on disposition code action:
    For Validate Release Quantity Against Total Quantity:
    When the system validates the calculated release quantity, then the release quantity is compared against the total cargo quantity for validation.
  • Context - a calculated release quantity exists:
    For Release Quantity > Total Quantity?:
    When the release quantity is validated against total cargo quantity, then if release quantity exceeds total quantity, the release quantity is set equal to total quantity.
    For Release Quantity < 0?:
    When the release quantity is validated for minimum bounds, then if release quantity is less than zero, the release quantity is set to zero.
  • Context - the calculated release quantity exceeds the total cargo quantity:
    For Set Release Quantity = Total Quantity:
    When the system applies quantity validation rules, then the release quantity is set equal to the total cargo quantity.
  • Context - the calculated release quantity is less than zero:
    For Set Release Quantity = 0:
    When the system applies minimum quantity validation, then the release quantity is set to zero.
  • Context - a validated release quantity has been calculated:
    For Update Cargo Record with New Release Quantity:
    When the quantity processing is complete, then the cargo record is updated with the new release quantity.
  • Context - the cargo record has been updated with new release quantity:
    For Calculate Quantity Impact for Merlin Message:
    When preparing merlin notification messages, then the quantity impact (difference between old and new release quantity) is calculated for message content.
  • Context - quantity impact has been calculated:
    For Format Before/After Quantity Comparison:
    When formatting information for notifications, then before and after quantity values are formatted for comparison display.
  • Context - quantity comparison has been formatted:
    For Log Quantity Change in Audit Trail:
    When recording the transaction, then the quantity change is logged in the audit trail with before/after values and disposition code information.
  • Context - quantity change has been logged in audit trail:
    For Generate Merlin Notification with Quantity Impact:
    When generating notifications, then a merlin notification message is generated including the quantity impact details.
  • Context - a disposition code lookup in the dc table has failed:
    For Generate Error Message for Unknown Disposition Code:
    When the disposition code is not found, then an error message is generated indicating unknown disposition code.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Retrieve Current Cargo Release Quantity
WHEN
The release quantity management process is initiated
THEN
The current release quantity is retrieved from the cargo record and stored for processing
Context: A cargo status array (S09A) contains disposition codes
GIVEN
A cargo status array (S09A) contains disposition codes
Applied to: Get Disposition Code from Status Array
WHEN
Processing release quantity calculations
THEN
The disposition code is extracted from the status array for further processing
Context: A disposition code has been extracted from the status array
GIVEN
A disposition code has been extracted from the status array
Applied to: Lookup Disposition Code in DC Table
WHEN
The system needs to determine the disposition code's action type
THEN
The disposition code is looked up in the DC table to retrieve its configuration
Context: A disposition code lookup has been performed in the DC table
GIVEN
A disposition code lookup has been performed in the DC table
Applied to: Disposition Code Found?
WHEN
The system checks if the disposition code was found
THEN
If the disposition code is not found, an error message is generated for unknown disposition code
Context: A valid disposition code exists in the DC table
GIVEN
A valid disposition code exists in the DC table
Applied to: Get Disposition Code Action Type
WHEN
The system processes the disposition code
THEN
The action type is retrieved from the DC table configuration
Context: A disposition code action type has been determined
GIVEN
A disposition code action type has been determined
Applied to: Action Type?
WHEN
The system processes the quantity impact
THEN
If action type is 'Add', quantity is added to release quantity; if action type is 'Subtract', quantity is subtracted from release quantity; if action type is 'Status Info Only', no quantity change is made
Context: A disposition code has action type 'Add'
GIVEN
A disposition code has action type 'Add'
Applied to: Add to Release Quantity
WHEN
The quantity impact is processed
THEN
The disposition code quantity is added to the current release quantity
Context: A disposition code has action type 'Subtract'
GIVEN
A disposition code has action type 'Subtract'
Applied to: Subtract from Release Quantity
WHEN
The quantity impact is processed
THEN
The disposition code quantity is subtracted from the current release quantity
Context: A disposition code has action type 'Status Info Only'
GIVEN
A disposition code has action type 'Status Info Only'
Applied to: No Quantity Change
WHEN
The quantity impact is processed
THEN
No change is made to the current release quantity
Context: Release quantity has been calculated based on disposition code action
GIVEN
Release quantity has been calculated based on disposition code action
Applied to: Validate Release Quantity Against Total Quantity
WHEN
The system validates the calculated release quantity
THEN
The release quantity is compared against the total cargo quantity for validation
Context: A calculated release quantity exists
GIVEN
A calculated release quantity exists
Applied to: Release Quantity > Total Quantity?
WHEN
The release quantity is validated against total cargo quantity
THEN
If release quantity exceeds total quantity, the release quantity is set equal to total quantity
Applied to: Release Quantity < 0?
WHEN
The release quantity is validated for minimum bounds
THEN
If release quantity is less than zero, the release quantity is set to zero
Context: The calculated release quantity exceeds the total cargo quantity
GIVEN
The calculated release quantity exceeds the total cargo quantity
Applied to: Set Release Quantity = Total Quantity
WHEN
The system applies quantity validation rules
THEN
The release quantity is set equal to the total cargo quantity
Context: The calculated release quantity is less than zero
GIVEN
The calculated release quantity is less than zero
Applied to: Set Release Quantity = 0
WHEN
The system applies minimum quantity validation
THEN
The release quantity is set to zero
Context: A validated release quantity has been calculated
GIVEN
A validated release quantity has been calculated
Applied to: Update Cargo Record with New Release Quantity
WHEN
The quantity processing is complete
THEN
The cargo record is updated with the new release quantity
Context: The cargo record has been updated with new release quantity
GIVEN
The cargo record has been updated with new release quantity
Applied to: Calculate Quantity Impact for Merlin Message
WHEN
Preparing Merlin notification messages
THEN
The quantity impact (difference between old and new release quantity) is calculated for message content
Context: Quantity impact has been calculated
GIVEN
Quantity impact has been calculated
Applied to: Format Before/After Quantity Comparison
WHEN
Formatting information for notifications
THEN
Before and after quantity values are formatted for comparison display
Context: Quantity comparison has been formatted
GIVEN
Quantity comparison has been formatted
Applied to: Log Quantity Change in Audit Trail
WHEN
Recording the transaction
THEN
The quantity change is logged in the audit trail with before/after values and disposition code information
Context: Quantity change has been logged in audit trail
GIVEN
Quantity change has been logged in audit trail
Applied to: Generate Merlin Notification with Quantity Impact
WHEN
Generating notifications
THEN
A Merlin notification message is generated including the quantity impact details
Context: A disposition code lookup in the DC table has failed
GIVEN
A disposition code lookup in the DC table has failed
Applied to: Generate Error Message for Unknown Disposition Code
WHEN
The disposition code is not found
THEN
An error message is generated indicating unknown disposition code
R-GCX016E-cbl-00762 (+25) File: GCX016E.cbl Hold Cargo Notification Merged 26 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hold Cargo Notification':
  • Context - a cargo record exists with status information:
    For Hold Status Detected in Cargo:
    When the system evaluates cargo status and finds hold conditions are present, then the hold notification process is triggered and hold information gathering begins.
  • Context - hold status has been detected for a cargo:
    For Gather Hold Information:
    When the system begins gathering hold information from gcsuss09 status segments, then all relevant hold data including hold type, priority, and status validation is collected.
  • Context - hold information is being gathered for a cargo:
    For Check Hold Type:
    When the system examines the hold status codes and disposition information, then the hold type is classified as border hold, destination hold, fda hold, or other specific hold category.
  • Context - a hold type has been identified for cargo:
    For Validate Hold Status:
    When the system validates the hold status against current business rules, then the hold status is confirmed as valid and active, or flagged for correction.
  • Context - hold status has been validated for cargo:
    For Determine Hold Priority:
    When the system evaluates hold type and associated business rules, then hold priority is determined based on hold type hierarchy and urgency requirements.
  • Context - hold information has been gathered for cargo:
    For Collect Disposition Code Details:
    When the system accesses gcstbrt table segments for disposition code details, then complete disposition code information including descriptions and hold reasons is collected.
  • Context - disposition code details are being collected:
    For Lookup Disposition Code Description:
    When the system looks up disposition codes in the dc table, then descriptive text for each disposition code is retrieved and made available for notification.
  • Context - disposition code descriptions have been retrieved:
    For Get Hold Reason Details:
    When the system analyzes disposition codes for hold-specific information, then detailed hold reasons and explanatory information are extracted for notification purposes.
  • Context - disposition code details have been collected:
    For Retrieve Location Information:
    When the system accesses station data tables for location information, then origin station, destination station, and border information are retrieved for the notification.
  • Context - all hold information and location data have been retrieved:
    For Format Hold Notification Message:
    When the system begins formatting the notification message, then a structured message template is prepared with placeholders for equipment, cargo, and location details.
  • Context - hold notification message formatting has begun:
    For Include Equipment Details:
    When the system accesses gcsusrt cargo root for equipment details, then car id, waybill number, and equipment type information are included in the notification.
  • Context - equipment details are being included in the notification:
    For Format Car ID:
    When the system processes car identification data, then car id is formatted according to standard notation and included in the message.
  • Context - car id has been formatted for the notification:
    For Include Waybill Number:
    When the system processes waybill information, then waybill number is included in the notification message for cargo identification.
  • Context - equipment details have been included in the notification:
    For Add Cargo Identification:
    When the system processes cargo identification data, then us-ccn, cargo description, and quantity information are added to the notification.
  • Context - cargo identification is being added to the notification:
    For Format US-CCN:
    When the system processes us-ccn information, then us-ccn is formatted according to standard format and included in the message.
  • Context - cargo identification has been added to the notification:
    For Include Hold Reason Code:
    When the system processes hold reason information, then hold reason codes and associated explanations are included in the notification message.
  • Context - hold reason codes have been included in the notification:
    For Add Location and Station Data:
    When the system processes location data from station tables, then origin station, destination station, and border information are formatted and added to the message.
  • Context - location and station data is being added to the notification:
    For Format Origin Station:
    When the system processes origin station information, then origin station name and code are formatted and included in the notification.
  • Context - origin station has been formatted for the notification:
    For Format Destination Station:
    When the system processes destination station information, then destination station name and code are formatted and included in the notification.
  • Context - location and station data has been added to the notification:
    For Format Date and Time Information:
    When the system processes date and time information, then hold date, time, and related temporal information are formatted according to standard format.
  • Context - all message components including date and time have been formatted:
    For Create Comprehensive Hold Message:
    When the system combines all elements into a final message, then a comprehensive hold notification message is created with all required information properly structured.
  • Context - all individual message components have been prepared:
    For Combine All Elements:
    When the system combines equipment, cargo, location, and hold information, then all elements are properly integrated into a single comprehensive message structure.
  • Context - all message elements have been combined:
    For Apply Message Template:
    When the system applies the standard hold notification template, then the message conforms to established format standards and includes all required sections.
  • Context - message template has been applied to the notification:
    For Validate Message Format:
    When the system validates the message format and content, then the message is confirmed to meet all format requirements and contains all mandatory information.
  • Context - hold notification message has been created and validated:
    For Route to Merlin Message System:
    When the system routes the message to the merlin message system, then the message is successfully queued in the merlin system for distribution.
  • Context - hold notification has been routed to the merlin message system:
    For Distribute Hold Notification:
    When the system processes the message for distribution, then the hold notification is distributed to all appropriate recipients based on routing rules.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with status information
GIVEN
A cargo record exists with status information
Applied to: Hold Status Detected in Cargo
WHEN
The system evaluates cargo status and finds hold conditions are present
THEN
The hold notification process is triggered and hold information gathering begins
Context: Hold status has been detected for a cargo
GIVEN
Hold status has been detected for a cargo
Applied to: Gather Hold Information
WHEN
The system begins gathering hold information from GCSUSS09 status segments
THEN
All relevant hold data including hold type, priority, and status validation is collected
Context: Hold information is being gathered for a cargo
GIVEN
Hold information is being gathered for a cargo
Applied to: Check Hold Type
WHEN
The system examines the hold status codes and disposition information
THEN
The hold type is classified as border hold, destination hold, FDA hold, or other specific hold category
Context: A hold type has been identified for cargo
GIVEN
A hold type has been identified for cargo
Applied to: Validate Hold Status
WHEN
The system validates the hold status against current business rules
THEN
The hold status is confirmed as valid and active, or flagged for correction
Context: Hold status has been validated for cargo
GIVEN
Hold status has been validated for cargo
Applied to: Determine Hold Priority
WHEN
The system evaluates hold type and associated business rules
THEN
Hold priority is determined based on hold type hierarchy and urgency requirements
Context: Hold information has been gathered for cargo
GIVEN
Hold information has been gathered for cargo
Applied to: Collect Disposition Code Details
WHEN
The system accesses GCSTBRT table segments for disposition code details
THEN
Complete disposition code information including descriptions and hold reasons is collected
Context: Disposition code details are being collected
GIVEN
Disposition code details are being collected
Applied to: Lookup Disposition Code Description
WHEN
The system looks up disposition codes in the DC table
THEN
Descriptive text for each disposition code is retrieved and made available for notification
Context: Disposition code descriptions have been retrieved
GIVEN
Disposition code descriptions have been retrieved
Applied to: Get Hold Reason Details
WHEN
The system analyzes disposition codes for hold-specific information
THEN
Detailed hold reasons and explanatory information are extracted for notification purposes
Context: Disposition code details have been collected
GIVEN
Disposition code details have been collected
Applied to: Retrieve Location Information
WHEN
The system accesses station data tables for location information
THEN
Origin station, destination station, and border information are retrieved for the notification
Context: All hold information and location data have been retrieved
GIVEN
All hold information and location data have been retrieved
Applied to: Format Hold Notification Message
WHEN
The system begins formatting the notification message
THEN
A structured message template is prepared with placeholders for equipment, cargo, and location details
Context: Hold notification message formatting has begun
GIVEN
Hold notification message formatting has begun
Applied to: Include Equipment Details
WHEN
The system accesses GCSUSRT cargo root for equipment details
THEN
Car ID, waybill number, and equipment type information are included in the notification
Context: Equipment details are being included in the notification
GIVEN
Equipment details are being included in the notification
Applied to: Format Car ID
WHEN
The system processes car identification data
THEN
Car ID is formatted according to standard notation and included in the message
Context: Car ID has been formatted for the notification
GIVEN
Car ID has been formatted for the notification
Applied to: Include Waybill Number
WHEN
The system processes waybill information
THEN
Waybill number is included in the notification message for cargo identification
Context: Equipment details have been included in the notification
GIVEN
Equipment details have been included in the notification
Applied to: Add Cargo Identification
WHEN
The system processes cargo identification data
THEN
US-CCN, cargo description, and quantity information are added to the notification
Context: Cargo identification is being added to the notification
GIVEN
Cargo identification is being added to the notification
Applied to: Format US-CCN
WHEN
The system processes US-CCN information
THEN
US-CCN is formatted according to standard format and included in the message
Context: Cargo identification has been added to the notification
GIVEN
Cargo identification has been added to the notification
Applied to: Include Hold Reason Code
WHEN
The system processes hold reason information
THEN
Hold reason codes and associated explanations are included in the notification message
Context: Hold reason codes have been included in the notification
GIVEN
Hold reason codes have been included in the notification
Applied to: Add Location and Station Data
WHEN
The system processes location data from station tables
THEN
Origin station, destination station, and border information are formatted and added to the message
Context: Location and station data is being added to the notification
GIVEN
Location and station data is being added to the notification
Applied to: Format Origin Station
WHEN
The system processes origin station information
THEN
Origin station name and code are formatted and included in the notification
Context: Origin station has been formatted for the notification
GIVEN
Origin station has been formatted for the notification
Applied to: Format Destination Station
WHEN
The system processes destination station information
THEN
Destination station name and code are formatted and included in the notification
Context: Location and station data has been added to the notification
GIVEN
Location and station data has been added to the notification
Applied to: Format Date and Time Information
WHEN
The system processes date and time information
THEN
Hold date, time, and related temporal information are formatted according to standard format
Context: All message components including date and time have been formatted
GIVEN
All message components including date and time have been formatted
Applied to: Create Comprehensive Hold Message
WHEN
The system combines all elements into a final message
THEN
A comprehensive hold notification message is created with all required information properly structured
Context: All individual message components have been prepared
GIVEN
All individual message components have been prepared
Applied to: Combine All Elements
WHEN
The system combines equipment, cargo, location, and hold information
THEN
All elements are properly integrated into a single comprehensive message structure
Context: All message elements have been combined
GIVEN
All message elements have been combined
Applied to: Apply Message Template
WHEN
The system applies the standard hold notification template
THEN
The message conforms to established format standards and includes all required sections
Context: Message template has been applied to the notification
GIVEN
Message template has been applied to the notification
Applied to: Validate Message Format
WHEN
The system validates the message format and content
THEN
The message is confirmed to meet all format requirements and contains all mandatory information
Context: Hold notification message has been created and validated
GIVEN
Hold notification message has been created and validated
Applied to: Route to Merlin Message System
WHEN
The system routes the message to the Merlin message system
THEN
The message is successfully queued in the Merlin system for distribution
Context: Hold notification has been routed to the Merlin message system
GIVEN
Hold notification has been routed to the Merlin message system
Applied to: Distribute Hold Notification
WHEN
The system processes the message for distribution
THEN
The hold notification is distributed to all appropriate recipients based on routing rules
R-GCX016E-cbl-00788 (+23) File: GCX016E.cbl Status Array Verification Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Verification':
  • Context - a cargo status array verification process is starting:
    For Initialize Status Analysis Variables:
    When the system begins status analysis, then all hold status flags, release status flags, proceed status flags, and information status flags are set to initial values.
  • Context - a cargo has s09a status array entries:
    For Loop Through S09A Status Array Entries:
    When the system processes the status array, then each status entry in the array is examined sequentially until all entries are processed.
  • Context - the system is processing s09a status array entries:
    For More Status Entries?:
    When the current entry position is evaluated, then if more entries exist, continue processing; otherwise proceed to status evaluation.
  • Context - a status entry exists in the s09a array:
    For Analyze Individual Status Entry:
    When the entry is being processed, then the disposition code, quantity, entry number, and other status data are extracted for analysis.
  • Context - a status entry with a disposition code is being analyzed:
    For Status Type?:
    When the disposition code type is evaluated, then the entry is classified as hold, release, proceed, or information type based on the disposition code characteristics.
  • Context - a status entry contains a hold-type disposition code:
    For Process Hold Disposition Code:
    When the hold disposition code is processed, then hold-specific data including location, reason, and quantity are extracted and processed.
  • Context - a status entry contains a release-type disposition code:
    For Process Release Disposition Code:
    When the release disposition code is processed, then release-specific data including quantity, entry number, and release authority are extracted and processed.
  • Context - a status entry contains a proceed-type disposition code:
    For Process Proceed Disposition Code:
    When the proceed disposition code is processed, then proceed-specific data including destination, timing, and conditions are extracted and processed.
  • Context - a status entry contains an information-type disposition code:
    For Process Status Information Code:
    When the information disposition code is processed, then informational data is extracted and recorded without affecting cargo processing status.
  • Context - a hold disposition code has been processed:
    For Update Hold Status Flags:
    When hold status flags are updated, then appropriate hold flags are set including border hold, destination hold, fda hold, or general hold based on the disposition code.
  • Context - a release disposition code has been processed:
    For Update Release Status Flags:
    When release status flags are updated, then appropriate release flags are set including manual release, auto release, or ptt release based on the disposition code.
  • Context - a proceed disposition code has been processed:
    For Update Proceed Status Flags:
    When proceed status flags are updated, then proceed flags are set to indicate cargo can proceed to destination or next processing step.
  • Context - an information disposition code has been processed:
    For Update Information Status Flags:
    When information status flags are updated, then information flags are set to record status details without affecting processing decisions.
  • Context - all status entries have been processed and flags updated:
    For Evaluate Combined Status Conditions:
    When combined status evaluation occurs, then the system evaluates the combination of hold, release, proceed, and information flags to determine final status.
  • Context - status array processing is complete:
    For Has Hold Codes?:
    When hold code presence is evaluated, then if any hold flags are set, the cargo has hold conditions; otherwise proceed to check other status types.
  • Context - hold code evaluation is complete:
    For Has Release Codes?:
    When release code presence is evaluated, then if release flags are set and override hold conditions, set released status; otherwise maintain hold status.
  • Context - release code evaluation is complete and no overriding release found:
    For Has Proceed Codes?:
    When proceed code presence is evaluated, then if proceed flags are set, set proceed status; otherwise set information-only status.
  • Context - hold codes exist and no overriding release codes are present:
    For Set Final Status: HELD:
    When final status is determined, then the cargo status is set to held with appropriate hold reason and location.
  • Context - release codes exist that override any hold conditions:
    For Set Final Status: RELEASED:
    When final status is determined, then the cargo status is set to released with appropriate release quantity and authority.
  • Context - proceed codes exist and no hold or overriding release codes are present:
    For Set Final Status: PROCEED:
    When final status is determined, then the cargo status is set to proceed allowing movement to next processing step.
  • Context - only information codes exist with no hold, release, or proceed codes:
    For Set Final Status: INFORMATION ONLY:
    When final status is determined, then the cargo status is set to information only indicating no action required.
  • Context - final status has been determined:
    For Calculate Release Quantities:
    When release quantity calculation occurs, then all release quantities from disposition codes are summed to determine total released amount.
  • Context - status evaluation and quantity calculations are complete:
    For Determine Final Cargo Status:
    When final cargo status is determined, then the definitive cargo status is established considering all disposition codes, quantities, and business rules.
  • Context - final cargo status has been determined:
    For Update Cargo Status Flags:
    When cargo status flags are updated, then the cargo record is updated with the new status, quantities, and any status-related data.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status array verification process is starting
GIVEN
A cargo status array verification process is starting
Applied to: Initialize Status Analysis Variables
WHEN
The system begins status analysis
THEN
All hold status flags, release status flags, proceed status flags, and information status flags are set to initial values
Context: A cargo has S09A status array entries
GIVEN
A cargo has S09A status array entries
Applied to: Loop Through S09A Status Array Entries
WHEN
The system processes the status array
THEN
Each status entry in the array is examined sequentially until all entries are processed
Context: The system is processing S09A status array entries
GIVEN
The system is processing S09A status array entries
Applied to: More Status Entries?
WHEN
The current entry position is evaluated
THEN
If more entries exist, continue processing; otherwise proceed to status evaluation
Context: A status entry exists in the S09A array
GIVEN
A status entry exists in the S09A array
Applied to: Analyze Individual Status Entry
WHEN
The entry is being processed
THEN
The disposition code, quantity, entry number, and other status data are extracted for analysis
Context: A status entry with a disposition code is being analyzed
GIVEN
A status entry with a disposition code is being analyzed
Applied to: Status Type?
WHEN
The disposition code type is evaluated
THEN
The entry is classified as Hold, Release, Proceed, or Information type based on the disposition code characteristics
Context: A status entry contains a hold-type disposition code
GIVEN
A status entry contains a hold-type disposition code
Applied to: Process Hold Disposition Code
WHEN
The hold disposition code is processed
THEN
Hold-specific data including location, reason, and quantity are extracted and processed
Context: A status entry contains a release-type disposition code
GIVEN
A status entry contains a release-type disposition code
Applied to: Process Release Disposition Code
WHEN
The release disposition code is processed
THEN
Release-specific data including quantity, entry number, and release authority are extracted and processed
Context: A status entry contains a proceed-type disposition code
GIVEN
A status entry contains a proceed-type disposition code
Applied to: Process Proceed Disposition Code
WHEN
The proceed disposition code is processed
THEN
Proceed-specific data including destination, timing, and conditions are extracted and processed
Context: A status entry contains an information-type disposition code
GIVEN
A status entry contains an information-type disposition code
Applied to: Process Status Information Code
WHEN
The information disposition code is processed
THEN
Informational data is extracted and recorded without affecting cargo processing status
Context: A hold disposition code has been processed
GIVEN
A hold disposition code has been processed
Applied to: Update Hold Status Flags
WHEN
Hold status flags are updated
THEN
Appropriate hold flags are set including border hold, destination hold, FDA hold, or general hold based on the disposition code
Context: A release disposition code has been processed
GIVEN
A release disposition code has been processed
Applied to: Update Release Status Flags
WHEN
Release status flags are updated
THEN
Appropriate release flags are set including manual release, auto release, or PTT release based on the disposition code
Context: A proceed disposition code has been processed
GIVEN
A proceed disposition code has been processed
Applied to: Update Proceed Status Flags
WHEN
Proceed status flags are updated
THEN
Proceed flags are set to indicate cargo can proceed to destination or next processing step
Context: An information disposition code has been processed
GIVEN
An information disposition code has been processed
Applied to: Update Information Status Flags
WHEN
Information status flags are updated
THEN
Information flags are set to record status details without affecting processing decisions
Context: All status entries have been processed and flags updated
GIVEN
All status entries have been processed and flags updated
Applied to: Evaluate Combined Status Conditions
WHEN
Combined status evaluation occurs
THEN
The system evaluates the combination of hold, release, proceed, and information flags to determine final status
Context: Status array processing is complete
GIVEN
Status array processing is complete
Applied to: Has Hold Codes?
WHEN
Hold code presence is evaluated
THEN
If any hold flags are set, the cargo has hold conditions; otherwise proceed to check other status types
Context: Hold code evaluation is complete
GIVEN
Hold code evaluation is complete
Applied to: Has Release Codes?
WHEN
Release code presence is evaluated
THEN
If release flags are set and override hold conditions, set released status; otherwise maintain hold status
Context: Release code evaluation is complete and no overriding release found
GIVEN
Release code evaluation is complete and no overriding release found
Applied to: Has Proceed Codes?
WHEN
Proceed code presence is evaluated
THEN
If proceed flags are set, set proceed status; otherwise set information-only status
Context: Hold codes exist and no overriding release codes are present
GIVEN
Hold codes exist and no overriding release codes are present
Applied to: Set Final Status: HELD
WHEN
Final status is determined
THEN
The cargo status is set to HELD with appropriate hold reason and location
Context: Release codes exist that override any hold conditions
GIVEN
Release codes exist that override any hold conditions
Applied to: Set Final Status: RELEASED
WHEN
Final status is determined
THEN
The cargo status is set to RELEASED with appropriate release quantity and authority
Context: Proceed codes exist and no hold or overriding release codes are present
GIVEN
Proceed codes exist and no hold or overriding release codes are present
Applied to: Set Final Status: PROCEED
WHEN
Final status is determined
THEN
The cargo status is set to PROCEED allowing movement to next processing step
Context: Only information codes exist with no hold, release, or proceed codes
GIVEN
Only information codes exist with no hold, release, or proceed codes
Applied to: Set Final Status: INFORMATION ONLY
WHEN
Final status is determined
THEN
The cargo status is set to INFORMATION ONLY indicating no action required
Context: Final status has been determined
GIVEN
Final status has been determined
Applied to: Calculate Release Quantities
WHEN
Release quantity calculation occurs
THEN
All release quantities from disposition codes are summed to determine total released amount
Context: Status evaluation and quantity calculations are complete
GIVEN
Status evaluation and quantity calculations are complete
Applied to: Determine Final Cargo Status
WHEN
Final cargo status is determined
THEN
The definitive cargo status is established considering all disposition codes, quantities, and business rules
Context: Final cargo status has been determined
GIVEN
Final cargo status has been determined
Applied to: Update Cargo Status Flags
WHEN
Cargo status flags are updated
THEN
The cargo record is updated with the new status, quantities, and any status-related data
R-GCX016E-cbl-00812 (+21) File: GCX016E.cbl Individual Status Analysis Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Individual Status Analysis':
  • Context - a cargo status analysis process is starting:
    For Initialize Status Flags:
    When the system begins individual status analysis, then all status flags (hold, release, proceed, status info, manual release) are set to false or initial values.
  • Context - a cargo status array contains multiple disposition code entries:
    For Get Next Status Array Entry:
    When the system processes status entries sequentially, then the next unprocessed status array entry is retrieved for evaluation.
  • Context - a cargo status array is being processed sequentially:
    For More Entries?:
    When the system checks for remaining entries after processing current entry, then if more entries exist, continue processing; otherwise proceed to final status determination.
  • Context - a status array entry contains a disposition code:
    For Analyze Disposition Code:
    When the system analyzes the disposition code, then the disposition code is categorized as hold, release, proceed, or status info type.
  • Context - a disposition code has been analyzed and categorized:
    For Code Type?:
    When the system determines the code type (hold, release, proceed, or status info), then the appropriate processing path is selected based on the code type.
  • Context - a disposition code is categorized as a hold type:
    For Set Hold Flag:
    When the system processes the hold disposition code, then the hold status flag is set to true for subsequent hold condition evaluation.
  • Context - a disposition code is categorized as a release type:
    For Set Release Flag:
    When the system processes the release disposition code, then the release status flag is set to true for subsequent release condition evaluation.
  • Context - a disposition code is categorized as a proceed type:
    For Set Proceed Flag:
    When the system processes the proceed disposition code, then the proceed status flag is set to true for subsequent proceed condition evaluation.
  • Context - a disposition code is categorized as status info type:
    For Set Status Info Flag:
    When the system processes the informational disposition code, then the status info flag is set and processing continues to next entry without further evaluation.
  • Context - a hold status flag has been set from disposition code analysis:
    For Evaluate Hold Conditions:
    When the system evaluates hold-specific business conditions (location, quantity, regulatory requirements), then hold conditions are assessed to determine if cargo hold business flag should be activated.
  • Context - hold conditions have been evaluated for a cargo:
    For Hold Status Found?:
    When the system checks if hold status should be applied, then if hold conditions are met, set cargo hold business flag; otherwise proceed to release evaluation.
  • Context - hold conditions have been evaluated and determined to be applicable:
    For Set Cargo Hold Business Flag:
    When the system confirms hold status should be applied to cargo, then the cargo hold business flag is set to indicate cargo is in hold status.
  • Context - a release status flag has been set or hold evaluation is complete:
    For Evaluate Release Conditions:
    When the system evaluates release-specific business conditions (quantity validation, regulatory clearance), then release conditions are assessed to determine if cargo release business flag should be activated.
  • Context - release conditions have been evaluated for a cargo:
    For Release Status Found?:
    When the system checks if release status should be applied, then if release conditions are met, set cargo release business flag; otherwise proceed to proceed evaluation.
  • Context - release conditions have been evaluated and determined to be applicable:
    For Set Cargo Release Business Flag:
    When the system confirms release status should be applied to cargo, then the cargo release business flag is set to indicate cargo is released.
  • Context - a proceed status flag has been set or release evaluation is complete:
    For Evaluate Proceed Conditions:
    When the system evaluates proceed-specific business conditions (in-bond requirements, entry type validation), then proceed conditions are assessed to determine if in-bond proceed business flag should be activated.
  • Context - proceed conditions have been evaluated for a cargo:
    For Proceed Status Found?:
    When the system checks if proceed status should be applied, then if proceed conditions are met, set in-bond proceed business flag; otherwise proceed to manual release evaluation.
  • Context - proceed conditions have been evaluated and determined to be applicable:
    For Set In-Bond Proceed Business Flag:
    When the system confirms proceed status should be applied to cargo, then the in-bond proceed business flag is set to indicate cargo can proceed in-bond.
  • Context - proceed evaluation is complete or proceed status flag has been set:
    For Evaluate Manual Release:
    When the system checks for manual release disposition codes in the status array, then manual release conditions are evaluated to determine if manual release business flag should be set.
  • Context - manual release conditions have been evaluated for a cargo:
    For Manual Release Found?:
    When the system checks if manual release status should be applied, then if manual release conditions are met, set manual release business flag; otherwise continue to next entry.
  • Context - manual release conditions have been evaluated and determined to be applicable:
    For Set Manual Release Business Flag:
    When the system confirms manual release status should be applied to cargo, then the manual release business flag is set to indicate cargo has been manually released.
  • Context - all status array entries have been processed and individual flags have been set:
    For Set Final Status Flags:
    When the system completes individual status analysis, then final cargo status flags are determined based on the combination of hold, release, proceed, and manual release flags.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status analysis process is starting
GIVEN
A cargo status analysis process is starting
Applied to: Initialize Status Flags
WHEN
The system begins individual status analysis
THEN
All status flags (hold, release, proceed, status info, manual release) are set to false or initial values
Context: A cargo status array contains multiple disposition code entries
GIVEN
A cargo status array contains multiple disposition code entries
Applied to: Get Next Status Array Entry
WHEN
The system processes status entries sequentially
THEN
The next unprocessed status array entry is retrieved for evaluation
Context: A cargo status array is being processed sequentially
GIVEN
A cargo status array is being processed sequentially
Applied to: More Entries?
WHEN
The system checks for remaining entries after processing current entry
THEN
If more entries exist, continue processing; otherwise proceed to final status determination
Context: A status array entry contains a disposition code
GIVEN
A status array entry contains a disposition code
Applied to: Analyze Disposition Code
WHEN
The system analyzes the disposition code
THEN
The disposition code is categorized as Hold, Release, Proceed, or Status Info type
Context: A disposition code has been analyzed and categorized
GIVEN
A disposition code has been analyzed and categorized
Applied to: Code Type?
WHEN
The system determines the code type (Hold, Release, Proceed, or Status Info)
THEN
The appropriate processing path is selected based on the code type
Context: A disposition code is categorized as a Hold type
GIVEN
A disposition code is categorized as a Hold type
Applied to: Set Hold Flag
WHEN
The system processes the hold disposition code
THEN
The hold status flag is set to true for subsequent hold condition evaluation
Context: A disposition code is categorized as a Release type
GIVEN
A disposition code is categorized as a Release type
Applied to: Set Release Flag
WHEN
The system processes the release disposition code
THEN
The release status flag is set to true for subsequent release condition evaluation
Context: A disposition code is categorized as a Proceed type
GIVEN
A disposition code is categorized as a Proceed type
Applied to: Set Proceed Flag
WHEN
The system processes the proceed disposition code
THEN
The proceed status flag is set to true for subsequent proceed condition evaluation
Context: A disposition code is categorized as Status Info type
GIVEN
A disposition code is categorized as Status Info type
Applied to: Set Status Info Flag
WHEN
The system processes the informational disposition code
THEN
The status info flag is set and processing continues to next entry without further evaluation
Context: A hold status flag has been set from disposition code analysis
GIVEN
A hold status flag has been set from disposition code analysis
Applied to: Evaluate Hold Conditions
WHEN
The system evaluates hold-specific business conditions (location, quantity, regulatory requirements)
THEN
Hold conditions are assessed to determine if cargo hold business flag should be activated
Context: Hold conditions have been evaluated for a cargo
GIVEN
Hold conditions have been evaluated for a cargo
Applied to: Hold Status Found?
WHEN
The system checks if hold status should be applied
THEN
If hold conditions are met, set cargo hold business flag; otherwise proceed to release evaluation
Context: Hold conditions have been evaluated and determined to be applicable
GIVEN
Hold conditions have been evaluated and determined to be applicable
Applied to: Set Cargo Hold Business Flag
WHEN
The system confirms hold status should be applied to cargo
THEN
The cargo hold business flag is set to indicate cargo is in hold status
Context: A release status flag has been set or hold evaluation is complete
GIVEN
A release status flag has been set or hold evaluation is complete
Applied to: Evaluate Release Conditions
WHEN
The system evaluates release-specific business conditions (quantity validation, regulatory clearance)
THEN
Release conditions are assessed to determine if cargo release business flag should be activated
Context: Release conditions have been evaluated for a cargo
GIVEN
Release conditions have been evaluated for a cargo
Applied to: Release Status Found?
WHEN
The system checks if release status should be applied
THEN
If release conditions are met, set cargo release business flag; otherwise proceed to proceed evaluation
Context: Release conditions have been evaluated and determined to be applicable
GIVEN
Release conditions have been evaluated and determined to be applicable
Applied to: Set Cargo Release Business Flag
WHEN
The system confirms release status should be applied to cargo
THEN
The cargo release business flag is set to indicate cargo is released
Context: A proceed status flag has been set or release evaluation is complete
GIVEN
A proceed status flag has been set or release evaluation is complete
Applied to: Evaluate Proceed Conditions
WHEN
The system evaluates proceed-specific business conditions (in-bond requirements, entry type validation)
THEN
Proceed conditions are assessed to determine if in-bond proceed business flag should be activated
Context: Proceed conditions have been evaluated for a cargo
GIVEN
Proceed conditions have been evaluated for a cargo
Applied to: Proceed Status Found?
WHEN
The system checks if proceed status should be applied
THEN
If proceed conditions are met, set in-bond proceed business flag; otherwise proceed to manual release evaluation
Context: Proceed conditions have been evaluated and determined to be applicable
GIVEN
Proceed conditions have been evaluated and determined to be applicable
Applied to: Set In-Bond Proceed Business Flag
WHEN
The system confirms proceed status should be applied to cargo
THEN
The in-bond proceed business flag is set to indicate cargo can proceed in-bond
Context: Proceed evaluation is complete or proceed status flag has been set
GIVEN
Proceed evaluation is complete or proceed status flag has been set
Applied to: Evaluate Manual Release
WHEN
The system checks for manual release disposition codes in the status array
THEN
Manual release conditions are evaluated to determine if manual release business flag should be set
Context: Manual release conditions have been evaluated for a cargo
GIVEN
Manual release conditions have been evaluated for a cargo
Applied to: Manual Release Found?
WHEN
The system checks if manual release status should be applied
THEN
If manual release conditions are met, set manual release business flag; otherwise continue to next entry
Context: Manual release conditions have been evaluated and determined to be applicable
GIVEN
Manual release conditions have been evaluated and determined to be applicable
Applied to: Set Manual Release Business Flag
WHEN
The system confirms manual release status should be applied to cargo
THEN
The manual release business flag is set to indicate cargo has been manually released
Context: All status array entries have been processed and individual flags have been set
GIVEN
All status array entries have been processed and individual flags have been set
Applied to: Set Final Status Flags
WHEN
The system completes individual status analysis
THEN
Final cargo status flags are determined based on the combination of hold, release, proceed, and manual release flags
R-GCX016E-cbl-00834 (+19) File: GCX016E.cbl Complex Cargo Status Evaluation Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Complex Cargo Status Evaluation':
  • Context - a cargo has s09a status arrays containing disposition codes with associated flags and quantities:
    For Analyze Complete S09A Status Arrays:
    When the system processes the status arrays to evaluate cargo conditions, then the system identifies hold status types, release conditions, proceed dispositions, arrival/export flags, and manual processing indicators for subsequent status determination.
  • Context - a cargo has disposition codes in its status array:
    For Border Hold Status:
    When the system finds disposition codes that indicate border hold conditions, then the system sets the border hold flag to indicate cargo is held at border location.
    For Destination Hold Status:
    When the system finds disposition codes that indicate destination hold conditions, then the system sets the destination hold flag to indicate cargo is held at destination location.
    For FDA Hold Status:
    When the system finds disposition codes that indicate fda hold requirements, then the system sets the fda hold flag to indicate cargo requires fda clearance.
  • Context - a cargo has disposition codes with associated release quantities in its status array:
    For Piece Count Hold Status:
    When the system compares released quantities against total cargo quantities, then the system sets piece count hold flag if cargo has partial releases or quantity discrepancies.
  • Context - a cargo has disposition codes in its status array with manual processing indicators:
    For Manual Release Processing:
    When the system finds manual release disposition codes or manual processing flags, then the system prioritizes manual release status and sets appropriate processing flags for manual intervention.
  • Context - a cargo has disposition codes in its status array with automatic processing indicators:
    For Automatic Release Processing:
    When the system finds automatic release disposition codes without hold conditions, then the system sets automatic release processing flags and prepares cargo for automated release workflow.
  • Context - a cargo has proceed disposition codes in its status array:
    For Proceed Disposition Processing:
    When the system processes proceed dispositions with associated location and timing information, then the system sets proceed status flags and updates cargo movement authorization while maintaining compliance tracking.
  • Context - a cargo has arrival disposition codes in its status array with location and date information:
    For Arrival Status Management:
    When the system processes arrival events and validates arrival conditions, then the system updates arrival status flags, records arrival location and date, and triggers arrival-related processing workflows.
  • Context - a cargo has export disposition codes in its status array with export requirements:
    For Export Status Management:
    When the system processes export events and validates export conditions, then the system updates export status flags, clears destination requirements, and ensures export compliance processing.
  • Context - a cargo is associated with canadian manifests and has cross-border movement requirements:
    For Canadian Manifest Processing:
    When the system processes canadian manifest disposition codes and cross-border conditions, then the system applies canadian regulatory requirements, updates cross-border tracking, and ensures compliance with bilateral trade agreements.
  • Context - a cargo has both hold and release disposition codes in its status array:
    For Hold vs Release Priority:
    When the system evaluates conflicting disposition codes with different priorities and timestamps, then the system applies business priority rules where holds generally override releases unless specific release conditions supersede hold requirements.
  • Context - a cargo has both proceed and hold disposition codes in its status array:
    For Proceed vs Hold Priority:
    When the system evaluates conflicting disposition codes with different business priorities, then the system applies priority rules where active holds override proceed dispositions unless proceed has regulatory precedence or proper release authorization.
  • Context - a cargo has informational disposition codes in its status array:
    For Status Information Codes:
    When the system processes status information codes that do not affect cargo movement, then the system records informational status updates for tracking and reporting purposes without altering cargo processing workflow or hold/release states.
  • Context - a cargo has multiple hold conditions identified from disposition code analysis:
    For Set Final Hold Status:
    When the system applies hold priority rules considering fda holds, border holds, destination holds, and piece count holds, then the system sets the highest priority hold status (fda > border > destination > piece count) and updates cargo status accordingly.
  • Context - a cargo has release disposition codes and no overriding hold conditions:
    For Set Final Release Status:
    When the system validates release quantities match cargo quantities and all release requirements are satisfied, then the system sets released status, updates release quantities, and enables cargo for movement processing.
  • Context - a cargo has proceed disposition codes and meets movement authorization requirements:
    For Set Final Proceed Status:
    When the system validates proceed conditions and ensures no conflicting holds prevent movement, then the system sets proceed status, authorizes cargo movement, and maintains compliance tracking for in-transit cargo.
  • Context - a cargo has arrival disposition codes with validated destination and arrival date information:
    For Set Final Arrival Status:
    When the system confirms cargo arrival at destination location and completes arrival validation, then the system sets arrival status, records final arrival date and location, and triggers destination processing workflows.
  • Context - a cargo has export disposition codes and meets all export regulatory requirements:
    For Set Final Export Status:
    When the system validates export documentation and compliance with international trade regulations, then the system sets export status, clears domestic processing requirements, and enables international shipment processing.
  • Context - the system has determined final cargo status through disposition code evaluation:
    For Update Cargo Status Flags:
    When the system updates cargo records with new status flags and processing indicators, then the system commits status changes to cargo database, updates status timestamps, and triggers downstream processing notifications.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo has S09A status arrays containing disposition codes with associated flags and quantities
GIVEN
A cargo has S09A status arrays containing disposition codes with associated flags and quantities
Applied to: Analyze Complete S09A Status Arrays
WHEN
The system processes the status arrays to evaluate cargo conditions
THEN
The system identifies hold status types, release conditions, proceed dispositions, arrival/export flags, and manual processing indicators for subsequent status determination
Context: A cargo has disposition codes in its status array
GIVEN
A cargo has disposition codes in its status array
Applied to: Border Hold Status
WHEN
The system finds disposition codes that indicate border hold conditions
THEN
The system sets the border hold flag to indicate cargo is held at border location
Applied to: Destination Hold Status
WHEN
The system finds disposition codes that indicate destination hold conditions
THEN
The system sets the destination hold flag to indicate cargo is held at destination location
Applied to: FDA Hold Status
WHEN
The system finds disposition codes that indicate FDA hold requirements
THEN
The system sets the FDA hold flag to indicate cargo requires FDA clearance
Context: A cargo has disposition codes with associated release quantities in its status array
GIVEN
A cargo has disposition codes with associated release quantities in its status array
Applied to: Piece Count Hold Status
WHEN
The system compares released quantities against total cargo quantities
THEN
The system sets piece count hold flag if cargo has partial releases or quantity discrepancies
Context: A cargo has disposition codes in its status array with manual processing indicators
GIVEN
A cargo has disposition codes in its status array with manual processing indicators
Applied to: Manual Release Processing
WHEN
The system finds manual release disposition codes or manual processing flags
THEN
The system prioritizes manual release status and sets appropriate processing flags for manual intervention
Context: A cargo has disposition codes in its status array with automatic processing indicators
GIVEN
A cargo has disposition codes in its status array with automatic processing indicators
Applied to: Automatic Release Processing
WHEN
The system finds automatic release disposition codes without hold conditions
THEN
The system sets automatic release processing flags and prepares cargo for automated release workflow
Context: A cargo has proceed disposition codes in its status array
GIVEN
A cargo has proceed disposition codes in its status array
Applied to: Proceed Disposition Processing
WHEN
The system processes proceed dispositions with associated location and timing information
THEN
The system sets proceed status flags and updates cargo movement authorization while maintaining compliance tracking
Context: A cargo has arrival disposition codes in its status array with location and date information
GIVEN
A cargo has arrival disposition codes in its status array with location and date information
Applied to: Arrival Status Management
WHEN
The system processes arrival events and validates arrival conditions
THEN
The system updates arrival status flags, records arrival location and date, and triggers arrival-related processing workflows
Context: A cargo has export disposition codes in its status array with export requirements
GIVEN
A cargo has export disposition codes in its status array with export requirements
Applied to: Export Status Management
WHEN
The system processes export events and validates export conditions
THEN
The system updates export status flags, clears destination requirements, and ensures export compliance processing
Context: A cargo is associated with Canadian manifests and has cross-border movement requirements
GIVEN
A cargo is associated with Canadian manifests and has cross-border movement requirements
Applied to: Canadian Manifest Processing
WHEN
The system processes Canadian manifest disposition codes and cross-border conditions
THEN
The system applies Canadian regulatory requirements, updates cross-border tracking, and ensures compliance with bilateral trade agreements
Context: A cargo has both hold and release disposition codes in its status array
GIVEN
A cargo has both hold and release disposition codes in its status array
Applied to: Hold vs Release Priority
WHEN
The system evaluates conflicting disposition codes with different priorities and timestamps
THEN
The system applies business priority rules where holds generally override releases unless specific release conditions supersede hold requirements
Context: A cargo has both proceed and hold disposition codes in its status array
GIVEN
A cargo has both proceed and hold disposition codes in its status array
Applied to: Proceed vs Hold Priority
WHEN
The system evaluates conflicting disposition codes with different business priorities
THEN
The system applies priority rules where active holds override proceed dispositions unless proceed has regulatory precedence or proper release authorization
Context: A cargo has informational disposition codes in its status array
GIVEN
A cargo has informational disposition codes in its status array
Applied to: Status Information Codes
WHEN
The system processes status information codes that do not affect cargo movement
THEN
The system records informational status updates for tracking and reporting purposes without altering cargo processing workflow or hold/release states
Context: A cargo has multiple hold conditions identified from disposition code analysis
GIVEN
A cargo has multiple hold conditions identified from disposition code analysis
Applied to: Set Final Hold Status
WHEN
The system applies hold priority rules considering FDA holds, border holds, destination holds, and piece count holds
THEN
The system sets the highest priority hold status (FDA > Border > Destination > Piece Count) and updates cargo status accordingly
Context: A cargo has release disposition codes and no overriding hold conditions
GIVEN
A cargo has release disposition codes and no overriding hold conditions
Applied to: Set Final Release Status
WHEN
The system validates release quantities match cargo quantities and all release requirements are satisfied
THEN
The system sets released status, updates release quantities, and enables cargo for movement processing
Context: A cargo has proceed disposition codes and meets movement authorization requirements
GIVEN
A cargo has proceed disposition codes and meets movement authorization requirements
Applied to: Set Final Proceed Status
WHEN
The system validates proceed conditions and ensures no conflicting holds prevent movement
THEN
The system sets proceed status, authorizes cargo movement, and maintains compliance tracking for in-transit cargo
Context: A cargo has arrival disposition codes with validated destination and arrival date information
GIVEN
A cargo has arrival disposition codes with validated destination and arrival date information
Applied to: Set Final Arrival Status
WHEN
The system confirms cargo arrival at destination location and completes arrival validation
THEN
The system sets arrival status, records final arrival date and location, and triggers destination processing workflows
Context: A cargo has export disposition codes and meets all export regulatory requirements
GIVEN
A cargo has export disposition codes and meets all export regulatory requirements
Applied to: Set Final Export Status
WHEN
The system validates export documentation and compliance with international trade regulations
THEN
The system sets export status, clears domestic processing requirements, and enables international shipment processing
Context: The system has determined final cargo status through disposition code evaluation
GIVEN
The system has determined final cargo status through disposition code evaluation
Applied to: Update Cargo Status Flags
WHEN
The system updates cargo records with new status flags and processing indicators
THEN
The system commits status changes to cargo database, updates status timestamps, and triggers downstream processing notifications
R-GCX016E-cbl-00854 (+10) File: GCX016E.cbl Canadian Manifest Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Manifest Processing':
  • Context - a us cargo record exists with equipment information:
    For Extract Equipment ID from US Cargo:
    When canadian manifest processing is initiated, then equipment id is extracted and formatted for canadian cargo database search.
  • Context - equipment id has been extracted from us cargo:
    For Search Canadian Cargo Database:
    When canadian cargo database search is performed, then system searches gccc-cargo-root database for matching canadian cargo records by equipment id.
  • Context - canadian cargo database search has been performed:
    For Canadian Cargo Found?:
    When search results are evaluated, then system determines if canadian cargo record exists and routes processing accordingly.
    For No Canadian Match Found:
    When no matching canadian cargo is found, then system processes the no match condition and continues with standard processing.
  • Context - canadian cargo record has been found:
    For Validate Canadian Cargo Status:
    When cargo status is evaluated, then system reads and validates the canadian cargo status from gccc database.
  • Context - canadian cargo status has been retrieved:
    For Status Valid?:
    When status validity is checked, then system excludes cargos with deleted status or new bond created status and allows valid statuses to proceed.
  • Context - canadian cargo has valid status for processing:
    For Create Cross-Border Audit Trail:
    When cross-border audit trail creation is initiated, then system creates audit record linking us and canadian manifest information.
  • Context - valid canadian cargo has been found and audit trail created:
    For Match Equipment IDs Between Systems:
    When equipment id matching is performed, then system matches car id number index between us and canadian cargo records.
  • Context - equipment ids have been successfully matched between systems:
    For Update Cargo Processing Status:
    When status update is performed, then system updates cargo processing status to indicate canadian manifest match completion.
  • Context - canadian manifest matching has been completed successfully:
    For Log Canadian Manifest Match:
    When logging is performed, then system logs the successful canadian manifest match with relevant details.
  • Context - either no canadian cargo was found or canadian cargo has invalid status:
    For Log No Match Status:
    When no match logging is performed, then system logs the no match status with appropriate reason code.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo record exists with equipment information
GIVEN
A US cargo record exists with equipment information
Applied to: Extract Equipment ID from US Cargo
WHEN
Canadian manifest processing is initiated
THEN
Equipment ID is extracted and formatted for Canadian cargo database search
Context: Equipment ID has been extracted from US cargo
GIVEN
Equipment ID has been extracted from US cargo
Applied to: Search Canadian Cargo Database
WHEN
Canadian cargo database search is performed
THEN
System searches GCCC-CARGO-ROOT database for matching Canadian cargo records by equipment ID
Context: Canadian cargo database search has been performed
GIVEN
Canadian cargo database search has been performed
Applied to: Canadian Cargo Found?
WHEN
Search results are evaluated
THEN
System determines if Canadian cargo record exists and routes processing accordingly
Applied to: No Canadian Match Found
WHEN
No matching Canadian cargo is found
THEN
System processes the no match condition and continues with standard processing
Context: Canadian cargo record has been found
GIVEN
Canadian cargo record has been found
Applied to: Validate Canadian Cargo Status
WHEN
Cargo status is evaluated
THEN
System reads and validates the Canadian cargo status from GCCC database
Context: Canadian cargo status has been retrieved
GIVEN
Canadian cargo status has been retrieved
Applied to: Status Valid?
WHEN
Status validity is checked
THEN
System excludes cargos with deleted status or new bond created status and allows valid statuses to proceed
Context: Canadian cargo has valid status for processing
GIVEN
Canadian cargo has valid status for processing
Applied to: Create Cross-Border Audit Trail
WHEN
Cross-border audit trail creation is initiated
THEN
System creates audit record linking US and Canadian manifest information
Context: Valid Canadian cargo has been found and audit trail created
GIVEN
Valid Canadian cargo has been found and audit trail created
Applied to: Match Equipment IDs Between Systems
WHEN
Equipment ID matching is performed
THEN
System matches car ID number index between US and Canadian cargo records
Context: Equipment IDs have been successfully matched between systems
GIVEN
Equipment IDs have been successfully matched between systems
Applied to: Update Cargo Processing Status
WHEN
Status update is performed
THEN
System updates cargo processing status to indicate Canadian manifest match completion
Context: Canadian manifest matching has been completed successfully
GIVEN
Canadian manifest matching has been completed successfully
Applied to: Log Canadian Manifest Match
WHEN
Logging is performed
THEN
System logs the successful Canadian manifest match with relevant details
Context: Either no Canadian cargo was found or Canadian cargo has invalid status
GIVEN
Either no Canadian cargo was found or Canadian cargo has invalid status
Applied to: Log No Match Status
WHEN
No match logging is performed
THEN
System logs the no match status with appropriate reason code
R-GCX016E-cbl-00865 (+19) File: GCX016E.cbl Cargo Status Preservation and Restoration Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Preservation and Restoration':
  • Context - a cargo record exists with current status information:
    For Save Current Cargo Status:
    When the system initiates cargo status processing, then the current cargo status is saved to a backup location for potential restoration.
    For Save Current Cargo Status:
    When the system begins cargo status processing, then the current cargo status is saved to backup storage for potential restoration.
  • Context - cargo status information exists in the system:
    For Store Previous Status Information:
    When status preservation process is executed, then previous status information including codes, quantities, and dates is stored in designated storage areas.
  • Context - cargo status is being modified:
    For Create Audit Trail Entry:
    When an audit trail entry is required, then a complete audit record is created with timestamp, user information, and status change details.
  • Context - cargo status updates are pending:
    For Process Status Updates:
    When status processing is initiated, then all status updates are processed according to disposition code rules and status hierarchy.
  • Context - cargo status updates have been processed:
    For Update Successful?:
    When the system evaluates update completion, then the system determines if updates were successful based on validation criteria and error conditions.
  • Context - cargo status updates have been validated as successful:
    For Commit New Status:
    When the commit process is executed, then the new cargo status is permanently saved and becomes the current active status.
  • Context - cargo status updates have failed validation:
    For Restore Previous Status:
    When status restoration is required, then the cargo status is restored to its previous state using saved backup information.
  • Context - a cargo status restoration has occurred:
    For Log Restoration Action:
    When logging is performed, then the restoration action is logged with details about the reason and previous status information.
  • Context - cargo status has been successfully updated:
    For Enable Status Comparison:
    When status comparison is requested, then the system provides capability to compare current status with previous status information.
  • Context - cargo status preservation process is active:
    For Maintain Data Integrity:
    When data integrity checks are performed, then all cargo data remains consistent and valid throughout the preservation process.
  • Context - current cargo status has been backed up:
    For Store Previous Status Information:
    When the system prepares for status updates, then previous status information including dates and codes is stored in audit storage.
  • Context - cargo status updates have been attempted:
    For Status Update Successful?:
    When the system evaluates the update results, then the system determines if updates were successful based on completion codes and data validation.
  • Context - cargo status updates completed successfully:
    For Maintain Updated Status:
    When the system confirms successful update validation, then the updated cargo status is maintained and processing continues normally.
  • Context - cargo status updates are in progress:
    For Error Detected During Update:
    When an error or failure occurs during the update process, then the system detects the error condition and initiates error handling procedures.
  • Context - an error has been detected during cargo status updates and previous status backup exists:
    For Restore Previous Cargo Status:
    When the system initiates error recovery procedures, then the cargo status is restored to its previous state from backup storage.
  • Context - previous cargo status has been restored from backup:
    For Rollback Status Changes:
    When the system performs rollback operations, then all status changes made during the failed update are reversed and data consistency is maintained.
  • Context - status rollback operations have been completed:
    For Log Status Restoration Event:
    When the system finalizes the restoration process, then a status restoration event is logged with timestamp, cargo identifier, and restoration details.
  • Context - status processing has completed either successfully or through error recovery:
    For Maintain Data Integrity:
    When the system validates final data state, then data integrity is confirmed and cargo information remains consistent across all related records.
  • Context - status restoration has been completed due to update errors:
    For Generate Error Notification:
    When the system generates error notifications, then error notifications are created with cargo details, error description, and recovery actions taken.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with current status information
GIVEN
A cargo record exists with current status information
Applied to: Save Current Cargo Status
WHEN
The system initiates cargo status processing
THEN
The current cargo status is saved to a backup location for potential restoration
Applied to: Save Current Cargo Status
WHEN
The system begins cargo status processing
THEN
The current cargo status is saved to backup storage for potential restoration
Context: Cargo status information exists in the system
GIVEN
Cargo status information exists in the system
Applied to: Store Previous Status Information
WHEN
Status preservation process is executed
THEN
Previous status information including codes, quantities, and dates is stored in designated storage areas
Context: Cargo status is being modified
GIVEN
Cargo status is being modified
Applied to: Create Audit Trail Entry
WHEN
An audit trail entry is required
THEN
A complete audit record is created with timestamp, user information, and status change details
Context: Cargo status updates are pending
GIVEN
Cargo status updates are pending
Applied to: Process Status Updates
WHEN
Status processing is initiated
THEN
All status updates are processed according to disposition code rules and status hierarchy
Context: Cargo status updates have been processed
GIVEN
Cargo status updates have been processed
Applied to: Update Successful?
WHEN
The system evaluates update completion
THEN
The system determines if updates were successful based on validation criteria and error conditions
Context: Cargo status updates have been validated as successful
GIVEN
Cargo status updates have been validated as successful
Applied to: Commit New Status
WHEN
The commit process is executed
THEN
The new cargo status is permanently saved and becomes the current active status
Context: Cargo status updates have failed validation
GIVEN
Cargo status updates have failed validation
Applied to: Restore Previous Status
WHEN
Status restoration is required
THEN
The cargo status is restored to its previous state using saved backup information
Context: A cargo status restoration has occurred
GIVEN
A cargo status restoration has occurred
Applied to: Log Restoration Action
WHEN
Logging is performed
THEN
The restoration action is logged with details about the reason and previous status information
Context: Cargo status has been successfully updated
GIVEN
Cargo status has been successfully updated
Applied to: Enable Status Comparison
WHEN
Status comparison is requested
THEN
The system provides capability to compare current status with previous status information
Context: Cargo status preservation process is active
GIVEN
Cargo status preservation process is active
Applied to: Maintain Data Integrity
WHEN
Data integrity checks are performed
THEN
All cargo data remains consistent and valid throughout the preservation process
Context: Current cargo status has been backed up
GIVEN
Current cargo status has been backed up
Applied to: Store Previous Status Information
WHEN
The system prepares for status updates
THEN
Previous status information including dates and codes is stored in audit storage
Context: Cargo status updates have been attempted
GIVEN
Cargo status updates have been attempted
Applied to: Status Update Successful?
WHEN
The system evaluates the update results
THEN
The system determines if updates were successful based on completion codes and data validation
Context: Cargo status updates completed successfully
GIVEN
Cargo status updates completed successfully
Applied to: Maintain Updated Status
WHEN
The system confirms successful update validation
THEN
The updated cargo status is maintained and processing continues normally
Context: Cargo status updates are in progress
GIVEN
Cargo status updates are in progress
Applied to: Error Detected During Update
WHEN
An error or failure occurs during the update process
THEN
The system detects the error condition and initiates error handling procedures
Context: An error has been detected during cargo status updates and previous status backup exists
GIVEN
An error has been detected during cargo status updates and previous status backup exists
Applied to: Restore Previous Cargo Status
WHEN
The system initiates error recovery procedures
THEN
The cargo status is restored to its previous state from backup storage
Context: Previous cargo status has been restored from backup
GIVEN
Previous cargo status has been restored from backup
Applied to: Rollback Status Changes
WHEN
The system performs rollback operations
THEN
All status changes made during the failed update are reversed and data consistency is maintained
Context: Status rollback operations have been completed
GIVEN
Status rollback operations have been completed
Applied to: Log Status Restoration Event
WHEN
The system finalizes the restoration process
THEN
A status restoration event is logged with timestamp, cargo identifier, and restoration details
Context: Status processing has completed either successfully or through error recovery
GIVEN
Status processing has completed either successfully or through error recovery
Applied to: Maintain Data Integrity
WHEN
The system validates final data state
THEN
Data integrity is confirmed and cargo information remains consistent across all related records
Context: Status restoration has been completed due to update errors
GIVEN
Status restoration has been completed due to update errors
Applied to: Generate Error Notification
WHEN
The system generates error notifications
THEN
Error notifications are created with cargo details, error description, and recovery actions taken
R-GCX016E-cbl-00875 (+14) File: GCX016E.cbl Cancel Release Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cancel Release Processing':
  • Context - a cargo disposition code indicates release cancellation:
    For Cancel Release Processing Triggered:
    When the system processes the cancellation disposition code, then cancel release processing workflow is initiated.
  • Context - a cargo record exists with status information in s09a arrays:
    For Analyze Current Cargo Status:
    When cancel release processing begins, then the system reads and analyzes current cargo status from status arrays.
  • Context - current cargo status is available and previous status exists in audit records:
    For Compare Previous Release Status:
    When status comparison is performed, then the system identifies differences between current and previous release status.
  • Context - cargo status history is available for comparison:
    For Was Cargo Previously Released?:
    When the system checks previous release status, then if cargo was previously released, proceed with cancellation processing, otherwise skip processing.
  • Context - cargo was previously in released status:
    For Detect Release Cancellation:
    When current status indicates release cancellation, then the system detects and confirms release cancellation event.
  • Context - release cancellation has been detected:
    For Preserve Previous Status for Audit:
    When processing the cancellation event, then the system preserves previous status information in audit records.
  • Context - release cancellation has been confirmed and previous status preserved:
    For Generate Cancel Release Notification:
    When notification generation is triggered, then the system creates a cancel release notification message.
  • Context - cancel release notification needs to be generated:
    For Format Notification Message:
    When message formatting process begins, then the system formats notification message with proper structure and headers.
  • Context - notification message is being formatted:
    For Include Cargo Details in Message:
    When cargo details are added to the message, then the system includes cargo ccn, car id, waybill number, and quantity information in the notification.
  • Context - notification message contains cargo details:
    For Add Disposition Code Information:
    When disposition code information is added, then the system includes disposition code, entry number, and related processing information in the message.
  • Context - cancel release notification message is formatted with cargo and disposition details:
    For Set Notification Type as UNRLSE:
    When message type classification is performed, then the system sets notification type as unrlse for cancel release processing.
  • Context - cancel release notification is formatted and classified as unrlse type:
    For Route to Merlin Message Distribution:
    When message routing is initiated, then the system routes notification to merlin message distribution system.
  • Context - cancel release notification is routed through merlin distribution:
    For Send to Business Recipients:
    When recipient delivery is processed, then the system sends notification to om01247 and sd segment cancel merlin ids.
  • Context - cancel release notification has been sent to business recipients:
    For Log Cancel Release Action:
    When action logging is performed, then the system logs cancel release action with timestamp and recipient information.
  • Context - cancel release processing is complete and action is logged:
    For Update Cargo Status Arrays:
    When status array update is performed, then the system updates s09a status arrays to reflect cancel release status and removes previous release indicators.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo disposition code indicates release cancellation
GIVEN
A cargo disposition code indicates release cancellation
Applied to: Cancel Release Processing Triggered
WHEN
The system processes the cancellation disposition code
THEN
Cancel release processing workflow is initiated
Context: A cargo record exists with status information in S09A arrays
GIVEN
A cargo record exists with status information in S09A arrays
Applied to: Analyze Current Cargo Status
WHEN
Cancel release processing begins
THEN
The system reads and analyzes current cargo status from status arrays
Context: Current cargo status is available and previous status exists in audit records
GIVEN
Current cargo status is available and previous status exists in audit records
Applied to: Compare Previous Release Status
WHEN
Status comparison is performed
THEN
The system identifies differences between current and previous release status
Context: Cargo status history is available for comparison
GIVEN
Cargo status history is available for comparison
Applied to: Was Cargo Previously Released?
WHEN
The system checks previous release status
THEN
If cargo was previously released, proceed with cancellation processing, otherwise skip processing
Context: Cargo was previously in released status
GIVEN
Cargo was previously in released status
Applied to: Detect Release Cancellation
WHEN
Current status indicates release cancellation
THEN
The system detects and confirms release cancellation event
Context: Release cancellation has been detected
GIVEN
Release cancellation has been detected
Applied to: Preserve Previous Status for Audit
WHEN
Processing the cancellation event
THEN
The system preserves previous status information in audit records
Context: Release cancellation has been confirmed and previous status preserved
GIVEN
Release cancellation has been confirmed and previous status preserved
Applied to: Generate Cancel Release Notification
WHEN
Notification generation is triggered
THEN
The system creates a cancel release notification message
Context: Cancel release notification needs to be generated
GIVEN
Cancel release notification needs to be generated
Applied to: Format Notification Message
WHEN
Message formatting process begins
THEN
The system formats notification message with proper structure and headers
Context: Notification message is being formatted
GIVEN
Notification message is being formatted
Applied to: Include Cargo Details in Message
WHEN
Cargo details are added to the message
THEN
The system includes cargo CCN, car ID, waybill number, and quantity information in the notification
Context: Notification message contains cargo details
GIVEN
Notification message contains cargo details
Applied to: Add Disposition Code Information
WHEN
Disposition code information is added
THEN
The system includes disposition code, entry number, and related processing information in the message
Context: Cancel release notification message is formatted with cargo and disposition details
GIVEN
Cancel release notification message is formatted with cargo and disposition details
Applied to: Set Notification Type as UNRLSE
WHEN
Message type classification is performed
THEN
The system sets notification type as UNRLSE for cancel release processing
Context: Cancel release notification is formatted and classified as UNRLSE type
GIVEN
Cancel release notification is formatted and classified as UNRLSE type
Applied to: Route to Merlin Message Distribution
WHEN
Message routing is initiated
THEN
The system routes notification to Merlin message distribution system
Context: Cancel release notification is routed through Merlin distribution
GIVEN
Cancel release notification is routed through Merlin distribution
Applied to: Send to Business Recipients
WHEN
Recipient delivery is processed
THEN
The system sends notification to OM01247 and SD segment cancel Merlin IDs
Context: Cancel release notification has been sent to business recipients
GIVEN
Cancel release notification has been sent to business recipients
Applied to: Log Cancel Release Action
WHEN
Action logging is performed
THEN
The system logs cancel release action with timestamp and recipient information
Context: Cancel release processing is complete and action is logged
GIVEN
Cancel release processing is complete and action is logged
Applied to: Update Cargo Status Arrays
WHEN
Status array update is performed
THEN
The system updates S09A status arrays to reflect cancel release status and removes previous release indicators
R-GCX016E-cbl-00890 (+15) File: GCX016E.cbl Destination Index Management Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Index Management':
  • Context - a cargo is being processed for arrival at its destination:
    For Clear Bond Start Dates:
    When the arrival processing is initiated, then all bond start dates are cleared from the cargo record.
  • Context - a cargo is arriving at a destination location:
    For Set Arrival Index:
    When the arrival index needs to be established, then the destination index is set to the current arrival location.
  • Context - a cargo has an established arrival date:
    For Calculate Cargo Age from Arrival Date:
    When cargo age calculation is required, then the system calculates the number of days between arrival date and current date.
  • Context - a cargo has successfully arrived at its destination:
    For Update Arrival Status Flags:
    When arrival processing is being completed, then all relevant arrival status flags are updated to indicate completed arrival.
  • Context - a cargo arrival process is being finalized:
    For Record Arrival Timestamp:
    When the arrival timestamp needs to be recorded, then the current date and time is stored as the official arrival timestamp.
  • Context - a cargo is being processed for export:
    For Clear Destination Index:
    When export processing is initiated, then the destination index is cleared from the cargo record.
  • Context - a cargo is undergoing export processing:
    For Reset Export Processing Flags:
    When export flags need to be reset, then all export processing flags are reset to their initial state.
  • Context - a cargo is being exported:
    For Update Export Status:
    When export status update is required, then the cargo status is updated to indicate export processing.
  • Context - a cargo export process is being reset or completed:
    For Clear Export-Related Dates:
    When export-related dates need to be cleared, then all export-related date fields are cleared from the cargo record.
  • Context - a cargo requires bond information restoration:
    For Restore Bond Information:
    When bond restoration process is initiated, then all previously saved bond information is restored to the cargo record.
  • Context - bond information has been restored for a cargo:
    For Recalculate Cargo Age:
    When cargo age recalculation is required, then the system recalculates cargo age using the restored bond start dates.
    For Update Bond Status Flags:
    When bond status flags need updating, then all bond status flags are updated to reflect the restored bond state.
  • Context - a cargo is undergoing bond restoration:
    For Reset Bond Start Dates:
    When bond start dates need to be reset, then all bond start dates are reset to their previously saved values.
  • Context - a cargo requires complete bond state restoration:
    For Restore Previous Bond State:
    When previous bond state restoration is initiated, then the cargo is restored to its complete previous bonded state with all associated attributes.
  • Context - destination index management processing has been completed:
    For Update Cargo Record:
    When cargo record update is required, then all index management changes are saved to the cargo record.
  • Context - destination index management has been completed:
    For Trigger Status Updates:
    When dependent status updates are required, then all related status update processes are triggered.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo is being processed for arrival at its destination
GIVEN
A cargo is being processed for arrival at its destination
Applied to: Clear Bond Start Dates
WHEN
The arrival processing is initiated
THEN
All bond start dates are cleared from the cargo record
Context: A cargo is arriving at a destination location
GIVEN
A cargo is arriving at a destination location
Applied to: Set Arrival Index
WHEN
The arrival index needs to be established
THEN
The destination index is set to the current arrival location
Context: A cargo has an established arrival date
GIVEN
A cargo has an established arrival date
Applied to: Calculate Cargo Age from Arrival Date
WHEN
Cargo age calculation is required
THEN
The system calculates the number of days between arrival date and current date
Context: A cargo has successfully arrived at its destination
GIVEN
A cargo has successfully arrived at its destination
Applied to: Update Arrival Status Flags
WHEN
Arrival processing is being completed
THEN
All relevant arrival status flags are updated to indicate completed arrival
Context: A cargo arrival process is being finalized
GIVEN
A cargo arrival process is being finalized
Applied to: Record Arrival Timestamp
WHEN
The arrival timestamp needs to be recorded
THEN
The current date and time is stored as the official arrival timestamp
Context: A cargo is being processed for export
GIVEN
A cargo is being processed for export
Applied to: Clear Destination Index
WHEN
Export processing is initiated
THEN
The destination index is cleared from the cargo record
Context: A cargo is undergoing export processing
GIVEN
A cargo is undergoing export processing
Applied to: Reset Export Processing Flags
WHEN
Export flags need to be reset
THEN
All export processing flags are reset to their initial state
Context: A cargo is being exported
GIVEN
A cargo is being exported
Applied to: Update Export Status
WHEN
Export status update is required
THEN
The cargo status is updated to indicate export processing
Context: A cargo export process is being reset or completed
GIVEN
A cargo export process is being reset or completed
Applied to: Clear Export-Related Dates
WHEN
Export-related dates need to be cleared
THEN
All export-related date fields are cleared from the cargo record
Context: A cargo requires bond information restoration
GIVEN
A cargo requires bond information restoration
Applied to: Restore Bond Information
WHEN
Bond restoration process is initiated
THEN
All previously saved bond information is restored to the cargo record
Context: Bond information has been restored for a cargo
GIVEN
Bond information has been restored for a cargo
Applied to: Recalculate Cargo Age
WHEN
Cargo age recalculation is required
THEN
The system recalculates cargo age using the restored bond start dates
Applied to: Update Bond Status Flags
WHEN
Bond status flags need updating
THEN
All bond status flags are updated to reflect the restored bond state
Context: A cargo is undergoing bond restoration
GIVEN
A cargo is undergoing bond restoration
Applied to: Reset Bond Start Dates
WHEN
Bond start dates need to be reset
THEN
All bond start dates are reset to their previously saved values
Context: A cargo requires complete bond state restoration
GIVEN
A cargo requires complete bond state restoration
Applied to: Restore Previous Bond State
WHEN
Previous bond state restoration is initiated
THEN
The cargo is restored to its complete previous bonded state with all associated attributes
Context: Destination index management processing has been completed
GIVEN
Destination index management processing has been completed
Applied to: Update Cargo Record
WHEN
Cargo record update is required
THEN
All index management changes are saved to the cargo record
Context: Destination index management has been completed
GIVEN
Destination index management has been completed
Applied to: Trigger Status Updates
WHEN
Dependent status updates are required
THEN
All related status update processes are triggered
R-GCX016E-cbl-00906 (+15) File: GCX016E.cbl Cargo Record Replacement Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Record Replacement':
  • Context - a cargo needs status update processing:
    For Retrieve Current Cargo Record:
    When the system initiates cargo record replacement process, then the current cargo record is retrieved from the us cargo root segments database.
  • Context - cargo record has been retrieved and disposition codes have been processed:
    For Update Cargo Status Changes:
    When status changes need to be applied to the cargo record, then the cargo status fields are updated with new status information including hold flags, release quantities, and arrival dates.
  • Context - n7 equipment segment data is available with car initial and number:
    For Format Car ID Information:
    When car id information needs to be formatted for cargo record, then the car initial and number are combined and formatted into a standardized car id format.
  • Context - a cargo record is being processed for car id updates:
    For CPRS Cargo?:
    When the system checks if the cargo is cprs type, then if cargo is cprs type, car id updates are skipped; if non-cprs, car id is updated with equipment information.
  • Context - cargo is determined to be non-cprs type and car id information is formatted:
    For Update Car ID for Non-CPRS:
    When car id update is required for the cargo record, then the cargo record car id fields are updated with the formatted car identification information.
  • Context - cargo is determined to be cprs type:
    For Skip Car ID Update for CPRS:
    When car id update processing is initiated, then the car id update is bypassed and existing car id information remains unchanged.
  • Context - cargo record has been updated with new status and car id information:
    For Replace Cargo Record in Database:
    When database update is required to persist changes, then the existing cargo record in us cargo root segments database is replaced with the updated record.
  • Context - cargo record has been updated in the database:
    For Validate Equipment Type:
    When gcciis integration is being considered, then the system checks if the equipment type is valid for gcciis processing (containers, trailers, chassis, etc.).
  • Context - equipment type validation has been performed:
    For Valid Equipment Type?:
    When decision is needed for gcciis integration, then if equipment type is valid, proceed with status mapping; if invalid, skip gcciis update.
  • Context - equipment type is valid for gcciis and cargo has internal status:
    For Map Internal Status to GCCIIS Status:
    When status mapping is required for gcciis integration, then internal status codes (hold, release, ptt, ptt-ex) are mapped to corresponding gcciis status descriptions.
  • Context - status has been mapped for gcciis and cargo has release quantity information:
    For Release Quantity Check:
    When release status determination is needed for gcciis, then if released quantity equals total quantity, send full release; if released quantity is less than total, send hold status.
  • Context - release quantity equals total quantity and status is mapped:
    For Send Full Release to GCCIIS:
    When gcciis notification is required for full release, then a full release status is sent to gcciis equipment tracking system with cargo and equipment details.
  • Context - released quantity is less than total quantity or cargo is held:
    For Send Hold Status to GCCIIS:
    When gcciis notification is required for hold status, then a hold status is sent to gcciis equipment tracking system with cargo and equipment details.
  • Context - equipment type is invalid for gcciis or status conditions exclude gcciis processing:
    For Skip GCCIIS Update:
    When gcciis integration decision is made, then gcciis update is skipped and processing continues without equipment tracking system notification.
  • Context - cargo status updates and gcciis notifications have been processed:
    For Log Status Update Action:
    When action logging is required for audit trail, then the status update actions are logged with cargo details, status changes, and processing results.
  • Context - primary cargo record has been updated and logged:
    For Update Multi-Cargo Records with Same Car/Waybill:
    When multiple cargos exist with the same car id and waybill combination, then all related cargo records with matching car id and waybill are updated with consistent status information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo needs status update processing
GIVEN
A cargo needs status update processing
Applied to: Retrieve Current Cargo Record
WHEN
The system initiates cargo record replacement process
THEN
The current cargo record is retrieved from the US Cargo Root Segments database
Context: Cargo record has been retrieved and disposition codes have been processed
GIVEN
Cargo record has been retrieved and disposition codes have been processed
Applied to: Update Cargo Status Changes
WHEN
Status changes need to be applied to the cargo record
THEN
The cargo status fields are updated with new status information including hold flags, release quantities, and arrival dates
Context: N7 equipment segment data is available with car initial and number
GIVEN
N7 equipment segment data is available with car initial and number
Applied to: Format Car ID Information
WHEN
Car ID information needs to be formatted for cargo record
THEN
The car initial and number are combined and formatted into a standardized car ID format
Context: A cargo record is being processed for car ID updates
GIVEN
A cargo record is being processed for car ID updates
Applied to: CPRS Cargo?
WHEN
The system checks if the cargo is CPRS type
THEN
If cargo is CPRS type, car ID updates are skipped; if non-CPRS, car ID is updated with equipment information
Context: Cargo is determined to be non-CPRS type and car ID information is formatted
GIVEN
Cargo is determined to be non-CPRS type and car ID information is formatted
Applied to: Update Car ID for Non-CPRS
WHEN
Car ID update is required for the cargo record
THEN
The cargo record car ID fields are updated with the formatted car identification information
Context: Cargo is determined to be CPRS type
GIVEN
Cargo is determined to be CPRS type
Applied to: Skip Car ID Update for CPRS
WHEN
Car ID update processing is initiated
THEN
The car ID update is bypassed and existing car ID information remains unchanged
Context: Cargo record has been updated with new status and car ID information
GIVEN
Cargo record has been updated with new status and car ID information
Applied to: Replace Cargo Record in Database
WHEN
Database update is required to persist changes
THEN
The existing cargo record in US Cargo Root Segments database is replaced with the updated record
Context: Cargo record has been updated in the database
GIVEN
Cargo record has been updated in the database
Applied to: Validate Equipment Type
WHEN
GCCIIS integration is being considered
THEN
The system checks if the equipment type is valid for GCCIIS processing (containers, trailers, chassis, etc.)
Context: Equipment type validation has been performed
GIVEN
Equipment type validation has been performed
Applied to: Valid Equipment Type?
WHEN
Decision is needed for GCCIIS integration
THEN
If equipment type is valid, proceed with status mapping; if invalid, skip GCCIIS update
Context: Equipment type is valid for GCCIIS and cargo has internal status
GIVEN
Equipment type is valid for GCCIIS and cargo has internal status
Applied to: Map Internal Status to GCCIIS Status
WHEN
Status mapping is required for GCCIIS integration
THEN
Internal status codes (HOLD, RELEASE, PTT, PTT-EX) are mapped to corresponding GCCIIS status descriptions
Context: Status has been mapped for GCCIIS and cargo has release quantity information
GIVEN
Status has been mapped for GCCIIS and cargo has release quantity information
Applied to: Release Quantity Check
WHEN
Release status determination is needed for GCCIIS
THEN
If released quantity equals total quantity, send full release; if released quantity is less than total, send hold status
Context: Release quantity equals total quantity and status is mapped
GIVEN
Release quantity equals total quantity and status is mapped
Applied to: Send Full Release to GCCIIS
WHEN
GCCIIS notification is required for full release
THEN
A full release status is sent to GCCIIS equipment tracking system with cargo and equipment details
Context: Released quantity is less than total quantity or cargo is held
GIVEN
Released quantity is less than total quantity or cargo is held
Applied to: Send Hold Status to GCCIIS
WHEN
GCCIIS notification is required for hold status
THEN
A hold status is sent to GCCIIS equipment tracking system with cargo and equipment details
Context: Equipment type is invalid for GCCIIS or status conditions exclude GCCIIS processing
GIVEN
Equipment type is invalid for GCCIIS or status conditions exclude GCCIIS processing
Applied to: Skip GCCIIS Update
WHEN
GCCIIS integration decision is made
THEN
GCCIIS update is skipped and processing continues without equipment tracking system notification
Context: Cargo status updates and GCCIIS notifications have been processed
GIVEN
Cargo status updates and GCCIIS notifications have been processed
Applied to: Log Status Update Action
WHEN
Action logging is required for audit trail
THEN
The status update actions are logged with cargo details, status changes, and processing results
Context: Primary cargo record has been updated and logged
GIVEN
Primary cargo record has been updated and logged
Applied to: Update Multi-Cargo Records with Same Car/Waybill
WHEN
Multiple cargos exist with the same car ID and waybill combination
THEN
All related cargo records with matching car ID and waybill are updated with consistent status information
R-GCX016E-cbl-00941 (+17) File: GCX016E.cbl Individual Cargo Analysis Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Individual Cargo Analysis':
  • Context - a cargo record exists in the system:
    For Check Cargo Deletion Status:
    When the system checks the cargo deletion status flag, then the cargo is identified as either deleted or active based on the deletion status indicator.
  • Context - a cargo record has been verified as deleted:
    For Mark as Deleted Cargo:
    When the deletion status check confirms the cargo is deleted, then the cargo is marked with deleted status and processing terminates for this cargo.
  • Context - an active cargo record exists in the system:
    For Check Manual Release Status:
    When the system analyzes the cargo's release status indicators, then the cargo is classified as either having manual release or no manual release based on release status flags.
  • Context - a cargo record shows manual release indicators:
    For Identify Manual Release:
    When manual release status is confirmed through status analysis, then the cargo is flagged as manually released for subsequent processing.
  • Context - a cargo record exists with potential hold conditions:
    For Analyze Hold Status Types:
    When the system evaluates all hold status indicators, then the system identifies and categorizes each type of hold (border, destination, fda, piece count, custom) applied to the cargo.
  • Context - a cargo record requires hold status analysis:
    For Border Hold Analysis:
    When the system examines border hold indicators and related status codes, then the cargo is classified as either having border hold conditions or being clear of border holds.
    For Destination Hold Analysis:
    When the system examines destination hold indicators and location-specific restrictions, then the cargo is classified as either having destination hold conditions or being clear for destination processing.
    For FDA Hold Analysis:
    When the system examines fda hold indicators and regulatory compliance status, then the cargo is classified as either having fda hold conditions or being compliant for fda processing.
    For Piece Count Hold Analysis:
    When the system examines piece count hold indicators and quantity validation results, then the cargo is classified as either having piece count hold conditions or having accurate piece counts.
    For Custom Hold Analysis:
    When the system examines custom hold indicators and customs processing status, then the cargo is classified as either having custom hold conditions or being clear for customs processing.
  • Context - a cargo record has been analyzed for all hold types:
    For Evaluate Release Eligibility:
    When the system evaluates the combined impact of all hold conditions and release requirements, then the cargo is determined to be either eligible for release or requiring continued hold status.
  • Context - a cargo record has been determined eligible for release:
    For Set Release Eligible Flag:
    When all hold conditions have been cleared and release requirements are met, then the system sets the release eligible flag and prepares the cargo for release processing.
  • Context - a cargo record has been determined to require continued hold status:
    For Set Hold Required Flag:
    When one or more hold conditions remain unresolved or new hold requirements are identified, then the system sets the hold required flag and maintains the cargo in hold status.
  • Context - a cargo record has been processed for individual analysis:
    For Check Multiple Records with Same Car/Waybill:
    When the system searches for other cargo records with matching car id and waybill number, then the system determines if the cargo is part of a single record or multiple records with the same car/waybill combination.
  • Context - multiple cargo records exist with the same car id and waybill number:
    For Analyze All Related Records:
    When the system processes each related cargo record for status and hold conditions, then all related cargo records are analyzed collectively to determine the overall shipment status.
  • Context - individual cargo analysis is complete or all related records have been analyzed:
    For Determine Overall Status:
    When the system evaluates all status indicators, hold conditions, and release eligibility, then the system determines the overall status for the cargo or shipment based on the most restrictive conditions.
  • Context - the overall status has been determined for the cargo or shipment:
    For Generate Status Summary:
    When the system compiles all analysis results including hold types, release eligibility, and final status, then a complete status summary is generated containing all relevant cargo analysis information.
  • Context - a status summary has been generated for the cargo analysis:
    For Update Cargo Analysis Results:
    When the system processes the final analysis results, then the cargo records are updated with the new status information, hold flags, and release eligibility indicators.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Check Cargo Deletion Status
WHEN
The system checks the cargo deletion status flag
THEN
The cargo is identified as either deleted or active based on the deletion status indicator
Context: A cargo record has been verified as deleted
GIVEN
A cargo record has been verified as deleted
Applied to: Mark as Deleted Cargo
WHEN
The deletion status check confirms the cargo is deleted
THEN
The cargo is marked with deleted status and processing terminates for this cargo
Context: An active cargo record exists in the system
GIVEN
An active cargo record exists in the system
Applied to: Check Manual Release Status
WHEN
The system analyzes the cargo's release status indicators
THEN
The cargo is classified as either having manual release or no manual release based on release status flags
Context: A cargo record shows manual release indicators
GIVEN
A cargo record shows manual release indicators
Applied to: Identify Manual Release
WHEN
Manual release status is confirmed through status analysis
THEN
The cargo is flagged as manually released for subsequent processing
Context: A cargo record exists with potential hold conditions
GIVEN
A cargo record exists with potential hold conditions
Applied to: Analyze Hold Status Types
WHEN
The system evaluates all hold status indicators
THEN
The system identifies and categorizes each type of hold (border, destination, FDA, piece count, custom) applied to the cargo
Context: A cargo record requires hold status analysis
GIVEN
A cargo record requires hold status analysis
Applied to: Border Hold Analysis
WHEN
The system examines border hold indicators and related status codes
THEN
The cargo is classified as either having border hold conditions or being clear of border holds
Applied to: Destination Hold Analysis
WHEN
The system examines destination hold indicators and location-specific restrictions
THEN
The cargo is classified as either having destination hold conditions or being clear for destination processing
Applied to: FDA Hold Analysis
WHEN
The system examines FDA hold indicators and regulatory compliance status
THEN
The cargo is classified as either having FDA hold conditions or being compliant for FDA processing
Applied to: Piece Count Hold Analysis
WHEN
The system examines piece count hold indicators and quantity validation results
THEN
The cargo is classified as either having piece count hold conditions or having accurate piece counts
Applied to: Custom Hold Analysis
WHEN
The system examines custom hold indicators and customs processing status
THEN
The cargo is classified as either having custom hold conditions or being clear for customs processing
Context: A cargo record has been analyzed for all hold types
GIVEN
A cargo record has been analyzed for all hold types
Applied to: Evaluate Release Eligibility
WHEN
The system evaluates the combined impact of all hold conditions and release requirements
THEN
The cargo is determined to be either eligible for release or requiring continued hold status
Context: A cargo record has been determined eligible for release
GIVEN
A cargo record has been determined eligible for release
Applied to: Set Release Eligible Flag
WHEN
All hold conditions have been cleared and release requirements are met
THEN
The system sets the release eligible flag and prepares the cargo for release processing
Context: A cargo record has been determined to require continued hold status
GIVEN
A cargo record has been determined to require continued hold status
Applied to: Set Hold Required Flag
WHEN
One or more hold conditions remain unresolved or new hold requirements are identified
THEN
The system sets the hold required flag and maintains the cargo in hold status
Context: A cargo record has been processed for individual analysis
GIVEN
A cargo record has been processed for individual analysis
Applied to: Check Multiple Records with Same Car/Waybill
WHEN
The system searches for other cargo records with matching car ID and waybill number
THEN
The system determines if the cargo is part of a single record or multiple records with the same car/waybill combination
Context: Multiple cargo records exist with the same car ID and waybill number
GIVEN
Multiple cargo records exist with the same car ID and waybill number
Applied to: Analyze All Related Records
WHEN
The system processes each related cargo record for status and hold conditions
THEN
All related cargo records are analyzed collectively to determine the overall shipment status
Context: Individual cargo analysis is complete or all related records have been analyzed
GIVEN
Individual cargo analysis is complete or all related records have been analyzed
Applied to: Determine Overall Status
WHEN
The system evaluates all status indicators, hold conditions, and release eligibility
THEN
The system determines the overall status for the cargo or shipment based on the most restrictive conditions
Context: The overall status has been determined for the cargo or shipment
GIVEN
The overall status has been determined for the cargo or shipment
Applied to: Generate Status Summary
WHEN
The system compiles all analysis results including hold types, release eligibility, and final status
THEN
A complete status summary is generated containing all relevant cargo analysis information
Context: A status summary has been generated for the cargo analysis
GIVEN
A status summary has been generated for the cargo analysis
Applied to: Update Cargo Analysis Results
WHEN
The system processes the final analysis results
THEN
The cargo records are updated with the new status information, hold flags, and release eligibility indicators
R-GCX016E-cbl-00959 (+12) File: GCX016E.cbl Release Notification Preparation Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Notification Preparation':
  • Context - a cargo release notification process is initiated:
    For Verify Cargo Release Status:
    When the system checks the cargo release status, then the system confirms cargo records are available and accessible for processing.
  • Context - multiple cargo records exist with the same car id and waybill number:
    For All Records with Same Car/Waybill Released?:
    When the system evaluates release status for notification preparation, then all related cargo records must be in released status to continue with release notification, otherwise the process terminates.
  • Context - cargo records are confirmed as released:
    For Calculate Release Quantities:
    When the system prepares release notification details, then the system calculates and formats the total released quantities for inclusion in the notification message.
  • Context - equipment information exists in n7 segments:
    For Format Equipment Information:
    When the system prepares release notification content, then the system formats car id, equipment initial, and equipment number into standardized format for the notification message.
  • Context - disposition code information exists in x4 segments:
    For Format Disposition Code Details:
    When the system prepares release notification content, then the system formats disposition codes, entry numbers, and related cargo details for inclusion in the notification message.
  • Context - current system date and time are available:
    For Format Date/Time Information:
    When the system prepares release notification content, then the system formats date and time in the required format for inclusion in the notification message.
  • Context - release quantities have been calculated:
    For Include Release Quantity Impact:
    When the system prepares the notification message content, then the system includes details about quantity changes and impact of the release action in the message.
  • Context - quantity impact information has been prepared:
    For Add Before/After Quantity Comparison:
    When the system finalizes notification message content, then the system includes before and after quantity comparison data to show the effect of the release.
  • Context - k1 comment segments exist for the cargo:
    For Include K1 Comment Messages:
    When the system prepares comprehensive notification content, then the system includes up to 4 lines of k1 segment comments in the notification message if available.
  • Context - special processing comments are available for the cargo:
    For Add Special Processing Comments:
    When the system prepares detailed notification content, then the system includes up to 3 lines of special processing comments in the notification message if present.
  • Context - all message components have been prepared including equipment info, disposition codes, quantities, and comments:
    For Format Comprehensive Release Message:
    When the system creates the final notification message, then the system formats all components into a comprehensive release message with proper structure and formatting.
  • Context - a comprehensive release message has been formatted:
    For Set Message Type as RELEASE:
    When the system finalizes message properties, then the system sets the message type indicator to release for proper routing and processing.
  • Context - a complete release message with proper type assignment exists:
    For Prepare Message for Distribution:
    When the system prepares for message distribution, then the system readies the message for delivery through appropriate notification channels including merlin routing and email systems.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release notification process is initiated
GIVEN
A cargo release notification process is initiated
Applied to: Verify Cargo Release Status
WHEN
The system checks the cargo release status
THEN
The system confirms cargo records are available and accessible for processing
Context: Multiple cargo records exist with the same car ID and waybill number
GIVEN
Multiple cargo records exist with the same car ID and waybill number
Applied to: All Records with Same Car/Waybill Released?
WHEN
The system evaluates release status for notification preparation
THEN
All related cargo records must be in released status to continue with release notification, otherwise the process terminates
Context: Cargo records are confirmed as released
GIVEN
Cargo records are confirmed as released
Applied to: Calculate Release Quantities
WHEN
The system prepares release notification details
THEN
The system calculates and formats the total released quantities for inclusion in the notification message
Context: Equipment information exists in N7 segments
GIVEN
Equipment information exists in N7 segments
Applied to: Format Equipment Information
WHEN
The system prepares release notification content
THEN
The system formats car ID, equipment initial, and equipment number into standardized format for the notification message
Context: Disposition code information exists in X4 segments
GIVEN
Disposition code information exists in X4 segments
Applied to: Format Disposition Code Details
WHEN
The system prepares release notification content
THEN
The system formats disposition codes, entry numbers, and related cargo details for inclusion in the notification message
Context: Current system date and time are available
GIVEN
Current system date and time are available
Applied to: Format Date/Time Information
WHEN
The system prepares release notification content
THEN
The system formats date and time in the required format for inclusion in the notification message
Context: Release quantities have been calculated
GIVEN
Release quantities have been calculated
Applied to: Include Release Quantity Impact
WHEN
The system prepares the notification message content
THEN
The system includes details about quantity changes and impact of the release action in the message
Context: Quantity impact information has been prepared
GIVEN
Quantity impact information has been prepared
Applied to: Add Before/After Quantity Comparison
WHEN
The system finalizes notification message content
THEN
The system includes before and after quantity comparison data to show the effect of the release
Context: K1 comment segments exist for the cargo
GIVEN
K1 comment segments exist for the cargo
Applied to: Include K1 Comment Messages
WHEN
The system prepares comprehensive notification content
THEN
The system includes up to 4 lines of K1 segment comments in the notification message if available
Context: Special processing comments are available for the cargo
GIVEN
Special processing comments are available for the cargo
Applied to: Add Special Processing Comments
WHEN
The system prepares detailed notification content
THEN
The system includes up to 3 lines of special processing comments in the notification message if present
Context: All message components have been prepared including equipment info, disposition codes, quantities, and comments
GIVEN
All message components have been prepared including equipment info, disposition codes, quantities, and comments
Applied to: Format Comprehensive Release Message
WHEN
The system creates the final notification message
THEN
The system formats all components into a comprehensive release message with proper structure and formatting
Context: A comprehensive release message has been formatted
GIVEN
A comprehensive release message has been formatted
Applied to: Set Message Type as RELEASE
WHEN
The system finalizes message properties
THEN
The system sets the message type indicator to RELEASE for proper routing and processing
Context: A complete release message with proper type assignment exists
GIVEN
A complete release message with proper type assignment exists
Applied to: Prepare Message for Distribution
WHEN
The system prepares for message distribution
THEN
The system readies the message for delivery through appropriate notification channels including Merlin routing and email systems
R-GCX016E-cbl-00972 (+16) File: GCX016E.cbl Export Notification Processing Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Notification Processing':
  • Context - a cargo record with current status and disposition codes:
    For Cargo Export Status?:
    When the system evaluates if export notification processing is required, then the system determines if cargo has export status and requires export notification processing.
  • Context - a cargo marked for export processing with associated port and routing information:
    For Export Port Validated?:
    When the system validates export conditions and port information, then the system confirms if export port is valid and cargo meets export processing requirements.
  • Context - a cargo record with valid export conditions and existing destination index:
    For Clear Destination Index:
    When the cargo is being processed for export, then the system clears the destination index to remove domestic routing information.
  • Context - a cargo record that has passed export validation with cleared destination index:
    For Set Export Status Flag:
    When the system processes the cargo for export, then the system sets the export status flag to indicate export processing status.
  • Context - a cargo with export status flag set and current system date/time available:
    For Calculate Export Date/Time:
    When the system calculates export timing information, then the system assigns appropriate export date and time to the cargo record.
  • Context - a cargo with export status, date/time, and validated export conditions:
    For Prepare Export Notification Message:
    When the system prepares export notification message, then the system creates message structure with header information for export notification.
  • Context - an export notification message structure and cargo with associated equipment information:
    For Format Equipment Information:
    When the system formats equipment details for the export message, then the system includes formatted car id, equipment type, and equipment details in the export notification.
  • Context - an export notification message with equipment information and cargo record with complete details:
    For Format Cargo Details:
    When the system formats cargo details for the export message, then the system includes formatted ccn, waybill, origin, destination, and commodity information in the export notification.
  • Context - an export notification message with cargo details and disposition code information from x4 segment:
    For Format Disposition Code Information:
    When the system formats disposition code information for the export message, then the system includes formatted disposition code, entry numbers, and related processing information in the export notification.
  • Context - an export notification message with disposition code information and cargo with release quantity data:
    For Add Release Quantity Information:
    When the system adds release quantity information to the export message, then the system includes release quantities and quantity impact details in the export notification.
  • Context - a complete export notification with all formatted information including equipment, cargo, disposition, and quantity details:
    For Create Merlin Export Message:
    When the system creates the merlin export message, then the system generates a complete merlin export message with proper formatting and routing information.
  • Context - a complete merlin export message and equipment type information:
    For Route to Export Message Recipients:
    When the system determines export message recipients, then the system routes the export notification to appropriate recipients based on equipment type and routing rules.
  • Context - a routed export notification message with identified recipients:
    For Send Export Notification:
    When the system sends the export notification, then the system delivers the export notification message to all identified recipients.
  • Context - an export notification that has been sent to recipients:
    For Delivery Successful?:
    When the system checks delivery status, then the system determines if the export notification was successfully delivered to all recipients.
  • Context - an export notification that was successfully delivered to all recipients:
    For Log Export Notification Sent:
    When the system logs the successful delivery, then the system records export notification delivery success with timestamp and recipient information.
  • Context - an export notification that failed delivery to one or more recipients:
    For Handle Delivery Failure:
    When the system handles the delivery failure, then the system initiates failure handling procedures and prepares for alternative delivery methods.
  • Context - an export notification with delivery failure and default recipient configuration:
    For Reroute to Default Recipients:
    When the system reroutes to default recipients, then the system sends the export notification to default recipients (om01247 and backup recipients) as fallback delivery.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with current status and disposition codes
GIVEN
A cargo record with current status and disposition codes
Applied to: Cargo Export Status?
WHEN
The system evaluates if export notification processing is required
THEN
The system determines if cargo has export status and requires export notification processing
Context: A cargo marked for export processing with associated port and routing information
GIVEN
A cargo marked for export processing with associated port and routing information
Applied to: Export Port Validated?
WHEN
The system validates export conditions and port information
THEN
The system confirms if export port is valid and cargo meets export processing requirements
Context: A cargo record with valid export conditions and existing destination index
GIVEN
A cargo record with valid export conditions and existing destination index
Applied to: Clear Destination Index
WHEN
The cargo is being processed for export
THEN
The system clears the destination index to remove domestic routing information
Context: A cargo record that has passed export validation with cleared destination index
GIVEN
A cargo record that has passed export validation with cleared destination index
Applied to: Set Export Status Flag
WHEN
The system processes the cargo for export
THEN
The system sets the export status flag to indicate export processing status
Context: A cargo with export status flag set and current system date/time available
GIVEN
A cargo with export status flag set and current system date/time available
Applied to: Calculate Export Date/Time
WHEN
The system calculates export timing information
THEN
The system assigns appropriate export date and time to the cargo record
Context: A cargo with export status, date/time, and validated export conditions
GIVEN
A cargo with export status, date/time, and validated export conditions
Applied to: Prepare Export Notification Message
WHEN
The system prepares export notification message
THEN
The system creates message structure with header information for export notification
Context: An export notification message structure and cargo with associated equipment information
GIVEN
An export notification message structure and cargo with associated equipment information
Applied to: Format Equipment Information
WHEN
The system formats equipment details for the export message
THEN
The system includes formatted car ID, equipment type, and equipment details in the export notification
Context: An export notification message with equipment information and cargo record with complete details
GIVEN
An export notification message with equipment information and cargo record with complete details
Applied to: Format Cargo Details
WHEN
The system formats cargo details for the export message
THEN
The system includes formatted CCN, waybill, origin, destination, and commodity information in the export notification
Context: An export notification message with cargo details and disposition code information from X4 segment
GIVEN
An export notification message with cargo details and disposition code information from X4 segment
Applied to: Format Disposition Code Information
WHEN
The system formats disposition code information for the export message
THEN
The system includes formatted disposition code, entry numbers, and related processing information in the export notification
Context: An export notification message with disposition code information and cargo with release quantity data
GIVEN
An export notification message with disposition code information and cargo with release quantity data
Applied to: Add Release Quantity Information
WHEN
The system adds release quantity information to the export message
THEN
The system includes release quantities and quantity impact details in the export notification
Context: A complete export notification with all formatted information including equipment, cargo, disposition, and quantity details
GIVEN
A complete export notification with all formatted information including equipment, cargo, disposition, and quantity details
Applied to: Create Merlin Export Message
WHEN
The system creates the Merlin export message
THEN
The system generates a complete Merlin export message with proper formatting and routing information
Context: A complete Merlin export message and equipment type information
GIVEN
A complete Merlin export message and equipment type information
Applied to: Route to Export Message Recipients
WHEN
The system determines export message recipients
THEN
The system routes the export notification to appropriate recipients based on equipment type and routing rules
Context: A routed export notification message with identified recipients
GIVEN
A routed export notification message with identified recipients
Applied to: Send Export Notification
WHEN
The system sends the export notification
THEN
The system delivers the export notification message to all identified recipients
Context: An export notification that has been sent to recipients
GIVEN
An export notification that has been sent to recipients
Applied to: Delivery Successful?
WHEN
The system checks delivery status
THEN
The system determines if the export notification was successfully delivered to all recipients
Context: An export notification that was successfully delivered to all recipients
GIVEN
An export notification that was successfully delivered to all recipients
Applied to: Log Export Notification Sent
WHEN
The system logs the successful delivery
THEN
The system records export notification delivery success with timestamp and recipient information
Context: An export notification that failed delivery to one or more recipients
GIVEN
An export notification that failed delivery to one or more recipients
Applied to: Handle Delivery Failure
WHEN
The system handles the delivery failure
THEN
The system initiates failure handling procedures and prepares for alternative delivery methods
Context: An export notification with delivery failure and default recipient configuration
GIVEN
An export notification with delivery failure and default recipient configuration
Applied to: Reroute to Default Recipients
WHEN
The system reroutes to default recipients
THEN
The system sends the export notification to default recipients (OM01247 and backup recipients) as fallback delivery
R-GCX016E-cbl-00989 (+21) File: GCX016E.cbl Arrival Notification Processing Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Arrival Notification Processing':
  • Context - a cargo has a disposition code in the message:
    For Arrival Disposition Code?:
    When the system processes the disposition code, then the system identifies if it is pod (proof of delivery), aad (actual arrival date), or other arrival-related codes and proceeds with arrival processing.
  • Context - a cargo has an arrival disposition code and location information:
    For Validate Arrival Location:
    When the system validates the arrival location, then the system confirms the location is valid for arrival processing and matches cargo routing requirements.
  • Context - a cargo has a validated arrival disposition code:
    For Set Arrival Status Flags:
    When the system processes the arrival event, then the system sets arrival status flags including arrival date, arrival location, and arrival type indicators.
  • Context - a cargo has arrived at its destination and has active bond start dates:
    For Clear Bond Start Dates:
    When the system processes the arrival event, then the system clears the bond start dates to stop bond timing calculations.
  • Context - a cargo has successfully arrived at a validated location:
    For Set Arrival Index:
    When the system processes the arrival event, then the system sets the arrival index to reference the arrival location for future processing.
  • Context - a cargo has arrival date and time information:
    For Calculate Cargo Age:
    When the system processes the arrival event, then the system calculates the cargo age from entry date to arrival date for reporting and compliance purposes.
  • Context - a cargo arrival is being processed:
    For Check Multi-Cargo Records:
    When the system checks for related cargo records, then the system identifies if there are multiple cargo records with the same car id and waybill that require coordinated processing.
  • Context - multiple cargo records exist in the system:
    For Same Car/Waybill Records?:
    When the system compares car id and waybill information, then the system identifies records with matching car id and waybill numbers that require coordinated arrival processing.
  • Context - multiple cargo records share the same car id and waybill:
    For Process All Related Records:
    When an arrival event is processed for one record, then the system processes arrival status for all related records with the same car id and waybill.
  • Context - multiple related cargo records have been processed for arrival:
    For Verify Arrival Status Across Records:
    When the system verifies arrival status consistency, then the system ensures all related records have consistent arrival status and flags any discrepancies.
  • Context - a cargo has successfully arrived and all validations are complete:
    For Create Arrival Notification Message:
    When the system creates arrival notification, then the system generates a structured arrival notification message with all relevant cargo and arrival details.
  • Context - an arrival notification message is being created:
    For Format Arrival Details:
    When the system formats arrival details, then the system formats cargo identification, arrival date/time, and status information into the standard notification format.
  • Context - an arrival notification is being formatted:
    For Include Equipment Information:
    When the system includes equipment information, then the system adds car id, equipment type, and equipment identification details to the notification message.
    For Include Location Information:
    When the system includes location information, then the system adds arrival location, destination details, and routing information to the notification message.
    For Include Date/Time Information:
    When the system includes date/time information, then the system adds arrival date, arrival time, and processing timestamp to the notification message.
    For Add Disposition Code Details:
    When the system adds disposition code details, then the system includes the disposition code, code description, and any associated quantities or references in the notification message.
  • Context - an arrival notification message is complete and formatted:
    For Route to Merlin Distribution:
    When the system routes the message for distribution, then the system sends the notification to the merlin messaging system for distribution to appropriate recipients.
  • Context - an arrival notification is ready for distribution:
    For Message Type?:
    When the system determines message type, then the system classifies the message as arrcanl (arrival cancellation) or other arrival type for proper routing.
  • Context - an arrival notification is classified as arrcanl message type:
    For Send to ARRCANL Basket:
    When the system routes the message, then the system sends the message to the arrcanl basket for specialized arrival cancellation processing.
  • Context - an arrival notification is not classified as arrcanl message type:
    For Send to Default Recipient:
    When the system routes the message, then the system sends the message to default recipients configured for standard arrival notifications.
  • Context - an arrival notification has been successfully distributed:
    For Log Arrival Action:
    When the system logs the arrival action, then the system creates a log entry recording the arrival event, processing details, and distribution results.
  • Context - an arrival action has been logged:
    For Update Audit Trail:
    When the system updates the audit trail, then the system records the arrival processing in the audit trail with timestamp, user information, and processing results.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo has a disposition code in the message
GIVEN
A cargo has a disposition code in the message
Applied to: Arrival Disposition Code?
WHEN
The system processes the disposition code
THEN
The system identifies if it is POD (Proof of Delivery), AAD (Actual Arrival Date), or other arrival-related codes and proceeds with arrival processing
Context: A cargo has an arrival disposition code and location information
GIVEN
A cargo has an arrival disposition code and location information
Applied to: Validate Arrival Location
WHEN
The system validates the arrival location
THEN
The system confirms the location is valid for arrival processing and matches cargo routing requirements
Context: A cargo has a validated arrival disposition code
GIVEN
A cargo has a validated arrival disposition code
Applied to: Set Arrival Status Flags
WHEN
The system processes the arrival event
THEN
The system sets arrival status flags including arrival date, arrival location, and arrival type indicators
Context: A cargo has arrived at its destination and has active bond start dates
GIVEN
A cargo has arrived at its destination and has active bond start dates
Applied to: Clear Bond Start Dates
WHEN
The system processes the arrival event
THEN
The system clears the bond start dates to stop bond timing calculations
Context: A cargo has successfully arrived at a validated location
GIVEN
A cargo has successfully arrived at a validated location
Applied to: Set Arrival Index
WHEN
The system processes the arrival event
THEN
The system sets the arrival index to reference the arrival location for future processing
Context: A cargo has arrival date and time information
GIVEN
A cargo has arrival date and time information
Applied to: Calculate Cargo Age
WHEN
The system processes the arrival event
THEN
The system calculates the cargo age from entry date to arrival date for reporting and compliance purposes
Context: A cargo arrival is being processed
GIVEN
A cargo arrival is being processed
Applied to: Check Multi-Cargo Records
WHEN
The system checks for related cargo records
THEN
The system identifies if there are multiple cargo records with the same car ID and waybill that require coordinated processing
Context: Multiple cargo records exist in the system
GIVEN
Multiple cargo records exist in the system
Applied to: Same Car/Waybill Records?
WHEN
The system compares car ID and waybill information
THEN
The system identifies records with matching car ID and waybill numbers that require coordinated arrival processing
Context: Multiple cargo records share the same car ID and waybill
GIVEN
Multiple cargo records share the same car ID and waybill
Applied to: Process All Related Records
WHEN
An arrival event is processed for one record
THEN
The system processes arrival status for all related records with the same car ID and waybill
Context: Multiple related cargo records have been processed for arrival
GIVEN
Multiple related cargo records have been processed for arrival
Applied to: Verify Arrival Status Across Records
WHEN
The system verifies arrival status consistency
THEN
The system ensures all related records have consistent arrival status and flags any discrepancies
Context: A cargo has successfully arrived and all validations are complete
GIVEN
A cargo has successfully arrived and all validations are complete
Applied to: Create Arrival Notification Message
WHEN
The system creates arrival notification
THEN
The system generates a structured arrival notification message with all relevant cargo and arrival details
Context: An arrival notification message is being created
GIVEN
An arrival notification message is being created
Applied to: Format Arrival Details
WHEN
The system formats arrival details
THEN
The system formats cargo identification, arrival date/time, and status information into the standard notification format
Context: An arrival notification is being formatted
GIVEN
An arrival notification is being formatted
Applied to: Include Equipment Information
WHEN
The system includes equipment information
THEN
The system adds car ID, equipment type, and equipment identification details to the notification message
Applied to: Include Location Information
WHEN
The system includes location information
THEN
The system adds arrival location, destination details, and routing information to the notification message
Applied to: Include Date/Time Information
WHEN
The system includes date/time information
THEN
The system adds arrival date, arrival time, and processing timestamp to the notification message
Applied to: Add Disposition Code Details
WHEN
The system adds disposition code details
THEN
The system includes the disposition code, code description, and any associated quantities or references in the notification message
Context: An arrival notification message is complete and formatted
GIVEN
An arrival notification message is complete and formatted
Applied to: Route to Merlin Distribution
WHEN
The system routes the message for distribution
THEN
The system sends the notification to the Merlin messaging system for distribution to appropriate recipients
Context: An arrival notification is ready for distribution
GIVEN
An arrival notification is ready for distribution
Applied to: Message Type?
WHEN
The system determines message type
THEN
The system classifies the message as ARRCANL (arrival cancellation) or other arrival type for proper routing
Context: An arrival notification is classified as ARRCANL message type
GIVEN
An arrival notification is classified as ARRCANL message type
Applied to: Send to ARRCANL Basket
WHEN
The system routes the message
THEN
The system sends the message to the ARRCANL basket for specialized arrival cancellation processing
Context: An arrival notification is not classified as ARRCANL message type
GIVEN
An arrival notification is not classified as ARRCANL message type
Applied to: Send to Default Recipient
WHEN
The system routes the message
THEN
The system sends the message to default recipients configured for standard arrival notifications
Context: An arrival notification has been successfully distributed
GIVEN
An arrival notification has been successfully distributed
Applied to: Log Arrival Action
WHEN
The system logs the arrival action
THEN
The system creates a log entry recording the arrival event, processing details, and distribution results
Context: An arrival action has been logged
GIVEN
An arrival action has been logged
Applied to: Update Audit Trail
WHEN
The system updates the audit trail
THEN
The system records the arrival processing in the audit trail with timestamp, user information, and processing results
R-GCX016E-cbl-01011 (+13) File: GCX016E.cbl New Cargo Record Creation Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'New Cargo Record Creation':
  • Context - cprs traffic is not found in the system:
    For Check if Foreign Bill?:
    When the system checks cargo characteristics to determine if it is a foreign bill, then the system should identify foreign bill status and route to appropriate processing path.
  • Context - a foreign bill has been identified for cprs traffic:
    For Initialize New Cargo Record:
    When the system needs to create a new cargo record, then the system should initialize a new cargo record structure with default values.
  • Context - a new cargo record has been initialized and x4 segment data is available:
    For Set Cargo Record Fields from X4 Segment:
    When the system processes x4 segment information, then the system should populate cargo record fields including disposition code, entry number, quantity, and related cargo details from the x4 segment.
  • Context - cargo record fields have been set from x4 segment and n7 segment data is available:
    For Set Equipment Information from N7 Segment:
    When the system processes n7 equipment information, then the system should assign equipment initial, equipment number, and formatted car id to the cargo record from n7 segment data.
  • Context - equipment information has been set and m10 segment data is available:
    For Build Foreign Manifest from M10 Segment:
    When the system processes m10 manifest information, then the system should build foreign manifest details including vessel information, transport mode, and manifest identifiers from m10 segment data.
  • Context - foreign manifest has been built from m10 segment:
    For Set SCAC Code:
    When the system determines carrier information, then the system should assign the appropriate scac code to identify the carrier for the cargo record.
  • Context - scac code has been assigned and transport characteristics are available:
    For Set Transport Type:
    When the system evaluates transport mode and vessel type, then the system should classify and assign the appropriate transport type (rail, truck, vessel, etc.) to the cargo record.
  • Context - transport type has been set and routing information is available:
    For Set Country Code:
    When the system determines country information from cargo routing, then the system should assign the appropriate country code for origin or destination to the cargo record.
  • Context - country code has been assigned and vessel information is available:
    For Set Vessel Details:
    When the system processes vessel-specific data, then the system should configure vessel details including vessel name, voyage number, and related transport information in the cargo record.
  • Context - vessel details have been set and equipment initial and number are available:
    For Format Car ID:
    When the system formats car identification, then the system should format car id by combining equipment initial and equipment number according to standard formatting rules.
  • Context - car id has been formatted and all cargo record fields are populated:
    For Validate Cargo Record Data:
    When the system validates cargo record data, then the system should verify that all required fields are present, data formats are correct, and business rules are satisfied before allowing database insertion.
  • Context - cargo record data has been validated successfully:
    For Insert New Cargo Record into Database:
    When the system performs database insertion, then the system should insert the new cargo record into the gcsusrt (us cargo root) database table.
  • Context - new cargo record has been successfully inserted into database:
    For Log Cargo Creation Action:
    When the system logs the creation activity, then the system should record cargo creation action with timestamp, user information, and cargo details for audit trail purposes.
  • Context - cargo creation action has been logged successfully:
    For Update CPRS Processing Flag:
    When the system updates processing status, then the system should set cprs processing flag to indicate that cargo record creation has been completed successfully.
👨‍💻 Technical ACs (Gherkin)
Context: CPRS traffic is not found in the system
GIVEN
CPRS traffic is not found in the system
Applied to: Check if Foreign Bill?
WHEN
the system checks cargo characteristics to determine if it is a foreign bill
THEN
the system should identify foreign bill status and route to appropriate processing path
Context: a foreign bill has been identified for CPRS traffic
GIVEN
a foreign bill has been identified for CPRS traffic
Applied to: Initialize New Cargo Record
WHEN
the system needs to create a new cargo record
THEN
the system should initialize a new cargo record structure with default values
Context: a new cargo record has been initialized and X4 segment data is available
GIVEN
a new cargo record has been initialized and X4 segment data is available
Applied to: Set Cargo Record Fields from X4 Segment
WHEN
the system processes X4 segment information
THEN
the system should populate cargo record fields including disposition code, entry number, quantity, and related cargo details from the X4 segment
Context: cargo record fields have been set from X4 segment and N7 segment data is available
GIVEN
cargo record fields have been set from X4 segment and N7 segment data is available
Applied to: Set Equipment Information from N7 Segment
WHEN
the system processes N7 equipment information
THEN
the system should assign equipment initial, equipment number, and formatted car ID to the cargo record from N7 segment data
Context: equipment information has been set and M10 segment data is available
GIVEN
equipment information has been set and M10 segment data is available
Applied to: Build Foreign Manifest from M10 Segment
WHEN
the system processes M10 manifest information
THEN
the system should build foreign manifest details including vessel information, transport mode, and manifest identifiers from M10 segment data
Context: foreign manifest has been built from M10 segment
GIVEN
foreign manifest has been built from M10 segment
Applied to: Set SCAC Code
WHEN
the system determines carrier information
THEN
the system should assign the appropriate SCAC code to identify the carrier for the cargo record
Context: SCAC code has been assigned and transport characteristics are available
GIVEN
SCAC code has been assigned and transport characteristics are available
Applied to: Set Transport Type
WHEN
the system evaluates transport mode and vessel type
THEN
the system should classify and assign the appropriate transport type (rail, truck, vessel, etc.) to the cargo record
Context: transport type has been set and routing information is available
GIVEN
transport type has been set and routing information is available
Applied to: Set Country Code
WHEN
the system determines country information from cargo routing
THEN
the system should assign the appropriate country code for origin or destination to the cargo record
Context: country code has been assigned and vessel information is available
GIVEN
country code has been assigned and vessel information is available
Applied to: Set Vessel Details
WHEN
the system processes vessel-specific data
THEN
the system should configure vessel details including vessel name, voyage number, and related transport information in the cargo record
Context: vessel details have been set and equipment initial and number are available
GIVEN
vessel details have been set and equipment initial and number are available
Applied to: Format Car ID
WHEN
the system formats car identification
THEN
the system should format car ID by combining equipment initial and equipment number according to standard formatting rules
Context: car ID has been formatted and all cargo record fields are populated
GIVEN
car ID has been formatted and all cargo record fields are populated
Applied to: Validate Cargo Record Data
WHEN
the system validates cargo record data
THEN
the system should verify that all required fields are present, data formats are correct, and business rules are satisfied before allowing database insertion
Context: cargo record data has been validated successfully
GIVEN
cargo record data has been validated successfully
Applied to: Insert New Cargo Record into Database
WHEN
the system performs database insertion
THEN
the system should insert the new cargo record into the GCSUSRT (US Cargo Root) database table
Context: new cargo record has been successfully inserted into database
GIVEN
new cargo record has been successfully inserted into database
Applied to: Log Cargo Creation Action
WHEN
the system logs the creation activity
THEN
the system should record cargo creation action with timestamp, user information, and cargo details for audit trail purposes
Context: cargo creation action has been logged successfully
GIVEN
cargo creation action has been logged successfully
Applied to: Update CPRS Processing Flag
WHEN
the system updates processing status
THEN
the system should set CPRS processing flag to indicate that cargo record creation has been completed successfully
R-GCX016E-cbl-01025 (+17) File: GCX016E.cbl Foreign Manifest Building Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Foreign Manifest Building':
  • Context - an m10 input segment is received containing carrier information:
    For Extract SCAC Code from M10:
    When the system processes the m10 segment for scac code extraction, then the scac code is extracted from the designated field position in the m10 segment.
  • Context - an m10 input segment is received containing transportation mode information:
    For Extract Transport Type from M10:
    When the system processes the m10 segment for transport type extraction, then the transport type is extracted from the designated field position in the m10 segment.
  • Context - an m10 input segment is received containing country information:
    For Extract Country Code from M10:
    When the system processes the m10 segment for country code extraction, then the country code is extracted from the designated field position in the m10 segment.
  • Context - an m10 input segment is received containing vessel information:
    For Extract Vessel Details from M10:
    When the system processes the m10 segment for vessel details extraction, then the vessel name and related details are extracted from the designated field positions in the m10 segment.
  • Context - a scac code has been extracted from the m10 segment:
    For SCAC Code Valid?:
    When the system validates the scac code against business rules, then the scac code is determined to be valid if it is not spaces and meets format requirements, otherwise it is invalid.
  • Context - the extracted scac code has failed validation:
    For Set Default SCAC if Invalid:
    When the system needs to assign a scac code for processing, then a default scac code is assigned to ensure processing can continue.
  • Context - a transport type has been extracted from the m10 segment:
    For Transport Type Valid?:
    When the system validates the transport type against acceptable values, then the transport type is determined to be valid if it matches recognized transportation modes, otherwise it is invalid.
  • Context - the extracted transport type has failed validation:
    For Set Default Transport Type:
    When the system needs to assign a transport type for processing, then a default transport type is assigned to ensure processing can continue.
  • Context - a country code has been extracted from the m10 segment:
    For Country Code Valid?:
    When the system validates the country code against acceptable country codes, then the country code is determined to be valid if it matches recognized country identifiers, otherwise it is invalid.
  • Context - the extracted country code has failed validation:
    For Set Default Country Code:
    When the system needs to assign a country code for processing, then a default country code is assigned to ensure processing can continue.
  • Context - all required data elements have been extracted and validated from the input:
    For Construct M10 Manifest Segment:
    When the system constructs the m10 manifest segment, then a properly formatted m10 segment is created with all required fields populated.
  • Context - vessel details have been extracted from the input segment:
    For Populate Vessel Name Field:
    When the system populates the vessel name field in the m10 segment, then the vessel name field is set with the extracted vessel name value.
  • Context - a valid or default transport type has been determined:
    For Populate Transport Mode Field:
    When the system populates the transport mode field in the m10 segment, then the transport mode field is set with the validated transport type value.
  • Context - a valid or default country code has been determined:
    For Populate Country of Origin Field:
    When the system populates the country of origin field in the m10 segment, then the country of origin field is set with the validated country code value.
  • Context - a valid or default scac code has been determined:
    For Populate SCAC Field:
    When the system populates the scac field in the m10 segment, then the scac field is set with the validated scac code value.
  • Context - an m10 manifest segment has been constructed with populated fields:
    For M10 Segment Complete?:
    When the system validates the completeness of the m10 segment, then the m10 segment is determined to be complete if all mandatory fields are populated, otherwise it is incomplete.
  • Context - the m10 segment has failed completeness validation:
    For Log Incomplete Manifest Warning:
    When the system processes the incomplete segment, then a warning message is logged indicating the manifest is incomplete but processing continues.
  • Context - an m10 manifest segment has been constructed and validated:
    For Store M10 Manifest Segment:
    When the system stores the m10 segment, then the m10 segment is stored in the appropriate data structure for subsequent processing steps.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 input segment is received containing carrier information
GIVEN
An M10 input segment is received containing carrier information
Applied to: Extract SCAC Code from M10
WHEN
The system processes the M10 segment for SCAC code extraction
THEN
The SCAC code is extracted from the designated field position in the M10 segment
Context: An M10 input segment is received containing transportation mode information
GIVEN
An M10 input segment is received containing transportation mode information
Applied to: Extract Transport Type from M10
WHEN
The system processes the M10 segment for transport type extraction
THEN
The transport type is extracted from the designated field position in the M10 segment
Context: An M10 input segment is received containing country information
GIVEN
An M10 input segment is received containing country information
Applied to: Extract Country Code from M10
WHEN
The system processes the M10 segment for country code extraction
THEN
The country code is extracted from the designated field position in the M10 segment
Context: An M10 input segment is received containing vessel information
GIVEN
An M10 input segment is received containing vessel information
Applied to: Extract Vessel Details from M10
WHEN
The system processes the M10 segment for vessel details extraction
THEN
The vessel name and related details are extracted from the designated field positions in the M10 segment
Context: A SCAC code has been extracted from the M10 segment
GIVEN
A SCAC code has been extracted from the M10 segment
Applied to: SCAC Code Valid?
WHEN
The system validates the SCAC code against business rules
THEN
The SCAC code is determined to be valid if it is not spaces and meets format requirements, otherwise it is invalid
Context: The extracted SCAC code has failed validation
GIVEN
The extracted SCAC code has failed validation
Applied to: Set Default SCAC if Invalid
WHEN
The system needs to assign a SCAC code for processing
THEN
A default SCAC code is assigned to ensure processing can continue
Context: A transport type has been extracted from the M10 segment
GIVEN
A transport type has been extracted from the M10 segment
Applied to: Transport Type Valid?
WHEN
The system validates the transport type against acceptable values
THEN
The transport type is determined to be valid if it matches recognized transportation modes, otherwise it is invalid
Context: The extracted transport type has failed validation
GIVEN
The extracted transport type has failed validation
Applied to: Set Default Transport Type
WHEN
The system needs to assign a transport type for processing
THEN
A default transport type is assigned to ensure processing can continue
Context: A country code has been extracted from the M10 segment
GIVEN
A country code has been extracted from the M10 segment
Applied to: Country Code Valid?
WHEN
The system validates the country code against acceptable country codes
THEN
The country code is determined to be valid if it matches recognized country identifiers, otherwise it is invalid
Context: The extracted country code has failed validation
GIVEN
The extracted country code has failed validation
Applied to: Set Default Country Code
WHEN
The system needs to assign a country code for processing
THEN
A default country code is assigned to ensure processing can continue
Context: All required data elements have been extracted and validated from the input
GIVEN
All required data elements have been extracted and validated from the input
Applied to: Construct M10 Manifest Segment
WHEN
The system constructs the M10 manifest segment
THEN
A properly formatted M10 segment is created with all required fields populated
Context: Vessel details have been extracted from the input segment
GIVEN
Vessel details have been extracted from the input segment
Applied to: Populate Vessel Name Field
WHEN
The system populates the vessel name field in the M10 segment
THEN
The vessel name field is set with the extracted vessel name value
Context: A valid or default transport type has been determined
GIVEN
A valid or default transport type has been determined
Applied to: Populate Transport Mode Field
WHEN
The system populates the transport mode field in the M10 segment
THEN
The transport mode field is set with the validated transport type value
Context: A valid or default country code has been determined
GIVEN
A valid or default country code has been determined
Applied to: Populate Country of Origin Field
WHEN
The system populates the country of origin field in the M10 segment
THEN
The country of origin field is set with the validated country code value
Context: A valid or default SCAC code has been determined
GIVEN
A valid or default SCAC code has been determined
Applied to: Populate SCAC Field
WHEN
The system populates the SCAC field in the M10 segment
THEN
The SCAC field is set with the validated SCAC code value
Context: An M10 manifest segment has been constructed with populated fields
GIVEN
An M10 manifest segment has been constructed with populated fields
Applied to: M10 Segment Complete?
WHEN
The system validates the completeness of the M10 segment
THEN
The M10 segment is determined to be complete if all mandatory fields are populated, otherwise it is incomplete
Context: The M10 segment has failed completeness validation
GIVEN
The M10 segment has failed completeness validation
Applied to: Log Incomplete Manifest Warning
WHEN
The system processes the incomplete segment
THEN
A warning message is logged indicating the manifest is incomplete but processing continues
Context: An M10 manifest segment has been constructed and validated
GIVEN
An M10 manifest segment has been constructed and validated
Applied to: Store M10 Manifest Segment
WHEN
The system stores the M10 segment
THEN
The M10 segment is stored in the appropriate data structure for subsequent processing steps
R-GCX016E-cbl-01043 (+18) File: GCX016E.cbl New Cargo Insertion Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'New Cargo Insertion':
  • Context - a new cargo insertion process is initiated:
    For Initialize New Cargo Record:
    When the system begins creating a new cargo record, then a new cargo record structure is initialized with default values and prepared for data population.
  • Context - an x4 segment contains disposition code, entry number, and quantity information:
    For Set Cargo Record with X4 Segment Data:
    When the system processes the x4 segment for new cargo creation, then the cargo record is populated with disposition code, entry number, quantity, and related x4 segment data.
  • Context - an n7 segment contains equipment initial, equipment number, and other equipment details:
    For Set Cargo Record with N7 Segment Data:
    When the system processes the n7 segment for new cargo creation, then the cargo record is populated with equipment initial, equipment number, and other n7 segment equipment data.
  • Context - equipment initial and equipment number are available from n7 segment:
    For Format Car ID for Database:
    When the system needs to create a car id for database storage, then the car id is formatted by combining equipment initial and equipment number in the required database format.
  • Context - a cargo is identified as cprs type:
    For Apply CPRS Special Formatting:
    When the system processes cprs cargo for database insertion, then special cprs formatting is applied including clearing the car id field and applying cprs-specific data formatting.
  • Context - a cargo record is being processed for insertion:
    For CPRS Cargo?:
    When the system evaluates cargo type classification, then the cargo is classified as either cprs or non-cprs based on predefined cargo type criteria.
  • Context - m10 segments contain vessel name, voyage number, and transportation details:
    For Build Foreign Manifest Information from M10 Segments:
    When the system builds foreign manifest information for new cargo, then foreign manifest information is constructed using vessel details, voyage information, and transportation data from m10 segments.
  • Context - carrier information is available from manifest or segment data:
    For Set SCAC Code:
    When the system processes carrier identification for new cargo, then the appropriate scac code is assigned to identify the transportation carrier.
  • Context - transportation mode information is available from manifest segments:
    For Set Transport Type:
    When the system classifies the transportation type for new cargo, then the transport type is set based on the transportation mode indicated in the manifest data.
  • Context - country information is available from manifest or routing data:
    For Set Country Code:
    When the system processes country classification for new cargo, then the appropriate country code is assigned based on origin, destination, or routing country information.
  • Context - vessel information is available from m10 segments or manifest data:
    For Set Vessel Details:
    When the system processes vessel details for new cargo, then vessel name, voyage number, and related vessel transportation details are populated in the cargo record.
  • Context - a cargo record has been populated with segment data:
    For Validate Cargo Record Completeness:
    When the system validates the cargo record before database insertion, then all required fields are verified as populated and meeting business validation requirements.
  • Context - a validated cargo record is ready for database insertion:
    For Call GCCUSIO Database Insert:
    When the system calls the database insert function, then the gccusio database insert operation is executed to create the new cargo record.
  • Context - a database insert operation has been executed:
    For Insert Successful?:
    When the system evaluates the insert operation result, then the insert operation is classified as either successful or failed based on the database response.
  • Context - a cargo record has been successfully inserted into the database:
    For Log Successful Cargo Creation:
    When the system processes the successful insert result, then a log entry is created documenting the successful cargo creation with relevant cargo identifiers.
  • Context - a cargo record has been successfully created:
    For Update Cargo Counters:
    When the system updates processing statistics, then cargo processing counters are incremented to reflect the successful cargo creation.
  • Context - a cargo record has been successfully created and logged:
    For Generate Success Notification:
    When the system generates success notifications, then appropriate notification messages are created and sent to relevant parties or systems.
  • Context - a database insert operation has failed:
    For Log Insert Error:
    When the system processes the failed insert result, then an error log entry is created documenting the insert failure with error details and cargo information.
  • Context - a cargo record insert operation has failed and been logged:
    For Generate Error Message:
    When the system generates error notifications, then appropriate error messages are created and sent to relevant parties or systems with failure details.
👨‍💻 Technical ACs (Gherkin)
Context: A new cargo insertion process is initiated
GIVEN
A new cargo insertion process is initiated
Applied to: Initialize New Cargo Record
WHEN
The system begins creating a new cargo record
THEN
A new cargo record structure is initialized with default values and prepared for data population
Context: An X4 segment contains disposition code, entry number, and quantity information
GIVEN
An X4 segment contains disposition code, entry number, and quantity information
Applied to: Set Cargo Record with X4 Segment Data
WHEN
The system processes the X4 segment for new cargo creation
THEN
The cargo record is populated with disposition code, entry number, quantity, and related X4 segment data
Context: An N7 segment contains equipment initial, equipment number, and other equipment details
GIVEN
An N7 segment contains equipment initial, equipment number, and other equipment details
Applied to: Set Cargo Record with N7 Segment Data
WHEN
The system processes the N7 segment for new cargo creation
THEN
The cargo record is populated with equipment initial, equipment number, and other N7 segment equipment data
Context: Equipment initial and equipment number are available from N7 segment
GIVEN
Equipment initial and equipment number are available from N7 segment
Applied to: Format Car ID for Database
WHEN
The system needs to create a car ID for database storage
THEN
The car ID is formatted by combining equipment initial and equipment number in the required database format
Context: A cargo is identified as CPRS type
GIVEN
A cargo is identified as CPRS type
Applied to: Apply CPRS Special Formatting
WHEN
The system processes CPRS cargo for database insertion
THEN
Special CPRS formatting is applied including clearing the car ID field and applying CPRS-specific data formatting
Context: A cargo record is being processed for insertion
GIVEN
A cargo record is being processed for insertion
Applied to: CPRS Cargo?
WHEN
The system evaluates cargo type classification
THEN
The cargo is classified as either CPRS or non-CPRS based on predefined cargo type criteria
Context: M10 segments contain vessel name, voyage number, and transportation details
GIVEN
M10 segments contain vessel name, voyage number, and transportation details
Applied to: Build Foreign Manifest Information from M10 Segments
WHEN
The system builds foreign manifest information for new cargo
THEN
Foreign manifest information is constructed using vessel details, voyage information, and transportation data from M10 segments
Context: Carrier information is available from manifest or segment data
GIVEN
Carrier information is available from manifest or segment data
Applied to: Set SCAC Code
WHEN
The system processes carrier identification for new cargo
THEN
The appropriate SCAC code is assigned to identify the transportation carrier
Context: Transportation mode information is available from manifest segments
GIVEN
Transportation mode information is available from manifest segments
Applied to: Set Transport Type
WHEN
The system classifies the transportation type for new cargo
THEN
The transport type is set based on the transportation mode indicated in the manifest data
Context: Country information is available from manifest or routing data
GIVEN
Country information is available from manifest or routing data
Applied to: Set Country Code
WHEN
The system processes country classification for new cargo
THEN
The appropriate country code is assigned based on origin, destination, or routing country information
Context: Vessel information is available from M10 segments or manifest data
GIVEN
Vessel information is available from M10 segments or manifest data
Applied to: Set Vessel Details
WHEN
The system processes vessel details for new cargo
THEN
Vessel name, voyage number, and related vessel transportation details are populated in the cargo record
Context: A cargo record has been populated with segment data
GIVEN
A cargo record has been populated with segment data
Applied to: Validate Cargo Record Completeness
WHEN
The system validates the cargo record before database insertion
THEN
All required fields are verified as populated and meeting business validation requirements
Context: A validated cargo record is ready for database insertion
GIVEN
A validated cargo record is ready for database insertion
Applied to: Call GCCUSIO Database Insert
WHEN
The system calls the database insert function
THEN
The GCCUSIO database insert operation is executed to create the new cargo record
Context: A database insert operation has been executed
GIVEN
A database insert operation has been executed
Applied to: Insert Successful?
WHEN
The system evaluates the insert operation result
THEN
The insert operation is classified as either successful or failed based on the database response
Context: A cargo record has been successfully inserted into the database
GIVEN
A cargo record has been successfully inserted into the database
Applied to: Log Successful Cargo Creation
WHEN
The system processes the successful insert result
THEN
A log entry is created documenting the successful cargo creation with relevant cargo identifiers
Context: A cargo record has been successfully created
GIVEN
A cargo record has been successfully created
Applied to: Update Cargo Counters
WHEN
The system updates processing statistics
THEN
Cargo processing counters are incremented to reflect the successful cargo creation
Context: A cargo record has been successfully created and logged
GIVEN
A cargo record has been successfully created and logged
Applied to: Generate Success Notification
WHEN
The system generates success notifications
THEN
Appropriate notification messages are created and sent to relevant parties or systems
Context: A database insert operation has failed
GIVEN
A database insert operation has failed
Applied to: Log Insert Error
WHEN
The system processes the failed insert result
THEN
An error log entry is created documenting the insert failure with error details and cargo information
Context: A cargo record insert operation has failed and been logged
GIVEN
A cargo record insert operation has failed and been logged
Applied to: Generate Error Message
WHEN
The system generates error notifications
THEN
Appropriate error messages are created and sent to relevant parties or systems with failure details
R-GCX016E-cbl-01062 (+12) File: GCX016E.cbl Station Data Lookup Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Data Lookup':
  • Context - a station data lookup request is initiated:
    For Station Type Required?:
    When the system evaluates the station type requirement, then the system routes to either destination station retrieval or key station retrieval based on the station type needed.
  • Context - a destination station lookup is required:
    For Retrieve Destination Station Data:
    When the system processes the destination station request, then the system initiates retrieval of destination station data from the ds table.
  • Context - a key station lookup is required:
    For Retrieve Key Station Data:
    When the system processes the key station request, then the system initiates retrieval of key station data from the ks table.
  • Context - station data retrieval is required from either ds or ks table:
    For Call Generic Table I/O Interface:
    When the system needs to access table data, then the system calls the generic table i/o interface to facilitate data access.
  • Context - destination station data is required:
    For Access DS Table via GCCTBIO:
    When the system executes table access through gcctbio, then the system retrieves data from the ds table containing destination station information.
  • Context - key station data is required:
    For Access KS Table via GCCTBIO:
    When the system executes table access through gcctbio, then the system retrieves data from the ks table containing key station information.
  • Context - a station lookup has been performed on either ds or ks table:
    For Station Found?:
    When the system evaluates the lookup results, then the system determines if the station was found and routes processing accordingly.
  • Context - a station record has been found in the table:
    For Extract Station Information:
    When the system processes the retrieved station data, then the system extracts the relevant station information fields for further processing.
  • Context - station information has been extracted from the table:
    For Validate Location Identifiers:
    When the system validates the location identifiers, then the system ensures location identifiers meet required format and business rules.
  • Context - station information has been validated successfully:
    For Set Station Data Fields:
    When the system processes the validated station data, then the system sets the appropriate station data fields with the retrieved information.
  • Context - a station lookup has been performed:
    For Handle Station Not Found:
    When the requested station is not found in the table, then the system initiates error handling procedures for the missing station.
  • Context - station data processing has been completed (either successfully or with error handling):
    For Return Station Information:
    When the system finalizes the station lookup process, then the system returns the station information or error status to the requesting process.
  • Context - a station lookup error has occurred:
    For Log Station Lookup Error:
    When the system processes the error condition, then the system logs the station lookup error for audit and troubleshooting purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A station data lookup request is initiated
GIVEN
A station data lookup request is initiated
Applied to: Station Type Required?
WHEN
The system evaluates the station type requirement
THEN
The system routes to either destination station retrieval or key station retrieval based on the station type needed
Context: A destination station lookup is required
GIVEN
A destination station lookup is required
Applied to: Retrieve Destination Station Data
WHEN
The system processes the destination station request
THEN
The system initiates retrieval of destination station data from the DS table
Context: A key station lookup is required
GIVEN
A key station lookup is required
Applied to: Retrieve Key Station Data
WHEN
The system processes the key station request
THEN
The system initiates retrieval of key station data from the KS table
Context: Station data retrieval is required from either DS or KS table
GIVEN
Station data retrieval is required from either DS or KS table
Applied to: Call Generic Table I/O Interface
WHEN
The system needs to access table data
THEN
The system calls the generic table I/O interface to facilitate data access
Context: Destination station data is required
GIVEN
Destination station data is required
Applied to: Access DS Table via GCCTBIO
WHEN
The system executes table access through GCCTBIO
THEN
The system retrieves data from the DS table containing destination station information
Context: Key station data is required
GIVEN
Key station data is required
Applied to: Access KS Table via GCCTBIO
WHEN
The system executes table access through GCCTBIO
THEN
The system retrieves data from the KS table containing key station information
Context: A station lookup has been performed on either DS or KS table
GIVEN
A station lookup has been performed on either DS or KS table
Applied to: Station Found?
WHEN
The system evaluates the lookup results
THEN
The system determines if the station was found and routes processing accordingly
Context: A station record has been found in the table
GIVEN
A station record has been found in the table
Applied to: Extract Station Information
WHEN
The system processes the retrieved station data
THEN
The system extracts the relevant station information fields for further processing
Context: Station information has been extracted from the table
GIVEN
Station information has been extracted from the table
Applied to: Validate Location Identifiers
WHEN
The system validates the location identifiers
THEN
The system ensures location identifiers meet required format and business rules
Context: Station information has been validated successfully
GIVEN
Station information has been validated successfully
Applied to: Set Station Data Fields
WHEN
The system processes the validated station data
THEN
The system sets the appropriate station data fields with the retrieved information
Context: A station lookup has been performed
GIVEN
A station lookup has been performed
Applied to: Handle Station Not Found
WHEN
The requested station is not found in the table
THEN
The system initiates error handling procedures for the missing station
Context: Station data processing has been completed (either successfully or with error handling)
GIVEN
Station data processing has been completed (either successfully or with error handling)
Applied to: Return Station Information
WHEN
The system finalizes the station lookup process
THEN
The system returns the station information or error status to the requesting process
Context: A station lookup error has occurred
GIVEN
A station lookup error has occurred
Applied to: Log Station Lookup Error
WHEN
The system processes the error condition
THEN
The system logs the station lookup error for audit and troubleshooting purposes
R-GCX016E-cbl-01075 (+12) File: GCX016E.cbl Destination Station Lookup Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Station Lookup':
  • Context - an x4 segment is being processed for cargo disposition:
    For Extract Location Identifier from X4 Segment:
    When the system needs to identify the destination station, then the location identifier is extracted from the x4 segment data.
  • Context - a location identifier has been extracted from the x4 segment:
    For Location Identifier Present?:
    When the system checks for the presence of the location identifier, then if location identifier is present, proceed with station lookup, otherwise generate station not found error.
  • Context - a valid location identifier exists for station lookup:
    For Set DS Table Type for Lookup:
    When the system prepares to access the destination station table, then the ds table type is set for the generic table interface lookup.
  • Context - the ds table type is configured for station lookup:
    For Call Generic Table I/O Interface - GCCTBIO:
    When the system needs to retrieve station information, then the generic table i/o interface gcctbio is called to access station data.
  • Context - the generic table interface has been called for station lookup:
    For Station Record Found?:
    When the system checks the lookup results, then if station record is found, proceed with station data retrieval, otherwise generate station not found error.
  • Context - a station record has been found in the destination station table:
    For Retrieve Destination Station Information:
    When the system accesses the station record, then the destination station information is retrieved from the table segments.
  • Context - destination station information has been retrieved:
    For Extract Station Name and Routing Data:
    When the system processes the station record data, then the station name and routing data are extracted from the station information.
  • Context - station name and routing data have been extracted:
    For Validate Station Information:
    When the system validates the station information, then the station information is checked for completeness and validity.
  • Context - station information has been validated:
    For Station Valid for Routing?:
    When the system checks station validity for routing, then if station is valid for routing, set station data in working storage, otherwise log station lookup failure.
  • Context - station information is valid for routing operations:
    For Set Station Data in Working Storage:
    When the system needs to store station data for processing, then the station data is set in working storage for cargo processing use.
  • Context - station data has been successfully set in working storage:
    For Log Station Lookup Success:
    When the station lookup operation completes successfully, then a success message is logged for the station lookup operation.
  • Context - either no location identifier is present or station record is not found:
    For Generate Station Not Found Error:
    When the station lookup operation fails, then a station not found error is generated for the cargo processing.
  • Context - station lookup has failed due to invalid station information or station not found:
    For Log Station Lookup Failure:
    When the station lookup operation encounters an error, then a failure message is logged for the station lookup operation.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed for cargo disposition
GIVEN
An X4 segment is being processed for cargo disposition
Applied to: Extract Location Identifier from X4 Segment
WHEN
The system needs to identify the destination station
THEN
The location identifier is extracted from the X4 segment data
Context: A location identifier has been extracted from the X4 segment
GIVEN
A location identifier has been extracted from the X4 segment
Applied to: Location Identifier Present?
WHEN
The system checks for the presence of the location identifier
THEN
If location identifier is present, proceed with station lookup, otherwise generate station not found error
Context: A valid location identifier exists for station lookup
GIVEN
A valid location identifier exists for station lookup
Applied to: Set DS Table Type for Lookup
WHEN
The system prepares to access the destination station table
THEN
The DS table type is set for the generic table interface lookup
Context: The DS table type is configured for station lookup
GIVEN
The DS table type is configured for station lookup
Applied to: Call Generic Table I/O Interface - GCCTBIO
WHEN
The system needs to retrieve station information
THEN
The generic table I/O interface GCCTBIO is called to access station data
Context: The generic table interface has been called for station lookup
GIVEN
The generic table interface has been called for station lookup
Applied to: Station Record Found?
WHEN
The system checks the lookup results
THEN
If station record is found, proceed with station data retrieval, otherwise generate station not found error
Context: A station record has been found in the destination station table
GIVEN
A station record has been found in the destination station table
Applied to: Retrieve Destination Station Information
WHEN
The system accesses the station record
THEN
The destination station information is retrieved from the table segments
Context: Destination station information has been retrieved
GIVEN
Destination station information has been retrieved
Applied to: Extract Station Name and Routing Data
WHEN
The system processes the station record data
THEN
The station name and routing data are extracted from the station information
Context: Station name and routing data have been extracted
GIVEN
Station name and routing data have been extracted
Applied to: Validate Station Information
WHEN
The system validates the station information
THEN
The station information is checked for completeness and validity
Context: Station information has been validated
GIVEN
Station information has been validated
Applied to: Station Valid for Routing?
WHEN
The system checks station validity for routing
THEN
If station is valid for routing, set station data in working storage, otherwise log station lookup failure
Context: Station information is valid for routing operations
GIVEN
Station information is valid for routing operations
Applied to: Set Station Data in Working Storage
WHEN
The system needs to store station data for processing
THEN
The station data is set in working storage for cargo processing use
Context: Station data has been successfully set in working storage
GIVEN
Station data has been successfully set in working storage
Applied to: Log Station Lookup Success
WHEN
The station lookup operation completes successfully
THEN
A success message is logged for the station lookup operation
Context: Either no location identifier is present or station record is not found
GIVEN
Either no location identifier is present or station record is not found
Applied to: Generate Station Not Found Error
WHEN
The station lookup operation fails
THEN
A station not found error is generated for the cargo processing
Context: Station lookup has failed due to invalid station information or station not found
GIVEN
Station lookup has failed due to invalid station information or station not found
Applied to: Log Station Lookup Failure
WHEN
The station lookup operation encounters an error
THEN
A failure message is logged for the station lookup operation
R-GCX016E-cbl-01088 (+8) File: GCX016E.cbl Key Station Lookup Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Key Station Lookup':
  • Context - an x4 segment containing disposition code information is being processed:
    For Extract Location Identifier from X4 Segment:
    When the system needs to validate the location identifier for station lookup, then the location identifier is extracted from the x4 segment and prepared for key station table lookup.
  • Context - a location identifier has been extracted from the x4 segment:
    For Call Generic Table I/O Interface:
    When the system needs to access key station information, then the generic table i/o interface is called to access the ks table via gcctbio.
  • Context - the generic table i/o interface has been called with a location identifier:
    For Access KS Table via GCCTBIO:
    When the system accesses the ks table through gcctbio, then key station information is retrieved from the ks table for the specified location identifier.
  • Context - a key station lookup has been performed using a location identifier:
    For Key Station Found?:
    When the system checks the lookup results, then the system determines if the key station exists and branches processing accordingly.
  • Context - a key station exists in the ks table for the specified location identifier:
    For Retrieve Key Station Information:
    When the system processes the found station record, then key station information is retrieved and made available for further processing.
  • Context - key station information has been retrieved from the ks table:
    For Validate Location Identifier:
    When the system validates the location identifier for business rules compliance, then the location identifier is validated against business requirements and processing rules.
  • Context - the location identifier has been validated successfully:
    For Set Station Data for Processing:
    When the system prepares station data for processing, then station data is set and formatted for use in subsequent business operations.
  • Context - a key station lookup has been performed for a location identifier:
    For Generate Station Not Found Error:
    When the key station is not found in the ks table, then a station not found error is generated and processing continues with error handling.
  • Context - key station lookup processing has completed with either valid station data or error condition:
    For Continue with Validated Station Data:
    When the system continues with subsequent processing steps, then processing continues using the validated station data or appropriate error handling for missing stations.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment containing disposition code information is being processed
GIVEN
An X4 segment containing disposition code information is being processed
Applied to: Extract Location Identifier from X4 Segment
WHEN
The system needs to validate the location identifier for station lookup
THEN
The location identifier is extracted from the X4 segment and prepared for key station table lookup
Context: A location identifier has been extracted from the X4 segment
GIVEN
A location identifier has been extracted from the X4 segment
Applied to: Call Generic Table I/O Interface
WHEN
The system needs to access key station information
THEN
The generic table I/O interface is called to access the KS table via GCCTBIO
Context: The generic table I/O interface has been called with a location identifier
GIVEN
The generic table I/O interface has been called with a location identifier
Applied to: Access KS Table via GCCTBIO
WHEN
The system accesses the KS table through GCCTBIO
THEN
Key station information is retrieved from the KS table for the specified location identifier
Context: A key station lookup has been performed using a location identifier
GIVEN
A key station lookup has been performed using a location identifier
Applied to: Key Station Found?
WHEN
The system checks the lookup results
THEN
The system determines if the key station exists and branches processing accordingly
Context: A key station exists in the KS table for the specified location identifier
GIVEN
A key station exists in the KS table for the specified location identifier
Applied to: Retrieve Key Station Information
WHEN
The system processes the found station record
THEN
Key station information is retrieved and made available for further processing
Context: Key station information has been retrieved from the KS table
GIVEN
Key station information has been retrieved from the KS table
Applied to: Validate Location Identifier
WHEN
The system validates the location identifier for business rules compliance
THEN
The location identifier is validated against business requirements and processing rules
Context: The location identifier has been validated successfully
GIVEN
The location identifier has been validated successfully
Applied to: Set Station Data for Processing
WHEN
The system prepares station data for processing
THEN
Station data is set and formatted for use in subsequent business operations
Context: A key station lookup has been performed for a location identifier
GIVEN
A key station lookup has been performed for a location identifier
Applied to: Generate Station Not Found Error
WHEN
The key station is not found in the KS table
THEN
A station not found error is generated and processing continues with error handling
Context: Key station lookup processing has completed with either valid station data or error condition
GIVEN
Key station lookup processing has completed with either valid station data or error condition
Applied to: Continue with Validated Station Data
WHEN
The system continues with subsequent processing steps
THEN
Processing continues using the validated station data or appropriate error handling for missing stations
R-GCX016E-cbl-01097 (+11) File: GCX016E.cbl Table I/O Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Table I/O Processing':
  • Context - a table lookup request is initiated with specific table type parameters:
    For Table Type?:
    When the system evaluates the table type identifier, then the system routes the request to the appropriate table processing logic (ds for station data, ks for key station data, dc for disposition codes, or broker table for broker information).
  • Context - a request for station data lookup is received with a valid station code:
    For Station Data Lookup - DS Table:
    When the system accesses the ds table in gcstbrt, then the system retrieves the corresponding station information including station name and location details.
  • Context - a request for key station data lookup is received with a station identifier:
    For Key Station Lookup - KS Table:
    When the system accesses the ks table in gcstbrt, then the system retrieves key station operational data and configuration information.
  • Context - a disposition code lookup request is received with a specific disposition code:
    For Disposition Code Lookup - DC Table:
    When the system accesses the dc table in gcstbrt, then the system retrieves disposition code details including processing instructions, status implications, and validation rules.
  • Context - a broker information lookup request is received with broker identification:
    For Broker Information Lookup:
    When the system accesses the broker table in gcst2rt, then the system retrieves broker contact information, credentials, and processing preferences.
  • Context - a table lookup request has been routed to the appropriate table type:
    For Call GCCTBIO Interface:
    When the system needs to perform the actual table access operation, then the system calls the gcctbio interface with the table type and key parameters.
  • Context - a table lookup key is provided for validation:
    For Validate Table Key:
    When the system performs key validation checks, then the system verifies the key format, length, and content validity before proceeding with table access.
  • Context - a validated table key has been used to search the target table:
    For Table Record Found?:
    When the system checks for record existence, then the system returns true if a matching record is found, false if no record exists for the given key.
  • Context - a matching table record has been located:
    For Retrieve Table Data:
    When the system retrieves the record data, then the system extracts all relevant fields and formats them for return to the requesting process.
  • Context - table data has been successfully retrieved and formatted:
    For Return Table Information:
    When the system prepares to return the information, then the system returns the complete table information with success status to the calling process.
  • Context - a table lookup has been performed but no matching record was found:
    For Generate Table Not Found Error:
    When the system needs to handle the not found condition, then the system generates a table not found error with relevant details about the failed lookup.
  • Context - a table lookup operation has failed or no record was found:
    For Return Error Status:
    When the system needs to communicate the failure to the calling process, then the system returns error status with descriptive information about the failure reason.
👨‍💻 Technical ACs (Gherkin)
Context: A table lookup request is initiated with specific table type parameters
GIVEN
A table lookup request is initiated with specific table type parameters
Applied to: Table Type?
WHEN
The system evaluates the table type identifier
THEN
The system routes the request to the appropriate table processing logic (DS for station data, KS for key station data, DC for disposition codes, or broker table for broker information)
Context: A request for station data lookup is received with a valid station code
GIVEN
A request for station data lookup is received with a valid station code
Applied to: Station Data Lookup - DS Table
WHEN
The system accesses the DS table in GCSTBRT
THEN
The system retrieves the corresponding station information including station name and location details
Context: A request for key station data lookup is received with a station identifier
GIVEN
A request for key station data lookup is received with a station identifier
Applied to: Key Station Lookup - KS Table
WHEN
The system accesses the KS table in GCSTBRT
THEN
The system retrieves key station operational data and configuration information
Context: A disposition code lookup request is received with a specific disposition code
GIVEN
A disposition code lookup request is received with a specific disposition code
Applied to: Disposition Code Lookup - DC Table
WHEN
The system accesses the DC table in GCSTBRT
THEN
The system retrieves disposition code details including processing instructions, status implications, and validation rules
Context: A broker information lookup request is received with broker identification
GIVEN
A broker information lookup request is received with broker identification
Applied to: Broker Information Lookup
WHEN
The system accesses the broker table in GCST2RT
THEN
The system retrieves broker contact information, credentials, and processing preferences
Context: A table lookup request has been routed to the appropriate table type
GIVEN
A table lookup request has been routed to the appropriate table type
Applied to: Call GCCTBIO Interface
WHEN
The system needs to perform the actual table access operation
THEN
The system calls the GCCTBIO interface with the table type and key parameters
Context: A table lookup key is provided for validation
GIVEN
A table lookup key is provided for validation
Applied to: Validate Table Key
WHEN
The system performs key validation checks
THEN
The system verifies the key format, length, and content validity before proceeding with table access
Context: A validated table key has been used to search the target table
GIVEN
A validated table key has been used to search the target table
Applied to: Table Record Found?
WHEN
The system checks for record existence
THEN
The system returns true if a matching record is found, false if no record exists for the given key
Context: A matching table record has been located
GIVEN
A matching table record has been located
Applied to: Retrieve Table Data
WHEN
The system retrieves the record data
THEN
The system extracts all relevant fields and formats them for return to the requesting process
Context: Table data has been successfully retrieved and formatted
GIVEN
Table data has been successfully retrieved and formatted
Applied to: Return Table Information
WHEN
The system prepares to return the information
THEN
The system returns the complete table information with success status to the calling process
Context: A table lookup has been performed but no matching record was found
GIVEN
A table lookup has been performed but no matching record was found
Applied to: Generate Table Not Found Error
WHEN
The system needs to handle the not found condition
THEN
The system generates a table not found error with relevant details about the failed lookup
Context: A table lookup operation has failed or no record was found
GIVEN
A table lookup operation has failed or no record was found
Applied to: Return Error Status
WHEN
The system needs to communicate the failure to the calling process
THEN
The system returns error status with descriptive information about the failure reason
R-GCX016E-cbl-01109 (+12) File: GCX016E.cbl Comprehensive Merlin Message Formatting Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Comprehensive Merlin Message Formatting':
  • Context - a cargo record exists in the system with valid equipment and manifest information:
    For Retrieve Cargo Information:
    When the system prepares to format a merlin message for cargo disposition processing, then the system retrieves and formats the car id, waybill number, us-ccn, and associated cargo identification details for message content.
  • Context - cargo equipment information is available including car id and equipment type:
    For Format Equipment Details:
    When the system formats equipment details for merlin message content, then the system includes formatted equipment id, car identification, and equipment type information in the message structure.
  • Context - a disposition code has been processed for a cargo with valid code description available:
    For Add Disposition Code Information:
    When the system adds disposition code information to the merlin message, then the system includes the disposition code, its description, and related processing information in the message content.
  • Context - a disposition code affects cargo release quantities with current and target quantity values available:
    For Calculate Quantity Impact:
    When the system calculates quantity impact for merlin message formatting, then the system determines whether quantities will increase, decrease, or remain unchanged and formats the impact information for the message.
  • Context - k1 segment comments are available for the cargo being processed:
    For Include K1 Free-Form Text:
    When the system checks for k1 comments during merlin message formatting, then the system includes up to 4 lines of k1 free-form text comments in the merlin message content.
  • Context - special processing comments are available for the cargo disposition processing:
    For Add Special Processing Comments:
    When the system adds special processing information to the merlin message, then the system includes up to 3 lines of special comments, processing timestamps, and station/location data in the message.
  • Context - k1 segment comments contain canadian pacific railway identifiers:
    For Bond Creation Scenario?:
    When the system checks for bond creation scenarios during message formatting, then the system identifies cp rail transactions by detecting 'director of customs, cp rail', 'canadian pacific limited', or 'canadian pacific railway co' in k1 comments.
  • Context - a canadian pacific railway transaction has been identified requiring bond creation messaging:
    For Format Canadian Pacific Railway Bond Creation Message:
    When the system formats the cp rail bond creation message, then the system creates a broker bond creation message with cp rail specific formatting and routing information.
  • Context - cargo quantities exist both before and after disposition code processing:
    For Create Before/After Quantity Comparison:
    When the system creates quantity comparison information for the merlin message, then the system formats before and after quantity values to show the impact of disposition code processing on cargo release quantities.
  • Context - disposition code processing has resulted in changes to cargo release quantities:
    For Format Release Quantity Impact Details:
    When the system formats release quantity impact details, then the system creates detailed quantity impact information showing specific changes to released, held, or processed quantities.
  • Context - all message components including cargo details, disposition information, comments, and quantity impacts are available:
    For Compile Complete Message Content:
    When the system compiles the complete message content, then the system assembles all components into a structured merlin message with proper formatting, sequencing, and content organization.
  • Context - a complete merlin message has been compiled with disposition code and cargo information:
    For Set Message Type and Priority:
    When the system sets message type and priority, then the system assigns appropriate message type classification and priority level based on disposition code type, cargo status, and business impact.
  • Context - a complete merlin message with assigned type and priority is ready for distribution:
    For Prepare Message for Distribution:
    When the system prepares the message for distribution, then the system finalizes message routing, determines delivery methods, and prepares the message for transmission to appropriate recipients.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with valid equipment and manifest information
GIVEN
A cargo record exists in the system with valid equipment and manifest information
Applied to: Retrieve Cargo Information
WHEN
The system prepares to format a Merlin message for cargo disposition processing
THEN
The system retrieves and formats the car ID, waybill number, US-CCN, and associated cargo identification details for message content
Context: Cargo equipment information is available including car ID and equipment type
GIVEN
Cargo equipment information is available including car ID and equipment type
Applied to: Format Equipment Details
WHEN
The system formats equipment details for Merlin message content
THEN
The system includes formatted equipment ID, car identification, and equipment type information in the message structure
Context: A disposition code has been processed for a cargo with valid code description available
GIVEN
A disposition code has been processed for a cargo with valid code description available
Applied to: Add Disposition Code Information
WHEN
The system adds disposition code information to the Merlin message
THEN
The system includes the disposition code, its description, and related processing information in the message content
Context: A disposition code affects cargo release quantities with current and target quantity values available
GIVEN
A disposition code affects cargo release quantities with current and target quantity values available
Applied to: Calculate Quantity Impact
WHEN
The system calculates quantity impact for Merlin message formatting
THEN
The system determines whether quantities will increase, decrease, or remain unchanged and formats the impact information for the message
Context: K1 segment comments are available for the cargo being processed
GIVEN
K1 segment comments are available for the cargo being processed
Applied to: Include K1 Free-Form Text
WHEN
The system checks for K1 comments during Merlin message formatting
THEN
The system includes up to 4 lines of K1 free-form text comments in the Merlin message content
Context: Special processing comments are available for the cargo disposition processing
GIVEN
Special processing comments are available for the cargo disposition processing
Applied to: Add Special Processing Comments
WHEN
The system adds special processing information to the Merlin message
THEN
The system includes up to 3 lines of special comments, processing timestamps, and station/location data in the message
Context: K1 segment comments contain Canadian Pacific Railway identifiers
GIVEN
K1 segment comments contain Canadian Pacific Railway identifiers
Applied to: Bond Creation Scenario?
WHEN
The system checks for bond creation scenarios during message formatting
THEN
The system identifies CP Rail transactions by detecting 'DIRECTOR OF CUSTOMS, CP RAIL', 'CANADIAN PACIFIC LIMITED', or 'CANADIAN PACIFIC RAILWAY CO' in K1 comments
Context: A Canadian Pacific Railway transaction has been identified requiring bond creation messaging
GIVEN
A Canadian Pacific Railway transaction has been identified requiring bond creation messaging
Applied to: Format Canadian Pacific Railway Bond Creation Message
WHEN
The system formats the CP Rail bond creation message
THEN
The system creates a broker bond creation message with CP Rail specific formatting and routing information
Context: Cargo quantities exist both before and after disposition code processing
GIVEN
Cargo quantities exist both before and after disposition code processing
Applied to: Create Before/After Quantity Comparison
WHEN
The system creates quantity comparison information for the Merlin message
THEN
The system formats before and after quantity values to show the impact of disposition code processing on cargo release quantities
Context: Disposition code processing has resulted in changes to cargo release quantities
GIVEN
Disposition code processing has resulted in changes to cargo release quantities
Applied to: Format Release Quantity Impact Details
WHEN
The system formats release quantity impact details
THEN
The system creates detailed quantity impact information showing specific changes to released, held, or processed quantities
Context: All message components including cargo details, disposition information, comments, and quantity impacts are available
GIVEN
All message components including cargo details, disposition information, comments, and quantity impacts are available
Applied to: Compile Complete Message Content
WHEN
The system compiles the complete message content
THEN
The system assembles all components into a structured Merlin message with proper formatting, sequencing, and content organization
Context: A complete Merlin message has been compiled with disposition code and cargo information
GIVEN
A complete Merlin message has been compiled with disposition code and cargo information
Applied to: Set Message Type and Priority
WHEN
The system sets message type and priority
THEN
The system assigns appropriate message type classification and priority level based on disposition code type, cargo status, and business impact
Context: A complete Merlin message with assigned type and priority is ready for distribution
GIVEN
A complete Merlin message with assigned type and priority is ready for distribution
Applied to: Prepare Message for Distribution
WHEN
The system prepares the message for distribution
THEN
The system finalizes message routing, determines delivery methods, and prepares the message for transmission to appropriate recipients
R-GCX016E-cbl-01122 (+9) File: GCX016E.cbl Broker Bond Creation Notification Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Bond Creation Notification':
  • Context - a k1 message segment is received for processing:
    For Message Type Check:
    When the system checks the k1 free-form text content for canadian pacific railway identifiers including 'director of customs, cp rail', 'canadian pacific limited', or 'canadian pacific railway co', then the message is classified as a cp rail bond creation request and routed for specialized bond processing.
  • Context - a k1 message segment identified as cp rail bond creation:
    For Extract K1 Free-Form Text:
    When the system processes the k1 segment to extract free-form text content, then the k1 text content is captured and made available for bond validation and notification formatting.
  • Context - k1 text content has been extracted from a cp rail bond creation message:
    For Validate Bond Creation Request:
    When the system validates the bond creation request against broker database information and business rules, then the bond creation request is either approved for notification processing or rejected with appropriate error handling.
  • Context - a validated cp rail bond creation request with extracted k1 text content:
    For Format Bond Creation Notification:
    When the system formats the bond creation notification message including cargo information, processing details, and special comments, then a properly formatted merlin message is created containing all necessary bond creation notification information.
  • Context - a bond creation notification message is being formatted and special comments exist for the cargo:
    For Add Special Comments to Message:
    When the system processes special comments associated with the cargo record, then up to 3 lines of special comments are included in the bond creation notification message.
  • Context - a bond creation notification message is being prepared with validated bond information:
    For Include Processing Details:
    When the system adds processing details including car identification, waybill numbers, us ccn, and processing timestamps, then the notification message contains complete processing context information for the bond creation request.
  • Context - all bond creation notification components have been prepared including special comments and processing details:
    For Create Comprehensive Merlin Message:
    When the system assembles the comprehensive merlin message with all components properly formatted, then a complete merlin message is created ready for routing to appropriate recipients.
  • Context - a comprehensive bond creation merlin message has been created:
    For Route to Appropriate Recipients:
    When the system determines routing based on broker configuration and notification preferences, then the message is routed to the appropriate recipients including brokers, customs officials, and system administrators.
  • Context - a bond creation notification message has been routed to appropriate recipients:
    For Send Bond Creation Notification:
    When the system transmits the notification through the merlin messaging system, then the bond creation notification is successfully delivered to all designated recipients.
  • Context - a bond creation notification has been successfully transmitted:
    For Log Bond Creation Action:
    When the system logs the bond creation action with relevant details and timestamps, then the bond creation action is recorded in the system audit trail for compliance and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 message segment is received for processing
GIVEN
A K1 message segment is received for processing
Applied to: Message Type Check
WHEN
The system checks the K1 free-form text content for Canadian Pacific Railway identifiers including 'DIRECTOR OF CUSTOMS, CP RAIL', 'CANADIAN PACIFIC LIMITED', or 'CANADIAN PACIFIC RAILWAY CO'
THEN
The message is classified as a CP Rail bond creation request and routed for specialized bond processing
Context: A K1 message segment identified as CP Rail bond creation
GIVEN
A K1 message segment identified as CP Rail bond creation
Applied to: Extract K1 Free-Form Text
WHEN
The system processes the K1 segment to extract free-form text content
THEN
The K1 text content is captured and made available for bond validation and notification formatting
Context: K1 text content has been extracted from a CP Rail bond creation message
GIVEN
K1 text content has been extracted from a CP Rail bond creation message
Applied to: Validate Bond Creation Request
WHEN
The system validates the bond creation request against broker database information and business rules
THEN
The bond creation request is either approved for notification processing or rejected with appropriate error handling
Context: A validated CP Rail bond creation request with extracted K1 text content
GIVEN
A validated CP Rail bond creation request with extracted K1 text content
Applied to: Format Bond Creation Notification
WHEN
The system formats the bond creation notification message including cargo information, processing details, and special comments
THEN
A properly formatted Merlin message is created containing all necessary bond creation notification information
Context: A bond creation notification message is being formatted and special comments exist for the cargo
GIVEN
A bond creation notification message is being formatted and special comments exist for the cargo
Applied to: Add Special Comments to Message
WHEN
The system processes special comments associated with the cargo record
THEN
Up to 3 lines of special comments are included in the bond creation notification message
Context: A bond creation notification message is being prepared with validated bond information
GIVEN
A bond creation notification message is being prepared with validated bond information
Applied to: Include Processing Details
WHEN
The system adds processing details including car identification, waybill numbers, US CCN, and processing timestamps
THEN
The notification message contains complete processing context information for the bond creation request
Context: All bond creation notification components have been prepared including special comments and processing details
GIVEN
All bond creation notification components have been prepared including special comments and processing details
Applied to: Create Comprehensive Merlin Message
WHEN
The system assembles the comprehensive Merlin message with all components properly formatted
THEN
A complete Merlin message is created ready for routing to appropriate recipients
Context: A comprehensive bond creation Merlin message has been created
GIVEN
A comprehensive bond creation Merlin message has been created
Applied to: Route to Appropriate Recipients
WHEN
The system determines routing based on broker configuration and notification preferences
THEN
The message is routed to the appropriate recipients including brokers, customs officials, and system administrators
Context: A bond creation notification message has been routed to appropriate recipients
GIVEN
A bond creation notification message has been routed to appropriate recipients
Applied to: Send Bond Creation Notification
WHEN
The system transmits the notification through the Merlin messaging system
THEN
The bond creation notification is successfully delivered to all designated recipients
Context: A bond creation notification has been successfully transmitted
GIVEN
A bond creation notification has been successfully transmitted
Applied to: Log Bond Creation Action
WHEN
The system logs the bond creation action with relevant details and timestamps
THEN
The bond creation action is recorded in the system audit trail for compliance and tracking purposes
R-GCX016E-cbl-01132 (+28) File: GCX016E.cbl Release Quantity Impact Messaging Merged 29 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Quantity Impact Messaging':
  • Context - a cargo record exists with release quantity information:
    For Retrieve Current Cargo Release Quantity:
    When release quantity impact messaging is initiated, then the current cargo release quantity is retrieved and stored for impact calculation.
    For Retrieve Current Cargo Release Quantity:
    When the system needs to calculate quantity impact for disposition code processing, then the current cargo release quantity is retrieved and stored for comparison calculations.
  • Context - a disposition code is being processed:
    For Identify Disposition Code Type:
    When the system needs to determine quantity impact, then the disposition code type and characteristics are identified from the dc table.
  • Context - a disposition code with defined characteristics:
    For Disposition Code Affects Release Quantity?:
    When the system evaluates quantity impact potential, then the system determines if the disposition code affects release quantities based on code type and action flags.
  • Context - a disposition code that affects release quantities and current cargo quantity information:
    For Calculate Quantity Impact:
    When quantity impact calculation is performed, then the system calculates the specific quantity change amount based on disposition code parameters.
  • Context - a disposition code with calculated quantity impact:
    For Determine Add or Subtract Action:
    When the system determines the direction of quantity change, then the system identifies whether the action is to add or subtract from current release quantity based on disposition code action type.
  • Context - a disposition code that increases release quantity and calculated impact amount:
    For Add to Release Quantity:
    When the action type is determined to be addition, then the calculated amount is added to the current release quantity.
  • Context - a disposition code that decreases release quantity and calculated impact amount:
    For Subtract from Release Quantity:
    When the action type is determined to be subtraction, then the calculated amount is subtracted from the current release quantity.
  • Context - current release quantity and calculated quantity impact with determined action:
    For Calculate New Release Quantity:
    When final quantity calculation is performed, then the system calculates the new release quantity by applying the add or subtract action to the current quantity.
  • Context - current release quantity value:
    For Format Before Quantity Display:
    When impact report formatting is performed, then the current quantity is formatted for display as the 'before' value in the impact message.
  • Context - calculated new release quantity value:
    For Format After Quantity Display:
    When impact report formatting is performed, then the new quantity is formatted for display as the 'after' value in the impact message.
  • Context - disposition code information and description from dc table:
    For Format Disposition Code Description:
    When impact message formatting is performed, then the disposition code description is formatted for inclusion in the impact report.
  • Context - formatted before quantity, after quantity, and disposition code description:
    For Create Quantity Impact Message:
    When impact message creation is performed, then the system creates a formatted message showing the quantity impact of the disposition code.
  • Context - created quantity impact message and existing merlin message structure:
    For Include Impact Details in Merlin Message:
    When merlin message assembly is performed, then the quantity impact details are included in the merlin message for stakeholder notification.
  • Context - quantity impact message and available k1 segment comments:
    For Add Special Comments if Available:
    When special comments are available for inclusion, then the system adds up to the maximum allowed special comments to the impact message.
  • Context - all impact message components including quantities, descriptions, and comments:
    For Format Complete Release Impact Report:
    When final report formatting is performed, then the system creates a complete formatted release impact report ready for distribution.
  • Context - a disposition code is being processed for a cargo:
    For Identify Disposition Code Action Type:
    When the system evaluates the disposition code's impact on quantities, then the action type is identified as either quantity addition, quantity subtraction, or no quantity change.
  • Context - a disposition code with defined quantity impact rules:
    For Disposition Code Action?:
    When the system processes the disposition code for quantity calculations, then the system routes to add quantity processing if the code increases release amounts, subtract quantity processing if it decreases amounts, or no change processing if quantities remain the same.
  • Context - a disposition code that adds to cargo release quantities and the current release amount:
    For Calculate Quantity Addition:
    When the system processes a quantity-increasing disposition code, then the additional quantity amount is calculated based on the disposition code rules and cargo specifications.
  • Context - a disposition code that subtracts from cargo release quantities and the current release amount:
    For Calculate Quantity Subtraction:
    When the system processes a quantity-decreasing disposition code, then the subtraction quantity amount is calculated based on the disposition code rules and current cargo quantities.
  • Context - current cargo release quantity and calculated quantity change amount from disposition code processing:
    For Determine New Release Quantity:
    When the system applies the disposition code quantity impact, then the new release quantity is determined by applying the calculated addition, subtraction, or no change to the current quantity.
  • Context - current cargo release quantity retrieved from cargo record:
    For Format Before Quantity Display:
    When the system prepares quantity impact messaging, then the current quantity is formatted for display as the 'before' quantity in impact messages.
  • Context - new release quantity calculated after disposition code processing:
    For Format After Quantity Display:
    When the system prepares quantity impact messaging, then the new quantity is formatted for display as the 'after' quantity in impact messages.
  • Context - formatted before and after quantity displays:
    For Create Quantity Impact Message:
    When the system generates quantity impact messaging, then a quantity impact message is created showing the quantity change from disposition code processing.
  • Context - a quantity impact message and merlin message configuration rules:
    For Include in Merlin Message?:
    When the system evaluates whether to include quantity impact details in merlin notifications, then the system includes impact details in the merlin message if configuration rules require it, otherwise finalizes the message without impact details.
  • Context - a merlin message and quantity impact details that should be included:
    For Add Impact Details to Message:
    When the system processes merlin message formatting with quantity impact inclusion, then the quantity impact details are added to the merlin message content.
  • Context - quantity impact details and disposition code information:
    For Format Complete Impact Statement:
    When the system creates comprehensive impact messaging, then a complete impact statement is formatted showing both the disposition code action and its quantity effects.
  • Context - a quantity impact message and k1 segment comments associated with the cargo:
    For Include K1 Comments if Present:
    When the system finalizes impact messaging and k1 comments exist, then the k1 comments are included in the impact message to provide additional context.
  • Context - all quantity impact message components including before/after quantities, disposition code details, and optional k1 comments:
    For Finalize Release Quantity Impact Message:
    When the system completes quantity impact message processing, then the release quantity impact message is finalized with all components properly formatted and ready for delivery.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with release quantity information
GIVEN
A cargo record exists with release quantity information
Applied to: Retrieve Current Cargo Release Quantity
WHEN
Release quantity impact messaging is initiated
THEN
The current cargo release quantity is retrieved and stored for impact calculation
Applied to: Retrieve Current Cargo Release Quantity
WHEN
The system needs to calculate quantity impact for disposition code processing
THEN
The current cargo release quantity is retrieved and stored for comparison calculations
Context: A disposition code is being processed
GIVEN
A disposition code is being processed
Applied to: Identify Disposition Code Type
WHEN
The system needs to determine quantity impact
THEN
The disposition code type and characteristics are identified from the DC table
Context: A disposition code with defined characteristics
GIVEN
A disposition code with defined characteristics
Applied to: Disposition Code Affects Release Quantity?
WHEN
The system evaluates quantity impact potential
THEN
The system determines if the disposition code affects release quantities based on code type and action flags
Context: A disposition code that affects release quantities and current cargo quantity information
GIVEN
A disposition code that affects release quantities and current cargo quantity information
Applied to: Calculate Quantity Impact
WHEN
Quantity impact calculation is performed
THEN
The system calculates the specific quantity change amount based on disposition code parameters
Context: A disposition code with calculated quantity impact
GIVEN
A disposition code with calculated quantity impact
Applied to: Determine Add or Subtract Action
WHEN
The system determines the direction of quantity change
THEN
The system identifies whether the action is to add or subtract from current release quantity based on disposition code action type
Context: A disposition code that increases release quantity and calculated impact amount
GIVEN
A disposition code that increases release quantity and calculated impact amount
Applied to: Add to Release Quantity
WHEN
The action type is determined to be addition
THEN
The calculated amount is added to the current release quantity
Context: A disposition code that decreases release quantity and calculated impact amount
GIVEN
A disposition code that decreases release quantity and calculated impact amount
Applied to: Subtract from Release Quantity
WHEN
The action type is determined to be subtraction
THEN
The calculated amount is subtracted from the current release quantity
Context: Current release quantity and calculated quantity impact with determined action
GIVEN
Current release quantity and calculated quantity impact with determined action
Applied to: Calculate New Release Quantity
WHEN
Final quantity calculation is performed
THEN
The system calculates the new release quantity by applying the add or subtract action to the current quantity
Context: Current release quantity value
GIVEN
Current release quantity value
Applied to: Format Before Quantity Display
WHEN
Impact report formatting is performed
THEN
The current quantity is formatted for display as the 'before' value in the impact message
Context: Calculated new release quantity value
GIVEN
Calculated new release quantity value
Applied to: Format After Quantity Display
WHEN
Impact report formatting is performed
THEN
The new quantity is formatted for display as the 'after' value in the impact message
Context: Disposition code information and description from DC table
GIVEN
Disposition code information and description from DC table
Applied to: Format Disposition Code Description
WHEN
Impact message formatting is performed
THEN
The disposition code description is formatted for inclusion in the impact report
Context: Formatted before quantity, after quantity, and disposition code description
GIVEN
Formatted before quantity, after quantity, and disposition code description
Applied to: Create Quantity Impact Message
WHEN
Impact message creation is performed
THEN
The system creates a formatted message showing the quantity impact of the disposition code
Context: Created quantity impact message and existing Merlin message structure
GIVEN
Created quantity impact message and existing Merlin message structure
Applied to: Include Impact Details in Merlin Message
WHEN
Merlin message assembly is performed
THEN
The quantity impact details are included in the Merlin message for stakeholder notification
Context: Quantity impact message and available K1 segment comments
GIVEN
Quantity impact message and available K1 segment comments
Applied to: Add Special Comments if Available
WHEN
Special comments are available for inclusion
THEN
The system adds up to the maximum allowed special comments to the impact message
Context: All impact message components including quantities, descriptions, and comments
GIVEN
All impact message components including quantities, descriptions, and comments
Applied to: Format Complete Release Impact Report
WHEN
Final report formatting is performed
THEN
The system creates a complete formatted release impact report ready for distribution
Context: A disposition code is being processed for a cargo
GIVEN
A disposition code is being processed for a cargo
Applied to: Identify Disposition Code Action Type
WHEN
The system evaluates the disposition code's impact on quantities
THEN
The action type is identified as either quantity addition, quantity subtraction, or no quantity change
Context: A disposition code with defined quantity impact rules
GIVEN
A disposition code with defined quantity impact rules
Applied to: Disposition Code Action?
WHEN
The system processes the disposition code for quantity calculations
THEN
The system routes to add quantity processing if the code increases release amounts, subtract quantity processing if it decreases amounts, or no change processing if quantities remain the same
Context: A disposition code that adds to cargo release quantities and the current release amount
GIVEN
A disposition code that adds to cargo release quantities and the current release amount
Applied to: Calculate Quantity Addition
WHEN
The system processes a quantity-increasing disposition code
THEN
The additional quantity amount is calculated based on the disposition code rules and cargo specifications
Context: A disposition code that subtracts from cargo release quantities and the current release amount
GIVEN
A disposition code that subtracts from cargo release quantities and the current release amount
Applied to: Calculate Quantity Subtraction
WHEN
The system processes a quantity-decreasing disposition code
THEN
The subtraction quantity amount is calculated based on the disposition code rules and current cargo quantities
Context: Current cargo release quantity and calculated quantity change amount from disposition code processing
GIVEN
Current cargo release quantity and calculated quantity change amount from disposition code processing
Applied to: Determine New Release Quantity
WHEN
The system applies the disposition code quantity impact
THEN
The new release quantity is determined by applying the calculated addition, subtraction, or no change to the current quantity
Context: Current cargo release quantity retrieved from cargo record
GIVEN
Current cargo release quantity retrieved from cargo record
Applied to: Format Before Quantity Display
WHEN
The system prepares quantity impact messaging
THEN
The current quantity is formatted for display as the 'before' quantity in impact messages
Context: New release quantity calculated after disposition code processing
GIVEN
New release quantity calculated after disposition code processing
Applied to: Format After Quantity Display
WHEN
The system prepares quantity impact messaging
THEN
The new quantity is formatted for display as the 'after' quantity in impact messages
Context: Formatted before and after quantity displays
GIVEN
Formatted before and after quantity displays
Applied to: Create Quantity Impact Message
WHEN
The system generates quantity impact messaging
THEN
A quantity impact message is created showing the quantity change from disposition code processing
Context: A quantity impact message and Merlin message configuration rules
GIVEN
A quantity impact message and Merlin message configuration rules
Applied to: Include in Merlin Message?
WHEN
The system evaluates whether to include quantity impact details in Merlin notifications
THEN
The system includes impact details in the Merlin message if configuration rules require it, otherwise finalizes the message without impact details
Context: A Merlin message and quantity impact details that should be included
GIVEN
A Merlin message and quantity impact details that should be included
Applied to: Add Impact Details to Message
WHEN
The system processes Merlin message formatting with quantity impact inclusion
THEN
The quantity impact details are added to the Merlin message content
Context: Quantity impact details and disposition code information
GIVEN
Quantity impact details and disposition code information
Applied to: Format Complete Impact Statement
WHEN
The system creates comprehensive impact messaging
THEN
A complete impact statement is formatted showing both the disposition code action and its quantity effects
Context: A quantity impact message and K1 segment comments associated with the cargo
GIVEN
A quantity impact message and K1 segment comments associated with the cargo
Applied to: Include K1 Comments if Present
WHEN
The system finalizes impact messaging and K1 comments exist
THEN
The K1 comments are included in the impact message to provide additional context
Context: All quantity impact message components including before/after quantities, disposition code details, and optional K1 comments
GIVEN
All quantity impact message components including before/after quantities, disposition code details, and optional K1 comments
Applied to: Finalize Release Quantity Impact Message
WHEN
The system completes quantity impact message processing
THEN
The release quantity impact message is finalized with all components properly formatted and ready for delivery
R-GCX016E-cbl-01147 (+12) File: GCX016E.cbl Cargo Status Integration Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Integration':
  • Context - a cargo record with equipment information is being processed for gcciis integration:
    For Equipment Type Valid?:
    When the system checks the equipment type against valid categories, then only containers, trailers, and chassis equipment types are allowed to proceed with gcciis integration, all other equipment types are excluded.
  • Context - a cargo record with valid equipment type is ready for gcciis processing:
    For Cargo Status Available?:
    When the system checks for the presence of cargo status information, then integration proceeds only when cargo status data is available, otherwise the integration is skipped.
  • Context - a cargo record with available status information:
    For Map Internal Status to GCCIIS Format:
    When the system processes the internal status code for gcciis transmission, then the internal status is mapped to the corresponding gcciis status format according to predefined conversion rules.
  • Context - a cargo status has been mapped to gcciis format:
    For Status Type?:
    When the system evaluates the status type for routing to appropriate processing logic, then status is classified as hold, release, ptt (proceed to transit), or ptt-ex (proceed to export) based on cargo disposition.
  • Context - a cargo status is classified as a hold type:
    For Map to HOLD Status:
    When the system processes the hold status for gcciis integration, then the status is mapped to hold format with appropriate hold reason codes and location information.
  • Context - a cargo status is classified as a release type:
    For Map to RELEASE Status:
    When the system processes the release status for gcciis integration, then the status is mapped to release format with release authorization and quantity information.
  • Context - a cargo status is classified as proceed to transit:
    For Map to PTT Status:
    When the system processes the ptt status for gcciis integration, then the status is mapped to ptt format with transit authorization and destination information.
  • Context - a cargo status is classified as proceed to export:
    For Map to PTT-EX Status:
    When the system processes the ptt-ex status for gcciis integration, then the status is mapped to ptt-ex format with export authorization and port information.
  • Context - a cargo status has been processed and mapped for gcciis:
    For Release Quantity Check:
    When the system evaluates whether quantity validation is required, then release status types require quantity verification while other status types proceed directly to status update.
  • Context - a cargo with release status requires quantity verification:
    For Verify Released Quantity = Total Quantity:
    When the system compares released quantity against total cargo quantity, then full release notification is sent only when released quantity equals total quantity, otherwise partial release status is maintained.
  • Context - a cargo has been verified as fully released with matching quantities:
    For Send Full Release Notification to GCCIIS:
    When the system sends notification to gcciis, then a full release notification is transmitted with complete cargo and quantity details.
  • Context - a cargo status has been processed and does not require full release verification or quantities do not match:
    For Send Status Update to GCCIIS:
    When the system sends status information to gcciis, then a status update notification is transmitted with current cargo status and relevant details.
  • Context - gcciis notification has been successfully transmitted:
    For Update Equipment Tracking Status:
    When the system updates internal tracking records, then equipment tracking status is updated to reflect the gcciis integration completion and timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with equipment information is being processed for GCCIIS integration
GIVEN
A cargo record with equipment information is being processed for GCCIIS integration
Applied to: Equipment Type Valid?
WHEN
The system checks the equipment type against valid categories
THEN
Only containers, trailers, and chassis equipment types are allowed to proceed with GCCIIS integration, all other equipment types are excluded
Context: A cargo record with valid equipment type is ready for GCCIIS processing
GIVEN
A cargo record with valid equipment type is ready for GCCIIS processing
Applied to: Cargo Status Available?
WHEN
The system checks for the presence of cargo status information
THEN
Integration proceeds only when cargo status data is available, otherwise the integration is skipped
Context: A cargo record with available status information
GIVEN
A cargo record with available status information
Applied to: Map Internal Status to GCCIIS Format
WHEN
The system processes the internal status code for GCCIIS transmission
THEN
The internal status is mapped to the corresponding GCCIIS status format according to predefined conversion rules
Context: A cargo status has been mapped to GCCIIS format
GIVEN
A cargo status has been mapped to GCCIIS format
Applied to: Status Type?
WHEN
The system evaluates the status type for routing to appropriate processing logic
THEN
Status is classified as HOLD, RELEASE, PTT (Proceed to Transit), or PTT-EX (Proceed to Export) based on cargo disposition
Context: A cargo status is classified as a hold type
GIVEN
A cargo status is classified as a hold type
Applied to: Map to HOLD Status
WHEN
The system processes the hold status for GCCIIS integration
THEN
The status is mapped to HOLD format with appropriate hold reason codes and location information
Context: A cargo status is classified as a release type
GIVEN
A cargo status is classified as a release type
Applied to: Map to RELEASE Status
WHEN
The system processes the release status for GCCIIS integration
THEN
The status is mapped to RELEASE format with release authorization and quantity information
Context: A cargo status is classified as Proceed to Transit
GIVEN
A cargo status is classified as Proceed to Transit
Applied to: Map to PTT Status
WHEN
The system processes the PTT status for GCCIIS integration
THEN
The status is mapped to PTT format with transit authorization and destination information
Context: A cargo status is classified as Proceed to Export
GIVEN
A cargo status is classified as Proceed to Export
Applied to: Map to PTT-EX Status
WHEN
The system processes the PTT-EX status for GCCIIS integration
THEN
The status is mapped to PTT-EX format with export authorization and port information
Context: A cargo status has been processed and mapped for GCCIIS
GIVEN
A cargo status has been processed and mapped for GCCIIS
Applied to: Release Quantity Check
WHEN
The system evaluates whether quantity validation is required
THEN
Release status types require quantity verification while other status types proceed directly to status update
Context: A cargo with release status requires quantity verification
GIVEN
A cargo with release status requires quantity verification
Applied to: Verify Released Quantity = Total Quantity
WHEN
The system compares released quantity against total cargo quantity
THEN
Full release notification is sent only when released quantity equals total quantity, otherwise partial release status is maintained
Context: A cargo has been verified as fully released with matching quantities
GIVEN
A cargo has been verified as fully released with matching quantities
Applied to: Send Full Release Notification to GCCIIS
WHEN
The system sends notification to GCCIIS
THEN
A full release notification is transmitted with complete cargo and quantity details
Context: A cargo status has been processed and does not require full release verification or quantities do not match
GIVEN
A cargo status has been processed and does not require full release verification or quantities do not match
Applied to: Send Status Update to GCCIIS
WHEN
The system sends status information to GCCIIS
THEN
A status update notification is transmitted with current cargo status and relevant details
Context: GCCIIS notification has been successfully transmitted
GIVEN
GCCIIS notification has been successfully transmitted
Applied to: Update Equipment Tracking Status
WHEN
The system updates internal tracking records
THEN
Equipment tracking status is updated to reflect the GCCIIS integration completion and timestamp
R-GCX016E-cbl-01160 (+5) File: GCX016E.cbl Freight Forwarder Disposition Code Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Freight Forwarder Disposition Code Validation':
  • Context - a disposition code needs to be validated for freight forwarder processing:
    For Search Broker Database for Freight Forwarder Codes:
    When the system searches the gcst2rt broker database for freight forwarder disposition codes, then the system identifies whether the disposition code exists in the freight forwarder records.
  • Context - a disposition code has been searched in the broker database:
    For Disposition Code Found in Broker Database?:
    When the system evaluates if the disposition code was found in the freight forwarder records, then the system either proceeds with freight forwarder information retrieval or marks it as a standard disposition code.
  • Context - a disposition code has been identified as a freight forwarder code in the broker database:
    For Retrieve Freight Forwarder Information:
    When the system accesses gcsuss03 and gcsuss07 cargo segments to retrieve freight forwarder data, then the system obtains the complete freight forwarder information for further validation.
  • Context - freight forwarder information has been retrieved from cargo segments:
    For Is Valid Freight Forwarder Code?:
    When the system validates the code against freight forwarder records in the broker database, then the system determines if the code represents a valid freight forwarder disposition or should be processed as a standard code.
  • Context - a disposition code has been validated as a legitimate freight forwarder code:
    For Mark Code as Valid Freight Forwarder Disposition:
    When the system marks the code as a valid freight forwarder disposition, then the system sets the freight forwarder processing flag and continues with freight forwarder-specific processing.
  • Context - a disposition code is either not found in the broker database or fails freight forwarder validation:
    For Mark Code as Standard Disposition Code:
    When the system marks the code as a standard disposition code, then the system continues with standard disposition code processing without freight forwarder-specific handling.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code needs to be validated for freight forwarder processing
GIVEN
A disposition code needs to be validated for freight forwarder processing
Applied to: Search Broker Database for Freight Forwarder Codes
WHEN
The system searches the GCST2RT broker database for freight forwarder disposition codes
THEN
The system identifies whether the disposition code exists in the freight forwarder records
Context: A disposition code has been searched in the broker database
GIVEN
A disposition code has been searched in the broker database
Applied to: Disposition Code Found in Broker Database?
WHEN
The system evaluates if the disposition code was found in the freight forwarder records
THEN
The system either proceeds with freight forwarder information retrieval or marks it as a standard disposition code
Context: A disposition code has been identified as a freight forwarder code in the broker database
GIVEN
A disposition code has been identified as a freight forwarder code in the broker database
Applied to: Retrieve Freight Forwarder Information
WHEN
The system accesses GCSUSS03 and GCSUSS07 cargo segments to retrieve freight forwarder data
THEN
The system obtains the complete freight forwarder information for further validation
Context: Freight forwarder information has been retrieved from cargo segments
GIVEN
Freight forwarder information has been retrieved from cargo segments
Applied to: Is Valid Freight Forwarder Code?
WHEN
The system validates the code against freight forwarder records in the broker database
THEN
The system determines if the code represents a valid freight forwarder disposition or should be processed as a standard code
Context: A disposition code has been validated as a legitimate freight forwarder code
GIVEN
A disposition code has been validated as a legitimate freight forwarder code
Applied to: Mark Code as Valid Freight Forwarder Disposition
WHEN
The system marks the code as a valid freight forwarder disposition
THEN
The system sets the freight forwarder processing flag and continues with freight forwarder-specific processing
Context: A disposition code is either not found in the broker database or fails freight forwarder validation
GIVEN
A disposition code is either not found in the broker database or fails freight forwarder validation
Applied to: Mark Code as Standard Disposition Code
WHEN
The system marks the code as a standard disposition code
THEN
The system continues with standard disposition code processing without freight forwarder-specific handling
R-GCX016E-cbl-01166 (+11) File: GCX016E.cbl Cargo Segment Analysis for Freight Forwarders Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Segment Analysis for Freight Forwarders':
  • Context - a cargo requires freight forwarder analysis:
    For Retrieve Cargo Segment Data from GCSUSS03:
    When the system initiates cargo segment retrieval from gcsuss03, then the primary cargo segment data is retrieved from gcsuss03 for further processing.
  • Context - a cargo segment retrieval attempt has been made from gcsuss03:
    For GCSUSS03 Segment Found?:
    When the system checks if gcsuss03 segment data was found, then the system determines if gcsuss03 segment exists and routes processing accordingly.
  • Context - gcsuss03 cargo segment data is available:
    For Extract Freight Forwarder Information from GCSUSS03:
    When the system processes the gcsuss03 segment, then freight forwarder information is extracted from the gcsuss03 segment data.
  • Context - primary cargo segment processing is complete or gcsuss03 segment was not found:
    For Retrieve Additional Cargo Data from GCSUSS07:
    When the system initiates extended cargo data retrieval from gcsuss07, then additional cargo segment data is retrieved from gcsuss07 for enhanced freight forwarder analysis.
  • Context - an extended cargo segment retrieval attempt has been made from gcsuss07:
    For GCSUSS07 Segment Found?:
    When the system checks if gcsuss07 segment data was found, then the system determines if gcsuss07 segment exists and routes processing accordingly.
  • Context - gcsuss07 extended cargo segment data is available:
    For Extract Extended Freight Forwarder Details from GCSUSS07:
    When the system processes the gcsuss07 segment, then extended freight forwarder details are extracted from the gcsuss07 segment data.
  • Context - freight forwarder information has been extracted from available cargo segments:
    For Consolidate Freight Forwarder Information:
    When the system consolidates the extracted freight forwarder data, then all available freight forwarder information is combined into a unified dataset for validation.
  • Context - freight forwarder information has been consolidated from available cargo segments:
    For Validate Freight Forwarder Data Completeness:
    When the system validates the completeness of freight forwarder data, then the system determines if sufficient freight forwarder information exists for further processing.
  • Context - freight forwarder data validation has been completed:
    For Freight Forwarder Identified?:
    When the system evaluates if a freight forwarder has been successfully identified, then the system determines the freight forwarder identification status and routes processing accordingly.
  • Context - a valid freight forwarder has been successfully identified from cargo segment analysis:
    For Set Freight Forwarder Found Flag:
    When the system processes the successful freight forwarder identification, then the freight forwarder found flag is set to indicate successful identification.
  • Context - a freight forwarder has been successfully identified and the found flag has been set:
    For Prepare Freight Forwarder Data for Processing:
    When the system prepares the freight forwarder data for downstream processing, then freight forwarder data is formatted and made available for subsequent business processes.
  • Context - cargo segment analysis has been completed but no valid freight forwarder was identified:
    For Log Freight Forwarder Not Found:
    When the system processes the freight forwarder not found condition, then a freight forwarder not found event is logged for audit and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo requires freight forwarder analysis
GIVEN
A cargo requires freight forwarder analysis
Applied to: Retrieve Cargo Segment Data from GCSUSS03
WHEN
The system initiates cargo segment retrieval from GCSUSS03
THEN
The primary cargo segment data is retrieved from GCSUSS03 for further processing
Context: A cargo segment retrieval attempt has been made from GCSUSS03
GIVEN
A cargo segment retrieval attempt has been made from GCSUSS03
Applied to: GCSUSS03 Segment Found?
WHEN
The system checks if GCSUSS03 segment data was found
THEN
The system determines if GCSUSS03 segment exists and routes processing accordingly
Context: GCSUSS03 cargo segment data is available
GIVEN
GCSUSS03 cargo segment data is available
Applied to: Extract Freight Forwarder Information from GCSUSS03
WHEN
The system processes the GCSUSS03 segment
THEN
Freight forwarder information is extracted from the GCSUSS03 segment data
Context: Primary cargo segment processing is complete or GCSUSS03 segment was not found
GIVEN
Primary cargo segment processing is complete or GCSUSS03 segment was not found
Applied to: Retrieve Additional Cargo Data from GCSUSS07
WHEN
The system initiates extended cargo data retrieval from GCSUSS07
THEN
Additional cargo segment data is retrieved from GCSUSS07 for enhanced freight forwarder analysis
Context: An extended cargo segment retrieval attempt has been made from GCSUSS07
GIVEN
An extended cargo segment retrieval attempt has been made from GCSUSS07
Applied to: GCSUSS07 Segment Found?
WHEN
The system checks if GCSUSS07 segment data was found
THEN
The system determines if GCSUSS07 segment exists and routes processing accordingly
Context: GCSUSS07 extended cargo segment data is available
GIVEN
GCSUSS07 extended cargo segment data is available
Applied to: Extract Extended Freight Forwarder Details from GCSUSS07
WHEN
The system processes the GCSUSS07 segment
THEN
Extended freight forwarder details are extracted from the GCSUSS07 segment data
Context: Freight forwarder information has been extracted from available cargo segments
GIVEN
Freight forwarder information has been extracted from available cargo segments
Applied to: Consolidate Freight Forwarder Information
WHEN
The system consolidates the extracted freight forwarder data
THEN
All available freight forwarder information is combined into a unified dataset for validation
Context: Freight forwarder information has been consolidated from available cargo segments
GIVEN
Freight forwarder information has been consolidated from available cargo segments
Applied to: Validate Freight Forwarder Data Completeness
WHEN
The system validates the completeness of freight forwarder data
THEN
The system determines if sufficient freight forwarder information exists for further processing
Context: Freight forwarder data validation has been completed
GIVEN
Freight forwarder data validation has been completed
Applied to: Freight Forwarder Identified?
WHEN
The system evaluates if a freight forwarder has been successfully identified
THEN
The system determines the freight forwarder identification status and routes processing accordingly
Context: A valid freight forwarder has been successfully identified from cargo segment analysis
GIVEN
A valid freight forwarder has been successfully identified from cargo segment analysis
Applied to: Set Freight Forwarder Found Flag
WHEN
The system processes the successful freight forwarder identification
THEN
The freight forwarder found flag is set to indicate successful identification
Context: A freight forwarder has been successfully identified and the found flag has been set
GIVEN
A freight forwarder has been successfully identified and the found flag has been set
Applied to: Prepare Freight Forwarder Data for Processing
WHEN
The system prepares the freight forwarder data for downstream processing
THEN
Freight forwarder data is formatted and made available for subsequent business processes
Context: Cargo segment analysis has been completed but no valid freight forwarder was identified
GIVEN
Cargo segment analysis has been completed but no valid freight forwarder was identified
Applied to: Log Freight Forwarder Not Found
WHEN
The system processes the freight forwarder not found condition
THEN
A freight forwarder not found event is logged for audit and tracking purposes
R-GCX016E-cbl-01178 (+10) File: GCX016E.cbl Freight Forwarder Information Retrieval Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Freight Forwarder Information Retrieval':
  • Context - a disposition code is being processed for cargo:
    For Search Broker Database for Freight Forwarder Disposition Codes:
    When the system searches the broker table segments for freight forwarder disposition codes, then the system identifies whether the disposition code is associated with a freight forwarder.
  • Context - the broker table search for freight forwarder disposition codes has been completed:
    For Freight Forwarder Code Found?:
    When the system evaluates the search results, then the system determines if a freight forwarder code was found and proceeds with appropriate processing path.
  • Context - a freight forwarder code has been found in the broker table:
    For Retrieve Cargo Segment Data from GCSUSS03:
    When the system needs cargo segment information for freight forwarder processing, then the system retrieves cargo segment data from gcsuss03 database.
  • Context - primary cargo segment data has been retrieved from gcsuss03:
    For Retrieve Additional Cargo Data from GCSUSS07:
    When the system requires additional cargo information for freight forwarder processing, then the system retrieves additional cargo data from gcsuss07 database.
  • Context - cargo segment data has been retrieved from both gcsuss03 and gcsuss07:
    For Extract Freight Forwarder Information from Cargo Segments:
    When the system processes the cargo segment data, then the system extracts freight forwarder identification and related information from the cargo segments.
  • Context - freight forwarder information has been extracted from cargo segments:
    For Lookup Freight Forwarder Name in Broker Tables:
    When the system needs to resolve the freight forwarder name, then the system looks up the freight forwarder name in the gcst2rt broker name segments table.
  • Context - the freight forwarder name has been successfully looked up in broker tables:
    For Retrieve Associated Broker Information:
    When the system requires complete broker information for the freight forwarder, then the system retrieves associated broker information from the gcstbrt broker table segments.
  • Context - associated broker information has been retrieved for the freight forwarder:
    For Get Freight Forwarder Contact Details:
    When the system needs contact information for freight forwarder notifications, then the system retrieves freight forwarder contact details including email addresses and communication preferences from broker table segments.
  • Context - all freight forwarder information components have been retrieved including name, broker details, and contact information:
    For Compile Complete Freight Forwarder Profile:
    When the system needs to create a complete freight forwarder profile, then the system compiles all retrieved information into a comprehensive freight forwarder profile.
  • Context - a complete freight forwarder profile has been compiled:
    For Return Freight Forwarder Information:
    When the freight forwarder information retrieval process is complete, then the system returns the complete freight forwarder information for use in cargo processing and notifications.
  • Context - no freight forwarder code was found during the broker table search:
    For No Freight Forwarder Information Available:
    When the system cannot locate freight forwarder information for the disposition code, then the system indicates that no freight forwarder information is available and continues processing without freight forwarder-specific actions.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo
GIVEN
A disposition code is being processed for cargo
Applied to: Search Broker Database for Freight Forwarder Disposition Codes
WHEN
The system searches the broker table segments for freight forwarder disposition codes
THEN
The system identifies whether the disposition code is associated with a freight forwarder
Context: The broker table search for freight forwarder disposition codes has been completed
GIVEN
The broker table search for freight forwarder disposition codes has been completed
Applied to: Freight Forwarder Code Found?
WHEN
The system evaluates the search results
THEN
The system determines if a freight forwarder code was found and proceeds with appropriate processing path
Context: A freight forwarder code has been found in the broker table
GIVEN
A freight forwarder code has been found in the broker table
Applied to: Retrieve Cargo Segment Data from GCSUSS03
WHEN
The system needs cargo segment information for freight forwarder processing
THEN
The system retrieves cargo segment data from GCSUSS03 database
Context: Primary cargo segment data has been retrieved from GCSUSS03
GIVEN
Primary cargo segment data has been retrieved from GCSUSS03
Applied to: Retrieve Additional Cargo Data from GCSUSS07
WHEN
The system requires additional cargo information for freight forwarder processing
THEN
The system retrieves additional cargo data from GCSUSS07 database
Context: Cargo segment data has been retrieved from both GCSUSS03 and GCSUSS07
GIVEN
Cargo segment data has been retrieved from both GCSUSS03 and GCSUSS07
Applied to: Extract Freight Forwarder Information from Cargo Segments
WHEN
The system processes the cargo segment data
THEN
The system extracts freight forwarder identification and related information from the cargo segments
Context: Freight forwarder information has been extracted from cargo segments
GIVEN
Freight forwarder information has been extracted from cargo segments
Applied to: Lookup Freight Forwarder Name in Broker Tables
WHEN
The system needs to resolve the freight forwarder name
THEN
The system looks up the freight forwarder name in the GCST2RT broker name segments table
Context: The freight forwarder name has been successfully looked up in broker tables
GIVEN
The freight forwarder name has been successfully looked up in broker tables
Applied to: Retrieve Associated Broker Information
WHEN
The system requires complete broker information for the freight forwarder
THEN
The system retrieves associated broker information from the GCSTBRT broker table segments
Context: Associated broker information has been retrieved for the freight forwarder
GIVEN
Associated broker information has been retrieved for the freight forwarder
Applied to: Get Freight Forwarder Contact Details
WHEN
The system needs contact information for freight forwarder notifications
THEN
The system retrieves freight forwarder contact details including email addresses and communication preferences from broker table segments
Context: All freight forwarder information components have been retrieved including name, broker details, and contact information
GIVEN
All freight forwarder information components have been retrieved including name, broker details, and contact information
Applied to: Compile Complete Freight Forwarder Profile
WHEN
The system needs to create a complete freight forwarder profile
THEN
The system compiles all retrieved information into a comprehensive freight forwarder profile
Context: A complete freight forwarder profile has been compiled
GIVEN
A complete freight forwarder profile has been compiled
Applied to: Return Freight Forwarder Information
WHEN
The freight forwarder information retrieval process is complete
THEN
The system returns the complete freight forwarder information for use in cargo processing and notifications
Context: No freight forwarder code was found during the broker table search
GIVEN
No freight forwarder code was found during the broker table search
Applied to: No Freight Forwarder Information Available
WHEN
The system cannot locate freight forwarder information for the disposition code
THEN
The system indicates that no freight forwarder information is available and continues processing without freight forwarder-specific actions
R-GCX016E-cbl-01189 (+15) File: GCX016E.cbl Freight Forwarder Contact Information Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Freight Forwarder Contact Information':
  • Context - a cargo record exists with segment data:
    For Retrieve Freight Forwarder Information from Cargo Segments:
    When the system processes freight forwarder contact information retrieval, then the freight forwarder code is extracted from the cargo segments for further processing.
  • Context - cargo segment data has been retrieved:
    For Freight Forwarder Code Found?:
    When the system checks for freight forwarder code presence, then if freight forwarder code exists, proceed to name lookup; otherwise log no code found and end process.
  • Context - a valid freight forwarder code exists:
    For Look up Freight Forwarder Name in Broker Database:
    When the system performs a lookup in the gcst2rt broker name segments, then the corresponding freight forwarder name is retrieved from the database.
  • Context - a lookup has been performed in the broker name database:
    For Freight Forwarder Name Found?:
    When the system checks the lookup results, then if freight forwarder name is found, proceed to retrieve broker information; otherwise log name not found and end process.
  • Context - a valid freight forwarder name has been found:
    For Retrieve Associated Broker Information:
    When the system retrieves associated broker information, then the broker details linked to the freight forwarder are obtained for email address lookup.
  • Context - a freight forwarder name has been found in the database:
    For Broker Information Available?:
    When the system checks for associated broker information, then if broker information is available, proceed to fetch email address; otherwise log no broker information and end process.
  • Context - valid broker information is available:
    For Fetch Email Address from Broker Table:
    When the system accesses the gcstbrt broker table segments, then the email address associated with the broker is retrieved from the table.
  • Context - a lookup has been performed in the broker table:
    For Email Address Found?:
    When the system checks if an email address was found, then if email address exists, proceed to validation; otherwise log no email address found and end process.
  • Context - an email address has been retrieved from the broker table:
    For Validate Email Address Format:
    When the system validates the email address format, then the email address format is checked for validity according to standard email formatting rules.
  • Context - email address format validation has been performed:
    For Email Valid?:
    When the system evaluates the validation results, then if email format is valid, store for notification; otherwise log invalid format and end process.
  • Context - a valid email address has been confirmed:
    For Store Email Address for Notification:
    When the system stores the email address, then the email address is saved for subsequent notification processing.
  • Context - cargo segment data has been processed:
    For Log: No Freight Forwarder Code Found:
    When no freight forwarder code is found in the data, then a log entry is created indicating no freight forwarder code was found.
  • Context - a freight forwarder code exists but name lookup has been performed:
    For Log: Freight Forwarder Name Not Found:
    When the freight forwarder name is not found in the broker database, then a log entry is created indicating the freight forwarder name was not found.
  • Context - a freight forwarder name has been found:
    For Log: No Broker Information Available:
    When no associated broker information is available, then a log entry is created indicating no broker information is available.
  • Context - broker information is available and email lookup has been performed:
    For Log: No Email Address Found:
    When no email address is found in the broker table, then a log entry is created indicating no email address was found.
  • Context - an email address has been retrieved and format validation performed:
    For Log: Invalid Email Format:
    When the email address format is determined to be invalid, then a log entry is created indicating the email format is invalid.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with segment data
GIVEN
A cargo record exists with segment data
Applied to: Retrieve Freight Forwarder Information from Cargo Segments
WHEN
The system processes freight forwarder contact information retrieval
THEN
The freight forwarder code is extracted from the cargo segments for further processing
Context: Cargo segment data has been retrieved
GIVEN
Cargo segment data has been retrieved
Applied to: Freight Forwarder Code Found?
WHEN
The system checks for freight forwarder code presence
THEN
If freight forwarder code exists, proceed to name lookup; otherwise log no code found and end process
Context: A valid freight forwarder code exists
GIVEN
A valid freight forwarder code exists
Applied to: Look up Freight Forwarder Name in Broker Database
WHEN
The system performs a lookup in the GCST2RT broker name segments
THEN
The corresponding freight forwarder name is retrieved from the database
Context: A lookup has been performed in the broker name database
GIVEN
A lookup has been performed in the broker name database
Applied to: Freight Forwarder Name Found?
WHEN
The system checks the lookup results
THEN
If freight forwarder name is found, proceed to retrieve broker information; otherwise log name not found and end process
Context: A valid freight forwarder name has been found
GIVEN
A valid freight forwarder name has been found
Applied to: Retrieve Associated Broker Information
WHEN
The system retrieves associated broker information
THEN
The broker details linked to the freight forwarder are obtained for email address lookup
Context: A freight forwarder name has been found in the database
GIVEN
A freight forwarder name has been found in the database
Applied to: Broker Information Available?
WHEN
The system checks for associated broker information
THEN
If broker information is available, proceed to fetch email address; otherwise log no broker information and end process
Context: Valid broker information is available
GIVEN
Valid broker information is available
Applied to: Fetch Email Address from Broker Table
WHEN
The system accesses the GCSTBRT broker table segments
THEN
The email address associated with the broker is retrieved from the table
Context: A lookup has been performed in the broker table
GIVEN
A lookup has been performed in the broker table
Applied to: Email Address Found?
WHEN
The system checks if an email address was found
THEN
If email address exists, proceed to validation; otherwise log no email address found and end process
Context: An email address has been retrieved from the broker table
GIVEN
An email address has been retrieved from the broker table
Applied to: Validate Email Address Format
WHEN
The system validates the email address format
THEN
The email address format is checked for validity according to standard email formatting rules
Context: Email address format validation has been performed
GIVEN
Email address format validation has been performed
Applied to: Email Valid?
WHEN
The system evaluates the validation results
THEN
If email format is valid, store for notification; otherwise log invalid format and end process
Context: A valid email address has been confirmed
GIVEN
A valid email address has been confirmed
Applied to: Store Email Address for Notification
WHEN
The system stores the email address
THEN
The email address is saved for subsequent notification processing
Context: Cargo segment data has been processed
GIVEN
Cargo segment data has been processed
Applied to: Log: No Freight Forwarder Code Found
WHEN
No freight forwarder code is found in the data
THEN
A log entry is created indicating no freight forwarder code was found
Context: A freight forwarder code exists but name lookup has been performed
GIVEN
A freight forwarder code exists but name lookup has been performed
Applied to: Log: Freight Forwarder Name Not Found
WHEN
The freight forwarder name is not found in the broker database
THEN
A log entry is created indicating the freight forwarder name was not found
Context: A freight forwarder name has been found
GIVEN
A freight forwarder name has been found
Applied to: Log: No Broker Information Available
WHEN
No associated broker information is available
THEN
A log entry is created indicating no broker information is available
Context: Broker information is available and email lookup has been performed
GIVEN
Broker information is available and email lookup has been performed
Applied to: Log: No Email Address Found
WHEN
No email address is found in the broker table
THEN
A log entry is created indicating no email address was found
Context: An email address has been retrieved and format validation performed
GIVEN
An email address has been retrieved and format validation performed
Applied to: Log: Invalid Email Format
WHEN
The email address format is determined to be invalid
THEN
A log entry is created indicating the email format is invalid
R-GCX016E-cbl-01205 (+23) File: GCX016E.cbl CIH Hold Email Notification Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CIH Hold Email Notification':
  • Context - a disposition code is being processed for cargo:
    For Is Disposition Code CIH?:
    When the system checks the disposition code value, then if the disposition code equals 'cih', proceed with email notification processing, otherwise skip email notification.
    For Skip Email - No CIH Code:
    When the disposition code is not equal to 'cih', then the system skips all email notification processing and completes the notification process.
  • Context - a cih disposition code has been identified for cargo:
    For Search Broker Database for Freight Forwarder:
    When the system searches the broker name table for freight forwarder disposition codes, then the system retrieves freight forwarder information from the broker database if available.
  • Context - the system has searched the broker database for freight forwarder information:
    For Freight Forwarder Found?:
    When the search results are evaluated, then if a freight forwarder is found, continue with cargo data retrieval, otherwise complete email notification process without sending email.
  • Context - a freight forwarder has been found for the cargo:
    For Retrieve Cargo Segment Data:
    When the system accesses cargo secondary data segments, then the system retrieves forwarder and consignee information from cargo segments gcsuss03 and gcsuss07.
  • Context - cargo segment data has been successfully retrieved:
    For Extract Freight Forwarder Information:
    When the system processes the cargo segment information, then the system extracts freight forwarder identification and contact details from the cargo segments.
  • Context - freight forwarder information has been extracted from cargo segments:
    For Lookup Freight Forwarder Name and Broker Info:
    When the system performs a lookup in the broker name segments table (gcst2rt), then the system retrieves the freight forwarder name and associated broker information.
  • Context - freight forwarder name and broker information lookup has been completed:
    For Valid Freight Forwarder?:
    When the system validates the retrieved freight forwarder data, then if the freight forwarder information is valid and complete, proceed with email address retrieval, otherwise complete notification process without sending email.
  • Context - a valid freight forwarder has been identified:
    For Retrieve Email Address from Broker Table:
    When the system accesses the broker table segments (gcstbrt), then the system retrieves the email address associated with the freight forwarder.
  • Context - the system has attempted to retrieve an email address from the broker table:
    For Email Address Found?:
    When the email address retrieval results are evaluated, then if a valid email address is found, proceed with email content building, otherwise complete notification process without sending email.
  • Context - a valid email address has been found for the freight forwarder:
    For Build Comprehensive Email Content:
    When the system builds the email notification content, then the system creates comprehensive email content including equipment information, waybill details, ccn information, content description, origin/destination stations, cih disposition information, and processing timestamps.
  • Context - email content building has started for cih notification:
    For Include Equipment Information:
    When the system processes equipment data for the email, then the system includes equipment type, identification, and related details in the email content.
  • Context - equipment information has been included in the email content:
    For Include Waybill and CCN Details:
    When the system processes waybill and ccn information, then the system includes waybill number and ccn details in the email notification content.
  • Context - waybill and ccn details have been included in the email content:
    For Include Content Description:
    When the system processes cargo content description data, then the system includes detailed cargo content description in the email notification.
  • Context - content description has been included in the email content:
    For Include Origin/Destination Stations:
    When the system processes origin and destination station data, then the system includes origin and destination station names and codes in the email notification.
  • Context - origin and destination station information has been included in the email content:
    For Include CIH Disposition Information:
    When the system processes cih disposition information, then the system includes cih disposition code details, hold reasons, and related customs information in the email notification.
  • Context - cih disposition information has been included in the email content:
    For Include Processing Timestamps:
    When the system processes timestamp information, then the system includes processing date, time, and relevant timestamps in the email notification content.
  • Context - comprehensive email content has been built with all required information:
    For Send Email Notification:
    When the system attempts to send the email notification, then the system transmits the email to the freight forwarder's email address and captures delivery status.
  • Context - an email notification has been sent to the freight forwarder:
    For Email Delivery Successful?:
    When the system evaluates the email delivery status, then if email delivery is successful, log successful delivery, otherwise initiate retry process.
  • Context - email notification has been successfully delivered:
    For Log Successful Email Delivery:
    When the system processes the successful delivery status, then the system logs the successful email delivery with timestamp and recipient information.
  • Context - email notification delivery has failed:
    For Retry Email Delivery:
    When the system initiates retry processing, then the system attempts to resend the email notification and tracks retry attempts.
  • Context - email delivery retry has been attempted:
    For Retry Limit Reached?:
    When the system checks the retry attempt count against the maximum limit, then if retry limit has not been reached, attempt delivery again, otherwise log delivery failure and route to error handler.
  • Context - email delivery retry limit has been reached without successful delivery:
    For Log Email Delivery Failure:
    When the system processes the final delivery failure, then the system logs the email delivery failure with error details and retry attempt information.
  • Context - email delivery has failed after maximum retry attempts:
    For Route to Error Handler:
    When the system routes to error handling, then the system invokes error handler to process alternative notification methods such as routing to backup recipients (aei9999, om01247).
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo
GIVEN
A disposition code is being processed for cargo
Applied to: Is Disposition Code CIH?
WHEN
The system checks the disposition code value
THEN
If the disposition code equals 'CIH', proceed with email notification processing, otherwise skip email notification
Applied to: Skip Email - No CIH Code
WHEN
The disposition code is not equal to 'CIH'
THEN
The system skips all email notification processing and completes the notification process
Context: A CIH disposition code has been identified for cargo
GIVEN
A CIH disposition code has been identified for cargo
Applied to: Search Broker Database for Freight Forwarder
WHEN
The system searches the broker name table for freight forwarder disposition codes
THEN
The system retrieves freight forwarder information from the broker database if available
Context: The system has searched the broker database for freight forwarder information
GIVEN
The system has searched the broker database for freight forwarder information
Applied to: Freight Forwarder Found?
WHEN
The search results are evaluated
THEN
If a freight forwarder is found, continue with cargo data retrieval, otherwise complete email notification process without sending email
Context: A freight forwarder has been found for the cargo
GIVEN
A freight forwarder has been found for the cargo
Applied to: Retrieve Cargo Segment Data
WHEN
The system accesses cargo secondary data segments
THEN
The system retrieves forwarder and consignee information from cargo segments GCSUSS03 and GCSUSS07
Context: Cargo segment data has been successfully retrieved
GIVEN
Cargo segment data has been successfully retrieved
Applied to: Extract Freight Forwarder Information
WHEN
The system processes the cargo segment information
THEN
The system extracts freight forwarder identification and contact details from the cargo segments
Context: Freight forwarder information has been extracted from cargo segments
GIVEN
Freight forwarder information has been extracted from cargo segments
Applied to: Lookup Freight Forwarder Name and Broker Info
WHEN
The system performs a lookup in the broker name segments table (GCST2RT)
THEN
The system retrieves the freight forwarder name and associated broker information
Context: Freight forwarder name and broker information lookup has been completed
GIVEN
Freight forwarder name and broker information lookup has been completed
Applied to: Valid Freight Forwarder?
WHEN
The system validates the retrieved freight forwarder data
THEN
If the freight forwarder information is valid and complete, proceed with email address retrieval, otherwise complete notification process without sending email
Context: A valid freight forwarder has been identified
GIVEN
A valid freight forwarder has been identified
Applied to: Retrieve Email Address from Broker Table
WHEN
The system accesses the broker table segments (GCSTBRT)
THEN
The system retrieves the email address associated with the freight forwarder
Context: The system has attempted to retrieve an email address from the broker table
GIVEN
The system has attempted to retrieve an email address from the broker table
Applied to: Email Address Found?
WHEN
The email address retrieval results are evaluated
THEN
If a valid email address is found, proceed with email content building, otherwise complete notification process without sending email
Context: A valid email address has been found for the freight forwarder
GIVEN
A valid email address has been found for the freight forwarder
Applied to: Build Comprehensive Email Content
WHEN
The system builds the email notification content
THEN
The system creates comprehensive email content including equipment information, waybill details, CCN information, content description, origin/destination stations, CIH disposition information, and processing timestamps
Context: Email content building has started for CIH notification
GIVEN
Email content building has started for CIH notification
Applied to: Include Equipment Information
WHEN
The system processes equipment data for the email
THEN
The system includes equipment type, identification, and related details in the email content
Context: Equipment information has been included in the email content
GIVEN
Equipment information has been included in the email content
Applied to: Include Waybill and CCN Details
WHEN
The system processes waybill and CCN information
THEN
The system includes waybill number and CCN details in the email notification content
Context: Waybill and CCN details have been included in the email content
GIVEN
Waybill and CCN details have been included in the email content
Applied to: Include Content Description
WHEN
The system processes cargo content description data
THEN
The system includes detailed cargo content description in the email notification
Context: Content description has been included in the email content
GIVEN
Content description has been included in the email content
Applied to: Include Origin/Destination Stations
WHEN
The system processes origin and destination station data
THEN
The system includes origin and destination station names and codes in the email notification
Context: Origin and destination station information has been included in the email content
GIVEN
Origin and destination station information has been included in the email content
Applied to: Include CIH Disposition Information
WHEN
The system processes CIH disposition information
THEN
The system includes CIH disposition code details, hold reasons, and related customs information in the email notification
Context: CIH disposition information has been included in the email content
GIVEN
CIH disposition information has been included in the email content
Applied to: Include Processing Timestamps
WHEN
The system processes timestamp information
THEN
The system includes processing date, time, and relevant timestamps in the email notification content
Context: Comprehensive email content has been built with all required information
GIVEN
Comprehensive email content has been built with all required information
Applied to: Send Email Notification
WHEN
The system attempts to send the email notification
THEN
The system transmits the email to the freight forwarder's email address and captures delivery status
Context: An email notification has been sent to the freight forwarder
GIVEN
An email notification has been sent to the freight forwarder
Applied to: Email Delivery Successful?
WHEN
The system evaluates the email delivery status
THEN
If email delivery is successful, log successful delivery, otherwise initiate retry process
Context: Email notification has been successfully delivered
GIVEN
Email notification has been successfully delivered
Applied to: Log Successful Email Delivery
WHEN
The system processes the successful delivery status
THEN
The system logs the successful email delivery with timestamp and recipient information
Context: Email notification delivery has failed
GIVEN
Email notification delivery has failed
Applied to: Retry Email Delivery
WHEN
The system initiates retry processing
THEN
The system attempts to resend the email notification and tracks retry attempts
Context: Email delivery retry has been attempted
GIVEN
Email delivery retry has been attempted
Applied to: Retry Limit Reached?
WHEN
The system checks the retry attempt count against the maximum limit
THEN
If retry limit has not been reached, attempt delivery again, otherwise log delivery failure and route to error handler
Context: Email delivery retry limit has been reached without successful delivery
GIVEN
Email delivery retry limit has been reached without successful delivery
Applied to: Log Email Delivery Failure
WHEN
The system processes the final delivery failure
THEN
The system logs the email delivery failure with error details and retry attempt information
Context: Email delivery has failed after maximum retry attempts
GIVEN
Email delivery has failed after maximum retry attempts
Applied to: Route to Error Handler
WHEN
The system routes to error handling
THEN
The system invokes error handler to process alternative notification methods such as routing to backup recipients (AEI9999, OM01247)
R-GCX016E-cbl-01229 (+8) File: GCX016E.cbl Email Distribution Management Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email Distribution Management':
  • Context - an email distribution request is received with recipient information:
    For Validate Email Recipients:
    When the system validates the email recipients, then the system determines if recipients are valid based on configuration and proceeds with email preparation or routes to default recipient.
  • Context - email message is prepared with valid recipients:
    For Attempt Email Delivery:
    When the system attempts email delivery, then the system executes email delivery process and returns delivery status.
  • Context - email delivery attempt was made:
    For Log Successful Delivery:
    When the delivery is successful, then the system logs successful delivery and completes the email distribution process.
  • Context - email delivery attempt failed:
    For Increment Retry Counter:
    When the delivery is not successful, then the system increments the retry counter to track delivery attempts.
  • Context - email delivery has failed and retry counter has been incremented:
    For Retry Limit Reached?:
    When the system checks if retry limit is reached, then the system determines whether to attempt another retry or log delivery failure based on retry limit configuration.
  • Context - email delivery failed and retry limit has not been reached:
    For Wait for Retry Interval:
    When the system processes retry interval, then the system waits for the configured retry interval before attempting delivery again.
  • Context - email delivery has failed and retry limit has been reached:
    For Log Delivery Failure:
    When the system processes the final delivery failure, then the system logs the delivery failure for audit and troubleshooting purposes.
  • Context - email delivery has failed completely or recipients are invalid:
    For Route to Default Recipient:
    When the system routes to default recipient, then the system sends the email to configured default recipient as fallback delivery method.
  • Context - email has been routed to default recipient due to delivery failure or invalid recipients:
    For Generate Error Notification:
    When the system generates error notification, then the system creates error notification message indicating the delivery issue and fallback action taken.
👨‍💻 Technical ACs (Gherkin)
Context: An email distribution request is received with recipient information
GIVEN
An email distribution request is received with recipient information
Applied to: Validate Email Recipients
WHEN
The system validates the email recipients
THEN
The system determines if recipients are valid based on configuration and proceeds with email preparation or routes to default recipient
Context: Email message is prepared with valid recipients
GIVEN
Email message is prepared with valid recipients
Applied to: Attempt Email Delivery
WHEN
The system attempts email delivery
THEN
The system executes email delivery process and returns delivery status
Context: Email delivery attempt was made
GIVEN
Email delivery attempt was made
Applied to: Log Successful Delivery
WHEN
The delivery is successful
THEN
The system logs successful delivery and completes the email distribution process
Context: Email delivery attempt failed
GIVEN
Email delivery attempt failed
Applied to: Increment Retry Counter
WHEN
The delivery is not successful
THEN
The system increments the retry counter to track delivery attempts
Context: Email delivery has failed and retry counter has been incremented
GIVEN
Email delivery has failed and retry counter has been incremented
Applied to: Retry Limit Reached?
WHEN
The system checks if retry limit is reached
THEN
The system determines whether to attempt another retry or log delivery failure based on retry limit configuration
Context: Email delivery failed and retry limit has not been reached
GIVEN
Email delivery failed and retry limit has not been reached
Applied to: Wait for Retry Interval
WHEN
The system processes retry interval
THEN
The system waits for the configured retry interval before attempting delivery again
Context: Email delivery has failed and retry limit has been reached
GIVEN
Email delivery has failed and retry limit has been reached
Applied to: Log Delivery Failure
WHEN
The system processes the final delivery failure
THEN
The system logs the delivery failure for audit and troubleshooting purposes
Context: Email delivery has failed completely or recipients are invalid
GIVEN
Email delivery has failed completely or recipients are invalid
Applied to: Route to Default Recipient
WHEN
The system routes to default recipient
THEN
The system sends the email to configured default recipient as fallback delivery method
Context: Email has been routed to default recipient due to delivery failure or invalid recipients
GIVEN
Email has been routed to default recipient due to delivery failure or invalid recipients
Applied to: Generate Error Notification
WHEN
The system generates error notification
THEN
The system creates error notification message indicating the delivery issue and fallback action taken
R-GCX016E-cbl-01238 (+13) File: GCX016E.cbl Status Array Debug Logging Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Debug Logging':
  • Context - a cargo record exists with status information:
    For Capture Current Cargo Status:
    When debug logging is requested for status array processing, then the system captures the current cargo status including rt10 and rt11 status codes.
  • Context - cargo status information is available in rt10 and rt11 fields:
    For Record RT10/RT11 Status Information:
    When creating debug log entries for cargo status, then the system records rt10 and rt11 status information for inclusion in debug output.
  • Context - cargo record contains quantity information:
    For Log Cargo Quantities and Totals:
    When debug logging is performed for cargo status changes, then the system logs cargo quantities and totals including released quantities.
  • Context - s09a status array contains disposition code information:
    For Dump S09A Status Array Contents:
    When debug logging is requested for status array processing, then the system dumps all s09a status array contents including disposition codes, quantities, and sequence information.
  • Context - cargo status array contains disposition codes:
    For Record All Disposition Codes:
    When creating debug log for status processing, then the system records all disposition codes with their associated details.
  • Context - cargo status information exists before processing:
    For Create Before Processing Snapshot:
    When debug logging is enabled for status array changes, then the system creates a before processing snapshot of all cargo status information.
  • Context - cargo status processing has been completed:
    For Create After Processing Snapshot:
    When debug logging is enabled for status array changes, then the system creates an after processing snapshot of all cargo status information.
  • Context - before and after processing snapshots exist:
    For Compare Status Changes:
    When debug analysis is performed on status changes, then the system compares the snapshots and identifies all status changes that occurred.
  • Context - debug information has been captured from status processing:
    For Format Debug Message Content:
    When creating debug output message, then the system formats all debug information into a structured message format.
  • Context - equipment information is available for the cargo:
    For Include Equipment Information:
    When formatting debug message content, then the system includes equipment information such as car id and equipment details in the debug output.
  • Context - waybill and ccn information exists for the cargo:
    For Include Waybill and CCN Details:
    When creating debug log entries, then the system includes waybill number and ccn details for cargo identification.
  • Context - debug logging is being performed:
    For Add Timestamp Information:
    When creating debug log entries, then the system adds current timestamp information to track when the status processing occurred.
  • Context - debug message has been formatted with all required information:
    For Route Debug Message to Recipients:
    When debug message routing is initiated, then the system routes the debug message to appropriate recipients for review.
  • Context - debug message is ready for distribution:
    For Send to Merlin Message Distribution:
    When sending debug message through merlin system, then the system sends the debug message through merlin message distribution for delivery.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with status information
GIVEN
A cargo record exists with status information
Applied to: Capture Current Cargo Status
WHEN
Debug logging is requested for status array processing
THEN
The system captures the current cargo status including RT10 and RT11 status codes
Context: Cargo status information is available in RT10 and RT11 fields
GIVEN
Cargo status information is available in RT10 and RT11 fields
Applied to: Record RT10/RT11 Status Information
WHEN
Creating debug log entries for cargo status
THEN
The system records RT10 and RT11 status information for inclusion in debug output
Context: Cargo record contains quantity information
GIVEN
Cargo record contains quantity information
Applied to: Log Cargo Quantities and Totals
WHEN
Debug logging is performed for cargo status changes
THEN
The system logs cargo quantities and totals including released quantities
Context: S09A status array contains disposition code information
GIVEN
S09A status array contains disposition code information
Applied to: Dump S09A Status Array Contents
WHEN
Debug logging is requested for status array processing
THEN
The system dumps all S09A status array contents including disposition codes, quantities, and sequence information
Context: Cargo status array contains disposition codes
GIVEN
Cargo status array contains disposition codes
Applied to: Record All Disposition Codes
WHEN
Creating debug log for status processing
THEN
The system records all disposition codes with their associated details
Context: Cargo status information exists before processing
GIVEN
Cargo status information exists before processing
Applied to: Create Before Processing Snapshot
WHEN
Debug logging is enabled for status array changes
THEN
The system creates a before processing snapshot of all cargo status information
Context: Cargo status processing has been completed
GIVEN
Cargo status processing has been completed
Applied to: Create After Processing Snapshot
WHEN
Debug logging is enabled for status array changes
THEN
The system creates an after processing snapshot of all cargo status information
Context: Before and after processing snapshots exist
GIVEN
Before and after processing snapshots exist
Applied to: Compare Status Changes
WHEN
Debug analysis is performed on status changes
THEN
The system compares the snapshots and identifies all status changes that occurred
Context: Debug information has been captured from status processing
GIVEN
Debug information has been captured from status processing
Applied to: Format Debug Message Content
WHEN
Creating debug output message
THEN
The system formats all debug information into a structured message format
Context: Equipment information is available for the cargo
GIVEN
Equipment information is available for the cargo
Applied to: Include Equipment Information
WHEN
Formatting debug message content
THEN
The system includes equipment information such as car ID and equipment details in the debug output
Context: Waybill and CCN information exists for the cargo
GIVEN
Waybill and CCN information exists for the cargo
Applied to: Include Waybill and CCN Details
WHEN
Creating debug log entries
THEN
The system includes waybill number and CCN details for cargo identification
Context: Debug logging is being performed
GIVEN
Debug logging is being performed
Applied to: Add Timestamp Information
WHEN
Creating debug log entries
THEN
The system adds current timestamp information to track when the status processing occurred
Context: Debug message has been formatted with all required information
GIVEN
Debug message has been formatted with all required information
Applied to: Route Debug Message to Recipients
WHEN
Debug message routing is initiated
THEN
The system routes the debug message to appropriate recipients for review
Context: Debug message is ready for distribution
GIVEN
Debug message is ready for distribution
Applied to: Send to Merlin Message Distribution
WHEN
Sending debug message through Merlin system
THEN
The system sends the debug message through Merlin message distribution for delivery
R-GCX016E-cbl-01252 (+13) File: GCX016E.cbl Merlin Message Distribution Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Message Distribution':
  • Context - a merlin message has been generated:
    For Route ERROR Message:
    When the message type is error, then the message should be routed to the in destination.
  • Context - a merlin message has been generated with sd segment recipient information:
    For Route INFO Message:
    When the message type is info, then the message should be routed to the in destination and all sd segment merlin ids.
    For Route RELEASE Message:
    When the message type is release, then the message should be routed only to sd segment merlin ids.
  • Context - a merlin message has been generated for an export transaction with equipment information:
    For Route EXPORT Message:
    When the message type is export, then the message should be routed based on equipment type routing rules.
  • Context - a merlin message has been generated with sd segment cancel recipient information:
    For Route UNRLSE Message:
    When the message type is unrlse, then the message should be routed to om01247 and all sd segment cancel merlin ids.
  • Context - a merlin message has been generated for arrival cancellation:
    For Route ARRCANL Message:
    When the message type is arrcanl, then the message should be routed to configured arrival cancellation recipients.
  • Context - a message needs to be distributed:
    For Check AD Segment Configuration:
    When recipient determination is required, then the system should check ad segment configuration for valid recipients.
  • Context - ad segment configuration has been checked:
    For Use Configured Recipient:
    When a valid recipient is found in the configuration, then the configured recipient should be used for message delivery.
    For Use Default Recipient OM01247:
    When no valid recipient is found in the configuration, then the default recipient om01247 should be used for message delivery.
  • Context - a message recipient has been determined:
    For Send Message to Basket:
    When message delivery is initiated, then the message should be sent to the recipient's designated basket.
  • Context - a message has been sent to a recipient's basket:
    For Message Delivered Successfully:
    When the delivery is successful, then the system should confirm successful message delivery.
    For Generate Error Notification:
    When the delivery fails, then an error notification should be generated.
  • Context - a message delivery has failed and an error notification has been generated:
    For Reroute to Default Recipient:
    When rerouting is attempted, then the message should be rerouted to the default recipient.
  • Context - a message delivery has failed and rerouting has been attempted:
    For Log Delivery Failure:
    When the rerouting also fails, then the delivery failure should be logged.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin message has been generated
GIVEN
A Merlin message has been generated
Applied to: Route ERROR Message
WHEN
The message type is ERROR
THEN
The message should be routed to the IN destination
Context: A Merlin message has been generated with SD segment recipient information
GIVEN
A Merlin message has been generated with SD segment recipient information
Applied to: Route INFO Message
WHEN
The message type is INFO
THEN
The message should be routed to the IN destination and all SD segment Merlin IDs
Applied to: Route RELEASE Message
WHEN
The message type is RELEASE
THEN
The message should be routed only to SD segment Merlin IDs
Context: A Merlin message has been generated for an export transaction with equipment information
GIVEN
A Merlin message has been generated for an export transaction with equipment information
Applied to: Route EXPORT Message
WHEN
The message type is EXPORT
THEN
The message should be routed based on equipment type routing rules
Context: A Merlin message has been generated with SD segment cancel recipient information
GIVEN
A Merlin message has been generated with SD segment cancel recipient information
Applied to: Route UNRLSE Message
WHEN
The message type is UNRLSE
THEN
The message should be routed to OM01247 and all SD segment cancel Merlin IDs
Context: A Merlin message has been generated for arrival cancellation
GIVEN
A Merlin message has been generated for arrival cancellation
Applied to: Route ARRCANL Message
WHEN
The message type is ARRCANL
THEN
The message should be routed to configured arrival cancellation recipients
Context: A message needs to be distributed
GIVEN
A message needs to be distributed
Applied to: Check AD Segment Configuration
WHEN
Recipient determination is required
THEN
The system should check AD segment configuration for valid recipients
Context: AD segment configuration has been checked
GIVEN
AD segment configuration has been checked
Applied to: Use Configured Recipient
WHEN
A valid recipient is found in the configuration
THEN
The configured recipient should be used for message delivery
Applied to: Use Default Recipient OM01247
WHEN
No valid recipient is found in the configuration
THEN
The default recipient OM01247 should be used for message delivery
Context: A message recipient has been determined
GIVEN
A message recipient has been determined
Applied to: Send Message to Basket
WHEN
Message delivery is initiated
THEN
The message should be sent to the recipient's designated basket
Context: A message has been sent to a recipient's basket
GIVEN
A message has been sent to a recipient's basket
Applied to: Message Delivered Successfully
WHEN
The delivery is successful
THEN
The system should confirm successful message delivery
Applied to: Generate Error Notification
WHEN
The delivery fails
THEN
An error notification should be generated
Context: A message delivery has failed and an error notification has been generated
GIVEN
A message delivery has failed and an error notification has been generated
Applied to: Reroute to Default Recipient
WHEN
Rerouting is attempted
THEN
The message should be rerouted to the default recipient
Context: A message delivery has failed and rerouting has been attempted
GIVEN
A message delivery has failed and rerouting has been attempted
Applied to: Log Delivery Failure
WHEN
The rerouting also fails
THEN
The delivery failure should be logged
R-GCX016E-cbl-01266 (+19) File: GCX016E.cbl Merlin Message Sending Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Message Sending':
  • Context - a merlin message is ready for distribution:
    For Message Type Classification:
    When the system evaluates the message type indicator, then the message is classified as error, info, release, export, unrlse, or arrcanl type for routing purposes.
  • Context - a message has been classified as error type:
    For Route ERROR Messages:
    When the routing process begins, then the message is directed to the 'in' destination queue.
  • Context - a message has been classified as info type:
    For Route INFO Messages:
    When the routing process begins, then the message is sent to 'in' destination and all configured sd segment merlin ids.
  • Context - a message has been classified as release type:
    For Route RELEASE Messages:
    When the routing process begins, then the message is sent only to configured sd segment merlin ids.
  • Context - a message has been classified as export type:
    For Route EXPORT Messages:
    When the routing process evaluates the equipment type, then the message is routed to destinations specific to the equipment type.
  • Context - a message has been classified as unrlse type:
    For Route UNRLSE Messages:
    When the routing process begins, then the message is sent to om01247 and all configured sd cancel merlin ids.
  • Context - a message has been classified as arrcanl type:
    For Route ARRCANL Messages:
    When the routing process begins, then the message is routed according to arrival cancellation notification rules.
  • Context - a message has been classified and routing rules applied:
    For Determine Message Recipient:
    When the system looks up recipient configuration, then the appropriate recipient merlin id or destination is identified.
  • Context - a recipient has been determined for the message:
    For Valid Recipient Found?:
    When the system validates the recipient configuration, then the recipient is confirmed as valid or invalid for delivery.
  • Context - a valid recipient has been identified:
    For Send to Configured Recipient:
    When the delivery process executes, then the message is sent to the configured recipient.
  • Context - no valid configured recipient was found:
    For Send to Default Recipient OM01247:
    When the fallback process activates, then the message is automatically sent to default recipient om01247.
  • Context - an invalid recipient was encountered during routing:
    For Generate Error Notification:
    When the error handling process executes, then an error notification is generated indicating the recipient validation failure.
  • Context - a message delivery attempt has been made:
    For Delivery Successful?:
    When the system checks delivery status, then the delivery is confirmed as successful or failed.
  • Context - a message delivery was successful:
    For Log Successful Delivery:
    When the logging process executes, then the successful delivery is recorded with timestamp and recipient information.
  • Context - a message delivery has failed:
    For Initiate Rerouting Process:
    When the rerouting process is triggered, then alternative delivery routes are identified and activated.
  • Context - rerouting process has identified alternative recipients:
    For Send to Alternative Recipient:
    When the alternative delivery executes, then the message is sent to backup recipients aei9999 and om01247.
  • Context - a rerouting delivery attempt has been made:
    For Rerouting Successful?:
    When the system checks rerouting delivery status, then the rerouting is confirmed as successful or failed.
  • Context - a rerouting delivery was successful:
    For Log Rerouting Success:
    When the logging process executes, then the successful rerouting is recorded with timestamp and alternative recipient information.
  • Context - both primary delivery and rerouting have failed:
    For Generate Delivery Failure Alert:
    When the alert generation process executes, then a delivery failure alert is generated for system administrators.
  • Context - all delivery attempts have been completed:
    For Complete Message Distribution:
    When the completion process executes, then the message distribution process is marked as complete with final status.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin message is ready for distribution
GIVEN
A Merlin message is ready for distribution
Applied to: Message Type Classification
WHEN
The system evaluates the message type indicator
THEN
The message is classified as ERROR, INFO, RELEASE, EXPORT, UNRLSE, or ARRCANL type for routing purposes
Context: A message has been classified as ERROR type
GIVEN
A message has been classified as ERROR type
Applied to: Route ERROR Messages
WHEN
The routing process begins
THEN
The message is directed to the 'IN' destination queue
Context: A message has been classified as INFO type
GIVEN
A message has been classified as INFO type
Applied to: Route INFO Messages
WHEN
The routing process begins
THEN
The message is sent to 'IN' destination and all configured SD segment Merlin IDs
Context: A message has been classified as RELEASE type
GIVEN
A message has been classified as RELEASE type
Applied to: Route RELEASE Messages
WHEN
The routing process begins
THEN
The message is sent only to configured SD segment Merlin IDs
Context: A message has been classified as EXPORT type
GIVEN
A message has been classified as EXPORT type
Applied to: Route EXPORT Messages
WHEN
The routing process evaluates the equipment type
THEN
The message is routed to destinations specific to the equipment type
Context: A message has been classified as UNRLSE type
GIVEN
A message has been classified as UNRLSE type
Applied to: Route UNRLSE Messages
WHEN
The routing process begins
THEN
The message is sent to OM01247 and all configured SD cancel Merlin IDs
Context: A message has been classified as ARRCANL type
GIVEN
A message has been classified as ARRCANL type
Applied to: Route ARRCANL Messages
WHEN
The routing process begins
THEN
The message is routed according to arrival cancellation notification rules
Context: A message has been classified and routing rules applied
GIVEN
A message has been classified and routing rules applied
Applied to: Determine Message Recipient
WHEN
The system looks up recipient configuration
THEN
The appropriate recipient Merlin ID or destination is identified
Context: A recipient has been determined for the message
GIVEN
A recipient has been determined for the message
Applied to: Valid Recipient Found?
WHEN
The system validates the recipient configuration
THEN
The recipient is confirmed as valid or invalid for delivery
Context: A valid recipient has been identified
GIVEN
A valid recipient has been identified
Applied to: Send to Configured Recipient
WHEN
The delivery process executes
THEN
The message is sent to the configured recipient
Context: No valid configured recipient was found
GIVEN
No valid configured recipient was found
Applied to: Send to Default Recipient OM01247
WHEN
The fallback process activates
THEN
The message is automatically sent to default recipient OM01247
Context: An invalid recipient was encountered during routing
GIVEN
An invalid recipient was encountered during routing
Applied to: Generate Error Notification
WHEN
The error handling process executes
THEN
An error notification is generated indicating the recipient validation failure
Context: A message delivery attempt has been made
GIVEN
A message delivery attempt has been made
Applied to: Delivery Successful?
WHEN
The system checks delivery status
THEN
The delivery is confirmed as successful or failed
Context: A message delivery was successful
GIVEN
A message delivery was successful
Applied to: Log Successful Delivery
WHEN
The logging process executes
THEN
The successful delivery is recorded with timestamp and recipient information
Context: A message delivery has failed
GIVEN
A message delivery has failed
Applied to: Initiate Rerouting Process
WHEN
The rerouting process is triggered
THEN
Alternative delivery routes are identified and activated
Context: Rerouting process has identified alternative recipients
GIVEN
Rerouting process has identified alternative recipients
Applied to: Send to Alternative Recipient
WHEN
The alternative delivery executes
THEN
The message is sent to backup recipients AEI9999 and OM01247
Context: A rerouting delivery attempt has been made
GIVEN
A rerouting delivery attempt has been made
Applied to: Rerouting Successful?
WHEN
The system checks rerouting delivery status
THEN
The rerouting is confirmed as successful or failed
Context: A rerouting delivery was successful
GIVEN
A rerouting delivery was successful
Applied to: Log Rerouting Success
WHEN
The logging process executes
THEN
The successful rerouting is recorded with timestamp and alternative recipient information
Context: Both primary delivery and rerouting have failed
GIVEN
Both primary delivery and rerouting have failed
Applied to: Generate Delivery Failure Alert
WHEN
The alert generation process executes
THEN
A delivery failure alert is generated for system administrators
Context: All delivery attempts have been completed
GIVEN
All delivery attempts have been completed
Applied to: Complete Message Distribution
WHEN
The completion process executes
THEN
The message distribution process is marked as complete with final status
R-GCX016E-cbl-01286 (+12) File: GCX016E.cbl MQ Connection Management Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MQ Connection Management':
  • Context - the system needs to connect to message queue services:
    For Initialize MQ Connection Parameters:
    When mq connection management process starts, then all mq connection parameters are initialized to default values.
  • Context - mq connection parameters are initialized:
    For Establish MQ Manager Connection:
    When system attempts to connect to mq manager, then connection to mq manager is established.
  • Context - system has attempted to connect to mq manager:
    For Connection Successful?:
    When connection attempt completes, then system determines if connection was successful or failed.
  • Context - mq manager connection is successfully established:
    For Open GC350.EXP.INPUT Queue:
    When system attempts to open gc350.exp.input queue, then the export input queue is opened for message processing.
  • Context - system has attempted to open gc350.exp.input queue:
    For Queue Open Successful?:
    When queue opening attempt completes, then system determines if queue opening was successful or failed.
  • Context - mq manager connection is established and gc350.exp.input queue is successfully opened:
    For Set Queue Ready Status:
    When both connection and queue opening are validated as successful, then queue status is set to ready for message processing.
  • Context - queue status has been set to ready:
    For Log Connection Success:
    When mq connection setup is complete, then connection success is logged to system audit trail.
  • Context - system attempted to connect to mq manager:
    For Handle Connection Error:
    When mq manager connection fails, then connection error is handled and appropriate error processing is initiated.
  • Context - mq manager connection has failed:
    For Log Connection Failure:
    When connection error handling is processed, then connection failure details are logged to system audit trail.
  • Context - mq manager connection is successful and system attempted to open gc350.exp.input queue:
    For Handle Queue Open Error:
    When queue opening fails, then queue opening error is handled and appropriate error processing is initiated.
  • Context - gc350.exp.input queue opening has failed:
    For Log Queue Open Failure:
    When queue opening error handling is processed, then queue opening failure details are logged to system audit trail.
  • Context - connection success has been logged:
    For MQ Connection Ready for Processing:
    When all mq setup operations are complete, then mq connection is confirmed ready for processing export messages from gc350.exp.input queue.
  • Context - either connection failure or queue opening failure has been logged:
    For Connection Failed - Exit:
    When error handling is complete, then mq connection management process exits without establishing ready status.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to connect to message queue services
GIVEN
The system needs to connect to message queue services
Applied to: Initialize MQ Connection Parameters
WHEN
MQ connection management process starts
THEN
All MQ connection parameters are initialized to default values
Context: MQ connection parameters are initialized
GIVEN
MQ connection parameters are initialized
Applied to: Establish MQ Manager Connection
WHEN
System attempts to connect to MQ Manager
THEN
Connection to MQ Manager is established
Context: System has attempted to connect to MQ Manager
GIVEN
System has attempted to connect to MQ Manager
Applied to: Connection Successful?
WHEN
Connection attempt completes
THEN
System determines if connection was successful or failed
Context: MQ Manager connection is successfully established
GIVEN
MQ Manager connection is successfully established
Applied to: Open GC350.EXP.INPUT Queue
WHEN
System attempts to open GC350.EXP.INPUT queue
THEN
The export input queue is opened for message processing
Context: System has attempted to open GC350.EXP.INPUT queue
GIVEN
System has attempted to open GC350.EXP.INPUT queue
Applied to: Queue Open Successful?
WHEN
Queue opening attempt completes
THEN
System determines if queue opening was successful or failed
Context: MQ Manager connection is established AND GC350.EXP.INPUT queue is successfully opened
GIVEN
MQ Manager connection is established AND GC350.EXP.INPUT queue is successfully opened
Applied to: Set Queue Ready Status
WHEN
Both connection and queue opening are validated as successful
THEN
Queue status is set to ready for message processing
Context: Queue status has been set to ready
GIVEN
Queue status has been set to ready
Applied to: Log Connection Success
WHEN
MQ connection setup is complete
THEN
Connection success is logged to system audit trail
Context: System attempted to connect to MQ Manager
GIVEN
System attempted to connect to MQ Manager
Applied to: Handle Connection Error
WHEN
MQ Manager connection fails
THEN
Connection error is handled and appropriate error processing is initiated
Context: MQ Manager connection has failed
GIVEN
MQ Manager connection has failed
Applied to: Log Connection Failure
WHEN
Connection error handling is processed
THEN
Connection failure details are logged to system audit trail
Context: MQ Manager connection is successful AND system attempted to open GC350.EXP.INPUT queue
GIVEN
MQ Manager connection is successful AND system attempted to open GC350.EXP.INPUT queue
Applied to: Handle Queue Open Error
WHEN
Queue opening fails
THEN
Queue opening error is handled and appropriate error processing is initiated
Context: GC350.EXP.INPUT queue opening has failed
GIVEN
GC350.EXP.INPUT queue opening has failed
Applied to: Log Queue Open Failure
WHEN
Queue opening error handling is processed
THEN
Queue opening failure details are logged to system audit trail
Context: Connection success has been logged
GIVEN
Connection success has been logged
Applied to: MQ Connection Ready for Processing
WHEN
All MQ setup operations are complete
THEN
MQ connection is confirmed ready for processing export messages from GC350.EXP.INPUT queue
Context: Either connection failure OR queue opening failure has been logged
GIVEN
Either connection failure OR queue opening failure has been logged
Applied to: Connection Failed - Exit
WHEN
Error handling is complete
THEN
MQ connection management process exits without establishing ready status
R-GCX016E-cbl-01299 (+22) File: GCX016E.cbl Message Array Initialization Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Array Initialization':
  • Context - a message needs to be processed for array initialization:
    For Message Type?:
    When the system evaluates the message type, then the system routes to cargo message array initialization for cargo messages or train message array initialization for train messages.
  • Context - a cargo message type has been identified:
    For Initialize Cargo Message Arrays:
    When the system initializes cargo message arrays, then the system creates empty array structures ready to receive x4 and n7 segment information.
  • Context - cargo message arrays are being initialized:
    For Create X4 Segment Structure:
    When the system creates x4 segment structure, then the system defines fields for disposition codes, entry numbers, quantities, and processing instructions.
  • Context - x4 segment structure has been created:
    For Set Equipment Information:
    When the system sets equipment information, then the system assigns equipment type, equipment number, and related identification data to the x4 segment.
  • Context - equipment information has been set in the x4 segment:
    For Set Disposition Code Data:
    When the system sets disposition code data, then the system populates disposition code, associated quantities, entry numbers, and processing flags.
  • Context - disposition code data has been set in the x4 segment:
    For Set Date/Time Information:
    When the system sets date/time information, then the system assigns current date, time, and timezone information to the x4 segment.
  • Context - x4 segment has been completed with date/time information:
    For Create N7 Segment Structure:
    When the system creates n7 segment structure, then the system defines fields for equipment details, cargo identification, and quantity information.
  • Context - n7 segment structure has been created:
    For Set Equipment Details:
    When the system sets equipment details, then the system assigns equipment initial, equipment number, equipment type, and equipment specifications to the n7 segment.
  • Context - equipment details have been set in the n7 segment:
    For Set Quantity Information:
    When the system sets quantity information, then the system populates quantity values, unit of measure, and weight information in the n7 segment.
  • Context - quantity information has been set in the n7 segment:
    For Set Car ID and Waybill:
    When the system sets car id and waybill, then the system assigns car identification number and waybill reference to the n7 segment.
  • Context - a train message type has been identified:
    For Initialize Train Message Arrays:
    When the system initializes train message arrays, then the system creates empty array structures ready to receive m10 and v9 segment information.
  • Context - train message arrays are being initialized:
    For Create M10 Segment Structure:
    When the system creates m10 segment structure, then the system defines fields for vessel name, train identification, and transport details.
  • Context - m10 segment structure has been created:
    For Set Vessel/Train Information:
    When the system sets vessel/train information, then the system assigns vessel name, train number, and train identification data to the m10 segment.
  • Context - vessel/train information has been set in the m10 segment:
    For Set SCAC and Transport Type:
    When the system sets scac and transport type, then the system populates scac code and transport mode information in the m10 segment.
  • Context - scac and transport type have been set in the m10 segment:
    For Set Country Code Details:
    When the system sets country code details, then the system assigns origin country code and destination country code to the m10 segment.
  • Context - m10 segment has been completed with country code details:
    For Create V9 Segment Structure:
    When the system creates v9 segment structure, then the system defines fields for event codes, status information, and location data.
  • Context - v9 segment structure has been created:
    For Set Event Information:
    When the system sets event information, then the system assigns event code, event date, event time, and event description to the v9 segment.
  • Context - event information has been set in the v9 segment:
    For Set Disposition Code:
    When the system sets disposition code, then the system populates disposition code and related processing flags in the v9 segment.
  • Context - disposition code has been set in the v9 segment:
    For Set Location Data:
    When the system sets location data, then the system assigns location code, location name, and geographic coordinates to the v9 segment.
  • Context - all segment structures have been created and populated:
    For Validate Segment Completeness:
    When the system validates segment completeness, then the system checks that all mandatory fields contain valid data and all segment structures are properly formed.
  • Context - segment completeness validation has been performed:
    For All Required Fields Set?:
    When the system checks if all required fields are set, then the system returns true if all mandatory fields contain valid data, otherwise returns false.
  • Context - all required fields validation check returns true:
    For Mark Arrays Ready for Processing:
    When the system marks arrays ready for processing, then the system sets the ready status flag and makes the arrays available for message processing.
  • Context - all required fields validation check returns false:
    For Log Initialization Error:
    When the system logs initialization error, then the system records error details including missing fields and sets error status for the initialization process.
👨‍💻 Technical ACs (Gherkin)
Context: A message needs to be processed for array initialization
GIVEN
A message needs to be processed for array initialization
Applied to: Message Type?
WHEN
The system evaluates the message type
THEN
The system routes to cargo message array initialization for cargo messages or train message array initialization for train messages
Context: A cargo message type has been identified
GIVEN
A cargo message type has been identified
Applied to: Initialize Cargo Message Arrays
WHEN
The system initializes cargo message arrays
THEN
The system creates empty array structures ready to receive X4 and N7 segment information
Context: Cargo message arrays are being initialized
GIVEN
Cargo message arrays are being initialized
Applied to: Create X4 Segment Structure
WHEN
The system creates X4 segment structure
THEN
The system defines fields for disposition codes, entry numbers, quantities, and processing instructions
Context: X4 segment structure has been created
GIVEN
X4 segment structure has been created
Applied to: Set Equipment Information
WHEN
The system sets equipment information
THEN
The system assigns equipment type, equipment number, and related identification data to the X4 segment
Context: Equipment information has been set in the X4 segment
GIVEN
Equipment information has been set in the X4 segment
Applied to: Set Disposition Code Data
WHEN
The system sets disposition code data
THEN
The system populates disposition code, associated quantities, entry numbers, and processing flags
Context: Disposition code data has been set in the X4 segment
GIVEN
Disposition code data has been set in the X4 segment
Applied to: Set Date/Time Information
WHEN
The system sets date/time information
THEN
The system assigns current date, time, and timezone information to the X4 segment
Context: X4 segment has been completed with date/time information
GIVEN
X4 segment has been completed with date/time information
Applied to: Create N7 Segment Structure
WHEN
The system creates N7 segment structure
THEN
The system defines fields for equipment details, cargo identification, and quantity information
Context: N7 segment structure has been created
GIVEN
N7 segment structure has been created
Applied to: Set Equipment Details
WHEN
The system sets equipment details
THEN
The system assigns equipment initial, equipment number, equipment type, and equipment specifications to the N7 segment
Context: Equipment details have been set in the N7 segment
GIVEN
Equipment details have been set in the N7 segment
Applied to: Set Quantity Information
WHEN
The system sets quantity information
THEN
The system populates quantity values, unit of measure, and weight information in the N7 segment
Context: Quantity information has been set in the N7 segment
GIVEN
Quantity information has been set in the N7 segment
Applied to: Set Car ID and Waybill
WHEN
The system sets car ID and waybill
THEN
The system assigns car identification number and waybill reference to the N7 segment
Context: A train message type has been identified
GIVEN
A train message type has been identified
Applied to: Initialize Train Message Arrays
WHEN
The system initializes train message arrays
THEN
The system creates empty array structures ready to receive M10 and V9 segment information
Context: Train message arrays are being initialized
GIVEN
Train message arrays are being initialized
Applied to: Create M10 Segment Structure
WHEN
The system creates M10 segment structure
THEN
The system defines fields for vessel name, train identification, and transport details
Context: M10 segment structure has been created
GIVEN
M10 segment structure has been created
Applied to: Set Vessel/Train Information
WHEN
The system sets vessel/train information
THEN
The system assigns vessel name, train number, and train identification data to the M10 segment
Context: Vessel/train information has been set in the M10 segment
GIVEN
Vessel/train information has been set in the M10 segment
Applied to: Set SCAC and Transport Type
WHEN
The system sets SCAC and transport type
THEN
The system populates SCAC code and transport mode information in the M10 segment
Context: SCAC and transport type have been set in the M10 segment
GIVEN
SCAC and transport type have been set in the M10 segment
Applied to: Set Country Code Details
WHEN
The system sets country code details
THEN
The system assigns origin country code and destination country code to the M10 segment
Context: M10 segment has been completed with country code details
GIVEN
M10 segment has been completed with country code details
Applied to: Create V9 Segment Structure
WHEN
The system creates V9 segment structure
THEN
The system defines fields for event codes, status information, and location data
Context: V9 segment structure has been created
GIVEN
V9 segment structure has been created
Applied to: Set Event Information
WHEN
The system sets event information
THEN
The system assigns event code, event date, event time, and event description to the V9 segment
Context: Event information has been set in the V9 segment
GIVEN
Event information has been set in the V9 segment
Applied to: Set Disposition Code
WHEN
The system sets disposition code
THEN
The system populates disposition code and related processing flags in the V9 segment
Context: Disposition code has been set in the V9 segment
GIVEN
Disposition code has been set in the V9 segment
Applied to: Set Location Data
WHEN
The system sets location data
THEN
The system assigns location code, location name, and geographic coordinates to the V9 segment
Context: All segment structures have been created and populated
GIVEN
All segment structures have been created and populated
Applied to: Validate Segment Completeness
WHEN
The system validates segment completeness
THEN
The system checks that all mandatory fields contain valid data and all segment structures are properly formed
Context: Segment completeness validation has been performed
GIVEN
Segment completeness validation has been performed
Applied to: All Required Fields Set?
WHEN
The system checks if all required fields are set
THEN
The system returns true if all mandatory fields contain valid data, otherwise returns false
Context: All required fields validation check returns true
GIVEN
All required fields validation check returns true
Applied to: Mark Arrays Ready for Processing
WHEN
The system marks arrays ready for processing
THEN
The system sets the ready status flag and makes the arrays available for message processing
Context: All required fields validation check returns false
GIVEN
All required fields validation check returns false
Applied to: Log Initialization Error
WHEN
The system logs initialization error
THEN
The system records error details including missing fields and sets error status for the initialization process
R-GCX016E-cbl-01322 (+10) File: GCX016E.cbl Cargo Information Logging Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Information Logging':
  • Context - a cargo processing action has been initiated:
    For Cargo Processing Action Occurs:
    When the system detects a cargo processing event, then the system should trigger the audit logging process.
  • Context - a cargo processing action needs to be logged:
    For Prepare Audit Log Entry:
    When the audit logging process is initiated, then the system should prepare the audit log entry structure with all required fields.
  • Context - an audit log entry is being prepared for cargo processing:
    For Set LOG-USE-INPUT-MESSAGE Action Code:
    When the system sets up the log entry parameters, then the action code should be set to log-use-input-message.
  • Context - an audit log entry is being created:
    For Capture Timestamp Information & Capture User Information:
    When the system captures audit information, then the current timestamp should be recorded in the log entry and the user identification information should be recorded in the log entry.
  • Context - an audit log entry is being created for a cargo processing action:
    For Capture Cargo Processing Details:
    When the system captures audit information, then the specific cargo processing details should be recorded in the log entry.
  • Context - all audit log information has been prepared:
    For Spawn GCT1051E Transaction:
    When the system is ready to create the log entry, then the gct1051e transaction should be spawned to create the audit log.
  • Context - the gct1051e transaction has been spawned for audit logging:
    For Transaction Spawn Successful?:
    When the system checks the transaction spawn result, then the system should determine if the spawn was successful or failed.
  • Context - the gct1051e transaction spawn was successful:
    For Log Entry Created Successfully:
    When the system processes the successful spawn result, then the system should confirm the log entry was created successfully.
  • Context - the gct1051e transaction spawn failed:
    For Handle Logging Error:
    When the system processes the failed spawn result, then the system should handle the logging error without interrupting cargo processing.
  • Context - the audit logging attempt has been completed (successfully or with error):
    For Continue Processing:
    When the logging process finishes, then the system should continue with the main cargo processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing action has been initiated
GIVEN
A cargo processing action has been initiated
Applied to: Cargo Processing Action Occurs
WHEN
The system detects a cargo processing event
THEN
The system should trigger the audit logging process
Context: A cargo processing action needs to be logged
GIVEN
A cargo processing action needs to be logged
Applied to: Prepare Audit Log Entry
WHEN
The audit logging process is initiated
THEN
The system should prepare the audit log entry structure with all required fields
Context: An audit log entry is being prepared for cargo processing
GIVEN
An audit log entry is being prepared for cargo processing
Applied to: Set LOG-USE-INPUT-MESSAGE Action Code
WHEN
The system sets up the log entry parameters
THEN
The action code should be set to LOG-USE-INPUT-MESSAGE
Context: An audit log entry is being created
GIVEN
An audit log entry is being created
Applied to: Capture Timestamp Information & Capture User Information
WHEN
The system captures audit information
THEN
The current timestamp should be recorded in the log entry AND The user identification information should be recorded in the log entry
Context: An audit log entry is being created for a cargo processing action
GIVEN
An audit log entry is being created for a cargo processing action
Applied to: Capture Cargo Processing Details
WHEN
The system captures audit information
THEN
The specific cargo processing details should be recorded in the log entry
Context: All audit log information has been prepared
GIVEN
All audit log information has been prepared
Applied to: Spawn GCT1051E Transaction
WHEN
The system is ready to create the log entry
THEN
The GCT1051E transaction should be spawned to create the audit log
Context: The GCT1051E transaction has been spawned for audit logging
GIVEN
The GCT1051E transaction has been spawned for audit logging
Applied to: Transaction Spawn Successful?
WHEN
The system checks the transaction spawn result
THEN
The system should determine if the spawn was successful or failed
Context: The GCT1051E transaction spawn was successful
GIVEN
The GCT1051E transaction spawn was successful
Applied to: Log Entry Created Successfully
WHEN
The system processes the successful spawn result
THEN
The system should confirm the log entry was created successfully
Context: The GCT1051E transaction spawn failed
GIVEN
The GCT1051E transaction spawn failed
Applied to: Handle Logging Error
WHEN
The system processes the failed spawn result
THEN
The system should handle the logging error without interrupting cargo processing
Context: The audit logging attempt has been completed (successfully or with error)
GIVEN
The audit logging attempt has been completed (successfully or with error)
Applied to: Continue Processing
WHEN
The logging process finishes
THEN
The system should continue with the main cargo processing workflow
R-GCX016E-cbl-01333 (+15) File: GCX016E.cbl Merlin Report Formatting Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Report Formatting':
  • Context - a cargo record exists with equipment information:
    For Format Equipment Information:
    When the system processes merlin report formatting, then equipment information is extracted and formatted for the report.
  • Context - cargo data contains car identification information:
    For Extract Car ID:
    When car id extraction is performed, then the car id is retrieved and made available for report formatting.
  • Context - cargo data contains waybill information:
    For Extract Waybill Number:
    When waybill number extraction is performed, then the waybill number is retrieved and made available for report formatting.
  • Context - cargo data contains us customs control number information:
    For Extract US-CCN:
    When us-ccn extraction is performed, then the us-ccn is retrieved and made available for report formatting.
  • Context - a disposition code exists for processing:
    For Format Disposition Code Information:
    When disposition code information formatting is performed, then disposition code details are formatted for the report.
  • Context - a disposition code is being processed:
    For Retrieve Disposition Code:
    When disposition code retrieval is performed, then the current disposition code is retrieved for formatting.
    For Apply Release Quantity Impact Logic:
    When release quantity impact logic is applied, then the system determines whether the disposition code affects release quantities.
  • Context - a disposition code exists and disposition code table is available:
    For Retrieve Disposition Description:
    When disposition description lookup is performed, then the corresponding description is retrieved from the disposition code table.
  • Context - system processing times are available:
    For Format Date/Time Information:
    When date/time information formatting is performed, then date and time information is formatted for the report.
  • Context - uscs processing time information is available:
    For Format USCS Processing Time:
    When uscs processing time formatting is performed, then uscs processing time is formatted for the report.
  • Context - system processing time information is available:
    For Format System Processing Time:
    When system processing time formatting is performed, then system processing time is formatted for the report.
  • Context - a disposition code is being evaluated for quantity impact:
    For Should Disposition Code Affect Release Quantities?:
    When the system checks if the disposition code affects release quantities, then the system returns yes if the code affects quantities, no if it does not.
  • Context - a disposition code affects release quantities:
    For Include Quantity Impact in Report:
    When report formatting includes quantity impact processing, then quantity impact information is included in the report.
  • Context - a disposition code does not affect release quantities:
    For Exclude Quantity Impact from Report:
    When report formatting excludes quantity impact processing, then quantity impact information is excluded from the report.
  • Context - all report elements have been individually formatted:
    For Combine All Formatted Elements:
    When element combination is performed, then all formatted elements are combined into a unified report structure.
  • Context - all report elements have been combined:
    For Generate Final Merlin Report Format:
    When final report generation is performed, then a complete formatted merlin report is generated.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with equipment information
GIVEN
A cargo record exists with equipment information
Applied to: Format Equipment Information
WHEN
The system processes Merlin report formatting
THEN
Equipment information is extracted and formatted for the report
Context: Cargo data contains car identification information
GIVEN
Cargo data contains car identification information
Applied to: Extract Car ID
WHEN
Car ID extraction is performed
THEN
The car ID is retrieved and made available for report formatting
Context: Cargo data contains waybill information
GIVEN
Cargo data contains waybill information
Applied to: Extract Waybill Number
WHEN
Waybill number extraction is performed
THEN
The waybill number is retrieved and made available for report formatting
Context: Cargo data contains US Customs Control Number information
GIVEN
Cargo data contains US Customs Control Number information
Applied to: Extract US-CCN
WHEN
US-CCN extraction is performed
THEN
The US-CCN is retrieved and made available for report formatting
Context: A disposition code exists for processing
GIVEN
A disposition code exists for processing
Applied to: Format Disposition Code Information
WHEN
Disposition code information formatting is performed
THEN
Disposition code details are formatted for the report
Context: A disposition code is being processed
GIVEN
A disposition code is being processed
Applied to: Retrieve Disposition Code
WHEN
Disposition code retrieval is performed
THEN
The current disposition code is retrieved for formatting
Applied to: Apply Release Quantity Impact Logic
WHEN
Release quantity impact logic is applied
THEN
The system determines whether the disposition code affects release quantities
Context: A disposition code exists and disposition code table is available
GIVEN
A disposition code exists and disposition code table is available
Applied to: Retrieve Disposition Description
WHEN
Disposition description lookup is performed
THEN
The corresponding description is retrieved from the disposition code table
Context: System processing times are available
GIVEN
System processing times are available
Applied to: Format Date/Time Information
WHEN
Date/time information formatting is performed
THEN
Date and time information is formatted for the report
Context: USCS processing time information is available
GIVEN
USCS processing time information is available
Applied to: Format USCS Processing Time
WHEN
USCS processing time formatting is performed
THEN
USCS processing time is formatted for the report
Context: System processing time information is available
GIVEN
System processing time information is available
Applied to: Format System Processing Time
WHEN
System processing time formatting is performed
THEN
System processing time is formatted for the report
Context: A disposition code is being evaluated for quantity impact
GIVEN
A disposition code is being evaluated for quantity impact
Applied to: Should Disposition Code Affect Release Quantities?
WHEN
The system checks if the disposition code affects release quantities
THEN
The system returns yes if the code affects quantities, no if it does not
Context: A disposition code affects release quantities
GIVEN
A disposition code affects release quantities
Applied to: Include Quantity Impact in Report
WHEN
Report formatting includes quantity impact processing
THEN
Quantity impact information is included in the report
Context: A disposition code does not affect release quantities
GIVEN
A disposition code does not affect release quantities
Applied to: Exclude Quantity Impact from Report
WHEN
Report formatting excludes quantity impact processing
THEN
Quantity impact information is excluded from the report
Context: All report elements have been individually formatted
GIVEN
All report elements have been individually formatted
Applied to: Combine All Formatted Elements
WHEN
Element combination is performed
THEN
All formatted elements are combined into a unified report structure
Context: All report elements have been combined
GIVEN
All report elements have been combined
Applied to: Generate Final Merlin Report Format
WHEN
Final report generation is performed
THEN
A complete formatted Merlin report is generated
R-GCX016E-cbl-01349 (+15) File: GCX016E.cbl Release Quantity Processing Logic Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Quantity Processing Logic':
  • Context - a cargo record exists in the system:
    For Retrieve Current Cargo Release Quantity:
    When the system needs to process disposition code quantity impacts, then the current cargo release quantity is retrieved and made available for processing.
  • Context - a cargo status array contains disposition codes:
    For Get Disposition Code from Status Array:
    When the system processes quantity impacts for disposition codes, then each disposition code is extracted from the status array for evaluation.
  • Context - a disposition code needs to be processed:
    For Lookup Disposition Code in DC Table:
    When the system looks up the disposition code in the dc table, then the disposition code details and action type are retrieved if found.
  • Context - a disposition code is being processed for quantity impact:
    For Disposition Code Found?:
    When the system checks if the disposition code exists in the dc table, then processing continues if found, otherwise an error is generated.
  • Context - a valid disposition code exists in the dc table:
    For Retrieve Disposition Code Action Type:
    When the system retrieves the disposition code configuration, then the action type (add, subtract, or status info) is determined for quantity processing.
  • Context - a disposition code has a defined action type:
    For Action Type?:
    When the system evaluates the action type for quantity impact, then the system routes to add, subtract, or no quantity impact processing based on the action type.
  • Context - a disposition code has an 'add' action type:
    For Add to Release Quantity:
    When the system processes the quantity impact, then the disposition code quantity is added to the current release quantity.
  • Context - a disposition code has a 'subtract' action type:
    For Subtract from Release Quantity:
    When the system processes the quantity impact, then the disposition code quantity is subtracted from the current release quantity.
  • Context - a disposition code has 'status info' action type:
    For No Quantity Impact:
    When the system processes the disposition code, then no quantity calculations are performed and processing continues to set impact flag.
  • Context - a release quantity has been calculated from disposition code processing:
    For Validate Quantity Against Total Cargo:
    When the system validates the calculated quantity, then the quantity must be between zero and the total cargo quantity inclusive.
  • Context - a release quantity has been calculated and validated:
    For Quantity Valid?:
    When the system checks if the quantity is valid, then processing continues to update if valid, otherwise an error is generated.
  • Context - a valid release quantity has been calculated:
    For Update Release Quantity:
    When the system updates the cargo release quantity, then the cargo record is updated with the new release quantity value.
  • Context - a cargo release quantity has been updated:
    For Generate Quantity Impact Message:
    When the system generates impact messaging, then a message is created showing the before and after quantity values and the disposition code causing the change.
  • Context - a quantity impact has been processed and messaged:
    For Log Before/After Comparison:
    When the system logs the quantity change, then the original quantity, new quantity, and disposition code are recorded in the system log.
  • Context - disposition code processing has been completed:
    For Set Quantity Impact Flag:
    When the system finalizes quantity impact processing, then a quantity impact flag is set to indicate whether quantities were affected by the disposition code.
  • Context - a disposition code is not found in dc table or calculated quantity is invalid:
    For Generate Error Message:
    When the system encounters a validation error, then an error message is generated indicating the specific validation failure.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Retrieve Current Cargo Release Quantity
WHEN
The system needs to process disposition code quantity impacts
THEN
The current cargo release quantity is retrieved and made available for processing
Context: A cargo status array contains disposition codes
GIVEN
A cargo status array contains disposition codes
Applied to: Get Disposition Code from Status Array
WHEN
The system processes quantity impacts for disposition codes
THEN
Each disposition code is extracted from the status array for evaluation
Context: A disposition code needs to be processed
GIVEN
A disposition code needs to be processed
Applied to: Lookup Disposition Code in DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The disposition code details and action type are retrieved if found
Context: A disposition code is being processed for quantity impact
GIVEN
A disposition code is being processed for quantity impact
Applied to: Disposition Code Found?
WHEN
The system checks if the disposition code exists in the DC table
THEN
Processing continues if found, otherwise an error is generated
Context: A valid disposition code exists in the DC table
GIVEN
A valid disposition code exists in the DC table
Applied to: Retrieve Disposition Code Action Type
WHEN
The system retrieves the disposition code configuration
THEN
The action type (Add, Subtract, or Status Info) is determined for quantity processing
Context: A disposition code has a defined action type
GIVEN
A disposition code has a defined action type
Applied to: Action Type?
WHEN
The system evaluates the action type for quantity impact
THEN
The system routes to Add, Subtract, or No Quantity Impact processing based on the action type
Context: A disposition code has an 'Add' action type
GIVEN
A disposition code has an 'Add' action type
Applied to: Add to Release Quantity
WHEN
The system processes the quantity impact
THEN
The disposition code quantity is added to the current release quantity
Context: A disposition code has a 'Subtract' action type
GIVEN
A disposition code has a 'Subtract' action type
Applied to: Subtract from Release Quantity
WHEN
The system processes the quantity impact
THEN
The disposition code quantity is subtracted from the current release quantity
Context: A disposition code has 'Status Info' action type
GIVEN
A disposition code has 'Status Info' action type
Applied to: No Quantity Impact
WHEN
The system processes the disposition code
THEN
No quantity calculations are performed and processing continues to set impact flag
Context: A release quantity has been calculated from disposition code processing
GIVEN
A release quantity has been calculated from disposition code processing
Applied to: Validate Quantity Against Total Cargo
WHEN
The system validates the calculated quantity
THEN
The quantity must be between zero and the total cargo quantity inclusive
Context: A release quantity has been calculated and validated
GIVEN
A release quantity has been calculated and validated
Applied to: Quantity Valid?
WHEN
The system checks if the quantity is valid
THEN
Processing continues to update if valid, otherwise an error is generated
Context: A valid release quantity has been calculated
GIVEN
A valid release quantity has been calculated
Applied to: Update Release Quantity
WHEN
The system updates the cargo release quantity
THEN
The cargo record is updated with the new release quantity value
Context: A cargo release quantity has been updated
GIVEN
A cargo release quantity has been updated
Applied to: Generate Quantity Impact Message
WHEN
The system generates impact messaging
THEN
A message is created showing the before and after quantity values and the disposition code causing the change
Context: A quantity impact has been processed and messaged
GIVEN
A quantity impact has been processed and messaged
Applied to: Log Before/After Comparison
WHEN
The system logs the quantity change
THEN
The original quantity, new quantity, and disposition code are recorded in the system log
Context: Disposition code processing has been completed
GIVEN
Disposition code processing has been completed
Applied to: Set Quantity Impact Flag
WHEN
The system finalizes quantity impact processing
THEN
A quantity impact flag is set to indicate whether quantities were affected by the disposition code
Context: A disposition code is not found in DC table OR calculated quantity is invalid
GIVEN
A disposition code is not found in DC table OR calculated quantity is invalid
Applied to: Generate Error Message
WHEN
The system encounters a validation error
THEN
An error message is generated indicating the specific validation failure
R-GCX016E-cbl-01365 (+8) File: GCX016E.cbl Julian Date Conversion Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Julian Date Conversion':
  • Context - a date input is required for cargo age calculation:
    For Validate Input Date Format:
    When the system receives a date value for processing, then the system validates the date format is correct and numeric before proceeding with conversion.
  • Context - a date input has been provided for age calculation:
    For Set Error Flag for Invalid Date:
    When the date format validation fails or date is invalid, then the system sets an error flag to indicate date processing failure.
  • Context - an invalid date has been detected during validation:
    For Use Default System Date:
    When the system cannot process the provided date, then the system uses the current system date as the default value for age calculation.
  • Context - a valid date has been confirmed through validation:
    For Convert Date to Julian Format:
    When the system needs to perform age calculations, then the system converts the date to julian format using standard conversion algorithms.
  • Context - a date has been successfully converted to julian format:
    For Calculate Days Since Base Date:
    When the system needs to determine cargo age, then the system calculates the difference in days between the julian date and the established base date.
  • Context - julian date conversion and age calculation have been completed successfully:
    For Return Julian Date Value:
    When the calling process requires the julian date result, then the system returns the calculated julian date value for further processing.
  • Context - cargo processing is being performed:
    For Cargo Age Calculation Required:
    When the system needs to determine cargo age for business rules, then the system initiates date input processing for age calculation.
  • Context - julian date calculation has been completed:
    For Destination Index Management:
    When the system needs to update destination information, then the system uses the julian date result to manage destination index values.
  • Context - destination index management has been completed:
    For Bond Start Date Processing:
    When the system needs to process bond information, then the system uses julian date calculations to determine bond start date processing requirements.
👨‍💻 Technical ACs (Gherkin)
Context: A date input is required for cargo age calculation
GIVEN
A date input is required for cargo age calculation
Applied to: Validate Input Date Format
WHEN
The system receives a date value for processing
THEN
The system validates the date format is correct and numeric before proceeding with conversion
Context: A date input has been provided for age calculation
GIVEN
A date input has been provided for age calculation
Applied to: Set Error Flag for Invalid Date
WHEN
The date format validation fails or date is invalid
THEN
The system sets an error flag to indicate date processing failure
Context: An invalid date has been detected during validation
GIVEN
An invalid date has been detected during validation
Applied to: Use Default System Date
WHEN
The system cannot process the provided date
THEN
The system uses the current system date as the default value for age calculation
Context: A valid date has been confirmed through validation
GIVEN
A valid date has been confirmed through validation
Applied to: Convert Date to Julian Format
WHEN
The system needs to perform age calculations
THEN
The system converts the date to Julian format using standard conversion algorithms
Context: A date has been successfully converted to Julian format
GIVEN
A date has been successfully converted to Julian format
Applied to: Calculate Days Since Base Date
WHEN
The system needs to determine cargo age
THEN
The system calculates the difference in days between the Julian date and the established base date
Context: Julian date conversion and age calculation have been completed successfully
GIVEN
Julian date conversion and age calculation have been completed successfully
Applied to: Return Julian Date Value
WHEN
The calling process requires the Julian date result
THEN
The system returns the calculated Julian date value for further processing
Context: Cargo processing is being performed
GIVEN
Cargo processing is being performed
Applied to: Cargo Age Calculation Required
WHEN
The system needs to determine cargo age for business rules
THEN
The system initiates date input processing for age calculation
Context: Julian date calculation has been completed
GIVEN
Julian date calculation has been completed
Applied to: Destination Index Management
WHEN
The system needs to update destination information
THEN
The system uses the Julian date result to manage destination index values
Context: Destination index management has been completed
GIVEN
Destination index management has been completed
Applied to: Bond Start Date Processing
WHEN
The system needs to process bond information
THEN
The system uses Julian date calculations to determine bond start date processing requirements
R-GCX016E-cbl-01374 (+5) File: GCX016E.cbl Shiproot Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Shiproot Validation':
  • Context - a shipment identifier has been extracted from an edi message:
    For Query SHIPROOT Database:
    When the system queries the shiproot database for the shipment identifier, then the system should retrieve the shipment root record if it exists.
  • Context - the system has queried the shiproot database for a shipment identifier:
    For Shipment Root Record Exists?:
    When the query result indicates whether a shipment root record exists or not, then the system should set validation successful flag if record exists, otherwise set error flag.
  • Context - a shipment root record does not exist in the shiproot database:
    For Log Validation Error:
    When the validation check fails, then the system should log a validation error indicating the missing shipment root record.
  • Context - a validation error has been logged for a missing shipment root record:
    For Set Error Flag:
    When the shipment root validation process completes with failure, then the system should set an error flag to indicate validation failure.
  • Context - a shipment root record exists in the shiproot database:
    For Continue EDI Processing:
    When the validation is successful, then the system should continue with normal edi processing workflow.
  • Context - a shipment root record does not exist and error flag has been set:
    For Skip EDI Processing:
    When the validation process completes with failure, then the system should skip the edi processing for this shipment.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment identifier has been extracted from an EDI message
GIVEN
A shipment identifier has been extracted from an EDI message
Applied to: Query SHIPROOT Database
WHEN
The system queries the SHIPROOT database for the shipment identifier
THEN
The system should retrieve the shipment root record if it exists
Context: The system has queried the SHIPROOT database for a shipment identifier
GIVEN
The system has queried the SHIPROOT database for a shipment identifier
Applied to: Shipment Root Record Exists?
WHEN
The query result indicates whether a shipment root record exists or not
THEN
The system should set validation successful flag if record exists, otherwise set error flag
Context: A shipment root record does not exist in the SHIPROOT database
GIVEN
A shipment root record does not exist in the SHIPROOT database
Applied to: Log Validation Error
WHEN
The validation check fails
THEN
The system should log a validation error indicating the missing shipment root record
Context: A validation error has been logged for a missing shipment root record
GIVEN
A validation error has been logged for a missing shipment root record
Applied to: Set Error Flag
WHEN
The shipment root validation process completes with failure
THEN
The system should set an error flag to indicate validation failure
Context: A shipment root record exists in the SHIPROOT database
GIVEN
A shipment root record exists in the SHIPROOT database
Applied to: Continue EDI Processing
WHEN
The validation is successful
THEN
The system should continue with normal EDI processing workflow
Context: A shipment root record does not exist and error flag has been set
GIVEN
A shipment root record does not exist and error flag has been set
Applied to: Skip EDI Processing
WHEN
The validation process completes with failure
THEN
The system should skip the EDI processing for this shipment
R-GCX016E-cbl-01380 (+13) File: GCX016E.cbl Shipment Minimum Information Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Shipment Minimum Information Processing':
  • Context - a shipment requires minimum information processing:
    For Validate Shiproot Record Exists:
    When the system attempts to validate the shiproot record existence, then the system should verify the shiproot record exists in the database.
    For Generate Error - Shiproot Not Found:
    When the shiproot record is not found in the database, then the system should generate an error indicating shiproot not found and terminate processing.
  • Context - a valid shiproot record exists for the shipment:
    For Retrieve In-Bond Type Codes:
    When the system processes shipment minimum information, then the system should retrieve the applicable in-bond type codes from the shipment data.
  • Context - a valid shiproot record exists and in-bond type codes are retrieved:
    For Retrieve Entry Numbers:
    When the system processes shipment minimum information, then the system should retrieve all applicable entry numbers for the shipment.
  • Context - entry numbers have been successfully retrieved for the shipment:
    For Retrieve Location Identifiers:
    When the system processes location information, then the system should retrieve all relevant location identifiers for the shipment.
  • Context - location identifiers have been retrieved and x4 segments are available:
    For Process Destination Station Information from X4 Segments:
    When the system processes destination station information, then the system should extract destination station data from x4 segments and validate the information.
  • Context - destination station information has been processed from x4 segments:
    For Process Key Station Information:
    When the system processes key station information, then the system should identify and validate key station data for shipment routing.
  • Context - all required shipment data including station information has been processed:
    For Create U1 Shipment Minimum Segment:
    When the system creates the u1 segment, then the system should initialize a new u1 shipment minimum segment with proper structure.
  • Context - a u1 segment has been created and in-bond type codes are available:
    For Populate In-Bond Type Codes in U1:
    When the system populates the u1 segment with in-bond information, then the system should insert all applicable in-bond type codes into the u1 segment.
  • Context - in-bond type codes have been populated in the u1 segment and entry numbers are available:
    For Populate Entry Numbers in U1:
    When the system populates entry number information, then the system should insert all retrieved entry numbers into the appropriate fields of the u1 segment.
  • Context - entry numbers have been populated in the u1 segment and location identifiers are available:
    For Populate Location Identifiers in U1:
    When the system populates location information, then the system should insert all location identifiers into the appropriate fields of the u1 segment.
  • Context - the u1 segment has been populated with all required data elements:
    For Validate U1 Segment Data:
    When the system validates the u1 segment data, then the system should verify that all mandatory fields are populated and data formats are correct.
  • Context - the u1 segment has been validated and all data is correct:
    For Store U1 Segment for EDI Processing:
    When the system stores the u1 segment, then the system should save the u1 segment to the shipminu database for edi processing.
  • Context - the u1 segment has been successfully stored for edi processing:
    For Log Shipment Processing Action:
    When the system completes shipment processing, then the system should create a log entry documenting the successful completion of shipment minimum information processing.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires minimum information processing
GIVEN
A shipment requires minimum information processing
Applied to: Validate Shiproot Record Exists
WHEN
The system attempts to validate the shiproot record existence
THEN
The system should verify the shiproot record exists in the database
Applied to: Generate Error - Shiproot Not Found
WHEN
The shiproot record is not found in the database
THEN
The system should generate an error indicating shiproot not found and terminate processing
Context: A valid shiproot record exists for the shipment
GIVEN
A valid shiproot record exists for the shipment
Applied to: Retrieve In-Bond Type Codes
WHEN
The system processes shipment minimum information
THEN
The system should retrieve the applicable in-bond type codes from the shipment data
Context: A valid shiproot record exists and in-bond type codes are retrieved
GIVEN
A valid shiproot record exists and in-bond type codes are retrieved
Applied to: Retrieve Entry Numbers
WHEN
The system processes shipment minimum information
THEN
The system should retrieve all applicable entry numbers for the shipment
Context: Entry numbers have been successfully retrieved for the shipment
GIVEN
Entry numbers have been successfully retrieved for the shipment
Applied to: Retrieve Location Identifiers
WHEN
The system processes location information
THEN
The system should retrieve all relevant location identifiers for the shipment
Context: Location identifiers have been retrieved and X4 segments are available
GIVEN
Location identifiers have been retrieved and X4 segments are available
Applied to: Process Destination Station Information from X4 Segments
WHEN
The system processes destination station information
THEN
The system should extract destination station data from X4 segments and validate the information
Context: Destination station information has been processed from X4 segments
GIVEN
Destination station information has been processed from X4 segments
Applied to: Process Key Station Information
WHEN
The system processes key station information
THEN
The system should identify and validate key station data for shipment routing
Context: All required shipment data including station information has been processed
GIVEN
All required shipment data including station information has been processed
Applied to: Create U1 Shipment Minimum Segment
WHEN
The system creates the U1 segment
THEN
The system should initialize a new U1 shipment minimum segment with proper structure
Context: A U1 segment has been created and in-bond type codes are available
GIVEN
A U1 segment has been created and in-bond type codes are available
Applied to: Populate In-Bond Type Codes in U1
WHEN
The system populates the U1 segment with in-bond information
THEN
The system should insert all applicable in-bond type codes into the U1 segment
Context: In-bond type codes have been populated in the U1 segment and entry numbers are available
GIVEN
In-bond type codes have been populated in the U1 segment and entry numbers are available
Applied to: Populate Entry Numbers in U1
WHEN
The system populates entry number information
THEN
The system should insert all retrieved entry numbers into the appropriate fields of the U1 segment
Context: Entry numbers have been populated in the U1 segment and location identifiers are available
GIVEN
Entry numbers have been populated in the U1 segment and location identifiers are available
Applied to: Populate Location Identifiers in U1
WHEN
The system populates location information
THEN
The system should insert all location identifiers into the appropriate fields of the U1 segment
Context: The U1 segment has been populated with all required data elements
GIVEN
The U1 segment has been populated with all required data elements
Applied to: Validate U1 Segment Data
WHEN
The system validates the U1 segment data
THEN
The system should verify that all mandatory fields are populated and data formats are correct
Context: The U1 segment has been validated and all data is correct
GIVEN
The U1 segment has been validated and all data is correct
Applied to: Store U1 Segment for EDI Processing
WHEN
The system stores the U1 segment
THEN
The system should save the U1 segment to the SHIPMINU database for EDI processing
Context: The U1 segment has been successfully stored for EDI processing
GIVEN
The U1 segment has been successfully stored for EDI processing
Applied to: Log Shipment Processing Action
WHEN
The system completes shipment processing
THEN
The system should create a log entry documenting the successful completion of shipment minimum information processing
R-GCX016E-cbl-01394 (+13) File: GCX016E.cbl Destination Station Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Station Processing':
  • Context - an x4 segment has been received for processing:
    For Extract Destination Station Code:
    When the system processes the x4 segment, then the destination station code is extracted from the segment data.
  • Context - a destination station code has been extracted from x4 segment:
    For Station Code Present?:
    When the system validates the extracted station code, then the system determines if the station code is present or missing.
  • Context - a destination station code is present:
    For Valid Format?:
    When the system validates the station code format, then the system determines if the format is valid according to business standards.
  • Context - a valid format destination station code exists:
    For Lookup Station in Destination Table:
    When the system performs a lookup in the destination station table, then the system searches for matching station information.
  • Context - a lookup has been performed in the destination station table:
    For Station Found?:
    When the system evaluates the lookup results, then the system determines if the station was found or not found.
  • Context - a destination station is found in the reference table:
    For Retrieve Station Information:
    When the system retrieves station data, then complete station information including name and attributes is retrieved.
  • Context - complete station information has been retrieved:
    For Set Destination Station Data:
    When the system sets destination station data, then all relevant destination station fields are populated with the retrieved information.
  • Context - destination station data has been set:
    For Update Cargo Record with Station Info:
    When the system updates the cargo record, then the cargo record is updated with the destination station information.
  • Context - cargo record has been updated with station information:
    For Log Station Processing Success:
    When the system completes station processing, then a success log entry is created for station processing.
  • Context - no destination station code is present in the x4 segment:
    For Set Default Station Information:
    When the system processes the missing station code, then default station information is applied to maintain data integrity.
  • Context - an x4 segment is processed without a destination station code:
    For Log Station Code Missing:
    When the system detects the missing station code, then a log entry is created indicating the station code is missing.
  • Context - a destination station code is present but has invalid format:
    For Log Invalid Station Format:
    When the system validates the station code format, then a log entry is created indicating invalid station format.
  • Context - a valid format destination station code is not found in the reference table:
    For Log Station Not Found Error:
    When the system completes the lookup process, then an error log entry is created indicating the station was not found.
  • Context - destination station processing is complete (successful or with defaults):
    For Continue X4 Processing:
    When the system finishes station processing, then processing continues with the next components of the x4 segment.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment has been received for processing
GIVEN
An X4 segment has been received for processing
Applied to: Extract Destination Station Code
WHEN
The system processes the X4 segment
THEN
The destination station code is extracted from the segment data
Context: A destination station code has been extracted from X4 segment
GIVEN
A destination station code has been extracted from X4 segment
Applied to: Station Code Present?
WHEN
The system validates the extracted station code
THEN
The system determines if the station code is present or missing
Context: A destination station code is present
GIVEN
A destination station code is present
Applied to: Valid Format?
WHEN
The system validates the station code format
THEN
The system determines if the format is valid according to business standards
Context: A valid format destination station code exists
GIVEN
A valid format destination station code exists
Applied to: Lookup Station in Destination Table
WHEN
The system performs a lookup in the destination station table
THEN
The system searches for matching station information
Context: A lookup has been performed in the destination station table
GIVEN
A lookup has been performed in the destination station table
Applied to: Station Found?
WHEN
The system evaluates the lookup results
THEN
The system determines if the station was found or not found
Context: A destination station is found in the reference table
GIVEN
A destination station is found in the reference table
Applied to: Retrieve Station Information
WHEN
The system retrieves station data
THEN
Complete station information including name and attributes is retrieved
Context: Complete station information has been retrieved
GIVEN
Complete station information has been retrieved
Applied to: Set Destination Station Data
WHEN
The system sets destination station data
THEN
All relevant destination station fields are populated with the retrieved information
Context: Destination station data has been set
GIVEN
Destination station data has been set
Applied to: Update Cargo Record with Station Info
WHEN
The system updates the cargo record
THEN
The cargo record is updated with the destination station information
Context: Cargo record has been updated with station information
GIVEN
Cargo record has been updated with station information
Applied to: Log Station Processing Success
WHEN
The system completes station processing
THEN
A success log entry is created for station processing
Context: No destination station code is present in the X4 segment
GIVEN
No destination station code is present in the X4 segment
Applied to: Set Default Station Information
WHEN
The system processes the missing station code
THEN
Default station information is applied to maintain data integrity
Context: An X4 segment is processed without a destination station code
GIVEN
An X4 segment is processed without a destination station code
Applied to: Log Station Code Missing
WHEN
The system detects the missing station code
THEN
A log entry is created indicating the station code is missing
Context: A destination station code is present but has invalid format
GIVEN
A destination station code is present but has invalid format
Applied to: Log Invalid Station Format
WHEN
The system validates the station code format
THEN
A log entry is created indicating invalid station format
Context: A valid format destination station code is not found in the reference table
GIVEN
A valid format destination station code is not found in the reference table
Applied to: Log Station Not Found Error
WHEN
The system completes the lookup process
THEN
An error log entry is created indicating the station was not found
Context: Destination station processing is complete (successful or with defaults)
GIVEN
Destination station processing is complete (successful or with defaults)
Applied to: Continue X4 Processing
WHEN
The system finishes station processing
THEN
Processing continues with the next components of the X4 segment
R-GCX016E-cbl-01408 (+12) File: GCX016E.cbl Key Station Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Key Station Processing':
  • Context - an x4 segment contains cargo disposition data with location information:
    For Extract Location Identifier from X4 Segment:
    When the system processes the x4 segment for key station lookup, then the location identifier is extracted from the x4 segment data.
  • Context - a location identifier has been extracted from x4 segment data:
    For Validate Location Identifier Format:
    When the system validates the location identifier format, then the location identifier format is confirmed as valid or invalid.
  • Context - a location identifier has undergone format validation:
    For Location Identifier Valid?:
    When the system evaluates the validation results, then the system proceeds with key station lookup if valid or generates error message if invalid.
  • Context - a valid location identifier has been confirmed:
    For Retrieve Key Station Information from KS Table:
    When the system queries the ks table for key station information, then the system retrieves matching key station data from the ks table.
  • Context - the system needs to lookup key station information in the ks table:
    For Call GCCTBIO for Table Lookup:
    When the system calls gcctbio with the location identifier, then gcctbio performs the table lookup and returns results.
  • Context - gcctbio has completed the key station table lookup:
    For Key Station Found?:
    When the system evaluates the lookup results, then the system proceeds with data loading if station found or generates error if not found.
  • Context - key station information has been successfully retrieved from the ks table:
    For Load Key Station Data:
    When the system loads the station data, then key station data is available in working storage for validation and field setting.
  • Context - key station data has been loaded into working storage:
    For Validate Station Information:
    When the system validates the station information, then the station data is confirmed as valid or invalid based on business rules.
  • Context - station information has undergone validation checks:
    For Station Data Valid?:
    When the system evaluates the validation results, then the system proceeds with field setting if valid or generates error message if invalid.
  • Context - valid key station data is available in working storage:
    For Set Key Station Fields:
    When the system sets key station fields, then key station fields are populated with validated station information.
  • Context - key station fields have been successfully set:
    For Update Location Validation Status:
    When the system updates location validation status, then location validation status indicates successful key station processing.
  • Context - a location identifier has failed format validation:
    For Generate Error Message for Invalid Location:
    When the system generates an error message, then an error message is created indicating invalid location identifier.
  • Context - key station lookup has failed to find matching station data:
    For Generate Error Message for Station Not Found:
    When the system generates an error message, then an error message is created indicating station not found.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment contains cargo disposition data with location information
GIVEN
An X4 segment contains cargo disposition data with location information
Applied to: Extract Location Identifier from X4 Segment
WHEN
The system processes the X4 segment for key station lookup
THEN
The location identifier is extracted from the X4 segment data
Context: A location identifier has been extracted from X4 segment data
GIVEN
A location identifier has been extracted from X4 segment data
Applied to: Validate Location Identifier Format
WHEN
The system validates the location identifier format
THEN
The location identifier format is confirmed as valid or invalid
Context: A location identifier has undergone format validation
GIVEN
A location identifier has undergone format validation
Applied to: Location Identifier Valid?
WHEN
The system evaluates the validation results
THEN
The system proceeds with key station lookup if valid or generates error message if invalid
Context: A valid location identifier has been confirmed
GIVEN
A valid location identifier has been confirmed
Applied to: Retrieve Key Station Information from KS Table
WHEN
The system queries the KS table for key station information
THEN
The system retrieves matching key station data from the KS table
Context: The system needs to lookup key station information in the KS table
GIVEN
The system needs to lookup key station information in the KS table
Applied to: Call GCCTBIO for Table Lookup
WHEN
The system calls GCCTBIO with the location identifier
THEN
GCCTBIO performs the table lookup and returns results
Context: GCCTBIO has completed the key station table lookup
GIVEN
GCCTBIO has completed the key station table lookup
Applied to: Key Station Found?
WHEN
The system evaluates the lookup results
THEN
The system proceeds with data loading if station found or generates error if not found
Context: Key station information has been successfully retrieved from the KS table
GIVEN
Key station information has been successfully retrieved from the KS table
Applied to: Load Key Station Data
WHEN
The system loads the station data
THEN
Key station data is available in working storage for validation and field setting
Context: Key station data has been loaded into working storage
GIVEN
Key station data has been loaded into working storage
Applied to: Validate Station Information
WHEN
The system validates the station information
THEN
The station data is confirmed as valid or invalid based on business rules
Context: Station information has undergone validation checks
GIVEN
Station information has undergone validation checks
Applied to: Station Data Valid?
WHEN
The system evaluates the validation results
THEN
The system proceeds with field setting if valid or generates error message if invalid
Context: Valid key station data is available in working storage
GIVEN
Valid key station data is available in working storage
Applied to: Set Key Station Fields
WHEN
The system sets key station fields
THEN
Key station fields are populated with validated station information
Context: Key station fields have been successfully set
GIVEN
Key station fields have been successfully set
Applied to: Update Location Validation Status
WHEN
The system updates location validation status
THEN
Location validation status indicates successful key station processing
Context: A location identifier has failed format validation
GIVEN
A location identifier has failed format validation
Applied to: Generate Error Message for Invalid Location
WHEN
The system generates an error message
THEN
An error message is created indicating invalid location identifier
Context: Key station lookup has failed to find matching station data
GIVEN
Key station lookup has failed to find matching station data
Applied to: Generate Error Message for Station Not Found
WHEN
The system generates an error message
THEN
An error message is created indicating station not found
R-GCX016E-cbl-01421 (+12) File: GCX016E.cbl N9 Reference Information Retrieval Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N9 Reference Information Retrieval':
  • Context - a cargo processing request is received:
    For Start N9 Reference Information Retrieval:
    When the system begins n9 reference information retrieval, then the n9 reference retrieval process is initiated.
  • Context - n9 reference retrieval process has been initiated:
    For Identify Cargo Record:
    When the system needs to locate the target cargo record, then the cargo record is identified using the cargo key information.
  • Context - the cargo record has been identified:
    For Access Cargo Segments Database:
    When the system needs to access n9 reference segments, then the gcsuss02 cargo segments database is accessed.
  • Context - the cargo segments database has been accessed:
    For N9 Segments Available?:
    When the system searches for n9 segments for the cargo, then the system determines if n9 segments are available or not available.
  • Context - n9 segments are available for the cargo:
    For Retrieve N9 Reference Numbers:
    When the system processes the available n9 segments, then all n9 reference numbers are retrieved from the segments.
  • Context - n9 reference numbers have been retrieved:
    For Validate Reference Number Format:
    When the system validates the format of each reference number, then each reference number is confirmed to meet format requirements.
  • Context - n9 reference numbers have been validated for format:
    For Reference Type?:
    When the system examines the reference type qualifier, then references are classified as either fda references (a1/a3) or general references.
  • Context - n9 references are classified as fda type with a1 or a3 qualifiers:
    For Process FDA Reference Numbers - A1/A3:
    When the system processes these fda references, then fda reference numbers are processed with specialized fda handling rules.
  • Context - n9 references are classified as general (non-fda) type:
    For Process General Reference Numbers:
    When the system processes these general references, then general reference numbers are processed using standard reference handling procedures.
  • Context - reference numbers have been processed (either fda or general):
    For Format Reference Information:
    When the system formats the reference information, then reference information is formatted into standardized structure with proper qualifiers and values.
  • Context - reference information has been formatted:
    For Store Reference Data in Working Storage:
    When the system stores the reference data, then formatted reference information is stored in working storage n9 arrays.
  • Context - reference data has been stored in working storage:
    For Update Cargo Record with References:
    When the system updates the cargo record, then the cargo record is updated with all processed n9 reference information.
  • Context - all n9 reference processing has been completed or no n9 segments were available:
    For End N9 Reference Retrieval:
    When the system reaches the end of the n9 reference retrieval process, then the n9 reference information retrieval process is completed.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing request is received
GIVEN
A cargo processing request is received
Applied to: Start N9 Reference Information Retrieval
WHEN
The system begins N9 reference information retrieval
THEN
The N9 reference retrieval process is initiated
Context: N9 reference retrieval process has been initiated
GIVEN
N9 reference retrieval process has been initiated
Applied to: Identify Cargo Record
WHEN
The system needs to locate the target cargo record
THEN
The cargo record is identified using the cargo key information
Context: The cargo record has been identified
GIVEN
The cargo record has been identified
Applied to: Access Cargo Segments Database
WHEN
The system needs to access N9 reference segments
THEN
The GCSUSS02 cargo segments database is accessed
Context: The cargo segments database has been accessed
GIVEN
The cargo segments database has been accessed
Applied to: N9 Segments Available?
WHEN
The system searches for N9 segments for the cargo
THEN
The system determines if N9 segments are available or not available
Context: N9 segments are available for the cargo
GIVEN
N9 segments are available for the cargo
Applied to: Retrieve N9 Reference Numbers
WHEN
The system processes the available N9 segments
THEN
All N9 reference numbers are retrieved from the segments
Context: N9 reference numbers have been retrieved
GIVEN
N9 reference numbers have been retrieved
Applied to: Validate Reference Number Format
WHEN
The system validates the format of each reference number
THEN
Each reference number is confirmed to meet format requirements
Context: N9 reference numbers have been validated for format
GIVEN
N9 reference numbers have been validated for format
Applied to: Reference Type?
WHEN
The system examines the reference type qualifier
THEN
References are classified as either FDA references (A1/A3) or general references
Context: N9 references are classified as FDA type with A1 or A3 qualifiers
GIVEN
N9 references are classified as FDA type with A1 or A3 qualifiers
Applied to: Process FDA Reference Numbers - A1/A3
WHEN
The system processes these FDA references
THEN
FDA reference numbers are processed with specialized FDA handling rules
Context: N9 references are classified as general (non-FDA) type
GIVEN
N9 references are classified as general (non-FDA) type
Applied to: Process General Reference Numbers
WHEN
The system processes these general references
THEN
General reference numbers are processed using standard reference handling procedures
Context: Reference numbers have been processed (either FDA or general)
GIVEN
Reference numbers have been processed (either FDA or general)
Applied to: Format Reference Information
WHEN
The system formats the reference information
THEN
Reference information is formatted into standardized structure with proper qualifiers and values
Context: Reference information has been formatted
GIVEN
Reference information has been formatted
Applied to: Store Reference Data in Working Storage
WHEN
The system stores the reference data
THEN
Formatted reference information is stored in working storage N9 arrays
Context: Reference data has been stored in working storage
GIVEN
Reference data has been stored in working storage
Applied to: Update Cargo Record with References
WHEN
The system updates the cargo record
THEN
The cargo record is updated with all processed N9 reference information
Context: All N9 reference processing has been completed OR no N9 segments were available
GIVEN
All N9 reference processing has been completed OR no N9 segments were available
Applied to: End N9 Reference Retrieval
WHEN
The system reaches the end of the N9 reference retrieval process
THEN
The N9 reference information retrieval process is completed
R-GCX016E-cbl-01434 (+10) File: GCX016E.cbl Canadian Cargo Lookup Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Cargo Lookup':
  • Context - a us cargo record exists with equipment information:
    For Extract Equipment ID from US Cargo Record:
    When the system processes the cargo for cross-border tracking, then the equipment id is extracted from the cargo record for canadian cargo lookup.
  • Context - an equipment id has been extracted from the us cargo record:
    For Search Canadian Cargo Database GCCC-CARGO-ROOT:
    When the system searches the canadian cargo database gccc-cargo-root, then the system retrieves any canadian cargo records that match the equipment id.
  • Context - a search has been performed in the canadian cargo database:
    For Canadian Cargo Record Found?:
    When the system evaluates the search results, then if a canadian cargo record is found, proceed to status validation; otherwise, log no canadian cargo found and continue processing.
  • Context - a canadian cargo record has been found:
    For Validate Canadian Cargo Status:
    When the system validates the cargo status, then the cargo status is checked to ensure it is valid for processing and not in an excluded state.
  • Context - a canadian cargo record status has been validated:
    For Status Valid for Processing?:
    When the system evaluates processing eligibility, then if status is valid, proceed to equipment id matching; if status is deleted or new bond created, skip the record and continue processing.
  • Context - a valid canadian cargo record exists for processing:
    For Match Equipment IDs Between Systems:
    When the system matches equipment ids between us and canadian systems, then equipment ids are compared and validated for creating cross-border tracking links.
  • Context - equipment ids have been successfully matched between systems:
    For Create Cross-Border Tracking Link:
    When the system creates cross-border tracking links, then a tracking relationship is established between the us and canadian cargo records.
  • Context - a cross-border tracking link has been created:
    For Update Cargo with Canadian Reference:
    When the system updates the us cargo record, then the us cargo record is updated with canadian cargo reference information for cross-border tracking.
  • Context - a canadian cargo record has been successfully matched and linked:
    For Log Canadian Cargo Match Found:
    When the system completes the cross-border linking process, then a log entry is created documenting the successful canadian cargo match.
  • Context - no canadian cargo record is found for the equipment id:
    For Log No Canadian Cargo Found:
    When the system completes the canadian cargo search, then a log entry is created documenting that no canadian cargo was found and processing continues.
  • Context - a canadian cargo record is found but has deleted or new bond created status:
    For Skip Deleted/Invalid Records:
    When the system evaluates the record for processing, then the record is skipped and excluded from cross-border tracking, and processing continues with the next record.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo record exists with equipment information
GIVEN
A US cargo record exists with equipment information
Applied to: Extract Equipment ID from US Cargo Record
WHEN
The system processes the cargo for cross-border tracking
THEN
The equipment ID is extracted from the cargo record for Canadian cargo lookup
Context: An equipment ID has been extracted from the US cargo record
GIVEN
An equipment ID has been extracted from the US cargo record
Applied to: Search Canadian Cargo Database GCCC-CARGO-ROOT
WHEN
The system searches the Canadian cargo database GCCC-CARGO-ROOT
THEN
The system retrieves any Canadian cargo records that match the equipment ID
Context: A search has been performed in the Canadian cargo database
GIVEN
A search has been performed in the Canadian cargo database
Applied to: Canadian Cargo Record Found?
WHEN
The system evaluates the search results
THEN
If a Canadian cargo record is found, proceed to status validation; otherwise, log no Canadian cargo found and continue processing
Context: A Canadian cargo record has been found
GIVEN
A Canadian cargo record has been found
Applied to: Validate Canadian Cargo Status
WHEN
The system validates the cargo status
THEN
The cargo status is checked to ensure it is valid for processing and not in an excluded state
Context: A Canadian cargo record status has been validated
GIVEN
A Canadian cargo record status has been validated
Applied to: Status Valid for Processing?
WHEN
The system evaluates processing eligibility
THEN
If status is valid, proceed to equipment ID matching; if status is deleted or new bond created, skip the record and continue processing
Context: A valid Canadian cargo record exists for processing
GIVEN
A valid Canadian cargo record exists for processing
Applied to: Match Equipment IDs Between Systems
WHEN
The system matches equipment IDs between US and Canadian systems
THEN
Equipment IDs are compared and validated for creating cross-border tracking links
Context: Equipment IDs have been successfully matched between systems
GIVEN
Equipment IDs have been successfully matched between systems
Applied to: Create Cross-Border Tracking Link
WHEN
The system creates cross-border tracking links
THEN
A tracking relationship is established between the US and Canadian cargo records
Context: A cross-border tracking link has been created
GIVEN
A cross-border tracking link has been created
Applied to: Update Cargo with Canadian Reference
WHEN
The system updates the US cargo record
THEN
The US cargo record is updated with Canadian cargo reference information for cross-border tracking
Context: A Canadian cargo record has been successfully matched and linked
GIVEN
A Canadian cargo record has been successfully matched and linked
Applied to: Log Canadian Cargo Match Found
WHEN
The system completes the cross-border linking process
THEN
A log entry is created documenting the successful Canadian cargo match
Context: No Canadian cargo record is found for the equipment ID
GIVEN
No Canadian cargo record is found for the equipment ID
Applied to: Log No Canadian Cargo Found
WHEN
The system completes the Canadian cargo search
THEN
A log entry is created documenting that no Canadian cargo was found and processing continues
Context: A Canadian cargo record is found but has deleted or new bond created status
GIVEN
A Canadian cargo record is found but has deleted or new bond created status
Applied to: Skip Deleted/Invalid Records
WHEN
The system evaluates the record for processing
THEN
The record is skipped and excluded from cross-border tracking, and processing continues with the next record
R-GCX016E-cbl-01445 (+13) File: GCX016E.cbl Transaction Spawning Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transaction Spawning':
  • Context - a cargo processing transaction is being executed:
    For Multi-Manifest Scenario?:
    When the system evaluates whether multiple manifests are involved in the current transaction, then the system determines if follower manifest processing is required and routes accordingly.
  • Context - a multi-manifest scenario has been identified:
    For Identify Lead Manifest CCN:
    When the system needs to process follower manifests, then the lead manifest ccn is identified and stored for comparison with follower manifest ccns.
  • Context - lead manifest ccn has been identified:
    For Identify US CCN Key:
    When the system prepares to compare manifests, then the us ccn key is extracted and prepared for comparison with the lead manifest ccn.
  • Context - both lead manifest ccn and us ccn key have been identified:
    For Lead Manifest CCN ≠ US CCN Key?:
    When the system compares the lead manifest ccn with the us ccn key, then if the ccns are different, follower manifest processing is initiated; if they are the same, no additional processing is required.
  • Context - lead manifest ccn differs from us ccn key:
    For Prepare 350 Special Action Message:
    When the system prepares to spawn a follower manifest transaction, then a special action message with action code 350 is prepared for the gct0162e transaction.
  • Context - a special action message is being prepared for follower manifest processing:
    For Include Disposition Codes:
    When the system builds the transaction message content, then all relevant disposition codes from the original transaction are included in the follower manifest message.
  • Context - disposition codes have been included in the follower manifest message:
    For Include Quantities:
    When the system continues building the transaction message, then all relevant quantity information from the original transaction is included in the follower manifest message.
  • Context - quantities have been included in the follower manifest message:
    For Include Entry Numbers:
    When the system completes building the transaction message, then all relevant entry numbers from the original transaction are included in the follower manifest message.
  • Context - a complete follower manifest message has been prepared with all required information:
    For Spawn GCT0162E Transaction:
    When the system is ready to process the follower manifest, then a gct0162e transaction is spawned with the prepared message for follower manifest processing.
  • Context - a gct0162e transaction has been successfully spawned for follower manifest processing:
    For Set Follower Manifest Processing Flag:
    When the system updates processing status, then follower manifest processing flags are set to indicate the current processing state.
  • Context - follower manifest processing flags have been set for the current manifest:
    For Continue with Next Manifest:
    When the system is ready to process additional manifests, then processing continues with the next manifest in the sequence.
  • Context - the current follower manifest has been processed:
    For More Follower Manifests?:
    When the system checks for additional manifests in the sequence, then if more follower manifests exist, processing continues; otherwise, transaction spawning is completed.
  • Context - all follower manifests have been processed or no follower manifests were required:
    For Complete Transaction Spawning:
    When the transaction spawning process reaches completion, then the transaction spawning process is marked as complete and control returns to the main processing flow.
  • Context - either no multi-manifest scenario exists or lead manifest ccn equals us ccn key:
    For No Transaction Spawning Required:
    When the system determines that no follower manifest processing is needed, then no transaction spawning occurs and processing continues with the normal flow.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing transaction is being executed
GIVEN
A cargo processing transaction is being executed
Applied to: Multi-Manifest Scenario?
WHEN
The system evaluates whether multiple manifests are involved in the current transaction
THEN
The system determines if follower manifest processing is required and routes accordingly
Context: A multi-manifest scenario has been identified
GIVEN
A multi-manifest scenario has been identified
Applied to: Identify Lead Manifest CCN
WHEN
The system needs to process follower manifests
THEN
The lead manifest CCN is identified and stored for comparison with follower manifest CCNs
Context: Lead manifest CCN has been identified
GIVEN
Lead manifest CCN has been identified
Applied to: Identify US CCN Key
WHEN
The system prepares to compare manifests
THEN
The US CCN key is extracted and prepared for comparison with the lead manifest CCN
Context: Both lead manifest CCN and US CCN key have been identified
GIVEN
Both lead manifest CCN and US CCN key have been identified
Applied to: Lead Manifest CCN ≠ US CCN Key?
WHEN
The system compares the lead manifest CCN with the US CCN key
THEN
If the CCNs are different, follower manifest processing is initiated; if they are the same, no additional processing is required
Context: Lead manifest CCN differs from US CCN key
GIVEN
Lead manifest CCN differs from US CCN key
Applied to: Prepare 350 Special Action Message
WHEN
The system prepares to spawn a follower manifest transaction
THEN
A special action message with action code 350 is prepared for the GCT0162E transaction
Context: A special action message is being prepared for follower manifest processing
GIVEN
A special action message is being prepared for follower manifest processing
Applied to: Include Disposition Codes
WHEN
The system builds the transaction message content
THEN
All relevant disposition codes from the original transaction are included in the follower manifest message
Context: Disposition codes have been included in the follower manifest message
GIVEN
Disposition codes have been included in the follower manifest message
Applied to: Include Quantities
WHEN
The system continues building the transaction message
THEN
All relevant quantity information from the original transaction is included in the follower manifest message
Context: Quantities have been included in the follower manifest message
GIVEN
Quantities have been included in the follower manifest message
Applied to: Include Entry Numbers
WHEN
The system completes building the transaction message
THEN
All relevant entry numbers from the original transaction are included in the follower manifest message
Context: A complete follower manifest message has been prepared with all required information
GIVEN
A complete follower manifest message has been prepared with all required information
Applied to: Spawn GCT0162E Transaction
WHEN
The system is ready to process the follower manifest
THEN
A GCT0162E transaction is spawned with the prepared message for follower manifest processing
Context: A GCT0162E transaction has been successfully spawned for follower manifest processing
GIVEN
A GCT0162E transaction has been successfully spawned for follower manifest processing
Applied to: Set Follower Manifest Processing Flag
WHEN
The system updates processing status
THEN
Follower manifest processing flags are set to indicate the current processing state
Context: Follower manifest processing flags have been set for the current manifest
GIVEN
Follower manifest processing flags have been set for the current manifest
Applied to: Continue with Next Manifest
WHEN
The system is ready to process additional manifests
THEN
Processing continues with the next manifest in the sequence
Context: The current follower manifest has been processed
GIVEN
The current follower manifest has been processed
Applied to: More Follower Manifests?
WHEN
The system checks for additional manifests in the sequence
THEN
If more follower manifests exist, processing continues; otherwise, transaction spawning is completed
Context: All follower manifests have been processed or no follower manifests were required
GIVEN
All follower manifests have been processed or no follower manifests were required
Applied to: Complete Transaction Spawning
WHEN
The transaction spawning process reaches completion
THEN
The transaction spawning process is marked as complete and control returns to the main processing flow
Context: Either no multi-manifest scenario exists or lead manifest CCN equals US CCN key
GIVEN
Either no multi-manifest scenario exists or lead manifest CCN equals US CCN key
Applied to: No Transaction Spawning Required
WHEN
The system determines that no follower manifest processing is needed
THEN
No transaction spawning occurs and processing continues with the normal flow
R-GCX016E-cbl-01459 (+13) File: GCX016E.cbl Error Handling and Abend Processing Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Handling and Abend Processing':
  • Context - a message is being processed from the message queue:
    For MQ Message Error:
    When mq completion code is not ok or reason code indicates message unavailable (2033) or backout count is not zero, then set appropriate message status flags (message not available or skip message) and generate error notification to merlin system.
  • Context - a database read, write, or update operation is being performed:
    For Database I/O Error:
    When database operation returns an error status code, then log error information, generate merlin error message, and either continue processing or abend based on error severity.
  • Context - a lookup is performed against reference tables (dc table, train list, broker table, etc.):
    For Table Lookup Error:
    When the lookup operation fails to find matching records or returns an error, then generate appropriate error message, log the lookup failure, and continue processing with default values or error handling.
  • Context - m10 segment contains vessel name that does not start with 'train' or 'day':
    For Train Not Found Error:
    When train lookup in train list fails to find matching train record, then generate train not found error message to merlin system and continue processing remaining segments.
  • Context - x4 and n7 segments specify cargo identification information:
    For Cargo Not Found Error:
    When cargo lookup fails to find matching cargo records in the database, then generate cargo not found error message, log the missing cargo information, and continue processing other cargos.
  • Context - x4 segment contains disposition code information:
    For Invalid Disposition Code Error:
    When disposition code lookup in dc table fails or returns invalid status, then generate invalid disposition code error message, log the invalid code, and skip processing for that specific disposition code.
  • Context - an error condition has been detected during message processing:
    For Generate Merlin Error Message:
    When error information needs to be communicated to business users, then format error message with relevant business context (train id, cargo information, disposition codes) and route to merlin system.
  • Context - an error has occurred during message processing:
    For Log Error Information:
    When error logging is required for audit trail, then log error details including message id, segment information, error type, and relevant business data for debugging purposes.
  • Context - an error condition has been identified and logged:
    For Set Error Flags:
    When processing flow needs to be controlled based on error status, then set appropriate error flags to indicate error type and severity for downstream processing decisions.
  • Context - an error message has been generated for routing:
    For Route Error Message to Default Recipient:
    When primary merlin id routing fails or is unavailable, then route error message to default recipients (om01247, aei9999) with fallback notification.
  • Context - an error has been detected and appropriate error handling has been performed:
    For Continue Processing or Terminate:
    When decision is needed on whether to continue processing remaining messages/segments, then continue processing for non-critical errors (train not found, cargo not found) or terminate for critical system errors (database failures, mq errors).
  • Context - a business-level error has occurred (train not found, cargo not found, invalid disposition code):
    For Reroute Message with Error Notification:
    When original message routing cannot be completed due to the error, then reroute message to backup recipients with error notification explaining the business issue.
  • Context - error handling is in progress and debug logging is enabled:
    For Create Debug Log Entry:
    When detailed troubleshooting information is needed for business rule analysis, then create debug log entries showing before/after status arrays, disposition codes, and cargo status changes.
  • Context - error handling has been completed for a specific error condition:
    For Update Processing Status:
    When processing status needs to reflect the current state after error handling, then update processing status flags and counters to indicate error resolution and readiness for continued processing.
👨‍💻 Technical ACs (Gherkin)
Context: A message is being processed from the message queue
GIVEN
A message is being processed from the message queue
Applied to: MQ Message Error
WHEN
MQ completion code is not OK or reason code indicates message unavailable (2033) or backout count is not zero
THEN
Set appropriate message status flags (message not available or skip message) and generate error notification to Merlin system
Context: A database read, write, or update operation is being performed
GIVEN
A database read, write, or update operation is being performed
Applied to: Database I/O Error
WHEN
Database operation returns an error status code
THEN
Log error information, generate Merlin error message, and either continue processing or abend based on error severity
Context: A lookup is performed against reference tables (DC table, train list, broker table, etc.)
GIVEN
A lookup is performed against reference tables (DC table, train list, broker table, etc.)
Applied to: Table Lookup Error
WHEN
The lookup operation fails to find matching records or returns an error
THEN
Generate appropriate error message, log the lookup failure, and continue processing with default values or error handling
Context: M10 segment contains vessel name that does not start with 'TRAIN' or 'DAY'
GIVEN
M10 segment contains vessel name that does not start with 'TRAIN' or 'DAY'
Applied to: Train Not Found Error
WHEN
Train lookup in train list fails to find matching train record
THEN
Generate train not found error message to Merlin system and continue processing remaining segments
Context: X4 and N7 segments specify cargo identification information
GIVEN
X4 and N7 segments specify cargo identification information
Applied to: Cargo Not Found Error
WHEN
Cargo lookup fails to find matching cargo records in the database
THEN
Generate cargo not found error message, log the missing cargo information, and continue processing other cargos
Context: X4 segment contains disposition code information
GIVEN
X4 segment contains disposition code information
Applied to: Invalid Disposition Code Error
WHEN
Disposition code lookup in DC table fails or returns invalid status
THEN
Generate invalid disposition code error message, log the invalid code, and skip processing for that specific disposition code
Context: An error condition has been detected during message processing
GIVEN
An error condition has been detected during message processing
Applied to: Generate Merlin Error Message
WHEN
Error information needs to be communicated to business users
THEN
Format error message with relevant business context (train ID, cargo information, disposition codes) and route to Merlin system
Context: An error has occurred during message processing
GIVEN
An error has occurred during message processing
Applied to: Log Error Information
WHEN
Error logging is required for audit trail
THEN
Log error details including message ID, segment information, error type, and relevant business data for debugging purposes
Context: An error condition has been identified and logged
GIVEN
An error condition has been identified and logged
Applied to: Set Error Flags
WHEN
Processing flow needs to be controlled based on error status
THEN
Set appropriate error flags to indicate error type and severity for downstream processing decisions
Context: An error message has been generated for routing
GIVEN
An error message has been generated for routing
Applied to: Route Error Message to Default Recipient
WHEN
Primary Merlin ID routing fails or is unavailable
THEN
Route error message to default recipients (OM01247, AEI9999) with fallback notification
Context: An error has been detected and appropriate error handling has been performed
GIVEN
An error has been detected and appropriate error handling has been performed
Applied to: Continue Processing or Terminate
WHEN
Decision is needed on whether to continue processing remaining messages/segments
THEN
Continue processing for non-critical errors (train not found, cargo not found) or terminate for critical system errors (database failures, MQ errors)
Context: A business-level error has occurred (train not found, cargo not found, invalid disposition code)
GIVEN
A business-level error has occurred (train not found, cargo not found, invalid disposition code)
Applied to: Reroute Message with Error Notification
WHEN
Original message routing cannot be completed due to the error
THEN
Reroute message to backup recipients with error notification explaining the business issue
Context: Error handling is in progress and debug logging is enabled
GIVEN
Error handling is in progress and debug logging is enabled
Applied to: Create Debug Log Entry
WHEN
Detailed troubleshooting information is needed for business rule analysis
THEN
Create debug log entries showing before/after status arrays, disposition codes, and cargo status changes
Context: Error handling has been completed for a specific error condition
GIVEN
Error handling has been completed for a specific error condition
Applied to: Update Processing Status
WHEN
Processing status needs to reflect the current state after error handling
THEN
Update processing status flags and counters to indicate error resolution and readiness for continued processing
R-GCX016E-cbl-01473 (+12) File: GCX016E.cbl Train ID Validation Processing Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train ID Validation Processing':
  • Context - an m10 vessel name segment is received:
    For Extract Train ID from Vessel Name:
    When the system processes the vessel name field, then the train id is extracted from the vessel name for validation.
  • Context - a vessel name has been processed for train id extraction:
    For Train ID Present?:
    When the system checks if a valid train id was extracted, then if train id is present, proceed to train lookup; if not present, generate train not found error.
  • Context - a valid train id has been extracted from the vessel name:
    For Call GCCUTRIO to Lookup Train in System:
    When the system needs to validate the train exists in the system, then call gccutrio program to lookup train data from gcwtl train list segments.
  • Context - gccutrio has been called to lookup train information:
    For Train Found in System?:
    When the system evaluates the lookup results, then if train is found, proceed to validate train record status; if not found, generate train not found error.
  • Context - a train record has been found in the system:
    For Validate Train Record Status:
    When the system validates the train record status, then check if the train is a cprs train for special processing requirements.
  • Context - a train record has been validated and found in the system:
    For CPRS Train?:
    When the system checks the train type, then if train is cprs type, apply cprs special processing rules; otherwise set train found flag.
  • Context - a train has been identified as cprs type:
    For Apply CPRS Special Processing Rules:
    When the system applies cprs-specific processing rules, then execute cprs special processing logic and then set train found flag.
  • Context - a train has been successfully validated (either regular or cprs):
    For Set Train Found Flag:
    When the system completes train validation processing, then set train found flag to true and continue with train processing.
  • Context - train id is not present in vessel name or train is not found in system lookup:
    For Generate Train Not Found Error Message:
    When the system encounters train validation failure, then generate a train not found error message for merlin system notification.
  • Context - a train not found error message has been generated:
    For Send Error to Merlin System:
    When the system needs to notify about the validation failure, then send the error message to merlin system for appropriate notification handling.
  • Context - an error message has been sent to merlin system for train not found:
    For Set Train Processing Flag to Skip:
    When the system needs to prevent further processing of invalid train, then set train processing flag to skip to bypass subsequent train-related operations.
  • Context - train found flag has been set after successful validation:
    For Continue with Train Processing:
    When the system is ready to proceed with train operations, then continue with normal train processing workflow and log validation results.
  • Context - train validation processing has completed (either successful or failed):
    For Log Train Validation Results:
    When the system needs to record validation results, then log the train validation results including success/failure status and any relevant details.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 vessel name segment is received
GIVEN
An M10 vessel name segment is received
Applied to: Extract Train ID from Vessel Name
WHEN
The system processes the vessel name field
THEN
The train ID is extracted from the vessel name for validation
Context: A vessel name has been processed for train ID extraction
GIVEN
A vessel name has been processed for train ID extraction
Applied to: Train ID Present?
WHEN
The system checks if a valid train ID was extracted
THEN
If train ID is present, proceed to train lookup; if not present, generate train not found error
Context: A valid train ID has been extracted from the vessel name
GIVEN
A valid train ID has been extracted from the vessel name
Applied to: Call GCCUTRIO to Lookup Train in System
WHEN
The system needs to validate the train exists in the system
THEN
Call GCCUTRIO program to lookup train data from GCWTL train list segments
Context: GCCUTRIO has been called to lookup train information
GIVEN
GCCUTRIO has been called to lookup train information
Applied to: Train Found in System?
WHEN
The system evaluates the lookup results
THEN
If train is found, proceed to validate train record status; if not found, generate train not found error
Context: A train record has been found in the system
GIVEN
A train record has been found in the system
Applied to: Validate Train Record Status
WHEN
The system validates the train record status
THEN
Check if the train is a CPRS train for special processing requirements
Context: A train record has been validated and found in the system
GIVEN
A train record has been validated and found in the system
Applied to: CPRS Train?
WHEN
The system checks the train type
THEN
If train is CPRS type, apply CPRS special processing rules; otherwise set train found flag
Context: A train has been identified as CPRS type
GIVEN
A train has been identified as CPRS type
Applied to: Apply CPRS Special Processing Rules
WHEN
The system applies CPRS-specific processing rules
THEN
Execute CPRS special processing logic and then set train found flag
Context: A train has been successfully validated (either regular or CPRS)
GIVEN
A train has been successfully validated (either regular or CPRS)
Applied to: Set Train Found Flag
WHEN
The system completes train validation processing
THEN
Set train found flag to true and continue with train processing
Context: Train ID is not present in vessel name OR train is not found in system lookup
GIVEN
Train ID is not present in vessel name OR train is not found in system lookup
Applied to: Generate Train Not Found Error Message
WHEN
The system encounters train validation failure
THEN
Generate a train not found error message for Merlin system notification
Context: A train not found error message has been generated
GIVEN
A train not found error message has been generated
Applied to: Send Error to Merlin System
WHEN
The system needs to notify about the validation failure
THEN
Send the error message to Merlin system for appropriate notification handling
Context: An error message has been sent to Merlin system for train not found
GIVEN
An error message has been sent to Merlin system for train not found
Applied to: Set Train Processing Flag to Skip
WHEN
The system needs to prevent further processing of invalid train
THEN
Set train processing flag to skip to bypass subsequent train-related operations
Context: Train found flag has been set after successful validation
GIVEN
Train found flag has been set after successful validation
Applied to: Continue with Train Processing
WHEN
The system is ready to proceed with train operations
THEN
Continue with normal train processing workflow and log validation results
Context: Train validation processing has completed (either successful or failed)
GIVEN
Train validation processing has completed (either successful or failed)
Applied to: Log Train Validation Results
WHEN
The system needs to record validation results
THEN
Log the train validation results including success/failure status and any relevant details
R-GCX016E-cbl-01486 (+15) File: GCX016E.cbl Equipment Hold Processing by VID Segment Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Hold Processing by VID Segment':
  • Context - a vid segment has been received for equipment hold processing:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment, then the equipment id is extracted from the vid segment data.
  • Context - an equipment id has been extracted from a vid segment:
    For Validate Equipment ID Format:
    When the system validates the equipment id format, then the equipment id format is checked against validation criteria.
  • Context - an equipment id format has been validated:
    For Equipment ID Valid?:
    When the system checks equipment id validity, then if equipment id is invalid, generate invalid equipment id error, otherwise proceed to locate equipment in train.
  • Context - a valid equipment id has been confirmed:
    For Locate Equipment in Train Consist:
    When the system searches for the equipment in the train consist, then the equipment is located within the train's equipment list.
  • Context - the system has searched for equipment in the train consist:
    For Equipment Found in Train?:
    When the equipment search is completed, then if equipment is not found in train, generate equipment not found error, otherwise check current equipment status.
  • Context - equipment has been found in the train consist:
    For Check Current Equipment Status:
    When the system checks the current equipment status, then the current hold status of the equipment is retrieved.
  • Context - the current equipment status has been checked:
    For Equipment Already Held?:
    When the system evaluates the equipment hold status, then if equipment is already held, generate already held warning, otherwise apply hold status to equipment.
  • Context - equipment is not currently held:
    For Apply Hold Status to Equipment:
    When the system applies hold status to the equipment, then the equipment hold status is set.
  • Context - hold status has been applied to equipment:
    For Update Equipment Status Flags:
    When the system updates equipment status flags, then equipment status flags are updated to reflect held status.
  • Context - equipment status flags have been updated:
    For Increment Train Hold Counter:
    When the system increments the train hold counter, then the train hold counter is increased by one.
  • Context - train hold counter has been incremented:
    For Log Equipment Hold Action:
    When the system logs the equipment hold action, then a log entry is created documenting the equipment hold with timestamp and equipment details.
  • Context - equipment hold action has been logged:
    For Generate Hold Confirmation Message:
    When the system generates hold confirmation message, then a confirmation message is created indicating successful equipment hold.
  • Context - hold confirmation message has been generated:
    For Update Train Equipment List:
    When the system updates the train equipment list, then the train equipment list is updated with the equipment's new held status.
  • Context - equipment search in train consist has been completed:
    For Generate Equipment Not Found Error:
    When equipment is not found in the train, then an equipment not found error message is generated.
  • Context - equipment id format validation has been performed:
    For Generate Invalid Equipment ID Error:
    When equipment id is determined to be invalid, then an invalid equipment id error message is generated.
  • Context - equipment hold status has been evaluated:
    For Generate Already Held Warning:
    When equipment is already in held status, then an already held warning message is generated.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment has been received for equipment hold processing
GIVEN
A VID segment has been received for equipment hold processing
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment
THEN
The equipment ID is extracted from the VID segment data
Context: An equipment ID has been extracted from a VID segment
GIVEN
An equipment ID has been extracted from a VID segment
Applied to: Validate Equipment ID Format
WHEN
The system validates the equipment ID format
THEN
The equipment ID format is checked against validation criteria
Context: An equipment ID format has been validated
GIVEN
An equipment ID format has been validated
Applied to: Equipment ID Valid?
WHEN
The system checks equipment ID validity
THEN
If equipment ID is invalid, generate invalid equipment ID error, otherwise proceed to locate equipment in train
Context: A valid equipment ID has been confirmed
GIVEN
A valid equipment ID has been confirmed
Applied to: Locate Equipment in Train Consist
WHEN
The system searches for the equipment in the train consist
THEN
The equipment is located within the train's equipment list
Context: The system has searched for equipment in the train consist
GIVEN
The system has searched for equipment in the train consist
Applied to: Equipment Found in Train?
WHEN
The equipment search is completed
THEN
If equipment is not found in train, generate equipment not found error, otherwise check current equipment status
Context: Equipment has been found in the train consist
GIVEN
Equipment has been found in the train consist
Applied to: Check Current Equipment Status
WHEN
The system checks the current equipment status
THEN
The current hold status of the equipment is retrieved
Context: The current equipment status has been checked
GIVEN
The current equipment status has been checked
Applied to: Equipment Already Held?
WHEN
The system evaluates the equipment hold status
THEN
If equipment is already held, generate already held warning, otherwise apply hold status to equipment
Context: Equipment is not currently held
GIVEN
Equipment is not currently held
Applied to: Apply Hold Status to Equipment
WHEN
The system applies hold status to the equipment
THEN
The equipment hold status is set
Context: Hold status has been applied to equipment
GIVEN
Hold status has been applied to equipment
Applied to: Update Equipment Status Flags
WHEN
The system updates equipment status flags
THEN
Equipment status flags are updated to reflect held status
Context: Equipment status flags have been updated
GIVEN
Equipment status flags have been updated
Applied to: Increment Train Hold Counter
WHEN
The system increments the train hold counter
THEN
The train hold counter is increased by one
Context: Train hold counter has been incremented
GIVEN
Train hold counter has been incremented
Applied to: Log Equipment Hold Action
WHEN
The system logs the equipment hold action
THEN
A log entry is created documenting the equipment hold with timestamp and equipment details
Context: Equipment hold action has been logged
GIVEN
Equipment hold action has been logged
Applied to: Generate Hold Confirmation Message
WHEN
The system generates hold confirmation message
THEN
A confirmation message is created indicating successful equipment hold
Context: Hold confirmation message has been generated
GIVEN
Hold confirmation message has been generated
Applied to: Update Train Equipment List
WHEN
The system updates the train equipment list
THEN
The train equipment list is updated with the equipment's new held status
Context: Equipment search in train consist has been completed
GIVEN
Equipment search in train consist has been completed
Applied to: Generate Equipment Not Found Error
WHEN
Equipment is not found in the train
THEN
An equipment not found error message is generated
Context: Equipment ID format validation has been performed
GIVEN
Equipment ID format validation has been performed
Applied to: Generate Invalid Equipment ID Error
WHEN
Equipment ID is determined to be invalid
THEN
An invalid equipment ID error message is generated
Context: Equipment hold status has been evaluated
GIVEN
Equipment hold status has been evaluated
Applied to: Generate Already Held Warning
WHEN
Equipment is already in held status
THEN
An already held warning message is generated
R-GCX016E-cbl-01502 (+17) File: GCX016E.cbl Equipment Release Processing by VID Segment Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Release Processing by VID Segment':
  • Context - a vid segment is received for equipment release processing:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment, then the equipment id is extracted from the vid segment data.
  • Context - an equipment id has been extracted from vid segment:
    For Equipment Found in Train?:
    When the system searches for the equipment in the train equipment list, then the system determines if the equipment exists in the train or generates equipment not found error.
  • Context - equipment exists in the train and release request data is available:
    For Valid Release Request?:
    When the system validates the release request parameters, then the system determines if the release request is valid or generates invalid release request error.
  • Context - a valid release request exists for equipment found in train:
    For Equipment Currently Held?:
    When the system checks the current hold status of the equipment, then the system determines if equipment is held or generates warning for equipment not held.
  • Context - equipment is currently held and release request is valid:
    For Process Equipment Release:
    When the system processes the equipment release, then the equipment release is processed and hold counter is decremented.
  • Context - equipment release is being processed:
    For Decrement Hold Counter:
    When the system updates the hold counter, then the hold counter is decremented by one.
  • Context - hold counter has been decremented for equipment release:
    For Hold Counter = 0?:
    When the system checks the hold counter value, then the system determines if hold counter equals zero to set equipment status to released.
  • Context - hold counter equals zero after decrement:
    For Set Equipment Status to Released:
    When the system updates equipment status, then the equipment status is set to released.
  • Context - equipment status has been processed for release:
    For Update Equipment Status in Train List:
    When the system updates the train equipment list, then the equipment status is updated in the train list.
  • Context - equipment status has been updated in train list:
    For Log Equipment Release Action:
    When the system logs the release action, then the equipment release action is logged with relevant details.
  • Context - equipment release action has been logged:
    For Generate Equipment Release Notification:
    When the system generates release notification, then an equipment release notification is generated.
  • Context - equipment release notification has been generated:
    For Update Train Equipment Status Flags:
    When the system updates train equipment status flags, then the train equipment status flags are updated to reflect current equipment states.
  • Context - train equipment status flags have been updated:
    For All Equipment in Train Released?:
    When the system checks if all equipment in train is released, then the system determines if all equipment is released or if some equipment remains held.
  • Context - all equipment in the train has been released:
    For Update Overall Train Status:
    When the system updates overall train status, then the overall train status is updated to reflect that all equipment is released.
  • Context - equipment release processing is complete and train status is updated:
    For Send Release Confirmation Message:
    When the system sends release confirmation, then a release confirmation message is sent.
  • Context - equipment id has been extracted from vid segment:
    For Generate Error - Equipment Not Found:
    When equipment is not found in the train equipment list, then an equipment not found error is generated.
  • Context - equipment exists in train but release request validation is performed:
    For Generate Error - Invalid Release Request:
    When release request validation fails, then an invalid release request error is generated.
  • Context - valid release request exists for equipment found in train:
    For Generate Warning - Equipment Not Held:
    When equipment is not currently in held status, then a warning is generated indicating equipment is not held.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment is received for equipment release processing
GIVEN
A VID segment is received for equipment release processing
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment
THEN
The equipment ID is extracted from the VID segment data
Context: An equipment ID has been extracted from VID segment
GIVEN
An equipment ID has been extracted from VID segment
Applied to: Equipment Found in Train?
WHEN
The system searches for the equipment in the train equipment list
THEN
The system determines if the equipment exists in the train or generates equipment not found error
Context: Equipment exists in the train and release request data is available
GIVEN
Equipment exists in the train and release request data is available
Applied to: Valid Release Request?
WHEN
The system validates the release request parameters
THEN
The system determines if the release request is valid or generates invalid release request error
Context: A valid release request exists for equipment found in train
GIVEN
A valid release request exists for equipment found in train
Applied to: Equipment Currently Held?
WHEN
The system checks the current hold status of the equipment
THEN
The system determines if equipment is held or generates warning for equipment not held
Context: Equipment is currently held and release request is valid
GIVEN
Equipment is currently held and release request is valid
Applied to: Process Equipment Release
WHEN
The system processes the equipment release
THEN
The equipment release is processed and hold counter is decremented
Context: Equipment release is being processed
GIVEN
Equipment release is being processed
Applied to: Decrement Hold Counter
WHEN
The system updates the hold counter
THEN
The hold counter is decremented by one
Context: Hold counter has been decremented for equipment release
GIVEN
Hold counter has been decremented for equipment release
Applied to: Hold Counter = 0?
WHEN
The system checks the hold counter value
THEN
The system determines if hold counter equals zero to set equipment status to released
Context: Hold counter equals zero after decrement
GIVEN
Hold counter equals zero after decrement
Applied to: Set Equipment Status to Released
WHEN
The system updates equipment status
THEN
The equipment status is set to released
Context: Equipment status has been processed for release
GIVEN
Equipment status has been processed for release
Applied to: Update Equipment Status in Train List
WHEN
The system updates the train equipment list
THEN
The equipment status is updated in the train list
Context: Equipment status has been updated in train list
GIVEN
Equipment status has been updated in train list
Applied to: Log Equipment Release Action
WHEN
The system logs the release action
THEN
The equipment release action is logged with relevant details
Context: Equipment release action has been logged
GIVEN
Equipment release action has been logged
Applied to: Generate Equipment Release Notification
WHEN
The system generates release notification
THEN
An equipment release notification is generated
Context: Equipment release notification has been generated
GIVEN
Equipment release notification has been generated
Applied to: Update Train Equipment Status Flags
WHEN
The system updates train equipment status flags
THEN
The train equipment status flags are updated to reflect current equipment states
Context: Train equipment status flags have been updated
GIVEN
Train equipment status flags have been updated
Applied to: All Equipment in Train Released?
WHEN
The system checks if all equipment in train is released
THEN
The system determines if all equipment is released or if some equipment remains held
Context: All equipment in the train has been released
GIVEN
All equipment in the train has been released
Applied to: Update Overall Train Status
WHEN
The system updates overall train status
THEN
The overall train status is updated to reflect that all equipment is released
Context: Equipment release processing is complete and train status is updated
GIVEN
Equipment release processing is complete and train status is updated
Applied to: Send Release Confirmation Message
WHEN
The system sends release confirmation
THEN
A release confirmation message is sent
Context: Equipment ID has been extracted from VID segment
GIVEN
Equipment ID has been extracted from VID segment
Applied to: Generate Error - Equipment Not Found
WHEN
Equipment is not found in the train equipment list
THEN
An equipment not found error is generated
Context: Equipment exists in train but release request validation is performed
GIVEN
Equipment exists in train but release request validation is performed
Applied to: Generate Error - Invalid Release Request
WHEN
Release request validation fails
THEN
An invalid release request error is generated
Context: Valid release request exists for equipment found in train
GIVEN
Valid release request exists for equipment found in train
Applied to: Generate Warning - Equipment Not Held
WHEN
Equipment is not currently in held status
THEN
A warning is generated indicating equipment is not held
R-GCX016E-cbl-01520 (+17) File: GCX016E.cbl Equipment Seizure Processing by VID Segment Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Seizure Processing by VID Segment':
  • Context - a vid segment is received in the message queue:
    For VID Segment Received:
    When the system processes the vid segment, then the equipment id is extracted from the vid segment for further processing.
  • Context - a vid segment contains equipment identification data:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment, then the equipment id is extracted and made available for validation.
  • Context - a vid segment has been processed and disposition code is available:
    For Disposition Code = SEI?:
    When the system checks the disposition code, then if disposition code equals sei, proceed with seizure processing, otherwise complete processing without seizure.
  • Context - an equipment id has been extracted from vid segment and disposition code is sei:
    For Validate Equipment ID Format:
    When the system validates the equipment id format, then the equipment id format is checked against validation rules.
  • Context - equipment id format validation has been performed:
    For Equipment ID Valid?:
    When the system evaluates validation results, then if equipment id is valid, proceed to locate equipment in train, otherwise generate invalid equipment id error.
  • Context - equipment id is valid and formatted correctly:
    For Locate Equipment in Train Consist:
    When the system searches the train consist, then the system attempts to locate the equipment within the train's equipment list.
  • Context - equipment location search has been completed:
    For Equipment Found in Train?:
    When the system evaluates search results, then if equipment is found in train, proceed to check current status, otherwise generate equipment not found error.
  • Context - equipment has been found in the train consist:
    For Check Current Equipment Status:
    When the system checks equipment status, then the current seizure status of the equipment is retrieved and evaluated.
  • Context - current equipment status has been retrieved:
    For Equipment Already Seized?:
    When the system evaluates seizure status, then if equipment is not already seized, proceed with seizure, otherwise generate already seized warning.
  • Context - equipment is found in train and not already seized:
    For Set Equipment Seizure Flag:
    When the system processes seizure request, then the equipment seizure flag is set to indicate seized status.
  • Context - equipment seizure flag has been set:
    For Update Equipment Status in Train List:
    When the system updates train records, then the equipment status in the train list is updated to reflect seized status.
  • Context - equipment status has been updated in train list:
    For Log Equipment Seizure Action:
    When the system performs logging, then a log entry is created documenting the equipment seizure action with relevant details.
  • Context - equipment seizure action has been logged:
    For Generate Equipment Seizure Notification:
    When the system generates notifications, then seizure notification messages are created and sent to appropriate recipients.
  • Context - equipment seizure notification has been generated:
    For Update Train Equipment Counter:
    When the system updates counters, then train equipment counters are updated to reflect the newly seized equipment.
  • Context - all seizure processing steps have been completed successfully:
    For Process Complete - Equipment Seized:
    When the system finalizes processing, then the equipment seizure process is marked as complete.
  • Context - equipment id format validation has failed:
    For Generate Error - Invalid Equipment ID:
    When the system handles validation failure, then an error message is generated indicating invalid equipment id format.
  • Context - equipment search in train consist has failed to locate the specified equipment:
    For Generate Error - Equipment Not Found:
    When the system handles search failure, then an error message is generated indicating equipment not found in train.
  • Context - equipment is found but already has seized status:
    For Generate Warning - Equipment Already Seized:
    When the system detects duplicate seizure attempt, then a warning message is generated indicating equipment is already seized.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment is received in the message queue
GIVEN
A VID segment is received in the message queue
Applied to: VID Segment Received
WHEN
The system processes the VID segment
THEN
The equipment ID is extracted from the VID segment for further processing
Context: A VID segment contains equipment identification data
GIVEN
A VID segment contains equipment identification data
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment
THEN
The equipment ID is extracted and made available for validation
Context: A VID segment has been processed and disposition code is available
GIVEN
A VID segment has been processed and disposition code is available
Applied to: Disposition Code = SEI?
WHEN
The system checks the disposition code
THEN
If disposition code equals SEI, proceed with seizure processing, otherwise complete processing without seizure
Context: An equipment ID has been extracted from VID segment and disposition code is SEI
GIVEN
An equipment ID has been extracted from VID segment and disposition code is SEI
Applied to: Validate Equipment ID Format
WHEN
The system validates the equipment ID format
THEN
The equipment ID format is checked against validation rules
Context: Equipment ID format validation has been performed
GIVEN
Equipment ID format validation has been performed
Applied to: Equipment ID Valid?
WHEN
The system evaluates validation results
THEN
If equipment ID is valid, proceed to locate equipment in train, otherwise generate invalid equipment ID error
Context: Equipment ID is valid and formatted correctly
GIVEN
Equipment ID is valid and formatted correctly
Applied to: Locate Equipment in Train Consist
WHEN
The system searches the train consist
THEN
The system attempts to locate the equipment within the train's equipment list
Context: Equipment location search has been completed
GIVEN
Equipment location search has been completed
Applied to: Equipment Found in Train?
WHEN
The system evaluates search results
THEN
If equipment is found in train, proceed to check current status, otherwise generate equipment not found error
Context: Equipment has been found in the train consist
GIVEN
Equipment has been found in the train consist
Applied to: Check Current Equipment Status
WHEN
The system checks equipment status
THEN
The current seizure status of the equipment is retrieved and evaluated
Context: Current equipment status has been retrieved
GIVEN
Current equipment status has been retrieved
Applied to: Equipment Already Seized?
WHEN
The system evaluates seizure status
THEN
If equipment is not already seized, proceed with seizure, otherwise generate already seized warning
Context: Equipment is found in train and not already seized
GIVEN
Equipment is found in train and not already seized
Applied to: Set Equipment Seizure Flag
WHEN
The system processes seizure request
THEN
The equipment seizure flag is set to indicate seized status
Context: Equipment seizure flag has been set
GIVEN
Equipment seizure flag has been set
Applied to: Update Equipment Status in Train List
WHEN
The system updates train records
THEN
The equipment status in the train list is updated to reflect seized status
Context: Equipment status has been updated in train list
GIVEN
Equipment status has been updated in train list
Applied to: Log Equipment Seizure Action
WHEN
The system performs logging
THEN
A log entry is created documenting the equipment seizure action with relevant details
Context: Equipment seizure action has been logged
GIVEN
Equipment seizure action has been logged
Applied to: Generate Equipment Seizure Notification
WHEN
The system generates notifications
THEN
Seizure notification messages are created and sent to appropriate recipients
Context: Equipment seizure notification has been generated
GIVEN
Equipment seizure notification has been generated
Applied to: Update Train Equipment Counter
WHEN
The system updates counters
THEN
Train equipment counters are updated to reflect the newly seized equipment
Context: All seizure processing steps have been completed successfully
GIVEN
All seizure processing steps have been completed successfully
Applied to: Process Complete - Equipment Seized
WHEN
The system finalizes processing
THEN
The equipment seizure process is marked as complete
Context: Equipment ID format validation has failed
GIVEN
Equipment ID format validation has failed
Applied to: Generate Error - Invalid Equipment ID
WHEN
The system handles validation failure
THEN
An error message is generated indicating invalid equipment ID format
Context: Equipment search in train consist has failed to locate the specified equipment
GIVEN
Equipment search in train consist has failed to locate the specified equipment
Applied to: Generate Error - Equipment Not Found
WHEN
The system handles search failure
THEN
An error message is generated indicating equipment not found in train
Context: Equipment is found but already has seized status
GIVEN
Equipment is found but already has seized status
Applied to: Generate Warning - Equipment Already Seized
WHEN
The system detects duplicate seizure attempt
THEN
A warning message is generated indicating equipment is already seized
R-GCX016E-cbl-01538 (+13) File: GCX016E.cbl Equipment Seizure Release Processing by VID Segment Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Seizure Release Processing by VID Segment':
  • Context - a vid segment is received with ser disposition code:
    For Validate Equipment ID in VID Segment:
    When the system processes the vid segment equipment id field, then the equipment id must be validated for proper format and non-blank content.
  • Context - a valid equipment id from vid segment:
    For Lookup Equipment in Train Consist:
    When the system searches the train equipment consist, then the equipment must be found in the train's equipment list to proceed with seizure release.
    For Generate Error - Equipment Not Found:
    When the equipment is not found in the train equipment consist, then an error must be generated indicating equipment not found in train.
  • Context - equipment is found in the train consist:
    For Check Current Seizure Status:
    When the system checks the equipment's current seizure status flags, then the equipment must currently be in seized status to allow seizure release.
  • Context - equipment is currently seized and seizure release is authorized:
    For Remove Seizure Status from Equipment:
    When the system processes the seizure release request, then the seizure status flag must be removed from the equipment record.
  • Context - equipment seizure status has been removed:
    For Update Equipment Status Flags:
    When the system updates equipment status information, then all equipment status flags must be updated to reflect the released from seizure state.
  • Context - equipment seizure status has been successfully removed:
    For Decrement Train Seizure Counter:
    When the system updates train-level seizure tracking, then the train seizure counter must be decremented by one.
  • Context - train seizure counter has been decremented:
    For All Equipment Released from Seizure?:
    When the system evaluates the remaining seizure counter value, then if seizure counter equals zero, then all equipment is released from seizure, otherwise some equipment remains seized.
  • Context - all equipment in the train has been released from seizure:
    For Update Train Seizure Status Flag:
    When the system updates train status information, then the train seizure status flag must be cleared to indicate no equipment is seized.
  • Context - equipment seizure release has been processed successfully:
    For Log Seizure Release Action:
    When the system performs audit logging, then a log entry must be created documenting the seizure release action with equipment details and timestamp.
  • Context - equipment seizure release action has been logged:
    For Generate Equipment Release Notification:
    When the system generates notifications, then a release notification must be created containing equipment identification and release details.
  • Context - equipment status flags have been updated and notifications generated:
    For Update Equipment Status in Database:
    When the system commits the changes, then the equipment status must be updated in the database to reflect the seizure release.
  • Context - a vid segment with ser disposition is received:
    For Generate Error - Invalid Equipment ID:
    When the equipment id validation fails due to invalid format or blank content, then an error must be generated indicating invalid equipment id.
  • Context - equipment is found in train consist but seizure release is requested:
    For Generate Error - Equipment Not Seized:
    When the equipment is not currently in seized status, then an error must be generated indicating equipment is not currently seized.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment is received with SER disposition code
GIVEN
A VID segment is received with SER disposition code
Applied to: Validate Equipment ID in VID Segment
WHEN
The system processes the VID segment equipment ID field
THEN
The equipment ID must be validated for proper format and non-blank content
Context: A valid equipment ID from VID segment
GIVEN
A valid equipment ID from VID segment
Applied to: Lookup Equipment in Train Consist
WHEN
The system searches the train equipment consist
THEN
The equipment must be found in the train's equipment list to proceed with seizure release
Applied to: Generate Error - Equipment Not Found
WHEN
The equipment is not found in the train equipment consist
THEN
An error must be generated indicating equipment not found in train
Context: Equipment is found in the train consist
GIVEN
Equipment is found in the train consist
Applied to: Check Current Seizure Status
WHEN
The system checks the equipment's current seizure status flags
THEN
The equipment must currently be in seized status to allow seizure release
Context: Equipment is currently seized and seizure release is authorized
GIVEN
Equipment is currently seized and seizure release is authorized
Applied to: Remove Seizure Status from Equipment
WHEN
The system processes the seizure release request
THEN
The seizure status flag must be removed from the equipment record
Context: Equipment seizure status has been removed
GIVEN
Equipment seizure status has been removed
Applied to: Update Equipment Status Flags
WHEN
The system updates equipment status information
THEN
All equipment status flags must be updated to reflect the released from seizure state
Context: Equipment seizure status has been successfully removed
GIVEN
Equipment seizure status has been successfully removed
Applied to: Decrement Train Seizure Counter
WHEN
The system updates train-level seizure tracking
THEN
The train seizure counter must be decremented by one
Context: Train seizure counter has been decremented
GIVEN
Train seizure counter has been decremented
Applied to: All Equipment Released from Seizure?
WHEN
The system evaluates the remaining seizure counter value
THEN
If seizure counter equals zero, then all equipment is released from seizure, otherwise some equipment remains seized
Context: All equipment in the train has been released from seizure
GIVEN
All equipment in the train has been released from seizure
Applied to: Update Train Seizure Status Flag
WHEN
The system updates train status information
THEN
The train seizure status flag must be cleared to indicate no equipment is seized
Context: Equipment seizure release has been processed successfully
GIVEN
Equipment seizure release has been processed successfully
Applied to: Log Seizure Release Action
WHEN
The system performs audit logging
THEN
A log entry must be created documenting the seizure release action with equipment details and timestamp
Context: Equipment seizure release action has been logged
GIVEN
Equipment seizure release action has been logged
Applied to: Generate Equipment Release Notification
WHEN
The system generates notifications
THEN
A release notification must be created containing equipment identification and release details
Context: Equipment status flags have been updated and notifications generated
GIVEN
Equipment status flags have been updated and notifications generated
Applied to: Update Equipment Status in Database
WHEN
The system commits the changes
THEN
The equipment status must be updated in the database to reflect the seizure release
Context: A VID segment with SER disposition is received
GIVEN
A VID segment with SER disposition is received
Applied to: Generate Error - Invalid Equipment ID
WHEN
The equipment ID validation fails due to invalid format or blank content
THEN
An error must be generated indicating invalid equipment ID
Context: Equipment is found in train consist but seizure release is requested
GIVEN
Equipment is found in train consist but seizure release is requested
Applied to: Generate Error - Equipment Not Seized
WHEN
The equipment is not currently in seized status
THEN
An error must be generated indicating equipment is not currently seized
R-GCX016E-cbl-01552 (+8) File: GCX016E.cbl Export Manifest Pre Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Manifest Pre':
  • Context - a train arrival event (pod/aad disposition) is being processed:
    For Train ID ends with 'T'?:
    When the system evaluates the train id suffix, then if train id ends with 't', classify as export manifest train, otherwise process as standard import train.
  • Context - an export manifest train has been identified and arrival port has been extracted from p4 location segment:
    For Is Port Designated for Export Manifests?:
    When the system checks the port against the export port validation table, then if port is designated for export manifests, proceed with export processing, otherwise generate port validation error.
  • Context - an export manifest train has been identified and port validation has been successful:
    For Set Export Manifest Pre-Arrival Status:
    When the system processes the export manifest pre-arrival, then set the train status to export manifest pre-arrival status.
  • Context - export manifest pre-arrival status has been set for a train:
    For Update Train Status Flags:
    When the system updates train status information, then update train status flags in train records to reflect export manifest pre-arrival state.
  • Context - train status flags have been updated for export manifest pre-arrival:
    For Log Export Manifest Pre-Arrival Action:
    When the system completes export manifest processing, then log the export manifest pre-arrival action with relevant train and port information.
  • Context - export manifest pre-arrival action has been logged:
    For Generate Pre-Arrival Notification:
    When the system completes export processing workflow, then generate pre-arrival notification message for the export manifest train.
  • Context - an export manifest train has been identified but port validation has failed:
    For Generate Port Validation Error:
    When the arrival port is not found in the export port validation table, then generate port validation error message indicating the port is not authorized for export manifests.
  • Context - a port validation error has been generated for an export manifest train:
    For Route Error to Default Recipient:
    When the system processes the error routing, then route the port validation error message to the default error recipient for resolution.
  • Context - a train arrival event is being processed and train id does not end with 't':
    For Continue with Standard Import Processing:
    When the system determines the train is not an export manifest train, then continue processing the train using standard import manifest procedures.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event (POD/AAD disposition) is being processed
GIVEN
A train arrival event (POD/AAD disposition) is being processed
Applied to: Train ID ends with 'T'?
WHEN
The system evaluates the train ID suffix
THEN
If train ID ends with 'T', classify as export manifest train, otherwise process as standard import train
Context: An export manifest train has been identified and arrival port has been extracted from P4 location segment
GIVEN
An export manifest train has been identified and arrival port has been extracted from P4 location segment
Applied to: Is Port Designated for Export Manifests?
WHEN
The system checks the port against the export port validation table
THEN
If port is designated for export manifests, proceed with export processing, otherwise generate port validation error
Context: An export manifest train has been identified and port validation has been successful
GIVEN
An export manifest train has been identified and port validation has been successful
Applied to: Set Export Manifest Pre-Arrival Status
WHEN
The system processes the export manifest pre-arrival
THEN
Set the train status to export manifest pre-arrival status
Context: Export manifest pre-arrival status has been set for a train
GIVEN
Export manifest pre-arrival status has been set for a train
Applied to: Update Train Status Flags
WHEN
The system updates train status information
THEN
Update train status flags in train records to reflect export manifest pre-arrival state
Context: Train status flags have been updated for export manifest pre-arrival
GIVEN
Train status flags have been updated for export manifest pre-arrival
Applied to: Log Export Manifest Pre-Arrival Action
WHEN
The system completes export manifest processing
THEN
Log the export manifest pre-arrival action with relevant train and port information
Context: Export manifest pre-arrival action has been logged
GIVEN
Export manifest pre-arrival action has been logged
Applied to: Generate Pre-Arrival Notification
WHEN
The system completes export processing workflow
THEN
Generate pre-arrival notification message for the export manifest train
Context: An export manifest train has been identified but port validation has failed
GIVEN
An export manifest train has been identified but port validation has failed
Applied to: Generate Port Validation Error
WHEN
The arrival port is not found in the export port validation table
THEN
Generate port validation error message indicating the port is not authorized for export manifests
Context: A port validation error has been generated for an export manifest train
GIVEN
A port validation error has been generated for an export manifest train
Applied to: Route Error to Default Recipient
WHEN
The system processes the error routing
THEN
Route the port validation error message to the default error recipient for resolution
Context: A train arrival event is being processed and train ID does not end with 'T'
GIVEN
A train arrival event is being processed and train ID does not end with 'T'
Applied to: Continue with Standard Import Processing
WHEN
The system determines the train is not an export manifest train
THEN
Continue processing the train using standard import manifest procedures
R-GCX016E-cbl-01561 (+8) File: GCX016E.cbl Import Manifest Arrival Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Import Manifest Arrival Processing':
  • Context - a train arrival event (pod/aad) is being processed:
    For Train ID has 'T' suffix?:
    When the system checks the train id for 't' suffix, then if train id does not have 't' suffix, classify as import manifest for standard processing.
  • Context - an import manifest train arrival is being processed and arrival date/time is extracted from v9 segment:
    For Valid Arrival Date?:
    When the system validates the arrival date format and content, then if arrival date is valid, use it for train arrival processing, otherwise use system current date/time.
  • Context - an import manifest train arrival is being processed and the v9 segment arrival date is invalid or missing:
    For Use System Current Date/Time:
    When the system needs to set train arrival date/time, then use system current date/time as the train arrival date/time.
  • Context - an import manifest train has valid arrival date/time established:
    For Set Train Arrival Status Flag:
    When the system processes the train arrival, then set the train arrival status flag to indicate successful arrival processing.
  • Context - a train arrival status flag has been set for an import manifest train:
    For Update Train Status in Database:
    When the system updates train information, then update the train status in gcwtl train list segments database with arrival information.
  • Context - an import manifest train status has been updated in the database:
    For Process US Cargo Arrival Notifications:
    When the system processes associated cargo arrivals, then process arrival notifications for all us cargos in gcsusrt segments associated with the train.
  • Context - us cargo arrival notifications have been processed for an import manifest train:
    For Send AEI Messages for Train Arrival:
    When the system generates external notifications, then send aei messages to notify external systems of the train arrival event.
  • Context - aei messages have been sent for an import manifest train arrival:
    For Generate Train Arrival Merlin Messages:
    When the system generates internal notifications, then generate and send merlin messages to notify internal stakeholders of the train arrival.
  • Context - merlin messages have been generated for an import manifest train arrival:
    For Log Train Arrival Action:
    When the system completes arrival processing, then log the train arrival action with relevant details for audit and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event (POD/AAD) is being processed
GIVEN
A train arrival event (POD/AAD) is being processed
Applied to: Train ID has 'T' suffix?
WHEN
The system checks the train ID for 'T' suffix
THEN
If train ID does not have 'T' suffix, classify as import manifest for standard processing
Context: An import manifest train arrival is being processed and arrival date/time is extracted from V9 segment
GIVEN
An import manifest train arrival is being processed and arrival date/time is extracted from V9 segment
Applied to: Valid Arrival Date?
WHEN
The system validates the arrival date format and content
THEN
If arrival date is valid, use it for train arrival processing, otherwise use system current date/time
Context: An import manifest train arrival is being processed and the V9 segment arrival date is invalid or missing
GIVEN
An import manifest train arrival is being processed and the V9 segment arrival date is invalid or missing
Applied to: Use System Current Date/Time
WHEN
The system needs to set train arrival date/time
THEN
Use system current date/time as the train arrival date/time
Context: An import manifest train has valid arrival date/time established
GIVEN
An import manifest train has valid arrival date/time established
Applied to: Set Train Arrival Status Flag
WHEN
The system processes the train arrival
THEN
Set the train arrival status flag to indicate successful arrival processing
Context: A train arrival status flag has been set for an import manifest train
GIVEN
A train arrival status flag has been set for an import manifest train
Applied to: Update Train Status in Database
WHEN
The system updates train information
THEN
Update the train status in GCWTL train list segments database with arrival information
Context: An import manifest train status has been updated in the database
GIVEN
An import manifest train status has been updated in the database
Applied to: Process US Cargo Arrival Notifications
WHEN
The system processes associated cargo arrivals
THEN
Process arrival notifications for all US cargos in GCSUSRT segments associated with the train
Context: US cargo arrival notifications have been processed for an import manifest train
GIVEN
US cargo arrival notifications have been processed for an import manifest train
Applied to: Send AEI Messages for Train Arrival
WHEN
The system generates external notifications
THEN
Send AEI messages to notify external systems of the train arrival event
Context: AEI messages have been sent for an import manifest train arrival
GIVEN
AEI messages have been sent for an import manifest train arrival
Applied to: Generate Train Arrival Merlin Messages
WHEN
The system generates internal notifications
THEN
Generate and send Merlin messages to notify internal stakeholders of the train arrival
Context: Merlin messages have been generated for an import manifest train arrival
GIVEN
Merlin messages have been generated for an import manifest train arrival
Applied to: Log Train Arrival Action
WHEN
The system completes arrival processing
THEN
Log the train arrival action with relevant details for audit and tracking purposes
R-GCX016E-cbl-01570 (+17) File: GCX016E.cbl Train Equipment List Management Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Equipment List Management':
  • Context - a vid segment is received in the message:
    For Extract Equipment ID from VID Segment:
    When the vid segment contains equipment id information, then the system extracts the equipment id for further processing.
  • Context - a vid segment is received:
    For Equipment ID Present?:
    When the system checks for equipment id presence, then processing continues if equipment id is present, otherwise equipment processing is skipped.
  • Context - an equipment id has been extracted from vid segment:
    For Locate Equipment in Train Consist:
    When the system searches the train consist for the equipment, then the system determines whether the equipment is found in the train list.
  • Context - equipment has been searched in the train consist:
    For Equipment Found in Train?:
    When the system evaluates the search results, then if equipment is not found, it is added to the train list; if found, disposition processing continues.
  • Context - equipment is not found in the current train consist:
    For Add Equipment to Train List:
    When the system processes the equipment for the first time, then the equipment is added to the train equipment list for future reference.
  • Context - equipment exists or has been added to the train list:
    For Disposition Code Type?:
    When the system evaluates the disposition code type, then the system routes to appropriate status update based on code type: hre for hold release, sei for seizure, ser for seizure release, or other hold types.
  • Context - a hold-related disposition code is being processed for equipment:
    For Update Equipment Hold Status Flag:
    When the disposition code is not hre, sei, or ser, then the system sets the equipment hold status flag to indicate the equipment is held.
  • Context - an hre hold release disposition code is being processed for equipment:
    For Update Equipment Release Status Flag:
    When the system processes the hold release action, then the system sets the equipment release status flag to indicate the equipment hold is released.
  • Context - an sei seizure disposition code is being processed for equipment:
    For Update Equipment Seizure Status Flag:
    When the system processes the seizure action, then the system sets the equipment seizure status flag to indicate the equipment is seized.
  • Context - an ser seizure release disposition code is being processed for equipment:
    For Update Equipment Seizure Release Status Flag:
    When the system processes the seizure release action, then the system sets the equipment seizure release status flag to indicate the equipment seizure is released.
  • Context - equipment hold status flag has been updated:
    For Update Equipment Hold Counter:
    When the system processes the hold action, then the system increments the equipment hold counter to track the number of holds applied.
  • Context - equipment release status flag has been updated:
    For Update Equipment Release Counter:
    When the system processes the release action, then the system increments the equipment release counter to track the number of releases applied.
  • Context - equipment seizure status flag has been updated:
    For Update Equipment Seizure Counter:
    When the system processes the seizure action, then the system increments the equipment seizure counter to track the number of seizures applied.
  • Context - equipment seizure release status flag has been updated:
    For Update Equipment Seizure Release Counter:
    When the system processes the seizure release action, then the system increments the equipment seizure release counter to track the number of seizure releases applied.
  • Context - equipment status flags and counters have been updated:
    For Update Train Equipment List:
    When the system completes status processing for the equipment, then the system updates the train equipment list with the current equipment status and counter values.
  • Context - train equipment list has been updated with new status information:
    For Log Equipment Status Change:
    When the system completes equipment status processing, then the system logs the equipment status change for audit trail and tracking purposes.
  • Context - current equipment status change has been logged:
    For Continue to Next Equipment:
    When there are additional equipment items to process in the vid segment, then the system continues to process the next equipment item in the list.
  • Context - all equipment items have been processed or no equipment id was present in vid segment:
    For Equipment Processing Complete:
    When the system reaches the end of equipment processing, then the system marks equipment processing as complete and continues with next segment processing.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment is received in the message
GIVEN
A VID segment is received in the message
Applied to: Extract Equipment ID from VID Segment
WHEN
The VID segment contains equipment ID information
THEN
The system extracts the equipment ID for further processing
Context: A VID segment is received
GIVEN
A VID segment is received
Applied to: Equipment ID Present?
WHEN
The system checks for equipment ID presence
THEN
Processing continues if equipment ID is present, otherwise equipment processing is skipped
Context: An equipment ID has been extracted from VID segment
GIVEN
An equipment ID has been extracted from VID segment
Applied to: Locate Equipment in Train Consist
WHEN
The system searches the train consist for the equipment
THEN
The system determines whether the equipment is found in the train list
Context: Equipment has been searched in the train consist
GIVEN
Equipment has been searched in the train consist
Applied to: Equipment Found in Train?
WHEN
The system evaluates the search results
THEN
If equipment is not found, it is added to the train list; if found, disposition processing continues
Context: Equipment is not found in the current train consist
GIVEN
Equipment is not found in the current train consist
Applied to: Add Equipment to Train List
WHEN
The system processes the equipment for the first time
THEN
The equipment is added to the train equipment list for future reference
Context: Equipment exists or has been added to the train list
GIVEN
Equipment exists or has been added to the train list
Applied to: Disposition Code Type?
WHEN
The system evaluates the disposition code type
THEN
The system routes to appropriate status update based on code type: HRE for hold release, SEI for seizure, SER for seizure release, or other hold types
Context: A hold-related disposition code is being processed for equipment
GIVEN
A hold-related disposition code is being processed for equipment
Applied to: Update Equipment Hold Status Flag
WHEN
The disposition code is not HRE, SEI, or SER
THEN
The system sets the equipment hold status flag to indicate the equipment is held
Context: An HRE hold release disposition code is being processed for equipment
GIVEN
An HRE hold release disposition code is being processed for equipment
Applied to: Update Equipment Release Status Flag
WHEN
The system processes the hold release action
THEN
The system sets the equipment release status flag to indicate the equipment hold is released
Context: An SEI seizure disposition code is being processed for equipment
GIVEN
An SEI seizure disposition code is being processed for equipment
Applied to: Update Equipment Seizure Status Flag
WHEN
The system processes the seizure action
THEN
The system sets the equipment seizure status flag to indicate the equipment is seized
Context: An SER seizure release disposition code is being processed for equipment
GIVEN
An SER seizure release disposition code is being processed for equipment
Applied to: Update Equipment Seizure Release Status Flag
WHEN
The system processes the seizure release action
THEN
The system sets the equipment seizure release status flag to indicate the equipment seizure is released
Context: Equipment hold status flag has been updated
GIVEN
Equipment hold status flag has been updated
Applied to: Update Equipment Hold Counter
WHEN
The system processes the hold action
THEN
The system increments the equipment hold counter to track the number of holds applied
Context: Equipment release status flag has been updated
GIVEN
Equipment release status flag has been updated
Applied to: Update Equipment Release Counter
WHEN
The system processes the release action
THEN
The system increments the equipment release counter to track the number of releases applied
Context: Equipment seizure status flag has been updated
GIVEN
Equipment seizure status flag has been updated
Applied to: Update Equipment Seizure Counter
WHEN
The system processes the seizure action
THEN
The system increments the equipment seizure counter to track the number of seizures applied
Context: Equipment seizure release status flag has been updated
GIVEN
Equipment seizure release status flag has been updated
Applied to: Update Equipment Seizure Release Counter
WHEN
The system processes the seizure release action
THEN
The system increments the equipment seizure release counter to track the number of seizure releases applied
Context: Equipment status flags and counters have been updated
GIVEN
Equipment status flags and counters have been updated
Applied to: Update Train Equipment List
WHEN
The system completes status processing for the equipment
THEN
The system updates the train equipment list with the current equipment status and counter values
Context: Train equipment list has been updated with new status information
GIVEN
Train equipment list has been updated with new status information
Applied to: Log Equipment Status Change
WHEN
The system completes equipment status processing
THEN
The system logs the equipment status change for audit trail and tracking purposes
Context: Current equipment status change has been logged
GIVEN
Current equipment status change has been logged
Applied to: Continue to Next Equipment
WHEN
There are additional equipment items to process in the VID segment
THEN
The system continues to process the next equipment item in the list
Context: All equipment items have been processed or no equipment ID was present in VID segment
GIVEN
All equipment items have been processed or no equipment ID was present in VID segment
Applied to: Equipment Processing Complete
WHEN
The system reaches the end of equipment processing
THEN
The system marks equipment processing as complete and continues with next segment processing
R-GCX016E-cbl-01588 (+9) File: GCX016E.cbl Train Status Flag Management Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Status Flag Management':
  • Context - a v9 segment with disposition code hmi is being processed for a train:
    For Process HMI - Hold Train:
    When the hmi hold event is processed, then the train held flag is set to 'y' and the hold action is logged.
  • Context - a v9 segment with disposition code hre is being processed for a train:
    For Process HRE - Release Hold:
    When the hre hold release event is processed, then the train held flag is set to 'n' and the release action is logged.
  • Context - a v9 segment with disposition code sei is being processed for a train:
    For Process SEI - Seize Train:
    When the sei seizure event is processed, then the train seized flag is set to 'y' and the seizure action is logged.
  • Context - a v9 segment with disposition code ser is being processed for a train:
    For Process SER - Release Seizure:
    When the ser seizure release event is processed, then the train seized flag is set to 'n' and the release action is logged.
  • Context - a v9 segment with disposition code lck is being processed for a train:
    For Process LCK - Lock Train:
    When the lck lock event is processed, then the train locked flag is set to 'y'.
  • Context - a v9 segment with disposition code ulc is being processed for a train:
    For Process ULC - Unlock Train:
    When the ulc unlock event is processed and the train is currently locked, then the train locked flag is set to 'n'.
  • Context - a v9 segment with disposition code pod or aad is being processed for a train:
    For Process POD/AAD - Train Arrival:
    When the arrival event is processed, then the train arrival flag is set to 'y' and the train arrival date is recorded.
  • Context - a v9 segment with disposition code coc is being processed for a train:
    For Process COC - Cancel Arrival:
    When the coc cancellation event is processed, then the train arrival flag is set to 'n' and the train arrival date is cleared.
  • Context - a train status event requires vid equipment processing for hold or seizure actions:
    For Update Individual Equipment Hold Status:
    When individual equipment processing is performed, then equipment hold status is updated, equipment seizure status is updated, and equipment hold/seizure counters are incremented or decremented accordingly.
  • Context - a train status flag has been modified due to a v9 disposition code event:
    For Update Train Status in Database:
    When the status processing is complete, then the train status is updated in the database and the status change is logged.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with disposition code HMI is being processed for a train
GIVEN
A V9 segment with disposition code HMI is being processed for a train
Applied to: Process HMI - Hold Train
WHEN
The HMI hold event is processed
THEN
The train held flag is set to 'Y' and the hold action is logged
Context: A V9 segment with disposition code HRE is being processed for a train
GIVEN
A V9 segment with disposition code HRE is being processed for a train
Applied to: Process HRE - Release Hold
WHEN
The HRE hold release event is processed
THEN
The train held flag is set to 'N' and the release action is logged
Context: A V9 segment with disposition code SEI is being processed for a train
GIVEN
A V9 segment with disposition code SEI is being processed for a train
Applied to: Process SEI - Seize Train
WHEN
The SEI seizure event is processed
THEN
The train seized flag is set to 'Y' and the seizure action is logged
Context: A V9 segment with disposition code SER is being processed for a train
GIVEN
A V9 segment with disposition code SER is being processed for a train
Applied to: Process SER - Release Seizure
WHEN
The SER seizure release event is processed
THEN
The train seized flag is set to 'N' and the release action is logged
Context: A V9 segment with disposition code LCK is being processed for a train
GIVEN
A V9 segment with disposition code LCK is being processed for a train
Applied to: Process LCK - Lock Train
WHEN
The LCK lock event is processed
THEN
The train locked flag is set to 'Y'
Context: A V9 segment with disposition code ULC is being processed for a train
GIVEN
A V9 segment with disposition code ULC is being processed for a train
Applied to: Process ULC - Unlock Train
WHEN
The ULC unlock event is processed and the train is currently locked
THEN
The train locked flag is set to 'N'
Context: A V9 segment with disposition code POD or AAD is being processed for a train
GIVEN
A V9 segment with disposition code POD or AAD is being processed for a train
Applied to: Process POD/AAD - Train Arrival
WHEN
The arrival event is processed
THEN
The train arrival flag is set to 'Y' and the train arrival date is recorded
Context: A V9 segment with disposition code COC is being processed for a train
GIVEN
A V9 segment with disposition code COC is being processed for a train
Applied to: Process COC - Cancel Arrival
WHEN
The COC cancellation event is processed
THEN
The train arrival flag is set to 'N' and the train arrival date is cleared
Context: A train status event requires VID equipment processing for hold or seizure actions
GIVEN
A train status event requires VID equipment processing for hold or seizure actions
Applied to: Update Individual Equipment Hold Status
WHEN
Individual equipment processing is performed
THEN
Equipment hold status is updated, equipment seizure status is updated, and equipment hold/seizure counters are incremented or decremented accordingly
Context: A train status flag has been modified due to a V9 disposition code event
GIVEN
A train status flag has been modified due to a V9 disposition code event
Applied to: Update Train Status in Database
WHEN
The status processing is complete
THEN
The train status is updated in the database and the status change is logged
R-GCX016E-cbl-01598 (+22) File: GCX016E.cbl Equipment Status Tracking within Trains Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Status Tracking within Trains':
  • Context - a vid segment has been received for processing:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment to extract equipment identification, then the equipment id is extracted from the vid segment data structure.
  • Context - an equipment id has been extracted from a vid segment:
    For Equipment ID Valid?:
    When the system validates the equipment id format and content, then the equipment id is accepted if valid or rejected if invalid with appropriate error handling.
  • Context - a valid equipment id has been extracted from a vid segment:
    For Locate Equipment in Train Consist:
    When the system searches for the equipment in the current train consist, then the equipment location is identified within the train consist data structure.
  • Context - the system has searched for equipment in the train consist:
    For Equipment Found in Train?:
    When the search results are evaluated, then the system confirms equipment exists in train or generates equipment not found condition.
  • Context - equipment has been found in the train consist:
    For Determine VID Disposition Code:
    When the system analyzes the vid segment for disposition code information, then the specific disposition code (hmi, hre, sei, ser) is determined for equipment status processing.
  • Context - a vid disposition code has been determined:
    For Disposition Code Type?:
    When the system evaluates the disposition code type, then the code is classified as hmi hold, hre release, sei seizure, or ser seizure release for appropriate processing.
  • Context - a vid segment contains hmi disposition code for valid equipment in train:
    For Process Equipment Hold - HMI:
    When the system processes the equipment hold request, then equipment hold processing is initiated for the specified equipment.
  • Context - a vid segment contains hre disposition code for valid equipment in train:
    For Process Equipment Release - HRE:
    When the system processes the equipment release request, then equipment release processing is initiated for the specified equipment.
  • Context - a vid segment contains sei disposition code for valid equipment in train:
    For Process Equipment Seizure - SEI:
    When the system processes the equipment seizure request, then equipment seizure processing is initiated for the specified equipment.
  • Context - a vid segment contains ser disposition code for valid equipment in train:
    For Process Equipment Seizure Release - SER:
    When the system processes the equipment seizure release request, then equipment seizure release processing is initiated for the specified equipment.
  • Context - equipment hold processing has been initiated for specific equipment:
    For Update Equipment Hold Status Flag:
    When the system updates equipment status information, then the equipment hold status flag is set to indicate hold condition.
  • Context - equipment release processing has been initiated for specific equipment:
    For Update Equipment Release Status Flag:
    When the system updates equipment status information, then the equipment release status flag is set to indicate release condition.
  • Context - equipment seizure processing has been initiated for specific equipment:
    For Update Equipment Seizure Status Flag:
    When the system updates equipment status information, then the equipment seizure status flag is set to indicate seizure condition.
  • Context - equipment seizure release processing has been initiated for specific equipment:
    For Update Equipment Seizure Release Status Flag:
    When the system updates equipment status information, then the equipment seizure release status flag is set to indicate release from seizure condition.
  • Context - equipment hold status flag has been updated for specific equipment:
    For Update Equipment Hold Counter:
    When the system updates equipment tracking counters, then the equipment hold counter is incremented to reflect the additional hold action.
  • Context - equipment release status flag has been updated for specific equipment:
    For Update Equipment Release Counter:
    When the system updates equipment tracking counters, then the equipment release counter is incremented to reflect the additional release action.
  • Context - equipment seizure status flag has been updated for specific equipment:
    For Update Equipment Seizure Counter:
    When the system updates equipment tracking counters, then the equipment seizure counter is incremented to reflect the additional seizure action.
  • Context - equipment seizure release status flag has been updated for specific equipment:
    For Update Equipment Seizure Release Counter:
    When the system updates equipment tracking counters, then the equipment seizure release counter is incremented to reflect the additional seizure release action.
  • Context - equipment status counters have been updated for specific equipment:
    For Update Train Equipment List:
    When the system updates the train equipment list, then the train equipment list reflects the current status information for the processed equipment.
  • Context - train equipment list has been updated with current equipment status:
    For Log Equipment Status Change:
    When the system creates audit trail documentation, then equipment status change is logged with timestamp, equipment id, and status change details.
  • Context - equipment status change has been logged in the system:
    For Generate Equipment Status Notification:
    When the system generates status notifications, then equipment status notification is created and sent to appropriate recipients.
  • Context - equipment search in train consist has been completed:
    For Generate Equipment Not Found Error:
    When the specified equipment is not found in the train consist, then equipment not found error is generated with appropriate error details.
  • Context - equipment id has been extracted from vid segment:
    For Generate Invalid Equipment ID Error:
    When the equipment id fails validation requirements, then invalid equipment id error is generated with appropriate error details.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment has been received for processing
GIVEN
A VID segment has been received for processing
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment to extract equipment identification
THEN
The equipment ID is extracted from the VID segment data structure
Context: An equipment ID has been extracted from a VID segment
GIVEN
An equipment ID has been extracted from a VID segment
Applied to: Equipment ID Valid?
WHEN
The system validates the equipment ID format and content
THEN
The equipment ID is accepted if valid or rejected if invalid with appropriate error handling
Context: A valid equipment ID has been extracted from a VID segment
GIVEN
A valid equipment ID has been extracted from a VID segment
Applied to: Locate Equipment in Train Consist
WHEN
The system searches for the equipment in the current train consist
THEN
The equipment location is identified within the train consist data structure
Context: The system has searched for equipment in the train consist
GIVEN
The system has searched for equipment in the train consist
Applied to: Equipment Found in Train?
WHEN
The search results are evaluated
THEN
The system confirms equipment exists in train or generates equipment not found condition
Context: Equipment has been found in the train consist
GIVEN
Equipment has been found in the train consist
Applied to: Determine VID Disposition Code
WHEN
The system analyzes the VID segment for disposition code information
THEN
The specific disposition code (HMI, HRE, SEI, SER) is determined for equipment status processing
Context: A VID disposition code has been determined
GIVEN
A VID disposition code has been determined
Applied to: Disposition Code Type?
WHEN
The system evaluates the disposition code type
THEN
The code is classified as HMI Hold, HRE Release, SEI Seizure, or SER Seizure Release for appropriate processing
Context: A VID segment contains HMI disposition code for valid equipment in train
GIVEN
A VID segment contains HMI disposition code for valid equipment in train
Applied to: Process Equipment Hold - HMI
WHEN
The system processes the equipment hold request
THEN
Equipment hold processing is initiated for the specified equipment
Context: A VID segment contains HRE disposition code for valid equipment in train
GIVEN
A VID segment contains HRE disposition code for valid equipment in train
Applied to: Process Equipment Release - HRE
WHEN
The system processes the equipment release request
THEN
Equipment release processing is initiated for the specified equipment
Context: A VID segment contains SEI disposition code for valid equipment in train
GIVEN
A VID segment contains SEI disposition code for valid equipment in train
Applied to: Process Equipment Seizure - SEI
WHEN
The system processes the equipment seizure request
THEN
Equipment seizure processing is initiated for the specified equipment
Context: A VID segment contains SER disposition code for valid equipment in train
GIVEN
A VID segment contains SER disposition code for valid equipment in train
Applied to: Process Equipment Seizure Release - SER
WHEN
The system processes the equipment seizure release request
THEN
Equipment seizure release processing is initiated for the specified equipment
Context: Equipment hold processing has been initiated for specific equipment
GIVEN
Equipment hold processing has been initiated for specific equipment
Applied to: Update Equipment Hold Status Flag
WHEN
The system updates equipment status information
THEN
The equipment hold status flag is set to indicate hold condition
Context: Equipment release processing has been initiated for specific equipment
GIVEN
Equipment release processing has been initiated for specific equipment
Applied to: Update Equipment Release Status Flag
WHEN
The system updates equipment status information
THEN
The equipment release status flag is set to indicate release condition
Context: Equipment seizure processing has been initiated for specific equipment
GIVEN
Equipment seizure processing has been initiated for specific equipment
Applied to: Update Equipment Seizure Status Flag
WHEN
The system updates equipment status information
THEN
The equipment seizure status flag is set to indicate seizure condition
Context: Equipment seizure release processing has been initiated for specific equipment
GIVEN
Equipment seizure release processing has been initiated for specific equipment
Applied to: Update Equipment Seizure Release Status Flag
WHEN
The system updates equipment status information
THEN
The equipment seizure release status flag is set to indicate release from seizure condition
Context: Equipment hold status flag has been updated for specific equipment
GIVEN
Equipment hold status flag has been updated for specific equipment
Applied to: Update Equipment Hold Counter
WHEN
The system updates equipment tracking counters
THEN
The equipment hold counter is incremented to reflect the additional hold action
Context: Equipment release status flag has been updated for specific equipment
GIVEN
Equipment release status flag has been updated for specific equipment
Applied to: Update Equipment Release Counter
WHEN
The system updates equipment tracking counters
THEN
The equipment release counter is incremented to reflect the additional release action
Context: Equipment seizure status flag has been updated for specific equipment
GIVEN
Equipment seizure status flag has been updated for specific equipment
Applied to: Update Equipment Seizure Counter
WHEN
The system updates equipment tracking counters
THEN
The equipment seizure counter is incremented to reflect the additional seizure action
Context: Equipment seizure release status flag has been updated for specific equipment
GIVEN
Equipment seizure release status flag has been updated for specific equipment
Applied to: Update Equipment Seizure Release Counter
WHEN
The system updates equipment tracking counters
THEN
The equipment seizure release counter is incremented to reflect the additional seizure release action
Context: Equipment status counters have been updated for specific equipment
GIVEN
Equipment status counters have been updated for specific equipment
Applied to: Update Train Equipment List
WHEN
The system updates the train equipment list
THEN
The train equipment list reflects the current status information for the processed equipment
Context: Train equipment list has been updated with current equipment status
GIVEN
Train equipment list has been updated with current equipment status
Applied to: Log Equipment Status Change
WHEN
The system creates audit trail documentation
THEN
Equipment status change is logged with timestamp, equipment ID, and status change details
Context: Equipment status change has been logged in the system
GIVEN
Equipment status change has been logged in the system
Applied to: Generate Equipment Status Notification
WHEN
The system generates status notifications
THEN
Equipment status notification is created and sent to appropriate recipients
Context: Equipment search in train consist has been completed
GIVEN
Equipment search in train consist has been completed
Applied to: Generate Equipment Not Found Error
WHEN
The specified equipment is not found in the train consist
THEN
Equipment not found error is generated with appropriate error details
Context: Equipment ID has been extracted from VID segment
GIVEN
Equipment ID has been extracted from VID segment
Applied to: Generate Invalid Equipment ID Error
WHEN
The equipment ID fails validation requirements
THEN
Invalid equipment ID error is generated with appropriate error details
R-GCX016E-cbl-01621 (+12) File: GCX016E.cbl Train Arrival Date Management Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Arrival Date Management':
  • Context - a v9 segment is received with event code data:
    For Disposition Code?:
    When the system evaluates the disposition code in the v9 segment, then the system identifies pod (proof of delivery) or aad (actual arrival date) events and routes to appropriate arrival processing.
  • Context - a v9 segment contains pod or aad event code:
    For Extract Date from V9 Segment:
    When the system processes the v9 segment for date information, then the system extracts the date value from the v9 segment for validation.
  • Context - a date has been extracted from the v9 segment:
    For Date Valid?:
    When the system validates the date format and value, then the system determines if the date is valid for business processing or requires default system date.
  • Context - the v9 segment date has been validated as correct:
    For Use V9 Segment Date:
    When the system processes the train arrival date assignment, then the system assigns the v9 segment date as the official train arrival date.
  • Context - the v9 segment date is invalid, missing, or fails validation:
    For Default to System Date:
    When the system requires a train arrival date for processing, then the system assigns the current system date as the default train arrival date.
  • Context - a train arrival date has been determined (either from v9 segment or system default):
    For Format Date for Processing:
    When the system prepares the date for train record processing, then the system formats the date into the standard format required for train arrival processing.
  • Context - a train arrival is being processed with a formatted arrival date:
    For Train Type?:
    When the system evaluates the train type based on manifest characteristics, then the system classifies the train as either export manifest train (with 't' suffix) or import manifest train for specialized processing.
  • Context - a train is classified as an export manifest train with 't' suffix:
    For Validate Export Port Authorization:
    When the system processes the export train arrival, then the system validates that the export port is authorized for the train's export operations before proceeding with arrival processing.
  • Context - a train arrival date has been validated and formatted, and train type processing is complete:
    For Set Train Arrival Date:
    When the system updates the train record, then the system assigns the arrival date to the train record for all subsequent processing.
  • Context - the train arrival date has been successfully set in the train record:
    For Update Train Status to Arrived:
    When the system updates the train operational status, then the system changes the train status to 'arrived' to reflect the current operational state.
  • Context - the train status has been updated to arrived with the assigned arrival date:
    For Log Arrival Date Assignment:
    When the system performs audit logging for the arrival event, then the system creates a log entry documenting the arrival date assignment, source of date (v9 segment or system default), and timestamp of the assignment.
  • Context - the train arrival has been logged and all arrival processing is complete:
    For Generate AEI Notification:
    When the system generates external notifications for the arrival event, then the system creates an aei notification containing train identification, arrival date, and location information for external systems.
  • Context - the aei notification has been generated for the train arrival:
    For Send Arrival Confirmation:
    When the system sends confirmation messages to business stakeholders, then the system transmits arrival confirmation containing train details, arrival date, and status to all configured recipients and external systems.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment is received with event code data
GIVEN
A V9 segment is received with event code data
Applied to: Disposition Code?
WHEN
The system evaluates the disposition code in the V9 segment
THEN
The system identifies POD (Proof of Delivery) or AAD (Actual Arrival Date) events and routes to appropriate arrival processing
Context: A V9 segment contains POD or AAD event code
GIVEN
A V9 segment contains POD or AAD event code
Applied to: Extract Date from V9 Segment
WHEN
The system processes the V9 segment for date information
THEN
The system extracts the date value from the V9 segment for validation
Context: A date has been extracted from the V9 segment
GIVEN
A date has been extracted from the V9 segment
Applied to: Date Valid?
WHEN
The system validates the date format and value
THEN
The system determines if the date is valid for business processing or requires default system date
Context: The V9 segment date has been validated as correct
GIVEN
The V9 segment date has been validated as correct
Applied to: Use V9 Segment Date
WHEN
The system processes the train arrival date assignment
THEN
The system assigns the V9 segment date as the official train arrival date
Context: The V9 segment date is invalid, missing, or fails validation
GIVEN
The V9 segment date is invalid, missing, or fails validation
Applied to: Default to System Date
WHEN
The system requires a train arrival date for processing
THEN
The system assigns the current system date as the default train arrival date
Context: A train arrival date has been determined (either from V9 segment or system default)
GIVEN
A train arrival date has been determined (either from V9 segment or system default)
Applied to: Format Date for Processing
WHEN
The system prepares the date for train record processing
THEN
The system formats the date into the standard format required for train arrival processing
Context: A train arrival is being processed with a formatted arrival date
GIVEN
A train arrival is being processed with a formatted arrival date
Applied to: Train Type?
WHEN
The system evaluates the train type based on manifest characteristics
THEN
The system classifies the train as either export manifest train (with 'T' suffix) or import manifest train for specialized processing
Context: A train is classified as an export manifest train with 'T' suffix
GIVEN
A train is classified as an export manifest train with 'T' suffix
Applied to: Validate Export Port Authorization
WHEN
The system processes the export train arrival
THEN
The system validates that the export port is authorized for the train's export operations before proceeding with arrival processing
Context: A train arrival date has been validated and formatted, and train type processing is complete
GIVEN
A train arrival date has been validated and formatted, and train type processing is complete
Applied to: Set Train Arrival Date
WHEN
The system updates the train record
THEN
The system assigns the arrival date to the train record for all subsequent processing
Context: The train arrival date has been successfully set in the train record
GIVEN
The train arrival date has been successfully set in the train record
Applied to: Update Train Status to Arrived
WHEN
The system updates the train operational status
THEN
The system changes the train status to 'Arrived' to reflect the current operational state
Context: The train status has been updated to arrived with the assigned arrival date
GIVEN
The train status has been updated to arrived with the assigned arrival date
Applied to: Log Arrival Date Assignment
WHEN
The system performs audit logging for the arrival event
THEN
The system creates a log entry documenting the arrival date assignment, source of date (V9 segment or system default), and timestamp of the assignment
Context: The train arrival has been logged and all arrival processing is complete
GIVEN
The train arrival has been logged and all arrival processing is complete
Applied to: Generate AEI Notification
WHEN
The system generates external notifications for the arrival event
THEN
The system creates an AEI notification containing train identification, arrival date, and location information for external systems
Context: The AEI notification has been generated for the train arrival
GIVEN
The AEI notification has been generated for the train arrival
Applied to: Send Arrival Confirmation
WHEN
The system sends confirmation messages to business stakeholders
THEN
The system transmits arrival confirmation containing train details, arrival date, and status to all configured recipients and external systems
R-GCX016E-cbl-01634 (+13) File: GCX016E.cbl US Cargo Arrival Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US Cargo Arrival Processing':
  • Context - a train arrival event (pod/aad disposition) has been received:
    For Train Type Check:
    When the system checks the train manifest type suffix, then if the manifest has 't' suffix, classify as export manifest train, otherwise classify as import manifest train.
  • Context - an export manifest train with 't' suffix is being processed for arrival:
    For Port Valid for Export?:
    When the system validates the arrival port against authorized export ports, then if the port is valid for export operations, continue with arrival processing, otherwise terminate processing.
  • Context - a train has been validated for arrival processing:
    For Set Train Arrival Status:
    When the system processes the arrival event, then set the train arrival status flag to indicate the train has arrived.
  • Context - a train arrival status has been set:
    For Update Train Arrival Date from V9 Segment:
    When the system processes the v9 segment containing arrival date and time, then update the train arrival date with the date and time from the v9 segment.
  • Context - a train arrival date has been updated:
    For US Cargo Found?:
    When the system searches for us cargo in the train manifest, then if us cargo is found in the train, proceed with cargo arrival processing, otherwise complete train processing without cargo updates.
  • Context - us cargo has been found in an arriving train:
    For Set Cargo Arrival Flag:
    When the system processes each cargo shipment, then set the arrival flag for each cargo to indicate it has arrived at destination.
  • Context - cargo arrival flag has been set:
    For Calculate Cargo Age:
    When the system calculates cargo transit time, then calculate the age of cargo based on the difference between current date and original shipment date.
  • Context - cargo age has been calculated:
    For Clear Bond Start Dates:
    When the system processes bond information for arrived cargo, then clear the bond start dates to reset the bonding period for the arrived cargo.
  • Context - bond start dates have been cleared for cargo:
    For Set Arrival Index:
    When the system assigns tracking references, then set the arrival index for the cargo to enable proper tracking and reference.
  • Context - arrival index has been set for cargo:
    For Generate AEI Message:
    When the system generates arrival notifications, then create an aei message containing train and cargo arrival information.
  • Context - aei message has been generated:
    For Send AEI Notification:
    When the system sends arrival notifications, then transmit the aei notification to configured recipients and external systems.
  • Context - aei notification has been sent:
    For Create Arrival Notification Message:
    When the system creates business notifications, then create a detailed arrival notification message containing train and cargo details.
  • Context - arrival notification message has been created:
    For Log Train Arrival Action:
    When the system logs the arrival event, then record the train arrival action in system logs with timestamp and details.
  • Context - train arrival action has been logged:
    For Update Equipment Status in Train:
    When the system updates equipment records, then update the status of all equipment in the train to reflect arrival at destination.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event (POD/AAD disposition) has been received
GIVEN
A train arrival event (POD/AAD disposition) has been received
Applied to: Train Type Check
WHEN
The system checks the train manifest type suffix
THEN
If the manifest has 'T' suffix, classify as export manifest train, otherwise classify as import manifest train
Context: An export manifest train with 'T' suffix is being processed for arrival
GIVEN
An export manifest train with 'T' suffix is being processed for arrival
Applied to: Port Valid for Export?
WHEN
The system validates the arrival port against authorized export ports
THEN
If the port is valid for export operations, continue with arrival processing, otherwise terminate processing
Context: A train has been validated for arrival processing
GIVEN
A train has been validated for arrival processing
Applied to: Set Train Arrival Status
WHEN
The system processes the arrival event
THEN
Set the train arrival status flag to indicate the train has arrived
Context: A train arrival status has been set
GIVEN
A train arrival status has been set
Applied to: Update Train Arrival Date from V9 Segment
WHEN
The system processes the V9 segment containing arrival date and time
THEN
Update the train arrival date with the date and time from the V9 segment
Context: A train arrival date has been updated
GIVEN
A train arrival date has been updated
Applied to: US Cargo Found?
WHEN
The system searches for US cargo in the train manifest
THEN
If US cargo is found in the train, proceed with cargo arrival processing, otherwise complete train processing without cargo updates
Context: US cargo has been found in an arriving train
GIVEN
US cargo has been found in an arriving train
Applied to: Set Cargo Arrival Flag
WHEN
The system processes each cargo shipment
THEN
Set the arrival flag for each cargo to indicate it has arrived at destination
Context: Cargo arrival flag has been set
GIVEN
Cargo arrival flag has been set
Applied to: Calculate Cargo Age
WHEN
The system calculates cargo transit time
THEN
Calculate the age of cargo based on the difference between current date and original shipment date
Context: Cargo age has been calculated
GIVEN
Cargo age has been calculated
Applied to: Clear Bond Start Dates
WHEN
The system processes bond information for arrived cargo
THEN
Clear the bond start dates to reset the bonding period for the arrived cargo
Context: Bond start dates have been cleared for cargo
GIVEN
Bond start dates have been cleared for cargo
Applied to: Set Arrival Index
WHEN
The system assigns tracking references
THEN
Set the arrival index for the cargo to enable proper tracking and reference
Context: Arrival index has been set for cargo
GIVEN
Arrival index has been set for cargo
Applied to: Generate AEI Message
WHEN
The system generates arrival notifications
THEN
Create an AEI message containing train and cargo arrival information
Context: AEI message has been generated
GIVEN
AEI message has been generated
Applied to: Send AEI Notification
WHEN
The system sends arrival notifications
THEN
Transmit the AEI notification to configured recipients and external systems
Context: AEI notification has been sent
GIVEN
AEI notification has been sent
Applied to: Create Arrival Notification Message
WHEN
The system creates business notifications
THEN
Create a detailed arrival notification message containing train and cargo details
Context: Arrival notification message has been created
GIVEN
Arrival notification message has been created
Applied to: Log Train Arrival Action
WHEN
The system logs the arrival event
THEN
Record the train arrival action in system logs with timestamp and details
Context: Train arrival action has been logged
GIVEN
Train arrival action has been logged
Applied to: Update Equipment Status in Train
WHEN
The system updates equipment records
THEN
Update the status of all equipment in the train to reflect arrival at destination
R-GCX016E-cbl-01648 (+9) File: GCX016E.cbl K1 Remark Message Processing for Trains Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'K1 Remark Message Processing for Trains':
  • Context - a message segment is being processed:
    For K1 Segment Detected in Message Stream:
    When the segment type is 'k1' and train context is being evaluated, then the system should identify the k1 segment and check if train processing context is active.
  • Context - a k1 segment is detected and train context is active:
    For Extract Free-Form Text from K1 Segment:
    When the system processes the k1 segment content, then the free-form text should be extracted from the k1 segment data.
  • Context - free-form text has been extracted from k1 segment:
    For Associate Text with Current Train ID:
    When the system processes train identification, then the k1 text should be associated with the current train id.
  • Context - k1 text is associated with current train id:
    For Link Text to Train Disposition Code:
    When the system processes disposition code context, then the k1 text should be linked to the train disposition code.
  • Context - k1 text is linked to train disposition code:
    For Special Bond Creation Message?:
    When the system checks for canadian pacific railway identifiers including 'director of customs, cp rail', 'canadian pacific limited', or 'canadian pacific railway co', then the system should identify if this is a special cpr bond creation message.
  • Context - a canadian pacific railway bond creation message is detected:
    For Process Canadian Pacific Railway Bond Creation:
    When the system processes the cpr-specific bond creation, then the system should execute canadian pacific railway bond creation processing.
  • Context - k1 text processing is complete (either regular or cpr bond processing):
    For Store K1 Text in Train Processing Context:
    When the system stores the k1 text information, then the k1 text should be stored in the train processing context.
  • Context - k1 text is stored in train processing context:
    For Log K1 Remark for Train:
    When the system performs logging operations, then the k1 remark should be logged for the train.
  • Context - k1 remark is logged for the train:
    For Include K1 Text in Train Merlin Messages:
    When the system generates merlin messages for the train, then the k1 text should be included in the train merlin messages.
  • Context - k1 processing is complete (either with train context or without):
    For Continue to Next Message Segment:
    When the system finishes k1 segment processing, then the system should continue to process the next message segment.
👨‍💻 Technical ACs (Gherkin)
Context: A message segment is being processed
GIVEN
A message segment is being processed
Applied to: K1 Segment Detected in Message Stream
WHEN
The segment type is 'K1' and train context is being evaluated
THEN
The system should identify the K1 segment and check if train processing context is active
Context: A K1 segment is detected and train context is active
GIVEN
A K1 segment is detected and train context is active
Applied to: Extract Free-Form Text from K1 Segment
WHEN
The system processes the K1 segment content
THEN
The free-form text should be extracted from the K1 segment data
Context: Free-form text has been extracted from K1 segment
GIVEN
Free-form text has been extracted from K1 segment
Applied to: Associate Text with Current Train ID
WHEN
The system processes train identification
THEN
The K1 text should be associated with the current train ID
Context: K1 text is associated with current train ID
GIVEN
K1 text is associated with current train ID
Applied to: Link Text to Train Disposition Code
WHEN
The system processes disposition code context
THEN
The K1 text should be linked to the train disposition code
Context: K1 text is linked to train disposition code
GIVEN
K1 text is linked to train disposition code
Applied to: Special Bond Creation Message?
WHEN
The system checks for Canadian Pacific Railway identifiers including 'DIRECTOR OF CUSTOMS, CP RAIL', 'CANADIAN PACIFIC LIMITED', or 'CANADIAN PACIFIC RAILWAY CO'
THEN
The system should identify if this is a special CPR bond creation message
Context: A Canadian Pacific Railway bond creation message is detected
GIVEN
A Canadian Pacific Railway bond creation message is detected
Applied to: Process Canadian Pacific Railway Bond Creation
WHEN
The system processes the CPR-specific bond creation
THEN
The system should execute Canadian Pacific Railway bond creation processing
Context: K1 text processing is complete (either regular or CPR bond processing)
GIVEN
K1 text processing is complete (either regular or CPR bond processing)
Applied to: Store K1 Text in Train Processing Context
WHEN
The system stores the K1 text information
THEN
The K1 text should be stored in the train processing context
Context: K1 text is stored in train processing context
GIVEN
K1 text is stored in train processing context
Applied to: Log K1 Remark for Train
WHEN
The system performs logging operations
THEN
The K1 remark should be logged for the train
Context: K1 remark is logged for the train
GIVEN
K1 remark is logged for the train
Applied to: Include K1 Text in Train Merlin Messages
WHEN
The system generates Merlin messages for the train
THEN
The K1 text should be included in the train Merlin messages
Context: K1 processing is complete (either with train context or without)
GIVEN
K1 processing is complete (either with train context or without)
Applied to: Continue to Next Message Segment
WHEN
The system finishes K1 segment processing
THEN
The system should continue to process the next message segment
R-GCX016E-cbl-01658 (+10) File: GCX016E.cbl K1 Remark Message Processing for Cargo Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'K1 Remark Message Processing for Cargo':
  • Context - a message segment is being processed:
    For K1 Segment Detected in Message:
    When the segment type is identified as 'k1', then the system should invoke b400-process-k1-segment routine.
  • Context - a k1 segment is being processed:
    For Extract Free-Form Text Message:
    When the segment contains free-form text data, then the system should extract and store the text message content.
  • Context - a k1 comment has been extracted from the segment:
    For Associated with Cargo?:
    When the system evaluates the processing context, then the system should determine if the comment is cargo-related and route accordingly.
  • Context - a k1 comment is determined to be cargo-associated:
    For Store K1 Text in Cargo Context:
    When the comment text needs to be preserved, then the system should store the k1 text in the cargo processing context.
  • Context - a k1 comment is stored in cargo context:
    For Link K1 Message to Disposition Code:
    When a disposition code is being processed, then the system should link the k1 message to the appropriate disposition code.
  • Context - a k1 comment is linked to a disposition code:
    For Add to K1 Comment Array:
    When the comment needs to be stored in the array structure, then the system should add the k1 comment to the appropriate comment array position.
  • Context - a k1 segment has been processed and stored:
    For More K1 Segments?:
    When the system checks for additional k1 segments in the message, then the system should continue k1 processing if more segments exist or proceed to integration if complete.
  • Context - all k1 segments have been processed and stored:
    For Integrate K1 Comments into Processing:
    When the system needs to integrate comments into cargo processing, then the system should make k1 comments available for subsequent processing steps.
  • Context - k1 comments are integrated into processing and merlin notifications are being generated:
    For Include K1 Text in Merlin Notifications:
    When the system creates notification messages, then the system should include relevant k1 comment text in the merlin notification content.
  • Context - k1 comments have been included in merlin notifications:
    For Log K1 Message for Audit Trail:
    When the system needs to maintain audit trail records, then the system should log k1 message details for audit and compliance purposes.
  • Context - k1 segment processing is complete including logging:
    For Continue Message Processing:
    When the system needs to continue with remaining message segments, then the system should proceed to process the next segment in the message sequence.
👨‍💻 Technical ACs (Gherkin)
Context: A message segment is being processed
GIVEN
A message segment is being processed
Applied to: K1 Segment Detected in Message
WHEN
The segment type is identified as 'K1'
THEN
The system should invoke B400-PROCESS-K1-SEGMENT routine
Context: A K1 segment is being processed
GIVEN
A K1 segment is being processed
Applied to: Extract Free-Form Text Message
WHEN
The segment contains free-form text data
THEN
The system should extract and store the text message content
Context: A K1 comment has been extracted from the segment
GIVEN
A K1 comment has been extracted from the segment
Applied to: Associated with Cargo?
WHEN
The system evaluates the processing context
THEN
The system should determine if the comment is cargo-related and route accordingly
Context: A K1 comment is determined to be cargo-associated
GIVEN
A K1 comment is determined to be cargo-associated
Applied to: Store K1 Text in Cargo Context
WHEN
The comment text needs to be preserved
THEN
The system should store the K1 text in the cargo processing context
Context: A K1 comment is stored in cargo context
GIVEN
A K1 comment is stored in cargo context
Applied to: Link K1 Message to Disposition Code
WHEN
A disposition code is being processed
THEN
The system should link the K1 message to the appropriate disposition code
Context: A K1 comment is linked to a disposition code
GIVEN
A K1 comment is linked to a disposition code
Applied to: Add to K1 Comment Array
WHEN
The comment needs to be stored in the array structure
THEN
The system should add the K1 comment to the appropriate comment array position
Context: A K1 segment has been processed and stored
GIVEN
A K1 segment has been processed and stored
Applied to: More K1 Segments?
WHEN
The system checks for additional K1 segments in the message
THEN
The system should continue K1 processing if more segments exist or proceed to integration if complete
Context: All K1 segments have been processed and stored
GIVEN
All K1 segments have been processed and stored
Applied to: Integrate K1 Comments into Processing
WHEN
The system needs to integrate comments into cargo processing
THEN
The system should make K1 comments available for subsequent processing steps
Context: K1 comments are integrated into processing and Merlin notifications are being generated
GIVEN
K1 comments are integrated into processing and Merlin notifications are being generated
Applied to: Include K1 Text in Merlin Notifications
WHEN
The system creates notification messages
THEN
The system should include relevant K1 comment text in the Merlin notification content
Context: K1 comments have been included in Merlin notifications
GIVEN
K1 comments have been included in Merlin notifications
Applied to: Log K1 Message for Audit Trail
WHEN
The system needs to maintain audit trail records
THEN
The system should log K1 message details for audit and compliance purposes
Context: K1 segment processing is complete including logging
GIVEN
K1 segment processing is complete including logging
Applied to: Continue Message Processing
WHEN
The system needs to continue with remaining message segments
THEN
The system should proceed to process the next segment in the message sequence
R-GCX016E-cbl-01669 (+11) File: GCX016E.cbl X4 Segment Date and Time Validation Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'X4 Segment Date and Time Validation':
  • Context - an x4 segment is received with a disposition code date field:
    For Date Valid?:
    When the system extracts and validates the disposition code date, then if the date is valid, use the extracted date; if the date is invalid or missing, default to the current system date.
  • Context - an x4 segment is received with a disposition code time field:
    For Time Valid?:
    When the system extracts and validates the disposition code time, then if the time is valid, use the extracted time; if the time is invalid or missing, default to the current system time.
  • Context - an x4 segment containing disposition code information:
    For Extract Disposition Code Date & Extract Disposition Code Time:
    When the system processes the x4 segment, then extract the date field from the disposition code data for further validation and extract the time field from the disposition code data for further validation.
  • Context - a disposition code date has been extracted from x4 segment and validated as correct:
    For Use Extracted Date:
    When the date validation passes, then use the extracted date value for disposition code date/time processing.
  • Context - a disposition code date has been extracted from x4 segment and is invalid or missing:
    For Default to System Date:
    When the date validation fails, then use the current system date as the default value for disposition code processing.
  • Context - a disposition code time has been extracted from x4 segment and validated as correct:
    For Use Extracted Time:
    When the time validation passes, then use the extracted time value for disposition code date/time processing.
  • Context - a disposition code time has been extracted from x4 segment and is invalid or missing:
    For Default to System Time:
    When the time validation fails, then use the current system time as the default value for disposition code processing.
  • Context - a valid date (either extracted or system default) for disposition code processing:
    For Format Date for Processing:
    When the date needs to be formatted for system processing, then convert the date into the standard format required for disposition code operations.
  • Context - a valid time (either extracted or system default) for disposition code processing:
    For Format Time for Processing:
    When the time needs to be formatted for system processing, then convert the time into the standard format required for disposition code operations.
  • Context - formatted date and time components for disposition code processing:
    For Combine Date and Time:
    When both date and time have been validated and formatted, then combine the date and time into a single datetime value for storage and processing.
  • Context - a combined datetime value from validated date and time components:
    For Store Formatted DateTime:
    When the datetime combination is complete, then store the formatted datetime value in the appropriate field for disposition code processing.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is received with a disposition code date field
GIVEN
An X4 segment is received with a disposition code date field
Applied to: Date Valid?
WHEN
The system extracts and validates the disposition code date
THEN
If the date is valid, use the extracted date; if the date is invalid or missing, default to the current system date
Context: An X4 segment is received with a disposition code time field
GIVEN
An X4 segment is received with a disposition code time field
Applied to: Time Valid?
WHEN
The system extracts and validates the disposition code time
THEN
If the time is valid, use the extracted time; if the time is invalid or missing, default to the current system time
Context: An X4 segment containing disposition code information
GIVEN
An X4 segment containing disposition code information
Applied to: Extract Disposition Code Date & Extract Disposition Code Time
WHEN
The system processes the X4 segment
THEN
Extract the date field from the disposition code data for further validation AND Extract the time field from the disposition code data for further validation
Context: A disposition code date has been extracted from X4 segment and validated as correct
GIVEN
A disposition code date has been extracted from X4 segment and validated as correct
Applied to: Use Extracted Date
WHEN
The date validation passes
THEN
Use the extracted date value for disposition code date/time processing
Context: A disposition code date has been extracted from X4 segment and is invalid or missing
GIVEN
A disposition code date has been extracted from X4 segment and is invalid or missing
Applied to: Default to System Date
WHEN
The date validation fails
THEN
Use the current system date as the default value for disposition code processing
Context: A disposition code time has been extracted from X4 segment and validated as correct
GIVEN
A disposition code time has been extracted from X4 segment and validated as correct
Applied to: Use Extracted Time
WHEN
The time validation passes
THEN
Use the extracted time value for disposition code date/time processing
Context: A disposition code time has been extracted from X4 segment and is invalid or missing
GIVEN
A disposition code time has been extracted from X4 segment and is invalid or missing
Applied to: Default to System Time
WHEN
The time validation fails
THEN
Use the current system time as the default value for disposition code processing
Context: A valid date (either extracted or system default) for disposition code processing
GIVEN
A valid date (either extracted or system default) for disposition code processing
Applied to: Format Date for Processing
WHEN
The date needs to be formatted for system processing
THEN
Convert the date into the standard format required for disposition code operations
Context: A valid time (either extracted or system default) for disposition code processing
GIVEN
A valid time (either extracted or system default) for disposition code processing
Applied to: Format Time for Processing
WHEN
The time needs to be formatted for system processing
THEN
Convert the time into the standard format required for disposition code operations
Context: Formatted date and time components for disposition code processing
GIVEN
Formatted date and time components for disposition code processing
Applied to: Combine Date and Time
WHEN
Both date and time have been validated and formatted
THEN
Combine the date and time into a single datetime value for storage and processing
Context: A combined datetime value from validated date and time components
GIVEN
A combined datetime value from validated date and time components
Applied to: Store Formatted DateTime
WHEN
The datetime combination is complete
THEN
Store the formatted datetime value in the appropriate field for disposition code processing
R-GCX016E-cbl-01681 (+7) File: GCX016E.cbl Disposition Code Re Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Re':
  • Context - a disposition code is being processed for a cargo shipment:
    For Is Disposition Code 'Proceed'?:
    When the disposition code is 'proceed' and the cargo arrival status is checked, then if cargo has arrived, apply standard proceed processing; if cargo has not arrived, skip proceed processing and continue with normal flow.
    For Is Disposition Code 'Cancel'?:
    When the disposition code is 'cancel-xj' and previous disposition codes are searched, then if a matching proceed code is found, remove the previous proceed code and then apply cancel processing; if no matching code is found, proceed directly to cancel processing.
  • Context - a proceed disposition code is being processed for a cargo shipment:
    For Has Cargo Arrived?:
    When the cargo arrival status is evaluated, then return true if cargo arrival date exists and cargo status indicates arrival, otherwise return false.
  • Context - a cancel disposition code is being processed and previous disposition codes exist:
    For Find Matching Proceed Code?:
    When the system searches through the cargo's disposition code history, then return true if a proceed disposition code with matching entry number and quantity is found, otherwise return false.
  • Context - a matching proceed disposition code has been identified in the cargo's disposition history:
    For Remove Previous Proceed Code:
    When the cancel disposition processing requires removal of the previous code, then remove the proceed code from the disposition array and update the array sequence numbers accordingly.
  • Context - cancel disposition processing has been completed for a cargo shipment:
    For Cargo Status Changed?:
    When the cargo status before and after cancel processing is compared, then return true if the cargo status flags, release quantities, or arrival status have changed, otherwise return false.
  • Context - cargo status has changed as a result of disposition code re-processing:
    For Update Cargo Status Flags:
    When status flags need to be updated to reflect the new cargo state, then update arrival status, release status, hold status, and any other relevant cargo status indicators based on the final disposition code array.
  • Context - disposition code re-processing has occurred for a cargo shipment:
    For Log Re-processing Action:
    When the re-processing action needs to be recorded, then create a log entry containing the original disposition code, re-processing type, cargo identifier, and timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for a cargo shipment
GIVEN
A disposition code is being processed for a cargo shipment
Applied to: Is Disposition Code 'Proceed'?
WHEN
The disposition code is 'PROCEED' and the cargo arrival status is checked
THEN
If cargo has arrived, apply standard proceed processing; if cargo has not arrived, skip proceed processing and continue with normal flow
Applied to: Is Disposition Code 'Cancel'?
WHEN
The disposition code is 'CANCEL-XJ' and previous disposition codes are searched
THEN
If a matching proceed code is found, remove the previous proceed code and then apply cancel processing; if no matching code is found, proceed directly to cancel processing
Context: A proceed disposition code is being processed for a cargo shipment
GIVEN
A proceed disposition code is being processed for a cargo shipment
Applied to: Has Cargo Arrived?
WHEN
The cargo arrival status is evaluated
THEN
Return true if cargo arrival date exists and cargo status indicates arrival, otherwise return false
Context: A cancel disposition code is being processed and previous disposition codes exist
GIVEN
A cancel disposition code is being processed and previous disposition codes exist
Applied to: Find Matching Proceed Code?
WHEN
The system searches through the cargo's disposition code history
THEN
Return true if a proceed disposition code with matching entry number and quantity is found, otherwise return false
Context: A matching proceed disposition code has been identified in the cargo's disposition history
GIVEN
A matching proceed disposition code has been identified in the cargo's disposition history
Applied to: Remove Previous Proceed Code
WHEN
The cancel disposition processing requires removal of the previous code
THEN
Remove the proceed code from the disposition array and update the array sequence numbers accordingly
Context: Cancel disposition processing has been completed for a cargo shipment
GIVEN
Cancel disposition processing has been completed for a cargo shipment
Applied to: Cargo Status Changed?
WHEN
The cargo status before and after cancel processing is compared
THEN
Return true if the cargo status flags, release quantities, or arrival status have changed, otherwise return false
Context: Cargo status has changed as a result of disposition code re-processing
GIVEN
Cargo status has changed as a result of disposition code re-processing
Applied to: Update Cargo Status Flags
WHEN
Status flags need to be updated to reflect the new cargo state
THEN
Update arrival status, release status, hold status, and any other relevant cargo status indicators based on the final disposition code array
Context: Disposition code re-processing has occurred for a cargo shipment
GIVEN
Disposition code re-processing has occurred for a cargo shipment
Applied to: Log Re-processing Action
WHEN
The re-processing action needs to be recorded
THEN
Create a log entry containing the original disposition code, re-processing type, cargo identifier, and timestamp
R-GCX016E-cbl-01689 (+12) File: GCX016E.cbl Cargo Processing by US CCN Key Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Processing by US CCN Key':
  • Context - cargo has not been found via primary search methods:
    For US CCN Key Available?:
    When the system checks for us ccn key availability in the cargo record, then if us ccn key exists and is not empty, proceed with us ccn search; otherwise generate cargo not found error.
  • Context - a valid cargo record exists and us ccn key is available:
    For Extract US CCN from Cargo Record:
    When the system extracts the us ccn value from the cargo record, then the us ccn value is retrieved and prepared for formatting.
  • Context - us ccn has been extracted from the cargo record:
    For Format US CCN Key for Search:
    When the system formats the us ccn into a search key, then the us ccn is properly formatted according to database key requirements.
  • Context - us ccn key has been properly formatted for search:
    For Search Cargo Database by US CCN Key:
    When the system searches the cargo database using the us ccn key, then database search is executed against gcsusrt using the us ccn key.
  • Context - database search by us ccn has been completed:
    For Cargo Found by US CCN?:
    When the system evaluates the search results, then if cargo record is found, proceed with record retrieval; otherwise generate cargo not found error.
  • Context - cargo has been found by us ccn search:
    For Retrieve Cargo Record:
    When the system retrieves the cargo record from gcsusrt, then complete cargo record is loaded for further processing.
  • Context - cargo record has been retrieved from the database:
    For Validate Cargo Record Status:
    When the system validates the cargo record status using gcsccrt, then cargo record status is checked for validity and processing eligibility.
  • Context - cargo record status validation has been completed:
    For Valid Cargo Record?:
    When the system evaluates cargo record validity, then if cargo record is valid, proceed with cargo processing; otherwise generate cargo not found error.
  • Context - cargo record has been found and validated as eligible for processing:
    For Process Found Cargo:
    When the system begins cargo processing operations, then cargo processing is initiated with the validated cargo record.
  • Context - cargo processing has been initiated:
    For Update Cargo Processing Flags:
    When the system updates cargo processing status flags, then processing flags are set to indicate successful cargo location and processing status.
  • Context - cargo has been found, validated, and processing flags updated:
    For Continue with Disposition Processing:
    When the system continues with disposition processing, then disposition code processing proceeds with the located cargo record.
  • Context - us ccn key is not available, cargo is not found by us ccn search, or cargo record validation fails:
    For Generate Cargo Not Found Error:
    When the system generates a cargo not found error, then error is generated indicating cargo could not be located for processing.
  • Context - cargo not found error has been generated:
    For Log Search Attempt:
    When the system logs the search attempt, then search attempt details are recorded for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: Cargo has not been found via primary search methods
GIVEN
Cargo has not been found via primary search methods
Applied to: US CCN Key Available?
WHEN
The system checks for US CCN key availability in the cargo record
THEN
If US CCN key exists and is not empty, proceed with US CCN search; otherwise generate cargo not found error
Context: A valid cargo record exists and US CCN key is available
GIVEN
A valid cargo record exists and US CCN key is available
Applied to: Extract US CCN from Cargo Record
WHEN
The system extracts the US CCN value from the cargo record
THEN
The US CCN value is retrieved and prepared for formatting
Context: US CCN has been extracted from the cargo record
GIVEN
US CCN has been extracted from the cargo record
Applied to: Format US CCN Key for Search
WHEN
The system formats the US CCN into a search key
THEN
The US CCN is properly formatted according to database key requirements
Context: US CCN key has been properly formatted for search
GIVEN
US CCN key has been properly formatted for search
Applied to: Search Cargo Database by US CCN Key
WHEN
The system searches the cargo database using the US CCN key
THEN
Database search is executed against GCSUSRT using the US CCN key
Context: Database search by US CCN has been completed
GIVEN
Database search by US CCN has been completed
Applied to: Cargo Found by US CCN?
WHEN
The system evaluates the search results
THEN
If cargo record is found, proceed with record retrieval; otherwise generate cargo not found error
Context: Cargo has been found by US CCN search
GIVEN
Cargo has been found by US CCN search
Applied to: Retrieve Cargo Record
WHEN
The system retrieves the cargo record from GCSUSRT
THEN
Complete cargo record is loaded for further processing
Context: Cargo record has been retrieved from the database
GIVEN
Cargo record has been retrieved from the database
Applied to: Validate Cargo Record Status
WHEN
The system validates the cargo record status using GCSCCRT
THEN
Cargo record status is checked for validity and processing eligibility
Context: Cargo record status validation has been completed
GIVEN
Cargo record status validation has been completed
Applied to: Valid Cargo Record?
WHEN
The system evaluates cargo record validity
THEN
If cargo record is valid, proceed with cargo processing; otherwise generate cargo not found error
Context: Cargo record has been found and validated as eligible for processing
GIVEN
Cargo record has been found and validated as eligible for processing
Applied to: Process Found Cargo
WHEN
The system begins cargo processing operations
THEN
Cargo processing is initiated with the validated cargo record
Context: Cargo processing has been initiated
GIVEN
Cargo processing has been initiated
Applied to: Update Cargo Processing Flags
WHEN
The system updates cargo processing status flags
THEN
Processing flags are set to indicate successful cargo location and processing status
Context: Cargo has been found, validated, and processing flags updated
GIVEN
Cargo has been found, validated, and processing flags updated
Applied to: Continue with Disposition Processing
WHEN
The system continues with disposition processing
THEN
Disposition code processing proceeds with the located cargo record
Context: US CCN key is not available, cargo is not found by US CCN search, or cargo record validation fails
GIVEN
US CCN key is not available, cargo is not found by US CCN search, or cargo record validation fails
Applied to: Generate Cargo Not Found Error
WHEN
The system generates a cargo not found error
THEN
Error is generated indicating cargo could not be located for processing
Context: Cargo not found error has been generated
GIVEN
Cargo not found error has been generated
Applied to: Log Search Attempt
WHEN
The system logs the search attempt
THEN
Search attempt details are recorded for audit trail
R-GCX016E-cbl-01702 (+9) File: GCX016E.cbl Bond Information Clearing for DC95 Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Information Clearing for DC95':
  • Context - a disposition code 95 is received for processing:
    For Validate DC95 in Disposition Code Table:
    When the system looks up disposition code 95 in the disposition code table, then if dc95 is not found in the table, generate an error message and stop processing, otherwise continue with bond clearing process.
  • Context - disposition code 95 has been validated and bond cancellation is being processed:
    For Clear BOL Type Code:
    When the system processes the bond information clearing, then the bol type code field in the cargo record is cleared to spaces.
  • Context - bol type code has been cleared and bond cancellation is in progress:
    For Clear M12 Bond Data:
    When the system processes m12 bond data clearing, then all m12 segment bond-related fields are cleared to their default values.
  • Context - m12 bond data has been cleared and bond cancellation continues:
    For Clear Bond Number Index:
    When the system processes bond number index clearing, then the bond number index field is set to zero to remove the bond reference.
  • Context - bond number index has been cleared and bond cancellation processing continues:
    For Clear Broker QP Information:
    When the system processes broker qp information clearing, then all broker qualification and permit fields are cleared to spaces or zero values.
  • Context - broker qp information has been cleared and bond cancellation is proceeding:
    For Clear Bond Owner Information:
    When the system processes bond owner information clearing, then bond owner identification fields are cleared to remove ownership references.
  • Context - all bond information has been cleared from the cargo record:
    For Update Cargo Status Arrays:
    When the system updates the cargo status arrays, then the status array is updated with disposition code 95 and appropriate sequence numbers to track the bond cancellation.
  • Context - cargo status arrays have been updated with the bond cancellation:
    For Log Bond Clearing Action:
    When the system creates audit log entries, then a log entry is created with timestamp, user information, and details of the bond clearing action for audit trail purposes.
  • Context - bond clearing action has been logged and all updates are complete:
    For Generate Merlin Notification:
    When the system generates merlin notifications, then a merlin message is created and sent to appropriate recipients containing cargo details and bond cancellation information.
  • Context - disposition code 95 is being validated against the disposition code table:
    For DC95 Not Found - Generate Error:
    When dc95 is not found in the disposition code table, then generate an error message indicating invalid disposition code and terminate the bond cancellation process.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code 95 is received for processing
GIVEN
A disposition code 95 is received for processing
Applied to: Validate DC95 in Disposition Code Table
WHEN
The system looks up disposition code 95 in the disposition code table
THEN
If DC95 is not found in the table, generate an error message and stop processing, otherwise continue with bond clearing process
Context: Disposition code 95 has been validated and bond cancellation is being processed
GIVEN
Disposition code 95 has been validated and bond cancellation is being processed
Applied to: Clear BOL Type Code
WHEN
The system processes the bond information clearing
THEN
The BOL type code field in the cargo record is cleared to spaces
Context: BOL type code has been cleared and bond cancellation is in progress
GIVEN
BOL type code has been cleared and bond cancellation is in progress
Applied to: Clear M12 Bond Data
WHEN
The system processes M12 bond data clearing
THEN
All M12 segment bond-related fields are cleared to their default values
Context: M12 bond data has been cleared and bond cancellation continues
GIVEN
M12 bond data has been cleared and bond cancellation continues
Applied to: Clear Bond Number Index
WHEN
The system processes bond number index clearing
THEN
The bond number index field is set to zero to remove the bond reference
Context: Bond number index has been cleared and bond cancellation processing continues
GIVEN
Bond number index has been cleared and bond cancellation processing continues
Applied to: Clear Broker QP Information
WHEN
The system processes broker QP information clearing
THEN
All broker qualification and permit fields are cleared to spaces or zero values
Context: Broker QP information has been cleared and bond cancellation is proceeding
GIVEN
Broker QP information has been cleared and bond cancellation is proceeding
Applied to: Clear Bond Owner Information
WHEN
The system processes bond owner information clearing
THEN
Bond owner identification fields are cleared to remove ownership references
Context: All bond information has been cleared from the cargo record
GIVEN
All bond information has been cleared from the cargo record
Applied to: Update Cargo Status Arrays
WHEN
The system updates the cargo status arrays
THEN
The status array is updated with disposition code 95 and appropriate sequence numbers to track the bond cancellation
Context: Cargo status arrays have been updated with the bond cancellation
GIVEN
Cargo status arrays have been updated with the bond cancellation
Applied to: Log Bond Clearing Action
WHEN
The system creates audit log entries
THEN
A log entry is created with timestamp, user information, and details of the bond clearing action for audit trail purposes
Context: Bond clearing action has been logged and all updates are complete
GIVEN
Bond clearing action has been logged and all updates are complete
Applied to: Generate Merlin Notification
WHEN
The system generates Merlin notifications
THEN
A Merlin message is created and sent to appropriate recipients containing cargo details and bond cancellation information
Context: Disposition code 95 is being validated against the disposition code table
GIVEN
Disposition code 95 is being validated against the disposition code table
Applied to: DC95 Not Found - Generate Error
WHEN
DC95 is not found in the disposition code table
THEN
Generate an error message indicating invalid disposition code and terminate the bond cancellation process
R-GCX016E-cbl-01724 (+9) File: GCX016E.cbl Canadian Border Location Mapping Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Border Location Mapping':
  • Context - a cargo record contains cross-border movement information:
    For Extract US Port Code from Cargo Data:
    When the system processes cargo for cross-border movement, then the us port code is extracted from the cargo data for mapping purposes.
  • Context - a us port code needs to be mapped to a canadian border location:
    For Access Canadian Border Mapping Table:
    When the system requires canadian location mapping, then the canadian border mapping table is accessed for lookup operations.
  • Context - a us port code is available and the canadian border mapping table is accessible:
    For Lookup US Port Code in Mapping Table:
    When the system performs a lookup operation for the us port code, then the system searches the mapping table to find a corresponding canadian border location.
  • Context - a us port code lookup has been performed in the canadian border mapping table:
    For Mapping Found?:
    When the system evaluates the lookup results, then the system determines if a valid mapping exists for the us port code.
  • Context - a valid mapping exists for the us port code in the canadian border mapping table:
    For Retrieve Canadian Border Location Name:
    When the mapping is found during lookup, then the system retrieves the corresponding canadian border location name.
  • Context - a canadian border location name has been retrieved from the mapping table:
    For Update Cargo Record with Canadian Location:
    When the location mapping is successful, then the cargo record is updated with the canadian border location information.
  • Context - a cargo record has been updated with canadian border location information:
    For Set Cross-Border Flag:
    When the location update is completed, then a cross-border flag is set to indicate the cargo involves cross-border movement.
  • Context - a cross-border flag has been set for the cargo:
    For Log Mapping Success:
    When the mapping process completes successfully, then the system logs the successful mapping operation for audit purposes.
  • Context - a us port code lookup in the canadian border mapping table returns no results:
    For Generate Error for Unmapped Port:
    When no valid mapping is found for the us port code, then the system generates an error indicating the port code cannot be mapped.
  • Context - an error has been generated for an unmapped us port code:
    For Use Default Canadian Location:
    When no specific mapping is available, then the system uses a default canadian location to continue processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record contains cross-border movement information
GIVEN
A cargo record contains cross-border movement information
Applied to: Extract US Port Code from Cargo Data
WHEN
The system processes cargo for cross-border movement
THEN
The US port code is extracted from the cargo data for mapping purposes
Context: A US port code needs to be mapped to a Canadian border location
GIVEN
A US port code needs to be mapped to a Canadian border location
Applied to: Access Canadian Border Mapping Table
WHEN
The system requires Canadian location mapping
THEN
The Canadian border mapping table is accessed for lookup operations
Context: A US port code is available and the Canadian border mapping table is accessible
GIVEN
A US port code is available and the Canadian border mapping table is accessible
Applied to: Lookup US Port Code in Mapping Table
WHEN
The system performs a lookup operation for the US port code
THEN
The system searches the mapping table to find a corresponding Canadian border location
Context: A US port code lookup has been performed in the Canadian border mapping table
GIVEN
A US port code lookup has been performed in the Canadian border mapping table
Applied to: Mapping Found?
WHEN
The system evaluates the lookup results
THEN
The system determines if a valid mapping exists for the US port code
Context: A valid mapping exists for the US port code in the Canadian border mapping table
GIVEN
A valid mapping exists for the US port code in the Canadian border mapping table
Applied to: Retrieve Canadian Border Location Name
WHEN
The mapping is found during lookup
THEN
The system retrieves the corresponding Canadian border location name
Context: A Canadian border location name has been retrieved from the mapping table
GIVEN
A Canadian border location name has been retrieved from the mapping table
Applied to: Update Cargo Record with Canadian Location
WHEN
The location mapping is successful
THEN
The cargo record is updated with the Canadian border location information
Context: A cargo record has been updated with Canadian border location information
GIVEN
A cargo record has been updated with Canadian border location information
Applied to: Set Cross-Border Flag
WHEN
The location update is completed
THEN
A cross-border flag is set to indicate the cargo involves cross-border movement
Context: A cross-border flag has been set for the cargo
GIVEN
A cross-border flag has been set for the cargo
Applied to: Log Mapping Success
WHEN
The mapping process completes successfully
THEN
The system logs the successful mapping operation for audit purposes
Context: A US port code lookup in the Canadian border mapping table returns no results
GIVEN
A US port code lookup in the Canadian border mapping table returns no results
Applied to: Generate Error for Unmapped Port
WHEN
No valid mapping is found for the US port code
THEN
The system generates an error indicating the port code cannot be mapped
Context: An error has been generated for an unmapped US port code
GIVEN
An error has been generated for an unmapped US port code
Applied to: Use Default Canadian Location
WHEN
No specific mapping is available
THEN
The system uses a default Canadian location to continue processing
R-GCX016E-cbl-01734 (+11) File: GCX016E.cbl FDA Reference Number Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FDA Reference Number Processing':
  • Context - a cargo has an a1 disposition code requiring fda reference number processing:
    For A1 Disposition Code Processing:
    When the system processes the a1 disposition code, then the fda reference number is formatted and processed for a1 specific requirements.
  • Context - a cargo has an a3 disposition code requiring fda reference number processing:
    For A3 Disposition Code Processing:
    When the system processes the a3 disposition code, then the fda reference number is formatted and processed for a3 specific requirements.
  • Context - an a1 disposition code is being processed with an fda reference number:
    For Format FDA Reference Number for A1:
    When the system formats the fda reference number, then the fda reference number is formatted according to a1 disposition code requirements.
    For Add 'FDA PN' Prefix for A1:
    When the system adds the required prefix, then the fda reference number is prefixed with 'fda pn'.
  • Context - an a3 disposition code is being processed with an fda reference number:
    For Format FDA Reference Number for A3:
    When the system formats the fda reference number, then the fda reference number is formatted according to a3 disposition code requirements.
    For Add 'FDA' Prefix for A3:
    When the system adds the required prefix, then the fda reference number is prefixed with 'fda'.
  • Context - fda reference number processing is required for a cargo:
    For N9 Segment Exists?:
    When the system checks for existing n9 reference segments, then the system determines if an n9 segment exists and routes processing accordingly.
  • Context - no existing n9 reference segment exists for the cargo:
    For Create New N9 Reference Segment:
    When fda reference number processing is required, then a new n9 reference segment is created to store the fda reference number.
  • Context - an existing n9 reference segment exists for the cargo:
    For Update Existing N9 Reference Segment:
    When fda reference number processing is required, then the existing n9 reference segment is updated with the fda reference number.
  • Context - an fda reference number is being processed for a1 or a3 disposition codes:
    For Validate FDA Reference Number Format:
    When the system validates the reference number format, then the fda reference number format is verified to meet business requirements.
  • Context - an existing n9 reference segment needs to be updated with fda reference number:
    For Replace N9 Reference Segment:
    When the system processes the segment replacement, then the n9 reference segment is replaced with the updated fda reference information.
  • Context - a new n9 reference segment needs to be created with fda reference number:
    For Insert N9 Reference Segment:
    When the system processes the segment insertion, then the n9 reference segment is inserted with the fda reference information into the cargo record.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo has an A1 disposition code requiring FDA reference number processing
GIVEN
A cargo has an A1 disposition code requiring FDA reference number processing
Applied to: A1 Disposition Code Processing
WHEN
The system processes the A1 disposition code
THEN
The FDA reference number is formatted and processed for A1 specific requirements
Context: A cargo has an A3 disposition code requiring FDA reference number processing
GIVEN
A cargo has an A3 disposition code requiring FDA reference number processing
Applied to: A3 Disposition Code Processing
WHEN
The system processes the A3 disposition code
THEN
The FDA reference number is formatted and processed for A3 specific requirements
Context: An A1 disposition code is being processed with an FDA reference number
GIVEN
An A1 disposition code is being processed with an FDA reference number
Applied to: Format FDA Reference Number for A1
WHEN
The system formats the FDA reference number
THEN
The FDA reference number is formatted according to A1 disposition code requirements
Applied to: Add 'FDA PN' Prefix for A1
WHEN
The system adds the required prefix
THEN
The FDA reference number is prefixed with 'FDA PN'
Context: An A3 disposition code is being processed with an FDA reference number
GIVEN
An A3 disposition code is being processed with an FDA reference number
Applied to: Format FDA Reference Number for A3
WHEN
The system formats the FDA reference number
THEN
The FDA reference number is formatted according to A3 disposition code requirements
Applied to: Add 'FDA' Prefix for A3
WHEN
The system adds the required prefix
THEN
The FDA reference number is prefixed with 'FDA'
Context: FDA reference number processing is required for a cargo
GIVEN
FDA reference number processing is required for a cargo
Applied to: N9 Segment Exists?
WHEN
The system checks for existing N9 reference segments
THEN
The system determines if an N9 segment exists and routes processing accordingly
Context: No existing N9 reference segment exists for the cargo
GIVEN
No existing N9 reference segment exists for the cargo
Applied to: Create New N9 Reference Segment
WHEN
FDA reference number processing is required
THEN
A new N9 reference segment is created to store the FDA reference number
Context: An existing N9 reference segment exists for the cargo
GIVEN
An existing N9 reference segment exists for the cargo
Applied to: Update Existing N9 Reference Segment
WHEN
FDA reference number processing is required
THEN
The existing N9 reference segment is updated with the FDA reference number
Context: An FDA reference number is being processed for A1 or A3 disposition codes
GIVEN
An FDA reference number is being processed for A1 or A3 disposition codes
Applied to: Validate FDA Reference Number Format
WHEN
The system validates the reference number format
THEN
The FDA reference number format is verified to meet business requirements
Context: An existing N9 reference segment needs to be updated with FDA reference number
GIVEN
An existing N9 reference segment needs to be updated with FDA reference number
Applied to: Replace N9 Reference Segment
WHEN
The system processes the segment replacement
THEN
The N9 reference segment is replaced with the updated FDA reference information
Context: A new N9 reference segment needs to be created with FDA reference number
GIVEN
A new N9 reference segment needs to be created with FDA reference number
Applied to: Insert N9 Reference Segment
WHEN
The system processes the segment insertion
THEN
The N9 reference segment is inserted with the FDA reference information into the cargo record
R-GCX016E-cbl-01757 (+16) File: GCX016E.cbl Cargo Database Lookup by Bond Number Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Database Lookup by Bond Number':
  • Context - a cargo lookup request is initiated:
    For Receive Bond Number as Search Key:
    When the system receives the search parameters, then the bond number must be present and valid as the primary search key.
  • Context - a valid bond number is provided for search:
    For Call GCCUSIO2 Database Interface:
    When the system needs to access cargo database records, then the gccusio2 database interface program must be invoked with the bond number parameter.
  • Context - the database interface is active and bond number is provided:
    For Search GCSUSRT US Cargo Root Segments:
    When the system searches the gcsusrt table, then all cargo root segments with matching bond numbers must be identified and retrieved.
  • Context - a search has been performed on the cargo database using bond number:
    For First Cargo Record Found?:
    When the system evaluates the search results, then if no cargo records are found for the bond number, the system must return 'no records found' status, otherwise proceed with record retrieval.
  • Context - at least one cargo record exists for the specified bond number:
    For Retrieve First Cargo Record:
    When the system processes the first matching record, then the complete cargo record data must be retrieved and made available for processing.
  • Context - the first cargo record has been successfully retrieved:
    For Set Bond Index Position:
    When the system prepares for additional record searches, then the bond index position must be set to enable sequential access to remaining records with the same bond number.
  • Context - the first cargo record has been processed and bond index position is set:
    For Search for Subsequent Records:
    When the system searches for additional records, then all remaining cargo records with the same bond number must be identified in sequential order.
  • Context - a search for subsequent records has been performed:
    For More Records with Same Bond?:
    When the system evaluates if more records exist with the same bond number, then if additional records exist, continue processing the next record, otherwise complete the bond lookup process.
  • Context - additional cargo records exist with the same bond number:
    For Retrieve Next Cargo Record:
    When the system processes the next record in sequence, then the complete cargo record data must be retrieved and prepared for validation.
  • Context - a cargo record has been retrieved from the database:
    For Validate Status Code:
    When the system examines the record's status code, then the status code must be validated against business rules to determine if the record should be included in processing.
  • Context - a cargo record's status code has been validated:
    For Status Code Valid?:
    When the system evaluates the validation results, then if the status code is valid, the record must be considered for inclusion in the cargo processing list, otherwise the record must be excluded and the search must continue.
  • Context - a cargo record has a valid status code:
    For Add to Cargo Processing List:
    When the system determines the record should be included, then the cargo record must be added to the cargo processing list for further business processing.
  • Context - a cargo record has been processed (either included or excluded):
    For Continue Search Loop:
    When the system needs to check for additional records, then the search loop must continue to evaluate remaining cargo records with the same bond number.
  • Context - all cargo records with the specified bond number have been evaluated:
    For Complete Bond Lookup:
    When no more records exist with the same bond number, then the bond lookup process must be completed and the system must prepare to return the cargo record set.
  • Context - the bond lookup process has been completed:
    For Return Cargo Record Set:
    When the system has identified all valid cargo records for the bond number, then the complete set of cargo records must be returned to the calling process for further business operations.
  • Context - an error occurs during the bond lookup process:
    For Log Bond Lookup Error:
    When the system encounters a database access error or invalid search condition, then the error details must be logged and the system must prepare to return a 'no records found' status.
  • Context - no cargo records exist for the bond number or an error has occurred:
    For Return No Records Found:
    When the system completes the lookup process, then a 'no records found' status must be returned to indicate that no valid cargo records are available for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo lookup request is initiated
GIVEN
A cargo lookup request is initiated
Applied to: Receive Bond Number as Search Key
WHEN
The system receives the search parameters
THEN
The bond number must be present and valid as the primary search key
Context: A valid bond number is provided for search
GIVEN
A valid bond number is provided for search
Applied to: Call GCCUSIO2 Database Interface
WHEN
The system needs to access cargo database records
THEN
The GCCUSIO2 database interface program must be invoked with the bond number parameter
Context: The database interface is active and bond number is provided
GIVEN
The database interface is active and bond number is provided
Applied to: Search GCSUSRT US Cargo Root Segments
WHEN
The system searches the GCSUSRT table
THEN
All cargo root segments with matching bond numbers must be identified and retrieved
Context: A search has been performed on the cargo database using bond number
GIVEN
A search has been performed on the cargo database using bond number
Applied to: First Cargo Record Found?
WHEN
The system evaluates the search results
THEN
If no cargo records are found for the bond number, the system must return 'No Records Found' status, otherwise proceed with record retrieval
Context: At least one cargo record exists for the specified bond number
GIVEN
At least one cargo record exists for the specified bond number
Applied to: Retrieve First Cargo Record
WHEN
The system processes the first matching record
THEN
The complete cargo record data must be retrieved and made available for processing
Context: The first cargo record has been successfully retrieved
GIVEN
The first cargo record has been successfully retrieved
Applied to: Set Bond Index Position
WHEN
The system prepares for additional record searches
THEN
The bond index position must be set to enable sequential access to remaining records with the same bond number
Context: The first cargo record has been processed and bond index position is set
GIVEN
The first cargo record has been processed and bond index position is set
Applied to: Search for Subsequent Records
WHEN
The system searches for additional records
THEN
All remaining cargo records with the same bond number must be identified in sequential order
Context: A search for subsequent records has been performed
GIVEN
A search for subsequent records has been performed
Applied to: More Records with Same Bond?
WHEN
The system evaluates if more records exist with the same bond number
THEN
If additional records exist, continue processing the next record, otherwise complete the bond lookup process
Context: Additional cargo records exist with the same bond number
GIVEN
Additional cargo records exist with the same bond number
Applied to: Retrieve Next Cargo Record
WHEN
The system processes the next record in sequence
THEN
The complete cargo record data must be retrieved and prepared for validation
Context: A cargo record has been retrieved from the database
GIVEN
A cargo record has been retrieved from the database
Applied to: Validate Status Code
WHEN
The system examines the record's status code
THEN
The status code must be validated against business rules to determine if the record should be included in processing
Context: A cargo record's status code has been validated
GIVEN
A cargo record's status code has been validated
Applied to: Status Code Valid?
WHEN
The system evaluates the validation results
THEN
If the status code is valid, the record must be considered for inclusion in the cargo processing list, otherwise the record must be excluded and the search must continue
Context: A cargo record has a valid status code
GIVEN
A cargo record has a valid status code
Applied to: Add to Cargo Processing List
WHEN
The system determines the record should be included
THEN
The cargo record must be added to the cargo processing list for further business processing
Context: A cargo record has been processed (either included or excluded)
GIVEN
A cargo record has been processed (either included or excluded)
Applied to: Continue Search Loop
WHEN
The system needs to check for additional records
THEN
The search loop must continue to evaluate remaining cargo records with the same bond number
Context: All cargo records with the specified bond number have been evaluated
GIVEN
All cargo records with the specified bond number have been evaluated
Applied to: Complete Bond Lookup
WHEN
No more records exist with the same bond number
THEN
The bond lookup process must be completed and the system must prepare to return the cargo record set
Context: The bond lookup process has been completed
GIVEN
The bond lookup process has been completed
Applied to: Return Cargo Record Set
WHEN
The system has identified all valid cargo records for the bond number
THEN
The complete set of cargo records must be returned to the calling process for further business operations
Context: An error occurs during the bond lookup process
GIVEN
An error occurs during the bond lookup process
Applied to: Log Bond Lookup Error
WHEN
The system encounters a database access error or invalid search condition
THEN
The error details must be logged and the system must prepare to return a 'No Records Found' status
Context: No cargo records exist for the bond number or an error has occurred
GIVEN
No cargo records exist for the bond number or an error has occurred
Applied to: Return No Records Found
WHEN
The system completes the lookup process
THEN
A 'No Records Found' status must be returned to indicate that no valid cargo records are available for processing
R-GCX016E-cbl-01774 (+15) File: GCX016E.cbl Cargo Database Lookup by Car/Waybill Index Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Database Lookup by Car/Waybill Index':
  • Context - an input message containing car identification information is received:
    For Extract Car ID from Input Message:
    When the system processes the message to extract car id, then the car id is extracted and made available for database search operations.
  • Context - an input message containing waybill number information is received:
    For Extract Waybill Number from Input Message:
    When the system processes the message to extract waybill number, then the waybill number is extracted and prepared for use in database search key construction.
  • Context - a raw car id has been extracted from the input message:
    For Format Car ID for Database Search:
    When the system formats the car id for database compatibility, then the car id is properly formatted and ready for use in database search operations.
  • Context - a formatted car id and extracted waybill number are available:
    For Construct Car/Waybill Search Key:
    When the system constructs the combined search key, then a composite car/waybill search key is created for database query operations.
  • Context - a car/waybill search key has been constructed:
    For Access GCSUSRT Database:
    When the system accesses the gcsusrt database, then database connection is established and ready for cargo record search operations.
  • Context - the gcsusrt database has been accessed with a car/waybill search key:
    For First Record Found?:
    When the system searches for the first matching cargo record, then the system determines whether a matching cargo record exists or not.
  • Context - a matching cargo record has been found in the database:
    For Retrieve First Cargo Record:
    When the system retrieves the first cargo record, then the first matching cargo record is loaded and available for processing.
  • Context - the first cargo record has been successfully retrieved:
    For Set Record Found Flag:
    When the system updates the record found status, then the record found flag is set to indicate successful cargo record retrieval.
  • Context - the first cargo record has been retrieved successfully:
    For Check for Additional Records:
    When the system checks for additional records with the same search key, then the system determines whether more matching cargo records exist.
  • Context - the system is checking for additional cargo records:
    For More Records with Same Key?:
    When the database search continues for more records with the same key, then the system determines if additional matching records are available for retrieval.
  • Context - additional matching cargo records have been identified:
    For Retrieve Next Cargo Record:
    When the system retrieves the next cargo record, then the next matching cargo record is loaded and available for processing.
  • Context - a cargo record has been successfully retrieved from the database:
    For Add to Cargo Record List:
    When the system adds the record to the cargo record collection, then the cargo record is included in the list of records for processing.
  • Context - a cargo record has been added to the collection:
    For Continue Search for Additional Records:
    When the system continues searching for additional records, then the search process loops back to check for more matching cargo records.
  • Context - all matching cargo records have been retrieved and collected:
    For Return All Found Records:
    When no more matching records exist in the database, then the complete collection of found cargo records is returned for business processing.
  • Context - the database search has been completed:
    For Set No Records Found Flag:
    When no cargo records match the car/waybill search criteria, then the no records found flag is set to indicate unsuccessful search results.
  • Context - no cargo records were found matching the search criteria:
    For Generate Not Found Message:
    When the system generates a not found message, then an appropriate message is created indicating that no matching cargo records exist.
👨‍💻 Technical ACs (Gherkin)
Context: An input message containing car identification information is received
GIVEN
An input message containing car identification information is received
Applied to: Extract Car ID from Input Message
WHEN
The system processes the message to extract car ID
THEN
The car ID is extracted and made available for database search operations
Context: An input message containing waybill number information is received
GIVEN
An input message containing waybill number information is received
Applied to: Extract Waybill Number from Input Message
WHEN
The system processes the message to extract waybill number
THEN
The waybill number is extracted and prepared for use in database search key construction
Context: A raw car ID has been extracted from the input message
GIVEN
A raw car ID has been extracted from the input message
Applied to: Format Car ID for Database Search
WHEN
The system formats the car ID for database compatibility
THEN
The car ID is properly formatted and ready for use in database search operations
Context: A formatted car ID and extracted waybill number are available
GIVEN
A formatted car ID and extracted waybill number are available
Applied to: Construct Car/Waybill Search Key
WHEN
The system constructs the combined search key
THEN
A composite car/waybill search key is created for database query operations
Context: A car/waybill search key has been constructed
GIVEN
A car/waybill search key has been constructed
Applied to: Access GCSUSRT Database
WHEN
The system accesses the GCSUSRT database
THEN
Database connection is established and ready for cargo record search operations
Context: The GCSUSRT database has been accessed with a car/waybill search key
GIVEN
The GCSUSRT database has been accessed with a car/waybill search key
Applied to: First Record Found?
WHEN
The system searches for the first matching cargo record
THEN
The system determines whether a matching cargo record exists or not
Context: A matching cargo record has been found in the database
GIVEN
A matching cargo record has been found in the database
Applied to: Retrieve First Cargo Record
WHEN
The system retrieves the first cargo record
THEN
The first matching cargo record is loaded and available for processing
Context: The first cargo record has been successfully retrieved
GIVEN
The first cargo record has been successfully retrieved
Applied to: Set Record Found Flag
WHEN
The system updates the record found status
THEN
The record found flag is set to indicate successful cargo record retrieval
Context: The first cargo record has been retrieved successfully
GIVEN
The first cargo record has been retrieved successfully
Applied to: Check for Additional Records
WHEN
The system checks for additional records with the same search key
THEN
The system determines whether more matching cargo records exist
Context: The system is checking for additional cargo records
GIVEN
The system is checking for additional cargo records
Applied to: More Records with Same Key?
WHEN
The database search continues for more records with the same key
THEN
The system determines if additional matching records are available for retrieval
Context: Additional matching cargo records have been identified
GIVEN
Additional matching cargo records have been identified
Applied to: Retrieve Next Cargo Record
WHEN
The system retrieves the next cargo record
THEN
The next matching cargo record is loaded and available for processing
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Add to Cargo Record List
WHEN
The system adds the record to the cargo record collection
THEN
The cargo record is included in the list of records for processing
Context: A cargo record has been added to the collection
GIVEN
A cargo record has been added to the collection
Applied to: Continue Search for Additional Records
WHEN
The system continues searching for additional records
THEN
The search process loops back to check for more matching cargo records
Context: All matching cargo records have been retrieved and collected
GIVEN
All matching cargo records have been retrieved and collected
Applied to: Return All Found Records
WHEN
No more matching records exist in the database
THEN
The complete collection of found cargo records is returned for business processing
Context: The database search has been completed
GIVEN
The database search has been completed
Applied to: Set No Records Found Flag
WHEN
No cargo records match the car/waybill search criteria
THEN
The no records found flag is set to indicate unsuccessful search results
Context: No cargo records were found matching the search criteria
GIVEN
No cargo records were found matching the search criteria
Applied to: Generate Not Found Message
WHEN
The system generates a not found message
THEN
An appropriate message is created indicating that no matching cargo records exist
R-GCX016E-cbl-01790 (+13) File: GCX016E.cbl CPRS New Cargo Creation Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CPRS New Cargo Creation':
  • Context - a cprs cargo lookup request with car id and waybill information:
    For CPRS Cargo Found in System?:
    When the system searches for existing cprs cargo records using the car id and waybill as search criteria, then the system returns whether the cprs cargo record exists or not in the database.
  • Context - raw car equipment initial and number from n7 segment data:
    For Format Car ID Using Standard Rules:
    When the system processes the car information for cprs cargo creation, then the system formats the car id by combining equipment initial and number according to standard formatting rules.
  • Context - a new cprs cargo record being created:
    For Set CPRS-Specific Flags and Identifiers:
    When the system initializes cprs cargo attributes, then the system sets cprs-specific processing flags and identifiers to enable proper cprs handling.
    For Initialize Cargo Status Arrays:
    When the system initializes cargo status tracking, then the system creates empty status arrays and sets up status segment structures for tracking cprs cargo disposition codes.
  • Context - x4 segment data containing disposition codes, quantities, and entry information:
    For Build Cargo Record from X4 Segment Data:
    When the system builds a new cprs cargo record, then the system populates cargo record fields with disposition code, quantity, entry number, and related x4 segment information.
  • Context - n7 segment data containing equipment initial, number, and related equipment information:
    For Build Cargo Record from N7 Segment Data:
    When the system builds a new cprs cargo record, then the system populates cargo record fields with equipment information, car id, and related n7 segment data.
  • Context - a new cprs cargo record with disposition code and entry information:
    For Set CPRS Bond Information:
    When the system sets bond information for the cprs cargo, then the system assigns bond number and related bond information based on cprs processing rules.
  • Context - a new cprs cargo record and access to carrier information database:
    For Set CPRS Broker Information:
    When the system sets broker information for the cprs cargo, then the system assigns broker code and related broker information from the carrier information database.
  • Context - a new cprs cargo record with basic information populated:
    For Set Default CPRS Processing Flags:
    When the system sets default processing flags, then the system assigns default values for processing flags that control cprs cargo handling and workflow.
  • Context - a complete cprs cargo record ready for database insertion:
    For Insert New CPRS Cargo Record into Database:
    When the system attempts to insert the record into the us cargo root database, then the system successfully adds the new cprs cargo record to the database or returns an insertion failure status.
  • Context - an attempt to insert a new cprs cargo record into the database:
    For Database Insert Successful?:
    When the system checks the database insertion result, then the system determines whether the insertion was successful or failed based on the database response.
  • Context - a successfully created cprs cargo record:
    For Log CPRS Cargo Creation Action:
    When the system logs the creation action, then the system records the cprs cargo creation event with relevant details for audit trail and tracking.
  • Context - a successfully created and logged cprs cargo record:
    For Generate CPRS Creation Notification:
    When the system generates creation notifications, then the system sends notifications to appropriate recipients about the new cprs cargo creation.
  • Context - a failed cprs cargo record insertion or creation error:
    For Handle CPRS Creation Error:
    When the system handles the creation error, then the system processes the error condition and takes appropriate corrective action or error reporting.
👨‍💻 Technical ACs (Gherkin)
Context: A CPRS cargo lookup request with car ID and waybill information
GIVEN
A CPRS cargo lookup request with car ID and waybill information
Applied to: CPRS Cargo Found in System?
WHEN
The system searches for existing CPRS cargo records using the car ID and waybill as search criteria
THEN
The system returns whether the CPRS cargo record exists or not in the database
Context: Raw car equipment initial and number from N7 segment data
GIVEN
Raw car equipment initial and number from N7 segment data
Applied to: Format Car ID Using Standard Rules
WHEN
The system processes the car information for CPRS cargo creation
THEN
The system formats the car ID by combining equipment initial and number according to standard formatting rules
Context: A new CPRS cargo record being created
GIVEN
A new CPRS cargo record being created
Applied to: Set CPRS-Specific Flags and Identifiers
WHEN
The system initializes CPRS cargo attributes
THEN
The system sets CPRS-specific processing flags and identifiers to enable proper CPRS handling
Applied to: Initialize Cargo Status Arrays
WHEN
The system initializes cargo status tracking
THEN
The system creates empty status arrays and sets up status segment structures for tracking CPRS cargo disposition codes
Context: X4 segment data containing disposition codes, quantities, and entry information
GIVEN
X4 segment data containing disposition codes, quantities, and entry information
Applied to: Build Cargo Record from X4 Segment Data
WHEN
The system builds a new CPRS cargo record
THEN
The system populates cargo record fields with disposition code, quantity, entry number, and related X4 segment information
Context: N7 segment data containing equipment initial, number, and related equipment information
GIVEN
N7 segment data containing equipment initial, number, and related equipment information
Applied to: Build Cargo Record from N7 Segment Data
WHEN
The system builds a new CPRS cargo record
THEN
The system populates cargo record fields with equipment information, car ID, and related N7 segment data
Context: A new CPRS cargo record with disposition code and entry information
GIVEN
A new CPRS cargo record with disposition code and entry information
Applied to: Set CPRS Bond Information
WHEN
The system sets bond information for the CPRS cargo
THEN
The system assigns bond number and related bond information based on CPRS processing rules
Context: A new CPRS cargo record and access to carrier information database
GIVEN
A new CPRS cargo record and access to carrier information database
Applied to: Set CPRS Broker Information
WHEN
The system sets broker information for the CPRS cargo
THEN
The system assigns broker code and related broker information from the carrier information database
Context: A new CPRS cargo record with basic information populated
GIVEN
A new CPRS cargo record with basic information populated
Applied to: Set Default CPRS Processing Flags
WHEN
The system sets default processing flags
THEN
The system assigns default values for processing flags that control CPRS cargo handling and workflow
Context: A complete CPRS cargo record ready for database insertion
GIVEN
A complete CPRS cargo record ready for database insertion
Applied to: Insert New CPRS Cargo Record into Database
WHEN
The system attempts to insert the record into the US cargo root database
THEN
The system successfully adds the new CPRS cargo record to the database or returns an insertion failure status
Context: An attempt to insert a new CPRS cargo record into the database
GIVEN
An attempt to insert a new CPRS cargo record into the database
Applied to: Database Insert Successful?
WHEN
The system checks the database insertion result
THEN
The system determines whether the insertion was successful or failed based on the database response
Context: A successfully created CPRS cargo record
GIVEN
A successfully created CPRS cargo record
Applied to: Log CPRS Cargo Creation Action
WHEN
The system logs the creation action
THEN
The system records the CPRS cargo creation event with relevant details for audit trail and tracking
Context: A successfully created and logged CPRS cargo record
GIVEN
A successfully created and logged CPRS cargo record
Applied to: Generate CPRS Creation Notification
WHEN
The system generates creation notifications
THEN
The system sends notifications to appropriate recipients about the new CPRS cargo creation
Context: A failed CPRS cargo record insertion or creation error
GIVEN
A failed CPRS cargo record insertion or creation error
Applied to: Handle CPRS Creation Error
WHEN
The system handles the creation error
THEN
The system processes the error condition and takes appropriate corrective action or error reporting
R-GCX016E-cbl-01804 (+13) File: GCX016E.cbl Foreign Cargo Creation Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Foreign Cargo Creation':
  • Context - a foreign bill of lading number is provided in the x4 segment:
    For Foreign Bill Not Found in System:
    When the system searches the cargo database for the bill of lading, then the system confirms the bill does not exist and proceeds with new cargo creation.
  • Context - a foreign bill requires a new cargo record:
    For Initialize New Cargo Record:
    When the system begins cargo record creation, then a new cargo record structure is initialized with default values and cleared fields.
  • Context - an x4 segment contains cargo disposition information:
    For Set Up Cargo Record with X4 Segment Data:
    When the system processes the x4 segment for new cargo creation, then the cargo record is populated with disposition code, entry number, quantity, and date/time information from the x4 segment.
  • Context - an n7 segment contains equipment information:
    For Set Up Cargo Record with N7 Segment Data:
    When the system processes the n7 segment for new cargo creation, then the cargo record is populated with equipment initial, equipment number, and formatted car id from the n7 segment.
  • Context - m10 segments contain manifest header information:
    For Build Foreign Manifest from M10 Segments:
    When the system processes m10 segments for foreign cargo creation, then the cargo record is populated with vessel name, voyage number, and manifest routing information from the m10 segments.
  • Context - manifest information contains carrier identification:
    For Extract SCAC Information:
    When the system processes carrier information for foreign cargo, then the scac code is extracted and stored in the cargo record for carrier identification.
  • Context - manifest data contains transportation mode information:
    For Extract Transport Type:
    When the system processes transportation details for foreign cargo, then the transport type is identified and recorded in the cargo record.
  • Context - manifest data contains country identification information:
    For Extract Country Code:
    When the system processes location details for foreign cargo, then the country code is extracted and assigned to the cargo record.
  • Context - m10 segments contain vessel identification and voyage information:
    For Extract Vessel Details:
    When the system processes vessel details for foreign cargo, then vessel name, voyage number, and vessel identifiers are extracted and stored in the cargo record.
  • Context - equipment initial and number are available from n7 segment:
    For Format Car ID for Database:
    When the system prepares car identification for database storage, then the car id is formatted into standardized database format combining equipment initial and number.
  • Context - a complete foreign cargo record has been constructed with all required information:
    For Insert New Cargo Record into Database:
    When the system performs database insertion, then the new cargo record is successfully inserted into the cargo database.
  • Context - a cargo record insertion has been attempted:
    For Validate Record Creation:
    When the system checks the insertion result, then the system confirms successful record creation or identifies creation failures.
  • Context - a foreign cargo record has been successfully created:
    For Log Foreign Cargo Creation:
    When the system completes the cargo creation process, then the cargo creation event is logged with relevant details for audit and tracking.
  • Context - all foreign cargo creation steps have been completed:
    For Foreign Cargo Record Created Successfully:
    When the system finalizes the cargo creation process, then the system confirms successful creation of the foreign cargo record and makes it available for further processing.
👨‍💻 Technical ACs (Gherkin)
Context: A foreign bill of lading number is provided in the X4 segment
GIVEN
A foreign bill of lading number is provided in the X4 segment
Applied to: Foreign Bill Not Found in System
WHEN
The system searches the cargo database for the bill of lading
THEN
The system confirms the bill does not exist and proceeds with new cargo creation
Context: A foreign bill requires a new cargo record
GIVEN
A foreign bill requires a new cargo record
Applied to: Initialize New Cargo Record
WHEN
The system begins cargo record creation
THEN
A new cargo record structure is initialized with default values and cleared fields
Context: An X4 segment contains cargo disposition information
GIVEN
An X4 segment contains cargo disposition information
Applied to: Set Up Cargo Record with X4 Segment Data
WHEN
The system processes the X4 segment for new cargo creation
THEN
The cargo record is populated with disposition code, entry number, quantity, and date/time information from the X4 segment
Context: An N7 segment contains equipment information
GIVEN
An N7 segment contains equipment information
Applied to: Set Up Cargo Record with N7 Segment Data
WHEN
The system processes the N7 segment for new cargo creation
THEN
The cargo record is populated with equipment initial, equipment number, and formatted car ID from the N7 segment
Context: M10 segments contain manifest header information
GIVEN
M10 segments contain manifest header information
Applied to: Build Foreign Manifest from M10 Segments
WHEN
The system processes M10 segments for foreign cargo creation
THEN
The cargo record is populated with vessel name, voyage number, and manifest routing information from the M10 segments
Context: Manifest information contains carrier identification
GIVEN
Manifest information contains carrier identification
Applied to: Extract SCAC Information
WHEN
The system processes carrier information for foreign cargo
THEN
The SCAC code is extracted and stored in the cargo record for carrier identification
Context: Manifest data contains transportation mode information
GIVEN
Manifest data contains transportation mode information
Applied to: Extract Transport Type
WHEN
The system processes transportation details for foreign cargo
THEN
The transport type is identified and recorded in the cargo record
Context: Manifest data contains country identification information
GIVEN
Manifest data contains country identification information
Applied to: Extract Country Code
WHEN
The system processes location details for foreign cargo
THEN
The country code is extracted and assigned to the cargo record
Context: M10 segments contain vessel identification and voyage information
GIVEN
M10 segments contain vessel identification and voyage information
Applied to: Extract Vessel Details
WHEN
The system processes vessel details for foreign cargo
THEN
Vessel name, voyage number, and vessel identifiers are extracted and stored in the cargo record
Context: Equipment initial and number are available from N7 segment
GIVEN
Equipment initial and number are available from N7 segment
Applied to: Format Car ID for Database
WHEN
The system prepares car identification for database storage
THEN
The car ID is formatted into standardized database format combining equipment initial and number
Context: A complete foreign cargo record has been constructed with all required information
GIVEN
A complete foreign cargo record has been constructed with all required information
Applied to: Insert New Cargo Record into Database
WHEN
The system performs database insertion
THEN
The new cargo record is successfully inserted into the cargo database
Context: A cargo record insertion has been attempted
GIVEN
A cargo record insertion has been attempted
Applied to: Validate Record Creation
WHEN
The system checks the insertion result
THEN
The system confirms successful record creation or identifies creation failures
Context: A foreign cargo record has been successfully created
GIVEN
A foreign cargo record has been successfully created
Applied to: Log Foreign Cargo Creation
WHEN
The system completes the cargo creation process
THEN
The cargo creation event is logged with relevant details for audit and tracking
Context: All foreign cargo creation steps have been completed
GIVEN
All foreign cargo creation steps have been completed
Applied to: Foreign Cargo Record Created Successfully
WHEN
The system finalizes the cargo creation process
THEN
The system confirms successful creation of the foreign cargo record and makes it available for further processing
R-GCX016E-cbl-01818 (+7) File: GCX016E.cbl Car ID Formatting and Validation Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car ID Formatting and Validation':
  • Context - an n7 segment contains equipment initial and equipment number:
    For Apply Standard Formatting Rules:
    When the system processes the n7 segment for car id formatting, then the equipment initial and number are concatenated and formatted into a standardized car id format.
  • Context - a formatted car id from equipment initial and number:
    For Validate Car ID Length and Characters:
    When the system validates the car id format, then the car id must meet specified length requirements and contain only valid characters.
  • Context - a cargo record with traffic type information:
    For CPRS Traffic?:
    When the system checks if the cargo is cprs traffic, then the system identifies whether cprs-specific formatting rules should be applied.
  • Context - a car id that belongs to cprs traffic type:
    For Apply CPRS Specific Formatting:
    When the system applies cprs-specific formatting rules, then the car id is formatted according to cprs business requirements which may clear or modify the standard car id format.
  • Context - a car id that is not cprs traffic type:
    For Apply Standard Formatting:
    When the system applies standard formatting rules, then the car id is formatted using standard business formatting requirements.
  • Context - a properly formatted and validated car id:
    For Update Car ID in Cargo Record:
    When the system updates the cargo record, then the car id information is stored in the cargo record for future processing and tracking.
  • Context - a car id that fails format validation:
    For Generate Format Error:
    When the system detects invalid car id format, then an appropriate format error is generated to indicate the car id formatting issue.
  • Context - a completed car id formatting process:
    For Log Formatting Action:
    When the system completes car id formatting (successful or with errors), then the formatting action and results are logged for audit trail and troubleshooting purposes.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 segment contains equipment initial and equipment number
GIVEN
An N7 segment contains equipment initial and equipment number
Applied to: Apply Standard Formatting Rules
WHEN
The system processes the N7 segment for car ID formatting
THEN
The equipment initial and number are concatenated and formatted into a standardized car ID format
Context: A formatted car ID from equipment initial and number
GIVEN
A formatted car ID from equipment initial and number
Applied to: Validate Car ID Length and Characters
WHEN
The system validates the car ID format
THEN
The car ID must meet specified length requirements and contain only valid characters
Context: A cargo record with traffic type information
GIVEN
A cargo record with traffic type information
Applied to: CPRS Traffic?
WHEN
The system checks if the cargo is CPRS traffic
THEN
The system identifies whether CPRS-specific formatting rules should be applied
Context: A car ID that belongs to CPRS traffic type
GIVEN
A car ID that belongs to CPRS traffic type
Applied to: Apply CPRS Specific Formatting
WHEN
The system applies CPRS-specific formatting rules
THEN
The car ID is formatted according to CPRS business requirements which may clear or modify the standard car ID format
Context: A car ID that is not CPRS traffic type
GIVEN
A car ID that is not CPRS traffic type
Applied to: Apply Standard Formatting
WHEN
The system applies standard formatting rules
THEN
The car ID is formatted using standard business formatting requirements
Context: A properly formatted and validated car ID
GIVEN
A properly formatted and validated car ID
Applied to: Update Car ID in Cargo Record
WHEN
The system updates the cargo record
THEN
The car ID information is stored in the cargo record for future processing and tracking
Context: A car ID that fails format validation
GIVEN
A car ID that fails format validation
Applied to: Generate Format Error
WHEN
The system detects invalid car ID format
THEN
An appropriate format error is generated to indicate the car ID formatting issue
Context: A completed car ID formatting process
GIVEN
A completed car ID formatting process
Applied to: Log Formatting Action
WHEN
The system completes car ID formatting (successful or with errors)
THEN
The formatting action and results are logged for audit trail and troubleshooting purposes
R-GCX016E-cbl-01826 (+10) File: GCX016E.cbl Bond Information Clearing Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Information Clearing Processing':
  • Context - a cargo is being processed with disposition codes:
    For Cargo Disposition Code Processing:
    When the disposition code is 95, then the system should initiate bond information clearing process.
  • Context - disposition code 95 has been identified for processing:
    For Validate DC95 Authorization:
    When the system validates the authorization for dc95, then the system should verify the disposition code is valid and authorized before proceeding with bond clearing.
  • Context - dc95 authorization has been validated:
    For Clear BOL Type Code:
    When the system processes bond information clearing, then the bol type code field should be cleared or set to blank.
  • Context - bol type code has been cleared:
    For Clear M12 Data:
    When the system continues bond information clearing, then all m12 data fields should be cleared or reset to initial values.
  • Context - m12 data has been cleared:
    For Clear Bond Number Index:
    When the system processes bond number clearing, then the bond number index field should be cleared or set to zero.
  • Context - bond number index has been cleared:
    For Clear Broker QP Information:
    When the system processes broker information clearing, then all broker qp (qualified person) information fields should be cleared.
  • Context - broker qp information has been cleared:
    For Clear Bond Owner Information:
    When the system processes bond owner clearing, then all bond owner information fields should be cleared or reset.
  • Context - all bond information has been cleared:
    For Log Bond Clearing Action:
    When the system completes bond clearing process, then a log entry should be created documenting the bond clearing action with relevant details.
  • Context - bond clearing action has been logged:
    For Update Cargo Status:
    When the system updates cargo status, then the cargo status should be updated to reflect that bond information has been cleared.
  • Context - cargo status has been updated after bond clearing:
    For Generate Cancellation Notification:
    When the system generates notifications, then a cancellation notification should be generated and sent to appropriate recipients regarding the bond clearing.
  • Context - bond clearing operations have been completed or disposition code is not 95:
    For Continue Cargo Processing:
    When the system continues cargo processing, then normal cargo processing workflow should continue with the next processing steps.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo is being processed with disposition codes
GIVEN
A cargo is being processed with disposition codes
Applied to: Cargo Disposition Code Processing
WHEN
The disposition code is 95
THEN
The system should initiate bond information clearing process
Context: Disposition code 95 has been identified for processing
GIVEN
Disposition code 95 has been identified for processing
Applied to: Validate DC95 Authorization
WHEN
The system validates the authorization for DC95
THEN
The system should verify the disposition code is valid and authorized before proceeding with bond clearing
Context: DC95 authorization has been validated
GIVEN
DC95 authorization has been validated
Applied to: Clear BOL Type Code
WHEN
The system processes bond information clearing
THEN
The BOL type code field should be cleared or set to blank
Context: BOL type code has been cleared
GIVEN
BOL type code has been cleared
Applied to: Clear M12 Data
WHEN
The system continues bond information clearing
THEN
All M12 data fields should be cleared or reset to initial values
Context: M12 data has been cleared
GIVEN
M12 data has been cleared
Applied to: Clear Bond Number Index
WHEN
The system processes bond number clearing
THEN
The bond number index field should be cleared or set to zero
Context: Bond number index has been cleared
GIVEN
Bond number index has been cleared
Applied to: Clear Broker QP Information
WHEN
The system processes broker information clearing
THEN
All broker QP (Qualified Person) information fields should be cleared
Context: Broker QP information has been cleared
GIVEN
Broker QP information has been cleared
Applied to: Clear Bond Owner Information
WHEN
The system processes bond owner clearing
THEN
All bond owner information fields should be cleared or reset
Context: All bond information has been cleared
GIVEN
All bond information has been cleared
Applied to: Log Bond Clearing Action
WHEN
The system completes bond clearing process
THEN
A log entry should be created documenting the bond clearing action with relevant details
Context: Bond clearing action has been logged
GIVEN
Bond clearing action has been logged
Applied to: Update Cargo Status
WHEN
The system updates cargo status
THEN
The cargo status should be updated to reflect that bond information has been cleared
Context: Cargo status has been updated after bond clearing
GIVEN
Cargo status has been updated after bond clearing
Applied to: Generate Cancellation Notification
WHEN
The system generates notifications
THEN
A cancellation notification should be generated and sent to appropriate recipients regarding the bond clearing
Context: Bond clearing operations have been completed OR disposition code is not 95
GIVEN
Bond clearing operations have been completed OR disposition code is not 95
Applied to: Continue Cargo Processing
WHEN
The system continues cargo processing
THEN
Normal cargo processing workflow should continue with the next processing steps
R-GCX016E-cbl-01847 (+12) File: GCX016E.cbl Entry Type Code Conversion Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Entry Type Code Conversion Processing':
  • Context - an x4 segment is being processed for cargo disposition:
    For Entry Type Code Present?:
    When the system checks for the presence of an entry type code in the segment, then if entry type code is present, proceed to lookup conversion; if not present, skip entry type processing.
  • Context - an edi entry type code is present in the x4 segment:
    For Lookup Entry Type in Conversion Array:
    When the system searches the entry type conversion arrays for a matching edi code, then return the corresponding internal system entry type value if found in the conversion arrays.
  • Context - entry type code lookup has been performed in conversion arrays:
    For Valid Entry Type Found?:
    When the system evaluates the lookup result, then if valid entry type found, proceed with conversion; if invalid, generate error; if not found, use default value.
  • Context - a valid entry type code has been found in the conversion arrays:
    For Convert EDI Code to Internal System Value:
    When the system performs the conversion from edi format to internal format, then the edi entry type code is converted to the corresponding internal system entry type value.
  • Context - an entry type code has been successfully converted to internal system value:
    For Entry Type = 61, 62, 63, or 69?:
    When the system checks if the entry type is 61, 62, 63, or 69, then if entry type matches any of these values, set master in-bond flag; otherwise continue to border crossing check.
  • Context - the entry type is identified as 61, 62, 63, or 69:
    For Set Master In-Bond Flag:
    When the system processes the in-bond entry type, then set the master in-bond flag to indicate special in-bond processing is required.
  • Context - entry type conversion has been completed:
    For Border Crossing Scenario?:
    When the system evaluates if this is a border crossing scenario, then if border crossing scenario detected, apply special border crossing rules; otherwise update cargo record directly.
  • Context - a border crossing scenario has been detected:
    For Apply Special Border Crossing Rules:
    When the system applies special border crossing processing rules, then execute border crossing specific logic before updating the cargo record.
  • Context - entry type conversion is complete and any special rules have been applied:
    For Update Cargo Record with Converted Entry Type:
    When the system updates the cargo record, then store the converted entry type value in the cargo record.
  • Context - entry type conversion and cargo record update are complete:
    For Log Entry Type Conversion Action:
    When the system performs logging operations, then create a log entry documenting the entry type conversion action.
  • Context - entry type code lookup did not find a valid conversion:
    For Use Default Entry Type Value:
    When the system needs to assign an entry type value, then use the default entry type value and proceed with cargo record update.
  • Context - entry type code is present but invalid or conversion fails:
    For Generate Entry Type Conversion Error:
    When the system encounters an invalid entry type code, then generate an entry type conversion error and continue processing.
  • Context - no entry type code is present in the x4 segment:
    For Skip Entry Type Processing:
    When the system evaluates entry type processing requirements, then skip all entry type conversion processing and continue to next processing step.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed for cargo disposition
GIVEN
An X4 segment is being processed for cargo disposition
Applied to: Entry Type Code Present?
WHEN
The system checks for the presence of an entry type code in the segment
THEN
If entry type code is present, proceed to lookup conversion; if not present, skip entry type processing
Context: An EDI entry type code is present in the X4 segment
GIVEN
An EDI entry type code is present in the X4 segment
Applied to: Lookup Entry Type in Conversion Array
WHEN
The system searches the entry type conversion arrays for a matching EDI code
THEN
Return the corresponding internal system entry type value if found in the conversion arrays
Context: Entry type code lookup has been performed in conversion arrays
GIVEN
Entry type code lookup has been performed in conversion arrays
Applied to: Valid Entry Type Found?
WHEN
The system evaluates the lookup result
THEN
If valid entry type found, proceed with conversion; if invalid, generate error; if not found, use default value
Context: A valid entry type code has been found in the conversion arrays
GIVEN
A valid entry type code has been found in the conversion arrays
Applied to: Convert EDI Code to Internal System Value
WHEN
The system performs the conversion from EDI format to internal format
THEN
The EDI entry type code is converted to the corresponding internal system entry type value
Context: An entry type code has been successfully converted to internal system value
GIVEN
An entry type code has been successfully converted to internal system value
Applied to: Entry Type = 61, 62, 63, or 69?
WHEN
The system checks if the entry type is 61, 62, 63, or 69
THEN
If entry type matches any of these values, set master in-bond flag; otherwise continue to border crossing check
Context: The entry type is identified as 61, 62, 63, or 69
GIVEN
The entry type is identified as 61, 62, 63, or 69
Applied to: Set Master In-Bond Flag
WHEN
The system processes the in-bond entry type
THEN
Set the master in-bond flag to indicate special in-bond processing is required
Context: Entry type conversion has been completed
GIVEN
Entry type conversion has been completed
Applied to: Border Crossing Scenario?
WHEN
The system evaluates if this is a border crossing scenario
THEN
If border crossing scenario detected, apply special border crossing rules; otherwise update cargo record directly
Context: A border crossing scenario has been detected
GIVEN
A border crossing scenario has been detected
Applied to: Apply Special Border Crossing Rules
WHEN
The system applies special border crossing processing rules
THEN
Execute border crossing specific logic before updating the cargo record
Context: Entry type conversion is complete and any special rules have been applied
GIVEN
Entry type conversion is complete and any special rules have been applied
Applied to: Update Cargo Record with Converted Entry Type
WHEN
The system updates the cargo record
THEN
Store the converted entry type value in the cargo record
Context: Entry type conversion and cargo record update are complete
GIVEN
Entry type conversion and cargo record update are complete
Applied to: Log Entry Type Conversion Action
WHEN
The system performs logging operations
THEN
Create a log entry documenting the entry type conversion action
Context: Entry type code lookup did not find a valid conversion
GIVEN
Entry type code lookup did not find a valid conversion
Applied to: Use Default Entry Type Value
WHEN
The system needs to assign an entry type value
THEN
Use the default entry type value and proceed with cargo record update
Context: Entry type code is present but invalid or conversion fails
GIVEN
Entry type code is present but invalid or conversion fails
Applied to: Generate Entry Type Conversion Error
WHEN
The system encounters an invalid entry type code
THEN
Generate an entry type conversion error and continue processing
Context: No entry type code is present in the X4 segment
GIVEN
No entry type code is present in the X4 segment
Applied to: Skip Entry Type Processing
WHEN
The system evaluates entry type processing requirements
THEN
Skip all entry type conversion processing and continue to next processing step
R-GCX016E-cbl-01860 (+7) File: GCX016E.cbl Master In Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Master In':
  • Context - an x4 segment is being processed and contains an entry type code:
    For Set Master In-Bond Flag for Code 61:
    When the entry type code value is 61, then the master in-bond flag is set for entry type code 61 and the cargo record is updated with master in-bond status.
    For Set Master In-Bond Flag for Code 62:
    When the entry type code value is 62, then the master in-bond flag is set for entry type code 62 and the cargo record is updated with master in-bond status.
    For Set Master In-Bond Flag for Code 63:
    When the entry type code value is 63, then the master in-bond flag is set for entry type code 63 and the cargo record is updated with master in-bond status.
    For Set Master In-Bond Flag for Code 69:
    When the entry type code value is 69, then the master in-bond flag is set for entry type code 69 and the cargo record is updated with master in-bond status.
  • Context - an x4 segment is being processed for master in-bond flag setting:
    For Entry Type Code Present?:
    When the system checks for the presence of an entry type code, then if entry type code is present, retrieve and evaluate the code value, otherwise continue with standard entry processing.
  • Context - an x4 segment is being processed:
    For Continue with Standard Entry Processing:
    When the entry type code is not present or the entry type code value is not 61, 62, 63, or 69, then continue with standard entry processing without setting master in-bond flags.
  • Context - a master in-bond flag has been set for entry type codes 61, 62, 63, or 69:
    For Update Cargo Record with Master In-Bond Status:
    When the cargo record needs to be updated with the master in-bond status, then the cargo record is updated to reflect the master in-bond status for the specific entry type code.
  • Context - a master in-bond flag has been set and cargo record has been updated:
    For Log Master In-Bond Flag Setting Action:
    When the master in-bond flag setting action needs to be logged, then the system logs the master in-bond flag setting action for audit trail purposes.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed and contains an entry type code
GIVEN
An X4 segment is being processed and contains an entry type code
Applied to: Set Master In-Bond Flag for Code 61
WHEN
The entry type code value is 61
THEN
The master in-bond flag is set for entry type code 61 and the cargo record is updated with master in-bond status
Applied to: Set Master In-Bond Flag for Code 62
WHEN
The entry type code value is 62
THEN
The master in-bond flag is set for entry type code 62 and the cargo record is updated with master in-bond status
Applied to: Set Master In-Bond Flag for Code 63
WHEN
The entry type code value is 63
THEN
The master in-bond flag is set for entry type code 63 and the cargo record is updated with master in-bond status
Applied to: Set Master In-Bond Flag for Code 69
WHEN
The entry type code value is 69
THEN
The master in-bond flag is set for entry type code 69 and the cargo record is updated with master in-bond status
Context: An X4 segment is being processed for master in-bond flag setting
GIVEN
An X4 segment is being processed for master in-bond flag setting
Applied to: Entry Type Code Present?
WHEN
The system checks for the presence of an entry type code
THEN
If entry type code is present, retrieve and evaluate the code value, otherwise continue with standard entry processing
Context: An X4 segment is being processed
GIVEN
An X4 segment is being processed
Applied to: Continue with Standard Entry Processing
WHEN
The entry type code is not present or the entry type code value is not 61, 62, 63, or 69
THEN
Continue with standard entry processing without setting master in-bond flags
Context: A master in-bond flag has been set for entry type codes 61, 62, 63, or 69
GIVEN
A master in-bond flag has been set for entry type codes 61, 62, 63, or 69
Applied to: Update Cargo Record with Master In-Bond Status
WHEN
The cargo record needs to be updated with the master in-bond status
THEN
The cargo record is updated to reflect the master in-bond status for the specific entry type code
Context: A master in-bond flag has been set and cargo record has been updated
GIVEN
A master in-bond flag has been set and cargo record has been updated
Applied to: Log Master In-Bond Flag Setting Action
WHEN
The master in-bond flag setting action needs to be logged
THEN
The system logs the master in-bond flag setting action for audit trail purposes
R-GCX016E-cbl-01868 (+10) File: GCX016E.cbl Canadian Border Port Name Mapping Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Border Port Name Mapping':
  • Context - a cargo record with location and routing data is being processed:
    For Is Cargo Cross-Border?:
    When the system evaluates cargo characteristics for cross-border requirements, then the cargo is identified as cross-border if it meets the criteria for international movement between us and canadian borders.
  • Context - cross-border cargo with location data containing us port information:
    For Extract US Port Code from Location Data:
    When the system processes the cargo location data, then the us port code is extracted from the location data for further processing.
  • Context - a us port code has been extracted from cargo location data:
    For Access Canadian Border Mapping Table:
    When the system needs to find the corresponding canadian border port name, then the canadian border mapping table is accessed for port code lookup.
  • Context - a us port code and access to the canadian border mapping table:
    For US Port Code Found in Mapping?:
    When the system searches for the us port code in the mapping table, then the system determines if a valid mapping exists for the port code.
  • Context - a us port code that exists in the canadian border mapping table:
    For Retrieve Canadian Border Port Name:
    When the system finds a valid mapping entry, then the corresponding canadian border port name is retrieved from the mapping table.
  • Context - a canadian border port name has been successfully retrieved from the mapping table:
    For Set Canadian Border Location for Cargo:
    When the system processes the mapping result, then the canadian border location is set in the cargo record for cross-border processing.
  • Context - cargo with a set canadian border location:
    For Update Cargo Routing Information:
    When the system updates cargo routing information, then the routing information is updated to include the canadian border location for proper cargo flow.
  • Context - cargo with updated routing information including canadian border location:
    For Log Border Crossing Information:
    When the system completes the border location assignment, then border crossing information is logged for audit trail and cargo tracking purposes.
  • Context - a us port code that does not exist in the canadian border mapping table:
    For Use Default Border Location:
    When the system cannot find a valid mapping for the port code, then a default border location is assigned to ensure cargo processing can continue.
  • Context - a us port code with no mapping found and default border location being used:
    For Generate Warning Message:
    When the system assigns the default border location, then a warning message is generated to alert users about the missing port code mapping.
  • Context - cargo with either mapped canadian border location or default border location assigned:
    For Continue Cargo Processing:
    When border location processing is complete, then the system continues with normal cargo processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with location and routing data is being processed
GIVEN
A cargo record with location and routing data is being processed
Applied to: Is Cargo Cross-Border?
WHEN
The system evaluates cargo characteristics for cross-border requirements
THEN
The cargo is identified as cross-border if it meets the criteria for international movement between US and Canadian borders
Context: Cross-border cargo with location data containing US port information
GIVEN
Cross-border cargo with location data containing US port information
Applied to: Extract US Port Code from Location Data
WHEN
The system processes the cargo location data
THEN
The US port code is extracted from the location data for further processing
Context: A US port code has been extracted from cargo location data
GIVEN
A US port code has been extracted from cargo location data
Applied to: Access Canadian Border Mapping Table
WHEN
The system needs to find the corresponding Canadian border port name
THEN
The Canadian border mapping table is accessed for port code lookup
Context: A US port code and access to the Canadian border mapping table
GIVEN
A US port code and access to the Canadian border mapping table
Applied to: US Port Code Found in Mapping?
WHEN
The system searches for the US port code in the mapping table
THEN
The system determines if a valid mapping exists for the port code
Context: A US port code that exists in the Canadian border mapping table
GIVEN
A US port code that exists in the Canadian border mapping table
Applied to: Retrieve Canadian Border Port Name
WHEN
The system finds a valid mapping entry
THEN
The corresponding Canadian border port name is retrieved from the mapping table
Context: A Canadian border port name has been successfully retrieved from the mapping table
GIVEN
A Canadian border port name has been successfully retrieved from the mapping table
Applied to: Set Canadian Border Location for Cargo
WHEN
The system processes the mapping result
THEN
The Canadian border location is set in the cargo record for cross-border processing
Context: Cargo with a set Canadian border location
GIVEN
Cargo with a set Canadian border location
Applied to: Update Cargo Routing Information
WHEN
The system updates cargo routing information
THEN
The routing information is updated to include the Canadian border location for proper cargo flow
Context: Cargo with updated routing information including Canadian border location
GIVEN
Cargo with updated routing information including Canadian border location
Applied to: Log Border Crossing Information
WHEN
The system completes the border location assignment
THEN
Border crossing information is logged for audit trail and cargo tracking purposes
Context: A US port code that does not exist in the Canadian border mapping table
GIVEN
A US port code that does not exist in the Canadian border mapping table
Applied to: Use Default Border Location
WHEN
The system cannot find a valid mapping for the port code
THEN
A default border location is assigned to ensure cargo processing can continue
Context: A US port code with no mapping found and default border location being used
GIVEN
A US port code with no mapping found and default border location being used
Applied to: Generate Warning Message
WHEN
The system assigns the default border location
THEN
A warning message is generated to alert users about the missing port code mapping
Context: Cargo with either mapped Canadian border location or default border location assigned
GIVEN
Cargo with either mapped Canadian border location or default border location assigned
Applied to: Continue Cargo Processing
WHEN
Border location processing is complete
THEN
The system continues with normal cargo processing workflow
R-GCX016E-cbl-01879 (+7) File: GCX016E.cbl FDA Reference Number Formatting Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FDA Reference Number Formatting':
  • Context - an n9 reference segment is received with a1 disposition code:
    For A1 Disposition Code Processing:
    When the system processes the fda reference number formatting, then the fda reference number should be prefixed with 'fda pn' and properly formatted.
  • Context - an n9 reference segment is received with a3 disposition code:
    For A3 Disposition Code Processing:
    When the system processes the fda reference number formatting, then the fda reference number should be prefixed with 'fda' and properly formatted.
  • Context - an n9 reference segment with disposition code is being processed:
    For Disposition Code Type?:
    When the system evaluates the disposition code type, then the system should route to a1 processing if a1 code or a3 processing if a3 code.
  • Context - an n9 segment is being processed for fda reference formatting:
    For Existing FDA Data Found?:
    When existing fda data is found in the segment, then the original fda information should be preserved and not overwritten.
  • Context - an n9 segment is being processed and no existing fda data is found:
    For Create New FDA Reference Entry:
    When the system creates a new fda reference entry, then a new fda reference entry should be created with appropriate prefix formatting.
  • Context - an n9 segment contains existing data that needs fda prefix formatting:
    For Reposition Existing N9 Data:
    When the system repositions the existing n9 data, then the existing data should be moved to appropriate positions to make room for fda prefix.
  • Context - an fda reference number has been formatted with appropriate prefix:
    For Validate FDA Reference Number Format:
    When the system validates the fda reference number format, then the fda reference number format should be verified as compliant with regulatory standards.
  • Context - fda reference data has been formatted and validated:
    For Update N9 Segment with Formatted Data:
    When the system updates the n9 segment with formatted data, then the n9 segment should contain the properly formatted fda reference information.
👨‍💻 Technical ACs (Gherkin)
Context: An N9 reference segment is received with A1 disposition code
GIVEN
An N9 reference segment is received with A1 disposition code
Applied to: A1 Disposition Code Processing
WHEN
The system processes the FDA reference number formatting
THEN
The FDA reference number should be prefixed with 'FDA PN' and properly formatted
Context: An N9 reference segment is received with A3 disposition code
GIVEN
An N9 reference segment is received with A3 disposition code
Applied to: A3 Disposition Code Processing
WHEN
The system processes the FDA reference number formatting
THEN
The FDA reference number should be prefixed with 'FDA' and properly formatted
Context: An N9 reference segment with disposition code is being processed
GIVEN
An N9 reference segment with disposition code is being processed
Applied to: Disposition Code Type?
WHEN
The system evaluates the disposition code type
THEN
The system should route to A1 processing if A1 code or A3 processing if A3 code
Context: An N9 segment is being processed for FDA reference formatting
GIVEN
An N9 segment is being processed for FDA reference formatting
Applied to: Existing FDA Data Found?
WHEN
Existing FDA data is found in the segment
THEN
The original FDA information should be preserved and not overwritten
Context: An N9 segment is being processed and no existing FDA data is found
GIVEN
An N9 segment is being processed and no existing FDA data is found
Applied to: Create New FDA Reference Entry
WHEN
The system creates a new FDA reference entry
THEN
A new FDA reference entry should be created with appropriate prefix formatting
Context: An N9 segment contains existing data that needs FDA prefix formatting
GIVEN
An N9 segment contains existing data that needs FDA prefix formatting
Applied to: Reposition Existing N9 Data
WHEN
The system repositions the existing N9 data
THEN
The existing data should be moved to appropriate positions to make room for FDA prefix
Context: An FDA reference number has been formatted with appropriate prefix
GIVEN
An FDA reference number has been formatted with appropriate prefix
Applied to: Validate FDA Reference Number Format
WHEN
The system validates the FDA reference number format
THEN
The FDA reference number format should be verified as compliant with regulatory standards
Context: FDA reference data has been formatted and validated
GIVEN
FDA reference data has been formatted and validated
Applied to: Update N9 Segment with Formatted Data
WHEN
The system updates the N9 segment with formatted data
THEN
The N9 segment should contain the properly formatted FDA reference information
R-GCX016E-cbl-01887 (+9) File: GCX016E.cbl N9 Reference Segment Management Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N9 Reference Segment Management':
  • Context - a disposition code is being processed for n9 reference segment management:
    For FDA Disposition Code?:
    When the system evaluates the disposition code type, then the system routes to a1 code processing if disposition code is a1, routes to a3 code processing if disposition code is a3, or exits processing for any other disposition code.
  • Context - an a1 disposition code is being processed:
    For Format FDA PN Prefix for A1:
    When the system formats the fda reference prefix, then the system creates a pn prefix format for the fda reference number.
  • Context - an a3 disposition code is being processed:
    For Format FDA Prefix for A3:
    When the system formats the fda reference prefix, then the system creates a standard fda prefix format for the reference number.
  • Context - the system has retrieved existing n9 reference data from the database:
    For N9 Segment Exists?:
    When the system checks for n9 segment existence, then the system creates a new n9 segment if none exists, or updates the existing n9 segment if one is found.
  • Context - an fda reference number has been formatted with the appropriate prefix:
    For Reference Number Valid?:
    When the system validates the reference number format, then the system proceeds with fda reference information setting if the format is valid, or completes processing without updates if the format is invalid.
  • Context - no existing n9 segment is found in the database:
    For Create New N9 Segment:
    When the system processes the fda reference information, then the system creates a new n9 segment with the formatted fda reference data.
  • Context - an existing n9 segment is found in the database:
    For Update Existing N9 Segment:
    When the system processes new fda reference information, then the system updates the existing n9 segment with the new reference data.
  • Context - the fda reference number format has been validated as correct:
    For Set FDA Reference Information:
    When the system processes the reference information, then the system sets the fda reference information in the n9 segment for database replacement.
  • Context - the fda reference information has been set in the n9 segment:
    For Replace N9 Segment in Database:
    When the system performs database operations, then the system replaces the n9 segment in the database with the updated reference information.
  • Context - the n9 segment has been successfully replaced in the database:
    For Log N9 Reference Update:
    When the system completes the reference update process, then the system logs the n9 reference update activity for audit trail maintenance.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for N9 reference segment management
GIVEN
A disposition code is being processed for N9 reference segment management
Applied to: FDA Disposition Code?
WHEN
The system evaluates the disposition code type
THEN
The system routes to A1 code processing if disposition code is A1, routes to A3 code processing if disposition code is A3, or exits processing for any other disposition code
Context: An A1 disposition code is being processed
GIVEN
An A1 disposition code is being processed
Applied to: Format FDA PN Prefix for A1
WHEN
The system formats the FDA reference prefix
THEN
The system creates a PN prefix format for the FDA reference number
Context: An A3 disposition code is being processed
GIVEN
An A3 disposition code is being processed
Applied to: Format FDA Prefix for A3
WHEN
The system formats the FDA reference prefix
THEN
The system creates a standard FDA prefix format for the reference number
Context: The system has retrieved existing N9 reference data from the database
GIVEN
The system has retrieved existing N9 reference data from the database
Applied to: N9 Segment Exists?
WHEN
The system checks for N9 segment existence
THEN
The system creates a new N9 segment if none exists, or updates the existing N9 segment if one is found
Context: An FDA reference number has been formatted with the appropriate prefix
GIVEN
An FDA reference number has been formatted with the appropriate prefix
Applied to: Reference Number Valid?
WHEN
The system validates the reference number format
THEN
The system proceeds with FDA reference information setting if the format is valid, or completes processing without updates if the format is invalid
Context: No existing N9 segment is found in the database
GIVEN
No existing N9 segment is found in the database
Applied to: Create New N9 Segment
WHEN
The system processes the FDA reference information
THEN
The system creates a new N9 segment with the formatted FDA reference data
Context: An existing N9 segment is found in the database
GIVEN
An existing N9 segment is found in the database
Applied to: Update Existing N9 Segment
WHEN
The system processes new FDA reference information
THEN
The system updates the existing N9 segment with the new reference data
Context: The FDA reference number format has been validated as correct
GIVEN
The FDA reference number format has been validated as correct
Applied to: Set FDA Reference Information
WHEN
The system processes the reference information
THEN
The system sets the FDA reference information in the N9 segment for database replacement
Context: The FDA reference information has been set in the N9 segment
GIVEN
The FDA reference information has been set in the N9 segment
Applied to: Replace N9 Segment in Database
WHEN
The system performs database operations
THEN
The system replaces the N9 segment in the database with the updated reference information
Context: The N9 segment has been successfully replaced in the database
GIVEN
The N9 segment has been successfully replaced in the database
Applied to: Log N9 Reference Update
WHEN
The system completes the reference update process
THEN
The system logs the N9 reference update activity for audit trail maintenance
R-GCX016E-cbl-01897 (+17) File: GCX016E.cbl Cargo Database Retrieval by Bond Index Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Database Retrieval by Bond Index':
  • Context - a cargo retrieval request is initiated:
    For Receive Bond Number as Input:
    When the system receives the bond number parameter, then the bond number must be present and not empty to proceed with cargo search.
  • Context - a valid bond number is received:
    For Initialize Bond Search Parameters:
    When the system prepares to search for cargo records, then search parameters including bond index key and search criteria must be initialized with proper values.
  • Context - bond search parameters are properly initialized:
    For Call GCCUSIO2 with Bond Index:
    When the system needs to retrieve cargo records for a specific bond, then gccusio2 module must be called with bond index parameters to access the cargo database.
  • Context - a database search has been performed using bond index:
    For Cargo Record Found?:
    When the system evaluates the search results, then if no cargo records are found for the bond number, return 'no records found' status, otherwise proceed to retrieve the first record.
  • Context - at least one cargo record exists for the bond number:
    For Retrieve First Cargo Record:
    When the system begins cargo record processing, then the first cargo record associated with the bond must be retrieved and made available for processing.
  • Context - a cargo record has been retrieved from the database:
    For Check Status Code:
    When the system examines the record's status code, then the status code must be valid and indicate an active, processable record state.
  • Context - a cargo record has been retrieved and status code checked:
    For Status Code Valid?:
    When the status code is invalid or indicates an inactive record, then return 'invalid status' error and do not process the record further.
  • Context - a cargo record with valid status code has been retrieved:
    For Load Cargo Data into Working Storage:
    When the system needs to process the cargo data, then all relevant cargo information must be loaded into working storage areas for subsequent processing operations.
  • Context - the first cargo record for a bond has been processed:
    For Check for Additional Records:
    When the system checks for additional records, then the system must determine if more cargo records exist for the same bond number.
  • Context - the system has checked for additional bond records:
    For More Records with Same Bond?:
    When multiple records exist for the same bond number, then continue to retrieve and process the next record, otherwise complete the bond index retrieval process.
  • Context - additional cargo records exist for the current bond number:
    For Retrieve Next Cargo Record:
    When the system continues processing multiple bond records, then the next cargo record in the sequence must be retrieved from the database.
  • Context - an additional cargo record has been retrieved for the bond:
    For Validate Record Status:
    When the system validates the record before processing, then the record status must be checked to ensure it represents an active, processable cargo.
  • Context - a cargo record status has been validated:
    For Record Status Active?:
    When the system evaluates whether the record is active, then if the record status is active, add it to the cargo processing list, otherwise skip to the next record.
  • Context - a cargo record has been validated as active:
    For Add to Cargo Processing List:
    When the record needs to be included in processing, then the cargo record must be added to the cargo processing list for further business rule application.
  • Context - a cargo record has been determined to be inactive:
    For Continue to Next Record:
    When the system processes multiple records for a bond, then skip the inactive record and continue processing the next record in the sequence.
  • Context - all cargo records for a bond number have been processed:
    For Complete Bond Index Retrieval:
    When no more records exist for the current bond, then complete the bond index retrieval operation and return the processed cargo list.
  • Context - a bond number search has been performed:
    For Return No Records Found:
    When no cargo records are found for the specified bond, then return 'no records found' status to indicate that no cargo exists for the bond number.
  • Context - cargo records have been retrieved for a bond number:
    For Return Error - Invalid Status:
    When the records contain invalid or unprocessable status codes, then return 'invalid status' error to indicate that the cargo records cannot be processed due to status issues.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo retrieval request is initiated
GIVEN
A cargo retrieval request is initiated
Applied to: Receive Bond Number as Input
WHEN
The system receives the bond number parameter
THEN
The bond number must be present and not empty to proceed with cargo search
Context: A valid bond number is received
GIVEN
A valid bond number is received
Applied to: Initialize Bond Search Parameters
WHEN
The system prepares to search for cargo records
THEN
Search parameters including bond index key and search criteria must be initialized with proper values
Context: Bond search parameters are properly initialized
GIVEN
Bond search parameters are properly initialized
Applied to: Call GCCUSIO2 with Bond Index
WHEN
The system needs to retrieve cargo records for a specific bond
THEN
GCCUSIO2 module must be called with bond index parameters to access the cargo database
Context: A database search has been performed using bond index
GIVEN
A database search has been performed using bond index
Applied to: Cargo Record Found?
WHEN
The system evaluates the search results
THEN
If no cargo records are found for the bond number, return 'No Records Found' status, otherwise proceed to retrieve the first record
Context: At least one cargo record exists for the bond number
GIVEN
At least one cargo record exists for the bond number
Applied to: Retrieve First Cargo Record
WHEN
The system begins cargo record processing
THEN
The first cargo record associated with the bond must be retrieved and made available for processing
Context: A cargo record has been retrieved from the database
GIVEN
A cargo record has been retrieved from the database
Applied to: Check Status Code
WHEN
The system examines the record's status code
THEN
The status code must be valid and indicate an active, processable record state
Context: A cargo record has been retrieved and status code checked
GIVEN
A cargo record has been retrieved and status code checked
Applied to: Status Code Valid?
WHEN
The status code is invalid or indicates an inactive record
THEN
Return 'Invalid Status' error and do not process the record further
Context: A cargo record with valid status code has been retrieved
GIVEN
A cargo record with valid status code has been retrieved
Applied to: Load Cargo Data into Working Storage
WHEN
The system needs to process the cargo data
THEN
All relevant cargo information must be loaded into working storage areas for subsequent processing operations
Context: The first cargo record for a bond has been processed
GIVEN
The first cargo record for a bond has been processed
Applied to: Check for Additional Records
WHEN
The system checks for additional records
THEN
The system must determine if more cargo records exist for the same bond number
Context: The system has checked for additional bond records
GIVEN
The system has checked for additional bond records
Applied to: More Records with Same Bond?
WHEN
Multiple records exist for the same bond number
THEN
Continue to retrieve and process the next record, otherwise complete the bond index retrieval process
Context: Additional cargo records exist for the current bond number
GIVEN
Additional cargo records exist for the current bond number
Applied to: Retrieve Next Cargo Record
WHEN
The system continues processing multiple bond records
THEN
The next cargo record in the sequence must be retrieved from the database
Context: An additional cargo record has been retrieved for the bond
GIVEN
An additional cargo record has been retrieved for the bond
Applied to: Validate Record Status
WHEN
The system validates the record before processing
THEN
The record status must be checked to ensure it represents an active, processable cargo
Context: A cargo record status has been validated
GIVEN
A cargo record status has been validated
Applied to: Record Status Active?
WHEN
The system evaluates whether the record is active
THEN
If the record status is active, add it to the cargo processing list, otherwise skip to the next record
Context: A cargo record has been validated as active
GIVEN
A cargo record has been validated as active
Applied to: Add to Cargo Processing List
WHEN
The record needs to be included in processing
THEN
The cargo record must be added to the cargo processing list for further business rule application
Context: A cargo record has been determined to be inactive
GIVEN
A cargo record has been determined to be inactive
Applied to: Continue to Next Record
WHEN
The system processes multiple records for a bond
THEN
Skip the inactive record and continue processing the next record in the sequence
Context: All cargo records for a bond number have been processed
GIVEN
All cargo records for a bond number have been processed
Applied to: Complete Bond Index Retrieval
WHEN
No more records exist for the current bond
THEN
Complete the bond index retrieval operation and return the processed cargo list
Context: A bond number search has been performed
GIVEN
A bond number search has been performed
Applied to: Return No Records Found
WHEN
No cargo records are found for the specified bond
THEN
Return 'No Records Found' status to indicate that no cargo exists for the bond number
Context: Cargo records have been retrieved for a bond number
GIVEN
Cargo records have been retrieved for a bond number
Applied to: Return Error - Invalid Status
WHEN
The records contain invalid or unprocessable status codes
THEN
Return 'Invalid Status' error to indicate that the cargo records cannot be processed due to status issues
R-GCX016E-cbl-01915 (+12) File: GCX016E.cbl Cargo Database Retrieval by Car/Waybill Index Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Database Retrieval by Car/Waybill Index':
  • Context - a cargo record contains equipment initial and equipment number from n7 segment:
    For Format Car ID for Search:
    When the system needs to create a car id for database search, then the system concatenates equipment initial and equipment number to form the car id search key.
  • Context - a formatted car id and a waybill number are available:
    For Combine Car ID and Waybill as Search Key:
    When the system prepares to search for cargo records, then the system combines car id and waybill into a single composite search key.
  • Context - a composite search key containing car id and waybill is prepared:
    For Call GCCUSIO2 Database Lookup:
    When the system needs to retrieve cargo records from the database, then the system calls gccusio2 service with the search key to perform the database lookup.
  • Context - a database lookup has been performed using car id and waybill search key:
    For Cargo Record Found?:
    When the system evaluates the lookup results, then the system determines if at least one matching cargo record was found and proceeds accordingly.
  • Context - database lookup has returned one or more matching cargo records:
    For Retrieve First Cargo Record:
    When the system begins processing the found records, then the system retrieves and loads the first cargo record from the result set.
  • Context - the first cargo record has been retrieved successfully:
    For Check for Additional Records:
    When the system evaluates the complete result set, then the system checks if more records exist with the same car id and waybill combination.
  • Context - at least one cargo record has been processed:
    For More Records with Same Car/Waybill?:
    When the system checks for additional matching records, then the system determines if more records with identical car id and waybill exist and routes processing accordingly.
  • Context - additional cargo records exist with the same car id and waybill:
    For Retrieve Subsequent Records:
    When the system continues processing the record set, then the system retrieves the next cargo record in the sequence.
  • Context - a cargo record has been retrieved from the database:
    For Validate Record Status:
    When the system evaluates the record for processing eligibility, then the system validates the record status to ensure it meets processing criteria.
  • Context - a cargo record has undergone status validation:
    For Record Valid?:
    When the system evaluates the validation results, then the system decides whether the record is valid for processing or should be skipped.
  • Context - a cargo record has passed validation checks:
    For Add to Processing List:
    When the system processes valid records, then the system adds the valid cargo record to the processing list for further operations.
  • Context - a cargo record has failed validation checks:
    For Skip Invalid Record:
    When the system processes invalid records, then the system skips the invalid cargo record and continues with the next record.
  • Context - all available cargo records with matching car id and waybill have been evaluated:
    For Complete Record Set Retrieved:
    When no more records remain to be processed, then the system confirms that the complete record set has been retrieved and processed.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record contains equipment initial and equipment number from N7 segment
GIVEN
A cargo record contains equipment initial and equipment number from N7 segment
Applied to: Format Car ID for Search
WHEN
The system needs to create a car ID for database search
THEN
The system concatenates equipment initial and equipment number to form the car ID search key
Context: A formatted car ID and a waybill number are available
GIVEN
A formatted car ID and a waybill number are available
Applied to: Combine Car ID and Waybill as Search Key
WHEN
The system prepares to search for cargo records
THEN
The system combines car ID and waybill into a single composite search key
Context: A composite search key containing car ID and waybill is prepared
GIVEN
A composite search key containing car ID and waybill is prepared
Applied to: Call GCCUSIO2 Database Lookup
WHEN
The system needs to retrieve cargo records from the database
THEN
The system calls GCCUSIO2 service with the search key to perform the database lookup
Context: A database lookup has been performed using car ID and waybill search key
GIVEN
A database lookup has been performed using car ID and waybill search key
Applied to: Cargo Record Found?
WHEN
The system evaluates the lookup results
THEN
The system determines if at least one matching cargo record was found and proceeds accordingly
Context: Database lookup has returned one or more matching cargo records
GIVEN
Database lookup has returned one or more matching cargo records
Applied to: Retrieve First Cargo Record
WHEN
The system begins processing the found records
THEN
The system retrieves and loads the first cargo record from the result set
Context: The first cargo record has been retrieved successfully
GIVEN
The first cargo record has been retrieved successfully
Applied to: Check for Additional Records
WHEN
The system evaluates the complete result set
THEN
The system checks if more records exist with the same car ID and waybill combination
Context: At least one cargo record has been processed
GIVEN
At least one cargo record has been processed
Applied to: More Records with Same Car/Waybill?
WHEN
The system checks for additional matching records
THEN
The system determines if more records with identical car ID and waybill exist and routes processing accordingly
Context: Additional cargo records exist with the same car ID and waybill
GIVEN
Additional cargo records exist with the same car ID and waybill
Applied to: Retrieve Subsequent Records
WHEN
The system continues processing the record set
THEN
The system retrieves the next cargo record in the sequence
Context: A cargo record has been retrieved from the database
GIVEN
A cargo record has been retrieved from the database
Applied to: Validate Record Status
WHEN
The system evaluates the record for processing eligibility
THEN
The system validates the record status to ensure it meets processing criteria
Context: A cargo record has undergone status validation
GIVEN
A cargo record has undergone status validation
Applied to: Record Valid?
WHEN
The system evaluates the validation results
THEN
The system decides whether the record is valid for processing or should be skipped
Context: A cargo record has passed validation checks
GIVEN
A cargo record has passed validation checks
Applied to: Add to Processing List
WHEN
The system processes valid records
THEN
The system adds the valid cargo record to the processing list for further operations
Context: A cargo record has failed validation checks
GIVEN
A cargo record has failed validation checks
Applied to: Skip Invalid Record
WHEN
The system processes invalid records
THEN
The system skips the invalid cargo record and continues with the next record
Context: All available cargo records with matching car ID and waybill have been evaluated
GIVEN
All available cargo records with matching car ID and waybill have been evaluated
Applied to: Complete Record Set Retrieved
WHEN
No more records remain to be processed
THEN
The system confirms that the complete record set has been retrieved and processed
R-GCX016E-cbl-01928 (+15) File: GCX016E.cbl CPRS Cargo Creation for Missing Records Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CPRS Cargo Creation for Missing Records':
  • Context - a cargo record is not found in the system and cprs cargo creation is requested:
    For Validate CPRS Traffic Type:
    When the system checks the traffic type indicators and cprs-specific identifiers, then the system should validate that this is legitimate cprs traffic and proceed with creation, or reject invalid traffic types.
  • Context - cprs traffic type has been validated and car id information is available from n7 segment:
    For Check Car ID Format:
    When the system processes the car initial and car number from the equipment data, then the system should validate the car id format meets cprs standards and format it appropriately.
  • Context - car id format has been validated for cprs standards:
    For Initialize New Cargo Record:
    When the system begins creating a new cargo record, then the system should initialize all cargo record fields to appropriate default values for new cprs cargo.
  • Context - a new cargo record has been initialized for cprs traffic:
    For Set CPRS-Specific Fields:
    When the system assigns cprs-specific field values, then the system should set cargo type indicators, processing flags, and other cprs-specific attributes.
  • Context - cprs-specific fields have been set in the new cargo record and x4 segment data is available:
    For Copy X4 Segment Data:
    When the system copies x4 segment information to the cargo record, then the system should transfer disposition code, entry number, quantity, and date/time information from x4 segment to cargo record.
  • Context - x4 segment data has been copied to the cargo record and n7 equipment data is available:
    For Copy N7 Equipment Data:
    When the system copies n7 equipment information to the cargo record, then the system should transfer car initial, car number, and other equipment details from n7 segment to cargo record.
  • Context - x4 and n7 segment data has been copied to the cargo record:
    For Set Default Values for Missing Fields:
    When the system identifies fields that do not have values from the source segments, then the system should assign appropriate default values for missing mandatory fields and leave optional fields blank.
  • Context - default values have been set for missing fields and raw car id components are available:
    For Format Car ID for CPRS Standards:
    When the system formats the car id for cprs processing, then the system should combine car initial and car number according to cprs formatting rules and standards.
  • Context - car id has been formatted according to cprs standards:
    For Assign US-CCN Key:
    When the system assigns a us-ccn key to the cargo record, then the system should generate or assign a unique us cargo control number that serves as the primary key for the cargo record.
  • Context - us-ccn key has been assigned to the cargo record:
    For Set Cargo Status to New:
    When the system sets the initial cargo status, then the system should set the cargo status to 'new' to indicate this is a newly created cargo record awaiting processing.
  • Context - a new cargo record has been prepared with status set to 'new':
    For Database Insert Successful?:
    When the system attempts to insert the cargo record into the database, then the system should verify the database insert operation completed successfully and handle any insertion failures.
  • Context - the database insert operation was successful:
    For Log CPRS Cargo Creation:
    When the system logs the cargo creation event, then the system should create an audit log entry documenting the creation of the new cprs cargo record with relevant details.
  • Context - cprs cargo creation has been logged successfully:
    For Update Cargo Processing Counters:
    When the system updates processing counters, then the system should increment counters for new cargo records created and total cargos processed.
  • Context - cargo processing counters have been updated after successful cprs cargo creation:
    For Continue with Disposition Processing:
    When the system continues with cargo processing, then the system should proceed with disposition code processing for the newly created cprs cargo record.
  • Context - cprs traffic validation failed or database insert operation failed:
    For Generate Error Message:
    When the system encounters an error during cprs cargo creation, then the system should generate an appropriate error message describing the failure reason and route it to the appropriate destination.
  • Context - an error message has been generated due to cprs cargo creation failure:
    For Skip Cargo Processing:
    When the system determines next processing steps, then the system should skip all further processing for this cargo and continue with the next cargo or segment.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is not found in the system and CPRS cargo creation is requested
GIVEN
A cargo record is not found in the system and CPRS cargo creation is requested
Applied to: Validate CPRS Traffic Type
WHEN
The system checks the traffic type indicators and CPRS-specific identifiers
THEN
The system should validate that this is legitimate CPRS traffic and proceed with creation, or reject invalid traffic types
Context: CPRS traffic type has been validated and car ID information is available from N7 segment
GIVEN
CPRS traffic type has been validated and car ID information is available from N7 segment
Applied to: Check Car ID Format
WHEN
The system processes the car initial and car number from the equipment data
THEN
The system should validate the car ID format meets CPRS standards and format it appropriately
Context: Car ID format has been validated for CPRS standards
GIVEN
Car ID format has been validated for CPRS standards
Applied to: Initialize New Cargo Record
WHEN
The system begins creating a new cargo record
THEN
The system should initialize all cargo record fields to appropriate default values for new CPRS cargo
Context: A new cargo record has been initialized for CPRS traffic
GIVEN
A new cargo record has been initialized for CPRS traffic
Applied to: Set CPRS-Specific Fields
WHEN
The system assigns CPRS-specific field values
THEN
The system should set cargo type indicators, processing flags, and other CPRS-specific attributes
Context: CPRS-specific fields have been set in the new cargo record and X4 segment data is available
GIVEN
CPRS-specific fields have been set in the new cargo record and X4 segment data is available
Applied to: Copy X4 Segment Data
WHEN
The system copies X4 segment information to the cargo record
THEN
The system should transfer disposition code, entry number, quantity, and date/time information from X4 segment to cargo record
Context: X4 segment data has been copied to the cargo record and N7 equipment data is available
GIVEN
X4 segment data has been copied to the cargo record and N7 equipment data is available
Applied to: Copy N7 Equipment Data
WHEN
The system copies N7 equipment information to the cargo record
THEN
The system should transfer car initial, car number, and other equipment details from N7 segment to cargo record
Context: X4 and N7 segment data has been copied to the cargo record
GIVEN
X4 and N7 segment data has been copied to the cargo record
Applied to: Set Default Values for Missing Fields
WHEN
The system identifies fields that do not have values from the source segments
THEN
The system should assign appropriate default values for missing mandatory fields and leave optional fields blank
Context: Default values have been set for missing fields and raw car ID components are available
GIVEN
Default values have been set for missing fields and raw car ID components are available
Applied to: Format Car ID for CPRS Standards
WHEN
The system formats the car ID for CPRS processing
THEN
The system should combine car initial and car number according to CPRS formatting rules and standards
Context: Car ID has been formatted according to CPRS standards
GIVEN
Car ID has been formatted according to CPRS standards
Applied to: Assign US-CCN Key
WHEN
The system assigns a US-CCN key to the cargo record
THEN
The system should generate or assign a unique US Cargo Control Number that serves as the primary key for the cargo record
Context: US-CCN key has been assigned to the cargo record
GIVEN
US-CCN key has been assigned to the cargo record
Applied to: Set Cargo Status to New
WHEN
The system sets the initial cargo status
THEN
The system should set the cargo status to 'New' to indicate this is a newly created cargo record awaiting processing
Context: A new cargo record has been prepared with status set to 'New'
GIVEN
A new cargo record has been prepared with status set to 'New'
Applied to: Database Insert Successful?
WHEN
The system attempts to insert the cargo record into the database
THEN
The system should verify the database insert operation completed successfully and handle any insertion failures
Context: The database insert operation was successful
GIVEN
The database insert operation was successful
Applied to: Log CPRS Cargo Creation
WHEN
The system logs the cargo creation event
THEN
The system should create an audit log entry documenting the creation of the new CPRS cargo record with relevant details
Context: CPRS cargo creation has been logged successfully
GIVEN
CPRS cargo creation has been logged successfully
Applied to: Update Cargo Processing Counters
WHEN
The system updates processing counters
THEN
The system should increment counters for new cargo records created and total cargos processed
Context: Cargo processing counters have been updated after successful CPRS cargo creation
GIVEN
Cargo processing counters have been updated after successful CPRS cargo creation
Applied to: Continue with Disposition Processing
WHEN
The system continues with cargo processing
THEN
The system should proceed with disposition code processing for the newly created CPRS cargo record
Context: CPRS traffic validation failed or database insert operation failed
GIVEN
CPRS traffic validation failed or database insert operation failed
Applied to: Generate Error Message
WHEN
The system encounters an error during CPRS cargo creation
THEN
The system should generate an appropriate error message describing the failure reason and route it to the appropriate destination
Context: An error message has been generated due to CPRS cargo creation failure
GIVEN
An error message has been generated due to CPRS cargo creation failure
Applied to: Skip Cargo Processing
WHEN
The system determines next processing steps
THEN
The system should skip all further processing for this cargo and continue with the next cargo or segment
R-GCX016E-cbl-01944 (+10) File: GCX016E.cbl Foreign Bill Cargo Creation Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Foreign Bill Cargo Creation':
  • Context - a foreign bill is not found in the existing cargo system:
    For Initialize New Cargo Record:
    When the system needs to create a new cargo record, then a new cargo record structure is initialized with default values and prepared for data population.
  • Context - an initialized cargo record and x4 segment data containing disposition codes and cargo details:
    For Set Up Cargo Record with X4 Segment Data:
    When the system processes x4 segment information for foreign bill cargo creation, then the cargo record is populated with disposition code, entry number, quantity, and other x4 segment data.
  • Context - a cargo record with x4 data populated and n7 segment data containing equipment information:
    For Set Up Cargo Record with N7 Segment Data:
    When the system processes n7 segment information for equipment details, then the cargo record is updated with car id, equipment initial, equipment number, and other n7 equipment data.
  • Context - m10 segments containing manifest header information for foreign bills:
    For Build Foreign Manifest Information from M10 Segments:
    When the system processes m10 segments to build foreign manifest data, then manifest information including scac code, transport type, country code, and vessel details are extracted and prepared for cargo record.
  • Context - m10 manifest segments containing carrier information:
    For Extract SCAC Code:
    When the system processes manifest data to identify the carrier, then the scac code is extracted and assigned to the cargo record for carrier identification.
  • Context - m10 manifest segments containing transportation mode information:
    For Extract Transport Type:
    When the system processes manifest data to classify transport method, then the transport type is identified and recorded in the cargo record for proper routing and handling.
  • Context - m10 manifest segments containing country information:
    For Extract Country Code:
    When the system processes manifest data to identify country details, then the appropriate country code is extracted and assigned to the cargo record for customs and regulatory purposes.
  • Context - m10 manifest segments containing vessel or conveyance information:
    For Extract Vessel Details:
    When the system processes manifest data to capture vessel details, then vessel name, voyage number, and other conveyance details are extracted and recorded in the cargo record.
  • Context - raw car id information from n7 equipment segments:
    For Format Car ID for Database:
    When the system prepares car id for database insertion, then the car id is formatted according to database requirements with proper padding, case conversion, and structure validation.
  • Context - a complete cargo record populated with all required foreign bill information:
    For Insert New Cargo Record into Database:
    When the system performs database insertion for the new cargo record, then the cargo record is successfully inserted into gcsusrt database with all populated fields and proper indexing.
  • Context - a successfully created foreign cargo record in the database:
    For Log Foreign Cargo Creation Action:
    When the system completes foreign cargo creation process, then a log entry is created documenting the foreign cargo creation with timestamp, cargo details, and creation context for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A foreign bill is not found in the existing cargo system
GIVEN
A foreign bill is not found in the existing cargo system
Applied to: Initialize New Cargo Record
WHEN
The system needs to create a new cargo record
THEN
A new cargo record structure is initialized with default values and prepared for data population
Context: An initialized cargo record and X4 segment data containing disposition codes and cargo details
GIVEN
An initialized cargo record and X4 segment data containing disposition codes and cargo details
Applied to: Set Up Cargo Record with X4 Segment Data
WHEN
The system processes X4 segment information for foreign bill cargo creation
THEN
The cargo record is populated with disposition code, entry number, quantity, and other X4 segment data
Context: A cargo record with X4 data populated and N7 segment data containing equipment information
GIVEN
A cargo record with X4 data populated and N7 segment data containing equipment information
Applied to: Set Up Cargo Record with N7 Segment Data
WHEN
The system processes N7 segment information for equipment details
THEN
The cargo record is updated with car ID, equipment initial, equipment number, and other N7 equipment data
Context: M10 segments containing manifest header information for foreign bills
GIVEN
M10 segments containing manifest header information for foreign bills
Applied to: Build Foreign Manifest Information from M10 Segments
WHEN
The system processes M10 segments to build foreign manifest data
THEN
Manifest information including SCAC code, transport type, country code, and vessel details are extracted and prepared for cargo record
Context: M10 manifest segments containing carrier information
GIVEN
M10 manifest segments containing carrier information
Applied to: Extract SCAC Code
WHEN
The system processes manifest data to identify the carrier
THEN
The SCAC code is extracted and assigned to the cargo record for carrier identification
Context: M10 manifest segments containing transportation mode information
GIVEN
M10 manifest segments containing transportation mode information
Applied to: Extract Transport Type
WHEN
The system processes manifest data to classify transport method
THEN
The transport type is identified and recorded in the cargo record for proper routing and handling
Context: M10 manifest segments containing country information
GIVEN
M10 manifest segments containing country information
Applied to: Extract Country Code
WHEN
The system processes manifest data to identify country details
THEN
The appropriate country code is extracted and assigned to the cargo record for customs and regulatory purposes
Context: M10 manifest segments containing vessel or conveyance information
GIVEN
M10 manifest segments containing vessel or conveyance information
Applied to: Extract Vessel Details
WHEN
The system processes manifest data to capture vessel details
THEN
Vessel name, voyage number, and other conveyance details are extracted and recorded in the cargo record
Context: Raw car ID information from N7 equipment segments
GIVEN
Raw car ID information from N7 equipment segments
Applied to: Format Car ID for Database
WHEN
The system prepares car ID for database insertion
THEN
The car ID is formatted according to database requirements with proper padding, case conversion, and structure validation
Context: A complete cargo record populated with all required foreign bill information
GIVEN
A complete cargo record populated with all required foreign bill information
Applied to: Insert New Cargo Record into Database
WHEN
The system performs database insertion for the new cargo record
THEN
The cargo record is successfully inserted into GCSUSRT database with all populated fields and proper indexing
Context: A successfully created foreign cargo record in the database
GIVEN
A successfully created foreign cargo record in the database
Applied to: Log Foreign Cargo Creation Action
WHEN
The system completes foreign cargo creation process
THEN
A log entry is created documenting the foreign cargo creation with timestamp, cargo details, and creation context for audit trail
R-GCX016E-cbl-01955 (+11) File: GCX016E.cbl Car ID Cargo Search with SCAC Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car ID Cargo Search with SCAC Processing':
  • Context - a car id is provided for cargo lookup:
    For Search Cargo by Car ID:
    When the system performs initial cargo search using the car id, then the system queries the cargo database to find matching cargo records.
  • Context - a cargo search has been performed using car id:
    For Cargo Found?:
    When the system evaluates the search results, then the system determines if a cargo record was found or not found.
  • Context - a cargo record has been found using car id search:
    For Check SCAC Code:
    When the system checks the scac code in the cargo record, then the system retrieves and evaluates the scac code for further processing.
  • Context - a scac code has been retrieved from the cargo record:
    For SCAC Unknown?:
    When the system evaluates the scac code status, then the system determines if the scac is unknown and requires us-ccn key renumbering.
  • Context - a cargo record has been found but scac is marked as unknown:
    For Perform US-CCN Key Renumbering:
    When the system performs us-ccn key renumbering, then the system updates the us-ccn key index to create a new searchable key.
  • Context - us-ccn key renumbering has been completed:
    For Search Again with New Key:
    When the system searches for cargo using the new key, then the system queries the cargo database with the renumbered us-ccn key.
  • Context - a secondary cargo search has been performed with renumbered key:
    For Cargo Found with New Key?:
    When the system evaluates the secondary search results, then the system determines if cargo was successfully found with the new key.
  • Context - cargo has been found using renumbered key after scac unknown determination:
    For Handle SCAC Unknown Scenario:
    When the system handles the scac unknown scenario, then the system applies special processing rules for unknown scac situations.
  • Context - scac unknown scenario processing has been completed:
    For Log SCAC Processing Action:
    When the system logs the processing action, then the system records the scac processing details for audit trail.
  • Context - a cargo record has been found and scac is not unknown:
    For Return Found Cargo Record:
    When the system processes the found cargo, then the system returns the cargo record for further business processing.
  • Context - a valid cargo record has been found through either initial search or scac unknown processing:
    For Continue with Found Cargo:
    When the system continues with cargo processing, then the system proceeds with standard cargo business logic using the found record.
  • Context - cargo search has failed in both initial search and secondary search with renumbered key:
    For Generate Cargo Not Found Error:
    When the system cannot locate any matching cargo record, then the system generates a cargo not found error for business exception handling.
👨‍💻 Technical ACs (Gherkin)
Context: A car ID is provided for cargo lookup
GIVEN
A car ID is provided for cargo lookup
Applied to: Search Cargo by Car ID
WHEN
The system performs initial cargo search using the car ID
THEN
The system queries the cargo database to find matching cargo records
Context: A cargo search has been performed using car ID
GIVEN
A cargo search has been performed using car ID
Applied to: Cargo Found?
WHEN
The system evaluates the search results
THEN
The system determines if a cargo record was found or not found
Context: A cargo record has been found using car ID search
GIVEN
A cargo record has been found using car ID search
Applied to: Check SCAC Code
WHEN
The system checks the SCAC code in the cargo record
THEN
The system retrieves and evaluates the SCAC code for further processing
Context: A SCAC code has been retrieved from the cargo record
GIVEN
A SCAC code has been retrieved from the cargo record
Applied to: SCAC Unknown?
WHEN
The system evaluates the SCAC code status
THEN
The system determines if the SCAC is unknown and requires US-CCN key renumbering
Context: A cargo record has been found but SCAC is marked as unknown
GIVEN
A cargo record has been found but SCAC is marked as unknown
Applied to: Perform US-CCN Key Renumbering
WHEN
The system performs US-CCN key renumbering
THEN
The system updates the US-CCN key index to create a new searchable key
Context: US-CCN key renumbering has been completed
GIVEN
US-CCN key renumbering has been completed
Applied to: Search Again with New Key
WHEN
The system searches for cargo using the new key
THEN
The system queries the cargo database with the renumbered US-CCN key
Context: A secondary cargo search has been performed with renumbered key
GIVEN
A secondary cargo search has been performed with renumbered key
Applied to: Cargo Found with New Key?
WHEN
The system evaluates the secondary search results
THEN
The system determines if cargo was successfully found with the new key
Context: Cargo has been found using renumbered key after SCAC unknown determination
GIVEN
Cargo has been found using renumbered key after SCAC unknown determination
Applied to: Handle SCAC Unknown Scenario
WHEN
The system handles the SCAC unknown scenario
THEN
The system applies special processing rules for unknown SCAC situations
Context: SCAC unknown scenario processing has been completed
GIVEN
SCAC unknown scenario processing has been completed
Applied to: Log SCAC Processing Action
WHEN
The system logs the processing action
THEN
The system records the SCAC processing details for audit trail
Context: A cargo record has been found and SCAC is not unknown
GIVEN
A cargo record has been found and SCAC is not unknown
Applied to: Return Found Cargo Record
WHEN
The system processes the found cargo
THEN
The system returns the cargo record for further business processing
Context: A valid cargo record has been found through either initial search or SCAC unknown processing
GIVEN
A valid cargo record has been found through either initial search or SCAC unknown processing
Applied to: Continue with Found Cargo
WHEN
The system continues with cargo processing
THEN
The system proceeds with standard cargo business logic using the found record
Context: Cargo search has failed in both initial search and secondary search with renumbered key
GIVEN
Cargo search has failed in both initial search and secondary search with renumbered key
Applied to: Generate Cargo Not Found Error
WHEN
The system cannot locate any matching cargo record
THEN
The system generates a cargo not found error for business exception handling
R-GCX016E-cbl-01967 (+9) File: GCX016E.cbl Cargo Status Segment Retrieval Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Segment Retrieval':
  • Context - a cargo status segment retrieval process is starting:
    For Initialize Status Segment Variables:
    When the system begins status segment processing, then all status segment variables, arrays, and counters are initialized to their default values.
  • Context - a cargo requires status segment retrieval:
    For Set Car ID and US-CCN Keys:
    When the system prepares to query status segments, then the car id and us-ccn keys are set to identify the specific cargo.
  • Context - car id and us-ccn keys are properly set:
    For Call GCCUSIO2 to Retrieve S09 Segments:
    When the system needs to retrieve cargo status segments, then gccusio2 program is called to fetch s09 segments from gcsuss09 database.
  • Context - gccusio2 has completed the status segment retrieval attempt:
    For S09 Segments Found?:
    When the system evaluates the retrieval results, then if segments are found, proceed to process them; if no segments found or database error occurred, initialize empty status arrays.
  • Context - no s09 status segments were found or a database error occurred:
    For Initialize Empty Status Arrays:
    When the system needs to continue processing without existing status data, then empty status arrays are initialized to allow new status processing.
  • Context - s09 status segments have been successfully retrieved from the database:
    For Process Retrieved S09 Segments:
    When the system processes each retrieved segment, then each s09 segment is processed to extract status data for array population.
  • Context - s09 segments have been processed and status data extracted:
    For Populate S09A Status Arrays:
    When the system populates status arrays, then s09a status arrays are populated with the extracted status information from each segment.
  • Context - status segments are being processed with sequence numbers:
    For Track Maximum Sequence Numbers:
    When the system encounters sequence numbers in the segments, then the maximum sequence numbers are tracked and stored for future reference.
  • Context - status segments are being processed sequentially:
    For More Segments to Process?:
    When the system completes processing of a segment, then if more segments exist, continue processing; if no more segments, proceed to finalize arrays.
  • Context - all status segments have been processed and arrays populated:
    For Set Status Arrays Ready Flag:
    When the status segment retrieval process is complete, then the status arrays ready flag is set to indicate successful completion.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status segment retrieval process is starting
GIVEN
A cargo status segment retrieval process is starting
Applied to: Initialize Status Segment Variables
WHEN
The system begins status segment processing
THEN
All status segment variables, arrays, and counters are initialized to their default values
Context: A cargo requires status segment retrieval
GIVEN
A cargo requires status segment retrieval
Applied to: Set Car ID and US-CCN Keys
WHEN
The system prepares to query status segments
THEN
The Car ID and US-CCN keys are set to identify the specific cargo
Context: Car ID and US-CCN keys are properly set
GIVEN
Car ID and US-CCN keys are properly set
Applied to: Call GCCUSIO2 to Retrieve S09 Segments
WHEN
The system needs to retrieve cargo status segments
THEN
GCCUSIO2 program is called to fetch S09 segments from GCSUSS09 database
Context: GCCUSIO2 has completed the status segment retrieval attempt
GIVEN
GCCUSIO2 has completed the status segment retrieval attempt
Applied to: S09 Segments Found?
WHEN
The system evaluates the retrieval results
THEN
If segments are found, proceed to process them; if no segments found or database error occurred, initialize empty status arrays
Context: No S09 status segments were found or a database error occurred
GIVEN
No S09 status segments were found or a database error occurred
Applied to: Initialize Empty Status Arrays
WHEN
The system needs to continue processing without existing status data
THEN
Empty status arrays are initialized to allow new status processing
Context: S09 status segments have been successfully retrieved from the database
GIVEN
S09 status segments have been successfully retrieved from the database
Applied to: Process Retrieved S09 Segments
WHEN
The system processes each retrieved segment
THEN
Each S09 segment is processed to extract status data for array population
Context: S09 segments have been processed and status data extracted
GIVEN
S09 segments have been processed and status data extracted
Applied to: Populate S09A Status Arrays
WHEN
The system populates status arrays
THEN
S09A status arrays are populated with the extracted status information from each segment
Context: Status segments are being processed with sequence numbers
GIVEN
Status segments are being processed with sequence numbers
Applied to: Track Maximum Sequence Numbers
WHEN
The system encounters sequence numbers in the segments
THEN
The maximum sequence numbers are tracked and stored for future reference
Context: Status segments are being processed sequentially
GIVEN
Status segments are being processed sequentially
Applied to: More Segments to Process?
WHEN
The system completes processing of a segment
THEN
If more segments exist, continue processing; if no more segments, proceed to finalize arrays
Context: All status segments have been processed and arrays populated
GIVEN
All status segments have been processed and arrays populated
Applied to: Set Status Arrays Ready Flag
WHEN
The status segment retrieval process is complete
THEN
The status arrays ready flag is set to indicate successful completion
R-GCX016E-cbl-01977 (+10) File: GCX016E.cbl Status Array Population from Database Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Population from Database':
  • Context - a cargo requires status array population from database segments:
    For Initialize Status Array Counter:
    When the status array population process begins, then the status array counter is initialized to zero to track processed segments.
  • Context - a cargo identifier exists in the system:
    For Retrieve S09 Status Segments from Database:
    When status array population is requested for the cargo, then all s09 status segments are retrieved from the gcsuss09 database table for that cargo.
  • Context - a database query for s09 status segments has been executed:
    For Status Segments Found?:
    When the query results are evaluated, then if status segments are found, continue with array population, otherwise complete the process without population.
  • Context - a status segment is being processed:
    For Extract Disposition Code Information:
    When disposition code information needs to be extracted, then the disposition code, entry number, and quantity information are extracted from the segment.
    For Extract Status Information Code:
    When status information needs to be extracted, then the status information code is extracted to identify the type of status change recorded.
  • Context - a status segment contains date and time information:
    For Extract Date and Time Information:
    When the segment is being processed for array population, then the date and time information is extracted and formatted for storage in the status array.
  • Context - status information has been extracted from a database segment:
    For Store in S09A Status Array:
    When the information needs to be stored for processing, then the disposition code, dates, times, and status information are stored in the corresponding s09a array element.
  • Context - a status segment has been successfully stored in the status array:
    For Increment Array Counter:
    When the storage operation is complete, then the array counter is incremented by one to reflect the additional stored segment.
  • Context - a status segment with a sequence number is being processed:
    For Track Maximum Sequence Number:
    When the sequence number is compared to the current maximum, then if the current sequence number is higher than the tracked maximum, update the maximum sequence number.
  • Context - a status segment has been processed and stored:
    For More Status Segments?:
    When the system checks for remaining segments, then if more status segments exist for the cargo, continue processing the next segment, otherwise proceed to completion.
  • Context - all status segments for a cargo have been processed:
    For Update Maximum Sequences Fetched:
    When the population process is completing, then the maximum sequences fetched counter is updated with the highest sequence number processed.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo requires status array population from database segments
GIVEN
A cargo requires status array population from database segments
Applied to: Initialize Status Array Counter
WHEN
The status array population process begins
THEN
The status array counter is initialized to zero to track processed segments
Context: A cargo identifier exists in the system
GIVEN
A cargo identifier exists in the system
Applied to: Retrieve S09 Status Segments from Database
WHEN
Status array population is requested for the cargo
THEN
All S09 status segments are retrieved from the GCSUSS09 database table for that cargo
Context: A database query for S09 status segments has been executed
GIVEN
A database query for S09 status segments has been executed
Applied to: Status Segments Found?
WHEN
The query results are evaluated
THEN
If status segments are found, continue with array population, otherwise complete the process without population
Context: A status segment is being processed
GIVEN
A status segment is being processed
Applied to: Extract Disposition Code Information
WHEN
Disposition code information needs to be extracted
THEN
The disposition code, entry number, and quantity information are extracted from the segment
Applied to: Extract Status Information Code
WHEN
Status information needs to be extracted
THEN
The status information code is extracted to identify the type of status change recorded
Context: A status segment contains date and time information
GIVEN
A status segment contains date and time information
Applied to: Extract Date and Time Information
WHEN
The segment is being processed for array population
THEN
The date and time information is extracted and formatted for storage in the status array
Context: Status information has been extracted from a database segment
GIVEN
Status information has been extracted from a database segment
Applied to: Store in S09A Status Array
WHEN
The information needs to be stored for processing
THEN
The disposition code, dates, times, and status information are stored in the corresponding S09A array element
Context: A status segment has been successfully stored in the status array
GIVEN
A status segment has been successfully stored in the status array
Applied to: Increment Array Counter
WHEN
The storage operation is complete
THEN
The array counter is incremented by one to reflect the additional stored segment
Context: A status segment with a sequence number is being processed
GIVEN
A status segment with a sequence number is being processed
Applied to: Track Maximum Sequence Number
WHEN
The sequence number is compared to the current maximum
THEN
If the current sequence number is higher than the tracked maximum, update the maximum sequence number
Context: A status segment has been processed and stored
GIVEN
A status segment has been processed and stored
Applied to: More Status Segments?
WHEN
The system checks for remaining segments
THEN
If more status segments exist for the cargo, continue processing the next segment, otherwise proceed to completion
Context: All status segments for a cargo have been processed
GIVEN
All status segments for a cargo have been processed
Applied to: Update Maximum Sequences Fetched
WHEN
The population process is completing
THEN
The maximum sequences fetched counter is updated with the highest sequence number processed
R-GCX016E-cbl-01988 (+9) File: GCX016E.cbl Status Segment Database Replacement Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Segment Database Replacement':
  • Context - a cargo status processing operation has been completed:
    For Status Array Updated?:
    When the system checks if the status array has been modified, then if the status array is updated, proceed to convert to database format, otherwise complete the process without database operations.
  • Context - the status array has been updated with new cargo status information:
    For Convert Status Array to Database Format:
    When the system needs to prepare data for database storage, then convert the status array elements to the proper database segment format maintaining all status codes, quantities, and sequence information.
  • Context - a cargo record is being processed for status segment replacement:
    For Cargo Type Check:
    When the system evaluates the cargo type, then if the cargo is non-cprs, proceed to update car id information, if cprs, skip car id updates and proceed directly to database segment preparation.
  • Context - a non-cprs cargo is being processed and car id information is available from n7 equipment segments:
    For Update Car ID for Non-CPRS Cargo:
    When the system updates cargo information before database storage, then update the cargo record with the current car id information from the equipment segment data.
  • Context - status array data has been converted to database format and car id updates have been applied if applicable:
    For Prepare Database Segment:
    When the system prepares the final database segment for storage, then format the segment with proper sequence numbers, status codes, quantities, and cargo identification for database replacement operation.
  • Context - a properly formatted database segment is ready for storage:
    For Replace Status Segment in GCSUSS09:
    When the system performs the database replacement operation, then replace the existing status segment in gcsuss09 table with the updated segment containing current status information.
  • Context - a database replacement operation has been attempted on gcsuss09:
    For Database Update Successful?:
    When the system checks the operation result, then if the update was successful, proceed to log successful replacement, if there was an error, handle the database error appropriately.
  • Context - the database replacement operation completed successfully:
    For Log Successful Replacement:
    When the system needs to record the successful operation, then log the successful replacement of status segment with cargo identification and timestamp information.
  • Context - a database replacement operation has failed:
    For Handle Database Error:
    When the system encounters a database error, then handle the error by logging the failure details and determining appropriate recovery or notification actions.
  • Context - a database replacement operation has been completed (successfully or with error):
    For Update Status Tracking:
    When the system updates internal tracking information, then update status tracking records to reflect the current state of the cargo status segment replacement operation.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status processing operation has been completed
GIVEN
A cargo status processing operation has been completed
Applied to: Status Array Updated?
WHEN
The system checks if the status array has been modified
THEN
If the status array is updated, proceed to convert to database format, otherwise complete the process without database operations
Context: The status array has been updated with new cargo status information
GIVEN
The status array has been updated with new cargo status information
Applied to: Convert Status Array to Database Format
WHEN
The system needs to prepare data for database storage
THEN
Convert the status array elements to the proper database segment format maintaining all status codes, quantities, and sequence information
Context: A cargo record is being processed for status segment replacement
GIVEN
A cargo record is being processed for status segment replacement
Applied to: Cargo Type Check
WHEN
The system evaluates the cargo type
THEN
If the cargo is Non-CPRS, proceed to update car ID information, if CPRS, skip car ID updates and proceed directly to database segment preparation
Context: A non-CPRS cargo is being processed and car ID information is available from N7 equipment segments
GIVEN
A non-CPRS cargo is being processed and car ID information is available from N7 equipment segments
Applied to: Update Car ID for Non-CPRS Cargo
WHEN
The system updates cargo information before database storage
THEN
Update the cargo record with the current car ID information from the equipment segment data
Context: Status array data has been converted to database format and car ID updates have been applied if applicable
GIVEN
Status array data has been converted to database format and car ID updates have been applied if applicable
Applied to: Prepare Database Segment
WHEN
The system prepares the final database segment for storage
THEN
Format the segment with proper sequence numbers, status codes, quantities, and cargo identification for database replacement operation
Context: A properly formatted database segment is ready for storage
GIVEN
A properly formatted database segment is ready for storage
Applied to: Replace Status Segment in GCSUSS09
WHEN
The system performs the database replacement operation
THEN
Replace the existing status segment in GCSUSS09 table with the updated segment containing current status information
Context: A database replacement operation has been attempted on GCSUSS09
GIVEN
A database replacement operation has been attempted on GCSUSS09
Applied to: Database Update Successful?
WHEN
The system checks the operation result
THEN
If the update was successful, proceed to log successful replacement, if there was an error, handle the database error appropriately
Context: The database replacement operation completed successfully
GIVEN
The database replacement operation completed successfully
Applied to: Log Successful Replacement
WHEN
The system needs to record the successful operation
THEN
Log the successful replacement of status segment with cargo identification and timestamp information
Context: A database replacement operation has failed
GIVEN
A database replacement operation has failed
Applied to: Handle Database Error
WHEN
The system encounters a database error
THEN
Handle the error by logging the failure details and determining appropriate recovery or notification actions
Context: A database replacement operation has been completed (successfully or with error)
GIVEN
A database replacement operation has been completed (successfully or with error)
Applied to: Update Status Tracking
WHEN
The system updates internal tracking information
THEN
Update status tracking records to reflect the current state of the cargo status segment replacement operation
R-GCX016E-cbl-01998 (+19) File: GCX016E.cbl Status Array to Database Conversion Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array to Database Conversion':
  • Context - a status array conversion process is starting:
    For Initialize Database Segment Counter:
    When the system begins the conversion operation, then the database segment counter is set to zero and work areas are cleared.
  • Context - a database segment work area exists:
    For Clear Database Segment Work Area:
    When the system prepares to process status array entries, then all fields in the database segment work area are cleared to initial values.
  • Context - a status array with multiple entries exists:
    For More Status Array Entries?:
    When the system checks for remaining entries to process, then the system returns true if more entries exist or false if all entries have been processed.
  • Context - status array entries are available for processing:
    For Get Next Status Array Entry:
    When the system needs to process the next entry, then the next status array entry is retrieved and made available for data extraction.
  • Context - a status array entry contains disposition code information:
    For Extract Disposition Code:
    When the system processes the entry for database conversion, then the disposition code is extracted and prepared for database segment formatting.
  • Context - a status array entry contains date information:
    For Extract Date Information:
    When the system processes the entry for database conversion, then the date information is extracted and prepared for database segment formatting.
  • Context - a status array entry contains time information:
    For Extract Time Information:
    When the system processes the entry for database conversion, then the time information is extracted and prepared for database segment formatting.
  • Context - a status array entry contains quantity information:
    For Extract Quantity Information:
    When the system processes the entry for database conversion, then the quantity information is extracted and prepared for database segment formatting.
  • Context - extracted data from status array entry is available:
    For Format Database Segment Fields:
    When the system prepares data for database storage, then all extracted data is formatted according to database segment field specifications.
  • Context - formatted data is ready for database storage:
    For Move Data to Database Segment:
    When the system populates the database segment, then all formatted data is moved to the appropriate database segment fields.
  • Context - a status array entry has been successfully processed into database format:
    For Increment Segment Counter:
    When the system completes processing of one entry, then the database segment counter is incremented by one.
  • Context - a database segment has a defined maximum capacity for entries:
    For Check Segment Capacity:
    When the system adds an entry to the segment, then the system checks if the segment capacity limit has been reached.
  • Context - a database segment with defined capacity limits:
    For Segment Full?:
    When the system checks segment capacity after adding an entry, then the system returns true if segment is at capacity or false if more entries can be added.
  • Context - a database segment that has reached its capacity limit:
    For Write Segment to Database:
    When the system determines the segment is full, then the complete segment is written to the gcsuss09 status segments database.
  • Context - a database segment has been written to storage:
    For Initialize New Segment:
    When more status array entries remain to be processed, then a new database segment is initialized with cleared fields and reset counter.
  • Context - the current status array entry has been processed:
    For Continue with Next Entry:
    When more entries remain in the status array, then the system continues processing with the next available entry.
  • Context - a status array with a finite number of entries:
    For All Entries Processed?:
    When the system completes processing entries, then the system returns true if all entries are processed or false if entries remain.
  • Context - all status array entries have been processed and a final segment contains data:
    For Write Final Segment to Database:
    When no more entries remain to be processed, then the final database segment is written to the gcsuss09 status segments database.
  • Context - database segments have been written for a cargo's status information:
    For Update Cargo Record with Segment Count:
    When the conversion process is complete, then the cargo record is updated with the total count of database segments created.
  • Context - all status array entries have been converted and written to database segments:
    For Complete Conversion Process:
    When the cargo record has been updated with segment information, then the conversion process is marked as complete and control returns to calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A status array conversion process is starting
GIVEN
A status array conversion process is starting
Applied to: Initialize Database Segment Counter
WHEN
The system begins the conversion operation
THEN
The database segment counter is set to zero and work areas are cleared
Context: A database segment work area exists
GIVEN
A database segment work area exists
Applied to: Clear Database Segment Work Area
WHEN
The system prepares to process status array entries
THEN
All fields in the database segment work area are cleared to initial values
Context: A status array with multiple entries exists
GIVEN
A status array with multiple entries exists
Applied to: More Status Array Entries?
WHEN
The system checks for remaining entries to process
THEN
The system returns true if more entries exist or false if all entries have been processed
Context: Status array entries are available for processing
GIVEN
Status array entries are available for processing
Applied to: Get Next Status Array Entry
WHEN
The system needs to process the next entry
THEN
The next status array entry is retrieved and made available for data extraction
Context: A status array entry contains disposition code information
GIVEN
A status array entry contains disposition code information
Applied to: Extract Disposition Code
WHEN
The system processes the entry for database conversion
THEN
The disposition code is extracted and prepared for database segment formatting
Context: A status array entry contains date information
GIVEN
A status array entry contains date information
Applied to: Extract Date Information
WHEN
The system processes the entry for database conversion
THEN
The date information is extracted and prepared for database segment formatting
Context: A status array entry contains time information
GIVEN
A status array entry contains time information
Applied to: Extract Time Information
WHEN
The system processes the entry for database conversion
THEN
The time information is extracted and prepared for database segment formatting
Context: A status array entry contains quantity information
GIVEN
A status array entry contains quantity information
Applied to: Extract Quantity Information
WHEN
The system processes the entry for database conversion
THEN
The quantity information is extracted and prepared for database segment formatting
Context: Extracted data from status array entry is available
GIVEN
Extracted data from status array entry is available
Applied to: Format Database Segment Fields
WHEN
The system prepares data for database storage
THEN
All extracted data is formatted according to database segment field specifications
Context: Formatted data is ready for database storage
GIVEN
Formatted data is ready for database storage
Applied to: Move Data to Database Segment
WHEN
The system populates the database segment
THEN
All formatted data is moved to the appropriate database segment fields
Context: A status array entry has been successfully processed into database format
GIVEN
A status array entry has been successfully processed into database format
Applied to: Increment Segment Counter
WHEN
The system completes processing of one entry
THEN
The database segment counter is incremented by one
Context: A database segment has a defined maximum capacity for entries
GIVEN
A database segment has a defined maximum capacity for entries
Applied to: Check Segment Capacity
WHEN
The system adds an entry to the segment
THEN
The system checks if the segment capacity limit has been reached
Context: A database segment with defined capacity limits
GIVEN
A database segment with defined capacity limits
Applied to: Segment Full?
WHEN
The system checks segment capacity after adding an entry
THEN
The system returns true if segment is at capacity or false if more entries can be added
Context: A database segment that has reached its capacity limit
GIVEN
A database segment that has reached its capacity limit
Applied to: Write Segment to Database
WHEN
The system determines the segment is full
THEN
The complete segment is written to the GCSUSS09 status segments database
Context: A database segment has been written to storage
GIVEN
A database segment has been written to storage
Applied to: Initialize New Segment
WHEN
More status array entries remain to be processed
THEN
A new database segment is initialized with cleared fields and reset counter
Context: The current status array entry has been processed
GIVEN
The current status array entry has been processed
Applied to: Continue with Next Entry
WHEN
More entries remain in the status array
THEN
The system continues processing with the next available entry
Context: A status array with a finite number of entries
GIVEN
A status array with a finite number of entries
Applied to: All Entries Processed?
WHEN
The system completes processing entries
THEN
The system returns true if all entries are processed or false if entries remain
Context: All status array entries have been processed and a final segment contains data
GIVEN
All status array entries have been processed and a final segment contains data
Applied to: Write Final Segment to Database
WHEN
No more entries remain to be processed
THEN
The final database segment is written to the GCSUSS09 status segments database
Context: Database segments have been written for a cargo's status information
GIVEN
Database segments have been written for a cargo's status information
Applied to: Update Cargo Record with Segment Count
WHEN
The conversion process is complete
THEN
The cargo record is updated with the total count of database segments created
Context: All status array entries have been converted and written to database segments
GIVEN
All status array entries have been converted and written to database segments
Applied to: Complete Conversion Process
WHEN
The cargo record has been updated with segment information
THEN
The conversion process is marked as complete and control returns to calling process
R-GCX016E-cbl-02018 (+12) File: GCX016E.cbl Disposition Code Table Validation Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Table Validation':
  • Context - an x4 segment is being processed:
    For Extract Disposition Code from X4 Segment:
    When the system needs to validate the disposition code, then the disposition code is extracted from the x4 segment for table lookup.
  • Context - a disposition code needs to be validated:
    For Call GCCTBIO to Access DC Table:
    When the system calls the table access function, then the dc table is accessed through gcctbio to retrieve disposition code information.
  • Context - a disposition code has been extracted from the x4 segment:
    For Disposition Code Found in Table?:
    When the system searches the dc table for the code, then the system determines if the disposition code is valid and authorized for use.
  • Context - a disposition code is found to be valid in the dc table:
    For Retrieve Processing Rules and Attributes:
    When the system needs to process the disposition code, then all associated processing rules, attributes, and configuration parameters are retrieved from the table.
  • Context - a disposition code has been successfully validated against the dc table:
    For Set Disposition Code Valid Flag:
    When the validation process completes successfully, then the system sets the disposition code valid flag to enable further processing.
  • Context - a valid disposition code with associated processing rules:
    For Extract Action Code for Release Quantity:
    When the system needs to determine quantity impact, then the action code for release quantity processing is extracted from the disposition code attributes.
  • Context - a valid disposition code with processing attributes:
    For Extract Hold/Release Indicator:
    When the system needs to determine the hold or release nature of the code, then the hold/release indicator is extracted to determine the appropriate cargo status action.
  • Context - a valid disposition code with complete attributes:
    For Extract Status Information Flag:
    When the system needs to determine if the code is informational, then the status information flag is extracted to determine if the code affects cargo status or is informational only.
  • Context - a disposition code is not found in the dc table:
    For Set Disposition Code Invalid Flag:
    When the validation process fails, then the system sets the disposition code invalid flag to prevent further processing.
  • Context - an invalid disposition code has been identified:
    For Generate Merlin Error Message:
    When error handling is required, then an error message is generated and sent to the merlin messaging system to notify users of the invalid code.
  • Context - a disposition code is determined to be invalid or unknown:
    For Log Unknown Disposition Code:
    When logging is required for audit purposes, then the unknown disposition code is logged with relevant context information for system administrators.
  • Context - a disposition code has been validated and processing rules retrieved:
    For Continue Processing with Retrieved Rules:
    When all validation checks pass successfully, then the system continues with cargo processing using the retrieved disposition code rules and attributes.
  • Context - a disposition code has failed validation:
    For Skip Processing Due to Invalid Code:
    When the code is determined to be invalid or unauthorized, then the system skips further processing of the cargo to prevent incorrect status updates.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed
GIVEN
An X4 segment is being processed
Applied to: Extract Disposition Code from X4 Segment
WHEN
The system needs to validate the disposition code
THEN
The disposition code is extracted from the X4 segment for table lookup
Context: A disposition code needs to be validated
GIVEN
A disposition code needs to be validated
Applied to: Call GCCTBIO to Access DC Table
WHEN
The system calls the table access function
THEN
The DC table is accessed through GCCTBIO to retrieve disposition code information
Context: A disposition code has been extracted from the X4 segment
GIVEN
A disposition code has been extracted from the X4 segment
Applied to: Disposition Code Found in Table?
WHEN
The system searches the DC table for the code
THEN
The system determines if the disposition code is valid and authorized for use
Context: A disposition code is found to be valid in the DC table
GIVEN
A disposition code is found to be valid in the DC table
Applied to: Retrieve Processing Rules and Attributes
WHEN
The system needs to process the disposition code
THEN
All associated processing rules, attributes, and configuration parameters are retrieved from the table
Context: A disposition code has been successfully validated against the DC table
GIVEN
A disposition code has been successfully validated against the DC table
Applied to: Set Disposition Code Valid Flag
WHEN
The validation process completes successfully
THEN
The system sets the disposition code valid flag to enable further processing
Context: A valid disposition code with associated processing rules
GIVEN
A valid disposition code with associated processing rules
Applied to: Extract Action Code for Release Quantity
WHEN
The system needs to determine quantity impact
THEN
The action code for release quantity processing is extracted from the disposition code attributes
Context: A valid disposition code with processing attributes
GIVEN
A valid disposition code with processing attributes
Applied to: Extract Hold/Release Indicator
WHEN
The system needs to determine the hold or release nature of the code
THEN
The hold/release indicator is extracted to determine the appropriate cargo status action
Context: A valid disposition code with complete attributes
GIVEN
A valid disposition code with complete attributes
Applied to: Extract Status Information Flag
WHEN
The system needs to determine if the code is informational
THEN
The status information flag is extracted to determine if the code affects cargo status or is informational only
Context: A disposition code is not found in the DC table
GIVEN
A disposition code is not found in the DC table
Applied to: Set Disposition Code Invalid Flag
WHEN
The validation process fails
THEN
The system sets the disposition code invalid flag to prevent further processing
Context: An invalid disposition code has been identified
GIVEN
An invalid disposition code has been identified
Applied to: Generate Merlin Error Message
WHEN
Error handling is required
THEN
An error message is generated and sent to the Merlin messaging system to notify users of the invalid code
Context: A disposition code is determined to be invalid or unknown
GIVEN
A disposition code is determined to be invalid or unknown
Applied to: Log Unknown Disposition Code
WHEN
Logging is required for audit purposes
THEN
The unknown disposition code is logged with relevant context information for system administrators
Context: A disposition code has been validated and processing rules retrieved
GIVEN
A disposition code has been validated and processing rules retrieved
Applied to: Continue Processing with Retrieved Rules
WHEN
All validation checks pass successfully
THEN
The system continues with cargo processing using the retrieved disposition code rules and attributes
Context: A disposition code has failed validation
GIVEN
A disposition code has failed validation
Applied to: Skip Processing Due to Invalid Code
WHEN
The code is determined to be invalid or unauthorized
THEN
The system skips further processing of the cargo to prevent incorrect status updates
R-GCX016E-cbl-02031 (+11) File: GCX016E.cbl Duplicate Disposition Code Detection and Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Duplicate Disposition Code Detection and Processing':
  • Context - a new disposition code needs to be processed for a cargo:
    For Search Existing S09A Status Arrays:
    When the system searches through all existing s09a status array entries, then the system identifies whether the disposition code already exists in the status arrays.
  • Context - the system has searched through existing s09a status arrays:
    For Duplicate Code Found?:
    When a matching disposition code is found in the existing status entries, then the system flags the code as a duplicate and proceeds with duplicate handling logic.
  • Context - a duplicate disposition code has been detected:
    For Code Type Analysis:
    When the system analyzes the disposition code characteristics from the dc table, then the system categorizes the code as hold code, release code, status info code, or removal code based on its processing requirements.
  • Context - a duplicate disposition code is identified as a hold code type:
    For Handle Hold Code Duplicate:
    When the system processes the duplicate hold code, then the system updates the existing entry's date and time information with the most recent values.
  • Context - a duplicate disposition code is identified as a release code type:
    For Handle Release Code Duplicate:
    When the system processes the duplicate release code, then the system updates the existing entry's date and time information with the most recent values.
  • Context - a duplicate disposition code is identified as a status info code type:
    For Handle Status Info Code Duplicate:
    When the system processes the duplicate status info code, then the system keeps the most recent entry and maintains the status information without creating additional duplicates.
  • Context - a duplicate disposition code is identified as a removal code type:
    For Handle Removal Code Duplicate:
    When the system processes the duplicate removal code, then the system removes the older duplicate entry from the status array.
  • Context - a duplicate hold or release code requires timestamp updates:
    For Update Existing Entry Date/Time:
    When the system processes the duplicate entry, then the system updates the existing entry's date and time fields with the current processing timestamp.
  • Context - a duplicate status info code is being processed:
    For Keep Most Recent Entry:
    When the system compares entry timestamps, then the system keeps the entry with the most recent timestamp and discards older duplicate information.
  • Context - a duplicate removal code is being processed:
    For Remove Older Duplicate:
    When the system identifies older duplicate entries in the status array, then the system removes the older duplicate entries and keeps only the most recent removal code.
  • Context - a disposition code is not found as a duplicate in existing status arrays:
    For Add New Code to Array:
    When the system processes the new disposition code, then the system adds the new disposition code to the appropriate status array with all required information.
  • Context - any duplicate disposition code processing action has been completed:
    For Log Duplicate Processing Action:
    When the system finishes handling the duplicate or new code, then the system logs the processing action taken including code type, action performed, and timestamp information.
👨‍💻 Technical ACs (Gherkin)
Context: A new disposition code needs to be processed for a cargo
GIVEN
A new disposition code needs to be processed for a cargo
Applied to: Search Existing S09A Status Arrays
WHEN
The system searches through all existing S09A status array entries
THEN
The system identifies whether the disposition code already exists in the status arrays
Context: The system has searched through existing S09A status arrays
GIVEN
The system has searched through existing S09A status arrays
Applied to: Duplicate Code Found?
WHEN
A matching disposition code is found in the existing status entries
THEN
The system flags the code as a duplicate and proceeds with duplicate handling logic
Context: A duplicate disposition code has been detected
GIVEN
A duplicate disposition code has been detected
Applied to: Code Type Analysis
WHEN
The system analyzes the disposition code characteristics from the DC table
THEN
The system categorizes the code as Hold Code, Release Code, Status Info Code, or Removal Code based on its processing requirements
Context: A duplicate disposition code is identified as a Hold Code type
GIVEN
A duplicate disposition code is identified as a Hold Code type
Applied to: Handle Hold Code Duplicate
WHEN
The system processes the duplicate hold code
THEN
The system updates the existing entry's date and time information with the most recent values
Context: A duplicate disposition code is identified as a Release Code type
GIVEN
A duplicate disposition code is identified as a Release Code type
Applied to: Handle Release Code Duplicate
WHEN
The system processes the duplicate release code
THEN
The system updates the existing entry's date and time information with the most recent values
Context: A duplicate disposition code is identified as a Status Info Code type
GIVEN
A duplicate disposition code is identified as a Status Info Code type
Applied to: Handle Status Info Code Duplicate
WHEN
The system processes the duplicate status info code
THEN
The system keeps the most recent entry and maintains the status information without creating additional duplicates
Context: A duplicate disposition code is identified as a Removal Code type
GIVEN
A duplicate disposition code is identified as a Removal Code type
Applied to: Handle Removal Code Duplicate
WHEN
The system processes the duplicate removal code
THEN
The system removes the older duplicate entry from the status array
Context: A duplicate hold or release code requires timestamp updates
GIVEN
A duplicate hold or release code requires timestamp updates
Applied to: Update Existing Entry Date/Time
WHEN
The system processes the duplicate entry
THEN
The system updates the existing entry's date and time fields with the current processing timestamp
Context: A duplicate status info code is being processed
GIVEN
A duplicate status info code is being processed
Applied to: Keep Most Recent Entry
WHEN
The system compares entry timestamps
THEN
The system keeps the entry with the most recent timestamp and discards older duplicate information
Context: A duplicate removal code is being processed
GIVEN
A duplicate removal code is being processed
Applied to: Remove Older Duplicate
WHEN
The system identifies older duplicate entries in the status array
THEN
The system removes the older duplicate entries and keeps only the most recent removal code
Context: A disposition code is not found as a duplicate in existing status arrays
GIVEN
A disposition code is not found as a duplicate in existing status arrays
Applied to: Add New Code to Array
WHEN
The system processes the new disposition code
THEN
The system adds the new disposition code to the appropriate status array with all required information
Context: Any duplicate disposition code processing action has been completed
GIVEN
Any duplicate disposition code processing action has been completed
Applied to: Log Duplicate Processing Action
WHEN
The system finishes handling the duplicate or new code
THEN
The system logs the processing action taken including code type, action performed, and timestamp information
R-GCX016E-cbl-02051 (+11) File: GCX016E.cbl Status Information Code Processing Logic Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Information Code Processing Logic':
  • Context - a status information code is received for processing:
    For Status Info Code Valid?:
    When the system validates the code against the dc table, then the code is accepted if it exists in the dc table, otherwise it is rejected as invalid.
  • Context - a status information code needs validation:
    For Validate Against DC Table:
    When the system searches the dc table for the code, then the lookup returns success if code exists or failure if code is not found.
  • Context - a validated status information code and existing status arrays:
    For Code Already Exists?:
    When the system searches all status arrays for the code, then the search returns true if code exists in any array, false if code is not found.
  • Context - a status array and a new status information code to be added:
    For Array Full?:
    When the system checks the current array size against maximum capacity, then the check returns true if array is at maximum capacity, false if space is available.
  • Context - a status array with available capacity and a new status information code:
    For Find Insertion Position:
    When the system determines the insertion position based on array sequence rules, then the position is identified where the code should be inserted to maintain proper array order.
  • Context - a validated status information code and determined insertion position:
    For Insert Status Info Code:
    When the system inserts the code into the status array, then the code is successfully added to the array at the specified position.
  • Context - a status array with a newly inserted status information code:
    For Update Array Sequence:
    When the system updates the array sequence numbers, then all sequence numbers are properly maintained to reflect the current array state.
  • Context - a successfully inserted status information code:
    For Set Status Info Flag:
    When the system sets the status information flag, then the flag is set to indicate status information processing has occurred.
  • Context - a successfully processed status information code:
    For Log Status Addition:
    When the system logs the status addition activity, then the activity is recorded with relevant details for audit trail.
  • Context - a status information code that already exists in the status arrays:
    For Skip Duplicate Code:
    When the system detects the duplicate code, then the processing is skipped and no duplicate entry is created.
  • Context - a status information code that fails validation:
    For Generate Error Message:
    When the system processes the invalid code, then an appropriate error message is generated indicating the code is invalid.
  • Context - a status array at maximum capacity and a new status information code to add:
    For Array Capacity Error:
    When the system attempts to add the code to the full array, then an array capacity error is generated and processing is terminated.
👨‍💻 Technical ACs (Gherkin)
Context: A status information code is received for processing
GIVEN
A status information code is received for processing
Applied to: Status Info Code Valid?
WHEN
The system validates the code against the DC table
THEN
The code is accepted if it exists in the DC table, otherwise it is rejected as invalid
Context: A status information code needs validation
GIVEN
A status information code needs validation
Applied to: Validate Against DC Table
WHEN
The system searches the DC table for the code
THEN
The lookup returns success if code exists or failure if code is not found
Context: A validated status information code and existing status arrays
GIVEN
A validated status information code and existing status arrays
Applied to: Code Already Exists?
WHEN
The system searches all status arrays for the code
THEN
The search returns true if code exists in any array, false if code is not found
Context: A status array and a new status information code to be added
GIVEN
A status array and a new status information code to be added
Applied to: Array Full?
WHEN
The system checks the current array size against maximum capacity
THEN
The check returns true if array is at maximum capacity, false if space is available
Context: A status array with available capacity and a new status information code
GIVEN
A status array with available capacity and a new status information code
Applied to: Find Insertion Position
WHEN
The system determines the insertion position based on array sequence rules
THEN
The position is identified where the code should be inserted to maintain proper array order
Context: A validated status information code and determined insertion position
GIVEN
A validated status information code and determined insertion position
Applied to: Insert Status Info Code
WHEN
The system inserts the code into the status array
THEN
The code is successfully added to the array at the specified position
Context: A status array with a newly inserted status information code
GIVEN
A status array with a newly inserted status information code
Applied to: Update Array Sequence
WHEN
The system updates the array sequence numbers
THEN
All sequence numbers are properly maintained to reflect the current array state
Context: A successfully inserted status information code
GIVEN
A successfully inserted status information code
Applied to: Set Status Info Flag
WHEN
The system sets the status information flag
THEN
The flag is set to indicate status information processing has occurred
Context: A successfully processed status information code
GIVEN
A successfully processed status information code
Applied to: Log Status Addition
WHEN
The system logs the status addition activity
THEN
The activity is recorded with relevant details for audit trail
Context: A status information code that already exists in the status arrays
GIVEN
A status information code that already exists in the status arrays
Applied to: Skip Duplicate Code
WHEN
The system detects the duplicate code
THEN
The processing is skipped and no duplicate entry is created
Context: A status information code that fails validation
GIVEN
A status information code that fails validation
Applied to: Generate Error Message
WHEN
The system processes the invalid code
THEN
An appropriate error message is generated indicating the code is invalid
Context: A status array at maximum capacity and a new status information code to add
GIVEN
A status array at maximum capacity and a new status information code to add
Applied to: Array Capacity Error
WHEN
The system attempts to add the code to the full array
THEN
An array capacity error is generated and processing is terminated
R-GCX016E-cbl-02063 (+11) File: GCX016E.cbl Disposition Code Removal Processing Logic Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Removal Processing Logic':
  • Context - a disposition code removal request is received:
    For Validate Disposition Code Format:
    When the system validates the disposition code format, then the disposition code must meet format requirements to proceed with removal processing.
    For Generate Error - Invalid Code Format:
    When the disposition code format validation fails, then an error message must be generated indicating invalid code format and processing must terminate.
  • Context - a valid disposition code is provided for removal:
    For Search Status Array for Matching Code:
    When the system searches the status array for the matching disposition code, then the disposition code must exist in the status array to proceed with removal.
  • Context - a disposition code exists in the status array:
    For Validate Removal Authority:
    When the system checks removal authorization for the requesting entity, then the requesting entity must have proper authorization to remove the disposition code.
    For Generate Error - Unauthorized Removal:
    When the requesting entity lacks proper removal authorization, then an error message must be generated indicating unauthorized removal attempt and processing must terminate.
  • Context - authorization is confirmed for disposition code removal:
    For Mark Disposition Code for Removal:
    When the system removes the disposition code from the status array, then the disposition code is marked for removal and remaining array elements are shifted to fill the gap.
  • Context - a disposition code has been removed from the status array:
    For Update Array Sequence Numbers:
    When the system updates the array structure, then all remaining disposition codes must have their sequence numbers updated to maintain proper ordering.
  • Context - a disposition code has been successfully removed from the status array:
    For Log Removal Action:
    When the system logs the removal action, then an audit log entry must be created with removal details including code, timestamp, and requesting entity.
  • Context - a disposition code removal has been logged:
    For Generate Removal Confirmation:
    When the system generates removal confirmation, then a confirmation message must be created and sent to appropriate recipients confirming the successful removal.
  • Context - a disposition code has been removed and confirmation generated:
    For Update Cargo Status:
    When the system updates the cargo status, then the cargo status must be recalculated based on the remaining disposition codes in the status array.
  • Context - the cargo status has been updated after disposition code removal:
    For Send Status Change Notification:
    When the system sends status change notifications, then notifications must be sent to all relevant parties including brokers, freight forwarders, and customs officials.
  • Context - a valid format disposition code is provided for removal:
    For Generate Error - Code Not Found:
    When the disposition code is not found in the status array, then an error message must be generated indicating code not found and processing must terminate.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code removal request is received
GIVEN
A disposition code removal request is received
Applied to: Validate Disposition Code Format
WHEN
The system validates the disposition code format
THEN
The disposition code must meet format requirements to proceed with removal processing
Applied to: Generate Error - Invalid Code Format
WHEN
The disposition code format validation fails
THEN
An error message must be generated indicating invalid code format and processing must terminate
Context: A valid disposition code is provided for removal
GIVEN
A valid disposition code is provided for removal
Applied to: Search Status Array for Matching Code
WHEN
The system searches the status array for the matching disposition code
THEN
The disposition code must exist in the status array to proceed with removal
Context: A disposition code exists in the status array
GIVEN
A disposition code exists in the status array
Applied to: Validate Removal Authority
WHEN
The system checks removal authorization for the requesting entity
THEN
The requesting entity must have proper authorization to remove the disposition code
Applied to: Generate Error - Unauthorized Removal
WHEN
The requesting entity lacks proper removal authorization
THEN
An error message must be generated indicating unauthorized removal attempt and processing must terminate
Context: Authorization is confirmed for disposition code removal
GIVEN
Authorization is confirmed for disposition code removal
Applied to: Mark Disposition Code for Removal
WHEN
The system removes the disposition code from the status array
THEN
The disposition code is marked for removal and remaining array elements are shifted to fill the gap
Context: A disposition code has been removed from the status array
GIVEN
A disposition code has been removed from the status array
Applied to: Update Array Sequence Numbers
WHEN
The system updates the array structure
THEN
All remaining disposition codes must have their sequence numbers updated to maintain proper ordering
Context: A disposition code has been successfully removed from the status array
GIVEN
A disposition code has been successfully removed from the status array
Applied to: Log Removal Action
WHEN
The system logs the removal action
THEN
An audit log entry must be created with removal details including code, timestamp, and requesting entity
Context: A disposition code removal has been logged
GIVEN
A disposition code removal has been logged
Applied to: Generate Removal Confirmation
WHEN
The system generates removal confirmation
THEN
A confirmation message must be created and sent to appropriate recipients confirming the successful removal
Context: A disposition code has been removed and confirmation generated
GIVEN
A disposition code has been removed and confirmation generated
Applied to: Update Cargo Status
WHEN
The system updates the cargo status
THEN
The cargo status must be recalculated based on the remaining disposition codes in the status array
Context: The cargo status has been updated after disposition code removal
GIVEN
The cargo status has been updated after disposition code removal
Applied to: Send Status Change Notification
WHEN
The system sends status change notifications
THEN
Notifications must be sent to all relevant parties including brokers, freight forwarders, and customs officials
Context: A valid format disposition code is provided for removal
GIVEN
A valid format disposition code is provided for removal
Applied to: Generate Error - Code Not Found
WHEN
The disposition code is not found in the status array
THEN
An error message must be generated indicating code not found and processing must terminate
R-GCX016E-cbl-02075 (+13) File: GCX016E.cbl Release Request Processing Logic Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Request Processing Logic':
  • Context - a release request has been received for a cargo:
    For Check Current Status Array:
    When the system needs to process the release request, then the system must retrieve and examine the current status array from cargo status segments to identify existing disposition codes.
  • Context - the current status array has been retrieved for a cargo:
    For Search for Existing Release Codes:
    When processing a new release request, then the system must search through all disposition codes in the status array to identify existing release codes.
  • Context - existing release codes have been found in the status array:
    For Remove Existing Release Codes:
    When processing a new release request, then the system must remove all existing release disposition codes from the status array before adding the new release code.
  • Context - a release request is being processed:
    For Search for Conflicting Hold Codes:
    When the system has processed existing release codes, then the system must search the status array for hold disposition codes that conflict with the release action.
  • Context - conflicting hold codes have been identified in the status array:
    For Remove Conflicting Hold Codes:
    When processing a release request, then the system must remove all conflicting hold disposition codes from the status array to allow the release to proceed.
  • Context - a new release disposition code needs to be added:
    For Validate New Release Disposition Code:
    When the system has cleared conflicting codes from the status array, then the system must validate the new release disposition code exists in the disposition code table and is classified as a valid release code.
  • Context - the new release disposition code has been validated as correct:
    For Add New Release Disposition Code to Status Array:
    When the status array has been cleared of conflicting codes, then the system must add the new release disposition code to the status array with appropriate sequence number and occurrence data.
  • Context - a new release disposition code has been added to the status array:
    For Update Status Array Sequence:
    When the status array structure needs to be maintained, then the system must update sequence numbers and occurrence counts to maintain proper status array integrity.
  • Context - a release disposition code has been added to the status array:
    For Calculate Release Quantity Impact:
    When the release quantity needs to be determined, then the system must calculate the quantity impact of the release code on the total cargo release amount.
  • Context - release quantity impact has been calculated:
    For Set Release Status Flags:
    When the cargo status needs to be updated, then the system must set appropriate release status flags to reflect the current release state of the cargo.
  • Context - release status flags have been set successfully:
    For Generate Release Notification:
    When stakeholders need to be notified of the release, then the system must generate release notifications to appropriate parties including brokers and freight forwarders.
  • Context - release notifications have been generated:
    For Log Release Request Action:
    When the release request processing is complete, then the system must log the release request action with timestamp and details for audit trail purposes.
  • Context - a release disposition code has failed validation:
    For Generate Error Message:
    When the code is not found in the disposition code table or is not a valid release code, then the system must generate an error message indicating the invalid release disposition code.
  • Context - an error message has been generated for invalid release code:
    For Reject Release Request:
    When the release request cannot be processed due to validation failure, then the system must reject the release request and maintain the original cargo status without any changes.
👨‍💻 Technical ACs (Gherkin)
Context: A release request has been received for a cargo
GIVEN
A release request has been received for a cargo
Applied to: Check Current Status Array
WHEN
The system needs to process the release request
THEN
The system must retrieve and examine the current status array from cargo status segments to identify existing disposition codes
Context: The current status array has been retrieved for a cargo
GIVEN
The current status array has been retrieved for a cargo
Applied to: Search for Existing Release Codes
WHEN
Processing a new release request
THEN
The system must search through all disposition codes in the status array to identify existing release codes
Context: Existing release codes have been found in the status array
GIVEN
Existing release codes have been found in the status array
Applied to: Remove Existing Release Codes
WHEN
Processing a new release request
THEN
The system must remove all existing release disposition codes from the status array before adding the new release code
Context: A release request is being processed
GIVEN
A release request is being processed
Applied to: Search for Conflicting Hold Codes
WHEN
The system has processed existing release codes
THEN
The system must search the status array for hold disposition codes that conflict with the release action
Context: Conflicting hold codes have been identified in the status array
GIVEN
Conflicting hold codes have been identified in the status array
Applied to: Remove Conflicting Hold Codes
WHEN
Processing a release request
THEN
The system must remove all conflicting hold disposition codes from the status array to allow the release to proceed
Context: A new release disposition code needs to be added
GIVEN
A new release disposition code needs to be added
Applied to: Validate New Release Disposition Code
WHEN
The system has cleared conflicting codes from the status array
THEN
The system must validate the new release disposition code exists in the disposition code table and is classified as a valid release code
Context: The new release disposition code has been validated as correct
GIVEN
The new release disposition code has been validated as correct
Applied to: Add New Release Disposition Code to Status Array
WHEN
The status array has been cleared of conflicting codes
THEN
The system must add the new release disposition code to the status array with appropriate sequence number and occurrence data
Context: A new release disposition code has been added to the status array
GIVEN
A new release disposition code has been added to the status array
Applied to: Update Status Array Sequence
WHEN
The status array structure needs to be maintained
THEN
The system must update sequence numbers and occurrence counts to maintain proper status array integrity
Context: A release disposition code has been added to the status array
GIVEN
A release disposition code has been added to the status array
Applied to: Calculate Release Quantity Impact
WHEN
The release quantity needs to be determined
THEN
The system must calculate the quantity impact of the release code on the total cargo release amount
Context: Release quantity impact has been calculated
GIVEN
Release quantity impact has been calculated
Applied to: Set Release Status Flags
WHEN
The cargo status needs to be updated
THEN
The system must set appropriate release status flags to reflect the current release state of the cargo
Context: Release status flags have been set successfully
GIVEN
Release status flags have been set successfully
Applied to: Generate Release Notification
WHEN
Stakeholders need to be notified of the release
THEN
The system must generate release notifications to appropriate parties including brokers and freight forwarders
Context: Release notifications have been generated
GIVEN
Release notifications have been generated
Applied to: Log Release Request Action
WHEN
The release request processing is complete
THEN
The system must log the release request action with timestamp and details for audit trail purposes
Context: A release disposition code has failed validation
GIVEN
A release disposition code has failed validation
Applied to: Generate Error Message
WHEN
The code is not found in the disposition code table or is not a valid release code
THEN
The system must generate an error message indicating the invalid release disposition code
Context: An error message has been generated for invalid release code
GIVEN
An error message has been generated for invalid release code
Applied to: Reject Release Request
WHEN
The release request cannot be processed due to validation failure
THEN
The system must reject the release request and maintain the original cargo status without any changes
R-GCX016E-cbl-02089 (+12) File: GCX016E.cbl Manual Release Processing Logic Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manual Release Processing Logic':
  • Context - a manual release request is received for a cargo:
    For Validate Manual Release Request:
    When the system validates the request parameters including disposition code format, cargo identification, and request authorization, then the system determines if the request is valid and can proceed with manual release processing.
  • Context - a cargo has an existing status array with disposition codes:
    For Conflicting Codes Found?:
    When a manual release request is processed and the system searches for conflicting hold or restriction codes, then the system identifies any existing codes that must be removed before applying the manual release.
  • Context - conflicting hold or restriction codes exist in the cargo status array:
    For Remove Existing Hold/Restriction Codes:
    When a manual release is being processed, then the system removes all conflicting disposition codes from the status array to clear the path for manual release.
  • Context - the cargo status array has been cleared of conflicting codes:
    For Add Manual Release Disposition Code:
    When a manual release is being applied, then the system adds the manual release disposition code (mrl) to the status array with appropriate sequence number and metadata.
  • Context - disposition codes have been added or removed from the cargo status array:
    For Update Status Array Sequence:
    When the manual release processing updates the array, then the system updates sequence numbers to maintain proper ordering and removes any gaps in the sequence.
  • Context - a manual release has been successfully applied to a cargo:
    For Log Manual Release Action:
    When the system completes the manual release processing, then the system logs the manual release action with timestamp, user information, and cargo details for audit purposes.
  • Context - the cargo status array has been updated with manual release disposition code:
    For Cargo Fully Released?:
    When the system evaluates the final status of the cargo, then the system determines if the cargo is fully released by checking for any remaining hold or restriction codes and validating release quantities.
  • Context - the cargo status evaluation determines the cargo is fully released:
    For Set Cargo Release Status:
    When manual release processing is completed, then the system sets the cargo status to 'relsd' (released) and updates all related status flags.
  • Context - a cargo has been set to released status through manual release:
    For Calculate Release Quantities:
    When the system processes the release quantities, then the system calculates the total released quantity based on the manual release disposition and updates the cargo record with the new released amount.
  • Context - a cargo has been successfully manually released with updated quantities:
    For Generate Release Notification:
    When the system completes the release processing, then the system generates and sends release notifications to brokers, freight forwarders, and other stakeholders via merlin messaging system.
  • Context - manual release processing has been completed for a cargo:
    For Update Cargo Status Flags:
    When the system finalizes the cargo status changes, then the system updates all cargo status flags including hold indicators, release flags, and processing status markers to reflect the current state.
  • Context - manual release processing has been successfully completed:
    For Create Audit Trail Entry:
    When the system finalizes all cargo updates, then the system creates detailed audit trail entries including before/after status, user identification, timestamp, and transaction details for compliance and tracking purposes.
  • Context - a manual release request fails validation or processing:
    For Generate Error Message:
    When the system encounters an error condition, then the system generates a specific error message describing the failure reason and routes it to the appropriate error handling system.
👨‍💻 Technical ACs (Gherkin)
Context: A manual release request is received for a cargo
GIVEN
A manual release request is received for a cargo
Applied to: Validate Manual Release Request
WHEN
The system validates the request parameters including disposition code format, cargo identification, and request authorization
THEN
The system determines if the request is valid and can proceed with manual release processing
Context: A cargo has an existing status array with disposition codes
GIVEN
A cargo has an existing status array with disposition codes
Applied to: Conflicting Codes Found?
WHEN
A manual release request is processed and the system searches for conflicting hold or restriction codes
THEN
The system identifies any existing codes that must be removed before applying the manual release
Context: Conflicting hold or restriction codes exist in the cargo status array
GIVEN
Conflicting hold or restriction codes exist in the cargo status array
Applied to: Remove Existing Hold/Restriction Codes
WHEN
A manual release is being processed
THEN
The system removes all conflicting disposition codes from the status array to clear the path for manual release
Context: The cargo status array has been cleared of conflicting codes
GIVEN
The cargo status array has been cleared of conflicting codes
Applied to: Add Manual Release Disposition Code
WHEN
A manual release is being applied
THEN
The system adds the manual release disposition code (MRL) to the status array with appropriate sequence number and metadata
Context: Disposition codes have been added or removed from the cargo status array
GIVEN
Disposition codes have been added or removed from the cargo status array
Applied to: Update Status Array Sequence
WHEN
The manual release processing updates the array
THEN
The system updates sequence numbers to maintain proper ordering and removes any gaps in the sequence
Context: A manual release has been successfully applied to a cargo
GIVEN
A manual release has been successfully applied to a cargo
Applied to: Log Manual Release Action
WHEN
The system completes the manual release processing
THEN
The system logs the manual release action with timestamp, user information, and cargo details for audit purposes
Context: The cargo status array has been updated with manual release disposition code
GIVEN
The cargo status array has been updated with manual release disposition code
Applied to: Cargo Fully Released?
WHEN
The system evaluates the final status of the cargo
THEN
The system determines if the cargo is fully released by checking for any remaining hold or restriction codes and validating release quantities
Context: The cargo status evaluation determines the cargo is fully released
GIVEN
The cargo status evaluation determines the cargo is fully released
Applied to: Set Cargo Release Status
WHEN
Manual release processing is completed
THEN
The system sets the cargo status to 'RELSD' (Released) and updates all related status flags
Context: A cargo has been set to released status through manual release
GIVEN
A cargo has been set to released status through manual release
Applied to: Calculate Release Quantities
WHEN
The system processes the release quantities
THEN
The system calculates the total released quantity based on the manual release disposition and updates the cargo record with the new released amount
Context: A cargo has been successfully manually released with updated quantities
GIVEN
A cargo has been successfully manually released with updated quantities
Applied to: Generate Release Notification
WHEN
The system completes the release processing
THEN
The system generates and sends release notifications to brokers, freight forwarders, and other stakeholders via Merlin messaging system
Context: Manual release processing has been completed for a cargo
GIVEN
Manual release processing has been completed for a cargo
Applied to: Update Cargo Status Flags
WHEN
The system finalizes the cargo status changes
THEN
The system updates all cargo status flags including hold indicators, release flags, and processing status markers to reflect the current state
Context: Manual release processing has been successfully completed
GIVEN
Manual release processing has been successfully completed
Applied to: Create Audit Trail Entry
WHEN
The system finalizes all cargo updates
THEN
The system creates detailed audit trail entries including before/after status, user identification, timestamp, and transaction details for compliance and tracking purposes
Context: A manual release request fails validation or processing
GIVEN
A manual release request fails validation or processing
Applied to: Generate Error Message
WHEN
The system encounters an error condition
THEN
The system generates a specific error message describing the failure reason and routes it to the appropriate error handling system
R-GCX016E-cbl-02102 (+14) File: GCX016E.cbl Auto Release Processing Logic Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Auto Release Processing Logic':
  • Context - an auto release request is received with a disposition code:
    For Validate Auto Release Disposition Code:
    When the system validates the disposition code against the disposition code table, then the system confirms the code is valid for auto release processing or rejects invalid codes.
  • Context - a valid auto release disposition code is being processed:
    For Duplicate Auto Release Found?:
    When the system searches the existing status arrays for the same auto release code, then the system identifies if a duplicate auto release code exists and flags it for removal.
  • Context - a duplicate auto release code is found in the status array:
    For Remove Existing Auto Release Code:
    When the system processes the new auto release request, then the system removes the existing auto release code from the status array.
  • Context - any existing duplicate auto release codes have been removed:
    For Add New Auto Release Code to Status Array:
    When the system processes a valid auto release request, then the system adds the new auto release code to the cargo's status array with appropriate sequence and occurrence data.
  • Context - an auto release code has been added to the status array:
    For Cargo Currently Held?:
    When the system evaluates the current cargo status including all active holds, then the system determines if the cargo is currently held and requires release processing or if no release action is needed.
  • Context - cargo is currently held and eligible for auto release:
    For Calculate Release Impact on Quantities:
    When the system calculates the impact on release quantities based on current held amounts and requested release quantities, then the system determines the quantity impact and whether full or partial release is possible.
  • Context - release quantity impact has been calculated:
    For Full Release Possible?:
    When the system evaluates if all cargo quantities can be fully released without restrictions, then the system determines if full release is feasible or if partial release processing is required.
  • Context - full release is determined to be possible:
    For Set Cargo Status to Released:
    When the system processes the auto release request, then the system sets the cargo status to released and updates all related status indicators.
  • Context - auto release processing has determined the release impact:
    For Update Release Quantities:
    When the system updates cargo quantities for either full or partial release, then the system updates released quantities, remaining held quantities, and total quantity balances.
  • Context - auto release processing has been completed with quantity updates:
    For Generate Auto Release Notification:
    When the system generates notifications for the auto release action, then the system creates merlin messages or email notifications to inform relevant parties of the auto release.
  • Context - auto release notifications have been generated:
    For Log Auto Release Action:
    When the system logs the auto release action, then the system creates audit records with cargo details, release quantities, and timestamp information.
  • Context - auto release action has been logged:
    For Update Status Array in Database:
    When the system updates the database with the modified status array, then the system replaces the cargo's s09 status segments with the updated status array information.
  • Context - status array has been updated in the database:
    For Trigger GCCIIS Status Update:
    When the system triggers gcciis integration for status synchronization, then the system calls gcciis with appropriate cargo status information for external system updates.
  • Context - an auto release request is received with an invalid disposition code:
    For Generate Error Message:
    When the disposition code validation fails, then the system generates an error message indicating invalid disposition code and stops auto release processing.
  • Context - auto release code has been added to status array:
    For Skip Auto Release Processing:
    When the system determines cargo is not currently held, then the system skips release quantity processing and proceeds to completion without release actions.
👨‍💻 Technical ACs (Gherkin)
Context: An auto release request is received with a disposition code
GIVEN
An auto release request is received with a disposition code
Applied to: Validate Auto Release Disposition Code
WHEN
The system validates the disposition code against the disposition code table
THEN
The system confirms the code is valid for auto release processing or rejects invalid codes
Context: A valid auto release disposition code is being processed
GIVEN
A valid auto release disposition code is being processed
Applied to: Duplicate Auto Release Found?
WHEN
The system searches the existing status arrays for the same auto release code
THEN
The system identifies if a duplicate auto release code exists and flags it for removal
Context: A duplicate auto release code is found in the status array
GIVEN
A duplicate auto release code is found in the status array
Applied to: Remove Existing Auto Release Code
WHEN
The system processes the new auto release request
THEN
The system removes the existing auto release code from the status array
Context: Any existing duplicate auto release codes have been removed
GIVEN
Any existing duplicate auto release codes have been removed
Applied to: Add New Auto Release Code to Status Array
WHEN
The system processes a valid auto release request
THEN
The system adds the new auto release code to the cargo's status array with appropriate sequence and occurrence data
Context: An auto release code has been added to the status array
GIVEN
An auto release code has been added to the status array
Applied to: Cargo Currently Held?
WHEN
The system evaluates the current cargo status including all active holds
THEN
The system determines if the cargo is currently held and requires release processing or if no release action is needed
Context: Cargo is currently held and eligible for auto release
GIVEN
Cargo is currently held and eligible for auto release
Applied to: Calculate Release Impact on Quantities
WHEN
The system calculates the impact on release quantities based on current held amounts and requested release quantities
THEN
The system determines the quantity impact and whether full or partial release is possible
Context: Release quantity impact has been calculated
GIVEN
Release quantity impact has been calculated
Applied to: Full Release Possible?
WHEN
The system evaluates if all cargo quantities can be fully released without restrictions
THEN
The system determines if full release is feasible or if partial release processing is required
Context: Full release is determined to be possible
GIVEN
Full release is determined to be possible
Applied to: Set Cargo Status to Released
WHEN
The system processes the auto release request
THEN
The system sets the cargo status to released and updates all related status indicators
Context: Auto release processing has determined the release impact
GIVEN
Auto release processing has determined the release impact
Applied to: Update Release Quantities
WHEN
The system updates cargo quantities for either full or partial release
THEN
The system updates released quantities, remaining held quantities, and total quantity balances
Context: Auto release processing has been completed with quantity updates
GIVEN
Auto release processing has been completed with quantity updates
Applied to: Generate Auto Release Notification
WHEN
The system generates notifications for the auto release action
THEN
The system creates Merlin messages or email notifications to inform relevant parties of the auto release
Context: Auto release notifications have been generated
GIVEN
Auto release notifications have been generated
Applied to: Log Auto Release Action
WHEN
The system logs the auto release action
THEN
The system creates audit records with cargo details, release quantities, and timestamp information
Context: Auto release action has been logged
GIVEN
Auto release action has been logged
Applied to: Update Status Array in Database
WHEN
The system updates the database with the modified status array
THEN
The system replaces the cargo's S09 status segments with the updated status array information
Context: Status array has been updated in the database
GIVEN
Status array has been updated in the database
Applied to: Trigger GCCIIS Status Update
WHEN
The system triggers GCCIIS integration for status synchronization
THEN
The system calls GCCIIS with appropriate cargo status information for external system updates
Context: An auto release request is received with an invalid disposition code
GIVEN
An auto release request is received with an invalid disposition code
Applied to: Generate Error Message
WHEN
The disposition code validation fails
THEN
The system generates an error message indicating invalid disposition code and stops auto release processing
Context: Auto release code has been added to status array
GIVEN
Auto release code has been added to status array
Applied to: Skip Auto Release Processing
WHEN
The system determines cargo is not currently held
THEN
The system skips release quantity processing and proceeds to completion without release actions
R-GCX016E-cbl-02117 (+10) File: GCX016E.cbl Disposition Code Table Lookup and Validation Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Table Lookup and Validation':
  • Context - a disposition code needs to be validated:
    For Call GCCTBIO to Access DC Table:
    When the system calls gcctbio to access the dc table, then the dc table is accessed and made available for code lookup.
  • Context - a disposition code from x4 or v9 segment:
    For Disposition Code Found in Table?:
    When the system searches for the code in the dc table, then the system determines if the code exists and is valid for processing.
  • Context - a disposition code exists in the dc table:
    For Retrieve Disposition Code Information:
    When the code lookup is successful, then the system retrieves all associated code information including description and processing rules.
  • Context - disposition code information has been retrieved from the table:
    For Extract Code Description:
    When the system processes the code information, then the code description is extracted and made available for use in messages and processing.
  • Context - disposition code information has been retrieved and description extracted:
    For Extract Processing Rules:
    When the system processes the code details, then the processing rules and business logic for the code are extracted and prepared for execution.
  • Context - disposition code has been successfully validated and information extracted:
    For Set Valid Code Flag:
    When all code validation steps are complete, then the system sets the valid code flag to allow continued processing.
  • Context - a disposition code is not found in the dc table:
    For Generate Merlin Error Message:
    When the code validation fails, then the system generates a merlin error message indicating the unknown disposition code.
    For Set Invalid Code Flag:
    When the error message has been generated, then the system sets the invalid code flag to prevent normal processing.
  • Context - an invalid disposition code has been identified and flagged:
    For Log Unknown Code Error:
    When the invalid code flag is set, then the system logs the unknown code error with relevant details for audit trail.
  • Context - a disposition code has been validated and marked as valid:
    For Continue with Code Processing:
    When the valid code flag is set, then the system continues with normal disposition code processing using the extracted information.
  • Context - a disposition code has been identified as invalid and logged:
    For Skip Code Processing:
    When the invalid code flag is set and error is logged, then the system skips normal disposition code processing to prevent further errors.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code needs to be validated
GIVEN
A disposition code needs to be validated
Applied to: Call GCCTBIO to Access DC Table
WHEN
The system calls GCCTBIO to access the DC table
THEN
The DC table is accessed and made available for code lookup
Context: A disposition code from X4 or V9 segment
GIVEN
A disposition code from X4 or V9 segment
Applied to: Disposition Code Found in Table?
WHEN
The system searches for the code in the DC table
THEN
The system determines if the code exists and is valid for processing
Context: A disposition code exists in the DC table
GIVEN
A disposition code exists in the DC table
Applied to: Retrieve Disposition Code Information
WHEN
The code lookup is successful
THEN
The system retrieves all associated code information including description and processing rules
Context: Disposition code information has been retrieved from the table
GIVEN
Disposition code information has been retrieved from the table
Applied to: Extract Code Description
WHEN
The system processes the code information
THEN
The code description is extracted and made available for use in messages and processing
Context: Disposition code information has been retrieved and description extracted
GIVEN
Disposition code information has been retrieved and description extracted
Applied to: Extract Processing Rules
WHEN
The system processes the code details
THEN
The processing rules and business logic for the code are extracted and prepared for execution
Context: Disposition code has been successfully validated and information extracted
GIVEN
Disposition code has been successfully validated and information extracted
Applied to: Set Valid Code Flag
WHEN
All code validation steps are complete
THEN
The system sets the valid code flag to allow continued processing
Context: A disposition code is not found in the DC table
GIVEN
A disposition code is not found in the DC table
Applied to: Generate Merlin Error Message
WHEN
The code validation fails
THEN
The system generates a Merlin error message indicating the unknown disposition code
Applied to: Set Invalid Code Flag
WHEN
The error message has been generated
THEN
The system sets the invalid code flag to prevent normal processing
Context: An invalid disposition code has been identified and flagged
GIVEN
An invalid disposition code has been identified and flagged
Applied to: Log Unknown Code Error
WHEN
The invalid code flag is set
THEN
The system logs the unknown code error with relevant details for audit trail
Context: A disposition code has been validated and marked as valid
GIVEN
A disposition code has been validated and marked as valid
Applied to: Continue with Code Processing
WHEN
The valid code flag is set
THEN
The system continues with normal disposition code processing using the extracted information
Context: A disposition code has been identified as invalid and logged
GIVEN
A disposition code has been identified as invalid and logged
Applied to: Skip Code Processing
WHEN
The invalid code flag is set and error is logged
THEN
The system skips normal disposition code processing to prevent further errors
R-GCX016E-cbl-02128 (+11) File: GCX016E.cbl Counterpart Disposition Code Detection and Removal Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Counterpart Disposition Code Detection and Removal':
  • Context - a new disposition code is being processed for a cargo and the cargo has an existing status array with disposition codes:
    For Check for Conflicting Codes?:
    When the system evaluates the new disposition code against existing codes, then the system identifies if there are any conflicting or counterpart codes that need to be addressed.
  • Context - a cargo has existing hold disposition codes in its status array and a new release disposition code is being processed:
    For Hold vs Release Conflict?:
    When the system checks for hold vs release conflicts, then the system identifies the conflicting hold codes that should be removed when the release code is applied.
  • Context - a cargo has existing proceed disposition codes in its status array and a new hold disposition code is being processed or a cargo has existing hold codes and a new proceed code is being processed:
    For Proceed vs Hold Conflict?:
    When the system checks for proceed vs hold conflicts, then the system identifies the conflicting codes that should be removed based on the business precedence rules.
  • Context - a cargo has existing seizure disposition codes in its status array and a new release disposition code is being processed:
    For Seizure vs Release Conflict?:
    When the system checks for seizure vs release conflicts, then the system identifies the conflicting seizure codes that should be removed when the release code is applied.
  • Context - a cargo has existing arrival disposition codes in its status array and a new cancellation disposition code is being processed or a cargo has existing cancellation codes and a new arrival code is being processed:
    For Arrival vs Cancel Conflict?:
    When the system checks for arrival vs cancel conflicts, then the system identifies the conflicting codes that should be removed based on the most recent action.
  • Context - a conflicting disposition code has been identified in the cargo status array and business rules define the precedence between the codes:
    For Code Should Be Removed?:
    When the system applies business rules to determine code precedence, then the system decides whether the existing conflicting code should be removed to allow the new code to be processed.
  • Context - a conflicting disposition code has been identified for removal and the code exists in the cargo status array:
    For Mark Counterpart Code for Removal:
    When the system processes the removal decision, then the system marks the conflicting code for removal while preserving other status array elements.
  • Context - disposition codes have been marked for removal from the cargo status array:
    For Remove Conflicting Code from Array:
    When the system executes the removal process, then the system removes the marked codes from the status array and maintains the integrity of remaining array elements.
  • Context - disposition codes have been removed from the cargo status array creating gaps in the array structure:
    For Reorganize Status Array:
    When the system reorganizes the array, then the system compacts the array by moving remaining elements to eliminate gaps and preserves the logical order of disposition codes.
  • Context - the cargo status array has been reorganized after removing conflicting codes:
    For Update Array Sequence Numbers:
    When the system updates sequence numbers, then the system assigns consecutive sequence numbers to all remaining disposition codes in the array starting from 1.
  • Context - the cargo status array has been modified through counterpart code removal and reorganization:
    For Validate Array Integrity:
    When the system validates array integrity, then the system confirms that all remaining disposition codes are valid and sequence numbers are consecutive and no business rule conflicts remain in the array.
  • Context - a conflicting disposition code has been removed from the cargo status array:
    For Log Removal Action:
    When the system logs the removal action, then the system records the removed disposition code details and the reason for removal and the timestamp of the action for audit trail purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A new disposition code is being processed for a cargo AND the cargo has an existing status array with disposition codes
GIVEN
A new disposition code is being processed for a cargo AND the cargo has an existing status array with disposition codes
Applied to: Check for Conflicting Codes?
WHEN
The system evaluates the new disposition code against existing codes
THEN
The system identifies if there are any conflicting or counterpart codes that need to be addressed
Context: A cargo has existing hold disposition codes in its status array AND a new release disposition code is being processed
GIVEN
A cargo has existing hold disposition codes in its status array AND a new release disposition code is being processed
Applied to: Hold vs Release Conflict?
WHEN
The system checks for hold vs release conflicts
THEN
The system identifies the conflicting hold codes that should be removed when the release code is applied
Context: A cargo has existing proceed disposition codes in its status array AND a new hold disposition code is being processed OR a cargo has existing hold codes AND a new proceed code is being processed
GIVEN
A cargo has existing proceed disposition codes in its status array AND a new hold disposition code is being processed OR a cargo has existing hold codes AND a new proceed code is being processed
Applied to: Proceed vs Hold Conflict?
WHEN
The system checks for proceed vs hold conflicts
THEN
The system identifies the conflicting codes that should be removed based on the business precedence rules
Context: A cargo has existing seizure disposition codes in its status array AND a new release disposition code is being processed
GIVEN
A cargo has existing seizure disposition codes in its status array AND a new release disposition code is being processed
Applied to: Seizure vs Release Conflict?
WHEN
The system checks for seizure vs release conflicts
THEN
The system identifies the conflicting seizure codes that should be removed when the release code is applied
Context: A cargo has existing arrival disposition codes in its status array AND a new cancellation disposition code is being processed OR a cargo has existing cancellation codes AND a new arrival code is being processed
GIVEN
A cargo has existing arrival disposition codes in its status array AND a new cancellation disposition code is being processed OR a cargo has existing cancellation codes AND a new arrival code is being processed
Applied to: Arrival vs Cancel Conflict?
WHEN
The system checks for arrival vs cancel conflicts
THEN
The system identifies the conflicting codes that should be removed based on the most recent action
Context: A conflicting disposition code has been identified in the cargo status array AND business rules define the precedence between the codes
GIVEN
A conflicting disposition code has been identified in the cargo status array AND business rules define the precedence between the codes
Applied to: Code Should Be Removed?
WHEN
The system applies business rules to determine code precedence
THEN
The system decides whether the existing conflicting code should be removed to allow the new code to be processed
Context: A conflicting disposition code has been identified for removal AND the code exists in the cargo status array
GIVEN
A conflicting disposition code has been identified for removal AND the code exists in the cargo status array
Applied to: Mark Counterpart Code for Removal
WHEN
The system processes the removal decision
THEN
The system marks the conflicting code for removal while preserving other status array elements
Context: Disposition codes have been marked for removal from the cargo status array
GIVEN
Disposition codes have been marked for removal from the cargo status array
Applied to: Remove Conflicting Code from Array
WHEN
The system executes the removal process
THEN
The system removes the marked codes from the status array AND maintains the integrity of remaining array elements
Context: Disposition codes have been removed from the cargo status array creating gaps in the array structure
GIVEN
Disposition codes have been removed from the cargo status array creating gaps in the array structure
Applied to: Reorganize Status Array
WHEN
The system reorganizes the array
THEN
The system compacts the array by moving remaining elements to eliminate gaps AND preserves the logical order of disposition codes
Context: The cargo status array has been reorganized after removing conflicting codes
GIVEN
The cargo status array has been reorganized after removing conflicting codes
Applied to: Update Array Sequence Numbers
WHEN
The system updates sequence numbers
THEN
The system assigns consecutive sequence numbers to all remaining disposition codes in the array starting from 1
Context: The cargo status array has been modified through counterpart code removal and reorganization
GIVEN
The cargo status array has been modified through counterpart code removal and reorganization
Applied to: Validate Array Integrity
WHEN
The system validates array integrity
THEN
The system confirms that all remaining disposition codes are valid AND sequence numbers are consecutive AND no business rule conflicts remain in the array
Context: A conflicting disposition code has been removed from the cargo status array
GIVEN
A conflicting disposition code has been removed from the cargo status array
Applied to: Log Removal Action
WHEN
The system logs the removal action
THEN
The system records the removed disposition code details AND the reason for removal AND the timestamp of the action for audit trail purposes
R-GCX016E-cbl-02140 (+15) File: GCX016E.cbl Status Array Management and Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Management and Processing':
  • Context - a cargo record exists in the system:
    For Retrieve S09 Status Segments from Database:
    When the system needs to process disposition codes for the cargo, then the system retrieves all s09 status segments associated with the cargo from the database.
  • Context - a cargo record has no existing s09 status segments in the database:
    For Initialize Empty Status Array:
    When the system attempts to retrieve status segments, then the system initializes empty s09a status arrays with zero entries and resets sequence counters.
  • Context - s09 status segments exist in the database for a cargo:
    For Populate S09A Status Arrays from Database Segments:
    When the system retrieves the segments successfully, then the system populates s09a status arrays with disposition codes, quantities, entry numbers, and sequence information from the database segments.
  • Context - status segments are populated from database with various sequence numbers:
    For Track Maximum Sequences Fetched:
    When the system processes all retrieved segments, then the system identifies and stores the maximum sequence number found across all status arrays for future sequencing.
  • Context - a new disposition code is received for processing and existing status arrays contain disposition codes:
    For Search for Duplicate Disposition Codes:
    When the system processes the new disposition code, then the system searches all status arrays to determine if the same disposition code with matching entry number and quantity already exists.
  • Context - a duplicate disposition code is found in the status arrays:
    For Handle Duplicate According to Business Rules:
    When the duplicate has matching entry number and quantity, then the system applies business rules such as removal, replacement, or skip processing based on the disposition code type and current cargo status.
  • Context - a new disposition code needs to be added to status arrays and no duplicates exist:
    For Find Insertion Point for Proper Sequencing:
    When the system needs to insert the disposition code, then the system finds the appropriate insertion point to maintain proper sequence numbering and array organization.
  • Context - an insertion point has been determined for a new disposition code:
    For Insert New Disposition Code in Array:
    When the system inserts the disposition code, then the system adds the disposition code with its associated quantity, entry number, and sequence information to the appropriate status array position.
  • Context - a new disposition code has been inserted into the status array:
    For Check for Counterpart Codes to Remove:
    When the system checks for business rule conflicts, then the system identifies any existing disposition codes that are counterparts or conflicts with the newly added code and must be removed.
  • Context - counterpart or conflicting disposition codes are identified in the status arrays:
    For Remove Conflicting Disposition Codes:
    When business rules require their removal, then the system removes the conflicting disposition codes from the status arrays.
  • Context - disposition codes have been removed from status arrays creating gaps:
    For Reorganize Array After Removal:
    When the removal process is complete, then the system reorganizes the arrays by moving remaining entries to eliminate gaps and maintain proper array structure.
  • Context - status arrays have been modified through insertion and removal operations:
    For Validate Array Sequence Numbers:
    When the system validates the array integrity, then the system verifies that sequence numbers are properly ordered and consistent across all status array entries.
  • Context - status arrays have been modified and sequence numbers validated:
    For Update Maximum Sequence Counter:
    When the system completes array processing, then the system updates the maximum sequence counter to reflect the highest sequence number currently in use.
  • Context - status arrays have been processed and are ready for database storage:
    For Convert Status Array Back to Database Format:
    When the system needs to save the updated status information, then the system converts the s09a status arrays back to s09 database segment format with proper structure and sequencing.
  • Context - status arrays have been converted to database format:
    For Replace Status Segments in Database:
    When the system updates the cargo record, then the system replaces the existing s09 status segments in the database with the updated segments containing current disposition code information.
  • Context - a cargo is not a cprs shipment and car identification information is available from n7 segment processing:
    For Update Car ID Information for Non-CPRS Cargo:
    When the system completes status array processing, then the system updates the cargo record with the car id information derived from the equipment initial and number.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Retrieve S09 Status Segments from Database
WHEN
The system needs to process disposition codes for the cargo
THEN
The system retrieves all S09 status segments associated with the cargo from the database
Context: A cargo record has no existing S09 status segments in the database
GIVEN
A cargo record has no existing S09 status segments in the database
Applied to: Initialize Empty Status Array
WHEN
The system attempts to retrieve status segments
THEN
The system initializes empty S09A status arrays with zero entries and resets sequence counters
Context: S09 status segments exist in the database for a cargo
GIVEN
S09 status segments exist in the database for a cargo
Applied to: Populate S09A Status Arrays from Database Segments
WHEN
The system retrieves the segments successfully
THEN
The system populates S09A status arrays with disposition codes, quantities, entry numbers, and sequence information from the database segments
Context: Status segments are populated from database with various sequence numbers
GIVEN
Status segments are populated from database with various sequence numbers
Applied to: Track Maximum Sequences Fetched
WHEN
The system processes all retrieved segments
THEN
The system identifies and stores the maximum sequence number found across all status arrays for future sequencing
Context: A new disposition code is received for processing and existing status arrays contain disposition codes
GIVEN
A new disposition code is received for processing and existing status arrays contain disposition codes
Applied to: Search for Duplicate Disposition Codes
WHEN
The system processes the new disposition code
THEN
The system searches all status arrays to determine if the same disposition code with matching entry number and quantity already exists
Context: A duplicate disposition code is found in the status arrays
GIVEN
A duplicate disposition code is found in the status arrays
Applied to: Handle Duplicate According to Business Rules
WHEN
The duplicate has matching entry number and quantity
THEN
The system applies business rules such as removal, replacement, or skip processing based on the disposition code type and current cargo status
Context: A new disposition code needs to be added to status arrays and no duplicates exist
GIVEN
A new disposition code needs to be added to status arrays and no duplicates exist
Applied to: Find Insertion Point for Proper Sequencing
WHEN
The system needs to insert the disposition code
THEN
The system finds the appropriate insertion point to maintain proper sequence numbering and array organization
Context: An insertion point has been determined for a new disposition code
GIVEN
An insertion point has been determined for a new disposition code
Applied to: Insert New Disposition Code in Array
WHEN
The system inserts the disposition code
THEN
The system adds the disposition code with its associated quantity, entry number, and sequence information to the appropriate status array position
Context: A new disposition code has been inserted into the status array
GIVEN
A new disposition code has been inserted into the status array
Applied to: Check for Counterpart Codes to Remove
WHEN
The system checks for business rule conflicts
THEN
The system identifies any existing disposition codes that are counterparts or conflicts with the newly added code and must be removed
Context: Counterpart or conflicting disposition codes are identified in the status arrays
GIVEN
Counterpart or conflicting disposition codes are identified in the status arrays
Applied to: Remove Conflicting Disposition Codes
WHEN
Business rules require their removal
THEN
The system removes the conflicting disposition codes from the status arrays
Context: Disposition codes have been removed from status arrays creating gaps
GIVEN
Disposition codes have been removed from status arrays creating gaps
Applied to: Reorganize Array After Removal
WHEN
The removal process is complete
THEN
The system reorganizes the arrays by moving remaining entries to eliminate gaps and maintain proper array structure
Context: Status arrays have been modified through insertion and removal operations
GIVEN
Status arrays have been modified through insertion and removal operations
Applied to: Validate Array Sequence Numbers
WHEN
The system validates the array integrity
THEN
The system verifies that sequence numbers are properly ordered and consistent across all status array entries
Context: Status arrays have been modified and sequence numbers validated
GIVEN
Status arrays have been modified and sequence numbers validated
Applied to: Update Maximum Sequence Counter
WHEN
The system completes array processing
THEN
The system updates the maximum sequence counter to reflect the highest sequence number currently in use
Context: Status arrays have been processed and are ready for database storage
GIVEN
Status arrays have been processed and are ready for database storage
Applied to: Convert Status Array Back to Database Format
WHEN
The system needs to save the updated status information
THEN
The system converts the S09A status arrays back to S09 database segment format with proper structure and sequencing
Context: Status arrays have been converted to database format
GIVEN
Status arrays have been converted to database format
Applied to: Replace Status Segments in Database
WHEN
The system updates the cargo record
THEN
The system replaces the existing S09 status segments in the database with the updated segments containing current disposition code information
Context: A cargo is not a CPRS shipment and car identification information is available from N7 segment processing
GIVEN
A cargo is not a CPRS shipment and car identification information is available from N7 segment processing
Applied to: Update Car ID Information for Non-CPRS Cargo
WHEN
The system completes status array processing
THEN
The system updates the cargo record with the car ID information derived from the equipment initial and number
R-GCX016E-cbl-02156 (+13) File: GCX016E.cbl Release Quantity Calculation Logic Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Quantity Calculation Logic':
  • Context - a cargo record exists with release quantity information:
    For Retrieve Current Release Quantity:
    When the system needs to calculate new release quantities, then the current release quantity is retrieved from the cargo record.
  • Context - a disposition code is being processed for a cargo:
    For Get Disposition Code Action Type:
    When the system evaluates the disposition code action requirements, then the action type is determined as either add, subtract, or no action based on the disposition code characteristics.
  • Context - a disposition code with add action type is being processed:
    For Add Quantity Action:
    When the action type is determined as add, then the specified quantity is prepared to be added to the current release quantity.
  • Context - a disposition code with subtract action type is being processed:
    For Subtract Quantity Action:
    When the action type is determined as subtract, then the specified quantity is prepared to be subtracted from the current release quantity.
  • Context - current release quantity and action quantity are available:
    For Calculate New Release Quantity:
    When add or subtract action needs to be applied, then new release quantity is calculated by adding or subtracting the action quantity from current release quantity.
  • Context - a new release quantity has been calculated:
    For Quantity Cannot Be Negative:
    When the calculated quantity is less than zero, then the quantity calculation is rejected and processing terminates with validation error.
  • Context - a new release quantity has been calculated and total cargo quantity is known:
    For Quantity Cannot Exceed Total:
    When the calculated release quantity exceeds the total cargo quantity, then the quantity calculation is rejected and processing terminates with validation error.
  • Context - a new release quantity has passed all validation checks:
    For Update Release Quantity:
    When the quantity is valid and within acceptable ranges, then the cargo record is updated with the new release quantity.
  • Context - cargo release quantity has been updated:
    For Set Release Status Flags:
    When release quantity changes require status flag updates, then appropriate release status flags are set on the cargo record.
  • Context - cargo has an updated release quantity and known total quantity:
    For Full Release?:
    When the system needs to determine release completion status, then if release quantity equals total quantity, cargo is fully released; otherwise cargo is partially released.
  • Context - cargo release quantity equals the total cargo quantity:
    For Mark Cargo as Fully Released:
    When full release status is determined, then cargo is marked with fully released status.
  • Context - cargo release quantity is less than the total cargo quantity:
    For Mark Cargo as Partially Released:
    When partial release status is determined, then cargo is marked with partially released status.
  • Context - cargo release quantity has been successfully updated:
    For Log Quantity Change:
    When quantity change needs to be recorded for audit purposes, then a log entry is created with old quantity, new quantity, and change details.
  • Context - release quantity calculation has been completed and logged:
    For Generate Release Impact Message:
    When stakeholders need to be notified of quantity changes, then a release impact message is generated showing the quantity change and its business impact.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with release quantity information
GIVEN
A cargo record exists with release quantity information
Applied to: Retrieve Current Release Quantity
WHEN
The system needs to calculate new release quantities
THEN
The current release quantity is retrieved from the cargo record
Context: A disposition code is being processed for a cargo
GIVEN
A disposition code is being processed for a cargo
Applied to: Get Disposition Code Action Type
WHEN
The system evaluates the disposition code action requirements
THEN
The action type is determined as either Add, Subtract, or No Action based on the disposition code characteristics
Context: A disposition code with add action type is being processed
GIVEN
A disposition code with add action type is being processed
Applied to: Add Quantity Action
WHEN
The action type is determined as Add
THEN
The specified quantity is prepared to be added to the current release quantity
Context: A disposition code with subtract action type is being processed
GIVEN
A disposition code with subtract action type is being processed
Applied to: Subtract Quantity Action
WHEN
The action type is determined as Subtract
THEN
The specified quantity is prepared to be subtracted from the current release quantity
Context: Current release quantity and action quantity are available
GIVEN
Current release quantity and action quantity are available
Applied to: Calculate New Release Quantity
WHEN
Add or subtract action needs to be applied
THEN
New release quantity is calculated by adding or subtracting the action quantity from current release quantity
Context: A new release quantity has been calculated
GIVEN
A new release quantity has been calculated
Applied to: Quantity Cannot Be Negative
WHEN
The calculated quantity is less than zero
THEN
The quantity calculation is rejected and processing terminates with validation error
Context: A new release quantity has been calculated and total cargo quantity is known
GIVEN
A new release quantity has been calculated and total cargo quantity is known
Applied to: Quantity Cannot Exceed Total
WHEN
The calculated release quantity exceeds the total cargo quantity
THEN
The quantity calculation is rejected and processing terminates with validation error
Context: A new release quantity has passed all validation checks
GIVEN
A new release quantity has passed all validation checks
Applied to: Update Release Quantity
WHEN
The quantity is valid and within acceptable ranges
THEN
The cargo record is updated with the new release quantity
Context: Cargo release quantity has been updated
GIVEN
Cargo release quantity has been updated
Applied to: Set Release Status Flags
WHEN
Release quantity changes require status flag updates
THEN
Appropriate release status flags are set on the cargo record
Context: Cargo has an updated release quantity and known total quantity
GIVEN
Cargo has an updated release quantity and known total quantity
Applied to: Full Release?
WHEN
The system needs to determine release completion status
THEN
If release quantity equals total quantity, cargo is fully released; otherwise cargo is partially released
Context: Cargo release quantity equals the total cargo quantity
GIVEN
Cargo release quantity equals the total cargo quantity
Applied to: Mark Cargo as Fully Released
WHEN
Full release status is determined
THEN
Cargo is marked with fully released status
Context: Cargo release quantity is less than the total cargo quantity
GIVEN
Cargo release quantity is less than the total cargo quantity
Applied to: Mark Cargo as Partially Released
WHEN
Partial release status is determined
THEN
Cargo is marked with partially released status
Context: Cargo release quantity has been successfully updated
GIVEN
Cargo release quantity has been successfully updated
Applied to: Log Quantity Change
WHEN
Quantity change needs to be recorded for audit purposes
THEN
A log entry is created with old quantity, new quantity, and change details
Context: Release quantity calculation has been completed and logged
GIVEN
Release quantity calculation has been completed and logged
Applied to: Generate Release Impact Message
WHEN
Stakeholders need to be notified of quantity changes
THEN
A release impact message is generated showing the quantity change and its business impact
R-GCX016E-cbl-02170 (+17) File: GCX016E.cbl Hold Cargo Notification Generation Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hold Cargo Notification Generation':
  • Context - a cargo has completed status evaluation processing:
    For Cargo Hold Status Detected?:
    When the system checks the cargo's current status flags, then the system identifies if the cargo has any active hold conditions (border hold, destination hold, fda hold, piece count hold, or general hold) and proceeds with hold notification processing if holds are detected, otherwise ends the notification process.
  • Context - a cargo with hold status has been identified for notification:
    For Retrieve Location Information:
    When the system needs to create a detailed hold notification, then the system retrieves location information from location tables (gcstbrt) including origin, destination, and current location details to provide business context for the hold notification.
  • Context - location information has been retrieved for a held cargo:
    For Gather Disposition Code Details:
    When the system processes disposition code information, then the system gathers disposition code details from status segments (gcsuss09) and disposition code tables including code descriptions, entry numbers, quantities, and associated business reasons for the hold.
  • Context - disposition code details have been gathered for a held cargo:
    For Determine Hold Type:
    When the system evaluates the hold conditions and status flags, then the system determines the specific hold type (border hold, destination hold, fda hold, piece count hold, or general hold) based on the cargo's status flags and disposition codes.
  • Context - a cargo has been classified as having a border hold type:
    For Border Hold Notification:
    When the system processes the border hold notification, then the system creates a border-specific hold notification with appropriate border location context, regulatory information, and routes the notification to border processing personnel.
  • Context - a cargo has been classified as having a destination hold type:
    For Destination Hold Notification:
    When the system processes the destination hold notification, then the system creates a destination-specific hold notification with destination location details, consignee information, and routes the notification to destination processing personnel.
  • Context - a cargo has been classified as having an fda hold type:
    For FDA Hold Notification:
    When the system processes the fda hold notification, then the system creates an fda-specific hold notification with regulatory compliance details, fda examination requirements, and routes the notification to fda processing personnel and relevant regulatory contacts.
  • Context - a cargo has been classified as having a piece count hold type:
    For Piece Count Hold Notification:
    When the system processes the piece count hold notification, then the system creates a piece count-specific hold notification with quantity details, release information, partial hold status, and routes the notification to quantity verification personnel.
  • Context - a cargo has been classified as having a general hold type (not border, destination, fda, or piece count):
    For General Hold Notification:
    When the system processes the general hold notification, then the system creates a general hold notification with standard hold information, disposition code details, and routes the notification to general processing personnel.
  • Context - a specific hold type notification has been processed:
    For Format Hold Details:
    When the system formats the hold details, then the system structures the hold information into a standardized format including hold type, reason codes, dates, quantities, and regulatory information for consistent business presentation.
  • Context - hold details have been formatted for a cargo notification:
    For Include Equipment Information:
    When the system includes equipment information, then the system adds equipment details from cargo data (gcsusrt) including car id, equipment type, equipment number, and container information to the hold notification.
  • Context - equipment information has been included in the hold notification:
    For Include Waybill Information:
    When the system includes waybill information, then the system adds waybill details from cargo data including waybill number, shipment references, and related shipping documentation information to the hold notification.
  • Context - waybill information has been included in the hold notification:
    For Include CCN Information:
    When the system includes ccn information, then the system adds cargo control number (ccn) details including us ccn, canadian ccn if applicable, and related manifest information to the hold notification.
  • Context - ccn information has been included in the hold notification:
    For Add Location Context:
    When the system adds location context, then the system includes location context from retrieved location information including origin location, destination location, current location, border crossing points, and relevant geographic identifiers.
  • Context - location context has been added to the hold notification:
    For Add Disposition Code Description:
    When the system adds disposition code descriptions, then the system includes disposition code descriptions from disposition code tables providing business-friendly explanations of the codes, regulatory requirements, and action items associated with the hold.
  • Context - all hold notification components (equipment, waybill, ccn, location, disposition codes) have been gathered:
    For Create Detailed Hold Message:
    When the system creates the detailed hold message, then the system assembles all information into a structured, comprehensive hold message with proper formatting, business terminology, and complete cargo context for effective business communication.
  • Context - a detailed hold message has been created:
    For Route to Business Users:
    When the system routes the notification to business users, then the system determines appropriate recipients based on hold type, location, and business rules, then routes the notification through appropriate channels (merlin system, email, or other communication methods) to relevant business personnel.
  • Context - a hold notification has been routed to business users:
    For Log Hold Notification:
    When the system logs the notification activity, then the system creates audit records documenting the hold notification including timestamp, recipients, hold details, and notification status for compliance and business tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo has completed status evaluation processing
GIVEN
A cargo has completed status evaluation processing
Applied to: Cargo Hold Status Detected?
WHEN
The system checks the cargo's current status flags
THEN
The system identifies if the cargo has any active hold conditions (border hold, destination hold, FDA hold, piece count hold, or general hold) and proceeds with hold notification processing if holds are detected, otherwise ends the notification process
Context: A cargo with hold status has been identified for notification
GIVEN
A cargo with hold status has been identified for notification
Applied to: Retrieve Location Information
WHEN
The system needs to create a detailed hold notification
THEN
The system retrieves location information from location tables (GCSTBRT) including origin, destination, and current location details to provide business context for the hold notification
Context: Location information has been retrieved for a held cargo
GIVEN
Location information has been retrieved for a held cargo
Applied to: Gather Disposition Code Details
WHEN
The system processes disposition code information
THEN
The system gathers disposition code details from status segments (GCSUSS09) and disposition code tables including code descriptions, entry numbers, quantities, and associated business reasons for the hold
Context: Disposition code details have been gathered for a held cargo
GIVEN
Disposition code details have been gathered for a held cargo
Applied to: Determine Hold Type
WHEN
The system evaluates the hold conditions and status flags
THEN
The system determines the specific hold type (Border Hold, Destination Hold, FDA Hold, Piece Count Hold, or General Hold) based on the cargo's status flags and disposition codes
Context: A cargo has been classified as having a border hold type
GIVEN
A cargo has been classified as having a border hold type
Applied to: Border Hold Notification
WHEN
The system processes the border hold notification
THEN
The system creates a border-specific hold notification with appropriate border location context, regulatory information, and routes the notification to border processing personnel
Context: A cargo has been classified as having a destination hold type
GIVEN
A cargo has been classified as having a destination hold type
Applied to: Destination Hold Notification
WHEN
The system processes the destination hold notification
THEN
The system creates a destination-specific hold notification with destination location details, consignee information, and routes the notification to destination processing personnel
Context: A cargo has been classified as having an FDA hold type
GIVEN
A cargo has been classified as having an FDA hold type
Applied to: FDA Hold Notification
WHEN
The system processes the FDA hold notification
THEN
The system creates an FDA-specific hold notification with regulatory compliance details, FDA examination requirements, and routes the notification to FDA processing personnel and relevant regulatory contacts
Context: A cargo has been classified as having a piece count hold type
GIVEN
A cargo has been classified as having a piece count hold type
Applied to: Piece Count Hold Notification
WHEN
The system processes the piece count hold notification
THEN
The system creates a piece count-specific hold notification with quantity details, release information, partial hold status, and routes the notification to quantity verification personnel
Context: A cargo has been classified as having a general hold type (not border, destination, FDA, or piece count)
GIVEN
A cargo has been classified as having a general hold type (not border, destination, FDA, or piece count)
Applied to: General Hold Notification
WHEN
The system processes the general hold notification
THEN
The system creates a general hold notification with standard hold information, disposition code details, and routes the notification to general processing personnel
Context: A specific hold type notification has been processed
GIVEN
A specific hold type notification has been processed
Applied to: Format Hold Details
WHEN
The system formats the hold details
THEN
The system structures the hold information into a standardized format including hold type, reason codes, dates, quantities, and regulatory information for consistent business presentation
Context: Hold details have been formatted for a cargo notification
GIVEN
Hold details have been formatted for a cargo notification
Applied to: Include Equipment Information
WHEN
The system includes equipment information
THEN
The system adds equipment details from cargo data (GCSUSRT) including car ID, equipment type, equipment number, and container information to the hold notification
Context: Equipment information has been included in the hold notification
GIVEN
Equipment information has been included in the hold notification
Applied to: Include Waybill Information
WHEN
The system includes waybill information
THEN
The system adds waybill details from cargo data including waybill number, shipment references, and related shipping documentation information to the hold notification
Context: Waybill information has been included in the hold notification
GIVEN
Waybill information has been included in the hold notification
Applied to: Include CCN Information
WHEN
The system includes CCN information
THEN
The system adds Cargo Control Number (CCN) details including US CCN, Canadian CCN if applicable, and related manifest information to the hold notification
Context: CCN information has been included in the hold notification
GIVEN
CCN information has been included in the hold notification
Applied to: Add Location Context
WHEN
The system adds location context
THEN
The system includes location context from retrieved location information including origin location, destination location, current location, border crossing points, and relevant geographic identifiers
Context: Location context has been added to the hold notification
GIVEN
Location context has been added to the hold notification
Applied to: Add Disposition Code Description
WHEN
The system adds disposition code descriptions
THEN
The system includes disposition code descriptions from disposition code tables providing business-friendly explanations of the codes, regulatory requirements, and action items associated with the hold
Context: All hold notification components (equipment, waybill, CCN, location, disposition codes) have been gathered
GIVEN
All hold notification components (equipment, waybill, CCN, location, disposition codes) have been gathered
Applied to: Create Detailed Hold Message
WHEN
The system creates the detailed hold message
THEN
The system assembles all information into a structured, comprehensive hold message with proper formatting, business terminology, and complete cargo context for effective business communication
Context: A detailed hold message has been created
GIVEN
A detailed hold message has been created
Applied to: Route to Business Users
WHEN
The system routes the notification to business users
THEN
The system determines appropriate recipients based on hold type, location, and business rules, then routes the notification through appropriate channels (Merlin system, email, or other communication methods) to relevant business personnel
Context: A hold notification has been routed to business users
GIVEN
A hold notification has been routed to business users
Applied to: Log Hold Notification
WHEN
The system logs the notification activity
THEN
The system creates audit records documenting the hold notification including timestamp, recipients, hold details, and notification status for compliance and business tracking purposes
R-GCX016E-cbl-02188 (+23) File: GCX016E.cbl Cargo Status Evaluation and Determination Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Evaluation and Determination':
  • Context - a cargo record exists with associated status segments:
    For Retrieve Complete S09A Status Arrays:
    When the system needs to evaluate cargo status, then all s09a status array segments are retrieved and made available for analysis.
  • Context - s09a status arrays have been retrieved for a cargo:
    For Analyze Individual Status Entries:
    When the system processes the status array, then each individual status entry is analyzed for disposition code, quantity, and entry number information.
  • Context - individual status entries have been analyzed:
    For Hold Disposition Codes Present?:
    When the system evaluates for hold conditions, then hold disposition codes are identified if present in the status array.
  • Context - hold disposition codes are present in the status array:
    For Evaluate Hold Types:
    When the system evaluates hold types, then hold codes are categorized as border hold, destination hold, fda hold, piece count hold, or customs intensive hold.
  • Context - hold evaluation has been completed:
    For Release Disposition Codes Present?:
    When the system evaluates for release conditions, then release disposition codes are identified if present in the status array.
  • Context - release disposition codes are present in the status array:
    For Evaluate Release Conditions:
    When the system evaluates release conditions, then release codes are categorized as full release, partial release, or conditional release based on quantity and conditions.
  • Context - release evaluation has been completed:
    For Proceed Disposition Codes Present?:
    When the system evaluates for proceed conditions, then proceed disposition codes are identified if present in the status array.
  • Context - proceed disposition codes are present in the status array:
    For Check In-Bond Entry Status:
    When the system validates in-bond requirements, then in-bond entry status is verified as valid for proceed processing.
  • Context - proceed evaluation has been completed:
    For Arrival/Export Codes Present?:
    When the system evaluates for arrival or export conditions, then arrival or export disposition codes are identified if present in the status array.
  • Context - arrival or export disposition codes are present:
    For Validate Location and Port:
    When the system validates location requirements, then location and port information are verified as valid for arrival or export processing.
  • Context - location and port validation has been completed:
    For Manual Release Present?:
    When the system evaluates for manual release override, then manual release disposition codes are identified if present in the status array.
  • Context - manual release disposition codes are present in the status array:
    For Override Hold Status:
    When the system processes manual release override, then system-generated hold status is overridden and cargo is marked for release processing.
  • Context - manual release evaluation has been completed:
    For Multiple Conflicting Codes?:
    When the system evaluates for conflicting disposition codes, then multiple conflicting disposition codes are identified if they exist in the status array.
  • Context - multiple conflicting disposition codes exist in the status array:
    For Apply Business Rule Priority:
    When the system applies business rule priority, then disposition codes are prioritized with hold taking priority over release, manual release overriding system hold, proceed requiring valid in-bond, and export requiring port validation.
  • Context - business rule priority has been applied to conflicting codes:
    For Calculate Final Release Quantity:
    When the system calculates final release quantity, then final release quantity is computed by summing all release quantities and subtracting hold quantities from the status array.
  • Context - final release quantity has been calculated:
    For All Conditions Met for Release?:
    When the system validates release conditions, then all conditions are verified as met if no active holds exist, release quantity equals or exceeds cargo quantity, and all regulatory requirements are satisfied.
  • Context - all conditions for release have been met:
    For Set Status: RELEASED:
    When the system sets final cargo status, then cargo status is set to released and release flags are activated.
  • Context - not all conditions for release have been met:
    For Set Status: HELD:
    When the system sets final cargo status, then cargo status is set to held with appropriate hold type designation and hold flags are activated.
  • Context - cargo status has been set to either released or held:
    For Export Processing Required?:
    When the system evaluates export processing requirements, then export processing is required if export disposition codes are present and cargo destination is outside the country.
  • Context - export processing is required for the cargo:
    For Set Status: EXPORTED:
    When the system processes export status, then cargo status is set to exported and export flags are activated with appropriate export date.
  • Context - export processing evaluation has been completed:
    For Arrival Processing Required?:
    When the system evaluates arrival processing requirements, then arrival processing is required if arrival disposition codes are present and cargo has reached its destination.
  • Context - arrival processing is required for the cargo:
    For Set Status: ARRIVED:
    When the system processes arrival status, then cargo status is set to arrived and arrival flags are activated with appropriate arrival date.
  • Context - final cargo status has been determined (released, held, exported, or arrived):
    For Update Cargo Status Flags:
    When the system updates cargo status flags, then all relevant status flags are updated including hold flags, release flags, export flags, arrival flags, and processing flags.
  • Context - cargo status flags have been updated:
    For Generate Status Change Notification:
    When the system generates status change notifications, then notifications are sent to brokers, freight forwarders, and other relevant parties based on the status change type and notification preferences.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with associated status segments
GIVEN
A cargo record exists with associated status segments
Applied to: Retrieve Complete S09A Status Arrays
WHEN
The system needs to evaluate cargo status
THEN
All S09A status array segments are retrieved and made available for analysis
Context: S09A status arrays have been retrieved for a cargo
GIVEN
S09A status arrays have been retrieved for a cargo
Applied to: Analyze Individual Status Entries
WHEN
The system processes the status array
THEN
Each individual status entry is analyzed for disposition code, quantity, and entry number information
Context: Individual status entries have been analyzed
GIVEN
Individual status entries have been analyzed
Applied to: Hold Disposition Codes Present?
WHEN
The system evaluates for hold conditions
THEN
Hold disposition codes are identified if present in the status array
Context: Hold disposition codes are present in the status array
GIVEN
Hold disposition codes are present in the status array
Applied to: Evaluate Hold Types
WHEN
The system evaluates hold types
THEN
Hold codes are categorized as border hold, destination hold, FDA hold, piece count hold, or customs intensive hold
Context: Hold evaluation has been completed
GIVEN
Hold evaluation has been completed
Applied to: Release Disposition Codes Present?
WHEN
The system evaluates for release conditions
THEN
Release disposition codes are identified if present in the status array
Context: Release disposition codes are present in the status array
GIVEN
Release disposition codes are present in the status array
Applied to: Evaluate Release Conditions
WHEN
The system evaluates release conditions
THEN
Release codes are categorized as full release, partial release, or conditional release based on quantity and conditions
Context: Release evaluation has been completed
GIVEN
Release evaluation has been completed
Applied to: Proceed Disposition Codes Present?
WHEN
The system evaluates for proceed conditions
THEN
Proceed disposition codes are identified if present in the status array
Context: Proceed disposition codes are present in the status array
GIVEN
Proceed disposition codes are present in the status array
Applied to: Check In-Bond Entry Status
WHEN
The system validates in-bond requirements
THEN
In-bond entry status is verified as valid for proceed processing
Context: Proceed evaluation has been completed
GIVEN
Proceed evaluation has been completed
Applied to: Arrival/Export Codes Present?
WHEN
The system evaluates for arrival or export conditions
THEN
Arrival or export disposition codes are identified if present in the status array
Context: Arrival or export disposition codes are present
GIVEN
Arrival or export disposition codes are present
Applied to: Validate Location and Port
WHEN
The system validates location requirements
THEN
Location and port information are verified as valid for arrival or export processing
Context: Location and port validation has been completed
GIVEN
Location and port validation has been completed
Applied to: Manual Release Present?
WHEN
The system evaluates for manual release override
THEN
Manual release disposition codes are identified if present in the status array
Context: Manual release disposition codes are present in the status array
GIVEN
Manual release disposition codes are present in the status array
Applied to: Override Hold Status
WHEN
The system processes manual release override
THEN
System-generated hold status is overridden and cargo is marked for release processing
Context: Manual release evaluation has been completed
GIVEN
Manual release evaluation has been completed
Applied to: Multiple Conflicting Codes?
WHEN
The system evaluates for conflicting disposition codes
THEN
Multiple conflicting disposition codes are identified if they exist in the status array
Context: Multiple conflicting disposition codes exist in the status array
GIVEN
Multiple conflicting disposition codes exist in the status array
Applied to: Apply Business Rule Priority
WHEN
The system applies business rule priority
THEN
Disposition codes are prioritized with hold taking priority over release, manual release overriding system hold, proceed requiring valid in-bond, and export requiring port validation
Context: Business rule priority has been applied to conflicting codes
GIVEN
Business rule priority has been applied to conflicting codes
Applied to: Calculate Final Release Quantity
WHEN
The system calculates final release quantity
THEN
Final release quantity is computed by summing all release quantities and subtracting hold quantities from the status array
Context: Final release quantity has been calculated
GIVEN
Final release quantity has been calculated
Applied to: All Conditions Met for Release?
WHEN
The system validates release conditions
THEN
All conditions are verified as met if no active holds exist, release quantity equals or exceeds cargo quantity, and all regulatory requirements are satisfied
Context: All conditions for release have been met
GIVEN
All conditions for release have been met
Applied to: Set Status: RELEASED
WHEN
The system sets final cargo status
THEN
Cargo status is set to RELEASED and release flags are activated
Context: Not all conditions for release have been met
GIVEN
Not all conditions for release have been met
Applied to: Set Status: HELD
WHEN
The system sets final cargo status
THEN
Cargo status is set to HELD with appropriate hold type designation and hold flags are activated
Context: Cargo status has been set to either RELEASED or HELD
GIVEN
Cargo status has been set to either RELEASED or HELD
Applied to: Export Processing Required?
WHEN
The system evaluates export processing requirements
THEN
Export processing is required if export disposition codes are present and cargo destination is outside the country
Context: Export processing is required for the cargo
GIVEN
Export processing is required for the cargo
Applied to: Set Status: EXPORTED
WHEN
The system processes export status
THEN
Cargo status is set to EXPORTED and export flags are activated with appropriate export date
Context: Export processing evaluation has been completed
GIVEN
Export processing evaluation has been completed
Applied to: Arrival Processing Required?
WHEN
The system evaluates arrival processing requirements
THEN
Arrival processing is required if arrival disposition codes are present and cargo has reached its destination
Context: Arrival processing is required for the cargo
GIVEN
Arrival processing is required for the cargo
Applied to: Set Status: ARRIVED
WHEN
The system processes arrival status
THEN
Cargo status is set to ARRIVED and arrival flags are activated with appropriate arrival date
Context: Final cargo status has been determined (RELEASED, HELD, EXPORTED, or ARRIVED)
GIVEN
Final cargo status has been determined (RELEASED, HELD, EXPORTED, or ARRIVED)
Applied to: Update Cargo Status Flags
WHEN
The system updates cargo status flags
THEN
All relevant status flags are updated including hold flags, release flags, export flags, arrival flags, and processing flags
Context: Cargo status flags have been updated
GIVEN
Cargo status flags have been updated
Applied to: Generate Status Change Notification
WHEN
The system generates status change notifications
THEN
Notifications are sent to brokers, freight forwarders, and other relevant parties based on the status change type and notification preferences
R-GCX016E-cbl-02212 (+14) File: GCX016E.cbl Proceed Disposition Code Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Proceed Disposition Code Processing':
  • Context - a proceed disposition code is being processed for a cargo:
    For Is Cargo In-Bond Entry?:
    When the system checks the cargo's entry type, then the cargo is classified as in-bond if it has entry types 61, 62, 63, or 69, otherwise it is classified as non-in-bond.
  • Context - a cargo has an in-bond entry type and is undergoing proceed disposition processing:
    For Set Master In-Bond Flag for Entry Types 61,62,63,69:
    When the entry type is 61, 62, 63, or 69, then the master in-bond flag is set to indicate this is a master in-bond movement.
  • Context - a cargo is being processed for proceed disposition with in-bond requirements:
    For Bond Information Available?:
    When the system checks for existing bond information, then bond processing continues if bond data exists, otherwise entry number validation is performed.
  • Context - bond information is available for a cargo undergoing proceed disposition processing:
    For Clear Existing Bond Data:
    When the system processes the bond information, then all existing bond data fields are cleared to prepare for new bond information updates.
  • Context - existing bond data has been cleared for a cargo:
    For Update Bond Number Index:
    When new bond information is being processed, then the bond number index is updated with the new bond number for tracking purposes.
  • Context - bond number index has been updated for a cargo:
    For Set Broker QP Information:
    When broker information is being processed, then the broker qualifying party information is set to establish broker responsibility for the bond.
  • Context - broker qp information has been set for a cargo:
    For Update Bond Owner Details:
    When bond owner information is being processed, then bond owner details are updated to reflect the current bond ownership information.
  • Context - bond processing is complete or no bond information is available:
    For Validate Entry Number Against Existing Records:
    When the system validates the entry number, then the entry number is checked against existing broker entry number records to ensure validity.
  • Context - the entry number has been validated as valid:
    For Process In-Bond Control Number:
    When in-bond control number processing is initiated, then the in-bond control number is processed and associated with the cargo record.
  • Context - in-bond control number has been processed:
    For Convert EDI Entry Type Codes to Internal Values:
    When edi entry type codes need to be converted, then edi entry type codes are converted to corresponding internal system values for processing.
  • Context - edi entry type codes have been converted to internal values:
    For Set In-Bond Processing Flags:
    When in-bond processing flags need to be set, then appropriate flags are set to indicate the cargo is undergoing in-bond processing.
  • Context - all in-bond processing flags have been set or the cargo is non-in-bond:
    For Update Cargo Status to Proceed:
    When the cargo status needs to be updated, then the cargo status is updated to proceed to indicate the cargo can move forward in the process.
  • Context - the cargo status has been updated to proceed:
    For Log Proceed Action:
    When action logging is performed, then the proceed action is logged with relevant details for audit trail and tracking purposes.
  • Context - the proceed action has been logged:
    For Generate Merlin Notification:
    When merlin notification is generated, then a notification is sent to the merlin system to inform stakeholders of the proceed status.
  • Context - entry number validation is performed against existing records:
    For Generate Error - Invalid Entry Number:
    When the entry number is found to be invalid or does not exist, then an error is generated indicating the entry number is invalid and processing cannot continue.
👨‍💻 Technical ACs (Gherkin)
Context: A proceed disposition code is being processed for a cargo
GIVEN
A proceed disposition code is being processed for a cargo
Applied to: Is Cargo In-Bond Entry?
WHEN
The system checks the cargo's entry type
THEN
The cargo is classified as in-bond if it has entry types 61, 62, 63, or 69, otherwise it is classified as non-in-bond
Context: A cargo has an in-bond entry type and is undergoing proceed disposition processing
GIVEN
A cargo has an in-bond entry type and is undergoing proceed disposition processing
Applied to: Set Master In-Bond Flag for Entry Types 61,62,63,69
WHEN
The entry type is 61, 62, 63, or 69
THEN
The master in-bond flag is set to indicate this is a master in-bond movement
Context: A cargo is being processed for proceed disposition with in-bond requirements
GIVEN
A cargo is being processed for proceed disposition with in-bond requirements
Applied to: Bond Information Available?
WHEN
The system checks for existing bond information
THEN
Bond processing continues if bond data exists, otherwise entry number validation is performed
Context: Bond information is available for a cargo undergoing proceed disposition processing
GIVEN
Bond information is available for a cargo undergoing proceed disposition processing
Applied to: Clear Existing Bond Data
WHEN
The system processes the bond information
THEN
All existing bond data fields are cleared to prepare for new bond information updates
Context: Existing bond data has been cleared for a cargo
GIVEN
Existing bond data has been cleared for a cargo
Applied to: Update Bond Number Index
WHEN
New bond information is being processed
THEN
The bond number index is updated with the new bond number for tracking purposes
Context: Bond number index has been updated for a cargo
GIVEN
Bond number index has been updated for a cargo
Applied to: Set Broker QP Information
WHEN
Broker information is being processed
THEN
The broker qualifying party information is set to establish broker responsibility for the bond
Context: Broker QP information has been set for a cargo
GIVEN
Broker QP information has been set for a cargo
Applied to: Update Bond Owner Details
WHEN
Bond owner information is being processed
THEN
Bond owner details are updated to reflect the current bond ownership information
Context: Bond processing is complete or no bond information is available
GIVEN
Bond processing is complete or no bond information is available
Applied to: Validate Entry Number Against Existing Records
WHEN
The system validates the entry number
THEN
The entry number is checked against existing broker entry number records to ensure validity
Context: The entry number has been validated as valid
GIVEN
The entry number has been validated as valid
Applied to: Process In-Bond Control Number
WHEN
In-bond control number processing is initiated
THEN
The in-bond control number is processed and associated with the cargo record
Context: In-bond control number has been processed
GIVEN
In-bond control number has been processed
Applied to: Convert EDI Entry Type Codes to Internal Values
WHEN
EDI entry type codes need to be converted
THEN
EDI entry type codes are converted to corresponding internal system values for processing
Context: EDI entry type codes have been converted to internal values
GIVEN
EDI entry type codes have been converted to internal values
Applied to: Set In-Bond Processing Flags
WHEN
In-bond processing flags need to be set
THEN
Appropriate flags are set to indicate the cargo is undergoing in-bond processing
Context: All in-bond processing flags have been set or the cargo is non-in-bond
GIVEN
All in-bond processing flags have been set or the cargo is non-in-bond
Applied to: Update Cargo Status to Proceed
WHEN
The cargo status needs to be updated
THEN
The cargo status is updated to proceed to indicate the cargo can move forward in the process
Context: The cargo status has been updated to proceed
GIVEN
The cargo status has been updated to proceed
Applied to: Log Proceed Action
WHEN
Action logging is performed
THEN
The proceed action is logged with relevant details for audit trail and tracking purposes
Context: The proceed action has been logged
GIVEN
The proceed action has been logged
Applied to: Generate Merlin Notification
WHEN
Merlin notification is generated
THEN
A notification is sent to the Merlin system to inform stakeholders of the proceed status
Context: Entry number validation is performed against existing records
GIVEN
Entry number validation is performed against existing records
Applied to: Generate Error - Invalid Entry Number
WHEN
The entry number is found to be invalid or does not exist
THEN
An error is generated indicating the entry number is invalid and processing cannot continue
R-GCX016E-cbl-02227 (+20) File: GCX016E.cbl Arrival and Export Status Management Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Arrival and Export Status Management':
  • Context - a disposition code is being processed for cargo status management:
    For Check Arrival Disposition Codes:
    When the system checks if the disposition code is aad (actual arrival date) or pod (proof of delivery), then the system identifies the code as an arrival disposition and proceeds with arrival processing.
    For Check Export Disposition Codes:
    When the system checks if the disposition code indicates export processing, then the system identifies the code as an export disposition and proceeds with export processing.
    For Check Cancel Arrival Codes:
    When the system checks if the disposition code indicates cancellation of arrival, then the system identifies the code as a cancel arrival disposition and proceeds with arrival cancellation.
    For Check Cancel Export Codes:
    When the system checks if the disposition code indicates cancellation of export, then the system identifies the code as a cancel export disposition and proceeds with export cancellation.
  • Context - an arrival disposition code (aad or pod) has been identified:
    For Validate Arrival Location:
    When the system validates the location code against valid arrival locations, then the system confirms the location is authorized for arrival processing or rejects invalid locations.
  • Context - a valid arrival disposition code with valid location has been processed:
    For Set Cargo Arrival Status Flag:
    When the system updates cargo status for arrival, then the cargo arrival status flag is set to indicate the cargo has arrived.
  • Context - cargo arrival status has been set:
    For Clear Bond Start Date:
    When the system processes the arrival event, then the bond start date is cleared to reflect that the in-bond movement has ended.
  • Context - cargo has arrived at a valid location:
    For Set Arrival Index:
    When the system processes the arrival status update, then an arrival index is set to reference the arrival location for tracking purposes.
  • Context - cargo has arrived and arrival date is recorded:
    For Calculate Cargo Age:
    When the system calculates cargo aging metrics, then the cargo age is computed as the difference between arrival date and original entry date.
  • Context - an export disposition code has been identified:
    For Validate Export Location:
    When the system validates the location code against authorized export locations, then the system confirms the location is authorized for export processing or rejects invalid locations.
  • Context - a valid export disposition code with valid location has been processed:
    For Set Cargo Export Status Flag:
    When the system updates cargo status for export, then the cargo export status flag is set to indicate the cargo is being exported.
  • Context - cargo export status has been set:
    For Clear Destination Index:
    When the system processes the export event, then the destination index is cleared since the cargo is leaving the country.
    For Update Export Date:
    When the system records the export event, then the export date is updated to reflect the current processing date and time.
  • Context - a cancel arrival disposition code has been processed:
    For Reset Arrival Status Flag:
    When the system cancels the arrival status, then the cargo arrival status flag is reset to indicate the cargo has not arrived.
  • Context - arrival status is being cancelled and a previous arrival date exists:
    For Restore Previous Arrival Date:
    When the system processes the arrival cancellation, then the previous arrival date is restored to maintain historical accuracy.
  • Context - arrival status has been cancelled:
    For Recalculate Bond Information:
    When the system updates bond-related data, then bond information is recalculated to reflect the cancelled arrival status.
  • Context - a cancel export disposition code has been processed:
    For Reset Export Status Flag:
    When the system cancels the export status, then the cargo export status flag is reset to indicate the cargo is not being exported.
  • Context - export status is being cancelled and a previous export date exists:
    For Restore Previous Export Date:
    When the system processes the export cancellation, then the previous export date is restored to maintain historical accuracy.
  • Context - export status is being cancelled:
    For Clear Export Index:
    When the system processes the export cancellation, then the export index is cleared to remove the export location reference.
  • Context - cargo arrival or export status has been updated or cancelled:
    For Generate Status Change Notification:
    When the system completes the status change processing, then a status change notification is generated to inform relevant parties of the status update.
  • Context - arrival or export status changes have been processed:
    For Update Cargo Status Arrays:
    When the system finalizes the status management, then the cargo status arrays are updated with the new arrival and export status information.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo status management
GIVEN
A disposition code is being processed for cargo status management
Applied to: Check Arrival Disposition Codes
WHEN
The system checks if the disposition code is AAD (Actual Arrival Date) or POD (Proof of Delivery)
THEN
The system identifies the code as an arrival disposition and proceeds with arrival processing
Applied to: Check Export Disposition Codes
WHEN
The system checks if the disposition code indicates export processing
THEN
The system identifies the code as an export disposition and proceeds with export processing
Applied to: Check Cancel Arrival Codes
WHEN
The system checks if the disposition code indicates cancellation of arrival
THEN
The system identifies the code as a cancel arrival disposition and proceeds with arrival cancellation
Applied to: Check Cancel Export Codes
WHEN
The system checks if the disposition code indicates cancellation of export
THEN
The system identifies the code as a cancel export disposition and proceeds with export cancellation
Context: An arrival disposition code (AAD or POD) has been identified
GIVEN
An arrival disposition code (AAD or POD) has been identified
Applied to: Validate Arrival Location
WHEN
The system validates the location code against valid arrival locations
THEN
The system confirms the location is authorized for arrival processing or rejects invalid locations
Context: A valid arrival disposition code with valid location has been processed
GIVEN
A valid arrival disposition code with valid location has been processed
Applied to: Set Cargo Arrival Status Flag
WHEN
The system updates cargo status for arrival
THEN
The cargo arrival status flag is set to indicate the cargo has arrived
Context: Cargo arrival status has been set
GIVEN
Cargo arrival status has been set
Applied to: Clear Bond Start Date
WHEN
The system processes the arrival event
THEN
The bond start date is cleared to reflect that the in-bond movement has ended
Context: Cargo has arrived at a valid location
GIVEN
Cargo has arrived at a valid location
Applied to: Set Arrival Index
WHEN
The system processes the arrival status update
THEN
An arrival index is set to reference the arrival location for tracking purposes
Context: Cargo has arrived and arrival date is recorded
GIVEN
Cargo has arrived and arrival date is recorded
Applied to: Calculate Cargo Age
WHEN
The system calculates cargo aging metrics
THEN
The cargo age is computed as the difference between arrival date and original entry date
Context: An export disposition code has been identified
GIVEN
An export disposition code has been identified
Applied to: Validate Export Location
WHEN
The system validates the location code against authorized export locations
THEN
The system confirms the location is authorized for export processing or rejects invalid locations
Context: A valid export disposition code with valid location has been processed
GIVEN
A valid export disposition code with valid location has been processed
Applied to: Set Cargo Export Status Flag
WHEN
The system updates cargo status for export
THEN
The cargo export status flag is set to indicate the cargo is being exported
Context: Cargo export status has been set
GIVEN
Cargo export status has been set
Applied to: Clear Destination Index
WHEN
The system processes the export event
THEN
The destination index is cleared since the cargo is leaving the country
Applied to: Update Export Date
WHEN
The system records the export event
THEN
The export date is updated to reflect the current processing date and time
Context: A cancel arrival disposition code has been processed
GIVEN
A cancel arrival disposition code has been processed
Applied to: Reset Arrival Status Flag
WHEN
The system cancels the arrival status
THEN
The cargo arrival status flag is reset to indicate the cargo has not arrived
Context: Arrival status is being cancelled and a previous arrival date exists
GIVEN
Arrival status is being cancelled and a previous arrival date exists
Applied to: Restore Previous Arrival Date
WHEN
The system processes the arrival cancellation
THEN
The previous arrival date is restored to maintain historical accuracy
Context: Arrival status has been cancelled
GIVEN
Arrival status has been cancelled
Applied to: Recalculate Bond Information
WHEN
The system updates bond-related data
THEN
Bond information is recalculated to reflect the cancelled arrival status
Context: A cancel export disposition code has been processed
GIVEN
A cancel export disposition code has been processed
Applied to: Reset Export Status Flag
WHEN
The system cancels the export status
THEN
The cargo export status flag is reset to indicate the cargo is not being exported
Context: Export status is being cancelled and a previous export date exists
GIVEN
Export status is being cancelled and a previous export date exists
Applied to: Restore Previous Export Date
WHEN
The system processes the export cancellation
THEN
The previous export date is restored to maintain historical accuracy
Context: Export status is being cancelled
GIVEN
Export status is being cancelled
Applied to: Clear Export Index
WHEN
The system processes the export cancellation
THEN
The export index is cleared to remove the export location reference
Context: Cargo arrival or export status has been updated or cancelled
GIVEN
Cargo arrival or export status has been updated or cancelled
Applied to: Generate Status Change Notification
WHEN
The system completes the status change processing
THEN
A status change notification is generated to inform relevant parties of the status update
Context: Arrival or export status changes have been processed
GIVEN
Arrival or export status changes have been processed
Applied to: Update Cargo Status Arrays
WHEN
The system finalizes the status management
THEN
The cargo status arrays are updated with the new arrival and export status information
R-GCX016E-cbl-02248 (+15) File: GCX016E.cbl Cancel Arrival and Export Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cancel Arrival and Export Processing':
  • Context - a cargo has an active arrival status and a cancel arrival disposition code is processed:
    For Cancel Arrival Processing:
    When the system processes the cancel arrival disposition code, then the system initiates cancel arrival processing workflow.
  • Context - a cargo has an active export status and a cancel export disposition code is processed:
    For Cancel Export Processing:
    When the system processes the cancel export disposition code, then the system initiates cancel export processing workflow.
  • Context - a cancellation request is being processed for a cargo:
    For Retrieve Current Cargo Status:
    When the system needs to process the cancellation, then the system retrieves the current cargo status from the cargo root record.
  • Context - a cargo status is about to be changed due to cancellation:
    For Save Previous Status for Audit:
    When the system processes the status change, then the system saves the previous status information to maintain audit trail.
  • Context - a cargo has an active arrival flag set and arrival cancellation is being processed:
    For Clear Arrival Flag:
    When the system processes the arrival cancellation, then the system clears the arrival flag in the cargo record.
  • Context - a cargo has an active export flag set and export cancellation is being processed:
    For Clear Export Flag:
    When the system processes the export cancellation, then the system clears the export flag in the cargo record.
  • Context - a cargo has an arrival date set and arrival cancellation is being processed:
    For Reset Arrival Date:
    When the system processes the arrival cancellation, then the system resets the arrival date to blank or previous value.
  • Context - a cargo has an export date set and export cancellation is being processed:
    For Reset Export Date:
    When the system processes the export cancellation, then the system resets the export date to blank or previous value.
  • Context - a cargo had bond information modified during arrival or export processing and cancellation is being processed:
    For Restore Bond Information:
    When the system processes the cancellation, then the system restores the bond information to its previous state.
  • Context - a cargo status has been changed due to cancellation and dates have been updated:
    For Recalculate Cargo Age:
    When the system completes the status change processing, then the system recalculates the cargo age based on the updated information.
  • Context - a cargo cancellation has been processed and status has been updated:
    For Update Destination Index:
    When the system completes the cancellation processing, then the system updates the destination index to reflect the new status.
  • Context - a cargo cancellation has been successfully processed:
    For Generate Cancel Notification:
    When the system completes the cancellation processing, then the system generates a cancel notification message for relevant parties.
  • Context - a cargo status has been changed due to cancellation processing:
    For Log Status Change:
    When the system completes the status change, then the system logs the status change with timestamp and details for audit purposes.
  • Context - a cargo cancellation has been processed and status has been determined:
    For Update Status Arrays:
    When the system updates the cargo record, then the system updates all relevant status arrays to reflect the cancellation changes.
  • Context - a cargo cancellation has been processed and status arrays have been updated:
    For Verify Status Restoration:
    When the system completes the update process, then the system verifies that the status has been properly restored and is consistent.
  • Context - a cargo cancellation has been verified and processed successfully:
    For Send Cancellation Message:
    When the system completes all internal processing, then the system sends cancellation message to external systems and interested parties.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo has an active arrival status and a cancel arrival disposition code is processed
GIVEN
A cargo has an active arrival status and a cancel arrival disposition code is processed
Applied to: Cancel Arrival Processing
WHEN
The system processes the cancel arrival disposition code
THEN
The system initiates cancel arrival processing workflow
Context: A cargo has an active export status and a cancel export disposition code is processed
GIVEN
A cargo has an active export status and a cancel export disposition code is processed
Applied to: Cancel Export Processing
WHEN
The system processes the cancel export disposition code
THEN
The system initiates cancel export processing workflow
Context: A cancellation request is being processed for a cargo
GIVEN
A cancellation request is being processed for a cargo
Applied to: Retrieve Current Cargo Status
WHEN
The system needs to process the cancellation
THEN
The system retrieves the current cargo status from the cargo root record
Context: A cargo status is about to be changed due to cancellation
GIVEN
A cargo status is about to be changed due to cancellation
Applied to: Save Previous Status for Audit
WHEN
The system processes the status change
THEN
The system saves the previous status information to maintain audit trail
Context: A cargo has an active arrival flag set and arrival cancellation is being processed
GIVEN
A cargo has an active arrival flag set and arrival cancellation is being processed
Applied to: Clear Arrival Flag
WHEN
The system processes the arrival cancellation
THEN
The system clears the arrival flag in the cargo record
Context: A cargo has an active export flag set and export cancellation is being processed
GIVEN
A cargo has an active export flag set and export cancellation is being processed
Applied to: Clear Export Flag
WHEN
The system processes the export cancellation
THEN
The system clears the export flag in the cargo record
Context: A cargo has an arrival date set and arrival cancellation is being processed
GIVEN
A cargo has an arrival date set and arrival cancellation is being processed
Applied to: Reset Arrival Date
WHEN
The system processes the arrival cancellation
THEN
The system resets the arrival date to blank or previous value
Context: A cargo has an export date set and export cancellation is being processed
GIVEN
A cargo has an export date set and export cancellation is being processed
Applied to: Reset Export Date
WHEN
The system processes the export cancellation
THEN
The system resets the export date to blank or previous value
Context: A cargo had bond information modified during arrival or export processing and cancellation is being processed
GIVEN
A cargo had bond information modified during arrival or export processing and cancellation is being processed
Applied to: Restore Bond Information
WHEN
The system processes the cancellation
THEN
The system restores the bond information to its previous state
Context: A cargo status has been changed due to cancellation and dates have been updated
GIVEN
A cargo status has been changed due to cancellation and dates have been updated
Applied to: Recalculate Cargo Age
WHEN
The system completes the status change processing
THEN
The system recalculates the cargo age based on the updated information
Context: A cargo cancellation has been processed and status has been updated
GIVEN
A cargo cancellation has been processed and status has been updated
Applied to: Update Destination Index
WHEN
The system completes the cancellation processing
THEN
The system updates the destination index to reflect the new status
Context: A cargo cancellation has been successfully processed
GIVEN
A cargo cancellation has been successfully processed
Applied to: Generate Cancel Notification
WHEN
The system completes the cancellation processing
THEN
The system generates a cancel notification message for relevant parties
Context: A cargo status has been changed due to cancellation processing
GIVEN
A cargo status has been changed due to cancellation processing
Applied to: Log Status Change
WHEN
The system completes the status change
THEN
The system logs the status change with timestamp and details for audit purposes
Context: A cargo cancellation has been processed and status has been determined
GIVEN
A cargo cancellation has been processed and status has been determined
Applied to: Update Status Arrays
WHEN
The system updates the cargo record
THEN
The system updates all relevant status arrays to reflect the cancellation changes
Context: A cargo cancellation has been processed and status arrays have been updated
GIVEN
A cargo cancellation has been processed and status arrays have been updated
Applied to: Verify Status Restoration
WHEN
The system completes the update process
THEN
The system verifies that the status has been properly restored and is consistent
Context: A cargo cancellation has been verified and processed successfully
GIVEN
A cargo cancellation has been verified and processed successfully
Applied to: Send Cancellation Message
WHEN
The system completes all internal processing
THEN
The system sends cancellation message to external systems and interested parties
R-GCX016E-cbl-02264 (+9) File: GCX016E.cbl Status Information Message Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Information Message Processing':
  • Context - a status information disposition code is received for processing:
    For Validate Disposition Code Against DC Table:
    When the system validates the disposition code against the dc table, then the code validation result determines whether processing continues or an error is generated.
  • Context - a disposition code has been validated against the dc table:
    For Generate Error Message for Unknown Code:
    When the disposition code is not found in the dc table, then an error message is generated for the unknown disposition code and processing continues with next code.
  • Context - a valid disposition code needs to be added to the status array:
    For Check if Code Already Exists in Status Array:
    When the system checks the s09a status array for existing occurrences of the same code, then the duplicate check result determines whether the code should be added or skipped.
  • Context - a disposition code has been checked against the existing status array:
    For Skip Processing - Code Already Present:
    When the same disposition code is already present in the s09a array, then processing is skipped for this code and continues with the next disposition code.
  • Context - a valid disposition code that doesn't already exist in the status array:
    For Insert Status Information Code into S09A Array:
    When the system processes the status information code for insertion, then the disposition code is inserted into the s09a status array with appropriate sequence positioning.
  • Context - a status information disposition code has been successfully inserted into the s09a array:
    For Set Status Information Flag:
    When the system processes the status information addition, then the status information flag is set to indicate informational status has been applied to the cargo.
  • Context - a new status information code has been added to the s09a array:
    For Update Status Array Sequence Counter:
    When the system updates the status array management counters, then the sequence counter is incremented to reflect the new entry and maintain proper array indexing.
  • Context - a status information disposition code has been successfully processed and added:
    For Log Status Information Addition:
    When the system performs logging operations for the status change, then the status information addition is logged with relevant details for audit trail purposes.
  • Context - status information has been logged for a cargo disposition code change:
    For Preserve Status Information for Audit Trail:
    When the system processes audit trail requirements, then the status information change is preserved in the audit trail with complete context for future reference.
  • Context - status information has been successfully processed and preserved in audit trail:
    For Generate Merlin Notification with Status Context:
    When the system generates notifications for the status information change, then a merlin notification is generated with complete status context information for relevant stakeholders.
👨‍💻 Technical ACs (Gherkin)
Context: A status information disposition code is received for processing
GIVEN
A status information disposition code is received for processing
Applied to: Validate Disposition Code Against DC Table
WHEN
The system validates the disposition code against the DC table
THEN
The code validation result determines whether processing continues or an error is generated
Context: A disposition code has been validated against the DC table
GIVEN
A disposition code has been validated against the DC table
Applied to: Generate Error Message for Unknown Code
WHEN
The disposition code is not found in the DC table
THEN
An error message is generated for the unknown disposition code and processing continues with next code
Context: A valid disposition code needs to be added to the status array
GIVEN
A valid disposition code needs to be added to the status array
Applied to: Check if Code Already Exists in Status Array
WHEN
The system checks the S09A status array for existing occurrences of the same code
THEN
The duplicate check result determines whether the code should be added or skipped
Context: A disposition code has been checked against the existing status array
GIVEN
A disposition code has been checked against the existing status array
Applied to: Skip Processing - Code Already Present
WHEN
The same disposition code is already present in the S09A array
THEN
Processing is skipped for this code and continues with the next disposition code
Context: A valid disposition code that doesn't already exist in the status array
GIVEN
A valid disposition code that doesn't already exist in the status array
Applied to: Insert Status Information Code into S09A Array
WHEN
The system processes the status information code for insertion
THEN
The disposition code is inserted into the S09A status array with appropriate sequence positioning
Context: A status information disposition code has been successfully inserted into the S09A array
GIVEN
A status information disposition code has been successfully inserted into the S09A array
Applied to: Set Status Information Flag
WHEN
The system processes the status information addition
THEN
The status information flag is set to indicate informational status has been applied to the cargo
Context: A new status information code has been added to the S09A array
GIVEN
A new status information code has been added to the S09A array
Applied to: Update Status Array Sequence Counter
WHEN
The system updates the status array management counters
THEN
The sequence counter is incremented to reflect the new entry and maintain proper array indexing
Context: A status information disposition code has been successfully processed and added
GIVEN
A status information disposition code has been successfully processed and added
Applied to: Log Status Information Addition
WHEN
The system performs logging operations for the status change
THEN
The status information addition is logged with relevant details for audit trail purposes
Context: Status information has been logged for a cargo disposition code change
GIVEN
Status information has been logged for a cargo disposition code change
Applied to: Preserve Status Information for Audit Trail
WHEN
The system processes audit trail requirements
THEN
The status information change is preserved in the audit trail with complete context for future reference
Context: Status information has been successfully processed and preserved in audit trail
GIVEN
Status information has been successfully processed and preserved in audit trail
Applied to: Generate Merlin Notification with Status Context
WHEN
The system generates notifications for the status information change
THEN
A Merlin notification is generated with complete status context information for relevant stakeholders
R-GCX016E-cbl-02274 (+8) File: GCX016E.cbl Cargo Status Preservation for Audit Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Preservation for Audit':
  • Context - a cargo record exists in the system with current status information:
    For Retrieve Current Cargo Status:
    When the system needs to preserve cargo status for audit purposes, then the current cargo status is retrieved from the cargo root record including all status flags and values.
  • Context - current cargo status has been retrieved from the cargo record:
    For Save Current Status to Audit Fields:
    When status preservation process is initiated, then current status values are copied to corresponding audit fields in the cargo record.
  • Context - cargo record contains current release quantity information:
    For Store Previous Release Quantities:
    When release quantities are about to be modified, then previous release quantities are stored in audit fields for historical tracking.
  • Context - cargo record has current hold status flags set:
    For Preserve Hold Status Flags:
    When hold status is about to be changed, then all current hold status flags are preserved in audit fields for comparison purposes.
  • Context - cargo record contains arrival or export status information:
    For Save Arrival/Export Status:
    When arrival or export status is about to be updated, then current arrival and export status values including dates are saved to audit fields.
  • Context - cargo record has bond information including bond numbers and broker details:
    For Store Bond Information:
    When bond information is about to be modified, then current bond information is stored in audit fields for historical reference.
  • Context - cargo record contains disposition code arrays with current status codes:
    For Save Disposition Code Arrays:
    When disposition codes are about to be processed or modified, then current disposition code arrays are saved to audit fields maintaining sequence and occurrence information.
  • Context - all individual status components have been preserved in audit fields:
    For Create Status Snapshot:
    When complete status preservation is required, then a comprehensive status snapshot is created capturing all cargo status elements at the current point in time.
  • Context - status snapshot has been created with all preserved information:
    For Mark Audit Trail Entry:
    When audit trail entry needs to be finalized, then the audit trail entry is marked with timestamp and processing context for future reference.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with current status information
GIVEN
A cargo record exists in the system with current status information
Applied to: Retrieve Current Cargo Status
WHEN
The system needs to preserve cargo status for audit purposes
THEN
The current cargo status is retrieved from the cargo root record including all status flags and values
Context: Current cargo status has been retrieved from the cargo record
GIVEN
Current cargo status has been retrieved from the cargo record
Applied to: Save Current Status to Audit Fields
WHEN
Status preservation process is initiated
THEN
Current status values are copied to corresponding audit fields in the cargo record
Context: Cargo record contains current release quantity information
GIVEN
Cargo record contains current release quantity information
Applied to: Store Previous Release Quantities
WHEN
Release quantities are about to be modified
THEN
Previous release quantities are stored in audit fields for historical tracking
Context: Cargo record has current hold status flags set
GIVEN
Cargo record has current hold status flags set
Applied to: Preserve Hold Status Flags
WHEN
Hold status is about to be changed
THEN
All current hold status flags are preserved in audit fields for comparison purposes
Context: Cargo record contains arrival or export status information
GIVEN
Cargo record contains arrival or export status information
Applied to: Save Arrival/Export Status
WHEN
Arrival or export status is about to be updated
THEN
Current arrival and export status values including dates are saved to audit fields
Context: Cargo record has bond information including bond numbers and broker details
GIVEN
Cargo record has bond information including bond numbers and broker details
Applied to: Store Bond Information
WHEN
Bond information is about to be modified
THEN
Current bond information is stored in audit fields for historical reference
Context: Cargo record contains disposition code arrays with current status codes
GIVEN
Cargo record contains disposition code arrays with current status codes
Applied to: Save Disposition Code Arrays
WHEN
Disposition codes are about to be processed or modified
THEN
Current disposition code arrays are saved to audit fields maintaining sequence and occurrence information
Context: All individual status components have been preserved in audit fields
GIVEN
All individual status components have been preserved in audit fields
Applied to: Create Status Snapshot
WHEN
Complete status preservation is required
THEN
A comprehensive status snapshot is created capturing all cargo status elements at the current point in time
Context: Status snapshot has been created with all preserved information
GIVEN
Status snapshot has been created with all preserved information
Applied to: Mark Audit Trail Entry
WHEN
Audit trail entry needs to be finalized
THEN
The audit trail entry is marked with timestamp and processing context for future reference
R-GCX016E-cbl-02283 (+16) File: GCX016E.cbl Release Cancellation Detection and Notification Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Cancellation Detection and Notification':
  • Context - a cargo record exists in the system:
    For Cargo Status Change Detected:
    When the cargo processing logic is executed and status arrays are updated, then the system detects that a cargo status change has occurred and triggers status analysis.
  • Context - a cargo status change is detected:
    For Save Previous Cargo Status:
    When the system begins processing the status change, then the previous cargo status and release information is saved for comparison analysis.
  • Context - previous cargo status has been saved:
    For Analyze Current Status Arrays:
    When the system processes the current cargo status arrays, then the current cargo status and release information is analyzed and determined.
  • Context - previous cargo status is saved and current status is analyzed:
    For Release Status Changed?:
    When the system compares the previous and current release status, then the system determines whether the release status has changed or remained the same.
  • Context - a release status change has been detected:
    For Compare Previous vs Current Release Status:
    When the system compares the specific release status values, then the system identifies the exact nature of the release status change.
  • Context - release status comparison is performed:
    For Was Previously Released?:
    When the system evaluates the previous release status, then the system determines if the cargo was previously in a released state.
  • Context - the cargo was previously released:
    For Is Currently Released?:
    When the system evaluates the current release status, then the system determines if the cargo is currently in a released state.
  • Context - the cargo was previously released and is currently not released:
    For Detect Release Cancellation:
    When the system analyzes the status transition, then the system detects that a release cancellation has occurred.
  • Context - a release cancellation has been detected:
    For Generate Release Cancellation Notification:
    When the system processes the cancellation event, then the system generates appropriate business notifications for the release cancellation.
  • Context - a release cancellation notification is being generated:
    For Format Cancellation Message Details:
    When the system formats the cancellation message, then the message includes cargo identification, cancellation details, and relevant transaction information.
  • Context - a cancellation message is being formatted:
    For Include Equipment Information:
    When the system processes equipment information, then the message includes car id, equipment type, and other relevant equipment details.
  • Context - equipment information is included in the cancellation message:
    For Include Disposition Code Details:
    When the system processes disposition code information, then the message includes the disposition code that triggered the release cancellation.
  • Context - disposition code details are included in the cancellation message:
    For Include Date/Time Information:
    When the system processes date and time information, then the message includes transaction date, time, and other relevant temporal information.
  • Context - a complete cancellation message is formatted with all required details:
    For Route to Merlin Message System:
    When the system routes the message to merlin, then the message is successfully submitted to the merlin messaging system for processing.
  • Context - the cancellation message is routed to merlin messaging system:
    For Send to Business Users:
    When the system processes the message delivery, then the notification is delivered to the appropriate business users and stakeholders.
  • Context - the cancellation notification is sent to business users:
    For Log Cancellation Event:
    When the system processes the logging requirement, then the release cancellation event is logged with relevant details for audit and tracking purposes.
  • Context - the cargo status change analysis is complete:
    For No Cancellation Detected:
    When no release cancellation is detected, then the system continues with normal cargo processing without generating cancellation notifications.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Cargo Status Change Detected
WHEN
The cargo processing logic is executed and status arrays are updated
THEN
The system detects that a cargo status change has occurred and triggers status analysis
Context: A cargo status change is detected
GIVEN
A cargo status change is detected
Applied to: Save Previous Cargo Status
WHEN
The system begins processing the status change
THEN
The previous cargo status and release information is saved for comparison analysis
Context: Previous cargo status has been saved
GIVEN
Previous cargo status has been saved
Applied to: Analyze Current Status Arrays
WHEN
The system processes the current cargo status arrays
THEN
The current cargo status and release information is analyzed and determined
Context: Previous cargo status is saved and current status is analyzed
GIVEN
Previous cargo status is saved and current status is analyzed
Applied to: Release Status Changed?
WHEN
The system compares the previous and current release status
THEN
The system determines whether the release status has changed or remained the same
Context: A release status change has been detected
GIVEN
A release status change has been detected
Applied to: Compare Previous vs Current Release Status
WHEN
The system compares the specific release status values
THEN
The system identifies the exact nature of the release status change
Context: Release status comparison is performed
GIVEN
Release status comparison is performed
Applied to: Was Previously Released?
WHEN
The system evaluates the previous release status
THEN
The system determines if the cargo was previously in a released state
Context: The cargo was previously released
GIVEN
The cargo was previously released
Applied to: Is Currently Released?
WHEN
The system evaluates the current release status
THEN
The system determines if the cargo is currently in a released state
Context: The cargo was previously released and is currently not released
GIVEN
The cargo was previously released and is currently not released
Applied to: Detect Release Cancellation
WHEN
The system analyzes the status transition
THEN
The system detects that a release cancellation has occurred
Context: A release cancellation has been detected
GIVEN
A release cancellation has been detected
Applied to: Generate Release Cancellation Notification
WHEN
The system processes the cancellation event
THEN
The system generates appropriate business notifications for the release cancellation
Context: A release cancellation notification is being generated
GIVEN
A release cancellation notification is being generated
Applied to: Format Cancellation Message Details
WHEN
The system formats the cancellation message
THEN
The message includes cargo identification, cancellation details, and relevant transaction information
Context: A cancellation message is being formatted
GIVEN
A cancellation message is being formatted
Applied to: Include Equipment Information
WHEN
The system processes equipment information
THEN
The message includes car ID, equipment type, and other relevant equipment details
Context: Equipment information is included in the cancellation message
GIVEN
Equipment information is included in the cancellation message
Applied to: Include Disposition Code Details
WHEN
The system processes disposition code information
THEN
The message includes the disposition code that triggered the release cancellation
Context: Disposition code details are included in the cancellation message
GIVEN
Disposition code details are included in the cancellation message
Applied to: Include Date/Time Information
WHEN
The system processes date and time information
THEN
The message includes transaction date, time, and other relevant temporal information
Context: A complete cancellation message is formatted with all required details
GIVEN
A complete cancellation message is formatted with all required details
Applied to: Route to Merlin Message System
WHEN
The system routes the message to Merlin
THEN
The message is successfully submitted to the Merlin messaging system for processing
Context: The cancellation message is routed to Merlin messaging system
GIVEN
The cancellation message is routed to Merlin messaging system
Applied to: Send to Business Users
WHEN
The system processes the message delivery
THEN
The notification is delivered to the appropriate business users and stakeholders
Context: The cancellation notification is sent to business users
GIVEN
The cancellation notification is sent to business users
Applied to: Log Cancellation Event
WHEN
The system processes the logging requirement
THEN
The release cancellation event is logged with relevant details for audit and tracking purposes
Context: The cargo status change analysis is complete
GIVEN
The cargo status change analysis is complete
Applied to: No Cancellation Detected
WHEN
No release cancellation is detected
THEN
The system continues with normal cargo processing without generating cancellation notifications
R-GCX016E-cbl-02300 (+27) File: GCX016E.cbl Complex Status Logic Evaluation Merged 28 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Complex Status Logic Evaluation':
  • Context - a cargo record requires status evaluation:
    For Initialize Status Flags:
    When the complex status logic evaluation process begins, then all status flags (hold, release, proceed, arrival, export) are set to false or initial values.
  • Context - a cargo record exists with associated disposition codes:
    For Retrieve S09A Status Arrays:
    When status evaluation process starts, then all s09a status array entries are loaded for analysis.
  • Context - s09a status arrays have been retrieved:
    For More Status Entries?:
    When processing status entries sequentially, then continue to next entry if more exist, otherwise proceed to status analysis.
  • Context - a disposition code is being evaluated:
    For Hold Disposition Code?:
    When the disposition code indicates a hold condition (border hold, destination hold, fda hold), then set the hold status flag to true.
    For Release Disposition Code?:
    When the disposition code indicates a release condition (manual release, auto release), then set the release status flag to true.
    For Proceed Disposition Code?:
    When the disposition code indicates a proceed condition, then set the proceed status flag to true.
    For Arrival Disposition Code?:
    When the disposition code indicates an arrival condition, then set the arrival status flag to true.
    For Export Disposition Code?:
    When the disposition code indicates an export condition, then set the export status flag to true.
  • Context - a hold disposition code has been identified:
    For Set Hold Status Flag:
    When processing the disposition code, then the hold status flag is set to active.
  • Context - a release disposition code has been identified:
    For Set Release Status Flag:
    When processing the disposition code, then the release status flag is set to active.
  • Context - a proceed disposition code has been identified:
    For Set Proceed Status Flag:
    When processing the disposition code, then the proceed status flag is set to active.
  • Context - an arrival disposition code has been identified:
    For Set Arrival Status Flag:
    When processing the disposition code, then the arrival status flag is set to active.
  • Context - an export disposition code has been identified:
    For Set Export Status Flag:
    When processing the disposition code, then the export status flag is set to active.
  • Context - all disposition codes have been processed and status flags are set:
    For Analyze Combined Status Flags:
    When determining the final cargo status, then analyze the combination of status flags according to business priority hierarchy.
  • Context - status flags have been analyzed:
    For Hold Status Active?:
    When the hold status flag is active, then proceed to check if release status overrides the hold.
  • Context - hold status is active:
    For Release Status Active?:
    When release status is also active, then check for manual release to determine final status.
  • Context - both hold and release status are active:
    For Manual Release Present?:
    When a manual release disposition code is present, then set final status to released regardless of hold conditions.
  • Context - hold status is active and no manual release is present:
    For Set Final Status: HELD:
    When determining final status, then set the cargo status to held.
  • Context - no hold status is active:
    For Proceed Status Active?:
    When proceed status flag is active, then check for in-bond entry conditions.
  • Context - proceed status is active:
    For In-Bond Entry Present?:
    When in-bond entry information is present and valid, then set final status to proceed.
  • Context - proceed status is active and in-bond entry conditions are met:
    For Set Final Status: PROCEED:
    When determining final status, then set the cargo status to proceed.
  • Context - no hold or proceed status conditions are active:
    For Arrival Status Active?:
    When arrival status flag is active, then set final status to arrived.
  • Context - arrival status is active and no higher priority conditions exist:
    For Set Final Status: ARRIVED:
    When determining final status, then set the cargo status to arrived.
  • Context - no hold, proceed, or arrival status conditions are active:
    For Export Status Active?:
    When export status flag is active, then set final status to exported.
  • Context - export status is active and no higher priority conditions exist:
    For Set Final Status: EXPORTED:
    When determining final status, then set the cargo status to exported.
  • Context - no specific status conditions (hold, proceed, arrival, export) are active:
    For Set Final Status: RELEASED:
    When determining final status, then set the cargo status to released as the default.
  • Context - final cargo status has been determined:
    For Update Cargo Status:
    When updating cargo information, then the cargo record is updated with the new status.
  • Context - cargo status has been updated:
    For Generate Status Change Notification:
    When status change processing is complete, then generate notifications to relevant parties about the status change.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires status evaluation
GIVEN
A cargo record requires status evaluation
Applied to: Initialize Status Flags
WHEN
The complex status logic evaluation process begins
THEN
All status flags (hold, release, proceed, arrival, export) are set to false or initial values
Context: A cargo record exists with associated disposition codes
GIVEN
A cargo record exists with associated disposition codes
Applied to: Retrieve S09A Status Arrays
WHEN
Status evaluation process starts
THEN
All S09A status array entries are loaded for analysis
Context: S09A status arrays have been retrieved
GIVEN
S09A status arrays have been retrieved
Applied to: More Status Entries?
WHEN
Processing status entries sequentially
THEN
Continue to next entry if more exist, otherwise proceed to status analysis
Context: A disposition code is being evaluated
GIVEN
A disposition code is being evaluated
Applied to: Hold Disposition Code?
WHEN
The disposition code indicates a hold condition (border hold, destination hold, FDA hold)
THEN
Set the hold status flag to true
Applied to: Release Disposition Code?
WHEN
The disposition code indicates a release condition (manual release, auto release)
THEN
Set the release status flag to true
Applied to: Proceed Disposition Code?
WHEN
The disposition code indicates a proceed condition
THEN
Set the proceed status flag to true
Applied to: Arrival Disposition Code?
WHEN
The disposition code indicates an arrival condition
THEN
Set the arrival status flag to true
Applied to: Export Disposition Code?
WHEN
The disposition code indicates an export condition
THEN
Set the export status flag to true
Context: A hold disposition code has been identified
GIVEN
A hold disposition code has been identified
Applied to: Set Hold Status Flag
WHEN
Processing the disposition code
THEN
The hold status flag is set to active
Context: A release disposition code has been identified
GIVEN
A release disposition code has been identified
Applied to: Set Release Status Flag
WHEN
Processing the disposition code
THEN
The release status flag is set to active
Context: A proceed disposition code has been identified
GIVEN
A proceed disposition code has been identified
Applied to: Set Proceed Status Flag
WHEN
Processing the disposition code
THEN
The proceed status flag is set to active
Context: An arrival disposition code has been identified
GIVEN
An arrival disposition code has been identified
Applied to: Set Arrival Status Flag
WHEN
Processing the disposition code
THEN
The arrival status flag is set to active
Context: An export disposition code has been identified
GIVEN
An export disposition code has been identified
Applied to: Set Export Status Flag
WHEN
Processing the disposition code
THEN
The export status flag is set to active
Context: All disposition codes have been processed and status flags are set
GIVEN
All disposition codes have been processed and status flags are set
Applied to: Analyze Combined Status Flags
WHEN
Determining the final cargo status
THEN
Analyze the combination of status flags according to business priority hierarchy
Context: Status flags have been analyzed
GIVEN
Status flags have been analyzed
Applied to: Hold Status Active?
WHEN
The hold status flag is active
THEN
Proceed to check if release status overrides the hold
Context: Hold status is active
GIVEN
Hold status is active
Applied to: Release Status Active?
WHEN
Release status is also active
THEN
Check for manual release to determine final status
Context: Both hold and release status are active
GIVEN
Both hold and release status are active
Applied to: Manual Release Present?
WHEN
A manual release disposition code is present
THEN
Set final status to RELEASED regardless of hold conditions
Context: Hold status is active and no manual release is present
GIVEN
Hold status is active and no manual release is present
Applied to: Set Final Status: HELD
WHEN
Determining final status
THEN
Set the cargo status to HELD
Context: No hold status is active
GIVEN
No hold status is active
Applied to: Proceed Status Active?
WHEN
Proceed status flag is active
THEN
Check for in-bond entry conditions
Context: Proceed status is active
GIVEN
Proceed status is active
Applied to: In-Bond Entry Present?
WHEN
In-bond entry information is present and valid
THEN
Set final status to PROCEED
Context: Proceed status is active and in-bond entry conditions are met
GIVEN
Proceed status is active and in-bond entry conditions are met
Applied to: Set Final Status: PROCEED
WHEN
Determining final status
THEN
Set the cargo status to PROCEED
Context: No hold or proceed status conditions are active
GIVEN
No hold or proceed status conditions are active
Applied to: Arrival Status Active?
WHEN
Arrival status flag is active
THEN
Set final status to ARRIVED
Context: Arrival status is active and no higher priority conditions exist
GIVEN
Arrival status is active and no higher priority conditions exist
Applied to: Set Final Status: ARRIVED
WHEN
Determining final status
THEN
Set the cargo status to ARRIVED
Context: No hold, proceed, or arrival status conditions are active
GIVEN
No hold, proceed, or arrival status conditions are active
Applied to: Export Status Active?
WHEN
Export status flag is active
THEN
Set final status to EXPORTED
Context: Export status is active and no higher priority conditions exist
GIVEN
Export status is active and no higher priority conditions exist
Applied to: Set Final Status: EXPORTED
WHEN
Determining final status
THEN
Set the cargo status to EXPORTED
Context: No specific status conditions (hold, proceed, arrival, export) are active
GIVEN
No specific status conditions (hold, proceed, arrival, export) are active
Applied to: Set Final Status: RELEASED
WHEN
Determining final status
THEN
Set the cargo status to RELEASED as the default
Context: Final cargo status has been determined
GIVEN
Final cargo status has been determined
Applied to: Update Cargo Status
WHEN
Updating cargo information
THEN
The cargo record is updated with the new status
Context: Cargo status has been updated
GIVEN
Cargo status has been updated
Applied to: Generate Status Change Notification
WHEN
Status change processing is complete
THEN
Generate notifications to relevant parties about the status change
R-GCX016E-cbl-02338 (+7) File: GCX016E.cbl Destination Index Management for Arrival Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Index Management for Arrival Processing':
  • Context - a cargo is being processed for arrival and bond information exists in the cargo record:
    For Clear Bond Start Dates:
    When the arrival processing is triggered, then the bond start date should be reset to zero to clear previous bond timing.
  • Context - a cargo is being processed for arrival and no bond information exists in the cargo record:
    For Clear Bond Start Dates:
    When the arrival processing is triggered, then the existing bond start date should be maintained without modification.
  • Context - a cargo is being processed for arrival and the current location is determined:
    For Set Arrival Index:
    When the arrival index needs to be set, then the arrival index should be updated with the current location identifier.
  • Context - a cargo has completed arrival index assignment:
    For Set Arrival Index:
    When the arrival processing procedures are finalized, then the arrival processing flag should be set to indicate completion.
  • Context - a cargo has a valid bond start date:
    For Calculate Cargo Age:
    When cargo age calculation is required during arrival processing, then the system should calculate the number of days between the bond start date and current date.
  • Context - the cargo age has been successfully calculated:
    For Calculate Cargo Age:
    When the age calculation is complete and valid, then the cargo age field should be updated with the calculated number of days.
  • Context - a cargo age has been calculated from bond start date:
    For Validate Age Calculation:
    When the calculated age value needs validation, then the system should verify that the age calculation is valid and within acceptable ranges.
  • Context - the cargo age calculation has failed validation or produced an invalid result:
    For Set Default Age Value:
    When a default age value is needed, then the system should set a predefined default age value for the cargo.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo is being processed for arrival AND bond information exists in the cargo record
GIVEN
A cargo is being processed for arrival AND bond information exists in the cargo record
Applied to: Clear Bond Start Dates
WHEN
The arrival processing is triggered
THEN
The bond start date should be reset to zero to clear previous bond timing
Context: A cargo is being processed for arrival AND no bond information exists in the cargo record
GIVEN
A cargo is being processed for arrival AND no bond information exists in the cargo record
Applied to: Clear Bond Start Dates
WHEN
The arrival processing is triggered
THEN
The existing bond start date should be maintained without modification
Context: A cargo is being processed for arrival AND the current location is determined
GIVEN
A cargo is being processed for arrival AND the current location is determined
Applied to: Set Arrival Index
WHEN
The arrival index needs to be set
THEN
The arrival index should be updated with the current location identifier
Context: A cargo has completed arrival index assignment
GIVEN
A cargo has completed arrival index assignment
Applied to: Set Arrival Index
WHEN
The arrival processing procedures are finalized
THEN
The arrival processing flag should be set to indicate completion
Context: A cargo has a valid bond start date
GIVEN
A cargo has a valid bond start date
Applied to: Calculate Cargo Age
WHEN
Cargo age calculation is required during arrival processing
THEN
The system should calculate the number of days between the bond start date and current date
Context: The cargo age has been successfully calculated
GIVEN
The cargo age has been successfully calculated
Applied to: Calculate Cargo Age
WHEN
The age calculation is complete and valid
THEN
The cargo age field should be updated with the calculated number of days
Context: A cargo age has been calculated from bond start date
GIVEN
A cargo age has been calculated from bond start date
Applied to: Validate Age Calculation
WHEN
The calculated age value needs validation
THEN
The system should verify that the age calculation is valid and within acceptable ranges
Context: The cargo age calculation has failed validation OR produced an invalid result
GIVEN
The cargo age calculation has failed validation OR produced an invalid result
Applied to: Set Default Age Value
WHEN
A default age value is needed
THEN
The system should set a predefined default age value for the cargo
R-GCX016E-cbl-02346 (+10) File: GCX016E.cbl Destination Index Management for Export Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Index Management for Export Processing':
  • Context - a cargo has an export disposition code:
    For Clear Destination Index:
    When the export processing is triggered, then the destination index field is cleared to spaces.
  • Context - a cargo is being processed for export:
    For Reset Bond Start Date:
    When the destination index has been cleared, then the bond start date is reset to zeros.
  • Context - a cargo is undergoing export processing:
    For Update Export Flag:
    When the bond start date has been reset, then the export flag is set to 'y' to indicate export status.
  • Context - a cargo has an arrival date and current processing date:
    For Calculate Cargo Age:
    When export processing is being performed, then the cargo age is calculated as the difference between current date and arrival date.
  • Context - a cargo has a specified export location:
    For Validate Export Location:
    When export processing validation is performed, then the system verifies the export location exists in the valid location table.
  • Context - a cargo has a valid export location:
    For Set Export Status to Active:
    When export location validation is successful, then the cargo export status is set to 'export' and marked as active.
  • Context - a cargo has been successfully set to export status:
    For Generate Export Notification:
    When export status is active, then an export notification message is generated and sent to appropriate recipients.
  • Context - a cargo has completed export processing steps:
    For Update Cargo Record:
    When all export data has been prepared, then the cargo record is updated in the database with export status, cleared destination index, and reset bond date.
  • Context - a cargo has been processed for export:
    For Log Export Action:
    When the cargo record has been updated, then an audit log entry is created recording the export action with timestamp and cargo details.
  • Context - a cargo has an invalid export location:
    For Generate Error Message:
    When export location validation fails, then an error message is generated indicating invalid export location and export processing is not completed.
  • Context - export processing has encountered an error:
    For Maintain Previous Status:
    When an error message has been generated, then the cargo retains its previous status and no export changes are applied.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo has an export disposition code
GIVEN
A cargo has an export disposition code
Applied to: Clear Destination Index
WHEN
The export processing is triggered
THEN
The destination index field is cleared to spaces
Context: A cargo is being processed for export
GIVEN
A cargo is being processed for export
Applied to: Reset Bond Start Date
WHEN
The destination index has been cleared
THEN
The bond start date is reset to zeros
Context: A cargo is undergoing export processing
GIVEN
A cargo is undergoing export processing
Applied to: Update Export Flag
WHEN
The bond start date has been reset
THEN
The export flag is set to 'Y' to indicate export status
Context: A cargo has an arrival date and current processing date
GIVEN
A cargo has an arrival date and current processing date
Applied to: Calculate Cargo Age
WHEN
Export processing is being performed
THEN
The cargo age is calculated as the difference between current date and arrival date
Context: A cargo has a specified export location
GIVEN
A cargo has a specified export location
Applied to: Validate Export Location
WHEN
Export processing validation is performed
THEN
The system verifies the export location exists in the valid location table
Context: A cargo has a valid export location
GIVEN
A cargo has a valid export location
Applied to: Set Export Status to Active
WHEN
Export location validation is successful
THEN
The cargo export status is set to 'EXPORT' and marked as active
Context: A cargo has been successfully set to export status
GIVEN
A cargo has been successfully set to export status
Applied to: Generate Export Notification
WHEN
Export status is active
THEN
An export notification message is generated and sent to appropriate recipients
Context: A cargo has completed export processing steps
GIVEN
A cargo has completed export processing steps
Applied to: Update Cargo Record
WHEN
All export data has been prepared
THEN
The cargo record is updated in the database with export status, cleared destination index, and reset bond date
Context: A cargo has been processed for export
GIVEN
A cargo has been processed for export
Applied to: Log Export Action
WHEN
The cargo record has been updated
THEN
An audit log entry is created recording the export action with timestamp and cargo details
Context: A cargo has an invalid export location
GIVEN
A cargo has an invalid export location
Applied to: Generate Error Message
WHEN
Export location validation fails
THEN
An error message is generated indicating invalid export location and export processing is not completed
Context: Export processing has encountered an error
GIVEN
Export processing has encountered an error
Applied to: Maintain Previous Status
WHEN
An error message has been generated
THEN
The cargo retains its previous status and no export changes are applied
R-GCX016E-cbl-02357 (+12) File: GCX016E.cbl Destination Index Management for Bond Restoration Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Index Management for Bond Restoration':
  • Context - a cargo status change has been detected:
    For Bond Information Available?:
    When the system checks for existing bond information, then the system determines if bond data is available and routes processing accordingly.
  • Context - bond information is available for the cargo:
    For Retrieve Previous Bond Data:
    When the system needs to restore bond information, then the system retrieves the previous bond data from the cargo record.
  • Context - previous bond data has been retrieved:
    For Clear Current Destination Index:
    When the system begins bond restoration, then the system clears the current destination index field.
  • Context - the destination index has been cleared:
    For Restore Bond Start Date:
    When the system processes bond restoration, then the system restores the bond start date from previous bond data.
  • Context - the bond start date has been restored:
    For Set Bond Number Index:
    When the system continues bond restoration, then the system sets the bond number index from the restored bond data.
  • Context - the bond number index has been set:
    For Restore Broker QP Information:
    When the system processes broker information restoration, then the system restores the broker qp information from bond data.
  • Context - broker qp information has been restored:
    For Calculate Current Date:
    When the system needs to calculate cargo age, then the system calculates the current system date.
  • Context - the current date has been calculated and bond start date is available:
    For Calculate Cargo Age in Days:
    When the system calculates cargo age, then the system computes the difference in days between current date and bond start date.
  • Context - cargo age has been calculated in days:
    For Age Calculation Valid?:
    When the system validates the age calculation, then the system determines if the calculated age is valid and within business rules.
  • Context - the age calculation is valid:
    For Update Cargo Age Field:
    When the system updates cargo information, then the system updates the cargo age field with the calculated age in days.
  • Context - cargo age has been updated or age calculation was invalid:
    For Set Bond Restoration Flag:
    When the system completes bond restoration processing, then the system sets the bond restoration completion flag.
  • Context - the bond restoration flag has been set:
    For Log Bond Restoration Action:
    When the system performs audit logging, then the system logs the bond restoration action with relevant details.
  • Context - bond restoration action has been logged:
    For Update Cargo Record:
    When the system finalizes the restoration process, then the system updates the cargo record with all restored bond information, age calculation, and restoration flags.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status change has been detected
GIVEN
A cargo status change has been detected
Applied to: Bond Information Available?
WHEN
The system checks for existing bond information
THEN
The system determines if bond data is available and routes processing accordingly
Context: Bond information is available for the cargo
GIVEN
Bond information is available for the cargo
Applied to: Retrieve Previous Bond Data
WHEN
The system needs to restore bond information
THEN
The system retrieves the previous bond data from the cargo record
Context: Previous bond data has been retrieved
GIVEN
Previous bond data has been retrieved
Applied to: Clear Current Destination Index
WHEN
The system begins bond restoration
THEN
The system clears the current destination index field
Context: The destination index has been cleared
GIVEN
The destination index has been cleared
Applied to: Restore Bond Start Date
WHEN
The system processes bond restoration
THEN
The system restores the bond start date from previous bond data
Context: The bond start date has been restored
GIVEN
The bond start date has been restored
Applied to: Set Bond Number Index
WHEN
The system continues bond restoration
THEN
The system sets the bond number index from the restored bond data
Context: The bond number index has been set
GIVEN
The bond number index has been set
Applied to: Restore Broker QP Information
WHEN
The system processes broker information restoration
THEN
The system restores the broker QP information from bond data
Context: Broker QP information has been restored
GIVEN
Broker QP information has been restored
Applied to: Calculate Current Date
WHEN
The system needs to calculate cargo age
THEN
The system calculates the current system date
Context: The current date has been calculated and bond start date is available
GIVEN
The current date has been calculated and bond start date is available
Applied to: Calculate Cargo Age in Days
WHEN
The system calculates cargo age
THEN
The system computes the difference in days between current date and bond start date
Context: Cargo age has been calculated in days
GIVEN
Cargo age has been calculated in days
Applied to: Age Calculation Valid?
WHEN
The system validates the age calculation
THEN
The system determines if the calculated age is valid and within business rules
Context: The age calculation is valid
GIVEN
The age calculation is valid
Applied to: Update Cargo Age Field
WHEN
The system updates cargo information
THEN
The system updates the cargo age field with the calculated age in days
Context: Cargo age has been updated or age calculation was invalid
GIVEN
Cargo age has been updated or age calculation was invalid
Applied to: Set Bond Restoration Flag
WHEN
The system completes bond restoration processing
THEN
The system sets the bond restoration completion flag
Context: The bond restoration flag has been set
GIVEN
The bond restoration flag has been set
Applied to: Log Bond Restoration Action
WHEN
The system performs audit logging
THEN
The system logs the bond restoration action with relevant details
Context: Bond restoration action has been logged
GIVEN
Bond restoration action has been logged
Applied to: Update Cargo Record
WHEN
The system finalizes the restoration process
THEN
The system updates the cargo record with all restored bond information, age calculation, and restoration flags
R-GCX016E-cbl-02384 (+19) File: GCX016E.cbl Cargo Release Verification and Notification Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Release Verification and Notification':
  • Context - a cargo record exists with a specific car id and waybill number:
    For Retrieve All Cargo Records with Same Car ID and Waybill:
    When the system initiates cargo release verification process, then all cargo records matching the same car id and waybill combination are retrieved for processing.
  • Context - a collection of cargo records has been retrieved for processing:
    For More Cargo Records?:
    When the system evaluates the collection status, then the system returns true if more records exist to process, false if all records have been processed.
  • Context - an individual cargo record from the collection:
    For Analyze Individual Cargo Record:
    When the system processes the cargo record, then the cargo record's status, hold conditions, and release eligibility are evaluated.
  • Context - a cargo record under analysis:
    For Check Hold Status:
    When the system checks for hold conditions, then the system identifies any active holds including border holds, destination holds, fda holds, or other regulatory holds.
  • Context - hold status check has been completed on a cargo record:
    For Hold Status Found?:
    When the system evaluates the hold check results, then if any hold status is found, proceed to manual release check; if no holds found, proceed to release eligibility evaluation.
  • Context - a cargo record with identified hold status:
    For Check Manual Release Status:
    When the system checks for manual release authorization, then the system determines if manual release disposition codes or authorizations have been applied to the cargo.
  • Context - manual release status check has been completed:
    For Manual Release Applied?:
    When the system evaluates manual release results, then if manual release is applied, proceed to piece count hold check; if not applied, proceed to other hold type checks.
  • Context - a cargo record with manual release applied:
    For Check Piece Count Holds:
    When the system checks piece count status, then the system identifies any piece count holds, partial release conditions, or quantity discrepancies.
  • Context - piece count hold check has been completed:
    For Piece Count Issues?:
    When the system evaluates piece count results, then if piece count issues exist, proceed to other hold type checks; if no issues, proceed to release eligibility evaluation.
  • Context - a cargo record requiring comprehensive hold analysis:
    For Check Various Hold Types:
    When the system checks for various hold types, then the system identifies examination holds, regulatory holds, security holds, or other specialized hold conditions.
  • Context - various hold types check has been completed:
    For Other Hold Types?:
    When the system evaluates additional hold results, then regardless of other hold type results, proceed to release eligibility evaluation.
  • Context - a cargo record with completed hold status analysis:
    For Evaluate Release Eligibility:
    When the system evaluates overall release eligibility, then the cargo is marked as release-eligible if no blocking holds exist, or marked as held if blocking conditions remain.
  • Context - all cargo records in the car/waybill group have been individually analyzed:
    For All Records Released?:
    When the system evaluates the collective release status, then if all records are released, proceed to generate comprehensive release notification; if any records remain held, end the release verification process.
  • Context - all cargo records with the same car id and waybill are confirmed as released:
    For Generate Comprehensive Release Notification:
    When the system generates release notification, then a comprehensive release notification is created containing all relevant cargo and release information.
  • Context - a comprehensive release notification is being created:
    For Format Release Message with Equipment Details:
    When the system formats the release message, then the message includes car id, waybill number, equipment type, and other relevant equipment identification details.
  • Context - a release message with equipment details:
    For Include Disposition Code Information:
    When the system includes disposition code information, then the message contains relevant disposition codes, processing actions, and regulatory compliance information.
  • Context - a release message with disposition code information:
    For Add Quantity Impact Analysis:
    When the system adds quantity impact analysis, then the message shows released quantities, remaining quantities, and impact on total cargo counts.
  • Context - a complete release notification message:
    For Send Release Notification to Recipients:
    When the system sends the notification, then the notification is delivered to brokers, freight forwarders, and other authorized recipients based on cargo ownership and processing requirements.
  • Context - release notification has been sent successfully:
    For Update Cargo Status Arrays:
    When the system updates cargo status arrays, then all cargo records in the group have their status arrays updated to reflect released status and notification completion.
  • Context - cargo status arrays have been updated:
    For Log Release Verification Action:
    When the system logs the release verification action, then an audit record is created with timestamp, cargo details, release status, and notification recipients for compliance tracking.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with a specific car ID and waybill number
GIVEN
A cargo record exists with a specific car ID and waybill number
Applied to: Retrieve All Cargo Records with Same Car ID and Waybill
WHEN
The system initiates cargo release verification process
THEN
All cargo records matching the same car ID and waybill combination are retrieved for processing
Context: A collection of cargo records has been retrieved for processing
GIVEN
A collection of cargo records has been retrieved for processing
Applied to: More Cargo Records?
WHEN
The system evaluates the collection status
THEN
The system returns true if more records exist to process, false if all records have been processed
Context: An individual cargo record from the collection
GIVEN
An individual cargo record from the collection
Applied to: Analyze Individual Cargo Record
WHEN
The system processes the cargo record
THEN
The cargo record's status, hold conditions, and release eligibility are evaluated
Context: A cargo record under analysis
GIVEN
A cargo record under analysis
Applied to: Check Hold Status
WHEN
The system checks for hold conditions
THEN
The system identifies any active holds including border holds, destination holds, FDA holds, or other regulatory holds
Context: Hold status check has been completed on a cargo record
GIVEN
Hold status check has been completed on a cargo record
Applied to: Hold Status Found?
WHEN
The system evaluates the hold check results
THEN
If any hold status is found, proceed to manual release check; if no holds found, proceed to release eligibility evaluation
Context: A cargo record with identified hold status
GIVEN
A cargo record with identified hold status
Applied to: Check Manual Release Status
WHEN
The system checks for manual release authorization
THEN
The system determines if manual release disposition codes or authorizations have been applied to the cargo
Context: Manual release status check has been completed
GIVEN
Manual release status check has been completed
Applied to: Manual Release Applied?
WHEN
The system evaluates manual release results
THEN
If manual release is applied, proceed to piece count hold check; if not applied, proceed to other hold type checks
Context: A cargo record with manual release applied
GIVEN
A cargo record with manual release applied
Applied to: Check Piece Count Holds
WHEN
The system checks piece count status
THEN
The system identifies any piece count holds, partial release conditions, or quantity discrepancies
Context: Piece count hold check has been completed
GIVEN
Piece count hold check has been completed
Applied to: Piece Count Issues?
WHEN
The system evaluates piece count results
THEN
If piece count issues exist, proceed to other hold type checks; if no issues, proceed to release eligibility evaluation
Context: A cargo record requiring comprehensive hold analysis
GIVEN
A cargo record requiring comprehensive hold analysis
Applied to: Check Various Hold Types
WHEN
The system checks for various hold types
THEN
The system identifies examination holds, regulatory holds, security holds, or other specialized hold conditions
Context: Various hold types check has been completed
GIVEN
Various hold types check has been completed
Applied to: Other Hold Types?
WHEN
The system evaluates additional hold results
THEN
Regardless of other hold type results, proceed to release eligibility evaluation
Context: A cargo record with completed hold status analysis
GIVEN
A cargo record with completed hold status analysis
Applied to: Evaluate Release Eligibility
WHEN
The system evaluates overall release eligibility
THEN
The cargo is marked as release-eligible if no blocking holds exist, or marked as held if blocking conditions remain
Context: All cargo records in the car/waybill group have been individually analyzed
GIVEN
All cargo records in the car/waybill group have been individually analyzed
Applied to: All Records Released?
WHEN
The system evaluates the collective release status
THEN
If all records are released, proceed to generate comprehensive release notification; if any records remain held, end the release verification process
Context: All cargo records with the same car ID and waybill are confirmed as released
GIVEN
All cargo records with the same car ID and waybill are confirmed as released
Applied to: Generate Comprehensive Release Notification
WHEN
The system generates release notification
THEN
A comprehensive release notification is created containing all relevant cargo and release information
Context: A comprehensive release notification is being created
GIVEN
A comprehensive release notification is being created
Applied to: Format Release Message with Equipment Details
WHEN
The system formats the release message
THEN
The message includes car ID, waybill number, equipment type, and other relevant equipment identification details
Context: A release message with equipment details
GIVEN
A release message with equipment details
Applied to: Include Disposition Code Information
WHEN
The system includes disposition code information
THEN
The message contains relevant disposition codes, processing actions, and regulatory compliance information
Context: A release message with disposition code information
GIVEN
A release message with disposition code information
Applied to: Add Quantity Impact Analysis
WHEN
The system adds quantity impact analysis
THEN
The message shows released quantities, remaining quantities, and impact on total cargo counts
Context: A complete release notification message
GIVEN
A complete release notification message
Applied to: Send Release Notification to Recipients
WHEN
The system sends the notification
THEN
The notification is delivered to brokers, freight forwarders, and other authorized recipients based on cargo ownership and processing requirements
Context: Release notification has been sent successfully
GIVEN
Release notification has been sent successfully
Applied to: Update Cargo Status Arrays
WHEN
The system updates cargo status arrays
THEN
All cargo records in the group have their status arrays updated to reflect released status and notification completion
Context: Cargo status arrays have been updated
GIVEN
Cargo status arrays have been updated
Applied to: Log Release Verification Action
WHEN
The system logs the release verification action
THEN
An audit record is created with timestamp, cargo details, release status, and notification recipients for compliance tracking
R-GCX016E-cbl-02404 (+14) File: GCX016E.cbl Cargo Hold Status Analysis Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Hold Status Analysis':
  • Context - a cargo record with status array containing disposition codes:
    For Check Manual Release Flag:
    When the system analyzes the cargo status for manual release indicators, then the manual release flag is set if manual release disposition codes are present in the status array.
    For Process Border Hold Status:
    When the system checks for border hold indicators in the status array, then the border hold flag is set if border hold disposition codes are present.
    For Process Destination Hold Status:
    When the system checks for destination hold indicators in the status array, then the destination hold flag is set if destination hold disposition codes are present.
    For Process FDA Hold Status:
    When the system checks for fda hold indicators in the status array, then the fda hold flag is set and cargo status is set to 'holdfda' if fda hold disposition codes are present.
    For Process Piece Count Hold Status:
    When the system checks for piece count hold indicators in the status array, then the piece count hold flag is set if piece count hold disposition codes are present.
  • Context - a cargo with manual release flag set to true:
    For Set Manual Release Status:
    When the system processes the cargo status determination, then the cargo status is set to 'relsd' (released) and manual release processing is applied.
  • Context - a cargo record with total quantity and released quantity values:
    For Evaluate Release Quantities:
    When the system evaluates the release quantities for completeness, then the system determines if the cargo is fully released, partially released, or not released based on quantity comparison.
  • Context - a cargo with released quantity equal to total quantity:
    For Set Full Release Eligible:
    When the system evaluates release eligibility, then the cargo is marked as fully released and eligible for complete release processing.
  • Context - a cargo with released quantity less than total quantity:
    For Set Partial Release Status:
    When the system evaluates release status, then the cargo is marked with partial release status and appropriate hold status is maintained.
  • Context - a cargo with multiple active hold conditions (border, destination, fda, piece count):
    For Determine Highest Priority Hold:
    When the system evaluates hold priority hierarchy, then the highest priority hold status is determined based on predefined hold precedence rules.
  • Context - a cargo with determined highest priority hold type:
    For Set Final Hold Status:
    When the system sets the final cargo status, then the cargo status is set to the appropriate hold status (hold, hold-b, hold-d, holdfda, holdpcs) based on the priority determination.
  • Context - a cargo with analyzed hold conditions and quantity comparisons:
    For Determine Release Eligibility:
    When the system performs final release eligibility assessment, then the cargo is determined to be either release eligible or hold eligible based on the comprehensive analysis.
  • Context - a cargo determined to be release eligible:
    For Set Cargo Release Status:
    When the system assigns final cargo status, then the cargo status is set to 'relsd' (released) or 'holdpcs' (hold pieces) based on quantity analysis.
  • Context - a cargo determined to have active hold conditions:
    For Set Cargo Hold Status:
    When the system assigns final cargo status, then the cargo status is set to the appropriate hold status based on the type and priority of active holds.
  • Context - a cargo with final status determination completed:
    For Update Cargo Status Flags:
    When the system updates cargo status flags, then all relevant status flags (hold flags, release flags, processing flags) are updated to reflect the final cargo status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with status array containing disposition codes
GIVEN
A cargo record with status array containing disposition codes
Applied to: Check Manual Release Flag
WHEN
The system analyzes the cargo status for manual release indicators
THEN
The manual release flag is set if manual release disposition codes are present in the status array
Applied to: Process Border Hold Status
WHEN
The system checks for border hold indicators in the status array
THEN
The border hold flag is set if border hold disposition codes are present
Applied to: Process Destination Hold Status
WHEN
The system checks for destination hold indicators in the status array
THEN
The destination hold flag is set if destination hold disposition codes are present
Applied to: Process FDA Hold Status
WHEN
The system checks for FDA hold indicators in the status array
THEN
The FDA hold flag is set and cargo status is set to 'HOLDFDA' if FDA hold disposition codes are present
Applied to: Process Piece Count Hold Status
WHEN
The system checks for piece count hold indicators in the status array
THEN
The piece count hold flag is set if piece count hold disposition codes are present
Context: A cargo with manual release flag set to true
GIVEN
A cargo with manual release flag set to true
Applied to: Set Manual Release Status
WHEN
The system processes the cargo status determination
THEN
The cargo status is set to 'RELSD' (Released) and manual release processing is applied
Context: A cargo record with total quantity and released quantity values
GIVEN
A cargo record with total quantity and released quantity values
Applied to: Evaluate Release Quantities
WHEN
The system evaluates the release quantities for completeness
THEN
The system determines if the cargo is fully released, partially released, or not released based on quantity comparison
Context: A cargo with released quantity equal to total quantity
GIVEN
A cargo with released quantity equal to total quantity
Applied to: Set Full Release Eligible
WHEN
The system evaluates release eligibility
THEN
The cargo is marked as fully released and eligible for complete release processing
Context: A cargo with released quantity less than total quantity
GIVEN
A cargo with released quantity less than total quantity
Applied to: Set Partial Release Status
WHEN
The system evaluates release status
THEN
The cargo is marked with partial release status and appropriate hold status is maintained
Context: A cargo with multiple active hold conditions (border, destination, FDA, piece count)
GIVEN
A cargo with multiple active hold conditions (border, destination, FDA, piece count)
Applied to: Determine Highest Priority Hold
WHEN
The system evaluates hold priority hierarchy
THEN
The highest priority hold status is determined based on predefined hold precedence rules
Context: A cargo with determined highest priority hold type
GIVEN
A cargo with determined highest priority hold type
Applied to: Set Final Hold Status
WHEN
The system sets the final cargo status
THEN
The cargo status is set to the appropriate hold status (HOLD, HOLD-B, HOLD-D, HOLDFDA, HOLDPCS) based on the priority determination
Context: A cargo with analyzed hold conditions and quantity comparisons
GIVEN
A cargo with analyzed hold conditions and quantity comparisons
Applied to: Determine Release Eligibility
WHEN
The system performs final release eligibility assessment
THEN
The cargo is determined to be either release eligible or hold eligible based on the comprehensive analysis
Context: A cargo determined to be release eligible
GIVEN
A cargo determined to be release eligible
Applied to: Set Cargo Release Status
WHEN
The system assigns final cargo status
THEN
The cargo status is set to 'RELSD' (Released) or 'HOLDPCS' (Hold Pieces) based on quantity analysis
Context: A cargo determined to have active hold conditions
GIVEN
A cargo determined to have active hold conditions
Applied to: Set Cargo Hold Status
WHEN
The system assigns final cargo status
THEN
The cargo status is set to the appropriate hold status based on the type and priority of active holds
Context: A cargo with final status determination completed
GIVEN
A cargo with final status determination completed
Applied to: Update Cargo Status Flags
WHEN
The system updates cargo status flags
THEN
All relevant status flags (hold flags, release flags, processing flags) are updated to reflect the final cargo status
R-GCX016E-cbl-02419 (+15) File: GCX016E.cbl New Foreign Cargo Record Creation Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'New Foreign Cargo Record Creation':
  • Context - a foreign bill of lading number is being processed:
    For Foreign Bill Not Found in System:
    When the system searches for the bill and it is not found in the existing cargo database, then the system should trigger the new cargo record creation process.
  • Context - a new cargo record needs to be created for a foreign bill:
    For Initialize New Cargo Record:
    When the initialization process begins, then the system should clear all cargo record fields and set default values for status, dates, and counters.
  • Context - a new cargo record is being created and x4 segment data is available:
    For Set Up Cargo Record with X4 Segment Data:
    When the system processes the x4 segment information, then the cargo record should be populated with disposition code, entry number, quantity, and related x4 segment data.
  • Context - a new cargo record is being created and n7 segment data is available:
    For Set Up Cargo Record with N7 Segment Data:
    When the system processes the n7 segment information, then the cargo record should be populated with equipment initial, equipment number, and formatted car id information.
  • Context - a new foreign cargo record is being created and m10 segment data is available:
    For Build Foreign Manifest from M10 Segment:
    When the system processes the m10 segment information, then the system should create a foreign manifest record with vessel name, manifest number, and related m10 segment data.
  • Context - manifest data is available for a new foreign cargo record:
    For Extract SCAC Code:
    When the system processes the manifest information, then the system should extract and validate the scac code from the manifest data.
    For Extract Transport Type:
    When the system processes the transportation information, then the system should extract and set the appropriate transport type code.
    For Extract Country Code:
    When the system processes the origin information, then the system should extract and validate the country code from the manifest data.
  • Context - m10 segment data is available for a new foreign cargo record:
    For Extract Vessel Details:
    When the system processes the vessel information, then the system should extract vessel name, voyage number, and other vessel identification details.
  • Context - equipment initial and equipment number are available from n7 segment:
    For Format Car ID for Database:
    When the system formats the car identification for database storage, then the system should concatenate equipment initial and number with proper formatting and padding.
  • Context - a new cargo record has been populated with segment data:
    For Validate Cargo Record Data:
    When the system validates the cargo record before insertion, then the system should verify all required fields are present and data formats are correct.
  • Context - a validated new cargo record is ready for insertion:
    For Insert New Cargo Record into Database:
    When the system attempts to insert the record into the database, then the system should successfully add the new cargo record to the database.
  • Context - a new cargo record insertion has been attempted:
    For Database Insert Successful?:
    When the database operation completes, then the system should check the operation status and determine if the insertion was successful.
  • Context - a new cargo record has been successfully inserted into the database:
    For Log Cargo Creation Action:
    When the insertion operation completes successfully, then the system should log the cargo creation action with relevant details and timestamps.
  • Context - a new cargo record insertion has failed:
    For Generate Error Message:
    When the database operation returns an error status, then the system should generate an error message indicating the insertion failure.
  • Context - cargo record creation process has completed (either successfully or with error):
    For Continue Processing:
    When the creation process finishes, then the system should continue with the next step in the message processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A foreign bill of lading number is being processed
GIVEN
A foreign bill of lading number is being processed
Applied to: Foreign Bill Not Found in System
WHEN
The system searches for the bill and it is not found in the existing cargo database
THEN
The system should trigger the new cargo record creation process
Context: A new cargo record needs to be created for a foreign bill
GIVEN
A new cargo record needs to be created for a foreign bill
Applied to: Initialize New Cargo Record
WHEN
The initialization process begins
THEN
The system should clear all cargo record fields and set default values for status, dates, and counters
Context: A new cargo record is being created and X4 segment data is available
GIVEN
A new cargo record is being created and X4 segment data is available
Applied to: Set Up Cargo Record with X4 Segment Data
WHEN
The system processes the X4 segment information
THEN
The cargo record should be populated with disposition code, entry number, quantity, and related X4 segment data
Context: A new cargo record is being created and N7 segment data is available
GIVEN
A new cargo record is being created and N7 segment data is available
Applied to: Set Up Cargo Record with N7 Segment Data
WHEN
The system processes the N7 segment information
THEN
The cargo record should be populated with equipment initial, equipment number, and formatted car ID information
Context: A new foreign cargo record is being created and M10 segment data is available
GIVEN
A new foreign cargo record is being created and M10 segment data is available
Applied to: Build Foreign Manifest from M10 Segment
WHEN
The system processes the M10 segment information
THEN
The system should create a foreign manifest record with vessel name, manifest number, and related M10 segment data
Context: Manifest data is available for a new foreign cargo record
GIVEN
Manifest data is available for a new foreign cargo record
Applied to: Extract SCAC Code
WHEN
The system processes the manifest information
THEN
The system should extract and validate the SCAC code from the manifest data
Applied to: Extract Transport Type
WHEN
The system processes the transportation information
THEN
The system should extract and set the appropriate transport type code
Applied to: Extract Country Code
WHEN
The system processes the origin information
THEN
The system should extract and validate the country code from the manifest data
Context: M10 segment data is available for a new foreign cargo record
GIVEN
M10 segment data is available for a new foreign cargo record
Applied to: Extract Vessel Details
WHEN
The system processes the vessel information
THEN
The system should extract vessel name, voyage number, and other vessel identification details
Context: Equipment initial and equipment number are available from N7 segment
GIVEN
Equipment initial and equipment number are available from N7 segment
Applied to: Format Car ID for Database
WHEN
The system formats the car identification for database storage
THEN
The system should concatenate equipment initial and number with proper formatting and padding
Context: A new cargo record has been populated with segment data
GIVEN
A new cargo record has been populated with segment data
Applied to: Validate Cargo Record Data
WHEN
The system validates the cargo record before insertion
THEN
The system should verify all required fields are present and data formats are correct
Context: A validated new cargo record is ready for insertion
GIVEN
A validated new cargo record is ready for insertion
Applied to: Insert New Cargo Record into Database
WHEN
The system attempts to insert the record into the database
THEN
The system should successfully add the new cargo record to the database
Context: A new cargo record insertion has been attempted
GIVEN
A new cargo record insertion has been attempted
Applied to: Database Insert Successful?
WHEN
The database operation completes
THEN
The system should check the operation status and determine if the insertion was successful
Context: A new cargo record has been successfully inserted into the database
GIVEN
A new cargo record has been successfully inserted into the database
Applied to: Log Cargo Creation Action
WHEN
The insertion operation completes successfully
THEN
The system should log the cargo creation action with relevant details and timestamps
Context: A new cargo record insertion has failed
GIVEN
A new cargo record insertion has failed
Applied to: Generate Error Message
WHEN
The database operation returns an error status
THEN
The system should generate an error message indicating the insertion failure
Context: Cargo record creation process has completed (either successfully or with error)
GIVEN
Cargo record creation process has completed (either successfully or with error)
Applied to: Continue Processing
WHEN
The creation process finishes
THEN
The system should continue with the next step in the message processing workflow
R-GCX016E-cbl-02435 (+13) File: GCX016E.cbl Foreign Manifest Building from M10 Segments Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Foreign Manifest Building from M10 Segments':
  • Context - an m10 segment containing carrier information is received:
    For Extract SCAC Code from M10:
    When the system processes the m10 segment for foreign manifest building, then the scac code is extracted from the m10 segment and stored for manifest construction.
  • Context - an m10 segment containing transport information is received:
    For Extract Transport Type from M10:
    When the system processes the m10 segment for foreign manifest building, then the transport type is extracted from the m10 segment and stored for manifest construction.
  • Context - an m10 segment containing country information is received:
    For Extract Country Code from M10:
    When the system processes the m10 segment for foreign manifest building, then the country code is extracted from the m10 segment and stored for manifest construction.
  • Context - an m10 segment containing vessel information is received:
    For Extract Vessel Details from M10:
    When the system processes the m10 segment for foreign manifest building, then the vessel details including name and identification are extracted from the m10 segment and stored for manifest construction.
  • Context - a scac code has been extracted from the m10 segment:
    For Validate SCAC Information:
    When the system validates the scac information for foreign manifest building, then the scac code is checked for validity and completeness according to business rules.
  • Context - a scac code has been validated and found to be invalid or missing:
    For Set Default SCAC Values:
    When the scac validation fails during foreign manifest building, then default scac values are applied to ensure manifest can be constructed.
  • Context - vessel details have been extracted from the m10 segment:
    For Extract Vessel Name/ID:
    When the system processes vessel information for foreign manifest building, then the vessel name and identification are extracted and prepared for manifest structure.
  • Context - vessel information has been processed from the m10 segment:
    For Extract Voyage Information:
    When the system extracts voyage details for foreign manifest building, then voyage information is extracted and prepared for inclusion in the manifest structure.
  • Context - all required information has been extracted from the m10 segment including scac, transport type, country code, and vessel details:
    For Build Foreign Manifest Structure:
    When the system builds the foreign manifest structure, then a complete foreign manifest structure is constructed with all extracted information properly organized.
  • Context - transport type has been extracted from the m10 segment and foreign manifest structure is being built:
    For Set Transport Mode Information:
    When the system sets transport mode information in the manifest, then transport mode information is properly configured in the foreign manifest structure.
  • Context - country code has been extracted from the m10 segment and foreign manifest structure is being built:
    For Set Country of Origin:
    When the system sets country of origin in the manifest, then country of origin information is properly configured in the foreign manifest structure.
  • Context - a foreign manifest structure has been built with extracted m10 segment information:
    For Validate Manifest Completeness:
    When the system validates manifest completeness, then all required manifest fields are checked for presence and validity.
  • Context - a foreign manifest has been validated and found to be incomplete:
    For Log Missing Information Warning:
    When required information is missing from the manifest, then a warning is logged indicating the missing information details.
  • Context - a foreign manifest structure has been built and validated (either complete or with logged warnings):
    For Finalize Foreign Manifest:
    When the system finalizes the foreign manifest, then the foreign manifest is prepared for return to the cargo creation process.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 segment containing carrier information is received
GIVEN
An M10 segment containing carrier information is received
Applied to: Extract SCAC Code from M10
WHEN
The system processes the M10 segment for foreign manifest building
THEN
The SCAC code is extracted from the M10 segment and stored for manifest construction
Context: An M10 segment containing transport information is received
GIVEN
An M10 segment containing transport information is received
Applied to: Extract Transport Type from M10
WHEN
The system processes the M10 segment for foreign manifest building
THEN
The transport type is extracted from the M10 segment and stored for manifest construction
Context: An M10 segment containing country information is received
GIVEN
An M10 segment containing country information is received
Applied to: Extract Country Code from M10
WHEN
The system processes the M10 segment for foreign manifest building
THEN
The country code is extracted from the M10 segment and stored for manifest construction
Context: An M10 segment containing vessel information is received
GIVEN
An M10 segment containing vessel information is received
Applied to: Extract Vessel Details from M10
WHEN
The system processes the M10 segment for foreign manifest building
THEN
The vessel details including name and identification are extracted from the M10 segment and stored for manifest construction
Context: A SCAC code has been extracted from the M10 segment
GIVEN
A SCAC code has been extracted from the M10 segment
Applied to: Validate SCAC Information
WHEN
The system validates the SCAC information for foreign manifest building
THEN
The SCAC code is checked for validity and completeness according to business rules
Context: A SCAC code has been validated and found to be invalid or missing
GIVEN
A SCAC code has been validated and found to be invalid or missing
Applied to: Set Default SCAC Values
WHEN
The SCAC validation fails during foreign manifest building
THEN
Default SCAC values are applied to ensure manifest can be constructed
Context: Vessel details have been extracted from the M10 segment
GIVEN
Vessel details have been extracted from the M10 segment
Applied to: Extract Vessel Name/ID
WHEN
The system processes vessel information for foreign manifest building
THEN
The vessel name and identification are extracted and prepared for manifest structure
Context: Vessel information has been processed from the M10 segment
GIVEN
Vessel information has been processed from the M10 segment
Applied to: Extract Voyage Information
WHEN
The system extracts voyage details for foreign manifest building
THEN
Voyage information is extracted and prepared for inclusion in the manifest structure
Context: All required information has been extracted from the M10 segment including SCAC, transport type, country code, and vessel details
GIVEN
All required information has been extracted from the M10 segment including SCAC, transport type, country code, and vessel details
Applied to: Build Foreign Manifest Structure
WHEN
The system builds the foreign manifest structure
THEN
A complete foreign manifest structure is constructed with all extracted information properly organized
Context: Transport type has been extracted from the M10 segment and foreign manifest structure is being built
GIVEN
Transport type has been extracted from the M10 segment and foreign manifest structure is being built
Applied to: Set Transport Mode Information
WHEN
The system sets transport mode information in the manifest
THEN
Transport mode information is properly configured in the foreign manifest structure
Context: Country code has been extracted from the M10 segment and foreign manifest structure is being built
GIVEN
Country code has been extracted from the M10 segment and foreign manifest structure is being built
Applied to: Set Country of Origin
WHEN
The system sets country of origin in the manifest
THEN
Country of origin information is properly configured in the foreign manifest structure
Context: A foreign manifest structure has been built with extracted M10 segment information
GIVEN
A foreign manifest structure has been built with extracted M10 segment information
Applied to: Validate Manifest Completeness
WHEN
The system validates manifest completeness
THEN
All required manifest fields are checked for presence and validity
Context: A foreign manifest has been validated and found to be incomplete
GIVEN
A foreign manifest has been validated and found to be incomplete
Applied to: Log Missing Information Warning
WHEN
Required information is missing from the manifest
THEN
A warning is logged indicating the missing information details
Context: A foreign manifest structure has been built and validated (either complete or with logged warnings)
GIVEN
A foreign manifest structure has been built and validated (either complete or with logged warnings)
Applied to: Finalize Foreign Manifest
WHEN
The system finalizes the foreign manifest
THEN
The foreign manifest is prepared for return to the cargo creation process
R-GCX016E-cbl-02449 (+11) File: GCX016E.cbl Station Data Lookup and Validation Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Data Lookup and Validation':
  • Context - a station data lookup request is initiated:
    For Station Type Required?:
    When the system evaluates the station type requirement, then the system routes to either destination station retrieval or key station retrieval based on the station type needed.
  • Context - a destination station lookup is required:
    For Retrieve Destination Station Information:
    When the system processes the destination station request, then the system accesses the ds table via gcctbio to retrieve destination station information.
  • Context - a key station lookup is required:
    For Retrieve Key Station Information:
    When the system processes the key station request, then the system accesses the ks table via gcctbio to retrieve key station information.
  • Context - destination station information is needed:
    For Access DS Table via GCCTBIO:
    When the system calls gcctbio to access the ds table, then the system retrieves station data from the ds table using the gcctbio interface.
  • Context - key station information is needed:
    For Access KS Table via GCCTBIO:
    When the system calls gcctbio to access the ks table, then the system retrieves station data from the ks table using the gcctbio interface.
  • Context - a station lookup has been performed in either ds or ks table:
    For Station Found?:
    When the system evaluates the lookup results, then the system determines if the station was found and routes to either location validation or station not found error processing.
  • Context - a station has been found in the station table:
    For Validate Location Identifier:
    When the system validates the location identifier for the station, then the system determines if the location identifier is valid for cargo routing purposes.
  • Context - a location identifier has been validated:
    For Location Valid?:
    When the system checks the validation results, then the system routes to either station information setup for cargo routing or invalid location error processing.
  • Context - a station has been found and its location identifier is valid:
    For Set Station Information for Cargo Routing:
    When the system sets up station information, then the system configures the station data for cargo routing operations and completes the station lookup process.
  • Context - a station lookup has been performed:
    For Generate Station Not Found Error:
    When the requested station is not found in either ds or ks table, then the system generates a station not found error and completes the station lookup process.
  • Context - a station has been found but its location identifier has been validated:
    For Generate Invalid Location Error:
    When the location identifier fails validation criteria, then the system generates an invalid location error and completes the station lookup process.
  • Context - station lookup processing has been performed with either successful station setup or error generation:
    For Station Lookup Complete:
    When the station lookup process reaches completion, then the system finalizes the station lookup operation and returns control to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A station data lookup request is initiated
GIVEN
A station data lookup request is initiated
Applied to: Station Type Required?
WHEN
The system evaluates the station type requirement
THEN
The system routes to either destination station retrieval or key station retrieval based on the station type needed
Context: A destination station lookup is required
GIVEN
A destination station lookup is required
Applied to: Retrieve Destination Station Information
WHEN
The system processes the destination station request
THEN
The system accesses the DS table via GCCTBIO to retrieve destination station information
Context: A key station lookup is required
GIVEN
A key station lookup is required
Applied to: Retrieve Key Station Information
WHEN
The system processes the key station request
THEN
The system accesses the KS table via GCCTBIO to retrieve key station information
Context: Destination station information is needed
GIVEN
Destination station information is needed
Applied to: Access DS Table via GCCTBIO
WHEN
The system calls GCCTBIO to access the DS table
THEN
The system retrieves station data from the DS table using the GCCTBIO interface
Context: Key station information is needed
GIVEN
Key station information is needed
Applied to: Access KS Table via GCCTBIO
WHEN
The system calls GCCTBIO to access the KS table
THEN
The system retrieves station data from the KS table using the GCCTBIO interface
Context: A station lookup has been performed in either DS or KS table
GIVEN
A station lookup has been performed in either DS or KS table
Applied to: Station Found?
WHEN
The system evaluates the lookup results
THEN
The system determines if the station was found and routes to either location validation or station not found error processing
Context: A station has been found in the station table
GIVEN
A station has been found in the station table
Applied to: Validate Location Identifier
WHEN
The system validates the location identifier for the station
THEN
The system determines if the location identifier is valid for cargo routing purposes
Context: A location identifier has been validated
GIVEN
A location identifier has been validated
Applied to: Location Valid?
WHEN
The system checks the validation results
THEN
The system routes to either station information setup for cargo routing or invalid location error processing
Context: A station has been found and its location identifier is valid
GIVEN
A station has been found and its location identifier is valid
Applied to: Set Station Information for Cargo Routing
WHEN
The system sets up station information
THEN
The system configures the station data for cargo routing operations and completes the station lookup process
Context: A station lookup has been performed
GIVEN
A station lookup has been performed
Applied to: Generate Station Not Found Error
WHEN
The requested station is not found in either DS or KS table
THEN
The system generates a station not found error and completes the station lookup process
Context: A station has been found but its location identifier has been validated
GIVEN
A station has been found but its location identifier has been validated
Applied to: Generate Invalid Location Error
WHEN
The location identifier fails validation criteria
THEN
The system generates an invalid location error and completes the station lookup process
Context: Station lookup processing has been performed with either successful station setup or error generation
GIVEN
Station lookup processing has been performed with either successful station setup or error generation
Applied to: Station Lookup Complete
WHEN
The station lookup process reaches completion
THEN
The system finalizes the station lookup operation and returns control to the calling process
R-GCX016E-cbl-02461 (+27) File: GCX016E.cbl Comprehensive Merlin Message Formatting with Quantity Impact Merged 28 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Comprehensive Merlin Message Formatting with Quantity Impact':
  • Context - a cargo disposition code processing event requires merlin notification:
    For Initialize Merlin Message Structure:
    When the system begins formatting a comprehensive merlin message, then the merlin message structure is initialized with default values and prepared for content population.
  • Context - a merlin message is being formatted for cargo processing:
    For Format Equipment Information:
    When equipment information needs to be included in the message, then the system formats equipment initial, number, and type into the message structure.
  • Context - equipment information has been formatted in the merlin message:
    For Add Car ID and Waybill Details:
    When car id and waybill details are available for the cargo, then the system adds the car id and waybill number to the message content.
  • Context - car id and waybill details have been added to the message:
    For Include US-CCN Information:
    When us-ccn information is available for the cargo, then the system includes the us-ccn in the message for customs tracking purposes.
  • Context - us-ccn information has been included in the message:
    For Format Disposition Code Details:
    When a disposition code has been processed for the cargo, then the system formats the disposition code and related details into the message.
  • Context - disposition code details have been formatted:
    For Add Disposition Code Description:
    When a disposition code description is available in the system, then the system adds the descriptive text explaining the disposition code action to the message.
  • Context - a disposition code has been processed for cargo:
    For Calculate Release Quantity Impact:
    When the disposition code affects release quantities, then the system calculates the before and after quantities to determine the impact.
  • Context - release quantity impact has been calculated:
    For Before/After Quantities Different?:
    When before and after quantities are compared, then the system determines if there is a significant difference requiring quantity impact messaging.
  • Context - before and after quantities are different:
    For Format Quantity Impact Message:
    When quantity impact messaging is required, then the system formats a detailed message showing the quantity changes.
  • Context - quantity impact message is being formatted:
    For Show Before Quantity:
    When before quantity information is available, then the system includes the original quantity value in the impact message.
  • Context - before quantity has been shown in the impact message:
    For Show After Quantity:
    When after quantity information is available, then the system includes the resulting quantity value in the impact message.
  • Context - before and after quantities have been shown:
    For Add Impact Description:
    When impact description is needed for clarity, then the system adds explanatory text describing whether quantities increased, decreased, or were modified.
  • Context - quantity impact processing is complete or not applicable:
    For Include Cargo Status Information:
    When cargo status information is available, then the system includes current cargo status details in the message.
  • Context - cargo status information is being included:
    For Add Current Cargo Status:
    When current cargo status is available in the system, then the system adds the current status code and description to the message.
  • Context - current cargo status has been added to the message:
    For Include Hold/Release Flags:
    When hold or release flags are set for the cargo, then the system includes the relevant hold/release flag information in the message.
  • Context - hold/release flags have been included in the message:
    For Process K1 Comments:
    When k1 comments processing is initiated, then the system evaluates available k1 comments for potential inclusion.
  • Context - k1 comments processing has been initiated:
    For K1 Comments Available?:
    When the system evaluates k1 comment availability, then the system determines if valid k1 comments exist for message inclusion.
  • Context - k1 comments are available for inclusion:
    For Add Free-Form Text Messages:
    When free-form text messages need to be added, then the system formats and includes the k1 comment text in the message.
  • Context - free-form text messages have been added or k1 comments are not available:
    For Include Processing Details:
    When processing details need to be included, then the system adds relevant processing details and context information to the message.
  • Context - processing details have been included in the message:
    For Add Special Comments:
    When special comments are available for the cargo or processing event, then the system adds the special comments to enhance message content.
  • Context - special comments have been processed:
    For Canadian Pacific Railway Bond?:
    When the system evaluates bond creation requirements, then the system determines if canadian pacific railway bond processing is involved.
  • Context - canadian pacific railway bond processing is identified:
    For Add CPR Bond Creation Notice:
    When bond creation notice is required, then the system adds cpr bond creation notification text to the message.
  • Context - cpr bond notice has been added or is not applicable:
    For Format Date/Time Information:
    When date and time information needs to be formatted, then the system formats relevant dates and times for inclusion in the message.
  • Context - date/time information formatting has been initiated:
    For Add USCS Processing Time:
    When uscs processing time is available, then the system adds the uscs processing timestamp to the message.
  • Context - uscs processing time has been added:
    For Add System Processing Time:
    When system processing time needs to be recorded, then the system adds the internal processing timestamp to the message.
  • Context - system processing time has been added:
    For Finalize Message Content:
    When message content assembly is complete, then the system finalizes the message content structure and prepares for message attributes.
  • Context - message content has been finalized:
    For Set Message Type and Priority:
    When message attributes need to be set, then the system assigns the appropriate message type and priority level for proper routing and handling.
  • Context - message type and priority have been set:
    For Complete Merlin Message:
    When final message assembly is required, then the system completes the merlin message with all formatted content, ready for transmission.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo disposition code processing event requires Merlin notification
GIVEN
A cargo disposition code processing event requires Merlin notification
Applied to: Initialize Merlin Message Structure
WHEN
The system begins formatting a comprehensive Merlin message
THEN
The Merlin message structure is initialized with default values and prepared for content population
Context: A Merlin message is being formatted for cargo processing
GIVEN
A Merlin message is being formatted for cargo processing
Applied to: Format Equipment Information
WHEN
Equipment information needs to be included in the message
THEN
The system formats equipment initial, number, and type into the message structure
Context: Equipment information has been formatted in the Merlin message
GIVEN
Equipment information has been formatted in the Merlin message
Applied to: Add Car ID and Waybill Details
WHEN
Car ID and waybill details are available for the cargo
THEN
The system adds the car ID and waybill number to the message content
Context: Car ID and waybill details have been added to the message
GIVEN
Car ID and waybill details have been added to the message
Applied to: Include US-CCN Information
WHEN
US-CCN information is available for the cargo
THEN
The system includes the US-CCN in the message for customs tracking purposes
Context: US-CCN information has been included in the message
GIVEN
US-CCN information has been included in the message
Applied to: Format Disposition Code Details
WHEN
A disposition code has been processed for the cargo
THEN
The system formats the disposition code and related details into the message
Context: Disposition code details have been formatted
GIVEN
Disposition code details have been formatted
Applied to: Add Disposition Code Description
WHEN
A disposition code description is available in the system
THEN
The system adds the descriptive text explaining the disposition code action to the message
Context: A disposition code has been processed for cargo
GIVEN
A disposition code has been processed for cargo
Applied to: Calculate Release Quantity Impact
WHEN
The disposition code affects release quantities
THEN
The system calculates the before and after quantities to determine the impact
Context: Release quantity impact has been calculated
GIVEN
Release quantity impact has been calculated
Applied to: Before/After Quantities Different?
WHEN
Before and after quantities are compared
THEN
The system determines if there is a significant difference requiring quantity impact messaging
Context: Before and after quantities are different
GIVEN
Before and after quantities are different
Applied to: Format Quantity Impact Message
WHEN
Quantity impact messaging is required
THEN
The system formats a detailed message showing the quantity changes
Context: Quantity impact message is being formatted
GIVEN
Quantity impact message is being formatted
Applied to: Show Before Quantity
WHEN
Before quantity information is available
THEN
The system includes the original quantity value in the impact message
Context: Before quantity has been shown in the impact message
GIVEN
Before quantity has been shown in the impact message
Applied to: Show After Quantity
WHEN
After quantity information is available
THEN
The system includes the resulting quantity value in the impact message
Context: Before and after quantities have been shown
GIVEN
Before and after quantities have been shown
Applied to: Add Impact Description
WHEN
Impact description is needed for clarity
THEN
The system adds explanatory text describing whether quantities increased, decreased, or were modified
Context: Quantity impact processing is complete or not applicable
GIVEN
Quantity impact processing is complete or not applicable
Applied to: Include Cargo Status Information
WHEN
Cargo status information is available
THEN
The system includes current cargo status details in the message
Context: Cargo status information is being included
GIVEN
Cargo status information is being included
Applied to: Add Current Cargo Status
WHEN
Current cargo status is available in the system
THEN
The system adds the current status code and description to the message
Context: Current cargo status has been added to the message
GIVEN
Current cargo status has been added to the message
Applied to: Include Hold/Release Flags
WHEN
Hold or release flags are set for the cargo
THEN
The system includes the relevant hold/release flag information in the message
Context: Hold/release flags have been included in the message
GIVEN
Hold/release flags have been included in the message
Applied to: Process K1 Comments
WHEN
K1 comments processing is initiated
THEN
The system evaluates available K1 comments for potential inclusion
Context: K1 comments processing has been initiated
GIVEN
K1 comments processing has been initiated
Applied to: K1 Comments Available?
WHEN
The system evaluates K1 comment availability
THEN
The system determines if valid K1 comments exist for message inclusion
Context: K1 comments are available for inclusion
GIVEN
K1 comments are available for inclusion
Applied to: Add Free-Form Text Messages
WHEN
Free-form text messages need to be added
THEN
The system formats and includes the K1 comment text in the message
Context: Free-form text messages have been added or K1 comments are not available
GIVEN
Free-form text messages have been added or K1 comments are not available
Applied to: Include Processing Details
WHEN
Processing details need to be included
THEN
The system adds relevant processing details and context information to the message
Context: Processing details have been included in the message
GIVEN
Processing details have been included in the message
Applied to: Add Special Comments
WHEN
Special comments are available for the cargo or processing event
THEN
The system adds the special comments to enhance message content
Context: Special comments have been processed
GIVEN
Special comments have been processed
Applied to: Canadian Pacific Railway Bond?
WHEN
The system evaluates bond creation requirements
THEN
The system determines if Canadian Pacific Railway bond processing is involved
Context: Canadian Pacific Railway bond processing is identified
GIVEN
Canadian Pacific Railway bond processing is identified
Applied to: Add CPR Bond Creation Notice
WHEN
Bond creation notice is required
THEN
The system adds CPR bond creation notification text to the message
Context: CPR bond notice has been added or is not applicable
GIVEN
CPR bond notice has been added or is not applicable
Applied to: Format Date/Time Information
WHEN
Date and time information needs to be formatted
THEN
The system formats relevant dates and times for inclusion in the message
Context: Date/time information formatting has been initiated
GIVEN
Date/time information formatting has been initiated
Applied to: Add USCS Processing Time
WHEN
USCS processing time is available
THEN
The system adds the USCS processing timestamp to the message
Context: USCS processing time has been added
GIVEN
USCS processing time has been added
Applied to: Add System Processing Time
WHEN
System processing time needs to be recorded
THEN
The system adds the internal processing timestamp to the message
Context: System processing time has been added
GIVEN
System processing time has been added
Applied to: Finalize Message Content
WHEN
Message content assembly is complete
THEN
The system finalizes the message content structure and prepares for message attributes
Context: Message content has been finalized
GIVEN
Message content has been finalized
Applied to: Set Message Type and Priority
WHEN
Message attributes need to be set
THEN
The system assigns the appropriate message type and priority level for proper routing and handling
Context: Message type and priority have been set
GIVEN
Message type and priority have been set
Applied to: Complete Merlin Message
WHEN
Final message assembly is required
THEN
The system completes the Merlin message with all formatted content, ready for transmission
R-GCX016E-cbl-02489 (+9) File: GCX016E.cbl Broker Bond Creation Notification Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Bond Creation Notification Processing':
  • Context - a k1 free-form text segment is received:
    For Identify Canadian Pacific Railway Bond Creation:
    When the k1 segment contains 'director of customs, cp rail' or 'canadian pacific limited' or 'canadian pacific railway co', then the message is identified as a canadian pacific railway bond creation request.
  • Context - a k1 segment is identified as canadian pacific railway bond creation:
    For Extract Bond Information from K1 Segment:
    When the system processes the k1 segment content, then bond information including bond number, broker details, and creation request data is extracted from the free-form text.
  • Context - bond information has been extracted from k1 segment:
    For Validate Bond Creation Request:
    When the system validates the bond creation request, then the bond information is verified for completeness and business rule compliance.
    For Generate Error Message for Invalid Bond:
    When bond validation fails due to incomplete or invalid information, then an error message is generated indicating the specific validation failure and the bond creation request is rejected.
  • Context - valid bond information has been extracted and validated:
    For Format Bond Creation Notification:
    When the system formats the bond creation notification, then a structured notification message is created containing bond details, broker information, and creation timestamp.
  • Context - a bond creation notification is being formatted for canadian pacific railway:
    For Add Special Comments for CPR Bond:
    When special comments are added to the message, then cpr-specific identifiers and comments are included in the notification message.
  • Context - a bond creation notification message is being prepared:
    For Include Bond Details in Message:
    When bond details are included in the message, then complete bond information including bond number, broker details, and creation context is added to the merlin message.
  • Context - bond details and special comments have been prepared:
    For Create Comprehensive Merlin Notification:
    When the comprehensive merlin notification is created, then a complete notification message is generated with all bond creation information formatted for business user consumption.
  • Context - a comprehensive merlin notification has been created:
    For Route to Appropriate Recipients:
    When the notification is routed to recipients, then the message is sent to appropriate business users, brokers, and systems based on established routing rules.
  • Context - a bond creation notification has been routed to recipients:
    For Log Bond Creation Action:
    When the action is logged, then bond creation notification details are recorded in the system log for audit and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 free-form text segment is received
GIVEN
A K1 free-form text segment is received
Applied to: Identify Canadian Pacific Railway Bond Creation
WHEN
The K1 segment contains 'DIRECTOR OF CUSTOMS, CP RAIL' OR 'CANADIAN PACIFIC LIMITED' OR 'CANADIAN PACIFIC RAILWAY CO'
THEN
The message is identified as a Canadian Pacific Railway bond creation request
Context: A K1 segment is identified as Canadian Pacific Railway bond creation
GIVEN
A K1 segment is identified as Canadian Pacific Railway bond creation
Applied to: Extract Bond Information from K1 Segment
WHEN
The system processes the K1 segment content
THEN
Bond information including bond number, broker details, and creation request data is extracted from the free-form text
Context: Bond information has been extracted from K1 segment
GIVEN
Bond information has been extracted from K1 segment
Applied to: Validate Bond Creation Request
WHEN
The system validates the bond creation request
THEN
The bond information is verified for completeness and business rule compliance
Applied to: Generate Error Message for Invalid Bond
WHEN
Bond validation fails due to incomplete or invalid information
THEN
An error message is generated indicating the specific validation failure and the bond creation request is rejected
Context: Valid bond information has been extracted and validated
GIVEN
Valid bond information has been extracted and validated
Applied to: Format Bond Creation Notification
WHEN
The system formats the bond creation notification
THEN
A structured notification message is created containing bond details, broker information, and creation timestamp
Context: A bond creation notification is being formatted for Canadian Pacific Railway
GIVEN
A bond creation notification is being formatted for Canadian Pacific Railway
Applied to: Add Special Comments for CPR Bond
WHEN
Special comments are added to the message
THEN
CPR-specific identifiers and comments are included in the notification message
Context: A bond creation notification message is being prepared
GIVEN
A bond creation notification message is being prepared
Applied to: Include Bond Details in Message
WHEN
Bond details are included in the message
THEN
Complete bond information including bond number, broker details, and creation context is added to the Merlin message
Context: Bond details and special comments have been prepared
GIVEN
Bond details and special comments have been prepared
Applied to: Create Comprehensive Merlin Notification
WHEN
The comprehensive Merlin notification is created
THEN
A complete notification message is generated with all bond creation information formatted for business user consumption
Context: A comprehensive Merlin notification has been created
GIVEN
A comprehensive Merlin notification has been created
Applied to: Route to Appropriate Recipients
WHEN
The notification is routed to recipients
THEN
The message is sent to appropriate business users, brokers, and systems based on established routing rules
Context: A bond creation notification has been routed to recipients
GIVEN
A bond creation notification has been routed to recipients
Applied to: Log Bond Creation Action
WHEN
The action is logged
THEN
Bond creation notification details are recorded in the system log for audit and tracking purposes
R-GCX016E-cbl-02499 (+10) File: GCX016E.cbl Release Quantity Impact Analysis Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Quantity Impact Analysis':
  • Context - a cargo record exists with release quantity information:
    For Retrieve Current Cargo Release Quantity:
    When release quantity impact analysis is initiated, then the current cargo release quantity is retrieved and stored for comparison calculations.
  • Context - a disposition code is being processed for cargo:
    For Identify Disposition Code Action Type:
    When the system evaluates the disposition code's quantity impact characteristics, then the action type is classified as add action, subtract action, or status info only based on the disposition code properties.
  • Context - a disposition code with add action type is being processed:
    For Add to Release Quantity:
    When the quantity impact calculation is performed, then the disposition code quantity is added to the current cargo release quantity.
  • Context - a disposition code with subtract action type is being processed:
    For Subtract from Release Quantity:
    When the quantity impact calculation is performed, then the disposition code quantity is subtracted from the current cargo release quantity.
  • Context - a disposition code with status info only type is being processed:
    For No Quantity Impact:
    When the quantity impact evaluation is performed, then no quantity calculations are performed and the release quantity remains unchanged.
  • Context - a disposition code with quantity impact has been processed:
    For Calculate Before/After Quantities:
    When before and after quantity calculation is performed, then the system calculates and stores both the original quantity and the new quantity after disposition code impact.
  • Context - before and after quantities have been calculated for a disposition code:
    For Format Quantity Impact Message:
    When quantity impact message formatting is initiated, then a formatted message is created showing the quantity change details in business-friendly format.
  • Context - before and after release quantities are available:
    For Release Quantity Changed?:
    When the system compares the quantities for changes, then if the before and after quantities are different, the system identifies that release quantity has changed, otherwise no change is detected.
  • Context - a release quantity change has been detected:
    For Create Impact Description:
    When impact description creation is initiated, then a detailed description is created showing the specific quantity change amount and direction (increase/decrease).
  • Context - a quantity impact description has been created:
    For Add to Merlin Message:
    When merlin message composition is in progress, then the quantity impact information is added to the merlin message content for business user notification.
  • Context - no release quantity change was detected or disposition code has no quantity impact:
    For Skip Quantity Impact Reporting:
    When quantity impact reporting evaluation is performed, then the system skips creating impact descriptions and does not add quantity information to notifications.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with release quantity information
GIVEN
A cargo record exists with release quantity information
Applied to: Retrieve Current Cargo Release Quantity
WHEN
Release quantity impact analysis is initiated
THEN
The current cargo release quantity is retrieved and stored for comparison calculations
Context: A disposition code is being processed for cargo
GIVEN
A disposition code is being processed for cargo
Applied to: Identify Disposition Code Action Type
WHEN
The system evaluates the disposition code's quantity impact characteristics
THEN
The action type is classified as Add Action, Subtract Action, or Status Info Only based on the disposition code properties
Context: A disposition code with Add Action type is being processed
GIVEN
A disposition code with Add Action type is being processed
Applied to: Add to Release Quantity
WHEN
The quantity impact calculation is performed
THEN
The disposition code quantity is added to the current cargo release quantity
Context: A disposition code with Subtract Action type is being processed
GIVEN
A disposition code with Subtract Action type is being processed
Applied to: Subtract from Release Quantity
WHEN
The quantity impact calculation is performed
THEN
The disposition code quantity is subtracted from the current cargo release quantity
Context: A disposition code with Status Info Only type is being processed
GIVEN
A disposition code with Status Info Only type is being processed
Applied to: No Quantity Impact
WHEN
The quantity impact evaluation is performed
THEN
No quantity calculations are performed and the release quantity remains unchanged
Context: A disposition code with quantity impact has been processed
GIVEN
A disposition code with quantity impact has been processed
Applied to: Calculate Before/After Quantities
WHEN
Before and after quantity calculation is performed
THEN
The system calculates and stores both the original quantity and the new quantity after disposition code impact
Context: Before and after quantities have been calculated for a disposition code
GIVEN
Before and after quantities have been calculated for a disposition code
Applied to: Format Quantity Impact Message
WHEN
Quantity impact message formatting is initiated
THEN
A formatted message is created showing the quantity change details in business-friendly format
Context: Before and after release quantities are available
GIVEN
Before and after release quantities are available
Applied to: Release Quantity Changed?
WHEN
The system compares the quantities for changes
THEN
If the before and after quantities are different, the system identifies that release quantity has changed, otherwise no change is detected
Context: A release quantity change has been detected
GIVEN
A release quantity change has been detected
Applied to: Create Impact Description
WHEN
Impact description creation is initiated
THEN
A detailed description is created showing the specific quantity change amount and direction (increase/decrease)
Context: A quantity impact description has been created
GIVEN
A quantity impact description has been created
Applied to: Add to Merlin Message
WHEN
Merlin message composition is in progress
THEN
The quantity impact information is added to the Merlin message content for business user notification
Context: No release quantity change was detected or disposition code has no quantity impact
GIVEN
No release quantity change was detected or disposition code has no quantity impact
Applied to: Skip Quantity Impact Reporting
WHEN
Quantity impact reporting evaluation is performed
THEN
The system skips creating impact descriptions and does not add quantity information to notifications
R-GCX016E-cbl-02510 (+11) File: GCX016E.cbl New Cargo Record Insertion Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'New Cargo Record Insertion':
  • Context - a new cargo record needs to be created in the system:
    For Initialize New Cargo Record:
    When the cargo record initialization process is triggered, then a new cargo record structure is created with all fields initialized to default values and ready for data population.
  • Context - a cargo record exists and x4 segment data is available with disposition codes and quantities:
    For Set Up Cargo Record with X4 Segment Data:
    When x4 segment data is processed for cargo record setup, then the cargo record is populated with disposition code, entry number, quantity information, and processing flags from the x4 segment.
  • Context - a cargo record exists and n7 segment data is available with equipment details:
    For Set Up Cargo Record with N7 Segment Data:
    When n7 segment data is processed for cargo record setup, then the cargo record is populated with equipment initial, equipment number, car id, and equipment type information from the n7 segment.
  • Context - a cargo record with equipment and routing information is being processed:
    For CPRS Traffic?:
    When the system evaluates the cargo type for cprs classification, then the system identifies whether the cargo is cprs traffic or standard traffic based on predefined cprs indicators.
  • Context - a cargo record is identified as cprs traffic:
    For Apply CPRS Special Handling:
    When cprs special handling is applied to the cargo record, then the car id information is cleared and cprs-specific processing rules are applied to the cargo record.
  • Context - a cargo record is identified as non-cprs traffic with equipment initial and number available:
    For Apply Standard Car ID Formatting:
    When standard car id formatting is applied, then the car id is formatted according to standard rules combining equipment initial and equipment number.
  • Context - a cargo record has car id information that needs formatting:
    For Format Car ID According to Standards:
    When car id formatting standards are applied, then the car id is formatted according to system standards with proper spacing, character positioning, and validation.
  • Context - a cargo record is populated with x4 and n7 segment data and formatted car id:
    For Validate Cargo Record Data:
    When cargo record validation is performed, then all required fields are validated for completeness, data integrity, and business rule compliance, and any validation errors are identified.
  • Context - a validated cargo record is ready for database insertion:
    For Insert Cargo Record into Database:
    When the database insertion operation is executed, then the cargo record is inserted into the gcsusrt database table and the operation result is captured.
  • Context - a cargo record insertion operation has been attempted:
    For Database Insert Successful?:
    When the database insertion result is evaluated, then the system determines whether the insertion was successful or failed based on database response codes.
  • Context - a cargo record has been successfully inserted into the database:
    For Log Successful Insertion:
    When success logging is performed, then the successful insertion is logged with cargo record details, timestamp, and confirmation of database update.
  • Context - a cargo record insertion operation has failed:
    For Handle Database Insert Error:
    When database insert error handling is triggered, then the insertion failure is logged with error details and appropriate error recovery or notification procedures are initiated.
👨‍💻 Technical ACs (Gherkin)
Context: A new cargo record needs to be created in the system
GIVEN
A new cargo record needs to be created in the system
Applied to: Initialize New Cargo Record
WHEN
The cargo record initialization process is triggered
THEN
A new cargo record structure is created with all fields initialized to default values and ready for data population
Context: A cargo record exists and X4 segment data is available with disposition codes and quantities
GIVEN
A cargo record exists and X4 segment data is available with disposition codes and quantities
Applied to: Set Up Cargo Record with X4 Segment Data
WHEN
X4 segment data is processed for cargo record setup
THEN
The cargo record is populated with disposition code, entry number, quantity information, and processing flags from the X4 segment
Context: A cargo record exists and N7 segment data is available with equipment details
GIVEN
A cargo record exists and N7 segment data is available with equipment details
Applied to: Set Up Cargo Record with N7 Segment Data
WHEN
N7 segment data is processed for cargo record setup
THEN
The cargo record is populated with equipment initial, equipment number, car ID, and equipment type information from the N7 segment
Context: A cargo record with equipment and routing information is being processed
GIVEN
A cargo record with equipment and routing information is being processed
Applied to: CPRS Traffic?
WHEN
The system evaluates the cargo type for CPRS classification
THEN
The system identifies whether the cargo is CPRS traffic or standard traffic based on predefined CPRS indicators
Context: A cargo record is identified as CPRS traffic
GIVEN
A cargo record is identified as CPRS traffic
Applied to: Apply CPRS Special Handling
WHEN
CPRS special handling is applied to the cargo record
THEN
The car ID information is cleared and CPRS-specific processing rules are applied to the cargo record
Context: A cargo record is identified as non-CPRS traffic with equipment initial and number available
GIVEN
A cargo record is identified as non-CPRS traffic with equipment initial and number available
Applied to: Apply Standard Car ID Formatting
WHEN
Standard car ID formatting is applied
THEN
The car ID is formatted according to standard rules combining equipment initial and equipment number
Context: A cargo record has car ID information that needs formatting
GIVEN
A cargo record has car ID information that needs formatting
Applied to: Format Car ID According to Standards
WHEN
Car ID formatting standards are applied
THEN
The car ID is formatted according to system standards with proper spacing, character positioning, and validation
Context: A cargo record is populated with X4 and N7 segment data and formatted car ID
GIVEN
A cargo record is populated with X4 and N7 segment data and formatted car ID
Applied to: Validate Cargo Record Data
WHEN
Cargo record validation is performed
THEN
All required fields are validated for completeness, data integrity, and business rule compliance, and any validation errors are identified
Context: A validated cargo record is ready for database insertion
GIVEN
A validated cargo record is ready for database insertion
Applied to: Insert Cargo Record into Database
WHEN
The database insertion operation is executed
THEN
The cargo record is inserted into the GCSUSRT database table and the operation result is captured
Context: A cargo record insertion operation has been attempted
GIVEN
A cargo record insertion operation has been attempted
Applied to: Database Insert Successful?
WHEN
The database insertion result is evaluated
THEN
The system determines whether the insertion was successful or failed based on database response codes
Context: A cargo record has been successfully inserted into the database
GIVEN
A cargo record has been successfully inserted into the database
Applied to: Log Successful Insertion
WHEN
Success logging is performed
THEN
The successful insertion is logged with cargo record details, timestamp, and confirmation of database update
Context: A cargo record insertion operation has failed
GIVEN
A cargo record insertion operation has failed
Applied to: Handle Database Insert Error
WHEN
Database insert error handling is triggered
THEN
The insertion failure is logged with error details and appropriate error recovery or notification procedures are initiated
R-GCX016E-cbl-02522 (+9) File: GCX016E.cbl Station Data Retrieval for Transit Traffic Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Data Retrieval for Transit Traffic':
  • Context - a transit traffic request is received with m1203 segment data:
    For Extract Location Identifier from M1203 Segment:
    When the system processes the m1203 segment, then the location identifier is extracted from the m1203 segment for further processing.
  • Context - a location identifier has been extracted from m1203 segment:
    For Validate Location Identifier Format:
    When the system validates the location identifier format, then the location identifier is confirmed as valid or invalid based on format requirements.
  • Context - a location identifier has been validated for format compliance:
    For Location Identifier Valid?:
    When the system checks if the location identifier is valid, then if valid, proceed to call generic table interface; if invalid, log error and return error to calling process.
  • Context - a valid location identifier is available for processing:
    For Call Generic Table I/O Interface:
    When the system needs to retrieve station information, then the generic table i/o interface is called to access the station data repository.
  • Context - the generic table i/o interface has been called with a valid location identifier:
    For Retrieve Station Information from DS Table:
    When the system searches the ds table for matching station data, then station information is retrieved from the ds table based on the location identifier.
  • Context - a search for station information has been performed in the ds table:
    For Station Data Found?:
    When the system checks if station data was found, then if station data is found, format it for transit routing; if not found, generate station not found error.
  • Context - station data has been successfully retrieved from the ds table:
    For Format Station Information for Transit Routing:
    When the system formats the station information, then station information is formatted in the required structure for transit routing operations.
  • Context - station information has been successfully formatted for transit routing:
    For Return Station Data to Calling Process:
    When the processing is complete, then the formatted station data is returned to the calling process.
  • Context - a search for station information in the ds table has been performed:
    For Generate Station Not Found Error:
    When no station data is found for the location identifier, then a station not found error is generated and returned to the calling process.
  • Context - a location identifier has failed format validation:
    For Log Invalid Location Identifier:
    When the system processes the invalid location identifier, then an invalid location identifier error is logged and error is returned to calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A transit traffic request is received with M1203 segment data
GIVEN
A transit traffic request is received with M1203 segment data
Applied to: Extract Location Identifier from M1203 Segment
WHEN
The system processes the M1203 segment
THEN
The location identifier is extracted from the M1203 segment for further processing
Context: A location identifier has been extracted from M1203 segment
GIVEN
A location identifier has been extracted from M1203 segment
Applied to: Validate Location Identifier Format
WHEN
The system validates the location identifier format
THEN
The location identifier is confirmed as valid or invalid based on format requirements
Context: A location identifier has been validated for format compliance
GIVEN
A location identifier has been validated for format compliance
Applied to: Location Identifier Valid?
WHEN
The system checks if the location identifier is valid
THEN
If valid, proceed to call generic table interface; if invalid, log error and return error to calling process
Context: A valid location identifier is available for processing
GIVEN
A valid location identifier is available for processing
Applied to: Call Generic Table I/O Interface
WHEN
The system needs to retrieve station information
THEN
The generic table I/O interface is called to access the station data repository
Context: The generic table I/O interface has been called with a valid location identifier
GIVEN
The generic table I/O interface has been called with a valid location identifier
Applied to: Retrieve Station Information from DS Table
WHEN
The system searches the DS table for matching station data
THEN
Station information is retrieved from the DS table based on the location identifier
Context: A search for station information has been performed in the DS table
GIVEN
A search for station information has been performed in the DS table
Applied to: Station Data Found?
WHEN
The system checks if station data was found
THEN
If station data is found, format it for transit routing; if not found, generate station not found error
Context: Station data has been successfully retrieved from the DS table
GIVEN
Station data has been successfully retrieved from the DS table
Applied to: Format Station Information for Transit Routing
WHEN
The system formats the station information
THEN
Station information is formatted in the required structure for transit routing operations
Context: Station information has been successfully formatted for transit routing
GIVEN
Station information has been successfully formatted for transit routing
Applied to: Return Station Data to Calling Process
WHEN
The processing is complete
THEN
The formatted station data is returned to the calling process
Context: A search for station information in the DS table has been performed
GIVEN
A search for station information in the DS table has been performed
Applied to: Generate Station Not Found Error
WHEN
No station data is found for the location identifier
THEN
A station not found error is generated and returned to the calling process
Context: A location identifier has failed format validation
GIVEN
A location identifier has failed format validation
Applied to: Log Invalid Location Identifier
WHEN
The system processes the invalid location identifier
THEN
An invalid location identifier error is logged and error is returned to calling process
R-GCX016E-cbl-02532 (+9) File: GCX016E.cbl Destination Station Table Lookup Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Station Table Lookup':
  • Context - an x4 segment containing location data is available for processing:
    For Extract Location Identifier from X4 Segment:
    When the system processes the x4 segment for station lookup, then the location identifier is extracted from the x4 segment and made available for table lookup.
  • Context - the system has extracted location data from the x4 segment:
    For Location Identifier Present?:
    When the system checks for the presence of a location identifier, then if location identifier is present, proceed with station lookup; if not present, continue with default routing.
  • Context - a valid location identifier is available for station lookup:
    For Set DS Table Type for Lookup:
    When the system prepares to access the ds table, then the ds table type is set for the lookup operation.
  • Context - the ds table type is configured and location identifier is available:
    For Call GCCTBIO Table I/O Interface:
    When the system needs to retrieve station information, then the gcctbio table i/o interface is invoked to access the ds table.
  • Context - the gcctbio interface has been called with a location identifier:
    For Station Record Found?:
    When the system checks the lookup result, then if station record is found, proceed with data retrieval; if not found, log error and continue with default routing.
  • Context - a matching station record exists in the ds table:
    For Retrieve Station Information:
    When the system processes the successful lookup result, then the complete station information is retrieved from the ds table.
  • Context - station information has been successfully retrieved from the ds table:
    For Extract Station Name and Details:
    When the system processes the retrieved station record, then station name and relevant details are extracted from the record.
  • Context - station name and details have been extracted from the ds table record:
    For Set Station Data for Cargo Routing:
    When the system prepares cargo routing information, then the station data is set and made available for cargo routing purposes.
  • Context - a station lookup has been performed with a valid location identifier:
    For Log Station Not Found Error:
    When no matching station record is found in the ds table, then a station not found error is logged for tracking and audit purposes.
  • Context - either no location identifier is present or station record is not found:
    For Continue with Default Routing:
    When the system cannot obtain specific station information, then processing continues with default routing configuration.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment containing location data is available for processing
GIVEN
An X4 segment containing location data is available for processing
Applied to: Extract Location Identifier from X4 Segment
WHEN
The system processes the X4 segment for station lookup
THEN
The location identifier is extracted from the X4 segment and made available for table lookup
Context: The system has extracted location data from the X4 segment
GIVEN
The system has extracted location data from the X4 segment
Applied to: Location Identifier Present?
WHEN
The system checks for the presence of a location identifier
THEN
If location identifier is present, proceed with station lookup; if not present, continue with default routing
Context: A valid location identifier is available for station lookup
GIVEN
A valid location identifier is available for station lookup
Applied to: Set DS Table Type for Lookup
WHEN
The system prepares to access the DS table
THEN
The DS table type is set for the lookup operation
Context: The DS table type is configured and location identifier is available
GIVEN
The DS table type is configured and location identifier is available
Applied to: Call GCCTBIO Table I/O Interface
WHEN
The system needs to retrieve station information
THEN
The GCCTBIO table I/O interface is invoked to access the DS table
Context: The GCCTBIO interface has been called with a location identifier
GIVEN
The GCCTBIO interface has been called with a location identifier
Applied to: Station Record Found?
WHEN
The system checks the lookup result
THEN
If station record is found, proceed with data retrieval; if not found, log error and continue with default routing
Context: A matching station record exists in the DS table
GIVEN
A matching station record exists in the DS table
Applied to: Retrieve Station Information
WHEN
The system processes the successful lookup result
THEN
The complete station information is retrieved from the DS table
Context: Station information has been successfully retrieved from the DS table
GIVEN
Station information has been successfully retrieved from the DS table
Applied to: Extract Station Name and Details
WHEN
The system processes the retrieved station record
THEN
Station name and relevant details are extracted from the record
Context: Station name and details have been extracted from the DS table record
GIVEN
Station name and details have been extracted from the DS table record
Applied to: Set Station Data for Cargo Routing
WHEN
The system prepares cargo routing information
THEN
The station data is set and made available for cargo routing purposes
Context: A station lookup has been performed with a valid location identifier
GIVEN
A station lookup has been performed with a valid location identifier
Applied to: Log Station Not Found Error
WHEN
No matching station record is found in the DS table
THEN
A station not found error is logged for tracking and audit purposes
Context: Either no location identifier is present or station record is not found
GIVEN
Either no location identifier is present or station record is not found
Applied to: Continue with Default Routing
WHEN
The system cannot obtain specific station information
THEN
Processing continues with default routing configuration
R-GCX016E-cbl-02542 (+10) File: GCX016E.cbl Key Station Table Lookup Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Key Station Table Lookup':
  • Context - an x4 segment contains location information:
    For Extract Location Code from X4 Segment:
    When the system processes the x4 segment for location validation, then the location code is extracted and prepared for key station lookup.
  • Context - a location code needs to be validated against key station data:
    For Set Table Type to KS - Key Station:
    When the system prepares for table lookup operation, then the table type is set to ks for key station table access.
  • Context - location code and table type ks are configured:
    For Call GCCTBIO Table Lookup Interface:
    When the system needs to validate location against key station data, then gcctbio table lookup interface is called to retrieve station information.
  • Context - a table lookup has been performed for a location code in ks table:
    For Key Station Found?:
    When the system evaluates the lookup results, then the system determines whether a valid key station record was found or not.
  • Context - a valid key station record exists for the location code:
    For Retrieve Key Station Information:
    When the table lookup successfully finds the station, then key station information is retrieved from the ks table data.
  • Context - key station information has been retrieved from the table:
    For Validate Location Identifier:
    When the system validates the location identifier, then the location identifier is confirmed as valid based on station data.
  • Context - location identifier has been successfully validated:
    For Set Station Data Fields:
    When the system processes the validated station information, then station data fields are populated with the retrieved key station details.
  • Context - station data fields have been populated with valid information:
    For Return Validated Location Information:
    When the location validation process completes successfully, then validated location information is returned to the requesting process.
  • Context - a location code does not exist in the ks key station table:
    For Generate Location Validation Error:
    When the table lookup fails to find a matching station record, then a location validation error is generated for the invalid location.
  • Context - a location validation error has been generated:
    For Set Error Flag for Invalid Location:
    When the system handles the invalid location condition, then an error flag is set to indicate invalid location status.
  • Context - an error flag has been set for invalid location:
    For Continue Processing with Error Status:
    When the system continues with subsequent processing steps, then processing continues with error status maintained for downstream handling.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment contains location information
GIVEN
An X4 segment contains location information
Applied to: Extract Location Code from X4 Segment
WHEN
The system processes the X4 segment for location validation
THEN
The location code is extracted and prepared for key station lookup
Context: A location code needs to be validated against key station data
GIVEN
A location code needs to be validated against key station data
Applied to: Set Table Type to KS - Key Station
WHEN
The system prepares for table lookup operation
THEN
The table type is set to KS for Key Station table access
Context: Location code and table type KS are configured
GIVEN
Location code and table type KS are configured
Applied to: Call GCCTBIO Table Lookup Interface
WHEN
The system needs to validate location against key station data
THEN
GCCTBIO table lookup interface is called to retrieve station information
Context: A table lookup has been performed for a location code in KS table
GIVEN
A table lookup has been performed for a location code in KS table
Applied to: Key Station Found?
WHEN
The system evaluates the lookup results
THEN
The system determines whether a valid key station record was found or not
Context: A valid key station record exists for the location code
GIVEN
A valid key station record exists for the location code
Applied to: Retrieve Key Station Information
WHEN
The table lookup successfully finds the station
THEN
Key station information is retrieved from the KS table data
Context: Key station information has been retrieved from the table
GIVEN
Key station information has been retrieved from the table
Applied to: Validate Location Identifier
WHEN
The system validates the location identifier
THEN
The location identifier is confirmed as valid based on station data
Context: Location identifier has been successfully validated
GIVEN
Location identifier has been successfully validated
Applied to: Set Station Data Fields
WHEN
The system processes the validated station information
THEN
Station data fields are populated with the retrieved key station details
Context: Station data fields have been populated with valid information
GIVEN
Station data fields have been populated with valid information
Applied to: Return Validated Location Information
WHEN
The location validation process completes successfully
THEN
Validated location information is returned to the requesting process
Context: A location code does not exist in the KS key station table
GIVEN
A location code does not exist in the KS key station table
Applied to: Generate Location Validation Error
WHEN
The table lookup fails to find a matching station record
THEN
A location validation error is generated for the invalid location
Context: A location validation error has been generated
GIVEN
A location validation error has been generated
Applied to: Set Error Flag for Invalid Location
WHEN
The system handles the invalid location condition
THEN
An error flag is set to indicate invalid location status
Context: An error flag has been set for invalid location
GIVEN
An error flag has been set for invalid location
Applied to: Continue Processing with Error Status
WHEN
The system continues with subsequent processing steps
THEN
Processing continues with error status maintained for downstream handling
R-GCX016E-cbl-02553 (+14) File: GCX016E.cbl Generic Table I/O Interface Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generic Table I/O Interface':
  • Context - a request is made for table data retrieval:
    For Generic Table I/O Request:
    When the generic table i/o interface is invoked, then the system should route the request to the appropriate table lookup service.
  • Context - a table data request is received:
    For Table Type?:
    When the system evaluates the table type parameter, then the request should be classified as either station data, broker information, or other table type.
  • Context - a request is classified as station data lookup:
    For Station Data Lookup Request:
    When the station data processing is initiated, then the system should prepare to retrieve station-specific information from the table interface.
  • Context - a request is classified as broker information lookup:
    For Broker Information Request:
    When the broker data processing is initiated, then the system should prepare to retrieve broker-specific information from the table interface.
  • Context - a request is classified as other table type:
    For Other Table Type Request:
    When the other table type processing is initiated, then the system should prepare to retrieve the specified table information from the generic interface.
  • Context - a table lookup request has been classified and prepared:
    For Call GCCTBIO Interface:
    When the gcctbio interface is called, then the system should execute the table lookup operation through the external interface.
  • Context - a destination station data request is processed through gcctbio:
    For Retrieve Destination Station Data:
    When the destination station lookup is executed, then the system should retrieve destination station details from the gcstbrt table segments.
  • Context - a key station data request is processed through gcctbio:
    For Retrieve Key Station Data:
    When the key station lookup is executed, then the system should retrieve key station details from the gcstbrt table segments.
  • Context - a broker name data request is processed through gcctbio:
    For Retrieve Broker Name Data:
    When the broker name lookup is executed, then the system should retrieve broker name details from the gcstbrt table segments.
  • Context - a broker contact data request is processed through gcctbio:
    For Retrieve Broker Contact Data:
    When the broker contact lookup is executed, then the system should retrieve broker contact details from the gcstbrt table segments.
  • Context - an other table type request is processed through gcctbio:
    For Retrieve Other Table Data:
    When the other table lookup is executed, then the system should retrieve the requested table data from the appropriate table segments.
  • Context - a table lookup operation has been completed:
    For Data Found?:
    When the system checks the retrieval results, then the system should determine if the requested data was found or not found.
  • Context - table data was successfully found during lookup:
    For Return Table Data:
    When the data return process is executed, then the system should return the retrieved table data to the caller.
  • Context - table data was not found during lookup:
    For Return Not Found Status:
    When the not found response process is executed, then the system should return a not found status to the caller.
  • Context - a table lookup operation has completed with either data found or not found status:
    For Process Retrieved Information:
    When the information processing is initiated, then the system should process the lookup results appropriately for the requesting operation.
👨‍💻 Technical ACs (Gherkin)
Context: A request is made for table data retrieval
GIVEN
A request is made for table data retrieval
Applied to: Generic Table I/O Request
WHEN
The generic table I/O interface is invoked
THEN
The system should route the request to the appropriate table lookup service
Context: A table data request is received
GIVEN
A table data request is received
Applied to: Table Type?
WHEN
The system evaluates the table type parameter
THEN
The request should be classified as either station data, broker information, or other table type
Context: A request is classified as station data lookup
GIVEN
A request is classified as station data lookup
Applied to: Station Data Lookup Request
WHEN
The station data processing is initiated
THEN
The system should prepare to retrieve station-specific information from the table interface
Context: A request is classified as broker information lookup
GIVEN
A request is classified as broker information lookup
Applied to: Broker Information Request
WHEN
The broker data processing is initiated
THEN
The system should prepare to retrieve broker-specific information from the table interface
Context: A request is classified as other table type
GIVEN
A request is classified as other table type
Applied to: Other Table Type Request
WHEN
The other table type processing is initiated
THEN
The system should prepare to retrieve the specified table information from the generic interface
Context: A table lookup request has been classified and prepared
GIVEN
A table lookup request has been classified and prepared
Applied to: Call GCCTBIO Interface
WHEN
The GCCTBIO interface is called
THEN
The system should execute the table lookup operation through the external interface
Context: A destination station data request is processed through GCCTBIO
GIVEN
A destination station data request is processed through GCCTBIO
Applied to: Retrieve Destination Station Data
WHEN
The destination station lookup is executed
THEN
The system should retrieve destination station details from the GCSTBRT table segments
Context: A key station data request is processed through GCCTBIO
GIVEN
A key station data request is processed through GCCTBIO
Applied to: Retrieve Key Station Data
WHEN
The key station lookup is executed
THEN
The system should retrieve key station details from the GCSTBRT table segments
Context: A broker name data request is processed through GCCTBIO
GIVEN
A broker name data request is processed through GCCTBIO
Applied to: Retrieve Broker Name Data
WHEN
The broker name lookup is executed
THEN
The system should retrieve broker name details from the GCSTBRT table segments
Context: A broker contact data request is processed through GCCTBIO
GIVEN
A broker contact data request is processed through GCCTBIO
Applied to: Retrieve Broker Contact Data
WHEN
The broker contact lookup is executed
THEN
The system should retrieve broker contact details from the GCSTBRT table segments
Context: An other table type request is processed through GCCTBIO
GIVEN
An other table type request is processed through GCCTBIO
Applied to: Retrieve Other Table Data
WHEN
The other table lookup is executed
THEN
The system should retrieve the requested table data from the appropriate table segments
Context: A table lookup operation has been completed
GIVEN
A table lookup operation has been completed
Applied to: Data Found?
WHEN
The system checks the retrieval results
THEN
The system should determine if the requested data was found or not found
Context: Table data was successfully found during lookup
GIVEN
Table data was successfully found during lookup
Applied to: Return Table Data
WHEN
The data return process is executed
THEN
The system should return the retrieved table data to the caller
Context: Table data was not found during lookup
GIVEN
Table data was not found during lookup
Applied to: Return Not Found Status
WHEN
The not found response process is executed
THEN
The system should return a not found status to the caller
Context: A table lookup operation has completed with either data found or not found status
GIVEN
A table lookup operation has completed with either data found or not found status
Applied to: Process Retrieved Information
WHEN
The information processing is initiated
THEN
The system should process the lookup results appropriately for the requesting operation
R-GCX016E-cbl-02568 (+20) File: GCX016E.cbl Comprehensive Merlin Message Creation Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Comprehensive Merlin Message Creation':
  • Context - a cargo processing event requires merlin notification:
    For Initialize Message Fields:
    When the system begins message creation process, then all message fields, counters, and data structures are reset to initial state.
  • Context - equipment information exists in the cargo record:
    For Format Equipment Information:
    When creating a merlin message for cargo disposition, then equipment type, identification number, and related cargo details are formatted and included in the message.
  • Context - car id and waybill information are available in the cargo record:
    For Add Car ID and Waybill Details:
    When building comprehensive merlin message content, then car id and waybill details are added to the message with proper formatting.
  • Context - us-ccn exists for the cargo being processed:
    For Include US-CCN Information:
    When creating merlin notification message, then us-ccn information is included in the message for cargo identification purposes.
  • Context - a disposition code is being processed for cargo:
    For Format Disposition Code Details:
    When creating comprehensive merlin message, then disposition code details are formatted with proper context and included in the message.
  • Context - disposition code has an associated description in the system:
    For Add Disposition Description:
    When building merlin message content, then disposition description is added to provide clear understanding of the action being taken.
  • Context - cargo has existing release quantities and a new disposition is being applied:
    For Calculate Release Quantity Impact:
    When processing disposition code that affects quantities, then system calculates the impact on release quantities (increase, decrease, or no change).
  • Context - before and after quantity values have been calculated:
    For Before/After Quantities Different?:
    When determining message content requirements, then if quantities differ, quantity impact analysis is included; otherwise, it is omitted from the message.
  • Context - disposition processing results in quantity changes:
    For Add Quantity Impact Analysis:
    When before and after quantities are different, then detailed quantity impact analysis showing the change is added to the merlin message.
  • Context - cargo processing events have occurred with recorded timestamps:
    For Include Processing Timestamps:
    When creating comprehensive merlin message, then processing timestamps are included to provide audit trail information.
  • Context - uscs processing time is available for the cargo event:
    For Add USCS Processing Time:
    When building comprehensive message content, then uscs processing time is added to the message for tracking purposes.
  • Context - system processing time is recorded for the cargo event:
    For Add System Processing Time:
    When creating merlin notification message, then system processing time is included in the message for complete audit trail.
  • Context - k1 segment data exists for the cargo:
    For Process K1 Comments:
    When building comprehensive merlin message, then k1 comments are processed and evaluated for inclusion in the message.
  • Context - k1 segment processing has been completed:
    For K1 Comments Available?:
    When determining message content components, then if k1 comments are available and relevant, they are included; otherwise, processing continues without them.
  • Context - k1 comments are available and contain free-form text:
    For Include Free-Form Text Messages:
    When k1 comments are determined to be relevant for the message, then free-form text messages from k1 segments are included in the merlin message.
  • Context - special comments exist for the cargo or processing event:
    For Add Special Comments:
    When building comprehensive message content, then special comments are added to provide additional context and information.
  • Context - cargo processing involves bond-related activities:
    For Canadian Pacific Railway Bond?:
    When evaluating special processing requirements, then if canadian pacific railway bond processing is detected, special bond notification is added; otherwise, standard processing continues.
  • Context - canadian pacific railway bond processing is identified:
    For Add Bond Creation Notification:
    When special bond processing requirements are detected, then bond creation notification is added to the merlin message for cp railway processing.
  • Context - all message components have been prepared and validated:
    For Format Complete Message:
    When finalizing message creation process, then complete merlin message is formatted with all required components in proper structure.
  • Context - complete message content has been formatted:
    For Set Message Type and Priority:
    When preparing message for distribution, then message type and priority are set based on disposition code and processing context.
  • Context - message type and priority have been set:
    For Prepare for Distribution:
    When finalizing message preparation, then message is prepared for distribution with proper routing and delivery information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing event requires Merlin notification
GIVEN
A cargo processing event requires Merlin notification
Applied to: Initialize Message Fields
WHEN
The system begins message creation process
THEN
All message fields, counters, and data structures are reset to initial state
Context: Equipment information exists in the cargo record
GIVEN
Equipment information exists in the cargo record
Applied to: Format Equipment Information
WHEN
Creating a Merlin message for cargo disposition
THEN
Equipment type, identification number, and related cargo details are formatted and included in the message
Context: Car ID and waybill information are available in the cargo record
GIVEN
Car ID and waybill information are available in the cargo record
Applied to: Add Car ID and Waybill Details
WHEN
Building comprehensive Merlin message content
THEN
Car ID and waybill details are added to the message with proper formatting
Context: US-CCN exists for the cargo being processed
GIVEN
US-CCN exists for the cargo being processed
Applied to: Include US-CCN Information
WHEN
Creating Merlin notification message
THEN
US-CCN information is included in the message for cargo identification purposes
Context: A disposition code is being processed for cargo
GIVEN
A disposition code is being processed for cargo
Applied to: Format Disposition Code Details
WHEN
Creating comprehensive Merlin message
THEN
Disposition code details are formatted with proper context and included in the message
Context: Disposition code has an associated description in the system
GIVEN
Disposition code has an associated description in the system
Applied to: Add Disposition Description
WHEN
Building Merlin message content
THEN
Disposition description is added to provide clear understanding of the action being taken
Context: Cargo has existing release quantities and a new disposition is being applied
GIVEN
Cargo has existing release quantities and a new disposition is being applied
Applied to: Calculate Release Quantity Impact
WHEN
Processing disposition code that affects quantities
THEN
System calculates the impact on release quantities (increase, decrease, or no change)
Context: Before and after quantity values have been calculated
GIVEN
Before and after quantity values have been calculated
Applied to: Before/After Quantities Different?
WHEN
Determining message content requirements
THEN
If quantities differ, quantity impact analysis is included; otherwise, it is omitted from the message
Context: Disposition processing results in quantity changes
GIVEN
Disposition processing results in quantity changes
Applied to: Add Quantity Impact Analysis
WHEN
Before and after quantities are different
THEN
Detailed quantity impact analysis showing the change is added to the Merlin message
Context: Cargo processing events have occurred with recorded timestamps
GIVEN
Cargo processing events have occurred with recorded timestamps
Applied to: Include Processing Timestamps
WHEN
Creating comprehensive Merlin message
THEN
Processing timestamps are included to provide audit trail information
Context: USCS processing time is available for the cargo event
GIVEN
USCS processing time is available for the cargo event
Applied to: Add USCS Processing Time
WHEN
Building comprehensive message content
THEN
USCS processing time is added to the message for tracking purposes
Context: System processing time is recorded for the cargo event
GIVEN
System processing time is recorded for the cargo event
Applied to: Add System Processing Time
WHEN
Creating Merlin notification message
THEN
System processing time is included in the message for complete audit trail
Context: K1 segment data exists for the cargo
GIVEN
K1 segment data exists for the cargo
Applied to: Process K1 Comments
WHEN
Building comprehensive Merlin message
THEN
K1 comments are processed and evaluated for inclusion in the message
Context: K1 segment processing has been completed
GIVEN
K1 segment processing has been completed
Applied to: K1 Comments Available?
WHEN
Determining message content components
THEN
If K1 comments are available and relevant, they are included; otherwise, processing continues without them
Context: K1 comments are available and contain free-form text
GIVEN
K1 comments are available and contain free-form text
Applied to: Include Free-Form Text Messages
WHEN
K1 comments are determined to be relevant for the message
THEN
Free-form text messages from K1 segments are included in the Merlin message
Context: Special comments exist for the cargo or processing event
GIVEN
Special comments exist for the cargo or processing event
Applied to: Add Special Comments
WHEN
Building comprehensive message content
THEN
Special comments are added to provide additional context and information
Context: Cargo processing involves bond-related activities
GIVEN
Cargo processing involves bond-related activities
Applied to: Canadian Pacific Railway Bond?
WHEN
Evaluating special processing requirements
THEN
If Canadian Pacific Railway bond processing is detected, special bond notification is added; otherwise, standard processing continues
Context: Canadian Pacific Railway bond processing is identified
GIVEN
Canadian Pacific Railway bond processing is identified
Applied to: Add Bond Creation Notification
WHEN
Special bond processing requirements are detected
THEN
Bond creation notification is added to the Merlin message for CP Railway processing
Context: All message components have been prepared and validated
GIVEN
All message components have been prepared and validated
Applied to: Format Complete Message
WHEN
Finalizing message creation process
THEN
Complete Merlin message is formatted with all required components in proper structure
Context: Complete message content has been formatted
GIVEN
Complete message content has been formatted
Applied to: Set Message Type and Priority
WHEN
Preparing message for distribution
THEN
Message type and priority are set based on disposition code and processing context
Context: Message type and priority have been set
GIVEN
Message type and priority have been set
Applied to: Prepare for Distribution
WHEN
Finalizing message preparation
THEN
Message is prepared for distribution with proper routing and delivery information
R-GCX016E-cbl-02589 (+11) File: GCX016E.cbl Canadian Pacific Railway Bond Creation Notification Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Pacific Railway Bond Creation Notification':
  • Context - a k1 segment message has been received:
    For Message Type Check:
    When the system checks the message content for cpr identifiers including 'director of customs, cp rail', 'canadian pacific limited', or 'canadian pacific railway co', then the message is classified as cpr bond creation if any cpr identifier is found, otherwise it is processed as a regular k1 message.
  • Context - a k1 segment message contains canadian pacific railway identifiers:
    For Identify CPR Bond Creation:
    When the system identifies the message as cpr bond creation type, then the system initiates cpr-specific bond creation processing workflow.
  • Context - a cpr bond creation message has been identified:
    For Extract Bond Information:
    When the system processes the k1 segment content, then bond-related information including bond numbers, amounts, and related cargo details are extracted from the message.
  • Context - bond information has been extracted from a cpr message:
    For Validate Bond Data:
    When the system validates the bond data for completeness and format compliance, then the bond data is marked as valid if all required fields are present and properly formatted, otherwise validation fails.
  • Context - bond data validation has been completed:
    For Bond Creation Valid?:
    When the system evaluates if the bond creation meets all business requirements, then bond creation is approved if validation passes and all business rules are satisfied, otherwise an error is generated.
  • Context - cpr bond creation has been validated and approved:
    For Format CPR Bond Notification:
    When the system formats the bond notification message, then a structured notification message is created containing bond details, cargo information, and cpr-specific formatting requirements.
  • Context - a cpr bond notification message has been formatted:
    For Add Special Comments:
    When the system processes special comments from k1 segments and other relevant sources, then up to 3 lines of special comments and up to 4 lines of k1 comments are added to the notification message if available.
  • Context - cpr bond notification content has been prepared with special comments:
    For Create Merlin Message:
    When the system creates a merlin message for the bond notification, then a properly formatted merlin message is created with cpr bond information, comments, and appropriate message headers.
  • Context - a merlin message for cpr bond notification has been created:
    For Route to Recipients:
    When the system determines routing based on freight forwarder setup and notification preferences, then the message is routed to appropriate recipients including freight forwarders with internet capability or default merlin ids.
  • Context - cpr bond notification routing has been determined:
    For Log Bond Creation Event:
    When the system logs the bond creation event, then an audit record is created capturing the bond creation details, timestamp, and processing status for tracking and compliance purposes.
  • Context - cpr bond notification has been logged and routed:
    For Send Notification:
    When the system attempts to deliver the notification, then the notification is sent via email if freight forwarder has internet capability, otherwise sent to merlin system, with fallback to backup recipients if delivery fails.
  • Context - cpr bond creation validation has failed or processing errors occurred:
    For Generate Error Message:
    When the system generates an error response, then an appropriate error message is created indicating the specific validation failure or processing issue for troubleshooting and correction.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 segment message has been received
GIVEN
A K1 segment message has been received
Applied to: Message Type Check
WHEN
The system checks the message content for CPR identifiers including 'DIRECTOR OF CUSTOMS, CP RAIL', 'CANADIAN PACIFIC LIMITED', or 'CANADIAN PACIFIC RAILWAY CO'
THEN
The message is classified as CPR bond creation if any CPR identifier is found, otherwise it is processed as a regular K1 message
Context: A K1 segment message contains Canadian Pacific Railway identifiers
GIVEN
A K1 segment message contains Canadian Pacific Railway identifiers
Applied to: Identify CPR Bond Creation
WHEN
The system identifies the message as CPR bond creation type
THEN
The system initiates CPR-specific bond creation processing workflow
Context: A CPR bond creation message has been identified
GIVEN
A CPR bond creation message has been identified
Applied to: Extract Bond Information
WHEN
The system processes the K1 segment content
THEN
Bond-related information including bond numbers, amounts, and related cargo details are extracted from the message
Context: Bond information has been extracted from a CPR message
GIVEN
Bond information has been extracted from a CPR message
Applied to: Validate Bond Data
WHEN
The system validates the bond data for completeness and format compliance
THEN
The bond data is marked as valid if all required fields are present and properly formatted, otherwise validation fails
Context: Bond data validation has been completed
GIVEN
Bond data validation has been completed
Applied to: Bond Creation Valid?
WHEN
The system evaluates if the bond creation meets all business requirements
THEN
Bond creation is approved if validation passes and all business rules are satisfied, otherwise an error is generated
Context: CPR bond creation has been validated and approved
GIVEN
CPR bond creation has been validated and approved
Applied to: Format CPR Bond Notification
WHEN
The system formats the bond notification message
THEN
A structured notification message is created containing bond details, cargo information, and CPR-specific formatting requirements
Context: A CPR bond notification message has been formatted
GIVEN
A CPR bond notification message has been formatted
Applied to: Add Special Comments
WHEN
The system processes special comments from K1 segments and other relevant sources
THEN
Up to 3 lines of special comments and up to 4 lines of K1 comments are added to the notification message if available
Context: CPR bond notification content has been prepared with special comments
GIVEN
CPR bond notification content has been prepared with special comments
Applied to: Create Merlin Message
WHEN
The system creates a Merlin message for the bond notification
THEN
A properly formatted Merlin message is created with CPR bond information, comments, and appropriate message headers
Context: A Merlin message for CPR bond notification has been created
GIVEN
A Merlin message for CPR bond notification has been created
Applied to: Route to Recipients
WHEN
The system determines routing based on freight forwarder setup and notification preferences
THEN
The message is routed to appropriate recipients including freight forwarders with internet capability or default Merlin IDs
Context: CPR bond notification routing has been determined
GIVEN
CPR bond notification routing has been determined
Applied to: Log Bond Creation Event
WHEN
The system logs the bond creation event
THEN
An audit record is created capturing the bond creation details, timestamp, and processing status for tracking and compliance purposes
Context: CPR bond notification has been logged and routed
GIVEN
CPR bond notification has been logged and routed
Applied to: Send Notification
WHEN
The system attempts to deliver the notification
THEN
The notification is sent via email if freight forwarder has internet capability, otherwise sent to Merlin system, with fallback to backup recipients if delivery fails
Context: CPR bond creation validation has failed or processing errors occurred
GIVEN
CPR bond creation validation has failed or processing errors occurred
Applied to: Generate Error Message
WHEN
The system generates an error response
THEN
An appropriate error message is created indicating the specific validation failure or processing issue for troubleshooting and correction
R-GCX016E-cbl-02615 (+15) File: GCX016E.cbl GCCIIS System Integration Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'GCCIIS System Integration':
  • Context - a cargo processing transaction is being executed:
    For Cargo Status Changed?:
    When the system evaluates whether cargo status has been modified during processing, then the system proceeds with gcciis integration if status changed, otherwise skips integration.
  • Context - a cargo has an internal status that needs to be communicated to gcciis:
    For Map Internal Status to GCCIIS Status:
    When the system processes the status mapping transformation, then the internal status is converted to the appropriate gcciis status format.
  • Context - a cargo has associated equipment information:
    For Equipment Type Valid?:
    When the system checks if the equipment type is valid for gcciis processing, then the system continues processing if equipment type is container, trailer, chassis, or other valid equipment, otherwise skips gcciis integration.
  • Context - equipment information is available for a cargo:
    For Validate Equipment Type:
    When the system validates the equipment type against acceptable categories, then the equipment is classified as container, trailer, chassis, or other valid equipment type for further processing.
  • Context - a cargo has a status that may require quantity validation:
    For Release Quantity Check:
    When the system evaluates whether full release validation is needed, then the system either requires full release quantity check or allows partial release processing.
  • Context - a cargo requires full release validation and has released and total quantity values:
    For Check Released vs Total Quantity:
    When the system compares the released quantity to the total quantity, then the system continues processing if released equals total quantity, otherwise skips gcciis integration.
  • Context - a cargo has passed validation checks and requires gcciis status update:
    For Prepare GCCIIS Status Update:
    When the system prepares the status update message, then the system formats the cargo and equipment information for gcciis transmission.
  • Context - a cargo status update is ready for gcciis transmission:
    For Status Type?:
    When the system evaluates the cargo status to determine gcciis status type, then the system selects hold, release, ptt, or ptt-ex status based on cargo conditions.
  • Context - a cargo has hold conditions that need to be communicated to gcciis:
    For Set GCCIIS Status: HOLD:
    When the system processes hold status assignment, then the system sets gcciis status to hold for held cargo conditions.
  • Context - a cargo has been fully released and meets release criteria:
    For Set GCCIIS Status: RELEASE:
    When the system processes release status assignment, then the system sets gcciis status to release for released cargo.
  • Context - a cargo has permit to transfer status that needs to be communicated to gcciis:
    For Set GCCIIS Status: PTT:
    When the system processes ptt status assignment, then the system sets gcciis status to ptt for cargo with transit permission.
  • Context - a cargo has permit to transfer with examination requirements that need to be communicated to gcciis:
    For Set GCCIIS Status: PTT-EX:
    When the system processes ptt-ex status assignment, then the system sets gcciis status to ptt-ex for cargo requiring examination.
  • Context - a gcciis status update is prepared and ready for transmission:
    For Send Status Update to GCCIIS:
    When the system sends the status update to gcciis, then the system transmits the cargo status information to the gcciis equipment tracking system.
  • Context - a status update has been sent to gcciis:
    For Update Successful?:
    When the system receives response from gcciis regarding the update, then the system determines if the update was successful or failed based on gcciis response.
  • Context - a gcciis status update has been successfully processed:
    For Log Successful Integration:
    When the system processes the successful integration, then the system records the successful gcciis integration for audit trail.
  • Context - a gcciis status update has failed or encountered an error:
    For Handle Integration Error:
    When the system processes the integration failure, then the system handles the error condition and takes appropriate corrective action.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing transaction is being executed
GIVEN
A cargo processing transaction is being executed
Applied to: Cargo Status Changed?
WHEN
The system evaluates whether cargo status has been modified during processing
THEN
The system proceeds with GCCIIS integration if status changed, otherwise skips integration
Context: A cargo has an internal status that needs to be communicated to GCCIIS
GIVEN
A cargo has an internal status that needs to be communicated to GCCIIS
Applied to: Map Internal Status to GCCIIS Status
WHEN
The system processes the status mapping transformation
THEN
The internal status is converted to the appropriate GCCIIS status format
Context: A cargo has associated equipment information
GIVEN
A cargo has associated equipment information
Applied to: Equipment Type Valid?
WHEN
The system checks if the equipment type is valid for GCCIIS processing
THEN
The system continues processing if equipment type is container, trailer, chassis, or other valid equipment, otherwise skips GCCIIS integration
Context: Equipment information is available for a cargo
GIVEN
Equipment information is available for a cargo
Applied to: Validate Equipment Type
WHEN
The system validates the equipment type against acceptable categories
THEN
The equipment is classified as container, trailer, chassis, or other valid equipment type for further processing
Context: A cargo has a status that may require quantity validation
GIVEN
A cargo has a status that may require quantity validation
Applied to: Release Quantity Check
WHEN
The system evaluates whether full release validation is needed
THEN
The system either requires full release quantity check or allows partial release processing
Context: A cargo requires full release validation and has released and total quantity values
GIVEN
A cargo requires full release validation and has released and total quantity values
Applied to: Check Released vs Total Quantity
WHEN
The system compares the released quantity to the total quantity
THEN
The system continues processing if released equals total quantity, otherwise skips GCCIIS integration
Context: A cargo has passed validation checks and requires GCCIIS status update
GIVEN
A cargo has passed validation checks and requires GCCIIS status update
Applied to: Prepare GCCIIS Status Update
WHEN
The system prepares the status update message
THEN
The system formats the cargo and equipment information for GCCIIS transmission
Context: A cargo status update is ready for GCCIIS transmission
GIVEN
A cargo status update is ready for GCCIIS transmission
Applied to: Status Type?
WHEN
The system evaluates the cargo status to determine GCCIIS status type
THEN
The system selects HOLD, RELEASE, PTT, or PTT-EX status based on cargo conditions
Context: A cargo has hold conditions that need to be communicated to GCCIIS
GIVEN
A cargo has hold conditions that need to be communicated to GCCIIS
Applied to: Set GCCIIS Status: HOLD
WHEN
The system processes hold status assignment
THEN
The system sets GCCIIS status to HOLD for held cargo conditions
Context: A cargo has been fully released and meets release criteria
GIVEN
A cargo has been fully released and meets release criteria
Applied to: Set GCCIIS Status: RELEASE
WHEN
The system processes release status assignment
THEN
The system sets GCCIIS status to RELEASE for released cargo
Context: A cargo has Permit to Transfer status that needs to be communicated to GCCIIS
GIVEN
A cargo has Permit to Transfer status that needs to be communicated to GCCIIS
Applied to: Set GCCIIS Status: PTT
WHEN
The system processes PTT status assignment
THEN
The system sets GCCIIS status to PTT for cargo with transit permission
Context: A cargo has Permit to Transfer with examination requirements that need to be communicated to GCCIIS
GIVEN
A cargo has Permit to Transfer with examination requirements that need to be communicated to GCCIIS
Applied to: Set GCCIIS Status: PTT-EX
WHEN
The system processes PTT-EX status assignment
THEN
The system sets GCCIIS status to PTT-EX for cargo requiring examination
Context: A GCCIIS status update is prepared and ready for transmission
GIVEN
A GCCIIS status update is prepared and ready for transmission
Applied to: Send Status Update to GCCIIS
WHEN
The system sends the status update to GCCIIS
THEN
The system transmits the cargo status information to the GCCIIS equipment tracking system
Context: A status update has been sent to GCCIIS
GIVEN
A status update has been sent to GCCIIS
Applied to: Update Successful?
WHEN
The system receives response from GCCIIS regarding the update
THEN
The system determines if the update was successful or failed based on GCCIIS response
Context: A GCCIIS status update has been successfully processed
GIVEN
A GCCIIS status update has been successfully processed
Applied to: Log Successful Integration
WHEN
The system processes the successful integration
THEN
The system records the successful GCCIIS integration for audit trail
Context: A GCCIIS status update has failed or encountered an error
GIVEN
A GCCIIS status update has failed or encountered an error
Applied to: Handle Integration Error
WHEN
The system processes the integration failure
THEN
The system handles the error condition and takes appropriate corrective action
R-GCX016E-cbl-02631 (+7) File: GCX016E.cbl Freight Forwarder Disposition Code Database Search Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Freight Forwarder Disposition Code Database Search':
  • Context - a disposition code is received for processing:
    For Search Broker Database for Freight Forwarder Codes:
    When the system searches the broker database for freight forwarder-specific disposition codes, then the system determines if the disposition code requires freight forwarder processing.
  • Context - a disposition code is identified as freight forwarder-related:
    For Retrieve Cargo Segment Data from GCSUSS03:
    When the system needs cargo information for freight forwarder processing, then the system retrieves cargo segment data from the primary cargo database.
  • Context - primary cargo segment data has been retrieved for freight forwarder processing:
    For Retrieve Additional Cargo Data from GCSUSS07:
    When additional cargo details are needed for complete freight forwarder information, then the system retrieves supplementary cargo data from the extended cargo database.
  • Context - cargo segment data and additional cargo data are available:
    For Extract Freight Forwarder Information:
    When the system processes freight forwarder disposition codes, then the system extracts freight forwarder identification and contact details from the cargo records.
  • Context - freight forwarder identification has been extracted from cargo data:
    For Lookup Freight Forwarder Name in Broker Tables:
    When the system needs complete freight forwarder contact information, then the system searches the broker name tables to retrieve freight forwarder name and contact details.
  • Context - freight forwarder has been identified in the broker name tables:
    For Retrieve Freight Forwarder Contact Details:
    When the system needs to send notifications to the freight forwarder, then the system retrieves complete contact details including email addresses and notification preferences.
  • Context - freight forwarder information has been successfully retrieved and validated:
    For Mark as Freight Forwarder Disposition Code:
    When the disposition code processing continues, then the system marks the disposition code as requiring freight forwarder notification processing.
  • Context - a disposition code is not identified as freight forwarder-related or freight forwarder processing is complete:
    For Continue with Standard Disposition Processing:
    When the system continues disposition code processing, then the system proceeds with standard disposition code processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received for processing
GIVEN
A disposition code is received for processing
Applied to: Search Broker Database for Freight Forwarder Codes
WHEN
The system searches the broker database for freight forwarder-specific disposition codes
THEN
The system determines if the disposition code requires freight forwarder processing
Context: A disposition code is identified as freight forwarder-related
GIVEN
A disposition code is identified as freight forwarder-related
Applied to: Retrieve Cargo Segment Data from GCSUSS03
WHEN
The system needs cargo information for freight forwarder processing
THEN
The system retrieves cargo segment data from the primary cargo database
Context: Primary cargo segment data has been retrieved for freight forwarder processing
GIVEN
Primary cargo segment data has been retrieved for freight forwarder processing
Applied to: Retrieve Additional Cargo Data from GCSUSS07
WHEN
Additional cargo details are needed for complete freight forwarder information
THEN
The system retrieves supplementary cargo data from the extended cargo database
Context: Cargo segment data and additional cargo data are available
GIVEN
Cargo segment data and additional cargo data are available
Applied to: Extract Freight Forwarder Information
WHEN
The system processes freight forwarder disposition codes
THEN
The system extracts freight forwarder identification and contact details from the cargo records
Context: Freight forwarder identification has been extracted from cargo data
GIVEN
Freight forwarder identification has been extracted from cargo data
Applied to: Lookup Freight Forwarder Name in Broker Tables
WHEN
The system needs complete freight forwarder contact information
THEN
The system searches the broker name tables to retrieve freight forwarder name and contact details
Context: Freight forwarder has been identified in the broker name tables
GIVEN
Freight forwarder has been identified in the broker name tables
Applied to: Retrieve Freight Forwarder Contact Details
WHEN
The system needs to send notifications to the freight forwarder
THEN
The system retrieves complete contact details including email addresses and notification preferences
Context: Freight forwarder information has been successfully retrieved and validated
GIVEN
Freight forwarder information has been successfully retrieved and validated
Applied to: Mark as Freight Forwarder Disposition Code
WHEN
The disposition code processing continues
THEN
The system marks the disposition code as requiring freight forwarder notification processing
Context: A disposition code is not identified as freight forwarder-related OR freight forwarder processing is complete
GIVEN
A disposition code is not identified as freight forwarder-related OR freight forwarder processing is complete
Applied to: Continue with Standard Disposition Processing
WHEN
The system continues disposition code processing
THEN
The system proceeds with standard disposition code processing workflow
R-GCX016E-cbl-02639 (+12) File: GCX016E.cbl Cargo Segment Data Retrieval for Freight Forwarders Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Segment Data Retrieval for Freight Forwarders':
  • Context - a cargo processing request is initiated for freight forwarder identification:
    For Access Cargo Record:
    When the system needs to retrieve freight forwarder information, then the cargo record is accessed and made available for segment processing.
  • Context - a cargo record is being processed for freight forwarder identification:
    For Retrieve GCSUSS03 Segment:
    When the system attempts to retrieve the gcsuss03 segment from the cargo record, then the gcsuss03 segment is retrieved from the cargo segments data source.
  • Context - the system has attempted to retrieve the gcsuss03 segment:
    For GCSUSS03 Found?:
    When the retrieval operation is completed, then the system determines if the gcsuss03 segment was found and proceeds accordingly.
  • Context - the gcsuss03 segment has been successfully retrieved:
    For Extract Freight Forwarder Code from GCSUSS03:
    When the system processes the gcsuss03 segment data, then the freight forwarder code is extracted from the gcsuss03 segment.
  • Context - the system is processing freight forwarder identification regardless of gcsuss03 availability:
    For Retrieve GCSUSS07 Segment:
    When the system attempts to retrieve the gcsuss07 segment from the cargo record, then the gcsuss07 segment is retrieved from the cargo segments data source.
  • Context - the system has attempted to retrieve the gcsuss07 segment:
    For GCSUSS07 Found?:
    When the retrieval operation is completed, then the system determines if the gcsuss07 segment was found and proceeds accordingly.
  • Context - the gcsuss07 segment has been successfully retrieved:
    For Extract Additional Freight Forwarder Data from GCSUSS07:
    When the system processes the gcsuss07 segment data, then additional freight forwarder data is extracted from the gcsuss07 segment.
  • Context - freight forwarder data has been extracted from available segments (gcsuss03 and/or gcsuss07):
    For Compile Freight Forwarder Information:
    When the system processes the extracted data, then all available freight forwarder information is compiled into a consolidated format.
  • Context - freight forwarder information has been compiled from cargo segments:
    For Validate Freight Forwarder Data:
    When the system validates the compiled data, then the freight forwarder data is checked for validity and completeness.
  • Context - freight forwarder data has been validated:
    For Valid Freight Forwarder?:
    When the validation process is completed, then the system determines if the freight forwarder information is valid and complete.
  • Context - the freight forwarder information has been validated as complete and accurate:
    For Set Freight Forwarder Identified Flag:
    When the system processes the validation result, then a freight forwarder identified flag is set to indicate successful identification.
  • Context - the freight forwarder information has been validated as incomplete or invalid:
    For Log Freight Forwarder Not Found:
    When the system processes the validation result, then a log entry is created indicating that freight forwarder information was not found or is invalid.
  • Context - freight forwarder processing has been completed with either successful identification or logging of not found status:
    For Return Freight Forwarder Information:
    When the system completes the freight forwarder data retrieval process, then the freight forwarder information (or indication of not found) is returned to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing request is initiated for freight forwarder identification
GIVEN
A cargo processing request is initiated for freight forwarder identification
Applied to: Access Cargo Record
WHEN
The system needs to retrieve freight forwarder information
THEN
The cargo record is accessed and made available for segment processing
Context: A cargo record is being processed for freight forwarder identification
GIVEN
A cargo record is being processed for freight forwarder identification
Applied to: Retrieve GCSUSS03 Segment
WHEN
The system attempts to retrieve the GCSUSS03 segment from the cargo record
THEN
The GCSUSS03 segment is retrieved from the cargo segments data source
Context: The system has attempted to retrieve the GCSUSS03 segment
GIVEN
The system has attempted to retrieve the GCSUSS03 segment
Applied to: GCSUSS03 Found?
WHEN
The retrieval operation is completed
THEN
The system determines if the GCSUSS03 segment was found and proceeds accordingly
Context: The GCSUSS03 segment has been successfully retrieved
GIVEN
The GCSUSS03 segment has been successfully retrieved
Applied to: Extract Freight Forwarder Code from GCSUSS03
WHEN
The system processes the GCSUSS03 segment data
THEN
The freight forwarder code is extracted from the GCSUSS03 segment
Context: The system is processing freight forwarder identification regardless of GCSUSS03 availability
GIVEN
The system is processing freight forwarder identification regardless of GCSUSS03 availability
Applied to: Retrieve GCSUSS07 Segment
WHEN
The system attempts to retrieve the GCSUSS07 segment from the cargo record
THEN
The GCSUSS07 segment is retrieved from the cargo segments data source
Context: The system has attempted to retrieve the GCSUSS07 segment
GIVEN
The system has attempted to retrieve the GCSUSS07 segment
Applied to: GCSUSS07 Found?
WHEN
The retrieval operation is completed
THEN
The system determines if the GCSUSS07 segment was found and proceeds accordingly
Context: The GCSUSS07 segment has been successfully retrieved
GIVEN
The GCSUSS07 segment has been successfully retrieved
Applied to: Extract Additional Freight Forwarder Data from GCSUSS07
WHEN
The system processes the GCSUSS07 segment data
THEN
Additional freight forwarder data is extracted from the GCSUSS07 segment
Context: Freight forwarder data has been extracted from available segments (GCSUSS03 and/or GCSUSS07)
GIVEN
Freight forwarder data has been extracted from available segments (GCSUSS03 and/or GCSUSS07)
Applied to: Compile Freight Forwarder Information
WHEN
The system processes the extracted data
THEN
All available freight forwarder information is compiled into a consolidated format
Context: Freight forwarder information has been compiled from cargo segments
GIVEN
Freight forwarder information has been compiled from cargo segments
Applied to: Validate Freight Forwarder Data
WHEN
The system validates the compiled data
THEN
The freight forwarder data is checked for validity and completeness
Context: Freight forwarder data has been validated
GIVEN
Freight forwarder data has been validated
Applied to: Valid Freight Forwarder?
WHEN
The validation process is completed
THEN
The system determines if the freight forwarder information is valid and complete
Context: The freight forwarder information has been validated as complete and accurate
GIVEN
The freight forwarder information has been validated as complete and accurate
Applied to: Set Freight Forwarder Identified Flag
WHEN
The system processes the validation result
THEN
A freight forwarder identified flag is set to indicate successful identification
Context: The freight forwarder information has been validated as incomplete or invalid
GIVEN
The freight forwarder information has been validated as incomplete or invalid
Applied to: Log Freight Forwarder Not Found
WHEN
The system processes the validation result
THEN
A log entry is created indicating that freight forwarder information was not found or is invalid
Context: Freight forwarder processing has been completed with either successful identification or logging of not found status
GIVEN
Freight forwarder processing has been completed with either successful identification or logging of not found status
Applied to: Return Freight Forwarder Information
WHEN
The system completes the freight forwarder data retrieval process
THEN
The freight forwarder information (or indication of not found) is returned to the calling process
R-GCX016E-cbl-02652 (+11) File: GCX016E.cbl Freight Forwarder Broker Information Lookup Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Freight Forwarder Broker Information Lookup':
  • Context - a cargo record exists with segment data:
    For Retrieve Cargo Segment Data:
    When the system processes freight forwarder broker lookup request, then the freight forwarder code is extracted from the cargo segment data for further processing.
  • Context - cargo segment data has been retrieved:
    For Freight Forwarder Code Found?:
    When the system checks for freight forwarder code presence, then if freight forwarder code exists, proceed to broker database search; otherwise set lookup failed flag.
  • Context - a valid freight forwarder code exists:
    For Search Broker Database by FF Code:
    When the system searches the broker database using the freight forwarder code, then the system queries the broker database tables to find matching broker records.
  • Context - broker database search has been performed using freight forwarder code:
    For Broker Record Found?:
    When the system evaluates search results, then if broker record is found, proceed to retrieve broker name; otherwise log broker information not found.
  • Context - a valid broker record has been found in the database:
    For Retrieve Broker Name from GCST2RT:
    When the system accesses gcst2rt table, then the broker name is retrieved from the gcst2rt broker name segments.
  • Context - broker name has been successfully retrieved from gcst2rt:
    For Retrieve Associated Broker Information:
    When the system accesses gcstbrt broker information tables, then associated broker information including contact details is retrieved.
  • Context - associated broker information has been retrieved:
    For Extract Freight Forwarder Name:
    When the system processes the broker information data, then the freight forwarder name is extracted from the broker information.
  • Context - freight forwarder name has been extracted:
    For Extract Broker Contact Details:
    When the system continues processing broker information, then broker contact details are extracted from the broker information data.
  • Context - freight forwarder name and broker contact details have been extracted:
    For Store FF Name and Broker Info:
    When the system completes information extraction, then the freight forwarder name and broker information are stored in system variables.
  • Context - freight forwarder name and broker information have been successfully stored:
    For Set Lookup Success Flag:
    When the lookup process completes successfully, then the system sets the lookup success flag to indicate successful completion.
  • Context - either freight forwarder code is not found or broker information lookup fails:
    For Set Lookup Failed Flag:
    When the lookup process cannot be completed successfully, then the system sets the lookup failed flag to indicate unsuccessful completion.
  • Context - broker database search has been performed but no matching broker record was found:
    For Log Broker Information Not Found:
    When the system determines that broker information is not available, then the system logs that broker information was not found for the freight forwarder code.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with segment data
GIVEN
A cargo record exists with segment data
Applied to: Retrieve Cargo Segment Data
WHEN
The system processes freight forwarder broker lookup request
THEN
The freight forwarder code is extracted from the cargo segment data for further processing
Context: Cargo segment data has been retrieved
GIVEN
Cargo segment data has been retrieved
Applied to: Freight Forwarder Code Found?
WHEN
The system checks for freight forwarder code presence
THEN
If freight forwarder code exists, proceed to broker database search; otherwise set lookup failed flag
Context: A valid freight forwarder code exists
GIVEN
A valid freight forwarder code exists
Applied to: Search Broker Database by FF Code
WHEN
The system searches the broker database using the freight forwarder code
THEN
The system queries the broker database tables to find matching broker records
Context: Broker database search has been performed using freight forwarder code
GIVEN
Broker database search has been performed using freight forwarder code
Applied to: Broker Record Found?
WHEN
The system evaluates search results
THEN
If broker record is found, proceed to retrieve broker name; otherwise log broker information not found
Context: A valid broker record has been found in the database
GIVEN
A valid broker record has been found in the database
Applied to: Retrieve Broker Name from GCST2RT
WHEN
The system accesses GCST2RT table
THEN
The broker name is retrieved from the GCST2RT broker name segments
Context: Broker name has been successfully retrieved from GCST2RT
GIVEN
Broker name has been successfully retrieved from GCST2RT
Applied to: Retrieve Associated Broker Information
WHEN
The system accesses GCSTBRT broker information tables
THEN
Associated broker information including contact details is retrieved
Context: Associated broker information has been retrieved
GIVEN
Associated broker information has been retrieved
Applied to: Extract Freight Forwarder Name
WHEN
The system processes the broker information data
THEN
The freight forwarder name is extracted from the broker information
Context: Freight forwarder name has been extracted
GIVEN
Freight forwarder name has been extracted
Applied to: Extract Broker Contact Details
WHEN
The system continues processing broker information
THEN
Broker contact details are extracted from the broker information data
Context: Freight forwarder name and broker contact details have been extracted
GIVEN
Freight forwarder name and broker contact details have been extracted
Applied to: Store FF Name and Broker Info
WHEN
The system completes information extraction
THEN
The freight forwarder name and broker information are stored in system variables
Context: Freight forwarder name and broker information have been successfully stored
GIVEN
Freight forwarder name and broker information have been successfully stored
Applied to: Set Lookup Success Flag
WHEN
The lookup process completes successfully
THEN
The system sets the lookup success flag to indicate successful completion
Context: Either freight forwarder code is not found or broker information lookup fails
GIVEN
Either freight forwarder code is not found or broker information lookup fails
Applied to: Set Lookup Failed Flag
WHEN
The lookup process cannot be completed successfully
THEN
The system sets the lookup failed flag to indicate unsuccessful completion
Context: Broker database search has been performed but no matching broker record was found
GIVEN
Broker database search has been performed but no matching broker record was found
Applied to: Log Broker Information Not Found
WHEN
The system determines that broker information is not available
THEN
The system logs that broker information was not found for the freight forwarder code
R-GCX016E-cbl-02664 (+10) File: GCX016E.cbl Freight Forwarder Contact Information Retrieval Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Freight Forwarder Contact Information Retrieval':
  • Context - a cargo record exists with segment data:
    For Retrieve Cargo Segment Data:
    When the system needs to process freight forwarder notifications, then the system retrieves cargo segment data including freight forwarder and consignee information from gcsuss03 and gcsuss07 segments.
  • Context - cargo segment data has been retrieved:
    For Freight Forwarder Information Available?:
    When the system evaluates freight forwarder information, then the system determines if freight forwarder information is available and proceeds with lookup or logs missing information warning.
  • Context - freight forwarder information is available in cargo segment:
    For Look up Freight Forwarder Name from Broker Database:
    When the system needs to retrieve freight forwarder details, then the system searches gcst2rt broker name segments table using freight forwarder identifier.
  • Context - freight forwarder name has been found in broker database:
    For Retrieve Associated Broker Information:
    When the system needs complete broker information, then the system retrieves associated broker information including broker codes and identifiers.
  • Context - broker information has been retrieved:
    For Access Broker Contact Table:
    When the system needs contact information for notifications, then the system accesses gcstbrt broker contact table using broker identifier.
  • Context - broker contact table has been accessed:
    For Extract Email Addresses:
    When the system processes contact information, then the system extracts email addresses from the contact table records for notification purposes.
  • Context - email addresses have been extracted from contact table:
    For Retrieve Additional Contact Information:
    When the system needs complete contact information, then the system retrieves additional contact information such as phone numbers and addresses from the contact table.
  • Context - contact information has been retrieved from broker contact table:
    For Validate Contact Information:
    When the system validates contact information, then the system checks that required contact fields are present and properly formatted.
  • Context - contact information has been validated:
    For Contact Information Complete?:
    When the system evaluates information completeness, then the system determines if contact information is complete and routes to storage or warning logging accordingly.
  • Context - contact information is complete and validated:
    For Store Contact Information for Notifications:
    When the system needs to store contact information, then the system stores the contact information including email addresses for use in freight forwarder notifications.
  • Context - freight forwarder information is not available or contact information is incomplete:
    For Log Missing Contact Information Warning:
    When the system cannot retrieve complete contact information, then the system logs a warning message indicating missing or incomplete freight forwarder contact information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with segment data
GIVEN
A cargo record exists with segment data
Applied to: Retrieve Cargo Segment Data
WHEN
The system needs to process freight forwarder notifications
THEN
The system retrieves cargo segment data including freight forwarder and consignee information from GCSUSS03 and GCSUSS07 segments
Context: Cargo segment data has been retrieved
GIVEN
Cargo segment data has been retrieved
Applied to: Freight Forwarder Information Available?
WHEN
The system evaluates freight forwarder information
THEN
The system determines if freight forwarder information is available and proceeds with lookup or logs missing information warning
Context: Freight forwarder information is available in cargo segment
GIVEN
Freight forwarder information is available in cargo segment
Applied to: Look up Freight Forwarder Name from Broker Database
WHEN
The system needs to retrieve freight forwarder details
THEN
The system searches GCST2RT broker name segments table using freight forwarder identifier
Context: Freight forwarder name has been found in broker database
GIVEN
Freight forwarder name has been found in broker database
Applied to: Retrieve Associated Broker Information
WHEN
The system needs complete broker information
THEN
The system retrieves associated broker information including broker codes and identifiers
Context: Broker information has been retrieved
GIVEN
Broker information has been retrieved
Applied to: Access Broker Contact Table
WHEN
The system needs contact information for notifications
THEN
The system accesses GCSTBRT broker contact table using broker identifier
Context: Broker contact table has been accessed
GIVEN
Broker contact table has been accessed
Applied to: Extract Email Addresses
WHEN
The system processes contact information
THEN
The system extracts email addresses from the contact table records for notification purposes
Context: Email addresses have been extracted from contact table
GIVEN
Email addresses have been extracted from contact table
Applied to: Retrieve Additional Contact Information
WHEN
The system needs complete contact information
THEN
The system retrieves additional contact information such as phone numbers and addresses from the contact table
Context: Contact information has been retrieved from broker contact table
GIVEN
Contact information has been retrieved from broker contact table
Applied to: Validate Contact Information
WHEN
The system validates contact information
THEN
The system checks that required contact fields are present and properly formatted
Context: Contact information has been validated
GIVEN
Contact information has been validated
Applied to: Contact Information Complete?
WHEN
The system evaluates information completeness
THEN
The system determines if contact information is complete and routes to storage or warning logging accordingly
Context: Contact information is complete and validated
GIVEN
Contact information is complete and validated
Applied to: Store Contact Information for Notifications
WHEN
The system needs to store contact information
THEN
The system stores the contact information including email addresses for use in freight forwarder notifications
Context: Freight forwarder information is not available OR contact information is incomplete
GIVEN
Freight forwarder information is not available OR contact information is incomplete
Applied to: Log Missing Contact Information Warning
WHEN
The system cannot retrieve complete contact information
THEN
The system logs a warning message indicating missing or incomplete freight forwarder contact information
R-GCX016E-cbl-02675 (+21) File: GCX016E.cbl CIH Hold Email Notification System Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CIH Hold Email Notification System':
  • Context - a cargo disposition code needs to be processed for cih hold notification:
    For Search Broker Database for Freight Forwarder Disposition Codes:
    When the system searches the broker name table for freight forwarder disposition codes, then the system identifies if the disposition code corresponds to a freight forwarder.
  • Context - the broker database search has been completed:
    For Freight Forwarder Code Found?:
    When the system evaluates the search results for freight forwarder codes, then the system determines whether to proceed with email notification or terminate the process.
  • Context - a valid freight forwarder disposition code has been identified:
    For Retrieve Cargo Segment Data from GCSUSS03/GCSUSS07:
    When the system accesses gcsuss03 and gcsuss07 cargo segments, then the system retrieves forwarder and consignee information for email content.
  • Context - cargo segment data has been successfully retrieved from gcsuss03/gcsuss07:
    For Extract Freight Forwarder Information from Cargo Segments:
    When the system processes the cargo segments to extract freight forwarder information, then the system obtains freight forwarder identification and contact details.
  • Context - freight forwarder information has been extracted from cargo segments:
    For Lookup Freight Forwarder Name in Broker Database:
    When the system searches the broker database for the freight forwarder name, then the system validates the freight forwarder's existence in the broker database.
  • Context - the freight forwarder name lookup has been completed:
    For Freight Forwarder Name Found?:
    When the system evaluates whether a valid freight forwarder name was found, then the system determines whether to proceed with email address retrieval or terminate processing.
  • Context - a valid freight forwarder name has been found in the broker database:
    For Retrieve Email Address from GCSTBRT Table:
    When the system accesses the gcstbrt broker table to retrieve email address information, then the system obtains the freight forwarder's email address for notification delivery.
  • Context - email address retrieval from gcstbrt table has been completed:
    For Valid Email Address?:
    When the system evaluates the retrieved email address for validity, then the system determines whether to proceed with email content building or terminate processing.
  • Context - a valid email address has been confirmed for the freight forwarder:
    For Build Comprehensive Email Content:
    When the system builds the email notification content, then the system creates comprehensive email content with cargo details, equipment information, and hold reasons.
  • Context - email content building has been initiated:
    For Include Equipment Information:
    When the system processes equipment information for inclusion in the email, then the system adds equipment details including car id, equipment type, and related information to the email content.
  • Context - equipment information has been included in the email content:
    For Include Waybill and CCN Details:
    When the system processes waybill and ccn information for email inclusion, then the system adds waybill numbers and ccn details to the email notification content.
  • Context - waybill and ccn details have been included in the email content:
    For Include Content Description:
    When the system processes cargo content description for email inclusion, then the system adds detailed cargo content description to the email notification.
  • Context - content description has been included in the email content:
    For Include Origin/Destination Stations:
    When the system processes origin and destination station information for email inclusion, then the system adds origin and destination station details to the email notification content.
  • Context - origin and destination station information has been included in the email content:
    For Include CIH Disposition Information:
    When the system processes cih disposition information for email inclusion, then the system adds cih disposition code details and related information to the email notification.
  • Context - cih disposition information has been included in the email content:
    For Include Hold Reason Details:
    When the system processes hold reason details for email inclusion, then the system adds comprehensive hold reason details and explanations to complete the email notification content.
  • Context - complete email content has been built with all required information:
    For Send Email Notification:
    When the system initiates email delivery to the freight forwarder, then the system sends the cih hold notification email to the specified recipient.
  • Context - an email notification has been sent to the freight forwarder:
    For Apply Retry Logic for Delivery Failures:
    When the system encounters email delivery failures or issues, then the system applies retry logic to attempt email delivery multiple times before considering it failed.
  • Context - email delivery has been attempted with retry logic applied:
    For Email Delivery Successful?:
    When the system evaluates the final delivery status of the email notification, then the system determines whether the email was successfully delivered or requires alternative handling.
  • Context - email notification has been successfully delivered to the freight forwarder:
    For Log Successful Email Delivery:
    When the system processes the successful delivery confirmation, then the system logs the successful email delivery with timestamp and recipient information for audit purposes.
  • Context - email notification delivery has failed after retry attempts:
    For Handle Email Delivery Failure:
    When the system processes the delivery failure, then the system initiates alternative notification handling procedures.
  • Context - email delivery has failed and alternative handling has been initiated:
    For Reroute to Default Recipient:
    When the system implements fallback notification procedures, then the system reroutes the notification to default recipients (aei9999, om01247) to ensure notification delivery.
  • Context - email processing has been completed either through successful delivery or fallback rerouting:
    For Log Email Processing Complete:
    When the system finalizes the email notification process, then the system logs the completion of email processing with final status and actions taken.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo disposition code needs to be processed for CIH hold notification
GIVEN
A cargo disposition code needs to be processed for CIH hold notification
Applied to: Search Broker Database for Freight Forwarder Disposition Codes
WHEN
The system searches the broker name table for freight forwarder disposition codes
THEN
The system identifies if the disposition code corresponds to a freight forwarder
Context: The broker database search has been completed
GIVEN
The broker database search has been completed
Applied to: Freight Forwarder Code Found?
WHEN
The system evaluates the search results for freight forwarder codes
THEN
The system determines whether to proceed with email notification or terminate the process
Context: A valid freight forwarder disposition code has been identified
GIVEN
A valid freight forwarder disposition code has been identified
Applied to: Retrieve Cargo Segment Data from GCSUSS03/GCSUSS07
WHEN
The system accesses GCSUSS03 and GCSUSS07 cargo segments
THEN
The system retrieves forwarder and consignee information for email content
Context: Cargo segment data has been successfully retrieved from GCSUSS03/GCSUSS07
GIVEN
Cargo segment data has been successfully retrieved from GCSUSS03/GCSUSS07
Applied to: Extract Freight Forwarder Information from Cargo Segments
WHEN
The system processes the cargo segments to extract freight forwarder information
THEN
The system obtains freight forwarder identification and contact details
Context: Freight forwarder information has been extracted from cargo segments
GIVEN
Freight forwarder information has been extracted from cargo segments
Applied to: Lookup Freight Forwarder Name in Broker Database
WHEN
The system searches the broker database for the freight forwarder name
THEN
The system validates the freight forwarder's existence in the broker database
Context: The freight forwarder name lookup has been completed
GIVEN
The freight forwarder name lookup has been completed
Applied to: Freight Forwarder Name Found?
WHEN
The system evaluates whether a valid freight forwarder name was found
THEN
The system determines whether to proceed with email address retrieval or terminate processing
Context: A valid freight forwarder name has been found in the broker database
GIVEN
A valid freight forwarder name has been found in the broker database
Applied to: Retrieve Email Address from GCSTBRT Table
WHEN
The system accesses the GCSTBRT broker table to retrieve email address information
THEN
The system obtains the freight forwarder's email address for notification delivery
Context: Email address retrieval from GCSTBRT table has been completed
GIVEN
Email address retrieval from GCSTBRT table has been completed
Applied to: Valid Email Address?
WHEN
The system evaluates the retrieved email address for validity
THEN
The system determines whether to proceed with email content building or terminate processing
Context: A valid email address has been confirmed for the freight forwarder
GIVEN
A valid email address has been confirmed for the freight forwarder
Applied to: Build Comprehensive Email Content
WHEN
The system builds the email notification content
THEN
The system creates comprehensive email content with cargo details, equipment information, and hold reasons
Context: Email content building has been initiated
GIVEN
Email content building has been initiated
Applied to: Include Equipment Information
WHEN
The system processes equipment information for inclusion in the email
THEN
The system adds equipment details including car ID, equipment type, and related information to the email content
Context: Equipment information has been included in the email content
GIVEN
Equipment information has been included in the email content
Applied to: Include Waybill and CCN Details
WHEN
The system processes waybill and CCN information for email inclusion
THEN
The system adds waybill numbers and CCN details to the email notification content
Context: Waybill and CCN details have been included in the email content
GIVEN
Waybill and CCN details have been included in the email content
Applied to: Include Content Description
WHEN
The system processes cargo content description for email inclusion
THEN
The system adds detailed cargo content description to the email notification
Context: Content description has been included in the email content
GIVEN
Content description has been included in the email content
Applied to: Include Origin/Destination Stations
WHEN
The system processes origin and destination station information for email inclusion
THEN
The system adds origin and destination station details to the email notification content
Context: Origin and destination station information has been included in the email content
GIVEN
Origin and destination station information has been included in the email content
Applied to: Include CIH Disposition Information
WHEN
The system processes CIH disposition information for email inclusion
THEN
The system adds CIH disposition code details and related information to the email notification
Context: CIH disposition information has been included in the email content
GIVEN
CIH disposition information has been included in the email content
Applied to: Include Hold Reason Details
WHEN
The system processes hold reason details for email inclusion
THEN
The system adds comprehensive hold reason details and explanations to complete the email notification content
Context: Complete email content has been built with all required information
GIVEN
Complete email content has been built with all required information
Applied to: Send Email Notification
WHEN
The system initiates email delivery to the freight forwarder
THEN
The system sends the CIH hold notification email to the specified recipient
Context: An email notification has been sent to the freight forwarder
GIVEN
An email notification has been sent to the freight forwarder
Applied to: Apply Retry Logic for Delivery Failures
WHEN
The system encounters email delivery failures or issues
THEN
The system applies retry logic to attempt email delivery multiple times before considering it failed
Context: Email delivery has been attempted with retry logic applied
GIVEN
Email delivery has been attempted with retry logic applied
Applied to: Email Delivery Successful?
WHEN
The system evaluates the final delivery status of the email notification
THEN
The system determines whether the email was successfully delivered or requires alternative handling
Context: Email notification has been successfully delivered to the freight forwarder
GIVEN
Email notification has been successfully delivered to the freight forwarder
Applied to: Log Successful Email Delivery
WHEN
The system processes the successful delivery confirmation
THEN
The system logs the successful email delivery with timestamp and recipient information for audit purposes
Context: Email notification delivery has failed after retry attempts
GIVEN
Email notification delivery has failed after retry attempts
Applied to: Handle Email Delivery Failure
WHEN
The system processes the delivery failure
THEN
The system initiates alternative notification handling procedures
Context: Email delivery has failed and alternative handling has been initiated
GIVEN
Email delivery has failed and alternative handling has been initiated
Applied to: Reroute to Default Recipient
WHEN
The system implements fallback notification procedures
THEN
The system reroutes the notification to default recipients (AEI9999, OM01247) to ensure notification delivery
Context: Email processing has been completed either through successful delivery or fallback rerouting
GIVEN
Email processing has been completed either through successful delivery or fallback rerouting
Applied to: Log Email Processing Complete
WHEN
The system finalizes the email notification process
THEN
The system logs the completion of email processing with final status and actions taken
R-GCX016E-cbl-02697 (+13) File: GCX016E.cbl Email Message Distribution with Retry Logic Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email Message Distribution with Retry Logic':
  • Context - a freight forwarder disposition code requires email notification and cargo information is available:
    For Prepare Email Message Content:
    When the system prepares the email message content, then the email message includes cargo details (ccn, waybill, car id), equipment information, origin/destination data, consignee information, and disposition code messages.
  • Context - email message content is prepared and ready for delivery:
    For Set Initial Delivery Attempt:
    When the system sets up the initial delivery attempt, then the retry counter is set to zero and delivery parameters are initialized for the first attempt.
  • Context - email message is prepared and delivery attempt is initialized:
    For Attempt Email Delivery:
    When the system attempts email delivery, then the email is transmitted to the freight forwarder's internet address if available, otherwise to the default merlin id.
  • Context - an email delivery attempt has been made:
    For Delivery Successful?:
    When the system checks the delivery status, then if the delivery response indicates success, the process continues to success logging, otherwise it proceeds to retry logic.
  • Context - email delivery has been confirmed as successful:
    For Log Successful Delivery:
    When the system logs the successful delivery, then a delivery success record is created with timestamp and recipient information for audit purposes.
  • Context - email delivery has failed:
    For Increment Retry Counter:
    When the system increments the retry counter, then the retry counter is increased by one to track the current attempt number.
  • Context - email delivery has failed and retry counter has been incremented:
    For Max Retries Reached?:
    When the system checks if maximum retries have been reached, then if retry counter equals or exceeds maximum retry limit, proceed to failure logging, otherwise continue with retry delay.
  • Context - email delivery has failed and maximum retries have not been reached:
    For Apply Retry Delay:
    When the system applies retry delay, then a predetermined delay period is applied before the next delivery attempt.
  • Context - retry delay has been applied:
    For Update Delivery Status:
    When the system updates delivery status, then the delivery status is updated to indicate retry in progress and the system is ready for the next attempt.
  • Context - maximum retry attempts have been reached without successful email delivery:
    For Log Delivery Failure:
    When the system logs the delivery failure, then a delivery failure record is created with error details and retry attempt count for troubleshooting purposes.
  • Context - primary email delivery has failed after maximum retry attempts:
    For Route to Alternative Recipient:
    When the system routes to alternative recipient, then the email is prepared for delivery to backup recipients (aei9999, om01247) as fallback options.
  • Context - primary email delivery has failed and alternative routing is initiated:
    For Alternative Available?:
    When the system checks alternative recipient availability, then if alternative recipients (aei9999, om01247) are available, proceed to send to default recipient, otherwise log final failure.
  • Context - alternative recipients are available for fallback delivery:
    For Send to Default Recipient:
    When the system sends to default recipient, then the email is delivered to the default recipient (om01247) with notification that original delivery failed.
  • Context - all email delivery attempts including alternative recipients have failed:
    For Log Final Failure:
    When the system logs final failure, then a final failure record is created indicating complete delivery failure with all attempted recipients and error details.
👨‍💻 Technical ACs (Gherkin)
Context: A freight forwarder disposition code requires email notification and cargo information is available
GIVEN
A freight forwarder disposition code requires email notification and cargo information is available
Applied to: Prepare Email Message Content
WHEN
The system prepares the email message content
THEN
The email message includes cargo details (CCN, waybill, car ID), equipment information, origin/destination data, consignee information, and disposition code messages
Context: Email message content is prepared and ready for delivery
GIVEN
Email message content is prepared and ready for delivery
Applied to: Set Initial Delivery Attempt
WHEN
The system sets up the initial delivery attempt
THEN
The retry counter is set to zero and delivery parameters are initialized for the first attempt
Context: Email message is prepared and delivery attempt is initialized
GIVEN
Email message is prepared and delivery attempt is initialized
Applied to: Attempt Email Delivery
WHEN
The system attempts email delivery
THEN
The email is transmitted to the freight forwarder's internet address if available, otherwise to the default Merlin ID
Context: An email delivery attempt has been made
GIVEN
An email delivery attempt has been made
Applied to: Delivery Successful?
WHEN
The system checks the delivery status
THEN
If the delivery response indicates success, the process continues to success logging, otherwise it proceeds to retry logic
Context: Email delivery has been confirmed as successful
GIVEN
Email delivery has been confirmed as successful
Applied to: Log Successful Delivery
WHEN
The system logs the successful delivery
THEN
A delivery success record is created with timestamp and recipient information for audit purposes
Context: Email delivery has failed
GIVEN
Email delivery has failed
Applied to: Increment Retry Counter
WHEN
The system increments the retry counter
THEN
The retry counter is increased by one to track the current attempt number
Context: Email delivery has failed and retry counter has been incremented
GIVEN
Email delivery has failed and retry counter has been incremented
Applied to: Max Retries Reached?
WHEN
The system checks if maximum retries have been reached
THEN
If retry counter equals or exceeds maximum retry limit, proceed to failure logging, otherwise continue with retry delay
Context: Email delivery has failed and maximum retries have not been reached
GIVEN
Email delivery has failed and maximum retries have not been reached
Applied to: Apply Retry Delay
WHEN
The system applies retry delay
THEN
A predetermined delay period is applied before the next delivery attempt
Context: Retry delay has been applied
GIVEN
Retry delay has been applied
Applied to: Update Delivery Status
WHEN
The system updates delivery status
THEN
The delivery status is updated to indicate retry in progress and the system is ready for the next attempt
Context: Maximum retry attempts have been reached without successful email delivery
GIVEN
Maximum retry attempts have been reached without successful email delivery
Applied to: Log Delivery Failure
WHEN
The system logs the delivery failure
THEN
A delivery failure record is created with error details and retry attempt count for troubleshooting purposes
Context: Primary email delivery has failed after maximum retry attempts
GIVEN
Primary email delivery has failed after maximum retry attempts
Applied to: Route to Alternative Recipient
WHEN
The system routes to alternative recipient
THEN
The email is prepared for delivery to backup recipients (AEI9999, OM01247) as fallback options
Context: Primary email delivery has failed and alternative routing is initiated
GIVEN
Primary email delivery has failed and alternative routing is initiated
Applied to: Alternative Available?
WHEN
The system checks alternative recipient availability
THEN
If alternative recipients (AEI9999, OM01247) are available, proceed to send to default recipient, otherwise log final failure
Context: Alternative recipients are available for fallback delivery
GIVEN
Alternative recipients are available for fallback delivery
Applied to: Send to Default Recipient
WHEN
The system sends to default recipient
THEN
The email is delivered to the default recipient (OM01247) with notification that original delivery failed
Context: All email delivery attempts including alternative recipients have failed
GIVEN
All email delivery attempts including alternative recipients have failed
Applied to: Log Final Failure
WHEN
The system logs final failure
THEN
A final failure record is created indicating complete delivery failure with all attempted recipients and error details
R-GCX016E-cbl-02711 (+11) File: GCX016E.cbl Status Array Debug Information Logging Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Debug Information Logging':
  • Context - a cargo status processing event requires debug logging:
    For Create Debug Information Header:
    When the system initiates debug information capture, then a debug header is created with cargo identification details including equipment id, waybill number, and us-ccn.
  • Context - a cargo requires status processing and debug logging is enabled:
    For Log Cargo Status Before Processing:
    When the system begins cargo status processing, then the current cargo status, quantities, and disposition codes are captured and logged as baseline information.
  • Context - debug logging is requested for cargo status processing:
    For Capture Current Status Information:
    When the system attempts to capture current status information, then if status information is available, proceed with detailed logging, otherwise skip to message formatting.
  • Context - cargo status information is available for logging:
    For Log RT10/RT11 Cargo Status:
    When the system processes rt10/rt11 cargo status records, then rt10 and rt11 status details are captured and included in the debug log.
  • Context - cargo status processing requires quantity tracking:
    For Log Cargo Quantities:
    When the system logs cargo information, then current cargo quantities, released quantities, and any pending quantity changes are documented in the debug log.
  • Context - cargo has associated disposition codes:
    For Log Disposition Codes:
    When the system performs debug logging, then all current disposition codes, their entry numbers, and associated quantities are documented in the debug log.
  • Context - cargo has an s09a status array with multiple entries:
    For Dump Complete S09A Status Array:
    When debug logging requires complete status visibility, then the entire s09a status array is dumped showing all status codes, sequences, and occurrence data.
  • Context - cargo status processing has been completed:
    For Log Cargo Status After Processing:
    When the system finalizes debug logging, then the final cargo status, updated quantities, and new disposition codes are captured and logged.
  • Context - both before and after status information has been captured:
    For Create Before/After Comparison:
    When the system completes status processing, then a comparison is created highlighting status changes, quantity modifications, and disposition code updates.
  • Context - all debug information has been captured:
    For Format Debug Message Content:
    When the system prepares debug output, then debug information is formatted into a structured message containing header, before/after status, and comparison data.
  • Context - debug message has been formatted and is ready for distribution:
    For Route Debug Message to Recipients:
    When the system processes debug message routing, then debug messages are routed to designated merlin recipients for troubleshooting support.
  • Context - debug logging has been completed:
    For Store Debug Log for Audit Trail:
    When the system finalizes debug processing, then debug log information is stored in audit trail records with timestamps for compliance and historical reference.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status processing event requires debug logging
GIVEN
A cargo status processing event requires debug logging
Applied to: Create Debug Information Header
WHEN
The system initiates debug information capture
THEN
A debug header is created with cargo identification details including equipment ID, waybill number, and US-CCN
Context: A cargo requires status processing and debug logging is enabled
GIVEN
A cargo requires status processing and debug logging is enabled
Applied to: Log Cargo Status Before Processing
WHEN
The system begins cargo status processing
THEN
The current cargo status, quantities, and disposition codes are captured and logged as baseline information
Context: Debug logging is requested for cargo status processing
GIVEN
Debug logging is requested for cargo status processing
Applied to: Capture Current Status Information
WHEN
The system attempts to capture current status information
THEN
If status information is available, proceed with detailed logging, otherwise skip to message formatting
Context: Cargo status information is available for logging
GIVEN
Cargo status information is available for logging
Applied to: Log RT10/RT11 Cargo Status
WHEN
The system processes RT10/RT11 cargo status records
THEN
RT10 and RT11 status details are captured and included in the debug log
Context: Cargo status processing requires quantity tracking
GIVEN
Cargo status processing requires quantity tracking
Applied to: Log Cargo Quantities
WHEN
The system logs cargo information
THEN
Current cargo quantities, released quantities, and any pending quantity changes are documented in the debug log
Context: Cargo has associated disposition codes
GIVEN
Cargo has associated disposition codes
Applied to: Log Disposition Codes
WHEN
The system performs debug logging
THEN
All current disposition codes, their entry numbers, and associated quantities are documented in the debug log
Context: Cargo has an S09A status array with multiple entries
GIVEN
Cargo has an S09A status array with multiple entries
Applied to: Dump Complete S09A Status Array
WHEN
Debug logging requires complete status visibility
THEN
The entire S09A status array is dumped showing all status codes, sequences, and occurrence data
Context: Cargo status processing has been completed
GIVEN
Cargo status processing has been completed
Applied to: Log Cargo Status After Processing
WHEN
The system finalizes debug logging
THEN
The final cargo status, updated quantities, and new disposition codes are captured and logged
Context: Both before and after status information has been captured
GIVEN
Both before and after status information has been captured
Applied to: Create Before/After Comparison
WHEN
The system completes status processing
THEN
A comparison is created highlighting status changes, quantity modifications, and disposition code updates
Context: All debug information has been captured
GIVEN
All debug information has been captured
Applied to: Format Debug Message Content
WHEN
The system prepares debug output
THEN
Debug information is formatted into a structured message containing header, before/after status, and comparison data
Context: Debug message has been formatted and is ready for distribution
GIVEN
Debug message has been formatted and is ready for distribution
Applied to: Route Debug Message to Recipients
WHEN
The system processes debug message routing
THEN
Debug messages are routed to designated Merlin recipients for troubleshooting support
Context: Debug logging has been completed
GIVEN
Debug logging has been completed
Applied to: Store Debug Log for Audit Trail
WHEN
The system finalizes debug processing
THEN
Debug log information is stored in audit trail records with timestamps for compliance and historical reference
R-GCX016E-cbl-02723 (+14) File: GCX016E.cbl Merlin Message Routing and Distribution Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Message Routing and Distribution':
  • Context - a merlin message is ready for distribution:
    For ERROR Message Type:
    When the message type is determined to be error, then the message should be routed to the in destination.
  • Context - a merlin message is ready for distribution and message type is info:
    For INFO Message Type:
    When the system processes the message routing, then the message should be sent to in destination and all valid sd segment merlin ids.
  • Context - a merlin message is ready for distribution and message type is release:
    For RELEASE Message Type:
    When the system processes the message routing, then the message should be sent only to valid sd segment merlin ids and not to in destination.
  • Context - a merlin message is ready for distribution and message type is export:
    For EXPORT Message Type:
    When the system evaluates the equipment type for routing decisions, then the message should be routed according to equipment-specific routing rules.
  • Context - a merlin message is ready for distribution and message type is unrlse:
    For UNRLSE Message Type:
    When the system processes the message routing, then the message should be sent to om01247 and all valid sd cancel merlin ids.
  • Context - a message type has been determined for a merlin message:
    For Check AD Segment Configuration:
    When the system needs to identify message recipients, then the ad segment configuration should be checked to find valid recipient merlin ids.
  • Context - ad segment configuration has been checked for a message:
    For Valid Recipient Found?:
    When the system evaluates recipient validity, then if valid recipients are found, proceed with configured routing; if no valid recipients exist, use default routing.
  • Context - valid recipients have been found in the ad segment configuration:
    For Route to Configured Recipient:
    When the system processes message routing, then the message should be delivered to all configured valid recipients.
  • Context - no valid recipients were found in the ad segment configuration:
    For Route to Default Recipient OM01247:
    When the system needs to deliver the message, then the message should be routed to the default recipient om01247.
  • Context - an invalid recipient is detected in the routing configuration:
    For Generate Invalid Recipient Error:
    When the system validates recipient information, then an invalid recipient error should be generated for tracking and correction.
  • Context - an invalid recipient error has been generated:
    For Reroute Message with Error Notification:
    When the system needs to handle the failed routing, then the message should be rerouted with an error notification indicating the routing failure.
  • Context - a message has been successfully distributed to recipients:
    For Log Distribution Action:
    When the distribution process completes, then the distribution action should be logged with relevant details for audit purposes.
  • Context - a message distribution has been attempted:
    For Handle Delivery Failure:
    When the delivery fails for any reason, then the system should handle the delivery failure and determine if retry is required.
  • Context - a message delivery failure has been detected:
    For Retry Required?:
    When the system evaluates the failure conditions, then if retry is required, reroute to default recipient; if no retry is needed, complete the distribution process.
  • Context - a delivery failure has occurred and retry is required:
    For Reroute to Default Recipient:
    When the system initiates the retry process, then the message should be rerouted to the default recipient as a fallback delivery method.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin message is ready for distribution
GIVEN
A Merlin message is ready for distribution
Applied to: ERROR Message Type
WHEN
The message type is determined to be ERROR
THEN
The message should be routed to the IN destination
Context: A Merlin message is ready for distribution and message type is INFO
GIVEN
A Merlin message is ready for distribution and message type is INFO
Applied to: INFO Message Type
WHEN
The system processes the message routing
THEN
The message should be sent to IN destination and all valid SD segment Merlin IDs
Context: A Merlin message is ready for distribution and message type is RELEASE
GIVEN
A Merlin message is ready for distribution and message type is RELEASE
Applied to: RELEASE Message Type
WHEN
The system processes the message routing
THEN
The message should be sent only to valid SD segment Merlin IDs and not to IN destination
Context: A Merlin message is ready for distribution and message type is EXPORT
GIVEN
A Merlin message is ready for distribution and message type is EXPORT
Applied to: EXPORT Message Type
WHEN
The system evaluates the equipment type for routing decisions
THEN
The message should be routed according to equipment-specific routing rules
Context: A Merlin message is ready for distribution and message type is UNRLSE
GIVEN
A Merlin message is ready for distribution and message type is UNRLSE
Applied to: UNRLSE Message Type
WHEN
The system processes the message routing
THEN
The message should be sent to OM01247 and all valid SD cancel Merlin IDs
Context: A message type has been determined for a Merlin message
GIVEN
A message type has been determined for a Merlin message
Applied to: Check AD Segment Configuration
WHEN
The system needs to identify message recipients
THEN
The AD segment configuration should be checked to find valid recipient Merlin IDs
Context: AD segment configuration has been checked for a message
GIVEN
AD segment configuration has been checked for a message
Applied to: Valid Recipient Found?
WHEN
The system evaluates recipient validity
THEN
If valid recipients are found, proceed with configured routing; if no valid recipients exist, use default routing
Context: Valid recipients have been found in the AD segment configuration
GIVEN
Valid recipients have been found in the AD segment configuration
Applied to: Route to Configured Recipient
WHEN
The system processes message routing
THEN
The message should be delivered to all configured valid recipients
Context: No valid recipients were found in the AD segment configuration
GIVEN
No valid recipients were found in the AD segment configuration
Applied to: Route to Default Recipient OM01247
WHEN
The system needs to deliver the message
THEN
The message should be routed to the default recipient OM01247
Context: An invalid recipient is detected in the routing configuration
GIVEN
An invalid recipient is detected in the routing configuration
Applied to: Generate Invalid Recipient Error
WHEN
The system validates recipient information
THEN
An invalid recipient error should be generated for tracking and correction
Context: An invalid recipient error has been generated
GIVEN
An invalid recipient error has been generated
Applied to: Reroute Message with Error Notification
WHEN
The system needs to handle the failed routing
THEN
The message should be rerouted with an error notification indicating the routing failure
Context: A message has been successfully distributed to recipients
GIVEN
A message has been successfully distributed to recipients
Applied to: Log Distribution Action
WHEN
The distribution process completes
THEN
The distribution action should be logged with relevant details for audit purposes
Context: A message distribution has been attempted
GIVEN
A message distribution has been attempted
Applied to: Handle Delivery Failure
WHEN
The delivery fails for any reason
THEN
The system should handle the delivery failure and determine if retry is required
Context: A message delivery failure has been detected
GIVEN
A message delivery failure has been detected
Applied to: Retry Required?
WHEN
The system evaluates the failure conditions
THEN
If retry is required, reroute to default recipient; if no retry is needed, complete the distribution process
Context: A delivery failure has occurred and retry is required
GIVEN
A delivery failure has occurred and retry is required
Applied to: Reroute to Default Recipient
WHEN
The system initiates the retry process
THEN
The message should be rerouted to the default recipient as a fallback delivery method
R-GCX016E-cbl-02738 (+11) File: GCX016E.cbl Merlin Message Delivery with Error Handling Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Message Delivery with Error Handling':
  • Context - a merlin message needs to be delivered:
    For Route ERROR Message:
    When the message type is error, then the message should be routed to the 'in' destination.
    For Route INFO Message:
    When the message type is info, then the message should be routed to 'in' destination plus sd segment merlin ids.
    For Route RELEASE Message:
    When the message type is release, then the message should be routed to sd segment merlin ids only.
    For Route EXPORT Message:
    When the message type is export, then the message should be routed based on equipment type settings.
    For Route UNRLSE Message:
    When the message type is unrlse, then the message should be routed to om01247 plus sd cancel merlin ids.
    For Route ARRCANL Message:
    When the message type is arrcanl, then the message should be routed to arrival cancellation recipients.
  • Context - a message recipient has been determined:
    For Use AD Segment Configuration:
    When the recipient is valid, then the system should use ad segment configuration for delivery.
    For Use Default Recipient OM01247:
    When the recipient is not valid, then the system should use default recipient om01247.
  • Context - a message has been sent to a recipient:
    For Generate Error Notification:
    When the delivery is not successful, then the system should generate an error notification.
  • Context - a message delivery has failed and error notification has been generated:
    For Reroute to Default Recipient:
    When rerouting is attempted, then the message should be sent to the default recipient.
  • Context - a message rerouting has been attempted:
    For Final Delivery Failure:
    When the rerouting is not successful, then the system should record a final delivery failure.
  • Context - a message delivery process has completed:
    For Log Delivery Status:
    When the delivery outcome is determined (success, rerouted success, or failure), then the system should log the delivery status.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin message needs to be delivered
GIVEN
A Merlin message needs to be delivered
Applied to: Route ERROR Message
WHEN
The message type is ERROR
THEN
The message should be routed to the 'IN' destination
Applied to: Route INFO Message
WHEN
The message type is INFO
THEN
The message should be routed to 'IN' destination plus SD segment Merlin IDs
Applied to: Route RELEASE Message
WHEN
The message type is RELEASE
THEN
The message should be routed to SD segment Merlin IDs only
Applied to: Route EXPORT Message
WHEN
The message type is EXPORT
THEN
The message should be routed based on equipment type settings
Applied to: Route UNRLSE Message
WHEN
The message type is UNRLSE
THEN
The message should be routed to OM01247 plus SD cancel Merlin IDs
Applied to: Route ARRCANL Message
WHEN
The message type is ARRCANL
THEN
The message should be routed to arrival cancellation recipients
Context: A message recipient has been determined
GIVEN
A message recipient has been determined
Applied to: Use AD Segment Configuration
WHEN
The recipient is valid
THEN
The system should use AD segment configuration for delivery
Applied to: Use Default Recipient OM01247
WHEN
The recipient is not valid
THEN
The system should use default recipient OM01247
Context: A message has been sent to a recipient
GIVEN
A message has been sent to a recipient
Applied to: Generate Error Notification
WHEN
The delivery is not successful
THEN
The system should generate an error notification
Context: A message delivery has failed and error notification has been generated
GIVEN
A message delivery has failed and error notification has been generated
Applied to: Reroute to Default Recipient
WHEN
Rerouting is attempted
THEN
The message should be sent to the default recipient
Context: A message rerouting has been attempted
GIVEN
A message rerouting has been attempted
Applied to: Final Delivery Failure
WHEN
The rerouting is not successful
THEN
The system should record a final delivery failure
Context: A message delivery process has completed
GIVEN
A message delivery process has completed
Applied to: Log Delivery Status
WHEN
The delivery outcome is determined (success, rerouted success, or failure)
THEN
The system should log the delivery status
R-GCX016E-cbl-02750 (+8) File: GCX016E.cbl Cargo Information Audit Logging Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Information Audit Logging':
  • Context - a cargo processing action has occurred that requires audit logging:
    For Prepare Audit Log Entry:
    When the system initiates audit log preparation, then an audit log entry structure is prepared to capture the cargo processing action details.
  • Context - an audit log entry is being prepared for a cargo processing action:
    For Capture Timestamp Information:
    When the system captures timestamp information, then the current date and time are recorded in the audit log entry for tracking when the action occurred.
  • Context - an audit log entry is being prepared with timestamp information:
    For Capture User Information:
    When the system captures user information, then the user identification and relevant user context are recorded in the audit log entry for accountability tracking.
  • Context - an audit log entry has been prepared with timestamp and user information:
    For Set Action Code to LOG-USE-INPUT-MESSAGE:
    When the system sets the action code for the audit log, then the action code is set to log-use-input-message to indicate this is an input message logging action.
  • Context - an audit log entry is prepared with action code log-use-input-message:
    For Spawn GCT1051E Transaction:
    When the system spawns the gct1051e transaction, then the gct1051e audit logging transaction is invoked to process the audit log entry.
  • Context - the gct1051e transaction has been spawned for audit logging:
    For Transaction Spawn Successful?:
    When the system checks the transaction spawn result, then if the transaction spawn was successful, proceed to log audit entry creation, otherwise handle the logging error.
  • Context - the gct1051e transaction spawn was successful:
    For Log Audit Entry Created:
    When the audit log entry is processed, then the audit log entry is successfully created and recorded in the audit system for compliance tracking.
  • Context - the gct1051e transaction spawn was not successful:
    For Handle Logging Error:
    When the system handles the logging error, then the logging error is processed and handled appropriately without stopping the main cargo processing flow.
  • Context - either the audit log entry was successfully created or the logging error was handled:
    For Continue Processing:
    When the audit logging process is complete, then the system continues with the main cargo processing workflow without interruption.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing action has occurred that requires audit logging
GIVEN
A cargo processing action has occurred that requires audit logging
Applied to: Prepare Audit Log Entry
WHEN
The system initiates audit log preparation
THEN
An audit log entry structure is prepared to capture the cargo processing action details
Context: An audit log entry is being prepared for a cargo processing action
GIVEN
An audit log entry is being prepared for a cargo processing action
Applied to: Capture Timestamp Information
WHEN
The system captures timestamp information
THEN
The current date and time are recorded in the audit log entry for tracking when the action occurred
Context: An audit log entry is being prepared with timestamp information
GIVEN
An audit log entry is being prepared with timestamp information
Applied to: Capture User Information
WHEN
The system captures user information
THEN
The user identification and relevant user context are recorded in the audit log entry for accountability tracking
Context: An audit log entry has been prepared with timestamp and user information
GIVEN
An audit log entry has been prepared with timestamp and user information
Applied to: Set Action Code to LOG-USE-INPUT-MESSAGE
WHEN
The system sets the action code for the audit log
THEN
The action code is set to LOG-USE-INPUT-MESSAGE to indicate this is an input message logging action
Context: An audit log entry is prepared with action code LOG-USE-INPUT-MESSAGE
GIVEN
An audit log entry is prepared with action code LOG-USE-INPUT-MESSAGE
Applied to: Spawn GCT1051E Transaction
WHEN
The system spawns the GCT1051E transaction
THEN
The GCT1051E audit logging transaction is invoked to process the audit log entry
Context: The GCT1051E transaction has been spawned for audit logging
GIVEN
The GCT1051E transaction has been spawned for audit logging
Applied to: Transaction Spawn Successful?
WHEN
The system checks the transaction spawn result
THEN
If the transaction spawn was successful, proceed to log audit entry creation, otherwise handle the logging error
Context: The GCT1051E transaction spawn was successful
GIVEN
The GCT1051E transaction spawn was successful
Applied to: Log Audit Entry Created
WHEN
The audit log entry is processed
THEN
The audit log entry is successfully created and recorded in the audit system for compliance tracking
Context: The GCT1051E transaction spawn was not successful
GIVEN
The GCT1051E transaction spawn was not successful
Applied to: Handle Logging Error
WHEN
The system handles the logging error
THEN
The logging error is processed and handled appropriately without stopping the main cargo processing flow
Context: Either the audit log entry was successfully created or the logging error was handled
GIVEN
Either the audit log entry was successfully created or the logging error was handled
Applied to: Continue Processing
WHEN
The audit logging process is complete
THEN
The system continues with the main cargo processing workflow without interruption
R-GCX016E-cbl-02759 (+15) File: GCX016E.cbl Merlin Report Field Management Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Report Field Management':
  • Context - a cargo record contains equipment information:
    For Format Equipment Information:
    When the system processes merlin report field management, then the equipment information is formatted and prepared for report inclusion.
  • Context - a cargo record exists with car identification data:
    For Extract Car ID from Cargo Record:
    When the system needs car id information for merlin reporting, then the car id is extracted from the cargo record and made available for formatting.
  • Context - a cargo record contains waybill number information:
    For Format Waybill Number:
    When the system processes waybill data for merlin reporting, then the waybill number is formatted according to report requirements.
  • Context - a cargo record contains us-ccn information:
    For Format US-CCN Information:
    When the system processes ccn data for merlin reporting, then the us-ccn is formatted according to report standards.
  • Context - a disposition code exists for the cargo:
    For Format Disposition Code Information:
    When the system processes disposition code data for merlin reporting, then the disposition code information is formatted for report inclusion.
  • Context - a disposition code identifier exists:
    For Retrieve Disposition Code:
    When the system needs disposition code details for merlin reporting, then the disposition code is retrieved from the disposition code table.
  • Context - a disposition code has been retrieved from the table:
    For Get Disposition Description:
    When the system needs the description for merlin reporting, then the disposition code description is obtained from the disposition code table.
  • Context - date and time information is available for the cargo transaction:
    For Format Date and Time Information:
    When the system processes temporal data for merlin reporting, then the date and time information is formatted according to report requirements.
  • Context - uscs processing time data is available:
    For Format USCS Processing Time:
    When the system processes uscs timing information for merlin reporting, then the uscs processing time is formatted according to report standards.
  • Context - system processing time data is available:
    For Format System Processing Time:
    When the system processes internal timing information for merlin reporting, then the system processing time is formatted according to report requirements.
  • Context - a disposition code is being processed for merlin reporting:
    For Apply Release Quantity Impact Logic:
    When the system evaluates the disposition code's impact on release quantities, then the system determines whether the disposition code affects release quantities based on business rules.
  • Context - a disposition code is being processed:
    For Does Disposition Code Affect Release Quantity?:
    When the system checks if the disposition code affects release quantities, then the system returns true if the disposition code affects release quantities, false otherwise.
  • Context - a disposition code affects release quantities:
    For Include Quantity Impact in Report:
    When the system formats the merlin report, then the quantity impact information is included in the report.
  • Context - a disposition code does not affect release quantities:
    For Exclude Quantity Impact from Report:
    When the system formats the merlin report, then the quantity impact information is excluded from the report.
  • Context - all individual report field components have been formatted:
    For Assemble Complete Merlin Report Fields:
    When the system assembles the complete merlin report, then all formatted fields are combined into a complete report structure.
  • Context - the complete merlin report fields have been assembled:
    For Return Formatted Report Fields:
    When the field management process completes, then the formatted report fields are returned to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record contains equipment information
GIVEN
A cargo record contains equipment information
Applied to: Format Equipment Information
WHEN
The system processes Merlin report field management
THEN
The equipment information is formatted and prepared for report inclusion
Context: A cargo record exists with car identification data
GIVEN
A cargo record exists with car identification data
Applied to: Extract Car ID from Cargo Record
WHEN
The system needs car ID information for Merlin reporting
THEN
The car ID is extracted from the cargo record and made available for formatting
Context: A cargo record contains waybill number information
GIVEN
A cargo record contains waybill number information
Applied to: Format Waybill Number
WHEN
The system processes waybill data for Merlin reporting
THEN
The waybill number is formatted according to report requirements
Context: A cargo record contains US-CCN information
GIVEN
A cargo record contains US-CCN information
Applied to: Format US-CCN Information
WHEN
The system processes CCN data for Merlin reporting
THEN
The US-CCN is formatted according to report standards
Context: A disposition code exists for the cargo
GIVEN
A disposition code exists for the cargo
Applied to: Format Disposition Code Information
WHEN
The system processes disposition code data for Merlin reporting
THEN
The disposition code information is formatted for report inclusion
Context: A disposition code identifier exists
GIVEN
A disposition code identifier exists
Applied to: Retrieve Disposition Code
WHEN
The system needs disposition code details for Merlin reporting
THEN
The disposition code is retrieved from the disposition code table
Context: A disposition code has been retrieved from the table
GIVEN
A disposition code has been retrieved from the table
Applied to: Get Disposition Description
WHEN
The system needs the description for Merlin reporting
THEN
The disposition code description is obtained from the disposition code table
Context: Date and time information is available for the cargo transaction
GIVEN
Date and time information is available for the cargo transaction
Applied to: Format Date and Time Information
WHEN
The system processes temporal data for Merlin reporting
THEN
The date and time information is formatted according to report requirements
Context: USCS processing time data is available
GIVEN
USCS processing time data is available
Applied to: Format USCS Processing Time
WHEN
The system processes USCS timing information for Merlin reporting
THEN
The USCS processing time is formatted according to report standards
Context: System processing time data is available
GIVEN
System processing time data is available
Applied to: Format System Processing Time
WHEN
The system processes internal timing information for Merlin reporting
THEN
The system processing time is formatted according to report requirements
Context: A disposition code is being processed for Merlin reporting
GIVEN
A disposition code is being processed for Merlin reporting
Applied to: Apply Release Quantity Impact Logic
WHEN
The system evaluates the disposition code's impact on release quantities
THEN
The system determines whether the disposition code affects release quantities based on business rules
Context: A disposition code is being processed
GIVEN
A disposition code is being processed
Applied to: Does Disposition Code Affect Release Quantity?
WHEN
The system checks if the disposition code affects release quantities
THEN
The system returns true if the disposition code affects release quantities, false otherwise
Context: A disposition code affects release quantities
GIVEN
A disposition code affects release quantities
Applied to: Include Quantity Impact in Report
WHEN
The system formats the Merlin report
THEN
The quantity impact information is included in the report
Context: A disposition code does not affect release quantities
GIVEN
A disposition code does not affect release quantities
Applied to: Exclude Quantity Impact from Report
WHEN
The system formats the Merlin report
THEN
The quantity impact information is excluded from the report
Context: All individual report field components have been formatted
GIVEN
All individual report field components have been formatted
Applied to: Assemble Complete Merlin Report Fields
WHEN
The system assembles the complete Merlin report
THEN
All formatted fields are combined into a complete report structure
Context: The complete Merlin report fields have been assembled
GIVEN
The complete Merlin report fields have been assembled
Applied to: Return Formatted Report Fields
WHEN
The field management process completes
THEN
The formatted report fields are returned to the calling process
R-GCX016E-cbl-02775 (+9) File: GCX016E.cbl Merlin Message Rerouting Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Message Rerouting':
  • Context - a merlin message is ready for distribution with a recipient configured in the ad segment:
    For Valid Recipient in AD Segment?:
    When the system checks the validity of the recipient in the ad segment, then the system determines if the recipient is valid and proceeds accordingly.
  • Context - a merlin message has a valid recipient configured in the ad segment:
    For Use Configured Recipient:
    When the recipient validation passes successfully, then the system uses the configured recipient for message delivery.
  • Context - a merlin message has an invalid recipient configured in the ad segment:
    For Detect Invalid Recipient:
    When the recipient validation fails, then the system detects the invalid recipient and generates an error notification.
  • Context - a merlin message has an invalid recipient and an error notification has been generated:
    For Set Default Recipient OM01247:
    When the system needs to assign a fallback recipient, then the system sets om01247 as the default recipient for message delivery.
  • Context - a merlin message has been assigned the default recipient om01247 due to invalid original recipient:
    For Route Message to Default Recipient:
    When the system initiates message routing, then the message is routed to the default recipient om01247.
  • Context - a merlin message has been routed to a recipient (either original or default):
    For Delivery Successful?:
    When the delivery attempt is completed, then the system determines if the delivery was successful or failed.
  • Context - a merlin message delivery attempt has been completed:
    For Message Delivered Successfully:
    When the delivery is determined to be successful, then the system marks the message as delivered successfully and completes the process.
  • Context - a merlin message delivery attempt has failed:
    For Handle Delivery Failure:
    When the delivery failure is detected, then the system initiates delivery failure handling procedures.
  • Context - a merlin message delivery has failed to the primary recipient:
    For Reroute to Alternative Default:
    When delivery failure handling is initiated, then the system reroutes the message to an alternative default recipient.
  • Context - a merlin message has been rerouted to an alternative default recipient:
    For Log Rerouting Action:
    When the rerouting action is completed, then the system logs the rerouting action for audit and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin message is ready for distribution with a recipient configured in the AD segment
GIVEN
A Merlin message is ready for distribution with a recipient configured in the AD segment
Applied to: Valid Recipient in AD Segment?
WHEN
The system checks the validity of the recipient in the AD segment
THEN
The system determines if the recipient is valid and proceeds accordingly
Context: A Merlin message has a valid recipient configured in the AD segment
GIVEN
A Merlin message has a valid recipient configured in the AD segment
Applied to: Use Configured Recipient
WHEN
The recipient validation passes successfully
THEN
The system uses the configured recipient for message delivery
Context: A Merlin message has an invalid recipient configured in the AD segment
GIVEN
A Merlin message has an invalid recipient configured in the AD segment
Applied to: Detect Invalid Recipient
WHEN
The recipient validation fails
THEN
The system detects the invalid recipient and generates an error notification
Context: A Merlin message has an invalid recipient and an error notification has been generated
GIVEN
A Merlin message has an invalid recipient and an error notification has been generated
Applied to: Set Default Recipient OM01247
WHEN
The system needs to assign a fallback recipient
THEN
The system sets OM01247 as the default recipient for message delivery
Context: A Merlin message has been assigned the default recipient OM01247 due to invalid original recipient
GIVEN
A Merlin message has been assigned the default recipient OM01247 due to invalid original recipient
Applied to: Route Message to Default Recipient
WHEN
The system initiates message routing
THEN
The message is routed to the default recipient OM01247
Context: A Merlin message has been routed to a recipient (either original or default)
GIVEN
A Merlin message has been routed to a recipient (either original or default)
Applied to: Delivery Successful?
WHEN
The delivery attempt is completed
THEN
The system determines if the delivery was successful or failed
Context: A Merlin message delivery attempt has been completed
GIVEN
A Merlin message delivery attempt has been completed
Applied to: Message Delivered Successfully
WHEN
The delivery is determined to be successful
THEN
The system marks the message as delivered successfully and completes the process
Context: A Merlin message delivery attempt has failed
GIVEN
A Merlin message delivery attempt has failed
Applied to: Handle Delivery Failure
WHEN
The delivery failure is detected
THEN
The system initiates delivery failure handling procedures
Context: A Merlin message delivery has failed to the primary recipient
GIVEN
A Merlin message delivery has failed to the primary recipient
Applied to: Reroute to Alternative Default
WHEN
Delivery failure handling is initiated
THEN
The system reroutes the message to an alternative default recipient
Context: A Merlin message has been rerouted to an alternative default recipient
GIVEN
A Merlin message has been rerouted to an alternative default recipient
Applied to: Log Rerouting Action
WHEN
The rerouting action is completed
THEN
The system logs the rerouting action for audit and tracking purposes
R-GCX016E-cbl-02785 (+17) File: GCX016E.cbl Message Array Initialization for Cargo Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Array Initialization for Cargo':
  • Context - a cargo processing request is received:
    For Initialize X4 Segment Array:
    When the system begins message array initialization for cargo, then the x4 segment array is initialized with proper structure and default values.
  • Context - an x4 segment array is initialized and cargo equipment data is available:
    For Set Equipment Information in X4:
    When the system processes equipment information for the cargo, then equipment identification details are populated into the x4 segment structure.
  • Context - an x4 segment is prepared and disposition code data is available:
    For Set Cargo Disposition Code in X4:
    When the system processes cargo disposition requirements, then the appropriate disposition code is assigned to the x4 segment.
  • Context - an x4 segment is being populated and current date/time is available:
    For Set Date/Time Information in X4:
    When the system processes timing information for the cargo transaction, then current date and time information is populated into the x4 segment.
  • Context - an x4 segment is being populated and location data is available:
    For Set Location Information in X4:
    When the system processes location requirements for the cargo, then location information is assigned to the x4 segment.
  • Context - cargo processing requires equipment data handling:
    For Initialize N7 Segment Array:
    When the system begins n7 segment initialization, then the n7 segment array is initialized with proper structure and default values.
  • Context - an n7 segment is initialized and equipment id data is available:
    For Set Equipment ID in N7:
    When the system processes equipment identification for the cargo, then equipment id is populated into the n7 segment.
  • Context - an n7 segment is being populated and equipment type data is available:
    For Set Equipment Type in N7:
    When the system processes equipment classification for the cargo, then equipment type is assigned to the n7 segment.
  • Context - an n7 segment is being populated and quantity data is available:
    For Set Quantity Information in N7:
    When the system processes cargo quantity information, then quantity information is populated into the n7 segment.
  • Context - an n7 segment is being populated and weight data is available:
    For Set Weight Information in N7:
    When the system processes cargo weight information, then weight information is assigned to the n7 segment.
  • Context - an n7 segment is being populated and waybill data is available:
    For Set Waybill Information in N7:
    When the system processes waybill information for the cargo, then waybill information is populated into the n7 segment.
  • Context - x4 and n7 segments have been populated with cargo and equipment data:
    For Validate Segment Data:
    When the system performs data validation on the segments, then all required data elements are verified for completeness and accuracy.
  • Context - segment data validation has been completed:
    For Validation Successful?:
    When the system evaluates validation results, then a determination is made whether validation was successful or failed based on business requirements.
  • Context - segment data validation has been successful:
    For Mark Segments Ready for Processing:
    When the system processes the validation success outcome, then x4 and n7 segments are marked as ready for cargo processing.
  • Context - message segments have been successfully initialized and marked ready:
    For Log Initialization Complete:
    When the system completes the initialization process, then initialization completion is logged for audit and tracking purposes.
  • Context - segment data validation has failed:
    For Generate Error Message:
    When the system processes the validation failure outcome, then an appropriate error message is generated describing the validation failure.
  • Context - an error message has been generated for validation failure:
    For Set Error Flag:
    When the system handles the error condition, then error flag is set to indicate validation failure and prevent further processing.
  • Context - message array initialization process has completed (either successfully or with errors):
    For Return to Cargo Processing:
    When the system finishes the initialization workflow, then control is returned to the main cargo processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing request is received
GIVEN
A cargo processing request is received
Applied to: Initialize X4 Segment Array
WHEN
The system begins message array initialization for cargo
THEN
The X4 segment array is initialized with proper structure and default values
Context: An X4 segment array is initialized and cargo equipment data is available
GIVEN
An X4 segment array is initialized and cargo equipment data is available
Applied to: Set Equipment Information in X4
WHEN
The system processes equipment information for the cargo
THEN
Equipment identification details are populated into the X4 segment structure
Context: An X4 segment is prepared and disposition code data is available
GIVEN
An X4 segment is prepared and disposition code data is available
Applied to: Set Cargo Disposition Code in X4
WHEN
The system processes cargo disposition requirements
THEN
The appropriate disposition code is assigned to the X4 segment
Context: An X4 segment is being populated and current date/time is available
GIVEN
An X4 segment is being populated and current date/time is available
Applied to: Set Date/Time Information in X4
WHEN
The system processes timing information for the cargo transaction
THEN
Current date and time information is populated into the X4 segment
Context: An X4 segment is being populated and location data is available
GIVEN
An X4 segment is being populated and location data is available
Applied to: Set Location Information in X4
WHEN
The system processes location requirements for the cargo
THEN
Location information is assigned to the X4 segment
Context: Cargo processing requires equipment data handling
GIVEN
Cargo processing requires equipment data handling
Applied to: Initialize N7 Segment Array
WHEN
The system begins N7 segment initialization
THEN
The N7 segment array is initialized with proper structure and default values
Context: An N7 segment is initialized and equipment ID data is available
GIVEN
An N7 segment is initialized and equipment ID data is available
Applied to: Set Equipment ID in N7
WHEN
The system processes equipment identification for the cargo
THEN
Equipment ID is populated into the N7 segment
Context: An N7 segment is being populated and equipment type data is available
GIVEN
An N7 segment is being populated and equipment type data is available
Applied to: Set Equipment Type in N7
WHEN
The system processes equipment classification for the cargo
THEN
Equipment type is assigned to the N7 segment
Context: An N7 segment is being populated and quantity data is available
GIVEN
An N7 segment is being populated and quantity data is available
Applied to: Set Quantity Information in N7
WHEN
The system processes cargo quantity information
THEN
Quantity information is populated into the N7 segment
Context: An N7 segment is being populated and weight data is available
GIVEN
An N7 segment is being populated and weight data is available
Applied to: Set Weight Information in N7
WHEN
The system processes cargo weight information
THEN
Weight information is assigned to the N7 segment
Context: An N7 segment is being populated and waybill data is available
GIVEN
An N7 segment is being populated and waybill data is available
Applied to: Set Waybill Information in N7
WHEN
The system processes waybill information for the cargo
THEN
Waybill information is populated into the N7 segment
Context: X4 and N7 segments have been populated with cargo and equipment data
GIVEN
X4 and N7 segments have been populated with cargo and equipment data
Applied to: Validate Segment Data
WHEN
The system performs data validation on the segments
THEN
All required data elements are verified for completeness and accuracy
Context: Segment data validation has been completed
GIVEN
Segment data validation has been completed
Applied to: Validation Successful?
WHEN
The system evaluates validation results
THEN
A determination is made whether validation was successful or failed based on business requirements
Context: Segment data validation has been successful
GIVEN
Segment data validation has been successful
Applied to: Mark Segments Ready for Processing
WHEN
The system processes the validation success outcome
THEN
X4 and N7 segments are marked as ready for cargo processing
Context: Message segments have been successfully initialized and marked ready
GIVEN
Message segments have been successfully initialized and marked ready
Applied to: Log Initialization Complete
WHEN
The system completes the initialization process
THEN
Initialization completion is logged for audit and tracking purposes
Context: Segment data validation has failed
GIVEN
Segment data validation has failed
Applied to: Generate Error Message
WHEN
The system processes the validation failure outcome
THEN
An appropriate error message is generated describing the validation failure
Context: An error message has been generated for validation failure
GIVEN
An error message has been generated for validation failure
Applied to: Set Error Flag
WHEN
The system handles the error condition
THEN
Error flag is set to indicate validation failure and prevent further processing
Context: Message array initialization process has completed (either successfully or with errors)
GIVEN
Message array initialization process has completed (either successfully or with errors)
Applied to: Return to Cargo Processing
WHEN
The system finishes the initialization workflow
THEN
Control is returned to the main cargo processing workflow
R-GCX016E-cbl-02803 (+19) File: GCX016E.cbl Message Array Initialization for Trains Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Array Initialization for Trains':
  • Context - a train processing request is received:
    For Initialize Train Message Arrays:
    When the system begins message array initialization, then message arrays are initialized and prepared for m10 and v9 segment storage.
  • Context - train message arrays are initialized:
    For Create M10 Vessel Segment:
    When the system creates m10 vessel segment, then m10 segment structure is created and ready to receive vessel data.
  • Context - m10 vessel segment is created and train id is available:
    For Set Vessel Name from Train ID:
    When the system sets vessel name from train id, then vessel name field in m10 segment is populated with train identifier.
  • Context - vessel name is set in m10 segment:
    For Set Transport Method Code:
    When the system sets transport method code, then transport method code is assigned to indicate rail transportation mode.
  • Context - transport method code is set in m10 segment:
    For Set Country Code:
    When the system sets country code, then country code is assigned to identify train's operational country.
  • Context - country code is set in m10 segment:
    For Set SCAC Code:
    When the system sets scac code, then scac code is assigned to identify the carrier responsible for the train.
  • Context - m10 segment is completed with all required data:
    For Create V9 Event Segment:
    When the system creates v9 event segment, then v9 segment structure is created and ready to receive event data.
  • Context - v9 event segment is created and disposition code is available:
    For Set Event Code from Disposition:
    When the system sets event code from disposition, then event code field in v9 segment is populated based on the disposition code.
  • Context - event code is set in v9 segment:
    For Set Event Date and Time:
    When the system sets event date and time, then event date and time fields are populated with current timestamp.
  • Context - event date and time are set in v9 segment:
    For Set Location Information:
    When the system sets location information, then location fields are populated with appropriate location data for the event.
  • Context - location information is set in v9 segment:
    For Set Event Description:
    When the system sets event description, then event description field is populated with explanatory text for the event.
  • Context - m10 and v9 segments are populated with data:
    For Validate Segment Data:
    When the system validates segment data, then all required fields are verified for completeness and accuracy.
  • Context - segment data validation is completed:
    For Validation Successful?:
    When validation is successful, then system proceeds to store segments in message arrays.
    For Validation Successful?:
    When validation fails, then system proceeds to log validation error and set error flag.
  • Context - m10 segment validation is successful:
    For Store M10 Segment in Array:
    When the system stores m10 segment in array, then m10 segment is placed in the appropriate position in the message array.
  • Context - v9 segment validation is successful and m10 segment is stored:
    For Store V9 Segment in Array:
    When the system stores v9 segment in array, then v9 segment is placed in the appropriate position in the message array.
  • Context - m10 and v9 segments are stored in arrays:
    For Set Array Counters:
    When the system sets array counters, then array counters are updated to reflect the current number of stored segments.
  • Context - array counters are set and segments are properly stored:
    For Mark Arrays Ready for Processing:
    When the system marks arrays ready for processing, then arrays are flagged as ready and available for subsequent train processing operations.
  • Context - segment data validation fails:
    For Log Validation Error:
    When the system logs validation error, then error details are recorded for troubleshooting and audit purposes.
  • Context - validation error is logged:
    For Set Error Flag:
    When the system sets error flag, then error flag is activated to prevent further processing with invalid data.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request is received
GIVEN
A train processing request is received
Applied to: Initialize Train Message Arrays
WHEN
The system begins message array initialization
THEN
Message arrays are initialized and prepared for M10 and V9 segment storage
Context: Train message arrays are initialized
GIVEN
Train message arrays are initialized
Applied to: Create M10 Vessel Segment
WHEN
The system creates M10 vessel segment
THEN
M10 segment structure is created and ready to receive vessel data
Context: M10 vessel segment is created and train ID is available
GIVEN
M10 vessel segment is created and train ID is available
Applied to: Set Vessel Name from Train ID
WHEN
The system sets vessel name from train ID
THEN
Vessel name field in M10 segment is populated with train identifier
Context: Vessel name is set in M10 segment
GIVEN
Vessel name is set in M10 segment
Applied to: Set Transport Method Code
WHEN
The system sets transport method code
THEN
Transport method code is assigned to indicate rail transportation mode
Context: Transport method code is set in M10 segment
GIVEN
Transport method code is set in M10 segment
Applied to: Set Country Code
WHEN
The system sets country code
THEN
Country code is assigned to identify train's operational country
Context: Country code is set in M10 segment
GIVEN
Country code is set in M10 segment
Applied to: Set SCAC Code
WHEN
The system sets SCAC code
THEN
SCAC code is assigned to identify the carrier responsible for the train
Context: M10 segment is completed with all required data
GIVEN
M10 segment is completed with all required data
Applied to: Create V9 Event Segment
WHEN
The system creates V9 event segment
THEN
V9 segment structure is created and ready to receive event data
Context: V9 event segment is created and disposition code is available
GIVEN
V9 event segment is created and disposition code is available
Applied to: Set Event Code from Disposition
WHEN
The system sets event code from disposition
THEN
Event code field in V9 segment is populated based on the disposition code
Context: Event code is set in V9 segment
GIVEN
Event code is set in V9 segment
Applied to: Set Event Date and Time
WHEN
The system sets event date and time
THEN
Event date and time fields are populated with current timestamp
Context: Event date and time are set in V9 segment
GIVEN
Event date and time are set in V9 segment
Applied to: Set Location Information
WHEN
The system sets location information
THEN
Location fields are populated with appropriate location data for the event
Context: Location information is set in V9 segment
GIVEN
Location information is set in V9 segment
Applied to: Set Event Description
WHEN
The system sets event description
THEN
Event description field is populated with explanatory text for the event
Context: M10 and V9 segments are populated with data
GIVEN
M10 and V9 segments are populated with data
Applied to: Validate Segment Data
WHEN
The system validates segment data
THEN
All required fields are verified for completeness and accuracy
Context: Segment data validation is completed
GIVEN
Segment data validation is completed
Applied to: Validation Successful?
WHEN
Validation is successful
THEN
System proceeds to store segments in message arrays
Applied to: Validation Successful?
WHEN
Validation fails
THEN
System proceeds to log validation error and set error flag
Context: M10 segment validation is successful
GIVEN
M10 segment validation is successful
Applied to: Store M10 Segment in Array
WHEN
The system stores M10 segment in array
THEN
M10 segment is placed in the appropriate position in the message array
Context: V9 segment validation is successful and M10 segment is stored
GIVEN
V9 segment validation is successful and M10 segment is stored
Applied to: Store V9 Segment in Array
WHEN
The system stores V9 segment in array
THEN
V9 segment is placed in the appropriate position in the message array
Context: M10 and V9 segments are stored in arrays
GIVEN
M10 and V9 segments are stored in arrays
Applied to: Set Array Counters
WHEN
The system sets array counters
THEN
Array counters are updated to reflect the current number of stored segments
Context: Array counters are set and segments are properly stored
GIVEN
Array counters are set and segments are properly stored
Applied to: Mark Arrays Ready for Processing
WHEN
The system marks arrays ready for processing
THEN
Arrays are flagged as ready and available for subsequent train processing operations
Context: Segment data validation fails
GIVEN
Segment data validation fails
Applied to: Log Validation Error
WHEN
The system logs validation error
THEN
Error details are recorded for troubleshooting and audit purposes
Context: Validation error is logged
GIVEN
Validation error is logged
Applied to: Set Error Flag
WHEN
The system sets error flag
THEN
Error flag is activated to prevent further processing with invalid data
R-GCX016E-cbl-02823 (+14) File: GCX016E.cbl Merlin Report Field Formatting Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Report Field Formatting':
  • Context - a cargo record with equipment information exists:
    For Format Equipment Information:
    When the system processes merlin report field formatting, then the equipment information is formatted and prepared for report inclusion.
  • Context - a cargo record contains car id information:
    For Format Car ID:
    When the car id formatting process is executed, then the car id is formatted with appropriate spacing and alignment for report display.
  • Context - a cargo record contains waybill number information:
    For Format Waybill Number:
    When the waybill number formatting process is executed, then the waybill number is formatted for consistent display in the report.
  • Context - a cargo record contains us-ccn information:
    For Format US-CCN:
    When the us-ccn formatting process is executed, then the us-ccn is formatted with proper structure for report display.
  • Context - a disposition code exists for the cargo:
    For Format Disposition Code Information:
    When the disposition code information formatting is processed, then the disposition code and its description are retrieved and formatted for report inclusion.
  • Context - a cargo is being processed with a disposition code:
    For Retrieve Disposition Code:
    When the disposition code retrieval is executed, then the current disposition code is retrieved from the processing context.
  • Context - a disposition code has been identified:
    For Retrieve Disposition Description:
    When the disposition description lookup is performed, then the corresponding description is retrieved from the disposition code table.
  • Context - processing timestamps are available for the cargo:
    For Format Date/Time Information:
    When the date/time formatting process is executed, then the date and time information is formatted for consistent display in the report.
  • Context - uscs processing time information is available:
    For Format USCS Processing Time:
    When the uscs processing time formatting is executed, then the uscs processing time is formatted for report display.
  • Context - system processing time information is available:
    For Format System Processing Time:
    When the system processing time formatting is executed, then the system processing time is formatted for report display.
  • Context - a disposition code is being processed for a cargo:
    For Apply Release Quantity Impact Logic:
    When the release quantity impact logic is applied, then the system determines if the disposition code affects release quantities.
  • Context - a disposition code is being evaluated for quantity impact:
    For Should Disposition Code Affect Release Quantities?:
    When the system checks if the disposition code affects release quantities, then the system returns true if the disposition code should affect quantities, false otherwise.
  • Context - a disposition code affects release quantities:
    For Include Quantity Impact in Report:
    When the quantity impact inclusion process is executed, then the quantity impact information is included in the merlin report fields.
  • Context - a disposition code does not affect release quantities:
    For Exclude Quantity Impact from Report:
    When the quantity impact exclusion process is executed, then the quantity impact information is excluded from the merlin report fields.
  • Context - all individual report components have been formatted:
    For Assemble Complete Merlin Report Fields:
    When the complete report field assembly is executed, then all components are assembled into complete merlin report fields ready for transmission.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with equipment information exists
GIVEN
A cargo record with equipment information exists
Applied to: Format Equipment Information
WHEN
The system processes Merlin report field formatting
THEN
The equipment information is formatted and prepared for report inclusion
Context: A cargo record contains car ID information
GIVEN
A cargo record contains car ID information
Applied to: Format Car ID
WHEN
The car ID formatting process is executed
THEN
The car ID is formatted with appropriate spacing and alignment for report display
Context: A cargo record contains waybill number information
GIVEN
A cargo record contains waybill number information
Applied to: Format Waybill Number
WHEN
The waybill number formatting process is executed
THEN
The waybill number is formatted for consistent display in the report
Context: A cargo record contains US-CCN information
GIVEN
A cargo record contains US-CCN information
Applied to: Format US-CCN
WHEN
The US-CCN formatting process is executed
THEN
The US-CCN is formatted with proper structure for report display
Context: A disposition code exists for the cargo
GIVEN
A disposition code exists for the cargo
Applied to: Format Disposition Code Information
WHEN
The disposition code information formatting is processed
THEN
The disposition code and its description are retrieved and formatted for report inclusion
Context: A cargo is being processed with a disposition code
GIVEN
A cargo is being processed with a disposition code
Applied to: Retrieve Disposition Code
WHEN
The disposition code retrieval is executed
THEN
The current disposition code is retrieved from the processing context
Context: A disposition code has been identified
GIVEN
A disposition code has been identified
Applied to: Retrieve Disposition Description
WHEN
The disposition description lookup is performed
THEN
The corresponding description is retrieved from the disposition code table
Context: Processing timestamps are available for the cargo
GIVEN
Processing timestamps are available for the cargo
Applied to: Format Date/Time Information
WHEN
The date/time formatting process is executed
THEN
The date and time information is formatted for consistent display in the report
Context: USCS processing time information is available
GIVEN
USCS processing time information is available
Applied to: Format USCS Processing Time
WHEN
The USCS processing time formatting is executed
THEN
The USCS processing time is formatted for report display
Context: System processing time information is available
GIVEN
System processing time information is available
Applied to: Format System Processing Time
WHEN
The system processing time formatting is executed
THEN
The system processing time is formatted for report display
Context: A disposition code is being processed for a cargo
GIVEN
A disposition code is being processed for a cargo
Applied to: Apply Release Quantity Impact Logic
WHEN
The release quantity impact logic is applied
THEN
The system determines if the disposition code affects release quantities
Context: A disposition code is being evaluated for quantity impact
GIVEN
A disposition code is being evaluated for quantity impact
Applied to: Should Disposition Code Affect Release Quantities?
WHEN
The system checks if the disposition code affects release quantities
THEN
The system returns true if the disposition code should affect quantities, false otherwise
Context: A disposition code affects release quantities
GIVEN
A disposition code affects release quantities
Applied to: Include Quantity Impact in Report
WHEN
The quantity impact inclusion process is executed
THEN
The quantity impact information is included in the Merlin report fields
Context: A disposition code does not affect release quantities
GIVEN
A disposition code does not affect release quantities
Applied to: Exclude Quantity Impact from Report
WHEN
The quantity impact exclusion process is executed
THEN
The quantity impact information is excluded from the Merlin report fields
Context: All individual report components have been formatted
GIVEN
All individual report components have been formatted
Applied to: Assemble Complete Merlin Report Fields
WHEN
The complete report field assembly is executed
THEN
All components are assembled into complete Merlin report fields ready for transmission
R-GCX016E-cbl-02838 (+13) File: GCX016E.cbl Shipment Minimum Information Creation Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Shipment Minimum Information Creation':
  • Context - a shipment processing request is initiated:
    For Validate Shiproot Record Exists:
    When the system attempts to validate shiproot record existence, then the system should verify the shiproot record exists in the shipment database and proceed only if found.
  • Context - shiproot record validation has been performed:
    For Shiproot Found?:
    When the system evaluates the shiproot record existence result, then if shiproot is found, proceed to retrieve in-bond type code; if not found, terminate the shipment minimum creation process.
  • Context - a valid shiproot record exists and cargo records are available:
    For Retrieve In-Bond Type Code from Cargo:
    When the system retrieves in-bond type code from the cargo record, then the in-bond type code should be extracted from the cargo record and made available for u1 segment population.
  • Context - in-bond type code has been successfully retrieved from cargo records:
    For Extract Entry Number Information:
    When the system extracts entry number information from cargo records, then entry number information should be extracted and prepared for u1 segment population.
  • Context - entry number information has been extracted and x4 segments are available:
    For Get Location Identifiers from X4 Segments:
    When the system processes x4 segments to get location identifiers, then location identifiers should be extracted from x4 segments and prepared for shipment minimum segment creation.
  • Context - location identifiers have been extracted from x4 segments:
    For Process Destination Station Information:
    When the system processes destination station information, then destination station information should be processed and prepared for u1 segment creation.
  • Context - destination station information has been processed:
    For Process Key Station Information:
    When the system processes key station information, then key station information should be processed and prepared for u1 segment creation.
  • Context - all required station information has been processed:
    For Create U1 Shipment Minimum Segment:
    When the system creates a u1 shipment minimum segment, then a u1 segment structure should be created and ready for data population.
  • Context - u1 segment has been created and in-bond type code is available:
    For Populate In-Bond Type Code in U1:
    When the system populates in-bond type code in the u1 segment, then the in-bond type code should be correctly populated in the appropriate field of the u1 segment.
  • Context - in-bond type code has been populated in u1 segment and entry number information is available:
    For Populate Entry Number in U1:
    When the system populates entry number in the u1 segment, then entry number information should be correctly populated in the appropriate field of the u1 segment.
  • Context - entry number has been populated in u1 segment and location identifiers are available:
    For Populate Location Identifiers in U1:
    When the system populates location identifiers in the u1 segment, then location identifiers should be correctly populated in the appropriate fields of the u1 segment.
  • Context - all data fields have been populated in the u1 segment:
    For Validate U1 Segment Data:
    When the system validates u1 segment data completeness and accuracy, then the u1 segment should pass validation checks for required fields and data integrity before storage.
  • Context - u1 segment data has been validated successfully:
    For Store U1 Segment for EDI Processing:
    When the system stores the u1 segment for edi processing, then the u1 segment should be stored in the shipment minimum segments database and made available for edi transmission.
  • Context - u1 segment has been successfully stored for edi processing:
    For Log Shipment Creation Action:
    When the system logs the shipment creation action, then a log entry should be created documenting the successful creation of shipment minimum information with relevant identifiers and timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment processing request is initiated
GIVEN
A shipment processing request is initiated
Applied to: Validate Shiproot Record Exists
WHEN
The system attempts to validate shiproot record existence
THEN
The system should verify the shiproot record exists in the shipment database and proceed only if found
Context: Shiproot record validation has been performed
GIVEN
Shiproot record validation has been performed
Applied to: Shiproot Found?
WHEN
The system evaluates the shiproot record existence result
THEN
If shiproot is found, proceed to retrieve in-bond type code; if not found, terminate the shipment minimum creation process
Context: A valid shiproot record exists and cargo records are available
GIVEN
A valid shiproot record exists and cargo records are available
Applied to: Retrieve In-Bond Type Code from Cargo
WHEN
The system retrieves in-bond type code from the cargo record
THEN
The in-bond type code should be extracted from the cargo record and made available for U1 segment population
Context: In-bond type code has been successfully retrieved from cargo records
GIVEN
In-bond type code has been successfully retrieved from cargo records
Applied to: Extract Entry Number Information
WHEN
The system extracts entry number information from cargo records
THEN
Entry number information should be extracted and prepared for U1 segment population
Context: Entry number information has been extracted and X4 segments are available
GIVEN
Entry number information has been extracted and X4 segments are available
Applied to: Get Location Identifiers from X4 Segments
WHEN
The system processes X4 segments to get location identifiers
THEN
Location identifiers should be extracted from X4 segments and prepared for shipment minimum segment creation
Context: Location identifiers have been extracted from X4 segments
GIVEN
Location identifiers have been extracted from X4 segments
Applied to: Process Destination Station Information
WHEN
The system processes destination station information
THEN
Destination station information should be processed and prepared for U1 segment creation
Context: Destination station information has been processed
GIVEN
Destination station information has been processed
Applied to: Process Key Station Information
WHEN
The system processes key station information
THEN
Key station information should be processed and prepared for U1 segment creation
Context: All required station information has been processed
GIVEN
All required station information has been processed
Applied to: Create U1 Shipment Minimum Segment
WHEN
The system creates a U1 shipment minimum segment
THEN
A U1 segment structure should be created and ready for data population
Context: U1 segment has been created and in-bond type code is available
GIVEN
U1 segment has been created and in-bond type code is available
Applied to: Populate In-Bond Type Code in U1
WHEN
The system populates in-bond type code in the U1 segment
THEN
The in-bond type code should be correctly populated in the appropriate field of the U1 segment
Context: In-bond type code has been populated in U1 segment and entry number information is available
GIVEN
In-bond type code has been populated in U1 segment and entry number information is available
Applied to: Populate Entry Number in U1
WHEN
The system populates entry number in the U1 segment
THEN
Entry number information should be correctly populated in the appropriate field of the U1 segment
Context: Entry number has been populated in U1 segment and location identifiers are available
GIVEN
Entry number has been populated in U1 segment and location identifiers are available
Applied to: Populate Location Identifiers in U1
WHEN
The system populates location identifiers in the U1 segment
THEN
Location identifiers should be correctly populated in the appropriate fields of the U1 segment
Context: All data fields have been populated in the U1 segment
GIVEN
All data fields have been populated in the U1 segment
Applied to: Validate U1 Segment Data
WHEN
The system validates U1 segment data completeness and accuracy
THEN
The U1 segment should pass validation checks for required fields and data integrity before storage
Context: U1 segment data has been validated successfully
GIVEN
U1 segment data has been validated successfully
Applied to: Store U1 Segment for EDI Processing
WHEN
The system stores the U1 segment for EDI processing
THEN
The U1 segment should be stored in the shipment minimum segments database and made available for EDI transmission
Context: U1 segment has been successfully stored for EDI processing
GIVEN
U1 segment has been successfully stored for EDI processing
Applied to: Log Shipment Creation Action
WHEN
The system logs the shipment creation action
THEN
A log entry should be created documenting the successful creation of shipment minimum information with relevant identifiers and timestamp
R-GCX016E-cbl-02852 (+13) File: GCX016E.cbl Canadian Manifest Search and Validation Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Manifest Search and Validation':
  • Context - a us cargo record exists with equipment information:
    For Extract Equipment ID from US Cargo:
    When the system processes the cargo for canadian manifest matching, then the equipment id is extracted and formatted for canadian system lookup.
  • Context - an equipment id has been extracted from us cargo:
    For Search Canadian Cargo Database:
    When the system searches the canadian cargo database, then all canadian cargo records with matching equipment id are retrieved.
  • Context - a search has been performed on the canadian cargo database:
    For Canadian Cargo Found?:
    When the system evaluates the search results, then the system determines if canadian cargo was found or not found.
  • Context - canadian cargo records have been found for the equipment id:
    For Validate Canadian Cargo Status:
    When the system validates the cargo status, then the cargo status is checked to ensure it is not deleted or marked as new bond created.
  • Context - canadian cargo status has been retrieved and validated:
    For Status Valid?:
    When the system determines status validity, then the status is classified as valid, deleted, or new bond created based on cargo state.
  • Context - valid canadian cargo has been found with matching equipment id:
    For Match Equipment IDs Between Systems:
    When the system matches equipment ids between systems, then equipment id correspondence is established between us and canadian cargo records.
  • Context - equipment ids have been successfully matched between systems:
    For Create Cross-Border Tracking Link:
    When the system creates cross-border tracking links, then a tracking relationship is established linking us and canadian cargo records.
  • Context - cross-border tracking links have been created successfully:
    For Log Canadian Manifest Match:
    When the system logs the manifest match, then match results are recorded with cargo details and timestamp information.
  • Context - canadian cargo records have been found but have invalid deleted status:
    For Exclude Deleted Cargo Records:
    When the system processes cargo status validation, then deleted cargo records are excluded from further cross-border processing.
  • Context - canadian cargo records have been found but have invalid new bond created status:
    For Exclude New Bond Created Records:
    When the system processes cargo status validation, then new bond created cargo records are excluded from further cross-border processing.
  • Context - valid canadian cargo has been matched and cross-border links created:
    For Update Cargo with Canadian Reference:
    When the system updates us cargo with canadian reference, then us cargo record is updated with canadian manifest reference information.
  • Context - us cargo has been updated with canadian reference information:
    For Generate Cross-Border Audit Trail:
    When the system generates cross-border audit trail, then audit records are created documenting the cross-border manifest matching process.
  • Context - no canadian cargo records were found matching the equipment id:
    For No Canadian Manifest Found:
    When the system processes the no match scenario, then the system proceeds to log search results without creating cross-border links.
  • Context - canadian manifest search has been completed with either match or no match results:
    For Log Search Results:
    When the system logs search results, then search outcome is recorded with equipment id and result status information.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo record exists with equipment information
GIVEN
A US cargo record exists with equipment information
Applied to: Extract Equipment ID from US Cargo
WHEN
The system processes the cargo for Canadian manifest matching
THEN
The equipment ID is extracted and formatted for Canadian system lookup
Context: An equipment ID has been extracted from US cargo
GIVEN
An equipment ID has been extracted from US cargo
Applied to: Search Canadian Cargo Database
WHEN
The system searches the Canadian cargo database
THEN
All Canadian cargo records with matching equipment ID are retrieved
Context: A search has been performed on the Canadian cargo database
GIVEN
A search has been performed on the Canadian cargo database
Applied to: Canadian Cargo Found?
WHEN
The system evaluates the search results
THEN
The system determines if Canadian cargo was found or not found
Context: Canadian cargo records have been found for the equipment ID
GIVEN
Canadian cargo records have been found for the equipment ID
Applied to: Validate Canadian Cargo Status
WHEN
The system validates the cargo status
THEN
The cargo status is checked to ensure it is not deleted or marked as new bond created
Context: Canadian cargo status has been retrieved and validated
GIVEN
Canadian cargo status has been retrieved and validated
Applied to: Status Valid?
WHEN
The system determines status validity
THEN
The status is classified as valid, deleted, or new bond created based on cargo state
Context: Valid Canadian cargo has been found with matching equipment ID
GIVEN
Valid Canadian cargo has been found with matching equipment ID
Applied to: Match Equipment IDs Between Systems
WHEN
The system matches equipment IDs between systems
THEN
Equipment ID correspondence is established between US and Canadian cargo records
Context: Equipment IDs have been successfully matched between systems
GIVEN
Equipment IDs have been successfully matched between systems
Applied to: Create Cross-Border Tracking Link
WHEN
The system creates cross-border tracking links
THEN
A tracking relationship is established linking US and Canadian cargo records
Context: Cross-border tracking links have been created successfully
GIVEN
Cross-border tracking links have been created successfully
Applied to: Log Canadian Manifest Match
WHEN
The system logs the manifest match
THEN
Match results are recorded with cargo details and timestamp information
Context: Canadian cargo records have been found but have invalid deleted status
GIVEN
Canadian cargo records have been found but have invalid deleted status
Applied to: Exclude Deleted Cargo Records
WHEN
The system processes cargo status validation
THEN
Deleted cargo records are excluded from further cross-border processing
Context: Canadian cargo records have been found but have invalid new bond created status
GIVEN
Canadian cargo records have been found but have invalid new bond created status
Applied to: Exclude New Bond Created Records
WHEN
The system processes cargo status validation
THEN
New bond created cargo records are excluded from further cross-border processing
Context: Valid Canadian cargo has been matched and cross-border links created
GIVEN
Valid Canadian cargo has been matched and cross-border links created
Applied to: Update Cargo with Canadian Reference
WHEN
The system updates US cargo with Canadian reference
THEN
US cargo record is updated with Canadian manifest reference information
Context: US cargo has been updated with Canadian reference information
GIVEN
US cargo has been updated with Canadian reference information
Applied to: Generate Cross-Border Audit Trail
WHEN
The system generates cross-border audit trail
THEN
Audit records are created documenting the cross-border manifest matching process
Context: No Canadian cargo records were found matching the equipment ID
GIVEN
No Canadian cargo records were found matching the equipment ID
Applied to: No Canadian Manifest Found
WHEN
The system processes the no match scenario
THEN
The system proceeds to log search results without creating cross-border links
Context: Canadian manifest search has been completed with either match or no match results
GIVEN
Canadian manifest search has been completed with either match or no match results
Applied to: Log Search Results
WHEN
The system logs search results
THEN
Search outcome is recorded with equipment ID and result status information
R-GCX016E-cbl-02866 (+7) File: GCX016E.cbl Message Loading Logic Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Loading Logic':
  • Context - the system needs to process export messages:
    For Execute MQGET to Retrieve Message from GC350.EXP.INPUT Queue:
    When a message retrieval request is initiated, then the system executes mqget operation to retrieve the next available message from gc350.exp.input queue.
  • Context - an mqget operation has been executed:
    For Evaluate MQ Completion Code:
    When the mq completion code is evaluated, then if completion code indicates success, proceed to message validation; if no message available, set message not available flag; if other error, handle error condition.
  • Context - a message has been successfully retrieved from the queue:
    For Check Message Backout Count:
    When the message backout count is evaluated, then if backout count is zero, mark as good message; if backout count is greater than zero, mark as skip message due to high backout count.
  • Context - a message has been retrieved successfully and backout count is zero:
    For Set Good Message Flag:
    When message classification is performed, then set good message flag to indicate the message is ready for business processing.
  • Context - a message has been retrieved successfully but backout count is greater than zero:
    For Set Skip Message Flag - High Backout Count:
    When message classification is performed, then set skip message flag to prevent processing of potentially problematic message.
  • Context - an mqget operation is executed:
    For Set Message Not Available Flag:
    When the completion code indicates no message is available (reason code 2033), then set message not available flag to indicate queue is empty.
    For Handle MQ Error Condition:
    When the completion code indicates an error other than 'no message available', then handle the mq error condition appropriately based on the specific error type.
  • Context - a message has been classified as good, skip, or not available:
    For Message Classification:
    When processing decision is made, then if good message, proceed to business processing; if skip message, continue to next message; if no message available, end message loading process.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process export messages
GIVEN
The system needs to process export messages
Applied to: Execute MQGET to Retrieve Message from GC350.EXP.INPUT Queue
WHEN
A message retrieval request is initiated
THEN
The system executes MQGET operation to retrieve the next available message from GC350.EXP.INPUT queue
Context: An MQGET operation has been executed
GIVEN
An MQGET operation has been executed
Applied to: Evaluate MQ Completion Code
WHEN
The MQ completion code is evaluated
THEN
If completion code indicates success, proceed to message validation; if no message available, set message not available flag; if other error, handle error condition
Context: A message has been successfully retrieved from the queue
GIVEN
A message has been successfully retrieved from the queue
Applied to: Check Message Backout Count
WHEN
The message backout count is evaluated
THEN
If backout count is zero, mark as good message; if backout count is greater than zero, mark as skip message due to high backout count
Context: A message has been retrieved successfully and backout count is zero
GIVEN
A message has been retrieved successfully and backout count is zero
Applied to: Set Good Message Flag
WHEN
Message classification is performed
THEN
Set good message flag to indicate the message is ready for business processing
Context: A message has been retrieved successfully but backout count is greater than zero
GIVEN
A message has been retrieved successfully but backout count is greater than zero
Applied to: Set Skip Message Flag - High Backout Count
WHEN
Message classification is performed
THEN
Set skip message flag to prevent processing of potentially problematic message
Context: An MQGET operation is executed
GIVEN
An MQGET operation is executed
Applied to: Set Message Not Available Flag
WHEN
The completion code indicates no message is available (reason code 2033)
THEN
Set message not available flag to indicate queue is empty
Applied to: Handle MQ Error Condition
WHEN
The completion code indicates an error other than 'no message available'
THEN
Handle the MQ error condition appropriately based on the specific error type
Context: A message has been classified as good, skip, or not available
GIVEN
A message has been classified as good, skip, or not available
Applied to: Message Classification
WHEN
Processing decision is made
THEN
If good message, proceed to business processing; if skip message, continue to next message; if no message available, end message loading process
R-GCX016E-cbl-02874 (+10) File: GCX016E.cbl Train Lookup and Validation Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Lookup and Validation':
  • Context - an m10 segment contains a vessel name field:
    For Extract Train ID from Vessel Name:
    When the system processes the m10 segment, then the train id is extracted from the vessel name for database lookup.
  • Context - a train id has been extracted from the vessel name:
    For Call GCCUTRIO Database Lookup:
    When the system initiates train lookup, then gccutrio database lookup is called to search for train information.
  • Context - a database lookup has been performed for a train id:
    For Train Found in System?:
    When the lookup results are evaluated, then if train is found, retrieve train information; if not found, generate train not found error.
  • Context - a train exists in the database:
    For Retrieve Train Information:
    When train lookup is successful, then complete train information is retrieved from the database.
  • Context - train information has been retrieved from the database:
    For Is CPRS Train?:
    When the system evaluates train type, then if train is cprs type, apply cprs special processing; otherwise proceed with standard processing.
  • Context - a train has been identified as cprs type:
    For Apply CPRS Special Processing:
    When cprs special processing is triggered, then cprs-specific business rules and processing logic are applied to the train.
  • Context - train information has been successfully retrieved and processed:
    For Set Train Found Flag:
    When train processing is completed, then train found flag is set to indicate successful train identification.
  • Context - a train id does not exist in the database:
    For Generate Train Not Found Error:
    When train lookup fails, then a train not found error is generated for error handling.
  • Context - a train not found error has been generated:
    For Create Merlin Error Message:
    When error message creation is triggered, then a merlin error message is created to notify relevant parties of the train lookup failure.
  • Context - a train not found error has occurred and merlin message has been created:
    For Set Train Error Flag:
    When error flag setting is processed, then train error flag is set to indicate train lookup failure.
  • Context - train lookup processing has completed (either successfully or with error):
    For Continue Processing:
    When train lookup phase is finished, then system continues with the next phase of message processing.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 segment contains a vessel name field
GIVEN
An M10 segment contains a vessel name field
Applied to: Extract Train ID from Vessel Name
WHEN
The system processes the M10 segment
THEN
The train ID is extracted from the vessel name for database lookup
Context: A train ID has been extracted from the vessel name
GIVEN
A train ID has been extracted from the vessel name
Applied to: Call GCCUTRIO Database Lookup
WHEN
The system initiates train lookup
THEN
GCCUTRIO database lookup is called to search for train information
Context: A database lookup has been performed for a train ID
GIVEN
A database lookup has been performed for a train ID
Applied to: Train Found in System?
WHEN
The lookup results are evaluated
THEN
If train is found, retrieve train information; if not found, generate train not found error
Context: A train exists in the database
GIVEN
A train exists in the database
Applied to: Retrieve Train Information
WHEN
Train lookup is successful
THEN
Complete train information is retrieved from the database
Context: Train information has been retrieved from the database
GIVEN
Train information has been retrieved from the database
Applied to: Is CPRS Train?
WHEN
The system evaluates train type
THEN
If train is CPRS type, apply CPRS special processing; otherwise proceed with standard processing
Context: A train has been identified as CPRS type
GIVEN
A train has been identified as CPRS type
Applied to: Apply CPRS Special Processing
WHEN
CPRS special processing is triggered
THEN
CPRS-specific business rules and processing logic are applied to the train
Context: Train information has been successfully retrieved and processed
GIVEN
Train information has been successfully retrieved and processed
Applied to: Set Train Found Flag
WHEN
Train processing is completed
THEN
Train found flag is set to indicate successful train identification
Context: A train ID does not exist in the database
GIVEN
A train ID does not exist in the database
Applied to: Generate Train Not Found Error
WHEN
Train lookup fails
THEN
A train not found error is generated for error handling
Context: A train not found error has been generated
GIVEN
A train not found error has been generated
Applied to: Create Merlin Error Message
WHEN
Error message creation is triggered
THEN
A Merlin error message is created to notify relevant parties of the train lookup failure
Context: A train not found error has occurred and Merlin message has been created
GIVEN
A train not found error has occurred and Merlin message has been created
Applied to: Set Train Error Flag
WHEN
Error flag setting is processed
THEN
Train error flag is set to indicate train lookup failure
Context: Train lookup processing has completed (either successfully or with error)
GIVEN
Train lookup processing has completed (either successfully or with error)
Applied to: Continue Processing
WHEN
Train lookup phase is finished
THEN
System continues with the next phase of message processing
R-GCX016E-cbl-02885 (+13) File: GCX016E.cbl Bond Number Database Search Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Number Database Search':
  • Context - an incoming message contains bond number information:
    For Extract Bond Number from Message:
    When the system processes the message to extract the bond number, then the bond number is extracted and validated for proper format.
  • Context - a bond number has been extracted from the message:
    For Bond Number Valid?:
    When the system validates the bond number format, then the bond number is accepted if it meets format requirements, otherwise processing is terminated with error.
  • Context - a valid bond number has been extracted and validated:
    For Set Bond Number as Search Key:
    When the system prepares to search for cargo records, then the bond number is set as the primary search key for database operations.
  • Context - a bond number search key has been established:
    For Call Database Lookup - GCCUSIO2:
    When the system needs to retrieve cargo records for the bond, then the gccusio2 database service is called to perform the lookup operation.
  • Context - database lookup has been initiated for a specific bond number:
    For Retrieve First Cargo Record:
    When the system processes the database response, then the first cargo record associated with the bond number is retrieved for processing.
  • Context - a database lookup has been performed for a bond number:
    For Record Found?:
    When the system checks the lookup results, then processing continues if records are found, otherwise a bond not found error is generated.
  • Context - a cargo record has been retrieved from the database:
    For Validate Status Code:
    When the system examines the cargo record status code, then the record is validated to ensure it has an acceptable status for bond processing.
  • Context - a cargo record status code has been validated:
    For Status Code Valid?:
    When the system evaluates the status code against business rules, then the record is accepted for processing if status is valid, otherwise it is skipped.
  • Context - a cargo record has passed status code validation:
    For Store Cargo Record:
    When the system processes the valid record, then the cargo record is stored in the processing collection for bond operations.
  • Context - at least one cargo record has been found for a bond number:
    For Get Next Cargo Record with Same Bond:
    When the system searches for additional records with the same bond, then all remaining cargo records associated with the bond number are retrieved sequentially.
  • Context - the system is retrieving cargo records for a bond number:
    For More Records?:
    When each record retrieval operation completes, then processing continues if more records exist, otherwise the bond collection is considered complete.
  • Context - all cargo records for a bond number have been collected and validated:
    For Process All Bond Cargo Records:
    When the system completes the bond record collection process, then all valid cargo records in the bond collection are processed according to business rules.
  • Context - a bond number search has been performed:
    For Generate Bond Not Found Error:
    When no valid cargo records are found for the bond number, then a bond not found error is generated and appropriate error handling is initiated.
  • Context - a cargo record has been retrieved but has an invalid status code:
    For Skip Invalid Status Record:
    When the system evaluates the record for processing eligibility, then the record is skipped and the system continues to search for additional valid records.
👨‍💻 Technical ACs (Gherkin)
Context: An incoming message contains bond number information
GIVEN
An incoming message contains bond number information
Applied to: Extract Bond Number from Message
WHEN
The system processes the message to extract the bond number
THEN
The bond number is extracted and validated for proper format
Context: A bond number has been extracted from the message
GIVEN
A bond number has been extracted from the message
Applied to: Bond Number Valid?
WHEN
The system validates the bond number format
THEN
The bond number is accepted if it meets format requirements, otherwise processing is terminated with error
Context: A valid bond number has been extracted and validated
GIVEN
A valid bond number has been extracted and validated
Applied to: Set Bond Number as Search Key
WHEN
The system prepares to search for cargo records
THEN
The bond number is set as the primary search key for database operations
Context: A bond number search key has been established
GIVEN
A bond number search key has been established
Applied to: Call Database Lookup - GCCUSIO2
WHEN
The system needs to retrieve cargo records for the bond
THEN
The GCCUSIO2 database service is called to perform the lookup operation
Context: Database lookup has been initiated for a specific bond number
GIVEN
Database lookup has been initiated for a specific bond number
Applied to: Retrieve First Cargo Record
WHEN
The system processes the database response
THEN
The first cargo record associated with the bond number is retrieved for processing
Context: A database lookup has been performed for a bond number
GIVEN
A database lookup has been performed for a bond number
Applied to: Record Found?
WHEN
The system checks the lookup results
THEN
Processing continues if records are found, otherwise a bond not found error is generated
Context: A cargo record has been retrieved from the database
GIVEN
A cargo record has been retrieved from the database
Applied to: Validate Status Code
WHEN
The system examines the cargo record status code
THEN
The record is validated to ensure it has an acceptable status for bond processing
Context: A cargo record status code has been validated
GIVEN
A cargo record status code has been validated
Applied to: Status Code Valid?
WHEN
The system evaluates the status code against business rules
THEN
The record is accepted for processing if status is valid, otherwise it is skipped
Context: A cargo record has passed status code validation
GIVEN
A cargo record has passed status code validation
Applied to: Store Cargo Record
WHEN
The system processes the valid record
THEN
The cargo record is stored in the processing collection for bond operations
Context: At least one cargo record has been found for a bond number
GIVEN
At least one cargo record has been found for a bond number
Applied to: Get Next Cargo Record with Same Bond
WHEN
The system searches for additional records with the same bond
THEN
All remaining cargo records associated with the bond number are retrieved sequentially
Context: The system is retrieving cargo records for a bond number
GIVEN
The system is retrieving cargo records for a bond number
Applied to: More Records?
WHEN
Each record retrieval operation completes
THEN
Processing continues if more records exist, otherwise the bond collection is considered complete
Context: All cargo records for a bond number have been collected and validated
GIVEN
All cargo records for a bond number have been collected and validated
Applied to: Process All Bond Cargo Records
WHEN
The system completes the bond record collection process
THEN
All valid cargo records in the bond collection are processed according to business rules
Context: A bond number search has been performed
GIVEN
A bond number search has been performed
Applied to: Generate Bond Not Found Error
WHEN
No valid cargo records are found for the bond number
THEN
A bond not found error is generated and appropriate error handling is initiated
Context: A cargo record has been retrieved but has an invalid status code
GIVEN
A cargo record has been retrieved but has an invalid status code
Applied to: Skip Invalid Status Record
WHEN
The system evaluates the record for processing eligibility
THEN
The record is skipped and the system continues to search for additional valid records
R-GCX016E-cbl-02899 (+16) File: GCX016E.cbl Car/Waybill Database Search Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car/Waybill Database Search':
  • Context - an x4 segment contains equipment and waybill information:
    For Extract Car ID and Waybill from X4 Segment:
    When the system processes the x4 segment for car/waybill search, then car id and waybill number are extracted and prepared for database search.
  • Context - a raw car id has been extracted from the x4 segment:
    For Format Car ID Using Standard Rules:
    When the system prepares the car id for database search, then car id is formatted according to standard business formatting rules for consistent lookup.
  • Context - a formatted car id and waybill number are available for search:
    For Search Cargo Database by Car/Waybill Index:
    When the system searches the cargo database, then database is searched using car/waybill index to locate existing cargo records.
  • Context - a database search has been performed using car id and waybill:
    For Cargo Found?:
    When the system evaluates the search results, then system determines if cargo records exist and routes processing accordingly.
  • Context - cargo records exist for the car id and waybill combination:
    For Retrieve First Cargo Record:
    When the system needs to process the cargo, then the first cargo record is retrieved and prepared for processing.
  • Context - a first cargo record has been retrieved for a car id and waybill:
    For Check for Additional Records with Same Car/Waybill:
    When the system checks for additional records, then all cargo records with the same car id and waybill are identified for processing.
  • Context - no existing cargo records are found for the car id and waybill:
    For CPRS Traffic?:
    When the system evaluates the traffic type, then system determines if this is cprs traffic requiring special processing rules.
  • Context - traffic has been identified as cprs type:
    For Handle CPRS Special Processing:
    When the system processes cprs cargo, then special cprs business rules are applied including carrier validation and record creation logic.
  • Context - cprs traffic is being processed:
    For Check SCAC Unknown Scenarios:
    When the system validates the carrier information, then scac is validated against carrier database and unknown scenarios are handled appropriately.
  • Context - cprs cargo requires key renumbering due to scac validation results:
    For Perform US-CCN Key Renumbering:
    When the system processes the ccn key, then us-ccn key is renumbered according to cprs business rules to ensure unique identification.
  • Context - no existing cargo records were found and traffic type has been determined:
    For Create New Record?:
    When the system evaluates record creation requirements, then system determines if a new cargo record should be created based on business rules.
  • Context - a new record is required for cprs traffic:
    For Create New CPRS Cargo Record:
    When the system creates the cargo record, then new cprs cargo record is created with cprs-specific business attributes and processing rules.
  • Context - a new record is required for non-cprs foreign traffic:
    For Create New Foreign Cargo Record:
    When the system creates the cargo record, then new foreign cargo record is created with standard business attributes and processing rules.
  • Context - a new cargo record has been created:
    For Initialize New Record with X4/N7 Data:
    When the system initializes the record with segment data, then record is populated with disposition codes from x4 segment and equipment data from n7 segment.
  • Context - a new cargo record has been created and initialized with segment data:
    For Insert New Record into Database:
    When the system saves the record, then new cargo record is inserted into the cargo database and becomes available for processing.
  • Context - a new cargo record has been successfully inserted into the database:
    For Log Cargo Creation Action:
    When the system completes the creation process, then cargo creation action is logged with relevant business details for audit and tracking purposes.
  • Context - a cargo record has been found or created through the search process:
    For Return Cargo Record for Processing:
    When the system completes the car/waybill database search, then cargo record is returned to the calling process for disposition code processing and status updates.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment contains equipment and waybill information
GIVEN
An X4 segment contains equipment and waybill information
Applied to: Extract Car ID and Waybill from X4 Segment
WHEN
The system processes the X4 segment for car/waybill search
THEN
Car ID and waybill number are extracted and prepared for database search
Context: A raw car ID has been extracted from the X4 segment
GIVEN
A raw car ID has been extracted from the X4 segment
Applied to: Format Car ID Using Standard Rules
WHEN
The system prepares the car ID for database search
THEN
Car ID is formatted according to standard business formatting rules for consistent lookup
Context: A formatted car ID and waybill number are available for search
GIVEN
A formatted car ID and waybill number are available for search
Applied to: Search Cargo Database by Car/Waybill Index
WHEN
The system searches the cargo database
THEN
Database is searched using car/waybill index to locate existing cargo records
Context: A database search has been performed using car ID and waybill
GIVEN
A database search has been performed using car ID and waybill
Applied to: Cargo Found?
WHEN
The system evaluates the search results
THEN
System determines if cargo records exist and routes processing accordingly
Context: Cargo records exist for the car ID and waybill combination
GIVEN
Cargo records exist for the car ID and waybill combination
Applied to: Retrieve First Cargo Record
WHEN
The system needs to process the cargo
THEN
The first cargo record is retrieved and prepared for processing
Context: A first cargo record has been retrieved for a car ID and waybill
GIVEN
A first cargo record has been retrieved for a car ID and waybill
Applied to: Check for Additional Records with Same Car/Waybill
WHEN
The system checks for additional records
THEN
All cargo records with the same car ID and waybill are identified for processing
Context: No existing cargo records are found for the car ID and waybill
GIVEN
No existing cargo records are found for the car ID and waybill
Applied to: CPRS Traffic?
WHEN
The system evaluates the traffic type
THEN
System determines if this is CPRS traffic requiring special processing rules
Context: Traffic has been identified as CPRS type
GIVEN
Traffic has been identified as CPRS type
Applied to: Handle CPRS Special Processing
WHEN
The system processes CPRS cargo
THEN
Special CPRS business rules are applied including carrier validation and record creation logic
Context: CPRS traffic is being processed
GIVEN
CPRS traffic is being processed
Applied to: Check SCAC Unknown Scenarios
WHEN
The system validates the carrier information
THEN
SCAC is validated against carrier database and unknown scenarios are handled appropriately
Context: CPRS cargo requires key renumbering due to SCAC validation results
GIVEN
CPRS cargo requires key renumbering due to SCAC validation results
Applied to: Perform US-CCN Key Renumbering
WHEN
The system processes the CCN key
THEN
US-CCN key is renumbered according to CPRS business rules to ensure unique identification
Context: No existing cargo records were found and traffic type has been determined
GIVEN
No existing cargo records were found and traffic type has been determined
Applied to: Create New Record?
WHEN
The system evaluates record creation requirements
THEN
System determines if a new cargo record should be created based on business rules
Context: A new record is required for CPRS traffic
GIVEN
A new record is required for CPRS traffic
Applied to: Create New CPRS Cargo Record
WHEN
The system creates the cargo record
THEN
New CPRS cargo record is created with CPRS-specific business attributes and processing rules
Context: A new record is required for non-CPRS foreign traffic
GIVEN
A new record is required for non-CPRS foreign traffic
Applied to: Create New Foreign Cargo Record
WHEN
The system creates the cargo record
THEN
New foreign cargo record is created with standard business attributes and processing rules
Context: A new cargo record has been created
GIVEN
A new cargo record has been created
Applied to: Initialize New Record with X4/N7 Data
WHEN
The system initializes the record with segment data
THEN
Record is populated with disposition codes from X4 segment and equipment data from N7 segment
Context: A new cargo record has been created and initialized with segment data
GIVEN
A new cargo record has been created and initialized with segment data
Applied to: Insert New Record into Database
WHEN
The system saves the record
THEN
New cargo record is inserted into the cargo database and becomes available for processing
Context: A new cargo record has been successfully inserted into the database
GIVEN
A new cargo record has been successfully inserted into the database
Applied to: Log Cargo Creation Action
WHEN
The system completes the creation process
THEN
Cargo creation action is logged with relevant business details for audit and tracking purposes
Context: A cargo record has been found or created through the search process
GIVEN
A cargo record has been found or created through the search process
Applied to: Return Cargo Record for Processing
WHEN
The system completes the car/waybill database search
THEN
Cargo record is returned to the calling process for disposition code processing and status updates
R-GCX016E-cbl-02916 (+5) File: GCX016E.cbl Disposition Code Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Processing':
  • Context - a disposition code is received for processing:
    For 43: Disposition Code Table Lookup:
    When the system looks up the disposition code in the gcstbrt disposition code table, then if the code is not found in the table, generate a merlin error message and stop processing for this code.
  • Context - a valid disposition code needs to be added to the cargo status array:
    For 44: Duplicate Disposition Code Detection:
    When the system searches the existing s09a status array for the same disposition code with matching entry number and quantity, then if an exact duplicate is found, skip processing and do not add the code again.
  • Context - a disposition code has counterpart codes defined in the disposition code table:
    For 45: Counterpart Disposition Code Removal:
    When the system processes the new disposition code for addition to the status array, then remove all existing counterpart disposition codes from the status array before adding the new code.
  • Context - a validated disposition code needs to be added to the cargo status array:
    For 157: Status Array Management and Processing:
    When the system processes the code insertion into the s09a status array, then insert the new disposition code with its associated data (entry number, quantity, date/time) into the next available array position.
  • Context - disposition codes have been added or removed from the status array:
    For 157: Status Array Management and Processing:
    When the system completes the array modification operations, then reorganize the status array sequence numbers to maintain consecutive numbering and update the total count of active status codes.
  • Context - the status array has been modified with additions or removals of disposition codes:
    For 157: Status Array Management and Processing:
    When the system completes all array operations, then update the status array counter to reflect the current number of active disposition codes in the array.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received for processing
GIVEN
A disposition code is received for processing
Applied to: 43: Disposition Code Table Lookup
WHEN
The system looks up the disposition code in the GCSTBRT disposition code table
THEN
If the code is not found in the table, generate a Merlin error message and stop processing for this code
Context: A valid disposition code needs to be added to the cargo status array
GIVEN
A valid disposition code needs to be added to the cargo status array
Applied to: 44: Duplicate Disposition Code Detection
WHEN
The system searches the existing S09A status array for the same disposition code with matching entry number and quantity
THEN
If an exact duplicate is found, skip processing and do not add the code again
Context: A disposition code has counterpart codes defined in the disposition code table
GIVEN
A disposition code has counterpart codes defined in the disposition code table
Applied to: 45: Counterpart Disposition Code Removal
WHEN
The system processes the new disposition code for addition to the status array
THEN
Remove all existing counterpart disposition codes from the status array before adding the new code
Context: A validated disposition code needs to be added to the cargo status array
GIVEN
A validated disposition code needs to be added to the cargo status array
Applied to: 157: Status Array Management and Processing
WHEN
The system processes the code insertion into the S09A status array
THEN
Insert the new disposition code with its associated data (entry number, quantity, date/time) into the next available array position
Context: Disposition codes have been added or removed from the status array
GIVEN
Disposition codes have been added or removed from the status array
Applied to: 157: Status Array Management and Processing
WHEN
The system completes the array modification operations
THEN
Reorganize the status array sequence numbers to maintain consecutive numbering and update the total count of active status codes
Context: The status array has been modified with additions or removals of disposition codes
GIVEN
The status array has been modified with additions or removals of disposition codes
Applied to: 157: Status Array Management and Processing
WHEN
The system completes all array operations
THEN
Update the status array counter to reflect the current number of active disposition codes in the array
R-GCX016E-cbl-02922 (+31) File: GCX016E.cbl Cargo Status Evaluation Merged 32 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Evaluation':
  • Context - a cargo record exists in the system:
    For Retrieve Current Cargo Status:
    When the system needs to evaluate cargo status, then the current cargo status, hold flags, release quantities, and processing flags are retrieved from the cargo record.
  • Context - a cargo has s09a status arrays with disposition codes:
    For Analyze S09A Status Arrays:
    When the system evaluates cargo status, then all disposition codes in the status arrays are analyzed for hold conditions, release conditions, and quantity impacts.
  • Context - a cargo with status arrays containing disposition codes:
    For Hold Conditions Present?:
    When the system checks for hold conditions, then the system identifies if border holds, destination holds, fda holds, or piece count holds are active.
  • Context - a cargo with disposition codes in status arrays:
    For Check Border Hold Status:
    When the system evaluates border hold conditions, then the system determines if cargo is held at border based on specific disposition codes and location information.
  • Context - a cargo with disposition codes and destination information:
    For Check Destination Hold Status:
    When the system evaluates destination hold conditions, then the system determines if cargo is held at destination based on disposition codes and destination location.
  • Context - a cargo with disposition codes that may include fda-related holds:
    For Check FDA Hold Status:
    When the system evaluates fda hold conditions, then the system determines if cargo requires fda clearance and sets holdfda status if applicable.
  • Context - a cargo with quantity information and release history:
    For Check Piece Count Hold Status:
    When the system evaluates piece count hold conditions, then the system determines if cargo has piece count holds based on quantity discrepancies or partial release conditions.
  • Context - a cargo with disposition codes that may include manual release codes:
    For Check Manual Release Status:
    When the system checks for manual release authorization, then the system identifies if manual release (mrl) disposition codes are present and takes precedence over other status conditions.
  • Context - a cargo with analyzed hold and release conditions:
    For Release Conditions Met?:
    When the system evaluates overall release eligibility, then the system determines if cargo can be released based on absence of active holds and presence of valid release authorization.
  • Context - a cargo with disposition codes containing quantity information:
    For Calculate Release Quantities:
    When the system calculates release quantities, then the system computes total cargo quantity, currently released quantity, remaining hold quantity, and validates quantity consistency across all disposition codes.
  • Context - a cargo with analyzed status and release conditions:
    For Evaluate Proceed Conditions:
    When the system evaluates proceed eligibility, then the system determines if cargo can proceed based on release status, hold conditions, and processing requirements.
  • Context - a cargo with entry type information:
    For In-Bond Entry?:
    When the system checks for in-bond entry classification, then the system identifies if cargo has entry types 61, 62, 63, or 69 indicating in-bond processing requirements.
  • Context - a cargo identified as in-bond entry type:
    For Process In-Bond Logic:
    When the system processes in-bond logic, then the system sets in-bond information, updates broker details, handles bond numbers, and applies canadian border crossing vessel swap rules if applicable.
  • Context - a cargo requiring in-bond processing:
    For Set Master In-Bond Flags:
    When the system sets master in-bond flags, then the system establishes master-level in-bond indicators that control downstream processing and reporting.
  • Context - a cargo with disposition codes and location information:
    For Arrival Status Required?:
    When the system evaluates arrival status requirements, then the system determines if cargo needs arrival status based on disposition codes indicating arrival events (pod, aad) or arrival-related processing.
  • Context - a cargo requiring arrival status with location information:
    For Validate Arrival Location:
    When the system validates arrival location, then the system confirms the arrival location is valid and matches expected destination or border crossing points.
  • Context - a cargo with validated arrival location:
    For Set Arrival Status Flags:
    When the system sets arrival status flags, then the system sets arrival status flags, updates arrival dates, and establishes arrival processing indicators.
  • Context - a cargo with disposition codes and processing history:
    For Export Status Required?:
    When the system evaluates export status requirements, then the system determines if cargo needs export status based on disposition codes or processing flags indicating export operations.
  • Context - a cargo requiring export status with location information:
    For Validate Export Location:
    When the system validates export location, then the system confirms the export location is valid and appropriate for export processing.
  • Context - a cargo with validated export location:
    For Set Export Status Flags:
    When the system sets export status flags, then the system sets export status flags, clears destination index, and establishes export processing indicators.
  • Context - a cargo with analyzed hold conditions, release conditions, and processing flags:
    For Determine Final Cargo Status:
    When the system determines final cargo status, then the system applies status hierarchy: manual release → released, fda hold → holdfda, ptt conditions → ptt/ptt-ex, hold combinations → various hold statuses, release with quantity → relsd/holdpcs, export/arrival → respective status, default → ack/proceed.
  • Context - a cargo with newly determined status and previous status information:
    For Status Changed?:
    When the system checks for status changes, then the system compares the new status with the previous status to determine if a change has occurred.
  • Context - a cargo with changed status:
    For Preserve Previous Status for Audit:
    When the system preserves previous status for audit, then the system saves the previous status information for audit trail and compliance tracking.
  • Context - a cargo with determined final status:
    For Update Cargo Status Flags:
    When the system updates cargo status flags, then the system updates all cargo status flags, processing indicators, and related status information in the cargo record.
  • Context - a cargo with arrival date or initial processing date:
    For Calculate Cargo Age:
    When the system calculates cargo age, then the system computes the number of days since cargo arrival or initial processing for aging analysis and reporting.
  • Context - a cargo with updated status information:
    For Generate Status Notifications:
    When the system generates status notifications, then the system creates merlin messages, email notifications, or system alerts based on the status change and notification requirements.
  • Context - a cargo with analyzed hold conditions:
    For All Holds Released?:
    When the system checks if all holds are released, then the system determines if no active hold conditions remain (no border holds, destination holds, fda holds, or piece count holds).
  • Context - a cargo with calculated release quantities and remaining holds:
    For Partial Release?:
    When the system checks for partial release status, then the system determines if some cargo quantity has been released while other quantities remain held.
  • Context - a cargo with active hold conditions and no partial releases:
    For Full Hold Status?:
    When the system checks for full hold status, then the system determines if the entire cargo quantity is held with no released portions.
  • Context - a cargo with all holds released and no remaining hold conditions:
    For Set RELEASED Status:
    When the system sets released status, then the system assigns released status and updates all related release flags and processing indicators.
  • Context - a cargo with partial quantity released and remaining holds:
    For Set PARTIAL RELEASE Status:
    When the system sets partial release status, then the system assigns holdpcs or similar partial release status indicating mixed release/hold condition.
  • Context - a cargo with active hold conditions and no releases:
    For Set HOLD Status:
    When the system sets hold status, then the system assigns appropriate hold status (hold, hold-b for border, hold-d for destination, holdfda for fda) based on the type and location of holds.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Retrieve Current Cargo Status
WHEN
The system needs to evaluate cargo status
THEN
The current cargo status, hold flags, release quantities, and processing flags are retrieved from the cargo record
Context: A cargo has S09A status arrays with disposition codes
GIVEN
A cargo has S09A status arrays with disposition codes
Applied to: Analyze S09A Status Arrays
WHEN
The system evaluates cargo status
THEN
All disposition codes in the status arrays are analyzed for hold conditions, release conditions, and quantity impacts
Context: A cargo with status arrays containing disposition codes
GIVEN
A cargo with status arrays containing disposition codes
Applied to: Hold Conditions Present?
WHEN
The system checks for hold conditions
THEN
The system identifies if border holds, destination holds, FDA holds, or piece count holds are active
Context: A cargo with disposition codes in status arrays
GIVEN
A cargo with disposition codes in status arrays
Applied to: Check Border Hold Status
WHEN
The system evaluates border hold conditions
THEN
The system determines if cargo is held at border based on specific disposition codes and location information
Context: A cargo with disposition codes and destination information
GIVEN
A cargo with disposition codes and destination information
Applied to: Check Destination Hold Status
WHEN
The system evaluates destination hold conditions
THEN
The system determines if cargo is held at destination based on disposition codes and destination location
Context: A cargo with disposition codes that may include FDA-related holds
GIVEN
A cargo with disposition codes that may include FDA-related holds
Applied to: Check FDA Hold Status
WHEN
The system evaluates FDA hold conditions
THEN
The system determines if cargo requires FDA clearance and sets HOLDFDA status if applicable
Context: A cargo with quantity information and release history
GIVEN
A cargo with quantity information and release history
Applied to: Check Piece Count Hold Status
WHEN
The system evaluates piece count hold conditions
THEN
The system determines if cargo has piece count holds based on quantity discrepancies or partial release conditions
Context: A cargo with disposition codes that may include manual release codes
GIVEN
A cargo with disposition codes that may include manual release codes
Applied to: Check Manual Release Status
WHEN
The system checks for manual release authorization
THEN
The system identifies if manual release (MRL) disposition codes are present and takes precedence over other status conditions
Context: A cargo with analyzed hold and release conditions
GIVEN
A cargo with analyzed hold and release conditions
Applied to: Release Conditions Met?
WHEN
The system evaluates overall release eligibility
THEN
The system determines if cargo can be released based on absence of active holds and presence of valid release authorization
Context: A cargo with disposition codes containing quantity information
GIVEN
A cargo with disposition codes containing quantity information
Applied to: Calculate Release Quantities
WHEN
The system calculates release quantities
THEN
The system computes total cargo quantity, currently released quantity, remaining hold quantity, and validates quantity consistency across all disposition codes
Context: A cargo with analyzed status and release conditions
GIVEN
A cargo with analyzed status and release conditions
Applied to: Evaluate Proceed Conditions
WHEN
The system evaluates proceed eligibility
THEN
The system determines if cargo can proceed based on release status, hold conditions, and processing requirements
Context: A cargo with entry type information
GIVEN
A cargo with entry type information
Applied to: In-Bond Entry?
WHEN
The system checks for in-bond entry classification
THEN
The system identifies if cargo has entry types 61, 62, 63, or 69 indicating in-bond processing requirements
Context: A cargo identified as in-bond entry type
GIVEN
A cargo identified as in-bond entry type
Applied to: Process In-Bond Logic
WHEN
The system processes in-bond logic
THEN
The system sets in-bond information, updates broker details, handles bond numbers, and applies Canadian border crossing vessel swap rules if applicable
Context: A cargo requiring in-bond processing
GIVEN
A cargo requiring in-bond processing
Applied to: Set Master In-Bond Flags
WHEN
The system sets master in-bond flags
THEN
The system establishes master-level in-bond indicators that control downstream processing and reporting
Context: A cargo with disposition codes and location information
GIVEN
A cargo with disposition codes and location information
Applied to: Arrival Status Required?
WHEN
The system evaluates arrival status requirements
THEN
The system determines if cargo needs arrival status based on disposition codes indicating arrival events (POD, AAD) or arrival-related processing
Context: A cargo requiring arrival status with location information
GIVEN
A cargo requiring arrival status with location information
Applied to: Validate Arrival Location
WHEN
The system validates arrival location
THEN
The system confirms the arrival location is valid and matches expected destination or border crossing points
Context: A cargo with validated arrival location
GIVEN
A cargo with validated arrival location
Applied to: Set Arrival Status Flags
WHEN
The system sets arrival status flags
THEN
The system sets arrival status flags, updates arrival dates, and establishes arrival processing indicators
Context: A cargo with disposition codes and processing history
GIVEN
A cargo with disposition codes and processing history
Applied to: Export Status Required?
WHEN
The system evaluates export status requirements
THEN
The system determines if cargo needs export status based on disposition codes or processing flags indicating export operations
Context: A cargo requiring export status with location information
GIVEN
A cargo requiring export status with location information
Applied to: Validate Export Location
WHEN
The system validates export location
THEN
The system confirms the export location is valid and appropriate for export processing
Context: A cargo with validated export location
GIVEN
A cargo with validated export location
Applied to: Set Export Status Flags
WHEN
The system sets export status flags
THEN
The system sets export status flags, clears destination index, and establishes export processing indicators
Context: A cargo with analyzed hold conditions, release conditions, and processing flags
GIVEN
A cargo with analyzed hold conditions, release conditions, and processing flags
Applied to: Determine Final Cargo Status
WHEN
The system determines final cargo status
THEN
The system applies status hierarchy: Manual Release → Released, FDA Hold → HOLDFDA, PTT conditions → PTT/PTT-EX, Hold combinations → various hold statuses, Release with quantity → RELSD/HOLDPCS, Export/Arrival → respective status, Default → ACK/PROCEED
Context: A cargo with newly determined status and previous status information
GIVEN
A cargo with newly determined status and previous status information
Applied to: Status Changed?
WHEN
The system checks for status changes
THEN
The system compares the new status with the previous status to determine if a change has occurred
Context: A cargo with changed status
GIVEN
A cargo with changed status
Applied to: Preserve Previous Status for Audit
WHEN
The system preserves previous status for audit
THEN
The system saves the previous status information for audit trail and compliance tracking
Context: A cargo with determined final status
GIVEN
A cargo with determined final status
Applied to: Update Cargo Status Flags
WHEN
The system updates cargo status flags
THEN
The system updates all cargo status flags, processing indicators, and related status information in the cargo record
Context: A cargo with arrival date or initial processing date
GIVEN
A cargo with arrival date or initial processing date
Applied to: Calculate Cargo Age
WHEN
The system calculates cargo age
THEN
The system computes the number of days since cargo arrival or initial processing for aging analysis and reporting
Context: A cargo with updated status information
GIVEN
A cargo with updated status information
Applied to: Generate Status Notifications
WHEN
The system generates status notifications
THEN
The system creates Merlin messages, email notifications, or system alerts based on the status change and notification requirements
Context: A cargo with analyzed hold conditions
GIVEN
A cargo with analyzed hold conditions
Applied to: All Holds Released?
WHEN
The system checks if all holds are released
THEN
The system determines if no active hold conditions remain (no border holds, destination holds, FDA holds, or piece count holds)
Context: A cargo with calculated release quantities and remaining holds
GIVEN
A cargo with calculated release quantities and remaining holds
Applied to: Partial Release?
WHEN
The system checks for partial release status
THEN
The system determines if some cargo quantity has been released while other quantities remain held
Context: A cargo with active hold conditions and no partial releases
GIVEN
A cargo with active hold conditions and no partial releases
Applied to: Full Hold Status?
WHEN
The system checks for full hold status
THEN
The system determines if the entire cargo quantity is held with no released portions
Context: A cargo with all holds released and no remaining hold conditions
GIVEN
A cargo with all holds released and no remaining hold conditions
Applied to: Set RELEASED Status
WHEN
The system sets released status
THEN
The system assigns RELEASED status and updates all related release flags and processing indicators
Context: A cargo with partial quantity released and remaining holds
GIVEN
A cargo with partial quantity released and remaining holds
Applied to: Set PARTIAL RELEASE Status
WHEN
The system sets partial release status
THEN
The system assigns HOLDPCS or similar partial release status indicating mixed release/hold condition
Context: A cargo with active hold conditions and no releases
GIVEN
A cargo with active hold conditions and no releases
Applied to: Set HOLD Status
WHEN
The system sets hold status
THEN
The system assigns appropriate hold status (HOLD, HOLD-B for border, HOLD-D for destination, HOLDFDA for FDA) based on the type and location of holds
R-GCX016E-cbl-02954 (+12) File: GCX016E.cbl Status Array Population Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Population':
  • Context - a cargo record exists in the system:
    For Retrieve S09 Status Segments from Database:
    When the system needs to process cargo status information, then the system retrieves all s09 status segments from the gcsuss09 database for the cargo.
  • Context - the system has attempted to retrieve s09 status segments from database:
    For Database Segments Found?:
    When the database query completes, then the system determines if any status segments were found and branches processing accordingly.
  • Context - status segments exist in the database for the cargo:
    For Initialize S09A Status Array:
    When the system begins status array population, then the system initializes the s09a status array structure to receive the segment data.
  • Context - no status segments exist in the database for the cargo:
    For Initialize Empty Status Array:
    When the system needs to create a status array, then the system initializes an empty s09a status array structure.
  • Context - a status segment exists in the database:
    For Convert Database Segment to Array Format:
    When the system processes the segment for array population, then the system converts the database segment format into the s09a array entry format.
  • Context - status segments are being processed from the database:
    For Track Maximum Sequence Number:
    When each segment is converted to array format, then the system tracks and updates the maximum sequence number encountered.
  • Context - a database status segment contains a disposition code:
    For Populate Array Entry with Disposition Code:
    When the segment is being converted to array format, then the system populates the disposition code field in the corresponding array entry.
  • Context - a database status segment contains date and time information:
    For Populate Array Entry with Date/Time:
    When the segment is being converted to array format, then the system populates the date and time fields in the corresponding array entry.
  • Context - a database status segment contains location code information:
    For Populate Array Entry with Location Code:
    When the segment is being converted to array format, then the system populates the location code field in the corresponding array entry.
  • Context - a database status segment contains quantity information:
    For Populate Array Entry with Quantity Information:
    When the segment is being converted to array format, then the system populates the quantity fields in the corresponding array entry.
  • Context - the system has processed one or more status segments:
    For More Database Segments?:
    When a segment conversion is complete, then the system checks if additional segments remain in the database for processing.
  • Context - a status segment has been successfully converted and stored in the array:
    For Increment Array Index:
    When additional segments remain to be processed, then the system increments the array index to the next available position.
  • Context - all status segments have been processed from the database:
    For Update Maximum Sequences Fetched Counter:
    When the segment processing loop completes, then the system updates the maximum sequences fetched counter with the total number of segments processed.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Retrieve S09 Status Segments from Database
WHEN
The system needs to process cargo status information
THEN
The system retrieves all S09 status segments from the GCSUSS09 database for the cargo
Context: The system has attempted to retrieve S09 status segments from database
GIVEN
The system has attempted to retrieve S09 status segments from database
Applied to: Database Segments Found?
WHEN
The database query completes
THEN
The system determines if any status segments were found and branches processing accordingly
Context: Status segments exist in the database for the cargo
GIVEN
Status segments exist in the database for the cargo
Applied to: Initialize S09A Status Array
WHEN
The system begins status array population
THEN
The system initializes the S09A status array structure to receive the segment data
Context: No status segments exist in the database for the cargo
GIVEN
No status segments exist in the database for the cargo
Applied to: Initialize Empty Status Array
WHEN
The system needs to create a status array
THEN
The system initializes an empty S09A status array structure
Context: A status segment exists in the database
GIVEN
A status segment exists in the database
Applied to: Convert Database Segment to Array Format
WHEN
The system processes the segment for array population
THEN
The system converts the database segment format into the S09A array entry format
Context: Status segments are being processed from the database
GIVEN
Status segments are being processed from the database
Applied to: Track Maximum Sequence Number
WHEN
Each segment is converted to array format
THEN
The system tracks and updates the maximum sequence number encountered
Context: A database status segment contains a disposition code
GIVEN
A database status segment contains a disposition code
Applied to: Populate Array Entry with Disposition Code
WHEN
The segment is being converted to array format
THEN
The system populates the disposition code field in the corresponding array entry
Context: A database status segment contains date and time information
GIVEN
A database status segment contains date and time information
Applied to: Populate Array Entry with Date/Time
WHEN
The segment is being converted to array format
THEN
The system populates the date and time fields in the corresponding array entry
Context: A database status segment contains location code information
GIVEN
A database status segment contains location code information
Applied to: Populate Array Entry with Location Code
WHEN
The segment is being converted to array format
THEN
The system populates the location code field in the corresponding array entry
Context: A database status segment contains quantity information
GIVEN
A database status segment contains quantity information
Applied to: Populate Array Entry with Quantity Information
WHEN
The segment is being converted to array format
THEN
The system populates the quantity fields in the corresponding array entry
Context: The system has processed one or more status segments
GIVEN
The system has processed one or more status segments
Applied to: More Database Segments?
WHEN
A segment conversion is complete
THEN
The system checks if additional segments remain in the database for processing
Context: A status segment has been successfully converted and stored in the array
GIVEN
A status segment has been successfully converted and stored in the array
Applied to: Increment Array Index
WHEN
Additional segments remain to be processed
THEN
The system increments the array index to the next available position
Context: All status segments have been processed from the database
GIVEN
All status segments have been processed from the database
Applied to: Update Maximum Sequences Fetched Counter
WHEN
The segment processing loop completes
THEN
The system updates the maximum sequences fetched counter with the total number of segments processed
R-GCX016E-cbl-02967 (+20) File: GCX016E.cbl Status Array Database Conversion Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Database Conversion':
  • Context - status array conversion process is starting:
    For Initialize Database Segment Counter:
    When the conversion initialization is triggered, then database segment counter is set to zero and work areas are cleared.
  • Context - database conversion process is active:
    For Clear Database Segment Work Area:
    When a new database segment needs to be prepared, then the database segment work area is cleared of all previous data.
  • Context - status array conversion is in progress:
    For More Status Array Entries?:
    When system checks for remaining entries to process, then continue processing if entries exist, otherwise complete conversion.
  • Context - status array has remaining entries to process:
    For Get Next Status Array Entry:
    When next entry retrieval is requested, then the next status array entry is loaded for processing.
  • Context - a status array entry with disposition code is being processed:
    For Validate Disposition Code Format:
    When disposition code format validation is performed, then disposition code is checked against valid format criteria.
  • Context - disposition code format validation has been performed:
    For Disposition Code Valid?:
    When validity determination is made, then valid codes proceed to formatting, invalid codes are skipped.
  • Context - a valid disposition code exists in the status array entry:
    For Format Disposition Code for Database:
    When database formatting is applied, then disposition code is converted to proper database storage format.
  • Context - status array entry contains date and time information:
    For Format Date/Time Information:
    When date/time formatting is applied, then date and time data is converted to database storage format.
  • Context - status array entry contains status information codes:
    For Format Status Information Code:
    When status code formatting is applied, then status information is converted to database-compatible format.
  • Context - status array entry contains quantity information:
    For Format Quantity Information:
    When quantity formatting is applied, then quantity data is converted to proper database storage format.
  • Context - all data elements have been formatted for database storage:
    For Move Formatted Data to Database Segment:
    When data transfer to database segment is executed, then formatted data is moved to the database segment work area.
  • Context - data has been successfully moved to database segment:
    For Increment Database Segment Counter:
    When counter increment is performed, then database segment counter is increased by one.
  • Context - database segment has received new data entry:
    For Segment Full or Array Complete?:
    When segment status evaluation is performed, then continue adding entries if segment has space and array has entries, otherwise complete segment.
  • Context - database segment is full or all array entries are processed:
    For Prepare Database Segment for Storage:
    When segment preparation is initiated, then database segment is prepared for storage with proper formatting.
  • Context - database segment is being prepared for storage:
    For Set Segment Sequence Number:
    When sequence number assignment is performed, then segment receives correct sequence number for database ordering.
  • Context - database segment requires car id information:
    For Update Car ID Information:
    When car id update is performed, then current car identification data is added to database segment.
  • Context - cargo type needs to be evaluated for car id processing:
    For Non-CPRS Cargo?:
    When cprs status check is performed, then non-cprs cargos proceed to car id update, cprs cargos skip car id update.
  • Context - cargo is confirmed as non-cprs type:
    For Update Car ID in Database Segment:
    When car id database update is executed, then car identification information is updated in the database segment.
  • Context - database segment has been fully prepared with all required data:
    For Mark Segment Ready for Database Write:
    When ready status marking is applied, then segment is flagged as ready for database write operation.
  • Context - current database segment processing is complete:
    For Continue to Next Segment:
    When continuation to next segment is initiated, then system proceeds to process next segment or remaining status array entries.
  • Context - all status array entries have been processed and converted:
    For Log Conversion Completion:
    When conversion completion logging is performed, then successful conversion completion is recorded in system logs.
👨‍💻 Technical ACs (Gherkin)
Context: Status array conversion process is starting
GIVEN
Status array conversion process is starting
Applied to: Initialize Database Segment Counter
WHEN
The conversion initialization is triggered
THEN
Database segment counter is set to zero and work areas are cleared
Context: Database conversion process is active
GIVEN
Database conversion process is active
Applied to: Clear Database Segment Work Area
WHEN
A new database segment needs to be prepared
THEN
The database segment work area is cleared of all previous data
Context: Status array conversion is in progress
GIVEN
Status array conversion is in progress
Applied to: More Status Array Entries?
WHEN
System checks for remaining entries to process
THEN
Continue processing if entries exist, otherwise complete conversion
Context: Status array has remaining entries to process
GIVEN
Status array has remaining entries to process
Applied to: Get Next Status Array Entry
WHEN
Next entry retrieval is requested
THEN
The next status array entry is loaded for processing
Context: A status array entry with disposition code is being processed
GIVEN
A status array entry with disposition code is being processed
Applied to: Validate Disposition Code Format
WHEN
Disposition code format validation is performed
THEN
Disposition code is checked against valid format criteria
Context: Disposition code format validation has been performed
GIVEN
Disposition code format validation has been performed
Applied to: Disposition Code Valid?
WHEN
Validity determination is made
THEN
Valid codes proceed to formatting, invalid codes are skipped
Context: A valid disposition code exists in the status array entry
GIVEN
A valid disposition code exists in the status array entry
Applied to: Format Disposition Code for Database
WHEN
Database formatting is applied
THEN
Disposition code is converted to proper database storage format
Context: Status array entry contains date and time information
GIVEN
Status array entry contains date and time information
Applied to: Format Date/Time Information
WHEN
Date/time formatting is applied
THEN
Date and time data is converted to database storage format
Context: Status array entry contains status information codes
GIVEN
Status array entry contains status information codes
Applied to: Format Status Information Code
WHEN
Status code formatting is applied
THEN
Status information is converted to database-compatible format
Context: Status array entry contains quantity information
GIVEN
Status array entry contains quantity information
Applied to: Format Quantity Information
WHEN
Quantity formatting is applied
THEN
Quantity data is converted to proper database storage format
Context: All data elements have been formatted for database storage
GIVEN
All data elements have been formatted for database storage
Applied to: Move Formatted Data to Database Segment
WHEN
Data transfer to database segment is executed
THEN
Formatted data is moved to the database segment work area
Context: Data has been successfully moved to database segment
GIVEN
Data has been successfully moved to database segment
Applied to: Increment Database Segment Counter
WHEN
Counter increment is performed
THEN
Database segment counter is increased by one
Context: Database segment has received new data entry
GIVEN
Database segment has received new data entry
Applied to: Segment Full or Array Complete?
WHEN
Segment status evaluation is performed
THEN
Continue adding entries if segment has space and array has entries, otherwise complete segment
Context: Database segment is full or all array entries are processed
GIVEN
Database segment is full or all array entries are processed
Applied to: Prepare Database Segment for Storage
WHEN
Segment preparation is initiated
THEN
Database segment is prepared for storage with proper formatting
Context: Database segment is being prepared for storage
GIVEN
Database segment is being prepared for storage
Applied to: Set Segment Sequence Number
WHEN
Sequence number assignment is performed
THEN
Segment receives correct sequence number for database ordering
Context: Database segment requires car ID information
GIVEN
Database segment requires car ID information
Applied to: Update Car ID Information
WHEN
Car ID update is performed
THEN
Current car identification data is added to database segment
Context: Cargo type needs to be evaluated for car ID processing
GIVEN
Cargo type needs to be evaluated for car ID processing
Applied to: Non-CPRS Cargo?
WHEN
CPRS status check is performed
THEN
Non-CPRS cargos proceed to car ID update, CPRS cargos skip car ID update
Context: Cargo is confirmed as non-CPRS type
GIVEN
Cargo is confirmed as non-CPRS type
Applied to: Update Car ID in Database Segment
WHEN
Car ID database update is executed
THEN
Car identification information is updated in the database segment
Context: Database segment has been fully prepared with all required data
GIVEN
Database segment has been fully prepared with all required data
Applied to: Mark Segment Ready for Database Write
WHEN
Ready status marking is applied
THEN
Segment is flagged as ready for database write operation
Context: Current database segment processing is complete
GIVEN
Current database segment processing is complete
Applied to: Continue to Next Segment
WHEN
Continuation to next segment is initiated
THEN
System proceeds to process next segment or remaining status array entries
Context: All status array entries have been processed and converted
GIVEN
All status array entries have been processed and converted
Applied to: Log Conversion Completion
WHEN
Conversion completion logging is performed
THEN
Successful conversion completion is recorded in system logs
R-GCX016E-cbl-02988 (+10) File: GCX016E.cbl Disposition Code Validation Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Validation':
  • Context - a disposition code is received from x4 segment processing:
    For Search DC Table for Disposition Code:
    When the system performs table lookup using gcctbio to search the dc table for the disposition code, then the system determines if the disposition code exists in the table and sets appropriate validation flags.
  • Context - a disposition code has been found valid in the dc table:
    For Extract Processing Rules from Table:
    When the system extracts processing rules from the table entry, then the system retrieves action type (add/subtract), hold/release indicator, status information flag, and removal processing flag for the disposition code.
  • Context - a disposition code has been successfully found in the dc table:
    For Set Disposition Code Valid Flag:
    When the system completes table lookup validation, then the system sets the disposition code valid flag to true to enable further processing.
  • Context - a valid disposition code entry exists in the dc table:
    For Extract Action Type - Add/Subtract:
    When the system extracts action type information from the table entry, then the system identifies whether the disposition code should add to or subtract from release quantities.
    For Extract Hold/Release Indicator:
    When the system extracts hold/release indicator from the table entry, then the system identifies whether the disposition code represents a hold or release action.
    For Extract Status Information Flag:
    When the system extracts status information flag from the table entry, then the system identifies whether the disposition code is informational only or requires active processing.
    For Extract Removal Processing Flag:
    When the system extracts removal processing flag from the table entry, then the system identifies whether existing disposition codes should be removed before processing the current code.
  • Context - all processing rules have been extracted from the dc table entry:
    For Set Processing Rules in Working Storage:
    When the system completes rule extraction process, then the system stores action type, hold/release indicator, status flag, and removal flag in working storage variables.
  • Context - a disposition code is not found in the dc table during lookup:
    For Generate Merlin Error Message:
    When the system determines the disposition code is invalid, then the system generates an error message to the merlin messaging system reporting the unknown disposition code.
  • Context - a disposition code is not found in the dc table:
    For Set Disposition Code Invalid Flag:
    When the system completes table lookup validation with negative result, then the system sets the disposition code invalid flag to prevent downstream processing of the invalid code.
  • Context - a disposition code has been determined invalid and error message generated:
    For Log Unknown Disposition Code:
    When the system processes the invalid disposition code, then the system logs the unknown disposition code details for audit and debugging purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received from X4 segment processing
GIVEN
A disposition code is received from X4 segment processing
Applied to: Search DC Table for Disposition Code
WHEN
The system performs table lookup using GCCTBIO to search the DC table for the disposition code
THEN
The system determines if the disposition code exists in the table and sets appropriate validation flags
Context: A disposition code has been found valid in the DC table
GIVEN
A disposition code has been found valid in the DC table
Applied to: Extract Processing Rules from Table
WHEN
The system extracts processing rules from the table entry
THEN
The system retrieves action type (add/subtract), hold/release indicator, status information flag, and removal processing flag for the disposition code
Context: A disposition code has been successfully found in the DC table
GIVEN
A disposition code has been successfully found in the DC table
Applied to: Set Disposition Code Valid Flag
WHEN
The system completes table lookup validation
THEN
The system sets the disposition code valid flag to true to enable further processing
Context: A valid disposition code entry exists in the DC table
GIVEN
A valid disposition code entry exists in the DC table
Applied to: Extract Action Type - Add/Subtract
WHEN
The system extracts action type information from the table entry
THEN
The system identifies whether the disposition code should add to or subtract from release quantities
Applied to: Extract Hold/Release Indicator
WHEN
The system extracts hold/release indicator from the table entry
THEN
The system identifies whether the disposition code represents a hold or release action
Applied to: Extract Status Information Flag
WHEN
The system extracts status information flag from the table entry
THEN
The system identifies whether the disposition code is informational only or requires active processing
Applied to: Extract Removal Processing Flag
WHEN
The system extracts removal processing flag from the table entry
THEN
The system identifies whether existing disposition codes should be removed before processing the current code
Context: All processing rules have been extracted from the DC table entry
GIVEN
All processing rules have been extracted from the DC table entry
Applied to: Set Processing Rules in Working Storage
WHEN
The system completes rule extraction process
THEN
The system stores action type, hold/release indicator, status flag, and removal flag in working storage variables
Context: A disposition code is not found in the DC table during lookup
GIVEN
A disposition code is not found in the DC table during lookup
Applied to: Generate Merlin Error Message
WHEN
The system determines the disposition code is invalid
THEN
The system generates an error message to the Merlin messaging system reporting the unknown disposition code
Context: A disposition code is not found in the DC table
GIVEN
A disposition code is not found in the DC table
Applied to: Set Disposition Code Invalid Flag
WHEN
The system completes table lookup validation with negative result
THEN
The system sets the disposition code invalid flag to prevent downstream processing of the invalid code
Context: A disposition code has been determined invalid and error message generated
GIVEN
A disposition code has been determined invalid and error message generated
Applied to: Log Unknown Disposition Code
WHEN
The system processes the invalid disposition code
THEN
The system logs the unknown disposition code details for audit and debugging purposes
R-GCX016E-cbl-02999 (+12) File: GCX016E.cbl Release Quantity Calculation Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Quantity Calculation':
  • Context - a cargo record exists with release quantity information:
    For Retrieve Current Release Quantity:
    When the system processes a disposition code that may affect quantities, then the current release quantity is retrieved and stored for calculation purposes.
  • Context - a disposition code is being processed:
    For Get Disposition Code Action Type:
    When the system evaluates the disposition code action requirements, then the action type is classified as add, subtract, or status info only based on disposition code characteristics.
  • Context - a disposition code with add action type is being processed:
    For Add Quantity Action:
    When the system determines quantity changes are required, then the disposition code quantity is marked for addition to current release quantity.
  • Context - a disposition code with subtract action type is being processed:
    For Subtract Quantity Action:
    When the system determines quantity reduction is required, then the disposition code quantity is marked for subtraction from current release quantity.
  • Context - a disposition code with status info only action type is being processed:
    For No Quantity Change Action:
    When the system determines no quantity changes are required, then the processing completes without modifying release quantities.
  • Context - current release quantity and disposition code action are available:
    For Calculate New Release Quantity:
    When the system performs quantity calculation, then new release quantity is computed by adding or subtracting the disposition code quantity from current release quantity.
  • Context - a new release quantity has been calculated:
    For Validate Against Total Quantity:
    When the system validates the calculated quantity, then the release quantity is checked against total cargo quantity for validity.
  • Context - calculated release quantity exceeds total cargo quantity:
    For Set Release Qty = Total Qty:
    When the system applies quantity validation rules, then release quantity is set equal to total cargo quantity.
  • Context - calculated release quantity is less than zero:
    For Set Release Qty = 0:
    When the system applies quantity validation rules, then release quantity is set to zero.
  • Context - a validated new release quantity is available:
    For Update Release Quantity:
    When the system updates cargo information, then the cargo record release quantity is updated with the new validated amount.
  • Context - release quantity has been updated:
    For Log Quantity Change:
    When the system completes quantity processing, then a log entry is created documenting the quantity change transaction.
  • Context - original and new release quantities are available:
    For Create Before/After Comparison:
    When the system documents quantity changes, then a before and after comparison record is created showing quantity differences.
  • Context - quantity changes have been processed and documented:
    For Generate Quantity Impact Message:
    When the system generates impact notifications, then a quantity impact message is created showing the effect of disposition code on release quantities.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with release quantity information
GIVEN
A cargo record exists with release quantity information
Applied to: Retrieve Current Release Quantity
WHEN
The system processes a disposition code that may affect quantities
THEN
The current release quantity is retrieved and stored for calculation purposes
Context: A disposition code is being processed
GIVEN
A disposition code is being processed
Applied to: Get Disposition Code Action Type
WHEN
The system evaluates the disposition code action requirements
THEN
The action type is classified as Add, Subtract, or Status Info Only based on disposition code characteristics
Context: A disposition code with Add action type is being processed
GIVEN
A disposition code with Add action type is being processed
Applied to: Add Quantity Action
WHEN
The system determines quantity changes are required
THEN
The disposition code quantity is marked for addition to current release quantity
Context: A disposition code with Subtract action type is being processed
GIVEN
A disposition code with Subtract action type is being processed
Applied to: Subtract Quantity Action
WHEN
The system determines quantity reduction is required
THEN
The disposition code quantity is marked for subtraction from current release quantity
Context: A disposition code with Status Info Only action type is being processed
GIVEN
A disposition code with Status Info Only action type is being processed
Applied to: No Quantity Change Action
WHEN
The system determines no quantity changes are required
THEN
The processing completes without modifying release quantities
Context: Current release quantity and disposition code action are available
GIVEN
Current release quantity and disposition code action are available
Applied to: Calculate New Release Quantity
WHEN
The system performs quantity calculation
THEN
New release quantity is computed by adding or subtracting the disposition code quantity from current release quantity
Context: A new release quantity has been calculated
GIVEN
A new release quantity has been calculated
Applied to: Validate Against Total Quantity
WHEN
The system validates the calculated quantity
THEN
The release quantity is checked against total cargo quantity for validity
Context: Calculated release quantity exceeds total cargo quantity
GIVEN
Calculated release quantity exceeds total cargo quantity
Applied to: Set Release Qty = Total Qty
WHEN
The system applies quantity validation rules
THEN
Release quantity is set equal to total cargo quantity
Context: Calculated release quantity is less than zero
GIVEN
Calculated release quantity is less than zero
Applied to: Set Release Qty = 0
WHEN
The system applies quantity validation rules
THEN
Release quantity is set to zero
Context: A validated new release quantity is available
GIVEN
A validated new release quantity is available
Applied to: Update Release Quantity
WHEN
The system updates cargo information
THEN
The cargo record release quantity is updated with the new validated amount
Context: Release quantity has been updated
GIVEN
Release quantity has been updated
Applied to: Log Quantity Change
WHEN
The system completes quantity processing
THEN
A log entry is created documenting the quantity change transaction
Context: Original and new release quantities are available
GIVEN
Original and new release quantities are available
Applied to: Create Before/After Comparison
WHEN
The system documents quantity changes
THEN
A before and after comparison record is created showing quantity differences
Context: Quantity changes have been processed and documented
GIVEN
Quantity changes have been processed and documented
Applied to: Generate Quantity Impact Message
WHEN
The system generates impact notifications
THEN
A quantity impact message is created showing the effect of disposition code on release quantities
R-GCX016E-cbl-03012 (+15) File: GCX016E.cbl Status Condition Analysis Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Condition Analysis':
  • Context - a cargo record with status array containing disposition codes:
    For Border Hold Present?:
    When the system analyzes the cargo status for border hold conditions, then the system identifies if border hold is present and sets appropriate processing flags.
  • Context - a cargo record with status array and destination information:
    For Destination Hold Present?:
    When the system checks for destination-specific hold conditions, then the system determines if destination hold is active and updates processing flags accordingly.
  • Context - a cargo record with regulatory status information:
    For FDA Hold Present?:
    When the system checks for fda hold conditions in the status array, then the system identifies fda hold presence and sets regulatory compliance flags.
  • Context - a cargo record with quantity information and release data:
    For Piece Count Hold Present?:
    When the system compares released quantities against total cargo quantities, then the system determines if piece count hold exists and updates quantity validation flags.
  • Context - a cargo record with disposition codes and release information:
    For Manual Release Present?:
    When the system evaluates manual release status in the disposition code array, then the system identifies manual release presence and sets override processing flags.
  • Context - a cargo record with disposition codes and processing status:
    For Proceed Code Present?:
    When the system checks for proceed authorization in the status array, then the system determines proceed code presence and enables movement authorization.
  • Context - a cargo record with status information and release criteria:
    For Auto Release Available?:
    When the system evaluates automatic release eligibility conditions, then the system determines auto release availability and sets automated processing flags.
  • Context - a cargo record with entry type and customs information:
    For In-Bond Entry?:
    When the system evaluates entry types 61, 62, 63, or 69 for in-bond classification, then the system sets in-bond processing flags and enables customs movement tracking.
  • Context - a cargo record with arrival information and location data:
    For Arrival Status Valid?:
    When the system validates arrival status against business rules and location constraints, then the system confirms arrival status validity and enables arrival processing workflows.
  • Context - a cargo record with export information and regulatory compliance data:
    For Export Status Valid?:
    When the system validates export status against customs regulations and business rules, then the system confirms export status validity and enables export processing workflows.
  • Context - a cargo record with multiple conflicting status conditions including holds, releases, and proceed codes:
    For Hold Takes Precedence?:
    When the system evaluates status priority hierarchy with holds having highest precedence, then the system determines final status based on hold precedence rules and sets appropriate processing flags.
  • Context - a cargo record where hold conditions have been determined to take precedence:
    For Set Final Status: HOLD:
    When the system applies final status assignment logic, then the system sets cargo status to hold and updates all related processing flags and notifications.
  • Context - a cargo record where release conditions take precedence and no overriding holds exist:
    For Set Final Status: RELEASE:
    When the system applies final status assignment logic, then the system sets cargo status to release and enables cargo movement and delivery processing.
  • Context - a cargo record where proceed authorization takes precedence and no blocking conditions exist:
    For Set Final Status: PROCEED:
    When the system applies final status assignment logic, then the system sets cargo status to proceed and enables next stage processing workflows.
  • Context - a cargo record where arrival status takes precedence and arrival validation is successful:
    For Set Final Status: ARRIVED:
    When the system applies final status assignment logic, then the system sets cargo status to arrived and triggers arrival notification and processing workflows.
  • Context - a cargo record where export status takes precedence and export validation is successful:
    For Set Final Status: EXPORTED:
    When the system applies final status assignment logic, then the system sets cargo status to exported and triggers export documentation and compliance workflows.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with status array containing disposition codes
GIVEN
A cargo record with status array containing disposition codes
Applied to: Border Hold Present?
WHEN
The system analyzes the cargo status for border hold conditions
THEN
The system identifies if border hold is present and sets appropriate processing flags
Context: A cargo record with status array and destination information
GIVEN
A cargo record with status array and destination information
Applied to: Destination Hold Present?
WHEN
The system checks for destination-specific hold conditions
THEN
The system determines if destination hold is active and updates processing flags accordingly
Context: A cargo record with regulatory status information
GIVEN
A cargo record with regulatory status information
Applied to: FDA Hold Present?
WHEN
The system checks for FDA hold conditions in the status array
THEN
The system identifies FDA hold presence and sets regulatory compliance flags
Context: A cargo record with quantity information and release data
GIVEN
A cargo record with quantity information and release data
Applied to: Piece Count Hold Present?
WHEN
The system compares released quantities against total cargo quantities
THEN
The system determines if piece count hold exists and updates quantity validation flags
Context: A cargo record with disposition codes and release information
GIVEN
A cargo record with disposition codes and release information
Applied to: Manual Release Present?
WHEN
The system evaluates manual release status in the disposition code array
THEN
The system identifies manual release presence and sets override processing flags
Context: A cargo record with disposition codes and processing status
GIVEN
A cargo record with disposition codes and processing status
Applied to: Proceed Code Present?
WHEN
The system checks for proceed authorization in the status array
THEN
The system determines proceed code presence and enables movement authorization
Context: A cargo record with status information and release criteria
GIVEN
A cargo record with status information and release criteria
Applied to: Auto Release Available?
WHEN
The system evaluates automatic release eligibility conditions
THEN
The system determines auto release availability and sets automated processing flags
Context: A cargo record with entry type and customs information
GIVEN
A cargo record with entry type and customs information
Applied to: In-Bond Entry?
WHEN
The system evaluates entry types 61, 62, 63, or 69 for in-bond classification
THEN
The system sets in-bond processing flags and enables customs movement tracking
Context: A cargo record with arrival information and location data
GIVEN
A cargo record with arrival information and location data
Applied to: Arrival Status Valid?
WHEN
The system validates arrival status against business rules and location constraints
THEN
The system confirms arrival status validity and enables arrival processing workflows
Context: A cargo record with export information and regulatory compliance data
GIVEN
A cargo record with export information and regulatory compliance data
Applied to: Export Status Valid?
WHEN
The system validates export status against customs regulations and business rules
THEN
The system confirms export status validity and enables export processing workflows
Context: A cargo record with multiple conflicting status conditions including holds, releases, and proceed codes
GIVEN
A cargo record with multiple conflicting status conditions including holds, releases, and proceed codes
Applied to: Hold Takes Precedence?
WHEN
The system evaluates status priority hierarchy with holds having highest precedence
THEN
The system determines final status based on hold precedence rules and sets appropriate processing flags
Context: A cargo record where hold conditions have been determined to take precedence
GIVEN
A cargo record where hold conditions have been determined to take precedence
Applied to: Set Final Status: HOLD
WHEN
The system applies final status assignment logic
THEN
The system sets cargo status to HOLD and updates all related processing flags and notifications
Context: A cargo record where release conditions take precedence and no overriding holds exist
GIVEN
A cargo record where release conditions take precedence and no overriding holds exist
Applied to: Set Final Status: RELEASE
WHEN
The system applies final status assignment logic
THEN
The system sets cargo status to RELEASE and enables cargo movement and delivery processing
Context: A cargo record where proceed authorization takes precedence and no blocking conditions exist
GIVEN
A cargo record where proceed authorization takes precedence and no blocking conditions exist
Applied to: Set Final Status: PROCEED
WHEN
The system applies final status assignment logic
THEN
The system sets cargo status to PROCEED and enables next stage processing workflows
Context: A cargo record where arrival status takes precedence and arrival validation is successful
GIVEN
A cargo record where arrival status takes precedence and arrival validation is successful
Applied to: Set Final Status: ARRIVED
WHEN
The system applies final status assignment logic
THEN
The system sets cargo status to ARRIVED and triggers arrival notification and processing workflows
Context: A cargo record where export status takes precedence and export validation is successful
GIVEN
A cargo record where export status takes precedence and export validation is successful
Applied to: Set Final Status: EXPORTED
WHEN
The system applies final status assignment logic
THEN
The system sets cargo status to EXPORTED and triggers export documentation and compliance workflows
R-GCX016E-cbl-03028 (+22) File: GCX016E.cbl Merlin Message Content Assembly Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Message Content Assembly':
  • Context - a cargo record exists with equipment information:
    For Retrieve Equipment Details:
    When the system processes merlin message assembly, then equipment details are retrieved and made available for message formatting.
  • Context - equipment details are available with car id and waybill information:
    For Format Car ID and Waybill Information:
    When the system formats message content, then car id and waybill information are formatted according to merlin message standards.
  • Context - a cargo record contains us-ccn information:
    For Add US-CCN Information:
    When the system assembles merlin message content, then us-ccn information is included in the message.
  • Context - a disposition code exists for the cargo:
    For Retrieve Disposition Code Information:
    When the system processes merlin message assembly, then disposition code information is retrieved from the dc table.
  • Context - disposition code information is available:
    For Format Disposition Code and Description:
    When the system formats message content, then disposition code and description are formatted for merlin message display.
  • Context - a disposition code with quantity information exists:
    For Calculate Release Quantity Impact:
    When the system processes quantity impact analysis, then the impact on release quantity is calculated and determined.
  • Context - release quantity impact has been calculated:
    For Quantity Impact Analysis:
    When the system evaluates quantity impact, then processing is routed to show quantity details if impact is detected, otherwise continues to comment processing.
  • Context - quantity impact has been detected:
    For Show Before Release Quantity:
    When the system processes quantity display, then the current release quantity before changes is shown in the message.
  • Context - before release quantity has been displayed:
    For Show After Release Quantity:
    When the system continues quantity processing, then the projected release quantity after changes is shown in the message.
  • Context - before and after release quantities have been displayed:
    For Add Quantity Change Details:
    When the system processes quantity change details, then detailed quantity change information is added to the message content.
  • Context - k1 segment comments exist for the cargo:
    For Include K1 Comment Processing:
    When the system processes message content assembly, then k1 comments are included in the merlin message up to the maximum allowed lines.
  • Context - free-form text messages exist from disposition code processing:
    For Add Free-Form Text Messages:
    When the system assembles message content, then free-form text messages are added to the merlin message content.
  • Context - special comments exist for the cargo processing:
    For Include Special Comments:
    When the system processes message content, then special comments are included in the merlin message up to the maximum allowed lines.
  • Context - processing context and details are available:
    For Add Processing Details:
    When the system assembles message content, then processing details are added to provide context in the merlin message.
  • Context - k1 segment comments are being processed:
    For Bond Creation Scenario?:
    When the system evaluates bond creation conditions, then processing is routed to bond creation if cp rail identifiers are found, otherwise continues to date/time processing.
  • Context - cp rail identifiers are detected in k1 comments:
    For Process Canadian Pacific Railway Bond Creation:
    When the system processes bond creation scenario, then special canadian pacific railway bond creation processing is performed.
  • Context - canadian pacific railway bond creation has been processed:
    For Add Bond Creation Notification:
    When the system adds notification content, then bond creation notification is added to the merlin message.
  • Context - processing date and time information is available:
    For Format Date and Time Information:
    When the system formats message content, then date and time information is formatted according to merlin message standards.
  • Context - uscs processing time is available:
    For Add USCS Processing Time:
    When the system adds time information, then uscs processing time is included in the merlin message content.
  • Context - system processing time is available:
    For Add System Processing Time:
    When the system adds time information, then system processing time is included in the merlin message content.
  • Context - all message components have been processed and formatted:
    For Assemble Complete Message Content:
    When the system assembles complete content, then all components are combined into complete merlin message content.
  • Context - complete message content has been assembled:
    For Validate Message Format:
    When the system validates message format, then message format is validated against merlin standards and requirements.
  • Context - message format has been validated successfully:
    For Finalize Merlin Message:
    When the system finalizes the message, then merlin message is finalized and ready for transmission.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with equipment information
GIVEN
A cargo record exists with equipment information
Applied to: Retrieve Equipment Details
WHEN
The system processes Merlin message assembly
THEN
Equipment details are retrieved and made available for message formatting
Context: Equipment details are available with car ID and waybill information
GIVEN
Equipment details are available with car ID and waybill information
Applied to: Format Car ID and Waybill Information
WHEN
The system formats message content
THEN
Car ID and waybill information are formatted according to Merlin message standards
Context: A cargo record contains US-CCN information
GIVEN
A cargo record contains US-CCN information
Applied to: Add US-CCN Information
WHEN
The system assembles Merlin message content
THEN
US-CCN information is included in the message
Context: A disposition code exists for the cargo
GIVEN
A disposition code exists for the cargo
Applied to: Retrieve Disposition Code Information
WHEN
The system processes Merlin message assembly
THEN
Disposition code information is retrieved from the DC table
Context: Disposition code information is available
GIVEN
Disposition code information is available
Applied to: Format Disposition Code and Description
WHEN
The system formats message content
THEN
Disposition code and description are formatted for Merlin message display
Context: A disposition code with quantity information exists
GIVEN
A disposition code with quantity information exists
Applied to: Calculate Release Quantity Impact
WHEN
The system processes quantity impact analysis
THEN
The impact on release quantity is calculated and determined
Context: Release quantity impact has been calculated
GIVEN
Release quantity impact has been calculated
Applied to: Quantity Impact Analysis
WHEN
The system evaluates quantity impact
THEN
Processing is routed to show quantity details if impact is detected, otherwise continues to comment processing
Context: Quantity impact has been detected
GIVEN
Quantity impact has been detected
Applied to: Show Before Release Quantity
WHEN
The system processes quantity display
THEN
The current release quantity before changes is shown in the message
Context: Before release quantity has been displayed
GIVEN
Before release quantity has been displayed
Applied to: Show After Release Quantity
WHEN
The system continues quantity processing
THEN
The projected release quantity after changes is shown in the message
Context: Before and after release quantities have been displayed
GIVEN
Before and after release quantities have been displayed
Applied to: Add Quantity Change Details
WHEN
The system processes quantity change details
THEN
Detailed quantity change information is added to the message content
Context: K1 segment comments exist for the cargo
GIVEN
K1 segment comments exist for the cargo
Applied to: Include K1 Comment Processing
WHEN
The system processes message content assembly
THEN
K1 comments are included in the Merlin message up to the maximum allowed lines
Context: Free-form text messages exist from disposition code processing
GIVEN
Free-form text messages exist from disposition code processing
Applied to: Add Free-Form Text Messages
WHEN
The system assembles message content
THEN
Free-form text messages are added to the Merlin message content
Context: Special comments exist for the cargo processing
GIVEN
Special comments exist for the cargo processing
Applied to: Include Special Comments
WHEN
The system processes message content
THEN
Special comments are included in the Merlin message up to the maximum allowed lines
Context: Processing context and details are available
GIVEN
Processing context and details are available
Applied to: Add Processing Details
WHEN
The system assembles message content
THEN
Processing details are added to provide context in the Merlin message
Context: K1 segment comments are being processed
GIVEN
K1 segment comments are being processed
Applied to: Bond Creation Scenario?
WHEN
The system evaluates bond creation conditions
THEN
Processing is routed to bond creation if CP Rail identifiers are found, otherwise continues to date/time processing
Context: CP Rail identifiers are detected in K1 comments
GIVEN
CP Rail identifiers are detected in K1 comments
Applied to: Process Canadian Pacific Railway Bond Creation
WHEN
The system processes bond creation scenario
THEN
Special Canadian Pacific Railway bond creation processing is performed
Context: Canadian Pacific Railway bond creation has been processed
GIVEN
Canadian Pacific Railway bond creation has been processed
Applied to: Add Bond Creation Notification
WHEN
The system adds notification content
THEN
Bond creation notification is added to the Merlin message
Context: Processing date and time information is available
GIVEN
Processing date and time information is available
Applied to: Format Date and Time Information
WHEN
The system formats message content
THEN
Date and time information is formatted according to Merlin message standards
Context: USCS processing time is available
GIVEN
USCS processing time is available
Applied to: Add USCS Processing Time
WHEN
The system adds time information
THEN
USCS processing time is included in the Merlin message content
Context: System processing time is available
GIVEN
System processing time is available
Applied to: Add System Processing Time
WHEN
The system adds time information
THEN
System processing time is included in the Merlin message content
Context: All message components have been processed and formatted
GIVEN
All message components have been processed and formatted
Applied to: Assemble Complete Message Content
WHEN
The system assembles complete content
THEN
All components are combined into complete Merlin message content
Context: Complete message content has been assembled
GIVEN
Complete message content has been assembled
Applied to: Validate Message Format
WHEN
The system validates message format
THEN
Message format is validated against Merlin standards and requirements
Context: Message format has been validated successfully
GIVEN
Message format has been validated successfully
Applied to: Finalize Merlin Message
WHEN
The system finalizes the message
THEN
Merlin message is finalized and ready for transmission
R-GCX016E-cbl-03051 (+12) File: GCX016E.cbl Freight Forwarder Identification Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Freight Forwarder Identification':
  • Context - a disposition code is being processed for cargo:
    For Search Broker Database for Freight Forwarder Disposition Codes:
    When the system searches the broker database for freight forwarder disposition codes, then the system identifies whether the disposition code is associated with freight forwarder processing.
  • Context - the broker database has been searched for freight forwarder disposition codes:
    For Freight Forwarder Code Found?:
    When the search results are evaluated, then if a freight forwarder code is found, proceed to retrieve cargo segment data, otherwise log freight forwarder not found.
  • Context - a freight forwarder disposition code has been identified:
    For Retrieve Cargo Segment Data from GCSUSS03:
    When the system needs cargo segment information for processing, then the system retrieves cargo segment data from the gcsuss03 database.
  • Context - primary cargo segment data has been retrieved from gcsuss03:
    For Retrieve Additional Cargo Data from GCSUSS07:
    When additional cargo information is needed for freight forwarder processing, then the system retrieves additional cargo data from the gcsuss07 database.
  • Context - cargo segment data has been retrieved from both gcsuss03 and gcsuss07:
    For Extract Freight Forwarder Information from Cargo Segments:
    When the system processes the cargo segment information, then the system extracts freight forwarder identification details from the cargo segments.
  • Context - freight forwarder identification has been extracted from cargo segments:
    For Lookup Freight Forwarder Name in Broker Table GCST2RT:
    When the system needs to validate and retrieve complete freight forwarder information, then the system looks up the freight forwarder name in the gcst2rt broker name table.
  • Context - the broker name table gcst2rt has been searched for the freight forwarder name:
    For Freight Forwarder Name Found?:
    When the search results are evaluated, then if the freight forwarder name is found, proceed to retrieve contact information, otherwise log freight forwarder not found.
  • Context - the freight forwarder name has been successfully found in the broker name table:
    For Retrieve Freight Forwarder Contact Information:
    When complete contact information is needed for notification processing, then the system retrieves freight forwarder contact information from the broker database.
  • Context - freight forwarder contact information has been retrieved:
    For Get Email Address from Broker Table GCSTBRT:
    When an email address is needed for electronic notification, then the system retrieves the email address from the gcstbrt broker table.
  • Context - the broker table has been searched for the freight forwarder's email address:
    For Email Address Available?:
    When the system needs to determine the notification method, then if an email address is available, set the freight forwarder identified flag, otherwise log freight forwarder not found.
  • Context - a freight forwarder has been successfully identified with available contact information:
    For Set Freight Forwarder Identified Flag:
    When the freight forwarder validation process is complete, then the system sets the freight forwarder identified flag to indicate successful identification.
  • Context - the freight forwarder identified flag has been set:
    For Store Freight Forwarder Details for Processing:
    When freight forwarder details need to be preserved for notification processing, then the system stores freight forwarder details including contact information and email address for processing.
  • Context - the freight forwarder identification process has failed at any validation step:
    For Log Freight Forwarder Not Found:
    When no valid freight forwarder can be identified for the disposition code, then the system logs that the freight forwarder was not found and continues processing without freight forwarder notification.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo
GIVEN
A disposition code is being processed for cargo
Applied to: Search Broker Database for Freight Forwarder Disposition Codes
WHEN
The system searches the broker database for freight forwarder disposition codes
THEN
The system identifies whether the disposition code is associated with freight forwarder processing
Context: The broker database has been searched for freight forwarder disposition codes
GIVEN
The broker database has been searched for freight forwarder disposition codes
Applied to: Freight Forwarder Code Found?
WHEN
The search results are evaluated
THEN
If a freight forwarder code is found, proceed to retrieve cargo segment data, otherwise log freight forwarder not found
Context: A freight forwarder disposition code has been identified
GIVEN
A freight forwarder disposition code has been identified
Applied to: Retrieve Cargo Segment Data from GCSUSS03
WHEN
The system needs cargo segment information for processing
THEN
The system retrieves cargo segment data from the GCSUSS03 database
Context: Primary cargo segment data has been retrieved from GCSUSS03
GIVEN
Primary cargo segment data has been retrieved from GCSUSS03
Applied to: Retrieve Additional Cargo Data from GCSUSS07
WHEN
Additional cargo information is needed for freight forwarder processing
THEN
The system retrieves additional cargo data from the GCSUSS07 database
Context: Cargo segment data has been retrieved from both GCSUSS03 and GCSUSS07
GIVEN
Cargo segment data has been retrieved from both GCSUSS03 and GCSUSS07
Applied to: Extract Freight Forwarder Information from Cargo Segments
WHEN
The system processes the cargo segment information
THEN
The system extracts freight forwarder identification details from the cargo segments
Context: Freight forwarder identification has been extracted from cargo segments
GIVEN
Freight forwarder identification has been extracted from cargo segments
Applied to: Lookup Freight Forwarder Name in Broker Table GCST2RT
WHEN
The system needs to validate and retrieve complete freight forwarder information
THEN
The system looks up the freight forwarder name in the GCST2RT broker name table
Context: The broker name table GCST2RT has been searched for the freight forwarder name
GIVEN
The broker name table GCST2RT has been searched for the freight forwarder name
Applied to: Freight Forwarder Name Found?
WHEN
The search results are evaluated
THEN
If the freight forwarder name is found, proceed to retrieve contact information, otherwise log freight forwarder not found
Context: The freight forwarder name has been successfully found in the broker name table
GIVEN
The freight forwarder name has been successfully found in the broker name table
Applied to: Retrieve Freight Forwarder Contact Information
WHEN
Complete contact information is needed for notification processing
THEN
The system retrieves freight forwarder contact information from the broker database
Context: Freight forwarder contact information has been retrieved
GIVEN
Freight forwarder contact information has been retrieved
Applied to: Get Email Address from Broker Table GCSTBRT
WHEN
An email address is needed for electronic notification
THEN
The system retrieves the email address from the GCSTBRT broker table
Context: The broker table has been searched for the freight forwarder's email address
GIVEN
The broker table has been searched for the freight forwarder's email address
Applied to: Email Address Available?
WHEN
The system needs to determine the notification method
THEN
If an email address is available, set the freight forwarder identified flag, otherwise log freight forwarder not found
Context: A freight forwarder has been successfully identified with available contact information
GIVEN
A freight forwarder has been successfully identified with available contact information
Applied to: Set Freight Forwarder Identified Flag
WHEN
The freight forwarder validation process is complete
THEN
The system sets the freight forwarder identified flag to indicate successful identification
Context: The freight forwarder identified flag has been set
GIVEN
The freight forwarder identified flag has been set
Applied to: Store Freight Forwarder Details for Processing
WHEN
Freight forwarder details need to be preserved for notification processing
THEN
The system stores freight forwarder details including contact information and email address for processing
Context: The freight forwarder identification process has failed at any validation step
GIVEN
The freight forwarder identification process has failed at any validation step
Applied to: Log Freight Forwarder Not Found
WHEN
No valid freight forwarder can be identified for the disposition code
THEN
The system logs that the freight forwarder was not found and continues processing without freight forwarder notification
R-GCX016E-cbl-03064 (+19) File: GCX016E.cbl CIH Email Content Creation Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CIH Email Content Creation':
  • Context - a cargo record exists with equipment information:
    For Retrieve Equipment Information:
    When the system processes email content creation, then equipment details are retrieved from the cargo segment data.
  • Context - equipment information has been retrieved from cargo data:
    For Format Car ID and Equipment Type:
    When the system formats the equipment details, then car id and equipment type are formatted according to business display standards.
  • Context - a cargo record contains waybill information:
    For Retrieve Waybill Number:
    When the system processes cargo information for email content, then the waybill number is retrieved from the cargo record.
  • Context - a cargo record contains us-ccn data:
    For Get US-CCN Information:
    When the system processes cargo identification information, then us-ccn information is retrieved from the cargo record.
  • Context - a cargo record contains content description information:
    For Retrieve Content Description:
    When the system processes cargo details for email content, then content description is retrieved from the cargo record.
  • Context - a cargo record contains origin station reference:
    For Get Origin Station Information:
    When the system processes station information for email content, then origin station details are retrieved from station information tables.
  • Context - a cargo record contains destination station reference:
    For Get Destination Station Information:
    When the system processes station information for email content, then destination station details are retrieved from station information tables.
  • Context - origin and destination station information has been retrieved:
    For Format Station Names and Codes:
    When the system formats station information for display, then station names and codes are formatted according to business display standards.
  • Context - a cargo record contains disposition code reference:
    For Retrieve Disposition Code Details:
    When the system processes disposition information for email content, then disposition code details are retrieved from disposition code tables.
  • Context - disposition code details have been retrieved:
    For Format Disposition Description:
    When the system formats disposition information for display, then disposition description is formatted according to business display standards.
  • Context - email content is being created:
    For Get Processing Date and Time:
    When the system processes timestamp information, then current processing date and time are retrieved for email content.
  • Context - all cargo and disposition information has been retrieved and formatted:
    For Build Email Subject Line:
    When the system builds the email subject line, then email subject line is constructed with relevant cargo and disposition details.
  • Context - email subject line has been constructed:
    For Create Email Header Section:
    When the system creates the email header section, then email header section is created with identification and routing information.
  • Context - email header section has been created and equipment information is formatted:
    For Add Equipment Details Section:
    When the system adds equipment details to email content, then equipment details section is added with car id and equipment type information.
  • Context - equipment details section has been added and cargo information is available:
    For Add Cargo Information Section:
    When the system adds cargo information to email content, then cargo information section is added with waybill, us-ccn, and content description.
  • Context - cargo information section has been added and station information is formatted:
    For Add Station Information Section:
    When the system adds station information to email content, then station information section is added with origin and destination station details.
  • Context - station information section has been added and disposition information is formatted:
    For Add Disposition Information Section:
    When the system adds disposition information to email content, then disposition information section is added with disposition code and description.
  • Context - disposition information section has been added and processing date/time is available:
    For Add Processing Timestamp:
    When the system adds timestamp to email content, then processing timestamp is added to email content for tracking purposes.
  • Context - all email sections have been added including timestamp:
    For Finalize Email Content:
    When the system finalizes email content, then email content is finalized with proper formatting and ready for distribution.
  • Context - email content has been finalized:
    For Email Content Ready for Distribution:
    When the system prepares email for distribution, then email content is confirmed ready for distribution to appropriate recipients.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with equipment information
GIVEN
A cargo record exists with equipment information
Applied to: Retrieve Equipment Information
WHEN
The system processes email content creation
THEN
Equipment details are retrieved from the cargo segment data
Context: Equipment information has been retrieved from cargo data
GIVEN
Equipment information has been retrieved from cargo data
Applied to: Format Car ID and Equipment Type
WHEN
The system formats the equipment details
THEN
Car ID and equipment type are formatted according to business display standards
Context: A cargo record contains waybill information
GIVEN
A cargo record contains waybill information
Applied to: Retrieve Waybill Number
WHEN
The system processes cargo information for email content
THEN
The waybill number is retrieved from the cargo record
Context: A cargo record contains US-CCN data
GIVEN
A cargo record contains US-CCN data
Applied to: Get US-CCN Information
WHEN
The system processes cargo identification information
THEN
US-CCN information is retrieved from the cargo record
Context: A cargo record contains content description information
GIVEN
A cargo record contains content description information
Applied to: Retrieve Content Description
WHEN
The system processes cargo details for email content
THEN
Content description is retrieved from the cargo record
Context: A cargo record contains origin station reference
GIVEN
A cargo record contains origin station reference
Applied to: Get Origin Station Information
WHEN
The system processes station information for email content
THEN
Origin station details are retrieved from station information tables
Context: A cargo record contains destination station reference
GIVEN
A cargo record contains destination station reference
Applied to: Get Destination Station Information
WHEN
The system processes station information for email content
THEN
Destination station details are retrieved from station information tables
Context: Origin and destination station information has been retrieved
GIVEN
Origin and destination station information has been retrieved
Applied to: Format Station Names and Codes
WHEN
The system formats station information for display
THEN
Station names and codes are formatted according to business display standards
Context: A cargo record contains disposition code reference
GIVEN
A cargo record contains disposition code reference
Applied to: Retrieve Disposition Code Details
WHEN
The system processes disposition information for email content
THEN
Disposition code details are retrieved from disposition code tables
Context: Disposition code details have been retrieved
GIVEN
Disposition code details have been retrieved
Applied to: Format Disposition Description
WHEN
The system formats disposition information for display
THEN
Disposition description is formatted according to business display standards
Context: Email content is being created
GIVEN
Email content is being created
Applied to: Get Processing Date and Time
WHEN
The system processes timestamp information
THEN
Current processing date and time are retrieved for email content
Context: All cargo and disposition information has been retrieved and formatted
GIVEN
All cargo and disposition information has been retrieved and formatted
Applied to: Build Email Subject Line
WHEN
The system builds the email subject line
THEN
Email subject line is constructed with relevant cargo and disposition details
Context: Email subject line has been constructed
GIVEN
Email subject line has been constructed
Applied to: Create Email Header Section
WHEN
The system creates the email header section
THEN
Email header section is created with identification and routing information
Context: Email header section has been created and equipment information is formatted
GIVEN
Email header section has been created and equipment information is formatted
Applied to: Add Equipment Details Section
WHEN
The system adds equipment details to email content
THEN
Equipment details section is added with car ID and equipment type information
Context: Equipment details section has been added and cargo information is available
GIVEN
Equipment details section has been added and cargo information is available
Applied to: Add Cargo Information Section
WHEN
The system adds cargo information to email content
THEN
Cargo information section is added with waybill, US-CCN, and content description
Context: Cargo information section has been added and station information is formatted
GIVEN
Cargo information section has been added and station information is formatted
Applied to: Add Station Information Section
WHEN
The system adds station information to email content
THEN
Station information section is added with origin and destination station details
Context: Station information section has been added and disposition information is formatted
GIVEN
Station information section has been added and disposition information is formatted
Applied to: Add Disposition Information Section
WHEN
The system adds disposition information to email content
THEN
Disposition information section is added with disposition code and description
Context: Disposition information section has been added and processing date/time is available
GIVEN
Disposition information section has been added and processing date/time is available
Applied to: Add Processing Timestamp
WHEN
The system adds timestamp to email content
THEN
Processing timestamp is added to email content for tracking purposes
Context: All email sections have been added including timestamp
GIVEN
All email sections have been added including timestamp
Applied to: Finalize Email Content
WHEN
The system finalizes email content
THEN
Email content is finalized with proper formatting and ready for distribution
Context: Email content has been finalized
GIVEN
Email content has been finalized
Applied to: Email Content Ready for Distribution
WHEN
The system prepares email for distribution
THEN
Email content is confirmed ready for distribution to appropriate recipients
R-GCX016E-cbl-03084 (+10) File: GCX016E.cbl Message Recipient Determination Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Recipient Determination':
  • Context - a message requires recipient determination:
    For AD Segment Available?:
    When the system evaluates ad segment availability, then the system identifies whether ad segment configuration exists for recipient lookup.
  • Context - ad segment is available for the message:
    For Read AD Segment Configuration:
    When the system reads the ad segment configuration, then the system loads the recipient configuration data from the ad segment.
  • Context - ad segment configuration has been read successfully:
    For Extract Recipient Information:
    When the system processes the configuration data, then the system extracts recipient identification and routing information.
  • Context - recipient information has been extracted from ad segment:
    For Valid Recipient Found?:
    When the system evaluates the extracted recipient data, then the system determines if a valid recipient identifier exists.
  • Context - either no ad segment is available or no valid recipient was found in ad segment:
    For Set Default Recipient OM01247:
    When the system applies default recipient logic, then the system sets om01247 as the message recipient.
  • Context - a valid recipient was found in the ad segment configuration:
    For Validate Recipient Format:
    When the system validates the recipient format, then the system verifies the recipient identifier meets required format standards.
  • Context - recipient format validation has been performed:
    For Recipient Valid?:
    When the system evaluates validation results, then the system confirms whether the recipient identifier is valid for message routing.
  • Context - the recipient identifier has passed format validation:
    For Use Configured Recipient:
    When the system finalizes recipient selection, then the system uses the configured recipient from the ad segment for message delivery.
  • Context - the recipient identifier failed format validation:
    For Generate Invalid Recipient Error:
    When the system processes the validation failure, then the system generates an invalid recipient error and initiates rerouting logic.
  • Context - an invalid recipient error has been generated:
    For Apply Rerouting Logic:
    When the system applies rerouting logic, then the system redirects the message to alternative routing paths to ensure delivery.
  • Context - either a configured recipient is validated or default recipient is assigned:
    For Set Final Message Recipient:
    When the system completes recipient determination process, then the system sets the final message recipient for delivery routing.
👨‍💻 Technical ACs (Gherkin)
Context: A message requires recipient determination
GIVEN
A message requires recipient determination
Applied to: AD Segment Available?
WHEN
The system evaluates AD segment availability
THEN
The system identifies whether AD segment configuration exists for recipient lookup
Context: AD segment is available for the message
GIVEN
AD segment is available for the message
Applied to: Read AD Segment Configuration
WHEN
The system reads the AD segment configuration
THEN
The system loads the recipient configuration data from the AD segment
Context: AD segment configuration has been read successfully
GIVEN
AD segment configuration has been read successfully
Applied to: Extract Recipient Information
WHEN
The system processes the configuration data
THEN
The system extracts recipient identification and routing information
Context: Recipient information has been extracted from AD segment
GIVEN
Recipient information has been extracted from AD segment
Applied to: Valid Recipient Found?
WHEN
The system evaluates the extracted recipient data
THEN
The system determines if a valid recipient identifier exists
Context: Either no AD segment is available or no valid recipient was found in AD segment
GIVEN
Either no AD segment is available or no valid recipient was found in AD segment
Applied to: Set Default Recipient OM01247
WHEN
The system applies default recipient logic
THEN
The system sets OM01247 as the message recipient
Context: A valid recipient was found in the AD segment configuration
GIVEN
A valid recipient was found in the AD segment configuration
Applied to: Validate Recipient Format
WHEN
The system validates the recipient format
THEN
The system verifies the recipient identifier meets required format standards
Context: Recipient format validation has been performed
GIVEN
Recipient format validation has been performed
Applied to: Recipient Valid?
WHEN
The system evaluates validation results
THEN
The system confirms whether the recipient identifier is valid for message routing
Context: The recipient identifier has passed format validation
GIVEN
The recipient identifier has passed format validation
Applied to: Use Configured Recipient
WHEN
The system finalizes recipient selection
THEN
The system uses the configured recipient from the AD segment for message delivery
Context: The recipient identifier failed format validation
GIVEN
The recipient identifier failed format validation
Applied to: Generate Invalid Recipient Error
WHEN
The system processes the validation failure
THEN
The system generates an invalid recipient error and initiates rerouting logic
Context: An invalid recipient error has been generated
GIVEN
An invalid recipient error has been generated
Applied to: Apply Rerouting Logic
WHEN
The system applies rerouting logic
THEN
The system redirects the message to alternative routing paths to ensure delivery
Context: Either a configured recipient is validated or default recipient is assigned
GIVEN
Either a configured recipient is validated or default recipient is assigned
Applied to: Set Final Message Recipient
WHEN
The system completes recipient determination process
THEN
The system sets the final message recipient for delivery routing
R-GCX016E-cbl-03115 (+13) File: GCX016E.cbl Foreign Cargo Record Setup Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Foreign Cargo Record Setup':
  • Context - a foreign cargo processing request is initiated:
    For Initialize New Cargo Record Structure:
    When the system begins foreign cargo record setup, then a new cargo record structure is initialized with default values and prepared for data population.
  • Context - an n7 segment containing equipment data is available:
    For Extract Equipment Data from N7 Segment:
    When the system processes the n7 segment for foreign cargo setup, then equipment information including equipment initial and number are extracted and prepared for cargo record population.
  • Context - equipment data has been extracted from n7 segment:
    For Set Car ID and Equipment Type:
    When the system processes equipment information for cargo record setup, then car id is formatted by combining equipment initial and number, and equipment type is assigned to the cargo record.
  • Context - an x4 segment containing cargo disposition data is available:
    For Extract Cargo Data from X4 Segment:
    When the system processes the x4 segment for foreign cargo setup, then cargo data including waybill number, quantities, and disposition information are extracted for cargo record population.
  • Context - cargo data has been extracted from x4 segment:
    For Set Waybill Number and Quantities:
    When the system processes waybill and quantity information, then waybill number and cargo quantities are assigned to the appropriate fields in the cargo record.
  • Context - disposition code data has been extracted from x4 segment:
    For Set Disposition Code Information:
    When the system processes disposition information for cargo setup, then disposition code information is assigned to the cargo record for subsequent processing and status tracking.
  • Context - an m10 segment containing manifest data is available:
    For Build Foreign Manifest from M10 Segment:
    When the system processes manifest information for foreign cargo setup, then foreign manifest information is extracted and prepared for cargo record population including transport and vessel details.
  • Context - manifest data from m10 segment is being processed:
    For Extract SCAC Code:
    When the system extracts carrier identification information, then scac code is extracted and assigned to identify the transportation carrier for the foreign cargo.
  • Context - manifest information has been processed from m10 segment:
    For Set Transport Type:
    When the system determines transport method for foreign cargo, then transport type is assigned to the cargo record based on the mode of transportation indicated in the manifest.
  • Context - foreign cargo manifest information is being processed:
    For Set Country Code:
    When the system determines country of origin, then country code is assigned to the cargo record to identify the foreign origin country.
  • Context - transport type and manifest information have been processed:
    For Set Vessel/Train Details:
    When the system assigns conveyance details to foreign cargo, then vessel or train identification details are assigned to the cargo record based on the transport method.
  • Context - car id information has been assembled from equipment data:
    For Format Car ID for Database:
    When the system prepares car id for database storage, then car id is formatted according to database requirements for proper storage and future retrieval operations.
  • Context - a complete foreign cargo record has been assembled with all required data:
    For Insert New Cargo Record to Database:
    When the system stores the new cargo record, then the foreign cargo record is inserted into the gcsusrt us cargo database for subsequent processing and status tracking.
  • Context - a new foreign cargo record has been successfully inserted into the database:
    For Log Cargo Creation Action:
    When the system completes cargo record creation, then the cargo creation action is logged with appropriate details for audit trail and processing history tracking.
👨‍💻 Technical ACs (Gherkin)
Context: A foreign cargo processing request is initiated
GIVEN
A foreign cargo processing request is initiated
Applied to: Initialize New Cargo Record Structure
WHEN
The system begins foreign cargo record setup
THEN
A new cargo record structure is initialized with default values and prepared for data population
Context: An N7 segment containing equipment data is available
GIVEN
An N7 segment containing equipment data is available
Applied to: Extract Equipment Data from N7 Segment
WHEN
The system processes the N7 segment for foreign cargo setup
THEN
Equipment information including equipment initial and number are extracted and prepared for cargo record population
Context: Equipment data has been extracted from N7 segment
GIVEN
Equipment data has been extracted from N7 segment
Applied to: Set Car ID and Equipment Type
WHEN
The system processes equipment information for cargo record setup
THEN
Car ID is formatted by combining equipment initial and number, and equipment type is assigned to the cargo record
Context: An X4 segment containing cargo disposition data is available
GIVEN
An X4 segment containing cargo disposition data is available
Applied to: Extract Cargo Data from X4 Segment
WHEN
The system processes the X4 segment for foreign cargo setup
THEN
Cargo data including waybill number, quantities, and disposition information are extracted for cargo record population
Context: Cargo data has been extracted from X4 segment
GIVEN
Cargo data has been extracted from X4 segment
Applied to: Set Waybill Number and Quantities
WHEN
The system processes waybill and quantity information
THEN
Waybill number and cargo quantities are assigned to the appropriate fields in the cargo record
Context: Disposition code data has been extracted from X4 segment
GIVEN
Disposition code data has been extracted from X4 segment
Applied to: Set Disposition Code Information
WHEN
The system processes disposition information for cargo setup
THEN
Disposition code information is assigned to the cargo record for subsequent processing and status tracking
Context: An M10 segment containing manifest data is available
GIVEN
An M10 segment containing manifest data is available
Applied to: Build Foreign Manifest from M10 Segment
WHEN
The system processes manifest information for foreign cargo setup
THEN
Foreign manifest information is extracted and prepared for cargo record population including transport and vessel details
Context: Manifest data from M10 segment is being processed
GIVEN
Manifest data from M10 segment is being processed
Applied to: Extract SCAC Code
WHEN
The system extracts carrier identification information
THEN
SCAC code is extracted and assigned to identify the transportation carrier for the foreign cargo
Context: Manifest information has been processed from M10 segment
GIVEN
Manifest information has been processed from M10 segment
Applied to: Set Transport Type
WHEN
The system determines transport method for foreign cargo
THEN
Transport type is assigned to the cargo record based on the mode of transportation indicated in the manifest
Context: Foreign cargo manifest information is being processed
GIVEN
Foreign cargo manifest information is being processed
Applied to: Set Country Code
WHEN
The system determines country of origin
THEN
Country code is assigned to the cargo record to identify the foreign origin country
Context: Transport type and manifest information have been processed
GIVEN
Transport type and manifest information have been processed
Applied to: Set Vessel/Train Details
WHEN
The system assigns conveyance details to foreign cargo
THEN
Vessel or train identification details are assigned to the cargo record based on the transport method
Context: Car ID information has been assembled from equipment data
GIVEN
Car ID information has been assembled from equipment data
Applied to: Format Car ID for Database
WHEN
The system prepares car ID for database storage
THEN
Car ID is formatted according to database requirements for proper storage and future retrieval operations
Context: A complete foreign cargo record has been assembled with all required data
GIVEN
A complete foreign cargo record has been assembled with all required data
Applied to: Insert New Cargo Record to Database
WHEN
The system stores the new cargo record
THEN
The foreign cargo record is inserted into the GCSUSRT US cargo database for subsequent processing and status tracking
Context: A new foreign cargo record has been successfully inserted into the database
GIVEN
A new foreign cargo record has been successfully inserted into the database
Applied to: Log Cargo Creation Action
WHEN
The system completes cargo record creation
THEN
The cargo creation action is logged with appropriate details for audit trail and processing history tracking
R-GCX016E-cbl-03129 (+18) File: GCX016E.cbl Apply CPRS Special Processing Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply CPRS Special Processing':
  • Context - a train record is being processed for arrival or departure:
    For Train ID Contains CPRS Indicator?:
    When the system evaluates the train id for cprs indicators or canadian pacific railway naming conventions, then the system routes the train to cprs-specific processing if indicators are found, otherwise processes as regular train.
  • Context - a train has been identified as a cprs train:
    For Apply CPRS Naming Conventions:
    When the system processes the train identification, then the system applies cprs naming conventions and formats the train id according to canadian pacific railway standards.
  • Context - a cprs train id has been formatted according to naming conventions:
    For Validate CPRS Train Format:
    When the system validates the train format against cprs standards, then the system confirms the train id meets canadian pacific railway formatting requirements or flags format violations.
  • Context - a validated cprs train id is ready for processing:
    For CPRS Train Found in System?:
    When the system searches the gcwtl train data for the cprs train, then the system either finds the train record and proceeds with normal processing or generates a train not found error.
  • Context - a cprs train id has been validated but not found in the train data system:
    For Generate CPRS Train Not Found Error:
    When the system cannot locate the train in gcwtl train data, then the system generates a train not found error message and continues with cargo lookup processing.
  • Context - cprs train processing has been initiated (whether train was found or not):
    For CPRS Cargo Lookup by Car ID:
    When the system searches gcsusrt cargo records using the car id from the n7 segment, then the system identifies existing cprs cargo records or determines that new cargo records need to be created.
  • Context - cprs cargo records have been found in the system for the specified car id:
    For Process Existing CPRS Cargo:
    When the system processes the existing cargo records, then the system updates the existing cprs cargo with new disposition codes, status changes, and associated processing.
  • Context - no existing cprs cargo records are found for the specified car id:
    For Create New CPRS Cargo Record:
    When the system needs to process new cprs cargo, then the system creates new cargo records in gcsusrt with appropriate cprs-specific attributes and initial status.
  • Context - cprs cargo records are ready for bond processing (either existing or newly created):
    For Apply CPRS Bond Processing Rules:
    When the system applies cprs bond processing rules from gcstbrt bond tables, then the system processes bonds according to canadian pacific railway requirements and cross-border regulations.
  • Context - cprs bond processing rules have been applied to the cargo:
    For Set CPRS Special Flags:
    When the system configures cprs-specific processing flags, then the system sets appropriate flags for canadian pacific railway processing, cross-border handling, and special routing requirements.
  • Context - cprs special flags have been configured for the cargo:
    For Handle CPRS Cross-Border Validation:
    When the system performs cross-border validation for canadian pacific railway operations, then the system validates compliance with cross-border regulations and determines if canadian border crossing processing is required.
  • Context - cprs cross-border validation has been completed:
    For Canadian Border Crossing?:
    When the system evaluates routing information to determine border crossing requirements, then the system identifies canadian border crossings and routes to appropriate location mapping or proceeds to bond information processing.
  • Context - a canadian border crossing has been identified for cprs cargo:
    For Map US Port to Canadian Location:
    When the system maps us port information to canadian location equivalents using border location maps, then the system establishes proper location mapping for cross-border processing and routing validation.
  • Context - us port to canadian location mapping has been completed:
    For Validate CPRS Routing Rules:
    When the system validates routing against cprs routing rules and cross-border requirements, then the system confirms routing compliance and proceeds to bond information processing.
  • Context - cprs routing rules have been validated (either after border crossing mapping or direct validation):
    For Apply CPRS Bond Information:
    When the system applies cprs bond information to the cargo, then the system updates cargo records with appropriate canadian pacific railway bond details and requirements.
  • Context - cprs bond information has been applied to the cargo:
    For Set Canadian Pacific Railway Bond:
    When the system sets canadian pacific railway bond configuration, then the system establishes proper bond settings specific to canadian pacific railway requirements and generates bond creation messaging.
  • Context - canadian pacific railway bond has been configured:
    For Generate K1 Bond Creation Message:
    When the system generates bond creation messaging, then the system creates k1 segment messages documenting the bond creation for canadian pacific railway operations.
  • Context - k1 bond creation messages have been generated:
    For Update CPRS Cargo Status:
    When the system updates cprs cargo status, then the system sets appropriate status indicators reflecting completed canadian pacific railway processing and prepares for notification generation.
  • Context - cprs cargo status has been updated:
    For Send CPRS Notifications:
    When the system sends cprs processing notifications, then the system delivers appropriate notifications to stakeholders regarding canadian pacific railway cargo processing completion.
👨‍💻 Technical ACs (Gherkin)
Context: A train record is being processed for arrival or departure
GIVEN
A train record is being processed for arrival or departure
Applied to: Train ID Contains CPRS Indicator?
WHEN
The system evaluates the train ID for CPRS indicators or Canadian Pacific Railway naming conventions
THEN
The system routes the train to CPRS-specific processing if indicators are found, otherwise processes as regular train
Context: A train has been identified as a CPRS train
GIVEN
A train has been identified as a CPRS train
Applied to: Apply CPRS Naming Conventions
WHEN
The system processes the train identification
THEN
The system applies CPRS naming conventions and formats the train ID according to Canadian Pacific Railway standards
Context: A CPRS train ID has been formatted according to naming conventions
GIVEN
A CPRS train ID has been formatted according to naming conventions
Applied to: Validate CPRS Train Format
WHEN
The system validates the train format against CPRS standards
THEN
The system confirms the train ID meets Canadian Pacific Railway formatting requirements or flags format violations
Context: A validated CPRS train ID is ready for processing
GIVEN
A validated CPRS train ID is ready for processing
Applied to: CPRS Train Found in System?
WHEN
The system searches the GCWTL train data for the CPRS train
THEN
The system either finds the train record and proceeds with normal processing or generates a train not found error
Context: A CPRS train ID has been validated but not found in the train data system
GIVEN
A CPRS train ID has been validated but not found in the train data system
Applied to: Generate CPRS Train Not Found Error
WHEN
The system cannot locate the train in GCWTL train data
THEN
The system generates a train not found error message and continues with cargo lookup processing
Context: CPRS train processing has been initiated (whether train was found or not)
GIVEN
CPRS train processing has been initiated (whether train was found or not)
Applied to: CPRS Cargo Lookup by Car ID
WHEN
The system searches GCSUSRT cargo records using the car ID from the N7 segment
THEN
The system identifies existing CPRS cargo records or determines that new cargo records need to be created
Context: CPRS cargo records have been found in the system for the specified car ID
GIVEN
CPRS cargo records have been found in the system for the specified car ID
Applied to: Process Existing CPRS Cargo
WHEN
The system processes the existing cargo records
THEN
The system updates the existing CPRS cargo with new disposition codes, status changes, and associated processing
Context: No existing CPRS cargo records are found for the specified car ID
GIVEN
No existing CPRS cargo records are found for the specified car ID
Applied to: Create New CPRS Cargo Record
WHEN
The system needs to process new CPRS cargo
THEN
The system creates new cargo records in GCSUSRT with appropriate CPRS-specific attributes and initial status
Context: CPRS cargo records are ready for bond processing (either existing or newly created)
GIVEN
CPRS cargo records are ready for bond processing (either existing or newly created)
Applied to: Apply CPRS Bond Processing Rules
WHEN
The system applies CPRS bond processing rules from GCSTBRT bond tables
THEN
The system processes bonds according to Canadian Pacific Railway requirements and cross-border regulations
Context: CPRS bond processing rules have been applied to the cargo
GIVEN
CPRS bond processing rules have been applied to the cargo
Applied to: Set CPRS Special Flags
WHEN
The system configures CPRS-specific processing flags
THEN
The system sets appropriate flags for Canadian Pacific Railway processing, cross-border handling, and special routing requirements
Context: CPRS special flags have been configured for the cargo
GIVEN
CPRS special flags have been configured for the cargo
Applied to: Handle CPRS Cross-Border Validation
WHEN
The system performs cross-border validation for Canadian Pacific Railway operations
THEN
The system validates compliance with cross-border regulations and determines if Canadian border crossing processing is required
Context: CPRS cross-border validation has been completed
GIVEN
CPRS cross-border validation has been completed
Applied to: Canadian Border Crossing?
WHEN
The system evaluates routing information to determine border crossing requirements
THEN
The system identifies Canadian border crossings and routes to appropriate location mapping or proceeds to bond information processing
Context: A Canadian border crossing has been identified for CPRS cargo
GIVEN
A Canadian border crossing has been identified for CPRS cargo
Applied to: Map US Port to Canadian Location
WHEN
The system maps US port information to Canadian location equivalents using border location maps
THEN
The system establishes proper location mapping for cross-border processing and routing validation
Context: US port to Canadian location mapping has been completed
GIVEN
US port to Canadian location mapping has been completed
Applied to: Validate CPRS Routing Rules
WHEN
The system validates routing against CPRS routing rules and cross-border requirements
THEN
The system confirms routing compliance and proceeds to bond information processing
Context: CPRS routing rules have been validated (either after border crossing mapping or direct validation)
GIVEN
CPRS routing rules have been validated (either after border crossing mapping or direct validation)
Applied to: Apply CPRS Bond Information
WHEN
The system applies CPRS bond information to the cargo
THEN
The system updates cargo records with appropriate Canadian Pacific Railway bond details and requirements
Context: CPRS bond information has been applied to the cargo
GIVEN
CPRS bond information has been applied to the cargo
Applied to: Set Canadian Pacific Railway Bond
WHEN
The system sets Canadian Pacific Railway bond configuration
THEN
The system establishes proper bond settings specific to Canadian Pacific Railway requirements and generates bond creation messaging
Context: Canadian Pacific Railway bond has been configured
GIVEN
Canadian Pacific Railway bond has been configured
Applied to: Generate K1 Bond Creation Message
WHEN
The system generates bond creation messaging
THEN
The system creates K1 segment messages documenting the bond creation for Canadian Pacific Railway operations
Context: K1 bond creation messages have been generated
GIVEN
K1 bond creation messages have been generated
Applied to: Update CPRS Cargo Status
WHEN
The system updates CPRS cargo status
THEN
The system sets appropriate status indicators reflecting completed Canadian Pacific Railway processing and prepares for notification generation
Context: CPRS cargo status has been updated
GIVEN
CPRS cargo status has been updated
Applied to: Send CPRS Notifications
WHEN
The system sends CPRS processing notifications
THEN
The system delivers appropriate notifications to stakeholders regarding Canadian Pacific Railway cargo processing completion
R-GCX016E-cbl-03148 (+10) File: GCX016E.cbl Validate Status Code Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Status Code':
  • Context - a cargo identification number is provided for processing:
    For Retrieve Cargo Record:
    When the system needs to validate cargo status, then the cargo record is retrieved from the us cargo root database.
  • Context - a cargo record has been retrieved from the database:
    For Cargo Status Code Check:
    When the system examines the cargo status code field, then the status code is validated against acceptable values for processing eligibility.
  • Context - a cargo record with status code information is available:
    For Check Deleted Status:
    When the system checks the cargo deletion status indicator, then the cargo is identified as deleted or active based on the status flag.
  • Context - a cargo record has been checked for deletion status:
    For Is Cargo Deleted?:
    When the cargo is marked as deleted, then the cargo is excluded from processing and marked as invalid for operations.
  • Context - a cargo record is not marked as deleted:
    For Check New Bond Creation Status:
    When the system examines the bond creation status, then the new bond creation flag is evaluated to determine processing eligibility.
  • Context - a cargo record has been checked for new bond creation status:
    For New Bond Created?:
    When the cargo is associated with a newly created bond, then the cargo is excluded from processing to prevent conflicts with bond creation procedures.
  • Context - a cargo record is not deleted and not associated with a new bond creation:
    For Verify Active Status:
    When the system verifies the active status of the cargo, then the cargo active status is confirmed against business rules for processing eligibility.
  • Context - a cargo record has been verified for active status:
    For Is Status Active?:
    When the cargo status is confirmed as active, then the cargo is marked as valid for processing operations.
  • Context - a cargo record has passed all validation checks including deletion status, bond creation status, and active status:
    For Mark as Valid for Processing:
    When all validation criteria are met, then the cargo is marked as valid and approved for subsequent processing operations.
  • Context - cargo status validation has been completed with either valid or invalid result:
    For Log Validation Result:
    When the validation process concludes, then the validation result is logged with cargo identification and validation outcome details.
  • Context - cargo status validation has been completed and results have been logged:
    For Continue with Cargo Processing:
    When the cargo is marked as valid for processing, then the system continues with the next phase of cargo processing operations.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo identification number is provided for processing
GIVEN
A cargo identification number is provided for processing
Applied to: Retrieve Cargo Record
WHEN
The system needs to validate cargo status
THEN
The cargo record is retrieved from the US Cargo Root database
Context: A cargo record has been retrieved from the database
GIVEN
A cargo record has been retrieved from the database
Applied to: Cargo Status Code Check
WHEN
The system examines the cargo status code field
THEN
The status code is validated against acceptable values for processing eligibility
Context: A cargo record with status code information is available
GIVEN
A cargo record with status code information is available
Applied to: Check Deleted Status
WHEN
The system checks the cargo deletion status indicator
THEN
The cargo is identified as deleted or active based on the status flag
Context: A cargo record has been checked for deletion status
GIVEN
A cargo record has been checked for deletion status
Applied to: Is Cargo Deleted?
WHEN
The cargo is marked as deleted
THEN
The cargo is excluded from processing and marked as invalid for operations
Context: A cargo record is not marked as deleted
GIVEN
A cargo record is not marked as deleted
Applied to: Check New Bond Creation Status
WHEN
The system examines the bond creation status
THEN
The new bond creation flag is evaluated to determine processing eligibility
Context: A cargo record has been checked for new bond creation status
GIVEN
A cargo record has been checked for new bond creation status
Applied to: New Bond Created?
WHEN
The cargo is associated with a newly created bond
THEN
The cargo is excluded from processing to prevent conflicts with bond creation procedures
Context: A cargo record is not deleted and not associated with a new bond creation
GIVEN
A cargo record is not deleted and not associated with a new bond creation
Applied to: Verify Active Status
WHEN
The system verifies the active status of the cargo
THEN
The cargo active status is confirmed against business rules for processing eligibility
Context: A cargo record has been verified for active status
GIVEN
A cargo record has been verified for active status
Applied to: Is Status Active?
WHEN
The cargo status is confirmed as active
THEN
The cargo is marked as valid for processing operations
Context: A cargo record has passed all validation checks including deletion status, bond creation status, and active status
GIVEN
A cargo record has passed all validation checks including deletion status, bond creation status, and active status
Applied to: Mark as Valid for Processing
WHEN
All validation criteria are met
THEN
The cargo is marked as valid and approved for subsequent processing operations
Context: Cargo status validation has been completed with either valid or invalid result
GIVEN
Cargo status validation has been completed with either valid or invalid result
Applied to: Log Validation Result
WHEN
The validation process concludes
THEN
The validation result is logged with cargo identification and validation outcome details
Context: Cargo status validation has been completed and results have been logged
GIVEN
Cargo status validation has been completed and results have been logged
Applied to: Continue with Cargo Processing
WHEN
The cargo is marked as valid for processing
THEN
The system continues with the next phase of cargo processing operations
R-GCX016E-cbl-03159 (+9) File: GCX016E.cbl Handle CPRS Special Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle CPRS Special Processing':
  • Context - cprs traffic has been identified for processing:
    For SCAC Code Available?:
    When the system checks for scac code availability, then if scac code is available, use existing scac code, otherwise set scac as unknown.
  • Context - cprs traffic processing is initiated and scac code status is determined:
    For Search Cargo by Car ID:
    When the system searches for cargo records using car id, then retrieve matching cargo records based on car identification number.
  • Context - car id search has been performed for cprs cargo:
    For Cargo Found?:
    When the system evaluates search results, then if cargo record is found, use existing cargo record, otherwise proceed to us-ccn key requirements check.
  • Context - no existing cargo record was found and us-ccn key requirements are being checked:
    For US-CCN Key Renumbering Needed?:
    When the system evaluates us-ccn key renumbering requirements, then if renumbering is needed, renumber us-ccn key, otherwise keep original us-ccn key.
  • Context - us-ccn key renumbering has been determined as necessary:
    For Renumber US-CCN Key:
    When the system performs key renumbering, then generate new us-ccn key value and update cargo identification.
  • Context - us-ccn key processing is complete for new cprs cargo:
    For Apply CPRS Cargo Creation Rules:
    When the system applies cprs-specific cargo creation rules, then enforce cprs business rules and validation requirements for cargo creation.
  • Context - cprs cargo creation rules have been applied successfully:
    For Create New CPRS Cargo Record:
    When the system creates new cprs cargo record, then establish new cargo record with cprs-specific data structure and attributes.
  • Context - new cprs cargo record has been created:
    For Initialize CPRS-Specific Fields:
    When the system initializes cprs-specific fields, then set default values and initialize all cprs-required data fields.
  • Context - cprs-specific fields have been initialized:
    For Set CPRS Processing Flags:
    When the system sets cprs processing flags, then activate flags that control cprs-specific processing behavior throughout the system.
  • Context - cprs processing flags have been configured:
    For Log CPRS Special Processing:
    When the system logs cprs special processing, then create audit trail entries documenting cprs-specific processing actions and decisions.
👨‍💻 Technical ACs (Gherkin)
Context: CPRS traffic has been identified for processing
GIVEN
CPRS traffic has been identified for processing
Applied to: SCAC Code Available?
WHEN
the system checks for SCAC code availability
THEN
if SCAC code is available, use existing SCAC code, otherwise set SCAC as unknown
Context: CPRS traffic processing is initiated and SCAC code status is determined
GIVEN
CPRS traffic processing is initiated and SCAC code status is determined
Applied to: Search Cargo by Car ID
WHEN
the system searches for cargo records using car ID
THEN
retrieve matching cargo records based on car identification number
Context: car ID search has been performed for CPRS cargo
GIVEN
car ID search has been performed for CPRS cargo
Applied to: Cargo Found?
WHEN
the system evaluates search results
THEN
if cargo record is found, use existing cargo record, otherwise proceed to US-CCN key requirements check
Context: no existing cargo record was found and US-CCN key requirements are being checked
GIVEN
no existing cargo record was found and US-CCN key requirements are being checked
Applied to: US-CCN Key Renumbering Needed?
WHEN
the system evaluates US-CCN key renumbering requirements
THEN
if renumbering is needed, renumber US-CCN key, otherwise keep original US-CCN key
Context: US-CCN key renumbering has been determined as necessary
GIVEN
US-CCN key renumbering has been determined as necessary
Applied to: Renumber US-CCN Key
WHEN
the system performs key renumbering
THEN
generate new US-CCN key value and update cargo identification
Context: US-CCN key processing is complete for new CPRS cargo
GIVEN
US-CCN key processing is complete for new CPRS cargo
Applied to: Apply CPRS Cargo Creation Rules
WHEN
the system applies CPRS-specific cargo creation rules
THEN
enforce CPRS business rules and validation requirements for cargo creation
Context: CPRS cargo creation rules have been applied successfully
GIVEN
CPRS cargo creation rules have been applied successfully
Applied to: Create New CPRS Cargo Record
WHEN
the system creates new CPRS cargo record
THEN
establish new cargo record with CPRS-specific data structure and attributes
Context: new CPRS cargo record has been created
GIVEN
new CPRS cargo record has been created
Applied to: Initialize CPRS-Specific Fields
WHEN
the system initializes CPRS-specific fields
THEN
set default values and initialize all CPRS-required data fields
Context: CPRS-specific fields have been initialized
GIVEN
CPRS-specific fields have been initialized
Applied to: Set CPRS Processing Flags
WHEN
the system sets CPRS processing flags
THEN
activate flags that control CPRS-specific processing behavior throughout the system
Context: CPRS processing flags have been configured
GIVEN
CPRS processing flags have been configured
Applied to: Log CPRS Special Processing
WHEN
the system logs CPRS special processing
THEN
create audit trail entries documenting CPRS-specific processing actions and decisions
R-GCX016E-cbl-03169 (+26) File: GCX016E.cbl Counterpart Disposition Code Removal Logic Merged 27 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Counterpart Disposition Code Removal Logic':
  • Context - a new disposition code needs to be processed:
    For Start Counterpart Disposition Code Removal:
    When the counterpart removal process is initiated, then the system prepares to search the existing status array for conflicting codes.
  • Context - a disposition code processing request is received:
    For Receive New Disposition Code:
    When the new disposition code is provided to the system, then the system accepts the disposition code for counterpart analysis.
  • Context - a new disposition code is received and the s09a status array exists:
    For Search S09A Status Array for Existing Codes:
    When the system searches for existing disposition codes in the status array, then all existing disposition codes in the array are identified and made available for conflict analysis.
  • Context - the status array has been searched and existing codes are identified:
    For Conflicting Codes Found?:
    When the system compares the new disposition code against existing codes, then the system determines whether conflicting codes exist and proceeds accordingly.
  • Context - conflicting disposition codes have been found in the status array:
    For Identify Counterpart Code Types:
    When the system analyzes the conflicting codes, then each conflicting code is classified by type (hold, release, proceed, cancel, arrival, export) for targeted removal.
  • Context - counterpart code types have been identified:
    For Code Type Analysis:
    When the system performs code type analysis, then the system determines the specific removal action based on code type relationships.
  • Context - a release disposition code is being added and hold codes exist in the status array:
    For Remove Hold Codes if Release Code Added:
    When the system processes the release code addition, then all conflicting hold disposition codes are removed from the status array.
  • Context - a hold disposition code is being added and release codes exist in the status array:
    For Remove Release Codes if Hold Code Added:
    When the system processes the hold code addition, then all conflicting release disposition codes are removed from the status array.
  • Context - a cancel disposition code is being added and proceed codes exist in the status array:
    For Remove Proceed Codes if Cancel Code Added:
    When the system processes the cancel code addition, then all conflicting proceed disposition codes are removed from the status array.
  • Context - a cancel arrival disposition code is being added and arrival codes exist in the status array:
    For Remove Arrival Codes if Cancel Arrival Added:
    When the system processes the cancel arrival code addition, then all conflicting arrival disposition codes are removed from the status array.
  • Context - a cancel export disposition code is being added and export codes exist in the status array:
    For Remove Export Codes if Cancel Export Added:
    When the system processes the cancel export code addition, then all conflicting export disposition codes are removed from the status array.
  • Context - disposition codes have been removed from the status array creating gaps:
    For Compress Status Array:
    When the system compresses the status array, then all remaining disposition codes are moved to eliminate gaps and maintain array continuity.
  • Context - the status array has been compressed after code removal:
    For Update Array Sequence Numbers:
    When the system updates sequence numbers, then all remaining disposition codes are assigned sequential numbers starting from 1.
  • Context - the status array has been modified through code removal and compression:
    For Validate Array Integrity:
    When the system validates array integrity, then the array structure is verified for proper sequence numbers, valid codes, and data consistency.
  • Context - array integrity validation has been performed:
    For Array Valid?:
    When the system checks array validity, then the system determines whether the array is valid and proceeds with success or error handling.
  • Context - counterpart disposition codes have been successfully removed and the array is valid:
    For Log Removal Action:
    When the system logs the removal action, then a record of the removed codes and the removal reason is created for audit purposes.
  • Context - the counterpart disposition code removal process has completed successfully:
    For Return Success Status:
    When the system returns success status, then control is returned to the calling process with a successful completion indicator.
  • Context - array validation has failed during the counterpart removal process:
    For Generate Error Message:
    When the system generates an error message, then an appropriate error message is created describing the validation failure.
  • Context - an error has occurred during counterpart code removal and an error message has been generated:
    For Restore Previous Array State:
    When the system restores the previous array state, then the status array is returned to its state before the counterpart removal attempt began.
  • Context - a new disposition code is being processed for a cargo and current status arrays exist with existing disposition codes:
    For Search for Conflicting Codes?:
    When the system needs to check for conflicting codes before adding the new disposition code, then the system searches through all existing disposition codes in the status arrays to identify potential conflicts.
  • Context - a search for conflicting codes has been initiated and existing disposition codes are found in status arrays:
    For Identify Counterpart Codes:
    When the system evaluates each existing disposition code against the new disposition code, then the system identifies which existing codes are counterparts that conflict with the new code based on predefined business relationships.
  • Context - counterpart disposition codes have been identified and business rules exist for code conflict resolution:
    For Evaluate Business Rules:
    When the system needs to determine if the conflicting code should be removed, then the system evaluates the business rules considering factors such as code hierarchy, timing, and business logic to make the removal decision.
  • Context - a conflicting disposition code has been identified and business rules determine it should be removed:
    For Remove Conflicting Code from Array:
    When the system processes the removal of the conflicting code, then the system removes the conflicting disposition code from the status array.
  • Context - a disposition code has been removed from the status array:
    For Update Status Array Sequence:
    When the status array structure needs to be maintained, then the system updates the array sequence numbers and reorganizes the remaining codes to maintain proper array structure.
    For Log Removal Action:
    When the removal action is completed, then the system logs the removal action including details of which code was removed and why.
  • Context - one disposition code has been processed for conflicts and there are additional codes in the status array:
    For More Codes to Check?:
    When the system completes processing of one code, then the system checks if there are more codes remaining to be evaluated and continues the conflict checking process if more codes exist.
  • Context - all disposition codes have been checked for conflicts and any necessary removals have been completed:
    For Continue with Status Processing:
    When the counterpart removal process is finished, then the system continues with the normal disposition code processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A new disposition code needs to be processed
GIVEN
A new disposition code needs to be processed
Applied to: Start Counterpart Disposition Code Removal
WHEN
The counterpart removal process is initiated
THEN
The system prepares to search the existing status array for conflicting codes
Context: A disposition code processing request is received
GIVEN
A disposition code processing request is received
Applied to: Receive New Disposition Code
WHEN
The new disposition code is provided to the system
THEN
The system accepts the disposition code for counterpart analysis
Context: A new disposition code is received and the S09A status array exists
GIVEN
A new disposition code is received and the S09A status array exists
Applied to: Search S09A Status Array for Existing Codes
WHEN
The system searches for existing disposition codes in the status array
THEN
All existing disposition codes in the array are identified and made available for conflict analysis
Context: The status array has been searched and existing codes are identified
GIVEN
The status array has been searched and existing codes are identified
Applied to: Conflicting Codes Found?
WHEN
The system compares the new disposition code against existing codes
THEN
The system determines whether conflicting codes exist and proceeds accordingly
Context: Conflicting disposition codes have been found in the status array
GIVEN
Conflicting disposition codes have been found in the status array
Applied to: Identify Counterpart Code Types
WHEN
The system analyzes the conflicting codes
THEN
Each conflicting code is classified by type (hold, release, proceed, cancel, arrival, export) for targeted removal
Context: Counterpart code types have been identified
GIVEN
Counterpart code types have been identified
Applied to: Code Type Analysis
WHEN
The system performs code type analysis
THEN
The system determines the specific removal action based on code type relationships
Context: A release disposition code is being added and hold codes exist in the status array
GIVEN
A release disposition code is being added and hold codes exist in the status array
Applied to: Remove Hold Codes if Release Code Added
WHEN
The system processes the release code addition
THEN
All conflicting hold disposition codes are removed from the status array
Context: A hold disposition code is being added and release codes exist in the status array
GIVEN
A hold disposition code is being added and release codes exist in the status array
Applied to: Remove Release Codes if Hold Code Added
WHEN
The system processes the hold code addition
THEN
All conflicting release disposition codes are removed from the status array
Context: A cancel disposition code is being added and proceed codes exist in the status array
GIVEN
A cancel disposition code is being added and proceed codes exist in the status array
Applied to: Remove Proceed Codes if Cancel Code Added
WHEN
The system processes the cancel code addition
THEN
All conflicting proceed disposition codes are removed from the status array
Context: A cancel arrival disposition code is being added and arrival codes exist in the status array
GIVEN
A cancel arrival disposition code is being added and arrival codes exist in the status array
Applied to: Remove Arrival Codes if Cancel Arrival Added
WHEN
The system processes the cancel arrival code addition
THEN
All conflicting arrival disposition codes are removed from the status array
Context: A cancel export disposition code is being added and export codes exist in the status array
GIVEN
A cancel export disposition code is being added and export codes exist in the status array
Applied to: Remove Export Codes if Cancel Export Added
WHEN
The system processes the cancel export code addition
THEN
All conflicting export disposition codes are removed from the status array
Context: Disposition codes have been removed from the status array creating gaps
GIVEN
Disposition codes have been removed from the status array creating gaps
Applied to: Compress Status Array
WHEN
The system compresses the status array
THEN
All remaining disposition codes are moved to eliminate gaps and maintain array continuity
Context: The status array has been compressed after code removal
GIVEN
The status array has been compressed after code removal
Applied to: Update Array Sequence Numbers
WHEN
The system updates sequence numbers
THEN
All remaining disposition codes are assigned sequential numbers starting from 1
Context: The status array has been modified through code removal and compression
GIVEN
The status array has been modified through code removal and compression
Applied to: Validate Array Integrity
WHEN
The system validates array integrity
THEN
The array structure is verified for proper sequence numbers, valid codes, and data consistency
Context: Array integrity validation has been performed
GIVEN
Array integrity validation has been performed
Applied to: Array Valid?
WHEN
The system checks array validity
THEN
The system determines whether the array is valid and proceeds with success or error handling
Context: Counterpart disposition codes have been successfully removed and the array is valid
GIVEN
Counterpart disposition codes have been successfully removed and the array is valid
Applied to: Log Removal Action
WHEN
The system logs the removal action
THEN
A record of the removed codes and the removal reason is created for audit purposes
Context: The counterpart disposition code removal process has completed successfully
GIVEN
The counterpart disposition code removal process has completed successfully
Applied to: Return Success Status
WHEN
The system returns success status
THEN
Control is returned to the calling process with a successful completion indicator
Context: Array validation has failed during the counterpart removal process
GIVEN
Array validation has failed during the counterpart removal process
Applied to: Generate Error Message
WHEN
The system generates an error message
THEN
An appropriate error message is created describing the validation failure
Context: An error has occurred during counterpart code removal and an error message has been generated
GIVEN
An error has occurred during counterpart code removal and an error message has been generated
Applied to: Restore Previous Array State
WHEN
The system restores the previous array state
THEN
The status array is returned to its state before the counterpart removal attempt began
Context: A new disposition code is being processed for a cargo AND current status arrays exist with existing disposition codes
GIVEN
A new disposition code is being processed for a cargo AND current status arrays exist with existing disposition codes
Applied to: Search for Conflicting Codes?
WHEN
The system needs to check for conflicting codes before adding the new disposition code
THEN
The system searches through all existing disposition codes in the status arrays to identify potential conflicts
Context: A search for conflicting codes has been initiated AND existing disposition codes are found in status arrays
GIVEN
A search for conflicting codes has been initiated AND existing disposition codes are found in status arrays
Applied to: Identify Counterpart Codes
WHEN
The system evaluates each existing disposition code against the new disposition code
THEN
The system identifies which existing codes are counterparts that conflict with the new code based on predefined business relationships
Context: Counterpart disposition codes have been identified AND business rules exist for code conflict resolution
GIVEN
Counterpart disposition codes have been identified AND business rules exist for code conflict resolution
Applied to: Evaluate Business Rules
WHEN
The system needs to determine if the conflicting code should be removed
THEN
The system evaluates the business rules considering factors such as code hierarchy, timing, and business logic to make the removal decision
Context: A conflicting disposition code has been identified AND business rules determine it should be removed
GIVEN
A conflicting disposition code has been identified AND business rules determine it should be removed
Applied to: Remove Conflicting Code from Array
WHEN
The system processes the removal of the conflicting code
THEN
The system removes the conflicting disposition code from the status array
Context: A disposition code has been removed from the status array
GIVEN
A disposition code has been removed from the status array
Applied to: Update Status Array Sequence
WHEN
The status array structure needs to be maintained
THEN
The system updates the array sequence numbers and reorganizes the remaining codes to maintain proper array structure
Applied to: Log Removal Action
WHEN
The removal action is completed
THEN
The system logs the removal action including details of which code was removed and why
Context: One disposition code has been processed for conflicts AND there are additional codes in the status array
GIVEN
One disposition code has been processed for conflicts AND there are additional codes in the status array
Applied to: More Codes to Check?
WHEN
The system completes processing of one code
THEN
The system checks if there are more codes remaining to be evaluated and continues the conflict checking process if more codes exist
Context: All disposition codes have been checked for conflicts AND any necessary removals have been completed
GIVEN
All disposition codes have been checked for conflicts AND any necessary removals have been completed
Applied to: Continue with Status Processing
WHEN
The counterpart removal process is finished
THEN
The system continues with the normal disposition code processing workflow
R-GCX016E-cbl-03188 (+54) File: GCX016E.cbl In Merged 55 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'In':
  • Context - a cargo record is being processed for in-bond entry:
    For Entry Number Present?:
    When the system checks for entry number presence, then if entry number is present, proceed to validation; if not present, complete processing without further validation.
  • Context - an entry number is present in the cargo record:
    For Validate Against Broker Entry Numbers:
    When the system validates the entry number against broker entry numbers, then the entry number must match an existing broker entry number to be considered valid.
  • Context - an entry number has passed broker entry validation:
    For Validate Against In-Bond Control Numbers:
    When the system validates against in-bond control numbers, then the entry number must also be valid against in-bond control number records.
  • Context - an entry number has passed standard validations:
    For Check Special V37 Entries:
    When the system checks for special v37 entry requirements, then v37 entries must meet additional validation criteria specific to this entry type.
  • Context - all entry number validations have been completed:
    For Entry Number Valid?:
    When the system evaluates overall entry number validity, then if all validations pass, proceed with entry type processing; if any validation fails, generate error.
  • Context - a valid entry number with edi entry type code:
    For Convert EDI Entry Type Code:
    When the system processes the entry type code, then convert edi entry type code to internal system format for further processing.
  • Context - a valid entry with entry type code 61:
    For Set Master In-Bond Flag for Code 61:
    When the system processes the entry type code, then set the master in-bond flag to indicate this is a master in-bond entry.
  • Context - a valid entry with entry type code 62:
    For Set Master In-Bond Flag for Code 62:
    When the system processes the entry type code, then set the master in-bond flag to indicate this is a master in-bond entry.
  • Context - a valid entry with entry type code 63:
    For Set Master In-Bond Flag for Code 63:
    When the system processes the entry type code, then set the master in-bond flag to indicate this is a master in-bond entry.
  • Context - a valid entry with entry type code 69:
    For Set Master In-Bond Flag for Code 69:
    When the system processes the entry type code, then set the master in-bond flag to indicate this is a master in-bond entry.
  • Context - a valid entry with entry type code other than 61, 62, 63, or 69:
    For Process Standard Entry Type:
    When the system processes the entry type code, then apply standard entry type processing without setting master in-bond flags.
  • Context - entry type processing has been completed:
    For Update Broker Bond Information:
    When the system updates broker bond information, then update broker bond records with current entry information and bond details.
  • Context - broker bond information has been updated:
    For CPRS Bond Processing Required?:
    When the system checks for cprs bond processing requirements, then if cprs bond processing is required, proceed with cprs bond assignment; otherwise, proceed to bond owner information.
  • Context - cprs bond processing is required:
    For Handle CPRS Bond Assignment:
    When the system processes cprs bond assignment, then assign appropriate cprs bond information and update bond records accordingly.
  • Context - cprs bond assignment has been completed:
    For Update Broker QP Information:
    When the system updates broker qp information, then update broker qualified person information with current bond and entry details.
  • Context - all bond processing steps have been completed:
    For Set Bond Owner Information:
    When the system sets bond owner information, then establish bond ownership details and finalize bond assignment for the entry.
  • Context - entry number validation has failed:
    For Generate Error - Invalid Entry Number & Generate Error Message:
    When the system processes the validation failure, then generate appropriate error message indicating invalid entry number and halt processing and an appropriate error message is generated describing the validation failure.
  • Context - all in-bond entry processing steps have been completed successfully or entry number was not present:
    For Complete In-Bond Entry Processing:
    When the system finalizes in-bond entry processing, then complete the in-bond entry processing and proceed to next processing stage.
  • Context - a cargo record contains an in-bond entry number:
    For 132: In-Bond Entry Number Validation:
    When the system processes the cargo for in-bond validation, then the entry number is validated for proper format and business rules compliance.
  • Context - an in-bond entry number has been submitted for validation:
    For Entry Number Valid?:
    When the validation process completes, then the system either accepts the entry number for further processing or rejects it with error handling.
  • Context - a valid entry number format has been confirmed:
    For Validate Against Existing Broker Entry Numbers:
    When the system checks against existing broker entry numbers, then the entry number is validated for consistency with broker records.
  • Context - the entry number has passed broker validation:
    For Validate Against In-Bond Control Numbers:
    When the system validates against in-bond control numbers, then the entry number is confirmed to match in-bond control number requirements.
  • Context - the entry number has passed standard validations:
    For Check Special V37 Entries:
    When the system checks for special v37 entry requirements, then special v37 validation rules are applied if applicable.
  • Context - all validations have been completed successfully:
    For Entry Type Code?:
    When the system evaluates the entry type code, then the appropriate entry type specific processing path is selected (61, 62, 63, 69, or other).
  • Context - the entry type code is determined to be 61:
    For 134: Master In-Bond Flag Setting for Code 61:
    When the system processes the in-bond flag setting, then master in-bond flags are set according to entry type 61 business rules.
  • Context - the entry type code is determined to be 62:
    For 134: Master In-Bond Flag Setting for Code 62:
    When the system processes the in-bond flag setting, then master in-bond flags are set according to entry type 62 business rules.
  • Context - the entry type code is determined to be 63:
    For 134: Master In-Bond Flag Setting for Code 63:
    When the system processes the in-bond flag setting, then master in-bond flags are set according to entry type 63 business rules.
  • Context - the entry type code is determined to be 69:
    For 134: Master In-Bond Flag Setting for Code 69:
    When the system processes the in-bond flag setting, then master in-bond flags are set according to entry type 69 business rules.
  • Context - the entry type code is not 61, 62, 63, or 69:
    For Process Other Entry Type Codes:
    When the system processes the other entry type, then standard in-bond processing rules are applied for the non-specific entry type.
  • Context - in-bond flag setting has been completed for the entry type:
    For Update Cargo with Broker Information:
    When the system updates the cargo record, then broker information and in-bond details are stored in the cargo record.
  • Context - cargo has been updated with broker information:
    For Log In-Bond Processing Action:
    When the system logs the processing action, then in-bond processing details are recorded in the system log.
  • Context - in-bond processing has completed (either successfully or with error handling):
    For Continue Cargo Processing:
    When the system continues with cargo processing, then standard cargo processing workflow resumes.
  • Context - an x4 segment is being processed for cargo disposition:
    For Entry Type Code Present?:
    When the system checks for the presence of an entry type code in the segment, then if entry type code is present, continue with conversion processing, otherwise skip entry type processing and continue with cargo processing.
  • Context - an entry type code is present in the x4 segment:
    For Retrieve Current Entry Type Code Value:
    When the system needs to process entry type code conversion, then retrieve the current entry type code value from the us cargo root segment record.
  • Context - an edi entry type code is received from the x4 segment:
    For Convert EDI Entry Type Code to Internal System Value:
    When the system processes the entry type code for internal use, then convert the edi entry type code to the corresponding internal system value using entry type code lookup arrays.
  • Context - an entry type code has been converted to internal system value:
    For Entry Type Code = 61, 62, 63, or 69?:
    When the system evaluates the entry type code for in-bond classification, then if entry type code equals 61, 62, 63, or 69, classify as in-bond and set master in-bond flag, otherwise proceed with standard entry type processing.
    For Update Entry Type Code in Cargo Record:
    When the system completes entry type code processing, then update the entry type code field in the us cargo root segment record with the converted internal value.
  • Context - the entry type code is classified as in-bond (61, 62, 63, or 69):
    For Set Master In-Bond Flag:
    When the system processes in-bond entry type classification, then set the master in-bond flag to indicate this cargo requires in-bond processing.
  • Context - entry type code has been updated in the cargo record:
    For Border Crossing Scenario?:
    When the system evaluates processing context for special scenarios, then if the cargo involves a border crossing scenario, apply special border crossing rules, otherwise proceed with standard validation.
  • Context - a border crossing scenario has been detected:
    For Apply Special Border Crossing Rules:
    When the system processes entry type code for border crossing cargo, then apply special border crossing rules for entry type code processing and validation.
  • Context - an entry type code has been converted and potentially processed for border crossing:
    For Validate Converted Entry Type Code:
    When the system validates the converted entry type code, then verify that the converted entry type code is valid and meets system requirements.
  • Context - the converted entry type code has passed validation:
    For Store Internal Entry Type Code Value:
    When the system completes entry type code processing, then store the validated internal entry type code value in the cargo record for future processing.
  • Context - the entry type code has been successfully stored:
    For Log Entry Type Code Conversion:
    When the system completes entry type code conversion processing, then log the entry type code conversion details for audit trail and tracking purposes.
  • Context - the converted entry type code fails validation:
    For Generate Error for Invalid Entry Type Code:
    When the system detects an invalid entry type code, then generate an error message indicating invalid entry type code and continue with cargo processing.
  • Context - an entry number is received from x4 segment:
    For Check Entry Number Format:
    When the system checks the entry number format, then the entry number is validated for proper format structure and marked as valid or invalid format.
  • Context - an entry number with valid format:
    For Search Existing Broker Entry Numbers:
    When the system searches existing broker entry numbers in the database, then if broker entry number is found, mark entry number as valid, otherwise continue to next validation step.
  • Context - an entry number that was not found in broker entry numbers:
    For Search In-Bond Control Numbers:
    When the system searches in-bond control numbers in the database, then if in-bond control number is found, mark entry number as valid, otherwise continue to next validation step.
  • Context - an entry number that was not found in broker entry numbers or in-bond control numbers:
    For Check for Special V37 Entries:
    When the system searches special v37 entries in the database, then if v37 entry is found, mark entry number as valid, otherwise generate entry number error.
  • Context - an entry number that has been found in broker entry numbers, in-bond control numbers, or special v37 entries:
    For Mark Entry Number as Valid:
    When the system marks the entry number as valid, then set in-bond processing flag, log entry number validation success, and continue with in-bond processing.
  • Context - an entry number that has invalid format or was not found in any validation databases:
    For Generate Entry Number Error:
    When the system generates entry number error, then log entry number validation failure and skip in-bond processing.
  • Context - an entry number format validation result:
    For Entry Number Valid Format?:
    When the system evaluates if entry number has valid format, then if format is valid, proceed to search existing broker entry numbers, otherwise generate entry number error.
  • Context - a broker entry number search result:
    For Broker Entry Number Found?:
    When the system evaluates if broker entry number was found, then if broker entry number is found, mark entry number as valid, otherwise search in-bond control numbers.
  • Context - an in-bond control number search result:
    For In-Bond Control Number Found?:
    When the system evaluates if in-bond control number was found, then if in-bond control number is found, mark entry number as valid, otherwise check for special v37 entries.
  • Context - a special v37 entry search result:
    For V37 Entry Found?:
    When the system evaluates if v37 entry was found, then if v37 entry is found, mark entry number as valid, otherwise generate entry number error.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for in-bond entry
GIVEN
A cargo record is being processed for in-bond entry
Applied to: Entry Number Present?
WHEN
The system checks for entry number presence
THEN
If entry number is present, proceed to validation; if not present, complete processing without further validation
Context: An entry number is present in the cargo record
GIVEN
An entry number is present in the cargo record
Applied to: Validate Against Broker Entry Numbers
WHEN
The system validates the entry number against broker entry numbers
THEN
The entry number must match an existing broker entry number to be considered valid
Context: An entry number has passed broker entry validation
GIVEN
An entry number has passed broker entry validation
Applied to: Validate Against In-Bond Control Numbers
WHEN
The system validates against in-bond control numbers
THEN
The entry number must also be valid against in-bond control number records
Context: An entry number has passed standard validations
GIVEN
An entry number has passed standard validations
Applied to: Check Special V37 Entries
WHEN
The system checks for special V37 entry requirements
THEN
V37 entries must meet additional validation criteria specific to this entry type
Context: All entry number validations have been completed
GIVEN
All entry number validations have been completed
Applied to: Entry Number Valid?
WHEN
The system evaluates overall entry number validity
THEN
If all validations pass, proceed with entry type processing; if any validation fails, generate error
Context: A valid entry number with EDI entry type code
GIVEN
A valid entry number with EDI entry type code
Applied to: Convert EDI Entry Type Code
WHEN
The system processes the entry type code
THEN
Convert EDI entry type code to internal system format for further processing
Context: A valid entry with entry type code 61
GIVEN
A valid entry with entry type code 61
Applied to: Set Master In-Bond Flag for Code 61
WHEN
The system processes the entry type code
THEN
Set the master in-bond flag to indicate this is a master in-bond entry
Context: A valid entry with entry type code 62
GIVEN
A valid entry with entry type code 62
Applied to: Set Master In-Bond Flag for Code 62
WHEN
The system processes the entry type code
THEN
Set the master in-bond flag to indicate this is a master in-bond entry
Context: A valid entry with entry type code 63
GIVEN
A valid entry with entry type code 63
Applied to: Set Master In-Bond Flag for Code 63
WHEN
The system processes the entry type code
THEN
Set the master in-bond flag to indicate this is a master in-bond entry
Context: A valid entry with entry type code 69
GIVEN
A valid entry with entry type code 69
Applied to: Set Master In-Bond Flag for Code 69
WHEN
The system processes the entry type code
THEN
Set the master in-bond flag to indicate this is a master in-bond entry
Context: A valid entry with entry type code other than 61, 62, 63, or 69
GIVEN
A valid entry with entry type code other than 61, 62, 63, or 69
Applied to: Process Standard Entry Type
WHEN
The system processes the entry type code
THEN
Apply standard entry type processing without setting master in-bond flags
Context: Entry type processing has been completed
GIVEN
Entry type processing has been completed
Applied to: Update Broker Bond Information
WHEN
The system updates broker bond information
THEN
Update broker bond records with current entry information and bond details
Context: Broker bond information has been updated
GIVEN
Broker bond information has been updated
Applied to: CPRS Bond Processing Required?
WHEN
The system checks for CPRS bond processing requirements
THEN
If CPRS bond processing is required, proceed with CPRS bond assignment; otherwise, proceed to bond owner information
Context: CPRS bond processing is required
GIVEN
CPRS bond processing is required
Applied to: Handle CPRS Bond Assignment
WHEN
The system processes CPRS bond assignment
THEN
Assign appropriate CPRS bond information and update bond records accordingly
Context: CPRS bond assignment has been completed
GIVEN
CPRS bond assignment has been completed
Applied to: Update Broker QP Information
WHEN
The system updates broker QP information
THEN
Update broker qualified person information with current bond and entry details
Context: All bond processing steps have been completed
GIVEN
All bond processing steps have been completed
Applied to: Set Bond Owner Information
WHEN
The system sets bond owner information
THEN
Establish bond ownership details and finalize bond assignment for the entry
Context: Entry number validation has failed
GIVEN
Entry number validation has failed
Applied to: Generate Error - Invalid Entry Number & Generate Error Message
WHEN
The system processes the validation failure
THEN
Generate appropriate error message indicating invalid entry number and halt processing AND An appropriate error message is generated describing the validation failure
Context: All in-bond entry processing steps have been completed successfully or entry number was not present
GIVEN
All in-bond entry processing steps have been completed successfully or entry number was not present
Applied to: Complete In-Bond Entry Processing
WHEN
The system finalizes in-bond entry processing
THEN
Complete the in-bond entry processing and proceed to next processing stage
Context: A cargo record contains an in-bond entry number
GIVEN
A cargo record contains an in-bond entry number
Applied to: 132: In-Bond Entry Number Validation
WHEN
The system processes the cargo for in-bond validation
THEN
The entry number is validated for proper format and business rules compliance
Context: An in-bond entry number has been submitted for validation
GIVEN
An in-bond entry number has been submitted for validation
Applied to: Entry Number Valid?
WHEN
The validation process completes
THEN
The system either accepts the entry number for further processing or rejects it with error handling
Context: A valid entry number format has been confirmed
GIVEN
A valid entry number format has been confirmed
Applied to: Validate Against Existing Broker Entry Numbers
WHEN
The system checks against existing broker entry numbers
THEN
The entry number is validated for consistency with broker records
Context: The entry number has passed broker validation
GIVEN
The entry number has passed broker validation
Applied to: Validate Against In-Bond Control Numbers
WHEN
The system validates against in-bond control numbers
THEN
The entry number is confirmed to match in-bond control number requirements
Context: The entry number has passed standard validations
GIVEN
The entry number has passed standard validations
Applied to: Check Special V37 Entries
WHEN
The system checks for special V37 entry requirements
THEN
Special V37 validation rules are applied if applicable
Context: All validations have been completed successfully
GIVEN
All validations have been completed successfully
Applied to: Entry Type Code?
WHEN
The system evaluates the entry type code
THEN
The appropriate entry type specific processing path is selected (61, 62, 63, 69, or Other)
Context: The entry type code is determined to be 61
GIVEN
The entry type code is determined to be 61
Applied to: 134: Master In-Bond Flag Setting for Code 61
WHEN
The system processes the in-bond flag setting
THEN
Master in-bond flags are set according to entry type 61 business rules
Context: The entry type code is determined to be 62
GIVEN
The entry type code is determined to be 62
Applied to: 134: Master In-Bond Flag Setting for Code 62
WHEN
The system processes the in-bond flag setting
THEN
Master in-bond flags are set according to entry type 62 business rules
Context: The entry type code is determined to be 63
GIVEN
The entry type code is determined to be 63
Applied to: 134: Master In-Bond Flag Setting for Code 63
WHEN
The system processes the in-bond flag setting
THEN
Master in-bond flags are set according to entry type 63 business rules
Context: The entry type code is determined to be 69
GIVEN
The entry type code is determined to be 69
Applied to: 134: Master In-Bond Flag Setting for Code 69
WHEN
The system processes the in-bond flag setting
THEN
Master in-bond flags are set according to entry type 69 business rules
Context: The entry type code is not 61, 62, 63, or 69
GIVEN
The entry type code is not 61, 62, 63, or 69
Applied to: Process Other Entry Type Codes
WHEN
The system processes the other entry type
THEN
Standard in-bond processing rules are applied for the non-specific entry type
Context: In-bond flag setting has been completed for the entry type
GIVEN
In-bond flag setting has been completed for the entry type
Applied to: Update Cargo with Broker Information
WHEN
The system updates the cargo record
THEN
Broker information and in-bond details are stored in the cargo record
Context: Cargo has been updated with broker information
GIVEN
Cargo has been updated with broker information
Applied to: Log In-Bond Processing Action
WHEN
The system logs the processing action
THEN
In-bond processing details are recorded in the system log
Context: In-bond processing has completed (either successfully or with error handling)
GIVEN
In-bond processing has completed (either successfully or with error handling)
Applied to: Continue Cargo Processing
WHEN
The system continues with cargo processing
THEN
Standard cargo processing workflow resumes
Context: An X4 segment is being processed for cargo disposition
GIVEN
An X4 segment is being processed for cargo disposition
Applied to: Entry Type Code Present?
WHEN
The system checks for the presence of an entry type code in the segment
THEN
If entry type code is present, continue with conversion processing, otherwise skip entry type processing and continue with cargo processing
Context: An entry type code is present in the X4 segment
GIVEN
An entry type code is present in the X4 segment
Applied to: Retrieve Current Entry Type Code Value
WHEN
The system needs to process entry type code conversion
THEN
Retrieve the current entry type code value from the US cargo root segment record
Context: An EDI entry type code is received from the X4 segment
GIVEN
An EDI entry type code is received from the X4 segment
Applied to: Convert EDI Entry Type Code to Internal System Value
WHEN
The system processes the entry type code for internal use
THEN
Convert the EDI entry type code to the corresponding internal system value using entry type code lookup arrays
Context: An entry type code has been converted to internal system value
GIVEN
An entry type code has been converted to internal system value
Applied to: Entry Type Code = 61, 62, 63, or 69?
WHEN
The system evaluates the entry type code for in-bond classification
THEN
If entry type code equals 61, 62, 63, or 69, classify as in-bond and set master in-bond flag, otherwise proceed with standard entry type processing
Applied to: Update Entry Type Code in Cargo Record
WHEN
The system completes entry type code processing
THEN
Update the entry type code field in the US cargo root segment record with the converted internal value
Context: The entry type code is classified as in-bond (61, 62, 63, or 69)
GIVEN
The entry type code is classified as in-bond (61, 62, 63, or 69)
Applied to: Set Master In-Bond Flag
WHEN
The system processes in-bond entry type classification
THEN
Set the master in-bond flag to indicate this cargo requires in-bond processing
Context: Entry type code has been updated in the cargo record
GIVEN
Entry type code has been updated in the cargo record
Applied to: Border Crossing Scenario?
WHEN
The system evaluates processing context for special scenarios
THEN
If the cargo involves a border crossing scenario, apply special border crossing rules, otherwise proceed with standard validation
Context: A border crossing scenario has been detected
GIVEN
A border crossing scenario has been detected
Applied to: Apply Special Border Crossing Rules
WHEN
The system processes entry type code for border crossing cargo
THEN
Apply special border crossing rules for entry type code processing and validation
Context: An entry type code has been converted and potentially processed for border crossing
GIVEN
An entry type code has been converted and potentially processed for border crossing
Applied to: Validate Converted Entry Type Code
WHEN
The system validates the converted entry type code
THEN
Verify that the converted entry type code is valid and meets system requirements
Context: The converted entry type code has passed validation
GIVEN
The converted entry type code has passed validation
Applied to: Store Internal Entry Type Code Value
WHEN
The system completes entry type code processing
THEN
Store the validated internal entry type code value in the cargo record for future processing
Context: The entry type code has been successfully stored
GIVEN
The entry type code has been successfully stored
Applied to: Log Entry Type Code Conversion
WHEN
The system completes entry type code conversion processing
THEN
Log the entry type code conversion details for audit trail and tracking purposes
Context: The converted entry type code fails validation
GIVEN
The converted entry type code fails validation
Applied to: Generate Error for Invalid Entry Type Code
WHEN
The system detects an invalid entry type code
THEN
Generate an error message indicating invalid entry type code and continue with cargo processing
Context: An entry number is received from X4 segment
GIVEN
An entry number is received from X4 segment
Applied to: Check Entry Number Format
WHEN
The system checks the entry number format
THEN
The entry number is validated for proper format structure and marked as valid or invalid format
Context: An entry number with valid format
GIVEN
An entry number with valid format
Applied to: Search Existing Broker Entry Numbers
WHEN
The system searches existing broker entry numbers in the database
THEN
If broker entry number is found, mark entry number as valid, otherwise continue to next validation step
Context: An entry number that was not found in broker entry numbers
GIVEN
An entry number that was not found in broker entry numbers
Applied to: Search In-Bond Control Numbers
WHEN
The system searches in-bond control numbers in the database
THEN
If in-bond control number is found, mark entry number as valid, otherwise continue to next validation step
Context: An entry number that was not found in broker entry numbers or in-bond control numbers
GIVEN
An entry number that was not found in broker entry numbers or in-bond control numbers
Applied to: Check for Special V37 Entries
WHEN
The system searches special V37 entries in the database
THEN
If V37 entry is found, mark entry number as valid, otherwise generate entry number error
Context: An entry number that has been found in broker entry numbers, in-bond control numbers, or special V37 entries
GIVEN
An entry number that has been found in broker entry numbers, in-bond control numbers, or special V37 entries
Applied to: Mark Entry Number as Valid
WHEN
The system marks the entry number as valid
THEN
Set in-bond processing flag, log entry number validation success, and continue with in-bond processing
Context: An entry number that has invalid format or was not found in any validation databases
GIVEN
An entry number that has invalid format or was not found in any validation databases
Applied to: Generate Entry Number Error
WHEN
The system generates entry number error
THEN
Log entry number validation failure and skip in-bond processing
Context: An entry number format validation result
GIVEN
An entry number format validation result
Applied to: Entry Number Valid Format?
WHEN
The system evaluates if entry number has valid format
THEN
If format is valid, proceed to search existing broker entry numbers, otherwise generate entry number error
Context: A broker entry number search result
GIVEN
A broker entry number search result
Applied to: Broker Entry Number Found?
WHEN
The system evaluates if broker entry number was found
THEN
If broker entry number is found, mark entry number as valid, otherwise search in-bond control numbers
Context: An in-bond control number search result
GIVEN
An in-bond control number search result
Applied to: In-Bond Control Number Found?
WHEN
The system evaluates if in-bond control number was found
THEN
If in-bond control number is found, mark entry number as valid, otherwise check for special V37 entries
Context: A special V37 entry search result
GIVEN
A special V37 entry search result
Applied to: V37 Entry Found?
WHEN
The system evaluates if V37 entry was found
THEN
If V37 entry is found, mark entry number as valid, otherwise generate entry number error
R-GCX016E-cbl-03206 (+12) File: GCX016E.cbl Arrival and Export Location Validation Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Arrival and Export Location Validation':
  • Context - a train arrival processing event (pod/aad disposition) is being processed:
    For Train ID Suffix Check:
    When the system checks the train id suffix, then if train id ends with 't', classify as export manifest train, otherwise classify as import manifest train.
  • Context - an export manifest train (suffix 't') is arriving at a port:
    For Export Manifest Port Validation:
    When the system validates the arrival port against export port configuration, then if port is designated for export, allow export manifest processing, otherwise generate validation message.
  • Context - an export manifest train is processed and arrival port information is available from p4 location segments:
    For Arrival Port Designated for Export?:
    When the system checks if the arrival port is designated for export processing, then if port is designated for export, proceed with export manifest business rules, otherwise generate location validation messages.
  • Context - a train is identified as export manifest and arrival port is validated for export:
    For Apply Export Manifest Business Rules:
    When the system processes the export manifest, then apply export-specific processing rules including location validation and status updates.
  • Context - a train is identified as import manifest (no 't' suffix):
    For Standard Import Processing Rules:
    When the system processes the import manifest, then apply standard import processing rules and proceed to location validation.
  • Context - location identifier information is available from p4 location segments:
    For Valid Destination Location?:
    When the system validates the destination location against destination station table, then if destination location is valid, proceed with location-specific rule application, otherwise generate location validation messages.
  • Context - a valid destination location is confirmed:
    For Border Crossing Location?:
    When the system checks if the location is a border crossing point, then if location is border crossing, apply border crossing rules, otherwise apply standard location rules.
  • Context - a location is identified as a border crossing point:
    For Apply Border Crossing Rules:
    When the system processes the border crossing location, then apply border-specific processing rules including vessel information swapping and special status handling.
  • Context - a location is identified as non-border crossing:
    For Apply Standard Location Rules:
    When the system processes the standard location, then apply standard location processing rules without special border crossing handling.
  • Context - export manifest business rules have been applied successfully:
    For Set Export Manifest Status:
    When the system updates the manifest status, then set export manifest status and proceed to train arrival status update.
  • Context - import manifest processing rules have been applied successfully:
    For Set Import Manifest Status:
    When the system updates the manifest status, then set import manifest status and proceed to train arrival status update.
  • Context - location-specific rules have been applied and manifest status has been set:
    For Update Train Arrival Status:
    When the system finalizes train arrival processing, then update train arrival status to reflect completed processing and generate location validation messages.
  • Context - train arrival processing is complete or validation errors occurred:
    For Generate Location Validation Messages:
    When the system generates validation messages, then create appropriate messages for successful processing or validation failures including invalid ports or destinations.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival processing event (POD/AAD disposition) is being processed
GIVEN
A train arrival processing event (POD/AAD disposition) is being processed
Applied to: Train ID Suffix Check
WHEN
The system checks the train ID suffix
THEN
If train ID ends with 'T', classify as export manifest train, otherwise classify as import manifest train
Context: An export manifest train (suffix 'T') is arriving at a port
GIVEN
An export manifest train (suffix 'T') is arriving at a port
Applied to: Export Manifest Port Validation
WHEN
The system validates the arrival port against export port configuration
THEN
If port is designated for export, allow export manifest processing, otherwise generate validation message
Context: An export manifest train is processed and arrival port information is available from P4 location segments
GIVEN
An export manifest train is processed and arrival port information is available from P4 location segments
Applied to: Arrival Port Designated for Export?
WHEN
The system checks if the arrival port is designated for export processing
THEN
If port is designated for export, proceed with export manifest business rules, otherwise generate location validation messages
Context: A train is identified as export manifest and arrival port is validated for export
GIVEN
A train is identified as export manifest and arrival port is validated for export
Applied to: Apply Export Manifest Business Rules
WHEN
The system processes the export manifest
THEN
Apply export-specific processing rules including location validation and status updates
Context: A train is identified as import manifest (no 'T' suffix)
GIVEN
A train is identified as import manifest (no 'T' suffix)
Applied to: Standard Import Processing Rules
WHEN
The system processes the import manifest
THEN
Apply standard import processing rules and proceed to location validation
Context: Location identifier information is available from P4 location segments
GIVEN
Location identifier information is available from P4 location segments
Applied to: Valid Destination Location?
WHEN
The system validates the destination location against destination station table
THEN
If destination location is valid, proceed with location-specific rule application, otherwise generate location validation messages
Context: A valid destination location is confirmed
GIVEN
A valid destination location is confirmed
Applied to: Border Crossing Location?
WHEN
The system checks if the location is a border crossing point
THEN
If location is border crossing, apply border crossing rules, otherwise apply standard location rules
Context: A location is identified as a border crossing point
GIVEN
A location is identified as a border crossing point
Applied to: Apply Border Crossing Rules
WHEN
The system processes the border crossing location
THEN
Apply border-specific processing rules including vessel information swapping and special status handling
Context: A location is identified as non-border crossing
GIVEN
A location is identified as non-border crossing
Applied to: Apply Standard Location Rules
WHEN
The system processes the standard location
THEN
Apply standard location processing rules without special border crossing handling
Context: Export manifest business rules have been applied successfully
GIVEN
Export manifest business rules have been applied successfully
Applied to: Set Export Manifest Status
WHEN
The system updates the manifest status
THEN
Set export manifest status and proceed to train arrival status update
Context: Import manifest processing rules have been applied successfully
GIVEN
Import manifest processing rules have been applied successfully
Applied to: Set Import Manifest Status
WHEN
The system updates the manifest status
THEN
Set import manifest status and proceed to train arrival status update
Context: Location-specific rules have been applied and manifest status has been set
GIVEN
Location-specific rules have been applied and manifest status has been set
Applied to: Update Train Arrival Status
WHEN
The system finalizes train arrival processing
THEN
Update train arrival status to reflect completed processing and generate location validation messages
Context: Train arrival processing is complete or validation errors occurred
GIVEN
Train arrival processing is complete or validation errors occurred
Applied to: Generate Location Validation Messages
WHEN
The system generates validation messages
THEN
Create appropriate messages for successful processing or validation failures including invalid ports or destinations
R-GCX016E-cbl-03219 (+21) File: GCX016E.cbl Database Segment Validation Merged 22 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database Segment Validation':
  • Context - a cargo record exists in the system with associated status segments:
    For Retrieve S09 Status Segment from Database:
    When the system attempts to retrieve the s09 status segment from the database, then the segment data is successfully fetched and made available for processing.
  • Context - an attempt has been made to retrieve s09 status segment from database:
    For Segment Retrieved Successfully?:
    When the system checks the retrieval operation result, then if segment was found and retrieved, proceed to format validation, otherwise initiate corrupted segment recovery.
  • Context - an s09 status segment has been successfully retrieved from database:
    For Check Segment Format Structure:
    When the system examines the segment format structure, then the segment structure is validated against expected format specifications.
  • Context - the s09 segment format structure has been examined:
    For Valid Segment Format?:
    When the system evaluates format validity, then if format is valid, proceed to sequence number verification, otherwise log format error and attempt reconstruction.
  • Context - an s09 segment with valid format structure:
    For Verify Sequence Numbers:
    When the system checks sequence numbers within the segment, then sequence numbers are verified for proper ordering and valid ranges.
  • Context - sequence numbers in s09 segment have been verified:
    For Sequence Numbers Valid?:
    When the system evaluates sequence number validity, then if sequence numbers are valid, proceed to data integrity check, otherwise log sequence error and correct numbering.
  • Context - an s09 segment with valid format and sequence numbers:
    For Check Data Integrity Fields:
    When the system examines data integrity fields, then data integrity is validated against consistency and completeness requirements.
  • Context - data integrity fields in s09 segment have been checked:
    For Data Integrity Valid?:
    When the system evaluates data integrity validity, then if data integrity is valid, initialize status array from segment, otherwise log integrity error and apply correction rules.
  • Context - a valid s09 segment with proper format, sequence numbers, and data integrity:
    For Initialize Status Array from Valid Segment:
    When the system initializes the status array, then status array is populated with disposition codes and status information from the segment.
  • Context - status array has been initialized from valid s09 segment:
    For Track Maximum Sequence Fetched:
    When the system processes sequence numbers, then the maximum sequence number encountered is recorded for future reference.
  • Context - s09 segment has passed all validation checks and maximum sequence has been tracked:
    For Mark Segment as Valid for Processing:
    When the system finalizes segment validation, then segment is marked as valid and ready for cargo status processing.
  • Context - s09 segment retrieval has failed or segment is corrupted:
    For Handle Corrupted Segment Recovery:
    When the system detects segment unavailability or corruption, then recovery procedures are initiated to attempt segment reconstruction.
  • Context - s09 segment format validation has failed:
    For Log Segment Format Error:
    When the system detects invalid segment format, then format error is logged with details for troubleshooting and segment reconstruction is attempted.
  • Context - s09 segment is invalid, corrupted, or has format errors:
    For Attempt Segment Reconstruction:
    When the system attempts segment reconstruction, then reconstruction process is executed using available cargo data and default values.
  • Context - segment reconstruction has been attempted:
    For Recovery Successful?:
    When the system evaluates reconstruction results, then if reconstruction successful, proceed to sequence verification, otherwise use default segment values.
  • Context - segment reconstruction has failed:
    For Use Default Segment Values:
    When the system cannot recover valid segment data, then default segment values are applied and validation is marked as failed.
  • Context - sequence number validation has failed:
    For Log Sequence Number Error:
    When the system detects invalid sequence numbers, then sequence number error is logged and correction procedures are initiated.
  • Context - invalid sequence numbers have been detected and logged:
    For Correct Sequence Numbering:
    When the system applies sequence number corrections, then sequence numbers are corrected and processing continues to data integrity check.
  • Context - data integrity validation has failed:
    For Log Data Integrity Error:
    When the system detects data integrity issues, then data integrity error is logged and correction rules are applied.
  • Context - data integrity errors have been detected and logged:
    For Apply Data Correction Rules:
    When the system applies data correction rules, then data integrity issues are corrected and status array initialization proceeds.
  • Context - s09 segment has passed all validation checks and is marked as valid:
    For Validation Complete - Segment Ready:
    When the system completes validation process, then segment is confirmed ready for cargo status processing and business logic application.
  • Context - s09 segment validation has failed and recovery attempts were unsuccessful:
    For Validation Failed - Segment Rejected:
    When the system cannot establish valid segment data, then segment is rejected and default processing procedures are applied.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with associated status segments
GIVEN
A cargo record exists in the system with associated status segments
Applied to: Retrieve S09 Status Segment from Database
WHEN
The system attempts to retrieve the S09 status segment from the database
THEN
The segment data is successfully fetched and made available for processing
Context: An attempt has been made to retrieve S09 status segment from database
GIVEN
An attempt has been made to retrieve S09 status segment from database
Applied to: Segment Retrieved Successfully?
WHEN
The system checks the retrieval operation result
THEN
If segment was found and retrieved, proceed to format validation, otherwise initiate corrupted segment recovery
Context: An S09 status segment has been successfully retrieved from database
GIVEN
An S09 status segment has been successfully retrieved from database
Applied to: Check Segment Format Structure
WHEN
The system examines the segment format structure
THEN
The segment structure is validated against expected format specifications
Context: The S09 segment format structure has been examined
GIVEN
The S09 segment format structure has been examined
Applied to: Valid Segment Format?
WHEN
The system evaluates format validity
THEN
If format is valid, proceed to sequence number verification, otherwise log format error and attempt reconstruction
Context: An S09 segment with valid format structure
GIVEN
An S09 segment with valid format structure
Applied to: Verify Sequence Numbers
WHEN
The system checks sequence numbers within the segment
THEN
Sequence numbers are verified for proper ordering and valid ranges
Context: Sequence numbers in S09 segment have been verified
GIVEN
Sequence numbers in S09 segment have been verified
Applied to: Sequence Numbers Valid?
WHEN
The system evaluates sequence number validity
THEN
If sequence numbers are valid, proceed to data integrity check, otherwise log sequence error and correct numbering
Context: An S09 segment with valid format and sequence numbers
GIVEN
An S09 segment with valid format and sequence numbers
Applied to: Check Data Integrity Fields
WHEN
The system examines data integrity fields
THEN
Data integrity is validated against consistency and completeness requirements
Context: Data integrity fields in S09 segment have been checked
GIVEN
Data integrity fields in S09 segment have been checked
Applied to: Data Integrity Valid?
WHEN
The system evaluates data integrity validity
THEN
If data integrity is valid, initialize status array from segment, otherwise log integrity error and apply correction rules
Context: A valid S09 segment with proper format, sequence numbers, and data integrity
GIVEN
A valid S09 segment with proper format, sequence numbers, and data integrity
Applied to: Initialize Status Array from Valid Segment
WHEN
The system initializes the status array
THEN
Status array is populated with disposition codes and status information from the segment
Context: Status array has been initialized from valid S09 segment
GIVEN
Status array has been initialized from valid S09 segment
Applied to: Track Maximum Sequence Fetched
WHEN
The system processes sequence numbers
THEN
The maximum sequence number encountered is recorded for future reference
Context: S09 segment has passed all validation checks and maximum sequence has been tracked
GIVEN
S09 segment has passed all validation checks and maximum sequence has been tracked
Applied to: Mark Segment as Valid for Processing
WHEN
The system finalizes segment validation
THEN
Segment is marked as valid and ready for cargo status processing
Context: S09 segment retrieval has failed or segment is corrupted
GIVEN
S09 segment retrieval has failed or segment is corrupted
Applied to: Handle Corrupted Segment Recovery
WHEN
The system detects segment unavailability or corruption
THEN
Recovery procedures are initiated to attempt segment reconstruction
Context: S09 segment format validation has failed
GIVEN
S09 segment format validation has failed
Applied to: Log Segment Format Error
WHEN
The system detects invalid segment format
THEN
Format error is logged with details for troubleshooting and segment reconstruction is attempted
Context: S09 segment is invalid, corrupted, or has format errors
GIVEN
S09 segment is invalid, corrupted, or has format errors
Applied to: Attempt Segment Reconstruction
WHEN
The system attempts segment reconstruction
THEN
Reconstruction process is executed using available cargo data and default values
Context: Segment reconstruction has been attempted
GIVEN
Segment reconstruction has been attempted
Applied to: Recovery Successful?
WHEN
The system evaluates reconstruction results
THEN
If reconstruction successful, proceed to sequence verification, otherwise use default segment values
Context: Segment reconstruction has failed
GIVEN
Segment reconstruction has failed
Applied to: Use Default Segment Values
WHEN
The system cannot recover valid segment data
THEN
Default segment values are applied and validation is marked as failed
Context: Sequence number validation has failed
GIVEN
Sequence number validation has failed
Applied to: Log Sequence Number Error
WHEN
The system detects invalid sequence numbers
THEN
Sequence number error is logged and correction procedures are initiated
Context: Invalid sequence numbers have been detected and logged
GIVEN
Invalid sequence numbers have been detected and logged
Applied to: Correct Sequence Numbering
WHEN
The system applies sequence number corrections
THEN
Sequence numbers are corrected and processing continues to data integrity check
Context: Data integrity validation has failed
GIVEN
Data integrity validation has failed
Applied to: Log Data Integrity Error
WHEN
The system detects data integrity issues
THEN
Data integrity error is logged and correction rules are applied
Context: Data integrity errors have been detected and logged
GIVEN
Data integrity errors have been detected and logged
Applied to: Apply Data Correction Rules
WHEN
The system applies data correction rules
THEN
Data integrity issues are corrected and status array initialization proceeds
Context: S09 segment has passed all validation checks and is marked as valid
GIVEN
S09 segment has passed all validation checks and is marked as valid
Applied to: Validation Complete - Segment Ready
WHEN
The system completes validation process
THEN
Segment is confirmed ready for cargo status processing and business logic application
Context: S09 segment validation has failed and recovery attempts were unsuccessful
GIVEN
S09 segment validation has failed and recovery attempts were unsuccessful
Applied to: Validation Failed - Segment Rejected
WHEN
The system cannot establish valid segment data
THEN
Segment is rejected and default processing procedures are applied
R-GCX016E-cbl-03241 (+10) File: GCX016E.cbl Processing Rules Extraction Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Processing Rules Extraction':
  • Context - a disposition code has been received for processing:
    For Lookup Disposition Code in DC Table:
    When the system looks up the disposition code in the dc table, then the system retrieves the corresponding processing rules including action type, quantity impact, and removal requirements.
  • Context - a disposition code lookup has been performed in the dc table:
    For Code Found in Table?:
    When the disposition code is not found in the table, then the system generates an error message for the unknown disposition code.
  • Context - a disposition code has been successfully looked up in the dc table:
    For Set Hold Indicator:
    When the action type from the dc table indicates a hold operation, then the system sets the hold indicator flag for subsequent processing.
    For Set Release Indicator:
    When the action type from the dc table indicates a release operation, then the system sets the release indicator flag for subsequent processing.
    For Set Status Info Indicator:
    When the action type from the dc table indicates a status information operation, then the system sets the status info indicator flag for subsequent processing.
    For Set Removal Indicator:
    When the action type from the dc table indicates a removal operation, then the system sets the removal indicator flag for subsequent processing.
  • Context - disposition code processing rules have been extracted from the dc table:
    For Set Quantity Add Flag:
    When the quantity impact flag indicates the disposition code adds to release quantity, then the system sets the quantity add flag to increase release quantities during processing.
    For Set Quantity Subtract Flag:
    When the quantity impact flag indicates the disposition code subtracts from release quantity, then the system sets the quantity subtract flag to decrease release quantities during processing.
    For Set No Quantity Impact:
    When the quantity impact flag indicates the disposition code has no effect on release quantity, then the system sets the no quantity impact flag to maintain current release quantities during processing.
  • Context - disposition code removal processing requirements have been extracted from the dc table:
    For Set Counterpart Removal Flag:
    When the removal requirements indicate counterpart disposition codes must be removed, then the system sets the counterpart removal flag to remove conflicting disposition codes before applying the new code.
    For Set Standard Processing Flag:
    When the removal requirements indicate no counterpart removal is needed, then the system sets the standard processing flag to apply the disposition code using normal processing rules.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code has been received for processing
GIVEN
A disposition code has been received for processing
Applied to: Lookup Disposition Code in DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The system retrieves the corresponding processing rules including action type, quantity impact, and removal requirements
Context: A disposition code lookup has been performed in the DC table
GIVEN
A disposition code lookup has been performed in the DC table
Applied to: Code Found in Table?
WHEN
The disposition code is not found in the table
THEN
The system generates an error message for the unknown disposition code
Context: A disposition code has been successfully looked up in the DC table
GIVEN
A disposition code has been successfully looked up in the DC table
Applied to: Set Hold Indicator
WHEN
The action type from the DC table indicates a hold operation
THEN
The system sets the hold indicator flag for subsequent processing
Applied to: Set Release Indicator
WHEN
The action type from the DC table indicates a release operation
THEN
The system sets the release indicator flag for subsequent processing
Applied to: Set Status Info Indicator
WHEN
The action type from the DC table indicates a status information operation
THEN
The system sets the status info indicator flag for subsequent processing
Applied to: Set Removal Indicator
WHEN
The action type from the DC table indicates a removal operation
THEN
The system sets the removal indicator flag for subsequent processing
Context: Disposition code processing rules have been extracted from the DC table
GIVEN
Disposition code processing rules have been extracted from the DC table
Applied to: Set Quantity Add Flag
WHEN
The quantity impact flag indicates the disposition code adds to release quantity
THEN
The system sets the quantity add flag to increase release quantities during processing
Applied to: Set Quantity Subtract Flag
WHEN
The quantity impact flag indicates the disposition code subtracts from release quantity
THEN
The system sets the quantity subtract flag to decrease release quantities during processing
Applied to: Set No Quantity Impact
WHEN
The quantity impact flag indicates the disposition code has no effect on release quantity
THEN
The system sets the no quantity impact flag to maintain current release quantities during processing
Context: Disposition code removal processing requirements have been extracted from the DC table
GIVEN
Disposition code removal processing requirements have been extracted from the DC table
Applied to: Set Counterpart Removal Flag
WHEN
The removal requirements indicate counterpart disposition codes must be removed
THEN
The system sets the counterpart removal flag to remove conflicting disposition codes before applying the new code
Applied to: Set Standard Processing Flag
WHEN
The removal requirements indicate no counterpart removal is needed
THEN
The system sets the standard processing flag to apply the disposition code using normal processing rules
R-GCX016E-cbl-03252 (+24) File: GCX016E.cbl Business Rule Priority Application Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Business Rule Priority Application':
  • Context - a cargo record exists with associated status segments:
    For Retrieve Complete S09A Status Array:
    When the system needs to determine final cargo status, then the complete s09a status array containing all disposition codes and status information is retrieved and made available for processing.
  • Context - the system is about to evaluate cargo status priorities:
    For Initialize Priority Flags:
    When priority evaluation process begins, then all priority flags for hold, release, proceed, arrival, and export conditions are set to initial false state.
  • Context - a cargo status array contains disposition codes:
    For Hold Conditions Present?:
    When the system checks for hold conditions including border holds, destination holds, or fda holds, then the system identifies if any hold disposition codes are present and sets hold priority flag accordingly.
    For Release Conditions Present?:
    When the system checks for release conditions including manual release or automatic release codes, then the system identifies if any release disposition codes are present and sets release priority flag accordingly.
    For Proceed Conditions Present?:
    When the system checks for proceed disposition codes that allow cargo movement, then the system identifies if any proceed disposition codes are present and sets proceed priority flag accordingly.
    For Arrival Conditions Present?:
    When the system checks for arrival disposition codes indicating cargo has arrived at destination, then the system identifies if any arrival disposition codes are present and sets arrival priority flag accordingly.
    For Export Conditions Present?:
    When the system checks for export disposition codes indicating cargo is being exported, then the system identifies if any export disposition codes are present and sets export priority flag accordingly.
  • Context - hold conditions have been detected in the cargo status array:
    For Set Hold Priority Flag:
    When the system processes the hold condition detection result, then the hold priority flag is set to true to indicate hold conditions take precedence in status determination.
  • Context - release conditions have been detected in the cargo status array:
    For Set Release Priority Flag:
    When the system processes the release condition detection result, then the release priority flag is set to true to indicate release conditions are present for priority evaluation.
  • Context - proceed conditions have been detected in the cargo status array:
    For Set Proceed Priority Flag:
    When the system processes the proceed condition detection result, then the proceed priority flag is set to true to indicate proceed conditions are present for priority evaluation.
  • Context - arrival conditions have been detected in the cargo status array:
    For Set Arrival Priority Flag:
    When the system processes the arrival condition detection result, then the arrival priority flag is set to true to indicate arrival conditions are present for priority evaluation.
  • Context - export conditions have been detected in the cargo status array:
    For Set Export Priority Flag:
    When the system processes the export condition detection result, then the export priority flag is set to true to indicate export conditions are present for priority evaluation.
  • Context - multiple status condition flags are set for a cargo:
    For Apply Regulatory Hierarchy Rules:
    When the system needs to determine the final authoritative status, then regulatory hierarchy rules are applied to establish precedence order among competing status conditions.
  • Context - hold conditions are present along with other status conditions:
    For Hold Takes Precedence?:
    When the system evaluates precedence according to regulatory hierarchy, then the system determines if hold conditions take absolute precedence over release, proceed, arrival, or export conditions.
  • Context - hold conditions have been determined to take precedence:
    For Final Status: HELD:
    When the system assigns the final cargo status, then the cargo status is set to held and all other competing status conditions are overridden.
  • Context - both hold and release conditions are present and hold does not take absolute precedence:
    For Release Overrides Hold?:
    When the system evaluates if release authorization can override the hold, then the system determines if release conditions have sufficient authority to override hold conditions based on regulatory rules.
  • Context - release conditions have been determined to override hold conditions:
    For Final Status: RELEASED:
    When the system assigns the final cargo status, then the cargo status is set to released and hold conditions are overridden by authorized release.
  • Context - proceed conditions are present and neither hold nor release take precedence:
    For Proceed Conditions Valid?:
    When the system validates proceed condition legitimacy, then the system determines if proceed conditions meet all regulatory requirements and can be applied as final status.
  • Context - proceed conditions have been validated as legitimate and applicable:
    For Final Status: PROCEED:
    When the system assigns the final cargo status, then the cargo status is set to proceed allowing cargo movement according to disposition instructions.
  • Context - arrival conditions are present and higher precedence conditions do not apply:
    For Arrival Status Valid?:
    When the system validates arrival status legitimacy, then the system determines if arrival conditions meet all requirements and can be applied as final status.
  • Context - arrival conditions have been validated as legitimate and applicable:
    For Final Status: ARRIVED:
    When the system assigns the final cargo status, then the cargo status is set to arrived indicating successful cargo arrival at destination.
  • Context - export conditions are present and higher precedence conditions do not apply:
    For Export Status Valid?:
    When the system validates export status legitimacy, then the system determines if export conditions meet all requirements and can be applied as final status.
  • Context - export conditions have been validated as legitimate and applicable:
    For Final Status: EXPORTED:
    When the system assigns the final cargo status, then the cargo status is set to exported indicating cargo has been processed for export.
  • Context - no specific status conditions (hold, release, proceed, arrival, export) are valid or applicable:
    For Final Status: DEFAULT:
    When the system assigns the final cargo status, then the cargo status is set to a default value indicating standard processing state.
  • Context - a final cargo status has been determined through priority rule application:
    For Return Final Cargo Status:
    When the status determination process completes, then the final cargo status is returned to the calling process for further business operations.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with associated status segments
GIVEN
A cargo record exists with associated status segments
Applied to: Retrieve Complete S09A Status Array
WHEN
The system needs to determine final cargo status
THEN
The complete S09A status array containing all disposition codes and status information is retrieved and made available for processing
Context: The system is about to evaluate cargo status priorities
GIVEN
The system is about to evaluate cargo status priorities
Applied to: Initialize Priority Flags
WHEN
Priority evaluation process begins
THEN
All priority flags for hold, release, proceed, arrival, and export conditions are set to initial false state
Context: A cargo status array contains disposition codes
GIVEN
A cargo status array contains disposition codes
Applied to: Hold Conditions Present?
WHEN
The system checks for hold conditions including border holds, destination holds, or FDA holds
THEN
The system identifies if any hold disposition codes are present and sets hold priority flag accordingly
Applied to: Release Conditions Present?
WHEN
The system checks for release conditions including manual release or automatic release codes
THEN
The system identifies if any release disposition codes are present and sets release priority flag accordingly
Applied to: Proceed Conditions Present?
WHEN
The system checks for proceed disposition codes that allow cargo movement
THEN
The system identifies if any proceed disposition codes are present and sets proceed priority flag accordingly
Applied to: Arrival Conditions Present?
WHEN
The system checks for arrival disposition codes indicating cargo has arrived at destination
THEN
The system identifies if any arrival disposition codes are present and sets arrival priority flag accordingly
Applied to: Export Conditions Present?
WHEN
The system checks for export disposition codes indicating cargo is being exported
THEN
The system identifies if any export disposition codes are present and sets export priority flag accordingly
Context: Hold conditions have been detected in the cargo status array
GIVEN
Hold conditions have been detected in the cargo status array
Applied to: Set Hold Priority Flag
WHEN
The system processes the hold condition detection result
THEN
The hold priority flag is set to true to indicate hold conditions take precedence in status determination
Context: Release conditions have been detected in the cargo status array
GIVEN
Release conditions have been detected in the cargo status array
Applied to: Set Release Priority Flag
WHEN
The system processes the release condition detection result
THEN
The release priority flag is set to true to indicate release conditions are present for priority evaluation
Context: Proceed conditions have been detected in the cargo status array
GIVEN
Proceed conditions have been detected in the cargo status array
Applied to: Set Proceed Priority Flag
WHEN
The system processes the proceed condition detection result
THEN
The proceed priority flag is set to true to indicate proceed conditions are present for priority evaluation
Context: Arrival conditions have been detected in the cargo status array
GIVEN
Arrival conditions have been detected in the cargo status array
Applied to: Set Arrival Priority Flag
WHEN
The system processes the arrival condition detection result
THEN
The arrival priority flag is set to true to indicate arrival conditions are present for priority evaluation
Context: Export conditions have been detected in the cargo status array
GIVEN
Export conditions have been detected in the cargo status array
Applied to: Set Export Priority Flag
WHEN
The system processes the export condition detection result
THEN
The export priority flag is set to true to indicate export conditions are present for priority evaluation
Context: Multiple status condition flags are set for a cargo
GIVEN
Multiple status condition flags are set for a cargo
Applied to: Apply Regulatory Hierarchy Rules
WHEN
The system needs to determine the final authoritative status
THEN
Regulatory hierarchy rules are applied to establish precedence order among competing status conditions
Context: Hold conditions are present along with other status conditions
GIVEN
Hold conditions are present along with other status conditions
Applied to: Hold Takes Precedence?
WHEN
The system evaluates precedence according to regulatory hierarchy
THEN
The system determines if hold conditions take absolute precedence over release, proceed, arrival, or export conditions
Context: Hold conditions have been determined to take precedence
GIVEN
Hold conditions have been determined to take precedence
Applied to: Final Status: HELD
WHEN
The system assigns the final cargo status
THEN
The cargo status is set to HELD and all other competing status conditions are overridden
Context: Both hold and release conditions are present and hold does not take absolute precedence
GIVEN
Both hold and release conditions are present and hold does not take absolute precedence
Applied to: Release Overrides Hold?
WHEN
The system evaluates if release authorization can override the hold
THEN
The system determines if release conditions have sufficient authority to override hold conditions based on regulatory rules
Context: Release conditions have been determined to override hold conditions
GIVEN
Release conditions have been determined to override hold conditions
Applied to: Final Status: RELEASED
WHEN
The system assigns the final cargo status
THEN
The cargo status is set to RELEASED and hold conditions are overridden by authorized release
Context: Proceed conditions are present and neither hold nor release take precedence
GIVEN
Proceed conditions are present and neither hold nor release take precedence
Applied to: Proceed Conditions Valid?
WHEN
The system validates proceed condition legitimacy
THEN
The system determines if proceed conditions meet all regulatory requirements and can be applied as final status
Context: Proceed conditions have been validated as legitimate and applicable
GIVEN
Proceed conditions have been validated as legitimate and applicable
Applied to: Final Status: PROCEED
WHEN
The system assigns the final cargo status
THEN
The cargo status is set to PROCEED allowing cargo movement according to disposition instructions
Context: Arrival conditions are present and higher precedence conditions do not apply
GIVEN
Arrival conditions are present and higher precedence conditions do not apply
Applied to: Arrival Status Valid?
WHEN
The system validates arrival status legitimacy
THEN
The system determines if arrival conditions meet all requirements and can be applied as final status
Context: Arrival conditions have been validated as legitimate and applicable
GIVEN
Arrival conditions have been validated as legitimate and applicable
Applied to: Final Status: ARRIVED
WHEN
The system assigns the final cargo status
THEN
The cargo status is set to ARRIVED indicating successful cargo arrival at destination
Context: Export conditions are present and higher precedence conditions do not apply
GIVEN
Export conditions are present and higher precedence conditions do not apply
Applied to: Export Status Valid?
WHEN
The system validates export status legitimacy
THEN
The system determines if export conditions meet all requirements and can be applied as final status
Context: Export conditions have been validated as legitimate and applicable
GIVEN
Export conditions have been validated as legitimate and applicable
Applied to: Final Status: EXPORTED
WHEN
The system assigns the final cargo status
THEN
The cargo status is set to EXPORTED indicating cargo has been processed for export
Context: No specific status conditions (hold, release, proceed, arrival, export) are valid or applicable
GIVEN
No specific status conditions (hold, release, proceed, arrival, export) are valid or applicable
Applied to: Final Status: DEFAULT
WHEN
The system assigns the final cargo status
THEN
The cargo status is set to a default value indicating standard processing state
Context: A final cargo status has been determined through priority rule application
GIVEN
A final cargo status has been determined through priority rule application
Applied to: Return Final Cargo Status
WHEN
The status determination process completes
THEN
The final cargo status is returned to the calling process for further business operations
R-GCX016E-cbl-03277 (+9) File: GCX016E.cbl K1 Comment Integration Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'K1 Comment Integration Processing':
  • Context - a k1 segment is received for processing:
    For Validate K1 Segment Format:
    When the system validates the k1 segment format and structure, then the segment is accepted if format is valid, otherwise it is rejected and logged as invalid.
  • Context - a valid k1 segment has been received:
    For Extract Free-Form Text Content:
    When the system processes the k1 segment to extract message content, then the free-form text content is extracted and made available for comment type determination.
  • Context - free-form text content has been extracted from a k1 segment:
    For Determine Comment Type:
    When the system analyzes the content to determine comment classification, then the comment is classified as either special comment type or standard comment type based on content analysis.
  • Context - a k1 comment has been classified as special comment type:
    For Canadian Pacific Railway Bond Creation:
    When the comment content contains 'director of customs, cp rail' or 'canadian pacific limited' or 'canadian pacific railway co', then the system triggers canadian pacific railway bond creation processing and generates appropriate broker bond messages.
  • Context - a k1 comment has been processed and classified:
    For Store K1 Comment in Memory:
    When the system stores the comment for integration with disposition processing, then the k1 comment is stored in memory with up to 4 lines of comment text available for notification integration.
  • Context - a k1 comment is stored in memory and a disposition code is being processed:
    For Associate with Current Disposition Code:
    When the system associates the comment with the current disposition code context, then the k1 comment becomes available for inclusion in disposition code notifications and merlin messages.
  • Context - a k1 comment is ready for integration with disposition notifications:
    For Train or Cargo Context?:
    When the system evaluates the current processing context, then the comment is routed to either train disposition notification or cargo disposition notification based on the current processing context.
  • Context - k1 comments are available for integration and merlin messages are being generated:
    For Add to Merlin Message Content:
    When the system formats merlin message content including disposition code information, then k1 comments are included in the merlin message content along with cargo information, disposition codes, and other relevant details.
  • Context - k1 comments are integrated with merlin messages and release quantity impacts are being calculated:
    For Include in Release Quantity Impact Message:
    When the system generates messages showing quantity impact of disposition codes, then k1 comments are included to provide additional context about how release quantities will be affected (add/subtract).
  • Context - a k1 segment fails format validation:
    For Log Invalid K1 Segment:
    When the system processes the invalid segment, then the invalid k1 segment is logged for audit purposes and processing continues without including the invalid comment.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 segment is received for processing
GIVEN
A K1 segment is received for processing
Applied to: Validate K1 Segment Format
WHEN
The system validates the K1 segment format and structure
THEN
The segment is accepted if format is valid, otherwise it is rejected and logged as invalid
Context: A valid K1 segment has been received
GIVEN
A valid K1 segment has been received
Applied to: Extract Free-Form Text Content
WHEN
The system processes the K1 segment to extract message content
THEN
The free-form text content is extracted and made available for comment type determination
Context: Free-form text content has been extracted from a K1 segment
GIVEN
Free-form text content has been extracted from a K1 segment
Applied to: Determine Comment Type
WHEN
The system analyzes the content to determine comment classification
THEN
The comment is classified as either special comment type or standard comment type based on content analysis
Context: A K1 comment has been classified as special comment type
GIVEN
A K1 comment has been classified as special comment type
Applied to: Canadian Pacific Railway Bond Creation
WHEN
The comment content contains 'DIRECTOR OF CUSTOMS, CP RAIL' or 'CANADIAN PACIFIC LIMITED' or 'CANADIAN PACIFIC RAILWAY CO'
THEN
The system triggers Canadian Pacific Railway bond creation processing and generates appropriate broker bond messages
Context: A K1 comment has been processed and classified
GIVEN
A K1 comment has been processed and classified
Applied to: Store K1 Comment in Memory
WHEN
The system stores the comment for integration with disposition processing
THEN
The K1 comment is stored in memory with up to 4 lines of comment text available for notification integration
Context: A K1 comment is stored in memory and a disposition code is being processed
GIVEN
A K1 comment is stored in memory and a disposition code is being processed
Applied to: Associate with Current Disposition Code
WHEN
The system associates the comment with the current disposition code context
THEN
The K1 comment becomes available for inclusion in disposition code notifications and Merlin messages
Context: A K1 comment is ready for integration with disposition notifications
GIVEN
A K1 comment is ready for integration with disposition notifications
Applied to: Train or Cargo Context?
WHEN
The system evaluates the current processing context
THEN
The comment is routed to either train disposition notification or cargo disposition notification based on the current processing context
Context: K1 comments are available for integration and Merlin messages are being generated
GIVEN
K1 comments are available for integration and Merlin messages are being generated
Applied to: Add to Merlin Message Content
WHEN
The system formats Merlin message content including disposition code information
THEN
K1 comments are included in the Merlin message content along with cargo information, disposition codes, and other relevant details
Context: K1 comments are integrated with Merlin messages and release quantity impacts are being calculated
GIVEN
K1 comments are integrated with Merlin messages and release quantity impacts are being calculated
Applied to: Include in Release Quantity Impact Message
WHEN
The system generates messages showing quantity impact of disposition codes
THEN
K1 comments are included to provide additional context about how release quantities will be affected (add/subtract)
Context: A K1 segment fails format validation
GIVEN
A K1 segment fails format validation
Applied to: Log Invalid K1 Segment
WHEN
The system processes the invalid segment
THEN
The invalid K1 segment is logged for audit purposes and processing continues without including the invalid comment
R-GCX016E-cbl-03287 (+13) File: GCX016E.cbl Cargo Segment Data Analysis Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Segment Data Analysis':
  • Context - a cargo record exists and requires freight forwarder analysis:
    For Retrieve GCSUSS03 Cargo Segment Data:
    When the system initiates cargo segment data analysis, then the system retrieves gcsuss03 cargo segment data for processing.
  • Context - primary cargo segment data has been retrieved from gcsuss03:
    For Retrieve GCSUSS07 Cargo Segment Data:
    When the system continues cargo segment data analysis, then the system retrieves gcsuss07 cargo segment data for additional processing.
  • Context - gcsuss03 and gcsuss07 cargo segment data have been retrieved:
    For Extract Freight Forwarder Identifiers:
    When the system processes the cargo segment data, then the system extracts freight forwarder identifiers from the segment data.
  • Context - freight forwarder identifier extraction has been completed:
    For Freight Forwarder ID Found?:
    When the system evaluates the extraction results, then the system determines if a valid freight forwarder id was found and proceeds accordingly.
  • Context - a valid freight forwarder id has been found in cargo segments:
    For Search Broker Database for Freight Forwarder:
    When the system needs to validate the freight forwarder, then the system searches the broker database for matching freight forwarder information.
  • Context - freight forwarder information has been located in the broker database:
    For Validate Broker Relationship:
    When the system evaluates the broker-freight forwarder relationship, then the system validates whether a legitimate broker relationship exists.
  • Context - broker relationship validation has been completed:
    For Valid Broker Relationship?:
    When the system evaluates the validation results, then the system determines if the broker relationship is valid and routes processing accordingly.
  • Context - a valid broker relationship has been established with the freight forwarder:
    For Retrieve Freight Forwarder Name:
    When the system needs freight forwarder identification details, then the system retrieves the freight forwarder name from the broker records.
  • Context - freight forwarder name has been retrieved from broker records:
    For Retrieve Contact Information:
    When the system needs to obtain contact details for notifications, then the system retrieves contact information from gcstbrt table segments.
  • Context - freight forwarder contact information has been retrieved:
    For Determine Notification Requirements:
    When the system evaluates notification requirements, then the system determines the appropriate notification method and requirements based on freight forwarder setup and cargo status.
  • Context - notification requirements have been determined for the freight forwarder:
    For CIH Hold Scenario?:
    When the system evaluates the cargo hold status, then the system determines if the scenario qualifies as a cih hold requiring email notification.
  • Context - the cargo situation has been identified as a cih hold scenario:
    For Set Email Notification Required Flag:
    When the system processes the hold scenario determination, then the system sets the email notification required flag to trigger email delivery.
  • Context - either no freight forwarder id was found, no valid broker relationship exists, or the scenario is not a cih hold:
    For Set No Notification Required Flag:
    When the system determines notification requirements, then the system sets the no notification required flag to bypass email delivery.
  • Context - either email notification required flag or no notification required flag has been set:
    For Complete Analysis:
    When the system finalizes the cargo segment data analysis, then the system completes the analysis process with all notification requirements determined.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists and requires freight forwarder analysis
GIVEN
A cargo record exists and requires freight forwarder analysis
Applied to: Retrieve GCSUSS03 Cargo Segment Data
WHEN
The system initiates cargo segment data analysis
THEN
The system retrieves GCSUSS03 cargo segment data for processing
Context: Primary cargo segment data has been retrieved from GCSUSS03
GIVEN
Primary cargo segment data has been retrieved from GCSUSS03
Applied to: Retrieve GCSUSS07 Cargo Segment Data
WHEN
The system continues cargo segment data analysis
THEN
The system retrieves GCSUSS07 cargo segment data for additional processing
Context: GCSUSS03 and GCSUSS07 cargo segment data have been retrieved
GIVEN
GCSUSS03 and GCSUSS07 cargo segment data have been retrieved
Applied to: Extract Freight Forwarder Identifiers
WHEN
The system processes the cargo segment data
THEN
The system extracts freight forwarder identifiers from the segment data
Context: Freight forwarder identifier extraction has been completed
GIVEN
Freight forwarder identifier extraction has been completed
Applied to: Freight Forwarder ID Found?
WHEN
The system evaluates the extraction results
THEN
The system determines if a valid freight forwarder ID was found and proceeds accordingly
Context: A valid freight forwarder ID has been found in cargo segments
GIVEN
A valid freight forwarder ID has been found in cargo segments
Applied to: Search Broker Database for Freight Forwarder
WHEN
The system needs to validate the freight forwarder
THEN
The system searches the broker database for matching freight forwarder information
Context: Freight forwarder information has been located in the broker database
GIVEN
Freight forwarder information has been located in the broker database
Applied to: Validate Broker Relationship
WHEN
The system evaluates the broker-freight forwarder relationship
THEN
The system validates whether a legitimate broker relationship exists
Context: Broker relationship validation has been completed
GIVEN
Broker relationship validation has been completed
Applied to: Valid Broker Relationship?
WHEN
The system evaluates the validation results
THEN
The system determines if the broker relationship is valid and routes processing accordingly
Context: A valid broker relationship has been established with the freight forwarder
GIVEN
A valid broker relationship has been established with the freight forwarder
Applied to: Retrieve Freight Forwarder Name
WHEN
The system needs freight forwarder identification details
THEN
The system retrieves the freight forwarder name from the broker records
Context: Freight forwarder name has been retrieved from broker records
GIVEN
Freight forwarder name has been retrieved from broker records
Applied to: Retrieve Contact Information
WHEN
The system needs to obtain contact details for notifications
THEN
The system retrieves contact information from GCSTBRT table segments
Context: Freight forwarder contact information has been retrieved
GIVEN
Freight forwarder contact information has been retrieved
Applied to: Determine Notification Requirements
WHEN
The system evaluates notification requirements
THEN
The system determines the appropriate notification method and requirements based on freight forwarder setup and cargo status
Context: Notification requirements have been determined for the freight forwarder
GIVEN
Notification requirements have been determined for the freight forwarder
Applied to: CIH Hold Scenario?
WHEN
The system evaluates the cargo hold status
THEN
The system determines if the scenario qualifies as a CIH hold requiring email notification
Context: The cargo situation has been identified as a CIH hold scenario
GIVEN
The cargo situation has been identified as a CIH hold scenario
Applied to: Set Email Notification Required Flag
WHEN
The system processes the hold scenario determination
THEN
The system sets the email notification required flag to trigger email delivery
Context: Either no freight forwarder ID was found, no valid broker relationship exists, or the scenario is not a CIH hold
GIVEN
Either no freight forwarder ID was found, no valid broker relationship exists, or the scenario is not a CIH hold
Applied to: Set No Notification Required Flag
WHEN
The system determines notification requirements
THEN
The system sets the no notification required flag to bypass email delivery
Context: Either email notification required flag or no notification required flag has been set
GIVEN
Either email notification required flag or no notification required flag has been set
Applied to: Complete Analysis
WHEN
The system finalizes the cargo segment data analysis
THEN
The system completes the analysis process with all notification requirements determined
R-GCX016E-cbl-03301 (+15) File: GCX016E.cbl Individual Record Status Analysis Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Individual Record Status Analysis':
  • Context - a cargo record is being evaluated for status analysis:
    For Is Cargo Record Deleted?:
    When the cargo record has a deleted status indicator, then the cargo record is excluded from further processing and analysis.
  • Context - a non-deleted cargo record is being analyzed:
    For Check Manual Release Status:
    When the system checks the cargo's release status indicators, then the manual release status is determined and recorded for subsequent processing.
  • Context - a cargo record has been identified as manually released:
    For Set Manual Release Flag:
    When the manual release detection process completes, then the manual release flag is set for the cargo record.
  • Context - a cargo record is undergoing hold type evaluation:
    For Border Hold Present?:
    When the system checks for border hold indicators in the cargo status, then the presence or absence of border hold is determined.
  • Context - a cargo record has been identified with border hold conditions:
    For Set Border Hold Flag:
    When the border hold evaluation completes, then the border hold flag is set for the cargo record.
  • Context - a cargo record is being evaluated for hold types:
    For Destination Hold Present?:
    When the system checks for destination hold indicators in the cargo status, then the presence or absence of destination hold is determined.
  • Context - a cargo record has been identified with destination hold conditions:
    For Set Destination Hold Flag:
    When the destination hold evaluation completes, then the destination hold flag is set for the cargo record.
  • Context - a cargo record is being evaluated for regulatory hold types:
    For FDA Hold Present?:
    When the system checks for fda hold indicators in the cargo status, then the presence or absence of fda hold is determined.
  • Context - a cargo record has been identified with fda hold conditions:
    For Set FDA Hold Flag:
    When the fda hold evaluation completes, then the fda hold flag is set for the cargo record.
  • Context - a cargo record is being evaluated for quantity-related hold types:
    For Piece Count Hold Present?:
    When the system checks for piece count hold indicators in the cargo status, then the presence or absence of piece count hold is determined.
  • Context - a cargo record has piece count hold indicators:
    For Validate Piece Count:
    When the system validates the piece count against expected quantities, then the piece count validation result is determined.
  • Context - a cargo record has invalid piece count validation results:
    For Set Piece Count Hold Flag:
    When the piece count validation process completes, then the piece count hold flag is set for the cargo record.
  • Context - a cargo record has completed hold type evaluation:
    For All Holds Cleared?:
    When the system checks all hold flags (border, destination, fda, piece count), then the overall hold clearance status is determined.
  • Context - a cargo record has all hold conditions cleared:
    For Set Release Eligible Flag:
    When the release eligibility evaluation completes, then the release eligible flag is set for the cargo record.
  • Context - a cargo record has one or more active hold conditions:
    For Set Hold Status Flag:
    When the release eligibility evaluation completes, then the hold status flag is set for the cargo record.
  • Context - individual cargo record analysis has completed with all flags determined:
    For Update Cargo Status Flags:
    When the system updates the cargo record status information, then all status flags are updated to reflect the current cargo state.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being evaluated for status analysis
GIVEN
A cargo record is being evaluated for status analysis
Applied to: Is Cargo Record Deleted?
WHEN
The cargo record has a deleted status indicator
THEN
The cargo record is excluded from further processing and analysis
Context: A non-deleted cargo record is being analyzed
GIVEN
A non-deleted cargo record is being analyzed
Applied to: Check Manual Release Status
WHEN
The system checks the cargo's release status indicators
THEN
The manual release status is determined and recorded for subsequent processing
Context: A cargo record has been identified as manually released
GIVEN
A cargo record has been identified as manually released
Applied to: Set Manual Release Flag
WHEN
The manual release detection process completes
THEN
The manual release flag is set for the cargo record
Context: A cargo record is undergoing hold type evaluation
GIVEN
A cargo record is undergoing hold type evaluation
Applied to: Border Hold Present?
WHEN
The system checks for border hold indicators in the cargo status
THEN
The presence or absence of border hold is determined
Context: A cargo record has been identified with border hold conditions
GIVEN
A cargo record has been identified with border hold conditions
Applied to: Set Border Hold Flag
WHEN
The border hold evaluation completes
THEN
The border hold flag is set for the cargo record
Context: A cargo record is being evaluated for hold types
GIVEN
A cargo record is being evaluated for hold types
Applied to: Destination Hold Present?
WHEN
The system checks for destination hold indicators in the cargo status
THEN
The presence or absence of destination hold is determined
Context: A cargo record has been identified with destination hold conditions
GIVEN
A cargo record has been identified with destination hold conditions
Applied to: Set Destination Hold Flag
WHEN
The destination hold evaluation completes
THEN
The destination hold flag is set for the cargo record
Context: A cargo record is being evaluated for regulatory hold types
GIVEN
A cargo record is being evaluated for regulatory hold types
Applied to: FDA Hold Present?
WHEN
The system checks for FDA hold indicators in the cargo status
THEN
The presence or absence of FDA hold is determined
Context: A cargo record has been identified with FDA hold conditions
GIVEN
A cargo record has been identified with FDA hold conditions
Applied to: Set FDA Hold Flag
WHEN
The FDA hold evaluation completes
THEN
The FDA hold flag is set for the cargo record
Context: A cargo record is being evaluated for quantity-related hold types
GIVEN
A cargo record is being evaluated for quantity-related hold types
Applied to: Piece Count Hold Present?
WHEN
The system checks for piece count hold indicators in the cargo status
THEN
The presence or absence of piece count hold is determined
Context: A cargo record has piece count hold indicators
GIVEN
A cargo record has piece count hold indicators
Applied to: Validate Piece Count
WHEN
The system validates the piece count against expected quantities
THEN
The piece count validation result is determined
Context: A cargo record has invalid piece count validation results
GIVEN
A cargo record has invalid piece count validation results
Applied to: Set Piece Count Hold Flag
WHEN
The piece count validation process completes
THEN
The piece count hold flag is set for the cargo record
Context: A cargo record has completed hold type evaluation
GIVEN
A cargo record has completed hold type evaluation
Applied to: All Holds Cleared?
WHEN
The system checks all hold flags (border, destination, FDA, piece count)
THEN
The overall hold clearance status is determined
Context: A cargo record has all hold conditions cleared
GIVEN
A cargo record has all hold conditions cleared
Applied to: Set Release Eligible Flag
WHEN
The release eligibility evaluation completes
THEN
The release eligible flag is set for the cargo record
Context: A cargo record has one or more active hold conditions
GIVEN
A cargo record has one or more active hold conditions
Applied to: Set Hold Status Flag
WHEN
The release eligibility evaluation completes
THEN
The hold status flag is set for the cargo record
Context: Individual cargo record analysis has completed with all flags determined
GIVEN
Individual cargo record analysis has completed with all flags determined
Applied to: Update Cargo Status Flags
WHEN
The system updates the cargo record status information
THEN
All status flags are updated to reflect the current cargo state
R-GCX016E-cbl-03317 (+16) File: GCX016E.cbl M10 Manifest Data Extraction Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'M10 Manifest Data Extraction':
  • Context - an m10 segment is received with manifest data:
    For Extract SCAC Code from M10:
    When the system processes the m10 segment, then the scac code is extracted from positions 3-6 of the m10 segment.
  • Context - a scac code has been extracted from the m10 segment:
    For SCAC Code Valid?:
    When the system validates the scac code, then the scac code must be non-blank and contain valid alphanumeric characters.
  • Context - an m10 segment with valid scac code is being processed:
    For Extract Transport Type:
    When the system extracts transport type information, then the transport type code is extracted from the designated position in the m10 segment.
  • Context - a transport type code has been extracted from the m10 segment:
    For Transport Type Valid?:
    When the system validates the transport type, then the transport type must be a valid code representing rail, truck, vessel, or air transportation.
  • Context - an m10 segment with valid transport type is being processed:
    For Extract Country Code:
    When the system extracts country code information, then the country code is extracted from the designated position in the m10 segment.
  • Context - a country code has been extracted from the m10 segment:
    For Country Code Valid?:
    When the system validates the country code, then the country code must be a valid iso country code or recognized customs country identifier.
  • Context - an m10 segment with valid country code is being processed:
    For Extract Vessel Name:
    When the system extracts vessel name information, then the vessel name is extracted from positions 7-16 of the m10 segment.
  • Context - a vessel name has been extracted from the m10 segment:
    For Extract Vessel Details:
    When the system extracts additional vessel details, then voyage number, vessel flag, and other vessel identifiers are extracted from their respective positions in the m10 segment.
  • Context - vessel details have been extracted from the m10 segment:
    For Vessel Info Valid?:
    When the system validates the vessel information, then the vessel name must be non-blank and vessel details must conform to transportation standards.
  • Context - valid vessel information has been extracted from the m10 segment:
    For Extract Cross-Border Routing Info:
    When the system extracts cross-border routing information, then port of entry, port of exit, and routing codes are extracted from their designated positions in the m10 segment.
  • Context - cross-border routing information has been extracted from the m10 segment:
    For Routing Valid?:
    When the system validates the routing information, then port codes must be valid customs ports and routing must be logically consistent for the transportation mode.
  • Context - all m10 segment data has been validated successfully:
    For Build Foreign Manifest Structure:
    When the system builds the foreign manifest structure, then a complete foreign manifest record is created with scac, transport type, country, vessel, and routing information.
  • Context - a foreign manifest structure has been built:
    For Set Manifest Data Fields:
    When the system sets manifest data fields, then all extracted data elements are assigned to their corresponding fields in the manifest record.
  • Context - manifest data fields have been set with extracted information:
    For Manifest Complete?:
    When the system validates the complete manifest, then all mandatory fields must be populated and the manifest must meet completeness requirements for customs processing.
  • Context - a complete and validated manifest has been created:
    For Store Manifest Data:
    When the system stores the manifest data, then the manifest data is stored in the system for subsequent cargo and customs processing.
  • Context - manifest validation has failed for any required field:
    For Generate Error Message:
    When the system generates an error message, then a descriptive error message is created indicating the specific validation failure and the manifest is marked as invalid.
  • Context - some m10 segment data is invalid but not critical for processing:
    For Set Default Values:
    When the system sets default values, then appropriate default values are assigned to non-critical fields to allow continued processing.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 segment is received with manifest data
GIVEN
An M10 segment is received with manifest data
Applied to: Extract SCAC Code from M10
WHEN
The system processes the M10 segment
THEN
The SCAC code is extracted from positions 3-6 of the M10 segment
Context: A SCAC code has been extracted from the M10 segment
GIVEN
A SCAC code has been extracted from the M10 segment
Applied to: SCAC Code Valid?
WHEN
The system validates the SCAC code
THEN
The SCAC code must be non-blank and contain valid alphanumeric characters
Context: An M10 segment with valid SCAC code is being processed
GIVEN
An M10 segment with valid SCAC code is being processed
Applied to: Extract Transport Type
WHEN
The system extracts transport type information
THEN
The transport type code is extracted from the designated position in the M10 segment
Context: A transport type code has been extracted from the M10 segment
GIVEN
A transport type code has been extracted from the M10 segment
Applied to: Transport Type Valid?
WHEN
The system validates the transport type
THEN
The transport type must be a valid code representing rail, truck, vessel, or air transportation
Context: An M10 segment with valid transport type is being processed
GIVEN
An M10 segment with valid transport type is being processed
Applied to: Extract Country Code
WHEN
The system extracts country code information
THEN
The country code is extracted from the designated position in the M10 segment
Context: A country code has been extracted from the M10 segment
GIVEN
A country code has been extracted from the M10 segment
Applied to: Country Code Valid?
WHEN
The system validates the country code
THEN
The country code must be a valid ISO country code or recognized customs country identifier
Context: An M10 segment with valid country code is being processed
GIVEN
An M10 segment with valid country code is being processed
Applied to: Extract Vessel Name
WHEN
The system extracts vessel name information
THEN
The vessel name is extracted from positions 7-16 of the M10 segment
Context: A vessel name has been extracted from the M10 segment
GIVEN
A vessel name has been extracted from the M10 segment
Applied to: Extract Vessel Details
WHEN
The system extracts additional vessel details
THEN
Voyage number, vessel flag, and other vessel identifiers are extracted from their respective positions in the M10 segment
Context: Vessel details have been extracted from the M10 segment
GIVEN
Vessel details have been extracted from the M10 segment
Applied to: Vessel Info Valid?
WHEN
The system validates the vessel information
THEN
The vessel name must be non-blank and vessel details must conform to transportation standards
Context: Valid vessel information has been extracted from the M10 segment
GIVEN
Valid vessel information has been extracted from the M10 segment
Applied to: Extract Cross-Border Routing Info
WHEN
The system extracts cross-border routing information
THEN
Port of entry, port of exit, and routing codes are extracted from their designated positions in the M10 segment
Context: Cross-border routing information has been extracted from the M10 segment
GIVEN
Cross-border routing information has been extracted from the M10 segment
Applied to: Routing Valid?
WHEN
The system validates the routing information
THEN
Port codes must be valid customs ports and routing must be logically consistent for the transportation mode
Context: All M10 segment data has been validated successfully
GIVEN
All M10 segment data has been validated successfully
Applied to: Build Foreign Manifest Structure
WHEN
The system builds the foreign manifest structure
THEN
A complete foreign manifest record is created with SCAC, transport type, country, vessel, and routing information
Context: A foreign manifest structure has been built
GIVEN
A foreign manifest structure has been built
Applied to: Set Manifest Data Fields
WHEN
The system sets manifest data fields
THEN
All extracted data elements are assigned to their corresponding fields in the manifest record
Context: Manifest data fields have been set with extracted information
GIVEN
Manifest data fields have been set with extracted information
Applied to: Manifest Complete?
WHEN
The system validates the complete manifest
THEN
All mandatory fields must be populated and the manifest must meet completeness requirements for customs processing
Context: A complete and validated manifest has been created
GIVEN
A complete and validated manifest has been created
Applied to: Store Manifest Data
WHEN
The system stores the manifest data
THEN
The manifest data is stored in the system for subsequent cargo and customs processing
Context: Manifest validation has failed for any required field
GIVEN
Manifest validation has failed for any required field
Applied to: Generate Error Message
WHEN
The system generates an error message
THEN
A descriptive error message is created indicating the specific validation failure and the manifest is marked as invalid
Context: Some M10 segment data is invalid but not critical for processing
GIVEN
Some M10 segment data is invalid but not critical for processing
Applied to: Set Default Values
WHEN
The system sets default values
THEN
Appropriate default values are assigned to non-critical fields to allow continued processing
R-GCX016E-cbl-03334 (+23) File: GCX016E.cbl Search S09A Status Array for Existing Codes Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search S09A Status Array for Existing Codes':
  • Context - a status array search operation is initiated:
    For Initialize Search Parameters:
    When the search process begins, then all search parameters are initialized including duplicate flags, conflict flags, position counters, and removal lists are cleared.
  • Context - a cargo record exists with potential s09a status array data:
    For Load Current S09A Status Array:
    When the status array loading process is executed, then the current s09a status array is loaded into working storage for analysis.
  • Context - the s09a status array has been loaded:
    For Status Array Empty?:
    When the array is examined for content, then if the array contains no entries, set array empty flag and terminate search; otherwise proceed with sequential search.
  • Context - the s09a status array has been examined and found to contain no entries:
    For Set Array Empty Flag:
    When the empty condition is confirmed, then set the array empty flag to indicate no disposition codes exist for processing.
  • Context - the s09a status array contains one or more entries:
    For Begin Sequential Array Search:
    When the sequential search process is initiated, then begin iterating through each status array entry starting from the first position.
  • Context - a sequential search through the status array is in progress:
    For More Array Entries?:
    When the current position in the array is evaluated, then if more entries exist, continue to next entry; otherwise complete the array analysis.
  • Context - more entries exist in the status array to examine:
    For Get Next Status Entry:
    When the next entry retrieval is executed, then the next status array entry is loaded for disposition code analysis.
  • Context - a status array entry has been retrieved:
    For Extract Disposition Code:
    When the disposition code extraction is performed, then the disposition code is extracted from the entry for comparison purposes.
  • Context - a disposition code has been extracted from the current status entry and a target code is defined:
    For Code Matches Target?:
    When the code comparison is performed, then if the extracted code matches the target code, mark as duplicate found; otherwise check for counterpart codes.
  • Context - the extracted disposition code matches the target code being searched:
    For Mark Duplicate Found:
    When the duplicate marking process is executed, then set the duplicate found flag to indicate an existing matching disposition code.
  • Context - a duplicate disposition code has been identified in the status array:
    For Record Entry Position:
    When the position recording is performed, then record the current array position for potential future reference or removal operations.
  • Context - a disposition code has been extracted from the status array entry:
    For Check for Counterpart Codes:
    When the counterpart code analysis is performed, then determine if the current code conflicts with existing codes and requires counterpart removal.
  • Context - the counterpart code analysis has been completed for the current disposition code:
    For Counterpart Code Found?:
    When the counterpart detection results are evaluated, then if counterpart codes are found, mark for removal; otherwise continue with the search process.
  • Context - counterpart disposition codes have been identified that conflict with the current processing:
    For Mark for Removal:
    When the removal marking process is executed, then mark the conflicting codes for removal from the status array.
  • Context - disposition codes have been marked for removal due to conflicts:
    For Add to Removal List:
    When the removal list update is performed, then add the conflicting codes and their positions to the removal list for subsequent processing.
  • Context - the current status array entry has been processed for duplicates and conflicts:
    For Continue Search:
    When the search continuation is executed, then move to the next array position to continue the sequential search process.
  • Context - all entries in the s09a status array have been examined:
    For Complete Array Analysis:
    When the array analysis completion is executed, then prepare to evaluate the search results for duplicates and conflicts.
  • Context - the complete status array has been searched for disposition codes:
    For Duplicates Found?:
    When the duplicate detection results are evaluated, then if duplicates were found, set duplicate flag; otherwise proceed to check for conflicts.
  • Context - duplicate disposition codes have been identified during the array search:
    For Set Duplicate Flag:
    When the duplicate flag setting is executed, then set the duplicate flag to indicate that matching disposition codes already exist.
  • Context - the status array search has been completed and duplicate analysis is done:
    For Conflicts Found?:
    When the conflict detection results are evaluated, then if conflicts were found, set conflict flag; otherwise prepare search results.
  • Context - conflicting counterpart disposition codes have been identified during the search:
    For Set Conflict Flag:
    When the conflict flag setting is executed, then set the conflict flag to indicate that counterpart codes need removal.
  • Context - the status array search has been completed with duplicate and conflict analysis:
    For Prepare Search Results:
    When the search results preparation is executed, then compile all search findings including duplicate flags, conflict flags, positions, and removal lists.
  • Context - the search results have been prepared with all findings compiled:
    For Return Search Status:
    When the search status return is executed, then return the complete search status including duplicate indicators, conflict indicators, and removal requirements.
  • Context - the search status has been returned to the calling process:
    For End Search Process:
    When the search process termination is executed, then end the status array search operation and return control to the disposition code processing logic.
👨‍💻 Technical ACs (Gherkin)
Context: A status array search operation is initiated
GIVEN
A status array search operation is initiated
Applied to: Initialize Search Parameters
WHEN
The search process begins
THEN
All search parameters are initialized including duplicate flags, conflict flags, position counters, and removal lists are cleared
Context: A cargo record exists with potential S09A status array data
GIVEN
A cargo record exists with potential S09A status array data
Applied to: Load Current S09A Status Array
WHEN
The status array loading process is executed
THEN
The current S09A status array is loaded into working storage for analysis
Context: The S09A status array has been loaded
GIVEN
The S09A status array has been loaded
Applied to: Status Array Empty?
WHEN
The array is examined for content
THEN
If the array contains no entries, set array empty flag and terminate search; otherwise proceed with sequential search
Context: The S09A status array has been examined and found to contain no entries
GIVEN
The S09A status array has been examined and found to contain no entries
Applied to: Set Array Empty Flag
WHEN
The empty condition is confirmed
THEN
Set the array empty flag to indicate no disposition codes exist for processing
Context: The S09A status array contains one or more entries
GIVEN
The S09A status array contains one or more entries
Applied to: Begin Sequential Array Search
WHEN
The sequential search process is initiated
THEN
Begin iterating through each status array entry starting from the first position
Context: A sequential search through the status array is in progress
GIVEN
A sequential search through the status array is in progress
Applied to: More Array Entries?
WHEN
The current position in the array is evaluated
THEN
If more entries exist, continue to next entry; otherwise complete the array analysis
Context: More entries exist in the status array to examine
GIVEN
More entries exist in the status array to examine
Applied to: Get Next Status Entry
WHEN
The next entry retrieval is executed
THEN
The next status array entry is loaded for disposition code analysis
Context: A status array entry has been retrieved
GIVEN
A status array entry has been retrieved
Applied to: Extract Disposition Code
WHEN
The disposition code extraction is performed
THEN
The disposition code is extracted from the entry for comparison purposes
Context: A disposition code has been extracted from the current status entry and a target code is defined
GIVEN
A disposition code has been extracted from the current status entry and a target code is defined
Applied to: Code Matches Target?
WHEN
The code comparison is performed
THEN
If the extracted code matches the target code, mark as duplicate found; otherwise check for counterpart codes
Context: The extracted disposition code matches the target code being searched
GIVEN
The extracted disposition code matches the target code being searched
Applied to: Mark Duplicate Found
WHEN
The duplicate marking process is executed
THEN
Set the duplicate found flag to indicate an existing matching disposition code
Context: A duplicate disposition code has been identified in the status array
GIVEN
A duplicate disposition code has been identified in the status array
Applied to: Record Entry Position
WHEN
The position recording is performed
THEN
Record the current array position for potential future reference or removal operations
Context: A disposition code has been extracted from the status array entry
GIVEN
A disposition code has been extracted from the status array entry
Applied to: Check for Counterpart Codes
WHEN
The counterpart code analysis is performed
THEN
Determine if the current code conflicts with existing codes and requires counterpart removal
Context: The counterpart code analysis has been completed for the current disposition code
GIVEN
The counterpart code analysis has been completed for the current disposition code
Applied to: Counterpart Code Found?
WHEN
The counterpart detection results are evaluated
THEN
If counterpart codes are found, mark for removal; otherwise continue with the search process
Context: Counterpart disposition codes have been identified that conflict with the current processing
GIVEN
Counterpart disposition codes have been identified that conflict with the current processing
Applied to: Mark for Removal
WHEN
The removal marking process is executed
THEN
Mark the conflicting codes for removal from the status array
Context: Disposition codes have been marked for removal due to conflicts
GIVEN
Disposition codes have been marked for removal due to conflicts
Applied to: Add to Removal List
WHEN
The removal list update is performed
THEN
Add the conflicting codes and their positions to the removal list for subsequent processing
Context: The current status array entry has been processed for duplicates and conflicts
GIVEN
The current status array entry has been processed for duplicates and conflicts
Applied to: Continue Search
WHEN
The search continuation is executed
THEN
Move to the next array position to continue the sequential search process
Context: All entries in the S09A status array have been examined
GIVEN
All entries in the S09A status array have been examined
Applied to: Complete Array Analysis
WHEN
The array analysis completion is executed
THEN
Prepare to evaluate the search results for duplicates and conflicts
Context: The complete status array has been searched for disposition codes
GIVEN
The complete status array has been searched for disposition codes
Applied to: Duplicates Found?
WHEN
The duplicate detection results are evaluated
THEN
If duplicates were found, set duplicate flag; otherwise proceed to check for conflicts
Context: Duplicate disposition codes have been identified during the array search
GIVEN
Duplicate disposition codes have been identified during the array search
Applied to: Set Duplicate Flag
WHEN
The duplicate flag setting is executed
THEN
Set the duplicate flag to indicate that matching disposition codes already exist
Context: The status array search has been completed and duplicate analysis is done
GIVEN
The status array search has been completed and duplicate analysis is done
Applied to: Conflicts Found?
WHEN
The conflict detection results are evaluated
THEN
If conflicts were found, set conflict flag; otherwise prepare search results
Context: Conflicting counterpart disposition codes have been identified during the search
GIVEN
Conflicting counterpart disposition codes have been identified during the search
Applied to: Set Conflict Flag
WHEN
The conflict flag setting is executed
THEN
Set the conflict flag to indicate that counterpart codes need removal
Context: The status array search has been completed with duplicate and conflict analysis
GIVEN
The status array search has been completed with duplicate and conflict analysis
Applied to: Prepare Search Results
WHEN
The search results preparation is executed
THEN
Compile all search findings including duplicate flags, conflict flags, positions, and removal lists
Context: The search results have been prepared with all findings compiled
GIVEN
The search results have been prepared with all findings compiled
Applied to: Return Search Status
WHEN
The search status return is executed
THEN
Return the complete search status including duplicate indicators, conflict indicators, and removal requirements
Context: The search status has been returned to the calling process
GIVEN
The search status has been returned to the calling process
Applied to: End Search Process
WHEN
The search process termination is executed
THEN
End the status array search operation and return control to the disposition code processing logic
R-GCX016E-cbl-03358 (+11) File: GCX016E.cbl Convert EDI Entry Type Code Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Convert EDI Entry Type Code':
  • Context - an x4 segment is being processed for cargo disposition:
    For Entry Type Code Present?:
    When the system checks for the presence of an entry type code in the segment, then if entry type code is present, continue with conversion process, otherwise skip entry type processing and continue with other segment processing.
  • Context - an edi entry type code is present in the x4 segment and conversion arrays are initialized:
    For Lookup EDI Code in Conversion Table:
    When the system searches the edi entry type code conversion table for a matching code, then the system locates the position of the edi code in the lookup array for further processing.
  • Context - an edi entry type code has been searched in the conversion table:
    For Code Found in Table?:
    When the system evaluates whether the code was found in the lookup table, then if code is found, retrieve the internal system value, otherwise generate an error message for invalid code.
  • Context - the edi entry type code is found in the conversion lookup table:
    For Retrieve Internal System Value:
    When the system retrieves the corresponding internal value from the same array position, then the internal system entry type value is obtained for further processing.
  • Context - an internal system entry type value has been retrieved from the conversion table:
    For Border Crossing Code?:
    When the system evaluates whether the entry type code indicates a border crossing, then if it is a border crossing code, apply special border crossing logic, otherwise proceed with standard in-bond flag processing.
  • Context - the entry type code is identified as a border crossing code:
    For Apply Special Border Crossing Logic:
    When the system applies border crossing specific processing rules, then special border crossing logic is applied including canadian border location mapping.
  • Context - a border crossing entry type code requires location mapping:
    For Map to Canadian Border Location:
    When the system maps the code to canadian border crossing locations, then the appropriate canadian border location identifier is assigned to the cargo record.
  • Context - an entry type code has been processed (either border crossing or standard):
    For Set Master In-Bond Flag for Codes 61,62,63,69:
    When the entry type code is 61, 62, 63, or 69, then the master in-bond flag is set to indicate this cargo requires in-bond processing.
  • Context - entry type code processing including border crossing logic and in-bond flag setting has been completed:
    For Code Validation Successful?:
    When the system evaluates whether all validation steps were successful, then if validation is successful, update the cargo record with the internal code, otherwise generate an error message.
  • Context - entry type code validation has been successful:
    For Update Cargo Record with Internal Code:
    When the system updates the cargo record with the converted entry type information, then the cargo record is updated with the internal entry type code, border crossing information, and in-bond flags as applicable.
  • Context - the cargo record has been successfully updated with the converted entry type code:
    For Log Code Conversion Action:
    When the system logs the code conversion action, then an audit log entry is created documenting the entry type code conversion from edi format to internal system format.
  • Context - an entry type code cannot be found in the conversion table or validation fails:
    For Generate Error Message for Invalid Code:
    When the system generates an error message for the invalid entry type code, then an error message is created indicating the entry type code is invalid and cannot be processed.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed for cargo disposition
GIVEN
An X4 segment is being processed for cargo disposition
Applied to: Entry Type Code Present?
WHEN
The system checks for the presence of an entry type code in the segment
THEN
If entry type code is present, continue with conversion process, otherwise skip entry type processing and continue with other segment processing
Context: An EDI entry type code is present in the X4 segment and conversion arrays are initialized
GIVEN
An EDI entry type code is present in the X4 segment and conversion arrays are initialized
Applied to: Lookup EDI Code in Conversion Table
WHEN
The system searches the EDI entry type code conversion table for a matching code
THEN
The system locates the position of the EDI code in the lookup array for further processing
Context: An EDI entry type code has been searched in the conversion table
GIVEN
An EDI entry type code has been searched in the conversion table
Applied to: Code Found in Table?
WHEN
The system evaluates whether the code was found in the lookup table
THEN
If code is found, retrieve the internal system value, otherwise generate an error message for invalid code
Context: The EDI entry type code is found in the conversion lookup table
GIVEN
The EDI entry type code is found in the conversion lookup table
Applied to: Retrieve Internal System Value
WHEN
The system retrieves the corresponding internal value from the same array position
THEN
The internal system entry type value is obtained for further processing
Context: An internal system entry type value has been retrieved from the conversion table
GIVEN
An internal system entry type value has been retrieved from the conversion table
Applied to: Border Crossing Code?
WHEN
The system evaluates whether the entry type code indicates a border crossing
THEN
If it is a border crossing code, apply special border crossing logic, otherwise proceed with standard in-bond flag processing
Context: The entry type code is identified as a border crossing code
GIVEN
The entry type code is identified as a border crossing code
Applied to: Apply Special Border Crossing Logic
WHEN
The system applies border crossing specific processing rules
THEN
Special border crossing logic is applied including Canadian border location mapping
Context: A border crossing entry type code requires location mapping
GIVEN
A border crossing entry type code requires location mapping
Applied to: Map to Canadian Border Location
WHEN
The system maps the code to Canadian border crossing locations
THEN
The appropriate Canadian border location identifier is assigned to the cargo record
Context: An entry type code has been processed (either border crossing or standard)
GIVEN
An entry type code has been processed (either border crossing or standard)
Applied to: Set Master In-Bond Flag for Codes 61,62,63,69
WHEN
The entry type code is 61, 62, 63, or 69
THEN
The master in-bond flag is set to indicate this cargo requires in-bond processing
Context: Entry type code processing including border crossing logic and in-bond flag setting has been completed
GIVEN
Entry type code processing including border crossing logic and in-bond flag setting has been completed
Applied to: Code Validation Successful?
WHEN
The system evaluates whether all validation steps were successful
THEN
If validation is successful, update the cargo record with the internal code, otherwise generate an error message
Context: Entry type code validation has been successful
GIVEN
Entry type code validation has been successful
Applied to: Update Cargo Record with Internal Code
WHEN
The system updates the cargo record with the converted entry type information
THEN
The cargo record is updated with the internal entry type code, border crossing information, and in-bond flags as applicable
Context: The cargo record has been successfully updated with the converted entry type code
GIVEN
The cargo record has been successfully updated with the converted entry type code
Applied to: Log Code Conversion Action
WHEN
The system logs the code conversion action
THEN
An audit log entry is created documenting the entry type code conversion from EDI format to internal system format
Context: An entry type code cannot be found in the conversion table or validation fails
GIVEN
An entry type code cannot be found in the conversion table or validation fails
Applied to: Generate Error Message for Invalid Code
WHEN
The system generates an error message for the invalid entry type code
THEN
An error message is created indicating the entry type code is invalid and cannot be processed
R-GCX016E-cbl-03380 (+12) File: GCX016E.cbl Initialize Status Array from Valid Segment Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Status Array from Valid Segment':
  • Context - a cargo record exists in the system:
    For Retrieve S09 Status Segment from Database:
    When the system needs to retrieve s09 status segments from the database, then the system should fetch the status segment data from gcsuss09 table.
  • Context - a database query for s09 status segment has been executed:
    For Valid Segment Found?:
    When the system checks if a valid segment was found, then the system should determine if segment data exists and is accessible for processing.
  • Context - a status segment has been retrieved from the database:
    For Validate Segment Structure:
    When the system validates the segment structure, then the system should verify that the segment contains valid data fields, proper formatting, and required elements.
  • Context - a status segment structure validation has been performed:
    For Segment Structure Valid?:
    When the system evaluates the validation results, then the system should determine if the segment structure meets required standards for array population.
  • Context - a valid status segment has been retrieved and validated:
    For Initialize S09A Status Array:
    When the system initializes the s09a status array, then the system should set up the array structure with proper indexing and prepare it for data population.
  • Context - a valid status segment is being processed:
    For Extract Sequence Number from Segment:
    When the system extracts the sequence number from the segment, then the system should identify and capture the sequence number for proper array ordering.
  • Context - a valid status segment with extracted sequence number is available:
    For Populate Array Entry with Segment Data:
    When the system populates the array entry with segment data, then the system should transfer all relevant status information from the segment into the appropriate array position.
  • Context - status segments are being processed with sequence numbers:
    For Track Maximum Sequence Number:
    When the system tracks the maximum sequence number, then the system should maintain the highest sequence number encountered for array boundary management.
  • Context - status segments are being processed for a cargo record:
    For More Segments Available?:
    When the system checks for more segments availability, then the system should determine if additional s09 segments exist that need to be processed for the current cargo.
  • Context - all available status segments have been processed:
    For Set Array Initialization Complete Flag:
    When the system completes array initialization, then the system should set a completion flag indicating that status array population is finished.
  • Context - status array initialization has been completed:
    For Log Array Population Results:
    When the system logs array population results, then the system should record the number of segments processed, array entries created, and completion status.
  • Context - a status segment has failed structure validation:
    For Set Error Flag for Invalid Structure:
    When the system handles the invalid structure, then the system should set an error flag indicating that segment structure is invalid and cannot be processed.
  • Context - an invalid status segment has been identified:
    For Handle Invalid Segment Error:
    When the system handles the invalid segment error, then the system should process the error condition and take appropriate corrective action.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Retrieve S09 Status Segment from Database
WHEN
The system needs to retrieve S09 status segments from the database
THEN
The system should fetch the status segment data from GCSUSS09 table
Context: A database query for S09 status segment has been executed
GIVEN
A database query for S09 status segment has been executed
Applied to: Valid Segment Found?
WHEN
The system checks if a valid segment was found
THEN
The system should determine if segment data exists and is accessible for processing
Context: A status segment has been retrieved from the database
GIVEN
A status segment has been retrieved from the database
Applied to: Validate Segment Structure
WHEN
The system validates the segment structure
THEN
The system should verify that the segment contains valid data fields, proper formatting, and required elements
Context: A status segment structure validation has been performed
GIVEN
A status segment structure validation has been performed
Applied to: Segment Structure Valid?
WHEN
The system evaluates the validation results
THEN
The system should determine if the segment structure meets required standards for array population
Context: A valid status segment has been retrieved and validated
GIVEN
A valid status segment has been retrieved and validated
Applied to: Initialize S09A Status Array
WHEN
The system initializes the S09A status array
THEN
The system should set up the array structure with proper indexing and prepare it for data population
Context: A valid status segment is being processed
GIVEN
A valid status segment is being processed
Applied to: Extract Sequence Number from Segment
WHEN
The system extracts the sequence number from the segment
THEN
The system should identify and capture the sequence number for proper array ordering
Context: A valid status segment with extracted sequence number is available
GIVEN
A valid status segment with extracted sequence number is available
Applied to: Populate Array Entry with Segment Data
WHEN
The system populates the array entry with segment data
THEN
The system should transfer all relevant status information from the segment into the appropriate array position
Context: Status segments are being processed with sequence numbers
GIVEN
Status segments are being processed with sequence numbers
Applied to: Track Maximum Sequence Number
WHEN
The system tracks the maximum sequence number
THEN
The system should maintain the highest sequence number encountered for array boundary management
Context: Status segments are being processed for a cargo record
GIVEN
Status segments are being processed for a cargo record
Applied to: More Segments Available?
WHEN
The system checks for more segments availability
THEN
The system should determine if additional S09 segments exist that need to be processed for the current cargo
Context: All available status segments have been processed
GIVEN
All available status segments have been processed
Applied to: Set Array Initialization Complete Flag
WHEN
The system completes array initialization
THEN
The system should set a completion flag indicating that status array population is finished
Context: Status array initialization has been completed
GIVEN
Status array initialization has been completed
Applied to: Log Array Population Results
WHEN
The system logs array population results
THEN
The system should record the number of segments processed, array entries created, and completion status
Context: A status segment has failed structure validation
GIVEN
A status segment has failed structure validation
Applied to: Set Error Flag for Invalid Structure
WHEN
The system handles the invalid structure
THEN
The system should set an error flag indicating that segment structure is invalid and cannot be processed
Context: An invalid status segment has been identified
GIVEN
An invalid status segment has been identified
Applied to: Handle Invalid Segment Error
WHEN
The system handles the invalid segment error
THEN
The system should process the error condition and take appropriate corrective action
R-GCX016E-cbl-03393 (+3) File: GCX016E.cbl Lookup Disposition Code in DC Table Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup Disposition Code in DC Table':
  • Context - a disposition code from x4 segment needs to be validated:
    For Call GCCTBIO Table Lookup:
    When the system calls gcctbio table lookup service with the disposition code, then the system searches the dc table and initiates the lookup process.
  • Context - a disposition code has been searched in the dc table:
    For Code Found in DC Table?:
    When the table lookup is completed, then the system determines if the code exists and branches to either retrieve processing rules or handle invalid code scenario.
  • Context - a disposition code exists in the dc table:
    For Retrieve Processing Rules:
    When the code is successfully found during table lookup, then the system retrieves the processing rules, extracts code description, sets valid code flag, and returns processing rules to caller.
  • Context - a disposition code does not exist in the dc table:
    For Set Invalid Code Flag:
    When the table lookup fails to find the code, then the system sets invalid code flag, generates merlin error message, logs unknown code error, and continues processing with error status.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code from X4 segment needs to be validated
GIVEN
A disposition code from X4 segment needs to be validated
Applied to: Call GCCTBIO Table Lookup
WHEN
The system calls GCCTBIO table lookup service with the disposition code
THEN
The system searches the DC table and initiates the lookup process
Context: A disposition code has been searched in the DC table
GIVEN
A disposition code has been searched in the DC table
Applied to: Code Found in DC Table?
WHEN
The table lookup is completed
THEN
The system determines if the code exists and branches to either retrieve processing rules or handle invalid code scenario
Context: A disposition code exists in the DC table
GIVEN
A disposition code exists in the DC table
Applied to: Retrieve Processing Rules
WHEN
The code is successfully found during table lookup
THEN
The system retrieves the processing rules, extracts code description, sets valid code flag, and returns processing rules to caller
Context: A disposition code does not exist in the DC table
GIVEN
A disposition code does not exist in the DC table
Applied to: Set Invalid Code Flag
WHEN
The table lookup fails to find the code
THEN
The system sets invalid code flag, generates Merlin error message, logs unknown code error, and continues processing with error status
R-GCX016E-cbl-03397 (+17) File: GCX016E.cbl Apply Regulatory Hierarchy Rules Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Regulatory Hierarchy Rules':
  • Context - a cargo record exists with status information:
    For Retrieve Current Status Array:
    When regulatory hierarchy processing is initiated, then the system retrieves the current s09 status array containing all existing disposition codes and their details.
  • Context - a new disposition code is received from x4 segment processing:
    For Identify New Disposition Code:
    When the disposition code is ready for regulatory hierarchy evaluation, then the system identifies the disposition code type and prepares it for hierarchy processing.
  • Context - a disposition code is identified for processing:
    For Check Disposition Code Type:
    When the system evaluates the disposition code characteristics, then the disposition code is classified as hold code, release code, proceed code, or status info based on its regulatory function.
  • Context - a disposition code is classified as a hold code type:
    For Apply Hold Code Hierarchy:
    When regulatory hierarchy processing is applied, then the system applies hold-specific precedence rules including border holds, destination holds, and fda holds with appropriate priority ordering.
  • Context - a disposition code is classified as a release code type:
    For Apply Release Code Hierarchy:
    When regulatory hierarchy processing is applied, then the system applies release-specific precedence rules including manual releases, auto releases, and ptt releases with quantity validation requirements.
  • Context - a disposition code is classified as a proceed code type:
    For Apply Proceed Code Hierarchy:
    When regulatory hierarchy processing is applied, then the system applies proceed-specific precedence rules including in-bond processing requirements and entry type validations.
  • Context - a disposition code is classified as status info type:
    For Apply Status Info Code Hierarchy:
    When regulatory hierarchy processing is applied, then the system applies informational code precedence rules that do not affect cargo release status but provide tracking information.
  • Context - a new disposition code is processed and existing status array contains disposition codes:
    For Check for Conflicting Codes:
    When the system evaluates code compatibility, then the system identifies if conflicts exist between the new code and existing codes based on regulatory business rules.
  • Context - conflicting disposition codes are detected in the status array:
    For Identify Counterpart Codes:
    When the system processes counterpart code logic, then the system identifies specific counterpart codes that must be removed based on regulatory requirements and business logic.
  • Context - counterpart codes are identified and regulatory precedence must be determined:
    For Apply Regulatory Precedence Rules:
    When the system applies regulatory precedence logic, then the system determines which codes have higher priority based on customs regulations, fda requirements, and business policy hierarchy.
  • Context - regulatory precedence rules are applied to conflicting disposition codes:
    For Higher Priority Code?:
    When the system evaluates priority levels, then the system determines if the new disposition code has higher priority than existing codes based on regulatory hierarchy.
  • Context - a disposition code is determined to have lower priority than a conflicting code:
    For Remove Lower Priority Code:
    When priority resolution is executed, then the system removes the lower priority disposition code from the status array and maintains audit trail.
  • Context - a disposition code is determined to have higher priority than conflicting codes:
    For Keep Higher Priority Code:
    When priority resolution is executed, then the system retains the higher priority disposition code in the status array and proceeds with processing.
  • Context - disposition code conflicts are resolved and final codes are determined:
    For Validate Final Code Combination:
    When final validation is performed, then the system validates that the final combination of disposition codes is legally compliant and business-rule compliant.
  • Context - final disposition code combination is validated:
    For Regulatory Compliance Check:
    When regulatory compliance verification is performed, then the system determines if the combination is compliant with customs regulations, fda requirements, and other applicable regulatory standards.
  • Context - final disposition code combination fails regulatory compliance check:
    For Apply Default Regulatory Action:
    When default regulatory action is triggered, then the system applies predefined default actions to ensure regulatory compliance including hold placement or status correction.
  • Context - final disposition codes are validated and compliance is confirmed:
    For Update Status Array with Final Codes:
    When status array update is executed, then the system updates the s09 status array with final disposition codes including sequence numbers and occurrence tracking.
  • Context - regulatory hierarchy processing is completed and status array is updated:
    For Log Regulatory Decision:
    When audit logging is performed, then the system logs the regulatory decisions made, codes removed or added, and rationale for compliance and audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with status information
GIVEN
A cargo record exists with status information
Applied to: Retrieve Current Status Array
WHEN
Regulatory hierarchy processing is initiated
THEN
The system retrieves the current S09 status array containing all existing disposition codes and their details
Context: A new disposition code is received from X4 segment processing
GIVEN
A new disposition code is received from X4 segment processing
Applied to: Identify New Disposition Code
WHEN
The disposition code is ready for regulatory hierarchy evaluation
THEN
The system identifies the disposition code type and prepares it for hierarchy processing
Context: A disposition code is identified for processing
GIVEN
A disposition code is identified for processing
Applied to: Check Disposition Code Type
WHEN
The system evaluates the disposition code characteristics
THEN
The disposition code is classified as Hold Code, Release Code, Proceed Code, or Status Info based on its regulatory function
Context: A disposition code is classified as a Hold Code type
GIVEN
A disposition code is classified as a Hold Code type
Applied to: Apply Hold Code Hierarchy
WHEN
Regulatory hierarchy processing is applied
THEN
The system applies hold-specific precedence rules including border holds, destination holds, and FDA holds with appropriate priority ordering
Context: A disposition code is classified as a Release Code type
GIVEN
A disposition code is classified as a Release Code type
Applied to: Apply Release Code Hierarchy
WHEN
Regulatory hierarchy processing is applied
THEN
The system applies release-specific precedence rules including manual releases, auto releases, and PTT releases with quantity validation requirements
Context: A disposition code is classified as a Proceed Code type
GIVEN
A disposition code is classified as a Proceed Code type
Applied to: Apply Proceed Code Hierarchy
WHEN
Regulatory hierarchy processing is applied
THEN
The system applies proceed-specific precedence rules including in-bond processing requirements and entry type validations
Context: A disposition code is classified as Status Info type
GIVEN
A disposition code is classified as Status Info type
Applied to: Apply Status Info Code Hierarchy
WHEN
Regulatory hierarchy processing is applied
THEN
The system applies informational code precedence rules that do not affect cargo release status but provide tracking information
Context: A new disposition code is processed and existing status array contains disposition codes
GIVEN
A new disposition code is processed and existing status array contains disposition codes
Applied to: Check for Conflicting Codes
WHEN
The system evaluates code compatibility
THEN
The system identifies if conflicts exist between the new code and existing codes based on regulatory business rules
Context: Conflicting disposition codes are detected in the status array
GIVEN
Conflicting disposition codes are detected in the status array
Applied to: Identify Counterpart Codes
WHEN
The system processes counterpart code logic
THEN
The system identifies specific counterpart codes that must be removed based on regulatory requirements and business logic
Context: Counterpart codes are identified and regulatory precedence must be determined
GIVEN
Counterpart codes are identified and regulatory precedence must be determined
Applied to: Apply Regulatory Precedence Rules
WHEN
The system applies regulatory precedence logic
THEN
The system determines which codes have higher priority based on customs regulations, FDA requirements, and business policy hierarchy
Context: Regulatory precedence rules are applied to conflicting disposition codes
GIVEN
Regulatory precedence rules are applied to conflicting disposition codes
Applied to: Higher Priority Code?
WHEN
The system evaluates priority levels
THEN
The system determines if the new disposition code has higher priority than existing codes based on regulatory hierarchy
Context: A disposition code is determined to have lower priority than a conflicting code
GIVEN
A disposition code is determined to have lower priority than a conflicting code
Applied to: Remove Lower Priority Code
WHEN
Priority resolution is executed
THEN
The system removes the lower priority disposition code from the status array and maintains audit trail
Context: A disposition code is determined to have higher priority than conflicting codes
GIVEN
A disposition code is determined to have higher priority than conflicting codes
Applied to: Keep Higher Priority Code
WHEN
Priority resolution is executed
THEN
The system retains the higher priority disposition code in the status array and proceeds with processing
Context: Disposition code conflicts are resolved and final codes are determined
GIVEN
Disposition code conflicts are resolved and final codes are determined
Applied to: Validate Final Code Combination
WHEN
Final validation is performed
THEN
The system validates that the final combination of disposition codes is legally compliant and business-rule compliant
Context: Final disposition code combination is validated
GIVEN
Final disposition code combination is validated
Applied to: Regulatory Compliance Check
WHEN
Regulatory compliance verification is performed
THEN
The system determines if the combination is compliant with customs regulations, FDA requirements, and other applicable regulatory standards
Context: Final disposition code combination fails regulatory compliance check
GIVEN
Final disposition code combination fails regulatory compliance check
Applied to: Apply Default Regulatory Action
WHEN
Default regulatory action is triggered
THEN
The system applies predefined default actions to ensure regulatory compliance including hold placement or status correction
Context: Final disposition codes are validated and compliance is confirmed
GIVEN
Final disposition codes are validated and compliance is confirmed
Applied to: Update Status Array with Final Codes
WHEN
Status array update is executed
THEN
The system updates the S09 status array with final disposition codes including sequence numbers and occurrence tracking
Context: Regulatory hierarchy processing is completed and status array is updated
GIVEN
Regulatory hierarchy processing is completed and status array is updated
Applied to: Log Regulatory Decision
WHEN
Audit logging is performed
THEN
The system logs the regulatory decisions made, codes removed or added, and rationale for compliance and audit purposes
R-GCX016E-cbl-03415 (+7) File: GCX016E.cbl Determine Comment Type Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Comment Type':
  • Context - a k1 segment comment is received for processing:
    For Identify as CPR Bond Creation Comment:
    When the comment text contains 'director of customs, cp rail' or 'canadian pacific limited' or 'canadian pacific railway co', then the system identifies this as a cpr bond creation comment and sets the special comment flag for broker bond message generation.
    For Identify as Standard Comment:
    When the comment text does not contain any canadian pacific railway bond creation keywords, then the system identifies this as a standard comment and sets the standard comment flag for regular comment processing.
  • Context - a k1 segment is received in the message:
    For Extract K1 Comment Text:
    When the system processes the k1 segment, then the comment text is extracted from the k1 segment and made available for content analysis.
  • Context - k1 comment text has been extracted:
    For Analyze Comment Content:
    When the system analyzes the comment content for specific keywords, then the system determines whether the comment requires special cpr bond processing or standard comment handling.
  • Context - a k1 comment has been identified as a cpr bond creation comment:
    For Set Special Comment Flag:
    When the system processes the comment classification, then a special comment flag is set to indicate this comment requires broker bond message generation.
  • Context - a k1 comment has been identified as a standard comment:
    For Set Standard Comment Flag:
    When the system processes the comment classification, then a standard comment flag is set to indicate this comment follows normal processing procedures.
  • Context - a k1 comment has been classified and flagged appropriately:
    For Store Comment for Processing:
    When the system prepares the comment for processing, then the comment text and its classification flags are stored in the appropriate processing structures.
  • Context - a k1 comment has been classified and stored with appropriate flags:
    For Route to Appropriate Handler:
    When the system determines the next processing step, then the comment is routed to either the cpr bond creation handler or the standard comment handler based on the classification flags.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 segment comment is received for processing
GIVEN
A K1 segment comment is received for processing
Applied to: Identify as CPR Bond Creation Comment
WHEN
The comment text contains 'DIRECTOR OF CUSTOMS, CP RAIL' OR 'CANADIAN PACIFIC LIMITED' OR 'CANADIAN PACIFIC RAILWAY CO'
THEN
The system identifies this as a CPR bond creation comment and sets the special comment flag for broker bond message generation
Applied to: Identify as Standard Comment
WHEN
The comment text does not contain any Canadian Pacific Railway bond creation keywords
THEN
The system identifies this as a standard comment and sets the standard comment flag for regular comment processing
Context: A K1 segment is received in the message
GIVEN
A K1 segment is received in the message
Applied to: Extract K1 Comment Text
WHEN
The system processes the K1 segment
THEN
The comment text is extracted from the K1 segment and made available for content analysis
Context: K1 comment text has been extracted
GIVEN
K1 comment text has been extracted
Applied to: Analyze Comment Content
WHEN
The system analyzes the comment content for specific keywords
THEN
The system determines whether the comment requires special CPR bond processing or standard comment handling
Context: A K1 comment has been identified as a CPR bond creation comment
GIVEN
A K1 comment has been identified as a CPR bond creation comment
Applied to: Set Special Comment Flag
WHEN
The system processes the comment classification
THEN
A special comment flag is set to indicate this comment requires broker bond message generation
Context: A K1 comment has been identified as a standard comment
GIVEN
A K1 comment has been identified as a standard comment
Applied to: Set Standard Comment Flag
WHEN
The system processes the comment classification
THEN
A standard comment flag is set to indicate this comment follows normal processing procedures
Context: A K1 comment has been classified and flagged appropriately
GIVEN
A K1 comment has been classified and flagged appropriately
Applied to: Store Comment for Processing
WHEN
The system prepares the comment for processing
THEN
The comment text and its classification flags are stored in the appropriate processing structures
Context: A K1 comment has been classified and stored with appropriate flags
GIVEN
A K1 comment has been classified and stored with appropriate flags
Applied to: Route to Appropriate Handler
WHEN
The system determines the next processing step
THEN
The comment is routed to either the CPR bond creation handler or the standard comment handler based on the classification flags
R-GCX016E-cbl-03423 (+8) File: GCX016E.cbl Search Broker Database for Freight Forwarder Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search Broker Database for Freight Forwarder':
  • Context - a disposition code needs to be processed for freight forwarder validation:
    For Search GCST2RT Broker Database:
    When the system searches the gcst2rt broker database for matching freight forwarder records, then the system retrieves broker segments that match the disposition code criteria.
  • Context - a search has been performed against the gcst2rt broker database:
    For Broker Record Found?:
    When the system evaluates the search results for broker record existence, then the system returns true if a broker record is found, false if no matching record exists.
  • Context - a broker record has been found in the database:
    For Valid Freight Forwarder?:
    When the system validates the freight forwarder relationship status, then the system confirms the broker is authorized to act as a freight forwarder for the given context.
  • Context - a valid freight forwarder relationship has been confirmed:
    For Retrieve Broker Information:
    When the system retrieves detailed broker information from the record, then the system extracts broker identification, contact details, and operational parameters.
  • Context - broker information has been retrieved for a freight forwarder:
    For Authorized for Disposition Code?:
    When the system validates the broker's authority for the specific disposition code, then the system confirms the freight forwarder is authorized to process this disposition code type.
  • Context - a freight forwarder has been validated and authorized for disposition code processing:
    For Set Freight Forwarder Found Flag:
    When the system sets the freight forwarder found flag, then the system marks the freight forwarder as available for subsequent processing operations.
  • Context - a freight forwarder has been successfully identified and validated:
    For Store Broker Details:
    When the system stores the broker details in working storage, then the system retains broker identification, contact information, and authorization details for processing.
  • Context - no valid freight forwarder record exists or the broker lacks proper authorization or the freight forwarder relationship is invalid:
    For Log Freight Forwarder Not Found:
    When the system processes the freight forwarder search failure, then the system logs the freight forwarder not found event for audit and troubleshooting purposes.
  • Context - freight forwarder search has completed without finding a valid authorized freight forwarder:
    For Continue with Standard Processing:
    When the system continues with standard processing procedures, then the system processes the disposition code using standard business rules without freight forwarder-specific handling.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code needs to be processed for freight forwarder validation
GIVEN
A disposition code needs to be processed for freight forwarder validation
Applied to: Search GCST2RT Broker Database
WHEN
The system searches the GCST2RT broker database for matching freight forwarder records
THEN
The system retrieves broker segments that match the disposition code criteria
Context: A search has been performed against the GCST2RT broker database
GIVEN
A search has been performed against the GCST2RT broker database
Applied to: Broker Record Found?
WHEN
The system evaluates the search results for broker record existence
THEN
The system returns true if a broker record is found, false if no matching record exists
Context: A broker record has been found in the database
GIVEN
A broker record has been found in the database
Applied to: Valid Freight Forwarder?
WHEN
The system validates the freight forwarder relationship status
THEN
The system confirms the broker is authorized to act as a freight forwarder for the given context
Context: A valid freight forwarder relationship has been confirmed
GIVEN
A valid freight forwarder relationship has been confirmed
Applied to: Retrieve Broker Information
WHEN
The system retrieves detailed broker information from the record
THEN
The system extracts broker identification, contact details, and operational parameters
Context: Broker information has been retrieved for a freight forwarder
GIVEN
Broker information has been retrieved for a freight forwarder
Applied to: Authorized for Disposition Code?
WHEN
The system validates the broker's authority for the specific disposition code
THEN
The system confirms the freight forwarder is authorized to process this disposition code type
Context: A freight forwarder has been validated and authorized for disposition code processing
GIVEN
A freight forwarder has been validated and authorized for disposition code processing
Applied to: Set Freight Forwarder Found Flag
WHEN
The system sets the freight forwarder found flag
THEN
The system marks the freight forwarder as available for subsequent processing operations
Context: A freight forwarder has been successfully identified and validated
GIVEN
A freight forwarder has been successfully identified and validated
Applied to: Store Broker Details
WHEN
The system stores the broker details in working storage
THEN
The system retains broker identification, contact information, and authorization details for processing
Context: No valid freight forwarder record exists OR the broker lacks proper authorization OR the freight forwarder relationship is invalid
GIVEN
No valid freight forwarder record exists OR the broker lacks proper authorization OR the freight forwarder relationship is invalid
Applied to: Log Freight Forwarder Not Found
WHEN
The system processes the freight forwarder search failure
THEN
The system logs the freight forwarder not found event for audit and troubleshooting purposes
Context: Freight forwarder search has completed without finding a valid authorized freight forwarder
GIVEN
Freight forwarder search has completed without finding a valid authorized freight forwarder
Applied to: Continue with Standard Processing
WHEN
The system continues with standard processing procedures
THEN
The system processes the disposition code using standard business rules without freight forwarder-specific handling
R-GCX016E-cbl-03432 (+18) File: GCX016E.cbl Evaluate Hold Types Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Evaluate Hold Types':
  • Context - a cargo record requires hold status evaluation:
    For Initialize Hold Status Flags:
    When the hold type evaluation process begins, then all hold status flags (border hold, destination hold, fda hold, piece count hold) are set to false and overall hold status is cleared.
  • Context - a cargo has a status array with disposition codes:
    For Check Border Hold Status:
    When the system checks for border hold status, then the system searches the status array for border hold disposition codes and identifies if border hold is active.
    For Check Destination Hold Status:
    When the system checks for destination hold status, then the system searches the status array for destination hold disposition codes and identifies if destination hold is active.
    For Check FDA Hold Status:
    When the system checks for fda hold status, then the system searches the status array for fda hold disposition codes and identifies if fda hold is active.
  • Context - the system has checked cargo status array for border hold codes:
    For Border Hold Active?:
    When border hold disposition codes are found in the status array, then the border hold active flag is set to true, otherwise it remains false.
  • Context - border hold status has been determined to be active:
    For Set Border Hold Flag:
    When the system processes the border hold determination, then the border hold flag is set to true to indicate cargo is held at border.
  • Context - the system has checked cargo status array for destination hold codes:
    For Destination Hold Active?:
    When destination hold disposition codes are found in the status array, then the destination hold active flag is set to true, otherwise it remains false.
  • Context - destination hold status has been determined to be active:
    For Set Destination Hold Flag:
    When the system processes the destination hold determination, then the destination hold flag is set to true to indicate cargo is held at destination.
  • Context - the system has checked cargo status array for fda hold codes:
    For FDA Hold Active?:
    When fda hold disposition codes are found in the status array, then the fda hold active flag is set to true, otherwise it remains false.
  • Context - fda hold status has been determined to be active:
    For Set FDA Hold Flag:
    When the system processes the fda hold determination, then the fda hold flag is set to true to indicate cargo is held by fda.
  • Context - a cargo has a status array with disposition codes and quantity information:
    For Check Piece Count Hold Status:
    When the system checks for piece count hold status, then the system evaluates release quantities against total quantities to identify if piece count hold is active.
  • Context - the system has checked cargo quantities for piece count hold conditions:
    For Piece Count Hold Active?:
    When released quantity is less than total quantity or partial release conditions exist, then the piece count hold active flag is set to true, otherwise it remains false.
  • Context - piece count hold status has been determined to be active:
    For Set Piece Count Hold Flag:
    When the system processes the piece count hold determination, then the piece count hold flag is set to true to indicate cargo has quantity-related holds.
  • Context - all individual hold type flags have been evaluated (border, destination, fda, piece count):
    For Evaluate Combined Hold Status:
    When the system evaluates the combined hold status, then the system analyzes all hold flags to determine the overall hold condition.
  • Context - all hold type flags have been set (border hold, destination hold, fda hold, piece count hold):
    For Any Hold Type Active?:
    When the system checks if any hold type is active, then if any hold flag is true, then overall hold status is active, otherwise cargo is not held.
  • Context - at least one hold type flag is active (border, destination, fda, or piece count):
    For Set Overall Hold Status:
    When the system processes the overall hold determination, then the overall hold status is set to indicate cargo is held with appropriate hold type designation.
  • Context - no hold type flags are active (border, destination, fda, and piece count are all false):
    For Set Release Status:
    When the system processes the overall hold determination, then the release status is set to indicate cargo is released and available for processing.
  • Context - hold status has been determined for the cargo:
    For Apply Hold Validation Rules:
    When the system applies hold validation rules, then the system validates hold status against business rules and regulatory requirements to ensure compliance.
  • Context - hold status has been determined and validated for the cargo:
    For Update Cargo Hold Status:
    When the system updates the cargo hold status, then the cargo record is updated with the final hold status and all related status fields are set appropriately.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires hold status evaluation
GIVEN
A cargo record requires hold status evaluation
Applied to: Initialize Hold Status Flags
WHEN
The hold type evaluation process begins
THEN
All hold status flags (border hold, destination hold, FDA hold, piece count hold) are set to false and overall hold status is cleared
Context: A cargo has a status array with disposition codes
GIVEN
A cargo has a status array with disposition codes
Applied to: Check Border Hold Status
WHEN
The system checks for border hold status
THEN
The system searches the status array for border hold disposition codes and identifies if border hold is active
Applied to: Check Destination Hold Status
WHEN
The system checks for destination hold status
THEN
The system searches the status array for destination hold disposition codes and identifies if destination hold is active
Applied to: Check FDA Hold Status
WHEN
The system checks for FDA hold status
THEN
The system searches the status array for FDA hold disposition codes and identifies if FDA hold is active
Context: The system has checked cargo status array for border hold codes
GIVEN
The system has checked cargo status array for border hold codes
Applied to: Border Hold Active?
WHEN
Border hold disposition codes are found in the status array
THEN
The border hold active flag is set to true, otherwise it remains false
Context: Border hold status has been determined to be active
GIVEN
Border hold status has been determined to be active
Applied to: Set Border Hold Flag
WHEN
The system processes the border hold determination
THEN
The border hold flag is set to true to indicate cargo is held at border
Context: The system has checked cargo status array for destination hold codes
GIVEN
The system has checked cargo status array for destination hold codes
Applied to: Destination Hold Active?
WHEN
Destination hold disposition codes are found in the status array
THEN
The destination hold active flag is set to true, otherwise it remains false
Context: Destination hold status has been determined to be active
GIVEN
Destination hold status has been determined to be active
Applied to: Set Destination Hold Flag
WHEN
The system processes the destination hold determination
THEN
The destination hold flag is set to true to indicate cargo is held at destination
Context: The system has checked cargo status array for FDA hold codes
GIVEN
The system has checked cargo status array for FDA hold codes
Applied to: FDA Hold Active?
WHEN
FDA hold disposition codes are found in the status array
THEN
The FDA hold active flag is set to true, otherwise it remains false
Context: FDA hold status has been determined to be active
GIVEN
FDA hold status has been determined to be active
Applied to: Set FDA Hold Flag
WHEN
The system processes the FDA hold determination
THEN
The FDA hold flag is set to true to indicate cargo is held by FDA
Context: A cargo has a status array with disposition codes and quantity information
GIVEN
A cargo has a status array with disposition codes and quantity information
Applied to: Check Piece Count Hold Status
WHEN
The system checks for piece count hold status
THEN
The system evaluates release quantities against total quantities to identify if piece count hold is active
Context: The system has checked cargo quantities for piece count hold conditions
GIVEN
The system has checked cargo quantities for piece count hold conditions
Applied to: Piece Count Hold Active?
WHEN
Released quantity is less than total quantity or partial release conditions exist
THEN
The piece count hold active flag is set to true, otherwise it remains false
Context: Piece count hold status has been determined to be active
GIVEN
Piece count hold status has been determined to be active
Applied to: Set Piece Count Hold Flag
WHEN
The system processes the piece count hold determination
THEN
The piece count hold flag is set to true to indicate cargo has quantity-related holds
Context: All individual hold type flags have been evaluated (border, destination, FDA, piece count)
GIVEN
All individual hold type flags have been evaluated (border, destination, FDA, piece count)
Applied to: Evaluate Combined Hold Status
WHEN
The system evaluates the combined hold status
THEN
The system analyzes all hold flags to determine the overall hold condition
Context: All hold type flags have been set (border hold, destination hold, FDA hold, piece count hold)
GIVEN
All hold type flags have been set (border hold, destination hold, FDA hold, piece count hold)
Applied to: Any Hold Type Active?
WHEN
The system checks if any hold type is active
THEN
If any hold flag is true, then overall hold status is active, otherwise cargo is not held
Context: At least one hold type flag is active (border, destination, FDA, or piece count)
GIVEN
At least one hold type flag is active (border, destination, FDA, or piece count)
Applied to: Set Overall Hold Status
WHEN
The system processes the overall hold determination
THEN
The overall hold status is set to indicate cargo is held with appropriate hold type designation
Context: No hold type flags are active (border, destination, FDA, and piece count are all false)
GIVEN
No hold type flags are active (border, destination, FDA, and piece count are all false)
Applied to: Set Release Status
WHEN
The system processes the overall hold determination
THEN
The release status is set to indicate cargo is released and available for processing
Context: Hold status has been determined for the cargo
GIVEN
Hold status has been determined for the cargo
Applied to: Apply Hold Validation Rules
WHEN
The system applies hold validation rules
THEN
The system validates hold status against business rules and regulatory requirements to ensure compliance
Context: Hold status has been determined and validated for the cargo
GIVEN
Hold status has been determined and validated for the cargo
Applied to: Update Cargo Hold Status
WHEN
The system updates the cargo hold status
THEN
The cargo record is updated with the final hold status and all related status fields are set appropriately
R-GCX016E-cbl-03451 (+12) File: GCX016E.cbl Build Foreign Manifest Structure Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build Foreign Manifest Structure':
  • Context - an m10 segment is available for processing:
    For Extract M10 Segment Data:
    When the system processes the m10 segment, then all m10 segment data fields are extracted and made available for manifest building.
  • Context - m10 segment data has been extracted:
    For Map SCAC Code from M10:
    When the system processes the scac code field from m10 segment, then the scac code is mapped to the appropriate field in the foreign manifest structure.
  • Context - m10 segment scac code has been mapped:
    For Extract Transport Type:
    When the system processes the transport type field from m10 segment, then the transport type is extracted and prepared for manifest structure mapping.
  • Context - transport type has been extracted from m10 segment:
    For Map Country Code:
    When the system processes the country code field from m10 segment, then the country code is mapped to the foreign manifest structure with proper validation.
  • Context - country code has been mapped from m10 segment:
    For Extract Vessel Details:
    When the system processes vessel information fields from m10 segment, then vessel name and identification details are extracted and prepared for manifest structure.
  • Context - vessel details have been extracted from m10 segment:
    For Map Port Information:
    When the system processes port information fields from m10 segment, then port of loading and discharge codes are mapped to the foreign manifest structure.
  • Context - port information has been mapped from m10 segment:
    For Extract Manifest Number:
    When the system processes the manifest number field from m10 segment, then the manifest number is extracted and prepared for foreign manifest structure.
  • Context - manifest number has been extracted from m10 segment:
    For Map Date Information:
    When the system processes date fields from m10 segment, then arrival and departure dates are mapped to the foreign manifest structure with proper formatting.
  • Context - date information has been mapped from m10 segment:
    For Validate Field Mappings:
    When the system validates all mapped fields for completeness and accuracy, then all field mappings are verified for data integrity and business rule compliance.
  • Context - field mappings have been validated:
    For All Fields Valid?:
    When the system evaluates the validation results, then the system determines if all fields are valid and processing can continue or if error handling is required.
  • Context - field mapping validation has failed:
    For Set Error Flag:
    When the system detects invalid or missing field mappings, then an error flag is set to indicate foreign manifest processing cannot continue normally.
  • Context - all field mappings have been validated successfully:
    For Build Complete Manifest Structure:
    When the system builds the foreign manifest structure, then a complete foreign manifest data structure is constructed with all required fields properly populated.
  • Context - complete foreign manifest structure has been built:
    For Store Foreign Manifest Data:
    When the system stores the foreign manifest data, then the foreign manifest data structure is stored and available for further processing operations.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 segment is available for processing
GIVEN
An M10 segment is available for processing
Applied to: Extract M10 Segment Data
WHEN
The system processes the M10 segment
THEN
All M10 segment data fields are extracted and made available for manifest building
Context: M10 segment data has been extracted
GIVEN
M10 segment data has been extracted
Applied to: Map SCAC Code from M10
WHEN
The system processes the SCAC code field from M10 segment
THEN
The SCAC code is mapped to the appropriate field in the foreign manifest structure
Context: M10 segment SCAC code has been mapped
GIVEN
M10 segment SCAC code has been mapped
Applied to: Extract Transport Type
WHEN
The system processes the transport type field from M10 segment
THEN
The transport type is extracted and prepared for manifest structure mapping
Context: Transport type has been extracted from M10 segment
GIVEN
Transport type has been extracted from M10 segment
Applied to: Map Country Code
WHEN
The system processes the country code field from M10 segment
THEN
The country code is mapped to the foreign manifest structure with proper validation
Context: Country code has been mapped from M10 segment
GIVEN
Country code has been mapped from M10 segment
Applied to: Extract Vessel Details
WHEN
The system processes vessel information fields from M10 segment
THEN
Vessel name and identification details are extracted and prepared for manifest structure
Context: Vessel details have been extracted from M10 segment
GIVEN
Vessel details have been extracted from M10 segment
Applied to: Map Port Information
WHEN
The system processes port information fields from M10 segment
THEN
Port of loading and discharge codes are mapped to the foreign manifest structure
Context: Port information has been mapped from M10 segment
GIVEN
Port information has been mapped from M10 segment
Applied to: Extract Manifest Number
WHEN
The system processes the manifest number field from M10 segment
THEN
The manifest number is extracted and prepared for foreign manifest structure
Context: Manifest number has been extracted from M10 segment
GIVEN
Manifest number has been extracted from M10 segment
Applied to: Map Date Information
WHEN
The system processes date fields from M10 segment
THEN
Arrival and departure dates are mapped to the foreign manifest structure with proper formatting
Context: Date information has been mapped from M10 segment
GIVEN
Date information has been mapped from M10 segment
Applied to: Validate Field Mappings
WHEN
The system validates all mapped fields for completeness and accuracy
THEN
All field mappings are verified for data integrity and business rule compliance
Context: Field mappings have been validated
GIVEN
Field mappings have been validated
Applied to: All Fields Valid?
WHEN
The system evaluates the validation results
THEN
The system determines if all fields are valid and processing can continue or if error handling is required
Context: Field mapping validation has failed
GIVEN
Field mapping validation has failed
Applied to: Set Error Flag
WHEN
The system detects invalid or missing field mappings
THEN
An error flag is set to indicate foreign manifest processing cannot continue normally
Context: All field mappings have been validated successfully
GIVEN
All field mappings have been validated successfully
Applied to: Build Complete Manifest Structure
WHEN
The system builds the foreign manifest structure
THEN
A complete foreign manifest data structure is constructed with all required fields properly populated
Context: Complete foreign manifest structure has been built
GIVEN
Complete foreign manifest structure has been built
Applied to: Store Foreign Manifest Data
WHEN
The system stores the foreign manifest data
THEN
The foreign manifest data structure is stored and available for further processing operations
R-GCX016E-cbl-03464 (+11) File: GCX016E.cbl Check for Counterpart Codes Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check for Counterpart Codes':
  • Context - a disposition code is being processed for cargo status update:
    For Does Code Have Counterparts?:
    When the system checks the disposition code table for counterpart relationships, then the system identifies if the code has any defined counterpart codes that require evaluation.
  • Context - a disposition code has been confirmed to have counterparts:
    For Get Counterpart Code List:
    When the system accesses the disposition code table counterpart fields, then the system retrieves all defined counterpart codes for the current disposition code.
  • Context - a list of counterpart codes has been retrieved from the disposition code table:
    For Search Status Array for Counterparts:
    When the system searches through the cargo's s09a status array, then the system identifies any existing counterpart codes in the current status array.
  • Context - the system has searched the status array for counterpart codes:
    For Counterpart Found in Array?:
    When the search results are evaluated, then the system determines whether any counterpart codes were found in the status array.
  • Context - counterpart codes have been found in the cargo status array:
    For Evaluate Regulatory Hierarchy:
    When the system evaluates the regulatory hierarchy rules between codes, then the system determines which code takes precedence based on regulatory requirements.
  • Context - regulatory hierarchy has been evaluated between current and counterpart codes:
    For Current Code Supersedes Counterpart?:
    When the system applies supersession rules, then the system determines if the current code supersedes the counterpart code requiring its removal.
  • Context - the current disposition code supersedes a counterpart code:
    For Mark Counterpart for Removal:
    When the system processes the supersession rule, then the system marks the counterpart code for removal from the status array.
  • Context - a counterpart code has been marked for removal:
    For Log Counterpart Removal Action:
    When the system processes the removal action, then the system logs the counterpart removal action with relevant details.
  • Context - a counterpart code has been marked for removal and logged:
    For Remove Counterpart from Status Array:
    When the system updates the cargo status array, then the system removes the counterpart code from the s09a status array.
  • Context - one counterpart code has been processed:
    For More Counterparts to Check?:
    When the system checks the remaining counterpart code list, then the system determines if more counterpart codes require processing.
  • Context - all counterpart codes have been processed and removed:
    For Reorganize Status Array Sequence:
    When the system reorganizes the status array, then the system resequences the remaining status codes to eliminate gaps.
  • Context - the status array has been reorganized after counterpart removals:
    For Update Status Array Indexes:
    When the system updates array management fields, then the system updates status array indexes and occurrence counters to reflect the current array state.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo status update
GIVEN
A disposition code is being processed for cargo status update
Applied to: Does Code Have Counterparts?
WHEN
The system checks the disposition code table for counterpart relationships
THEN
The system identifies if the code has any defined counterpart codes that require evaluation
Context: A disposition code has been confirmed to have counterparts
GIVEN
A disposition code has been confirmed to have counterparts
Applied to: Get Counterpart Code List
WHEN
The system accesses the disposition code table counterpart fields
THEN
The system retrieves all defined counterpart codes for the current disposition code
Context: A list of counterpart codes has been retrieved from the disposition code table
GIVEN
A list of counterpart codes has been retrieved from the disposition code table
Applied to: Search Status Array for Counterparts
WHEN
The system searches through the cargo's S09A status array
THEN
The system identifies any existing counterpart codes in the current status array
Context: The system has searched the status array for counterpart codes
GIVEN
The system has searched the status array for counterpart codes
Applied to: Counterpart Found in Array?
WHEN
The search results are evaluated
THEN
The system determines whether any counterpart codes were found in the status array
Context: Counterpart codes have been found in the cargo status array
GIVEN
Counterpart codes have been found in the cargo status array
Applied to: Evaluate Regulatory Hierarchy
WHEN
The system evaluates the regulatory hierarchy rules between codes
THEN
The system determines which code takes precedence based on regulatory requirements
Context: Regulatory hierarchy has been evaluated between current and counterpart codes
GIVEN
Regulatory hierarchy has been evaluated between current and counterpart codes
Applied to: Current Code Supersedes Counterpart?
WHEN
The system applies supersession rules
THEN
The system determines if the current code supersedes the counterpart code requiring its removal
Context: The current disposition code supersedes a counterpart code
GIVEN
The current disposition code supersedes a counterpart code
Applied to: Mark Counterpart for Removal
WHEN
The system processes the supersession rule
THEN
The system marks the counterpart code for removal from the status array
Context: A counterpart code has been marked for removal
GIVEN
A counterpart code has been marked for removal
Applied to: Log Counterpart Removal Action
WHEN
The system processes the removal action
THEN
The system logs the counterpart removal action with relevant details
Context: A counterpart code has been marked for removal and logged
GIVEN
A counterpart code has been marked for removal and logged
Applied to: Remove Counterpart from Status Array
WHEN
The system updates the cargo status array
THEN
The system removes the counterpart code from the S09A status array
Context: One counterpart code has been processed
GIVEN
One counterpart code has been processed
Applied to: More Counterparts to Check?
WHEN
The system checks the remaining counterpart code list
THEN
The system determines if more counterpart codes require processing
Context: All counterpart codes have been processed and removed
GIVEN
All counterpart codes have been processed and removed
Applied to: Reorganize Status Array Sequence
WHEN
The system reorganizes the status array
THEN
The system resequences the remaining status codes to eliminate gaps
Context: The status array has been reorganized after counterpart removals
GIVEN
The status array has been reorganized after counterpart removals
Applied to: Update Status Array Indexes
WHEN
The system updates array management fields
THEN
The system updates status array indexes and occurrence counters to reflect the current array state
R-GCX016E-cbl-03476 (+12) File: GCX016E.cbl Apply Special Border Crossing Logic Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Special Border Crossing Logic':
  • Context - a cargo record with origin and destination location information:
    For Cargo Movement Type?:
    When the system evaluates the cargo movement pattern for border crossing processing, then the system classifies the movement as us to canada transit, canada to us transit, or us-canada-us transit based on origin and destination locations.
  • Context - a us port code from cargo location information and a us port to canadian border mapping table:
    For Map US Port Code to Canadian Border Location:
    When the system needs to identify the corresponding canadian border location, then the system retrieves the mapped canadian border location code from the mapping table.
  • Context - a mapped canadian border location code and the canadian border location table:
    For Validate Canadian Border Location:
    When the system validates the canadian border location, then the system confirms whether the canadian location exists in the reference table.
  • Context - a validated canadian border location code from the canadian border location table:
    For Set Canadian Border Port Name:
    When the canadian location is confirmed to exist, then the system sets the canadian border port name for the cargo record.
  • Context - cargo equipment information and access to gccc-cargo-root canadian cargo database:
    For Search Canadian Manifest Database:
    When the system needs to find corresponding canadian manifest records, then the system searches the canadian manifest database using equipment identification criteria.
  • Context - a us cargo record with equipment id and a canadian manifest record with equipment id:
    For Equipment ID Matches?:
    When the system compares equipment ids for cross-border record linking, then the system confirms whether the equipment ids match exactly between the us and canadian records.
  • Context - matching us and canadian cargo records with validated equipment ids:
    For Link US and Canadian Records:
    When equipment ids match between the records, then the system establishes a cross-border linkage between the us and canadian cargo records.
  • Context - successfully linked us and canadian cargo records:
    For Set Cross-Border Transit Flags:
    When cross-border record linkage is established, then the system sets cross-border transit flags on both us and canadian cargo records.
  • Context - a cargo record identified as us-canada-us transit movement:
    For Apply Special Transit Rules:
    When the cargo movement type is us-canada-us transit, then the system applies special transit processing rules specific to round-trip cross-border movements.
  • Context - a canadian manifest record found for cross-border cargo movement:
    For Create Cross-Border Audit Trail:
    When canadian manifest is successfully located, then the system creates audit trail records documenting the cross-border cargo movement.
  • Context - a cargo record requiring border crossing processing and canadian border location table:
    For Generate Border Crossing Error:
    When the canadian location is not found in the reference table, then the system generates a border crossing error indicating the location validation failure.
  • Context - a cargo record undergoing border crossing logic where canadian manifest search fails or equipment id validation fails:
    For Continue Standard Processing:
    When no canadian manifest is found or equipment ids do not match, then the system continues with standard cargo processing without cross-border linkage.
  • Context - a cargo record that has completed border crossing logic processing:
    For Update Cargo Status for Border Transit:
    When border crossing logic is complete (whether successful linkage, error, or standard processing), then the system updates the cargo status to reflect the border transit processing results.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with origin and destination location information
GIVEN
A cargo record with origin and destination location information
Applied to: Cargo Movement Type?
WHEN
The system evaluates the cargo movement pattern for border crossing processing
THEN
The system classifies the movement as US to Canada Transit, Canada to US Transit, or US-Canada-US Transit based on origin and destination locations
Context: A US port code from cargo location information and a US Port to Canadian Border Mapping table
GIVEN
A US port code from cargo location information and a US Port to Canadian Border Mapping table
Applied to: Map US Port Code to Canadian Border Location
WHEN
The system needs to identify the corresponding Canadian border location
THEN
The system retrieves the mapped Canadian border location code from the mapping table
Context: A mapped Canadian border location code and the Canadian Border Location Table
GIVEN
A mapped Canadian border location code and the Canadian Border Location Table
Applied to: Validate Canadian Border Location
WHEN
The system validates the Canadian border location
THEN
The system confirms whether the Canadian location exists in the reference table
Context: A validated Canadian border location code from the Canadian Border Location Table
GIVEN
A validated Canadian border location code from the Canadian Border Location Table
Applied to: Set Canadian Border Port Name
WHEN
The Canadian location is confirmed to exist
THEN
The system sets the Canadian border port name for the cargo record
Context: Cargo equipment information and access to GCCC-CARGO-ROOT Canadian Cargo database
GIVEN
Cargo equipment information and access to GCCC-CARGO-ROOT Canadian Cargo database
Applied to: Search Canadian Manifest Database
WHEN
The system needs to find corresponding Canadian manifest records
THEN
The system searches the Canadian manifest database using equipment identification criteria
Context: A US cargo record with equipment ID and a Canadian manifest record with equipment ID
GIVEN
A US cargo record with equipment ID and a Canadian manifest record with equipment ID
Applied to: Equipment ID Matches?
WHEN
The system compares equipment IDs for cross-border record linking
THEN
The system confirms whether the equipment IDs match exactly between the US and Canadian records
Context: Matching US and Canadian cargo records with validated equipment IDs
GIVEN
Matching US and Canadian cargo records with validated equipment IDs
Applied to: Link US and Canadian Records
WHEN
Equipment IDs match between the records
THEN
The system establishes a cross-border linkage between the US and Canadian cargo records
Context: Successfully linked US and Canadian cargo records
GIVEN
Successfully linked US and Canadian cargo records
Applied to: Set Cross-Border Transit Flags
WHEN
Cross-border record linkage is established
THEN
The system sets cross-border transit flags on both US and Canadian cargo records
Context: A cargo record identified as US-Canada-US transit movement
GIVEN
A cargo record identified as US-Canada-US transit movement
Applied to: Apply Special Transit Rules
WHEN
The cargo movement type is US-Canada-US Transit
THEN
The system applies special transit processing rules specific to round-trip cross-border movements
Context: A Canadian manifest record found for cross-border cargo movement
GIVEN
A Canadian manifest record found for cross-border cargo movement
Applied to: Create Cross-Border Audit Trail
WHEN
Canadian manifest is successfully located
THEN
The system creates audit trail records documenting the cross-border cargo movement
Context: A cargo record requiring border crossing processing and Canadian Border Location Table
GIVEN
A cargo record requiring border crossing processing and Canadian Border Location Table
Applied to: Generate Border Crossing Error
WHEN
The Canadian location is not found in the reference table
THEN
The system generates a border crossing error indicating the location validation failure
Context: A cargo record undergoing border crossing logic where Canadian manifest search fails or equipment ID validation fails
GIVEN
A cargo record undergoing border crossing logic where Canadian manifest search fails or equipment ID validation fails
Applied to: Continue Standard Processing
WHEN
No Canadian manifest is found OR equipment IDs do not match
THEN
The system continues with standard cargo processing without cross-border linkage
Context: A cargo record that has completed border crossing logic processing
GIVEN
A cargo record that has completed border crossing logic processing
Applied to: Update Cargo Status for Border Transit
WHEN
Border crossing logic is complete (whether successful linkage, error, or standard processing)
THEN
The system updates the cargo status to reflect the border transit processing results
R-GCX016E-cbl-03489 (+16) File: GCX016E.cbl Validate Segment Structure Merged 17 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Segment Structure':
  • Context - a cargo record requires s09 segment validation:
    For Retrieve S09 Segment from Database:
    When the system attempts to retrieve the s09 segment from the gcsuss09 database, then the s09 segment data is successfully retrieved and made available for validation.
  • Context - an attempt has been made to retrieve s09 segment from database:
    For Segment Retrieved Successfully?:
    When the system checks the retrieval operation result, then if segment is retrieved successfully, proceed to format validation, otherwise log validation error.
  • Context - an s09 segment has been successfully retrieved from database:
    For Validate Segment Format Structure:
    When the system validates the segment format structure, then the segment format must conform to s09 structure requirements to proceed to field integrity validation.
  • Context - s09 segment format structure has been validated:
    For Format Valid?:
    When the system evaluates format validity, then if format is valid, proceed to field integrity check, otherwise log validation error.
  • Context - s09 segment has valid format structure:
    For Check Field Integrity:
    When the system checks field integrity of the segment, then all required fields must be present and properly formatted to proceed to data consistency validation.
  • Context - s09 segment field integrity has been validated:
    For Fields Complete?:
    When the system evaluates field completeness, then if all fields are complete, proceed to data consistency validation, otherwise log validation error.
  • Context - s09 segment has complete and valid fields:
    For Validate Data Consistency:
    When the system validates data consistency across segment fields, then all data values must be consistent and logically coherent to proceed to sequence number validation.
  • Context - s09 segment data consistency has been validated:
    For Data Consistent?:
    When the system evaluates data consistency, then if data is consistent, proceed to sequence number validation, otherwise log validation error.
  • Context - s09 segment has consistent data values:
    For Validate Sequence Numbers:
    When the system validates sequence numbers, then sequence numbers must be properly ordered and within valid ranges to proceed to status code validation.
  • Context - s09 segment sequence numbers have been validated:
    For Sequences Valid?:
    When the system evaluates sequence validity, then if sequences are valid, proceed to status code validation, otherwise log validation error.
  • Context - s09 segment has valid sequence numbers:
    For Validate Status Code Values:
    When the system validates status code values, then all status codes must be valid and recognized to proceed to segment approval.
  • Context - s09 segment status codes have been validated:
    For Status Codes Valid?:
    When the system evaluates status code validity, then if status codes are valid, mark segment as valid, otherwise log validation error.
  • Context - s09 segment has passed all validation checks including status codes:
    For Mark Segment as Valid:
    When the system marks the segment as valid, then the segment is flagged as valid and ready for status array population processing.
  • Context - s09 segment has failed any validation check during the validation process:
    For Log Validation Error:
    When the system encounters a validation failure, then a validation error is logged with appropriate error details for troubleshooting.
  • Context - a validation error has been logged for the s09 segment:
    For Set Error Flag:
    When the system sets the error flag, then the error flag is set to indicate validation failure and prevent invalid segment processing.
  • Context - s09 segment has been marked as valid after successful validation:
    For Continue to Status Array Population:
    When the system continues processing, then the valid segment data is used to populate status arrays for cargo processing.
  • Context - s09 segment has failed validation and error flag has been set:
    For Skip Invalid Segment:
    When the system processes the validation result, then the invalid segment is skipped and not used for status array population.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires S09 segment validation
GIVEN
A cargo record requires S09 segment validation
Applied to: Retrieve S09 Segment from Database
WHEN
The system attempts to retrieve the S09 segment from the GCSUSS09 database
THEN
The S09 segment data is successfully retrieved and made available for validation
Context: An attempt has been made to retrieve S09 segment from database
GIVEN
An attempt has been made to retrieve S09 segment from database
Applied to: Segment Retrieved Successfully?
WHEN
The system checks the retrieval operation result
THEN
If segment is retrieved successfully, proceed to format validation, otherwise log validation error
Context: An S09 segment has been successfully retrieved from database
GIVEN
An S09 segment has been successfully retrieved from database
Applied to: Validate Segment Format Structure
WHEN
The system validates the segment format structure
THEN
The segment format must conform to S09 structure requirements to proceed to field integrity validation
Context: S09 segment format structure has been validated
GIVEN
S09 segment format structure has been validated
Applied to: Format Valid?
WHEN
The system evaluates format validity
THEN
If format is valid, proceed to field integrity check, otherwise log validation error
Context: S09 segment has valid format structure
GIVEN
S09 segment has valid format structure
Applied to: Check Field Integrity
WHEN
The system checks field integrity of the segment
THEN
All required fields must be present and properly formatted to proceed to data consistency validation
Context: S09 segment field integrity has been validated
GIVEN
S09 segment field integrity has been validated
Applied to: Fields Complete?
WHEN
The system evaluates field completeness
THEN
If all fields are complete, proceed to data consistency validation, otherwise log validation error
Context: S09 segment has complete and valid fields
GIVEN
S09 segment has complete and valid fields
Applied to: Validate Data Consistency
WHEN
The system validates data consistency across segment fields
THEN
All data values must be consistent and logically coherent to proceed to sequence number validation
Context: S09 segment data consistency has been validated
GIVEN
S09 segment data consistency has been validated
Applied to: Data Consistent?
WHEN
The system evaluates data consistency
THEN
If data is consistent, proceed to sequence number validation, otherwise log validation error
Context: S09 segment has consistent data values
GIVEN
S09 segment has consistent data values
Applied to: Validate Sequence Numbers
WHEN
The system validates sequence numbers
THEN
Sequence numbers must be properly ordered and within valid ranges to proceed to status code validation
Context: S09 segment sequence numbers have been validated
GIVEN
S09 segment sequence numbers have been validated
Applied to: Sequences Valid?
WHEN
The system evaluates sequence validity
THEN
If sequences are valid, proceed to status code validation, otherwise log validation error
Context: S09 segment has valid sequence numbers
GIVEN
S09 segment has valid sequence numbers
Applied to: Validate Status Code Values
WHEN
The system validates status code values
THEN
All status codes must be valid and recognized to proceed to segment approval
Context: S09 segment status codes have been validated
GIVEN
S09 segment status codes have been validated
Applied to: Status Codes Valid?
WHEN
The system evaluates status code validity
THEN
If status codes are valid, mark segment as valid, otherwise log validation error
Context: S09 segment has passed all validation checks including status codes
GIVEN
S09 segment has passed all validation checks including status codes
Applied to: Mark Segment as Valid
WHEN
The system marks the segment as valid
THEN
The segment is flagged as valid and ready for status array population processing
Context: S09 segment has failed any validation check during the validation process
GIVEN
S09 segment has failed any validation check during the validation process
Applied to: Log Validation Error
WHEN
The system encounters a validation failure
THEN
A validation error is logged with appropriate error details for troubleshooting
Context: A validation error has been logged for the S09 segment
GIVEN
A validation error has been logged for the S09 segment
Applied to: Set Error Flag
WHEN
The system sets the error flag
THEN
The error flag is set to indicate validation failure and prevent invalid segment processing
Context: S09 segment has been marked as valid after successful validation
GIVEN
S09 segment has been marked as valid after successful validation
Applied to: Continue to Status Array Population
WHEN
The system continues processing
THEN
The valid segment data is used to populate status arrays for cargo processing
Context: S09 segment has failed validation and error flag has been set
GIVEN
S09 segment has failed validation and error flag has been set
Applied to: Skip Invalid Segment
WHEN
The system processes the validation result
THEN
The invalid segment is skipped and not used for status array population
R-GCX016E-cbl-03506 (+9) File: GCX016E.cbl Generate Merlin Error Message Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generate Merlin Error Message':
  • Context - a disposition code is received for processing:
    For Lookup Disposition Code in DC Table:
    When the system looks up the disposition code in the dc table, then the system determines if the code exists in the table and proceeds with appropriate processing path.
  • Context - a disposition code has been received and validated against the dc table:
    For Continue Normal Processing:
    When the disposition code is found in the dc table, then the system continues with normal disposition code processing workflow.
  • Context - a disposition code has been received for processing:
    For Generate Merlin Error Message:
    When the disposition code is not found in the dc table, then the system initiates generation of a merlin error message for the unknown code.
  • Context - an unknown disposition code has been detected:
    For Format Error Message with Code Details:
    When the system formats the error message, then the error message includes the invalid disposition code value and descriptive details about the error.
  • Context - an error message is being formatted for an unknown disposition code:
    For Include Processing Context Information:
    When the system adds processing context information, then the error message includes relevant context such as processing stage, transaction details, and timing information.
  • Context - an error message is being prepared for an unknown disposition code:
    For Add Equipment/Cargo Identification:
    When the system adds identification information, then the error message includes equipment identifiers, cargo details, and other relevant identification data.
  • Context - an error message has been formatted with all required details:
    For Set Error Message Type:
    When the system sets the message type, then the error message is classified with the appropriate error type indicator for disposition code validation failures.
  • Context - an error message has been formatted and classified:
    For Route Error Message to Recipients:
    When the system routes the error message, then the error message is sent to the designated recipients according to error routing rules.
  • Context - an error message has been generated and routed for an unknown disposition code:
    For Log Error for Audit Trail:
    When the system logs the error, then the error details are recorded in the audit trail with timestamp and relevant transaction information.
  • Context - an unknown disposition code error has been processed and logged:
    For Continue Processing Next Code:
    When the system completes error handling, then the system continues processing the next disposition code in the sequence without stopping the overall transaction.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received for processing
GIVEN
A disposition code is received for processing
Applied to: Lookup Disposition Code in DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The system determines if the code exists in the table and proceeds with appropriate processing path
Context: A disposition code has been received and validated against the DC table
GIVEN
A disposition code has been received and validated against the DC table
Applied to: Continue Normal Processing
WHEN
The disposition code is found in the DC table
THEN
The system continues with normal disposition code processing workflow
Context: A disposition code has been received for processing
GIVEN
A disposition code has been received for processing
Applied to: Generate Merlin Error Message
WHEN
The disposition code is not found in the DC table
THEN
The system initiates generation of a Merlin error message for the unknown code
Context: An unknown disposition code has been detected
GIVEN
An unknown disposition code has been detected
Applied to: Format Error Message with Code Details
WHEN
The system formats the error message
THEN
The error message includes the invalid disposition code value and descriptive details about the error
Context: An error message is being formatted for an unknown disposition code
GIVEN
An error message is being formatted for an unknown disposition code
Applied to: Include Processing Context Information
WHEN
The system adds processing context information
THEN
The error message includes relevant context such as processing stage, transaction details, and timing information
Context: An error message is being prepared for an unknown disposition code
GIVEN
An error message is being prepared for an unknown disposition code
Applied to: Add Equipment/Cargo Identification
WHEN
The system adds identification information
THEN
The error message includes equipment identifiers, cargo details, and other relevant identification data
Context: An error message has been formatted with all required details
GIVEN
An error message has been formatted with all required details
Applied to: Set Error Message Type
WHEN
The system sets the message type
THEN
The error message is classified with the appropriate error type indicator for disposition code validation failures
Context: An error message has been formatted and classified
GIVEN
An error message has been formatted and classified
Applied to: Route Error Message to Recipients
WHEN
The system routes the error message
THEN
The error message is sent to the designated recipients according to error routing rules
Context: An error message has been generated and routed for an unknown disposition code
GIVEN
An error message has been generated and routed for an unknown disposition code
Applied to: Log Error for Audit Trail
WHEN
The system logs the error
THEN
The error details are recorded in the audit trail with timestamp and relevant transaction information
Context: An unknown disposition code error has been processed and logged
GIVEN
An unknown disposition code error has been processed and logged
Applied to: Continue Processing Next Code
WHEN
The system completes error handling
THEN
The system continues processing the next disposition code in the sequence without stopping the overall transaction
R-GCX016E-cbl-03516 (+12) File: GCX016E.cbl Apply Regulatory Precedence Rules Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Regulatory Precedence Rules':
  • Context - a cargo record exists with disposition codes in the status array:
    For Retrieve Current Status Array:
    When the system needs to apply regulatory precedence rules for a new disposition code, then the system retrieves all current disposition codes from the s09 status segments.
  • Context - a new disposition code is being added to a cargo's status array:
    For Identify New Disposition Code:
    When the system processes the disposition code, then the system identifies the specific disposition code and its regulatory classification.
  • Context - a new disposition code and existing status array with current disposition codes:
    For Check for Conflicting Codes?:
    When the system checks for regulatory conflicts between codes, then the system determines if conflicting codes exist that require precedence rule application.
  • Context - conflicting disposition codes exist in the cargo status array:
    For Apply Customs Regulatory Hierarchy:
    When the system applies customs regulatory hierarchy rules, then the system determines the precedence order based on regulatory requirements and customs policies.
  • Context - regulatory hierarchy has been applied to conflicting disposition codes:
    For Higher Priority Code Exists?:
    When the system evaluates code priorities, then the system determines if an existing code has higher regulatory priority than the new code.
  • Context - a higher priority disposition code exists compared to a lower priority code:
    For Remove Lower Priority Code:
    When the system applies precedence rules, then the system removes the lower priority code from the status array.
  • Context - an existing disposition code has higher priority than the new code:
    For Keep Higher Priority Code:
    When the system applies precedence rules, then the system keeps the existing higher priority code and may reject or modify the new code.
  • Context - precedence rules have been applied to disposition codes:
    For Validate Regulatory Compliance:
    When the system validates regulatory compliance, then the system confirms that the resulting code combination meets all customs regulatory requirements.
  • Context - regulatory compliance validation has been performed:
    For Precedence Rules Satisfied?:
    When the system checks if precedence rules are satisfied, then the system determines if all precedence requirements have been met successfully.
  • Context - precedence rules have been successfully applied and validated:
    For Update Status Array:
    When the system updates the status array, then the system commits the precedence-adjusted disposition codes to the cargo's s09 status segments.
  • Context - precedence rules have been applied and status array updated:
    For Log Precedence Decision:
    When the system logs the precedence decision, then the system records the precedence actions, removed codes, and regulatory justification for audit purposes.
  • Context - precedence rules cannot be satisfied or regulatory conflicts exist:
    For Generate Conflict Warning:
    When the system encounters unresolvable precedence issues, then the system generates appropriate conflict warnings for manual review and intervention.
  • Context - specific precedence rules cannot resolve disposition code conflicts:
    For Apply Default Precedence Rule:
    When the system applies default precedence rules, then the system uses predefined default hierarchy to resolve conflicts and proceed with processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with disposition codes in the status array
GIVEN
A cargo record exists with disposition codes in the status array
Applied to: Retrieve Current Status Array
WHEN
The system needs to apply regulatory precedence rules for a new disposition code
THEN
The system retrieves all current disposition codes from the S09 status segments
Context: A new disposition code is being added to a cargo's status array
GIVEN
A new disposition code is being added to a cargo's status array
Applied to: Identify New Disposition Code
WHEN
The system processes the disposition code
THEN
The system identifies the specific disposition code and its regulatory classification
Context: A new disposition code and existing status array with current disposition codes
GIVEN
A new disposition code and existing status array with current disposition codes
Applied to: Check for Conflicting Codes?
WHEN
The system checks for regulatory conflicts between codes
THEN
The system determines if conflicting codes exist that require precedence rule application
Context: Conflicting disposition codes exist in the cargo status array
GIVEN
Conflicting disposition codes exist in the cargo status array
Applied to: Apply Customs Regulatory Hierarchy
WHEN
The system applies customs regulatory hierarchy rules
THEN
The system determines the precedence order based on regulatory requirements and customs policies
Context: Regulatory hierarchy has been applied to conflicting disposition codes
GIVEN
Regulatory hierarchy has been applied to conflicting disposition codes
Applied to: Higher Priority Code Exists?
WHEN
The system evaluates code priorities
THEN
The system determines if an existing code has higher regulatory priority than the new code
Context: A higher priority disposition code exists compared to a lower priority code
GIVEN
A higher priority disposition code exists compared to a lower priority code
Applied to: Remove Lower Priority Code
WHEN
The system applies precedence rules
THEN
The system removes the lower priority code from the status array
Context: An existing disposition code has higher priority than the new code
GIVEN
An existing disposition code has higher priority than the new code
Applied to: Keep Higher Priority Code
WHEN
The system applies precedence rules
THEN
The system keeps the existing higher priority code and may reject or modify the new code
Context: Precedence rules have been applied to disposition codes
GIVEN
Precedence rules have been applied to disposition codes
Applied to: Validate Regulatory Compliance
WHEN
The system validates regulatory compliance
THEN
The system confirms that the resulting code combination meets all customs regulatory requirements
Context: Regulatory compliance validation has been performed
GIVEN
Regulatory compliance validation has been performed
Applied to: Precedence Rules Satisfied?
WHEN
The system checks if precedence rules are satisfied
THEN
The system determines if all precedence requirements have been met successfully
Context: Precedence rules have been successfully applied and validated
GIVEN
Precedence rules have been successfully applied and validated
Applied to: Update Status Array
WHEN
The system updates the status array
THEN
The system commits the precedence-adjusted disposition codes to the cargo's S09 status segments
Context: Precedence rules have been applied and status array updated
GIVEN
Precedence rules have been applied and status array updated
Applied to: Log Precedence Decision
WHEN
The system logs the precedence decision
THEN
The system records the precedence actions, removed codes, and regulatory justification for audit purposes
Context: Precedence rules cannot be satisfied or regulatory conflicts exist
GIVEN
Precedence rules cannot be satisfied or regulatory conflicts exist
Applied to: Generate Conflict Warning
WHEN
The system encounters unresolvable precedence issues
THEN
The system generates appropriate conflict warnings for manual review and intervention
Context: Specific precedence rules cannot resolve disposition code conflicts
GIVEN
Specific precedence rules cannot resolve disposition code conflicts
Applied to: Apply Default Precedence Rule
WHEN
The system applies default precedence rules
THEN
The system uses predefined default hierarchy to resolve conflicts and proceed with processing
R-GCX016E-cbl-03529 (+11) File: GCX016E.cbl Analyze Comment Content Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Analyze Comment Content':
  • Context - a k1 segment is received with comment data:
    For Extract Comment Text Content:
    When the system processes the k1 segment, then the comment text content is extracted and made available for pattern matching analysis.
  • Context - k1 segment comment text content is available for analysis:
    For Canadian Pacific Railway Bond Creation Pattern:
    When the comment contains 'director of customs, cp rail' or 'canadian pacific limited' or 'canadian pacific railway co', then the system identifies this as a canadian pacific railway bond creation pattern and sets the bond creation processing flag.
    For Train Disposition Comment Pattern:
    When the comment contains train-related disposition information, then the system identifies this as a train disposition comment pattern and sets the train comment processing flag.
    For Cargo Disposition Comment Pattern:
    When the comment contains cargo-related disposition information, then the system identifies this as a cargo disposition comment pattern and sets the cargo comment processing flag.
    For General Comment Pattern:
    When the comment does not match canadian pacific railway, train disposition, or cargo disposition patterns, then the system classifies this as a general comment pattern and sets the general comment processing flag.
  • Context - canadian pacific railway bond creation pattern has been detected in the comment:
    For Set Bond Creation Processing Flag:
    When the system processes the pattern detection result, then the bond creation processing flag is set to indicate special bond processing is required.
  • Context - train disposition comment pattern has been detected in the comment:
    For Set Train Comment Processing Flag:
    When the system processes the pattern detection result, then the train comment processing flag is set to indicate special train processing is required.
  • Context - cargo disposition comment pattern has been detected in the comment:
    For Set Cargo Comment Processing Flag:
    When the system processes the pattern detection result, then the cargo comment processing flag is set to indicate special cargo processing is required.
  • Context - general comment pattern has been detected in the comment:
    For Set General Comment Processing Flag:
    When the system processes the pattern detection result, then the general comment processing flag is set to indicate standard comment processing is required.
  • Context - a comment processing flag has been set (bond creation, train, cargo, or general):
    For Determine Processing Requirements:
    When the system evaluates the processing requirements, then the specific processing requirements are determined based on the comment pattern type.
  • Context - processing requirements have been determined for the comment:
    For Store Comment for Merlin Integration:
    When the system prepares the comment for downstream processing, then the comment is stored in the appropriate format for merlin integration.
  • Context - comment has been stored for merlin integration:
    For Mark for Special Processing:
    When the comment requires special processing (bond creation, train disposition, or cargo disposition), then the comment is marked for special processing to ensure appropriate downstream handling.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 segment is received with comment data
GIVEN
A K1 segment is received with comment data
Applied to: Extract Comment Text Content
WHEN
The system processes the K1 segment
THEN
The comment text content is extracted and made available for pattern matching analysis
Context: K1 segment comment text content is available for analysis
GIVEN
K1 segment comment text content is available for analysis
Applied to: Canadian Pacific Railway Bond Creation Pattern
WHEN
The comment contains 'DIRECTOR OF CUSTOMS, CP RAIL' OR 'CANADIAN PACIFIC LIMITED' OR 'CANADIAN PACIFIC RAILWAY CO'
THEN
The system identifies this as a Canadian Pacific Railway bond creation pattern and sets the bond creation processing flag
Applied to: Train Disposition Comment Pattern
WHEN
The comment contains train-related disposition information
THEN
The system identifies this as a train disposition comment pattern and sets the train comment processing flag
Applied to: Cargo Disposition Comment Pattern
WHEN
The comment contains cargo-related disposition information
THEN
The system identifies this as a cargo disposition comment pattern and sets the cargo comment processing flag
Applied to: General Comment Pattern
WHEN
The comment does not match Canadian Pacific Railway, train disposition, or cargo disposition patterns
THEN
The system classifies this as a general comment pattern and sets the general comment processing flag
Context: Canadian Pacific Railway bond creation pattern has been detected in the comment
GIVEN
Canadian Pacific Railway bond creation pattern has been detected in the comment
Applied to: Set Bond Creation Processing Flag
WHEN
The system processes the pattern detection result
THEN
The bond creation processing flag is set to indicate special bond processing is required
Context: Train disposition comment pattern has been detected in the comment
GIVEN
Train disposition comment pattern has been detected in the comment
Applied to: Set Train Comment Processing Flag
WHEN
The system processes the pattern detection result
THEN
The train comment processing flag is set to indicate special train processing is required
Context: Cargo disposition comment pattern has been detected in the comment
GIVEN
Cargo disposition comment pattern has been detected in the comment
Applied to: Set Cargo Comment Processing Flag
WHEN
The system processes the pattern detection result
THEN
The cargo comment processing flag is set to indicate special cargo processing is required
Context: General comment pattern has been detected in the comment
GIVEN
General comment pattern has been detected in the comment
Applied to: Set General Comment Processing Flag
WHEN
The system processes the pattern detection result
THEN
The general comment processing flag is set to indicate standard comment processing is required
Context: A comment processing flag has been set (bond creation, train, cargo, or general)
GIVEN
A comment processing flag has been set (bond creation, train, cargo, or general)
Applied to: Determine Processing Requirements
WHEN
The system evaluates the processing requirements
THEN
The specific processing requirements are determined based on the comment pattern type
Context: Processing requirements have been determined for the comment
GIVEN
Processing requirements have been determined for the comment
Applied to: Store Comment for Merlin Integration
WHEN
The system prepares the comment for downstream processing
THEN
The comment is stored in the appropriate format for Merlin integration
Context: Comment has been stored for Merlin integration
GIVEN
Comment has been stored for Merlin integration
Applied to: Mark for Special Processing
WHEN
The comment requires special processing (bond creation, train disposition, or cargo disposition)
THEN
The comment is marked for special processing to ensure appropriate downstream handling
R-GCX016E-cbl-03541 (+9) File: GCX016E.cbl Validate Freight Forwarder Relationship Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Freight Forwarder Relationship':
  • Context - a disposition code has been retrieved from x4 segment:
    For Search Broker Database for Freight Forwarder Codes:
    When the system searches the gcstbrt broker database for freight forwarder disposition codes, then the system identifies whether the disposition code requires freight forwarder validation.
  • Context - the broker database has been searched for the disposition code:
    For Disposition Code Found in Broker Database?:
    When the disposition code is found in the broker database, then the system proceeds to retrieve cargo segment data for freight forwarder processing.
  • Context - cargo segment data has been retrieved from gcsuss03 and gcsuss07 segments:
    For Extract Freight Forwarder Information from Cargo Segments:
    When the system processes the cargo segments to extract freight forwarder information, then the system identifies the freight forwarder code and related business information for validation.
  • Context - freight forwarder information has been extracted from cargo segments:
    For Valid Broker-Freight Forwarder Relationship?:
    When the system looks up the freight forwarder in the gcst2rt broker name table, then the system validates whether a valid business relationship exists between the broker and freight forwarder.
  • Context - a valid broker-freight forwarder relationship has been established:
    For Freight Forwarder Authorized for This Disposition?:
    When the system validates authorization for the specific disposition code, then the system determines whether the freight forwarder is authorized to use this disposition code.
  • Context - the freight forwarder has been authorized for the disposition code:
    For Set Freight Forwarder as Validated:
    When the system sets the freight forwarder validation status, then the freight forwarder is marked as validated and approved for email notification processing.
  • Context - the freight forwarder has been validated and approved:
    For Retrieve Freight Forwarder Contact Information:
    When the system retrieves freight forwarder contact information, then the system obtains email addresses and notification preferences for the freight forwarder.
  • Context - a valid broker-freight forwarder relationship exists but authorization check fails:
    For Mark Validation as Failed - Unauthorized:
    When the freight forwarder is not authorized for the disposition code, then the system marks validation as failed due to unauthorized access and skips email notification.
  • Context - freight forwarder lookup has been performed in the broker name table:
    For Mark Validation as Failed - Invalid Relationship:
    When no valid broker-freight forwarder relationship is found, then the system marks validation as failed due to invalid relationship and skips email notification.
  • Context - freight forwarder validation has failed due to unauthorized access, invalid relationship, or disposition code not found:
    For Skip Email Notification - Validation Failed:
    When the system processes the validation failure, then the system bypasses email notification processing and continues with standard disposition code processing.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code has been retrieved from X4 segment
GIVEN
A disposition code has been retrieved from X4 segment
Applied to: Search Broker Database for Freight Forwarder Codes
WHEN
The system searches the GCSTBRT broker database for freight forwarder disposition codes
THEN
The system identifies whether the disposition code requires freight forwarder validation
Context: The broker database has been searched for the disposition code
GIVEN
The broker database has been searched for the disposition code
Applied to: Disposition Code Found in Broker Database?
WHEN
The disposition code is found in the broker database
THEN
The system proceeds to retrieve cargo segment data for freight forwarder processing
Context: Cargo segment data has been retrieved from GCSUSS03 and GCSUSS07 segments
GIVEN
Cargo segment data has been retrieved from GCSUSS03 and GCSUSS07 segments
Applied to: Extract Freight Forwarder Information from Cargo Segments
WHEN
The system processes the cargo segments to extract freight forwarder information
THEN
The system identifies the freight forwarder code and related business information for validation
Context: Freight forwarder information has been extracted from cargo segments
GIVEN
Freight forwarder information has been extracted from cargo segments
Applied to: Valid Broker-Freight Forwarder Relationship?
WHEN
The system looks up the freight forwarder in the GCST2RT broker name table
THEN
The system validates whether a valid business relationship exists between the broker and freight forwarder
Context: A valid broker-freight forwarder relationship has been established
GIVEN
A valid broker-freight forwarder relationship has been established
Applied to: Freight Forwarder Authorized for This Disposition?
WHEN
The system validates authorization for the specific disposition code
THEN
The system determines whether the freight forwarder is authorized to use this disposition code
Context: The freight forwarder has been authorized for the disposition code
GIVEN
The freight forwarder has been authorized for the disposition code
Applied to: Set Freight Forwarder as Validated
WHEN
The system sets the freight forwarder validation status
THEN
The freight forwarder is marked as validated and approved for email notification processing
Context: The freight forwarder has been validated and approved
GIVEN
The freight forwarder has been validated and approved
Applied to: Retrieve Freight Forwarder Contact Information
WHEN
The system retrieves freight forwarder contact information
THEN
The system obtains email addresses and notification preferences for the freight forwarder
Context: A valid broker-freight forwarder relationship exists but authorization check fails
GIVEN
A valid broker-freight forwarder relationship exists but authorization check fails
Applied to: Mark Validation as Failed - Unauthorized
WHEN
The freight forwarder is not authorized for the disposition code
THEN
The system marks validation as failed due to unauthorized access and skips email notification
Context: Freight forwarder lookup has been performed in the broker name table
GIVEN
Freight forwarder lookup has been performed in the broker name table
Applied to: Mark Validation as Failed - Invalid Relationship
WHEN
No valid broker-freight forwarder relationship is found
THEN
The system marks validation as failed due to invalid relationship and skips email notification
Context: Freight forwarder validation has failed due to unauthorized access, invalid relationship, or disposition code not found
GIVEN
Freight forwarder validation has failed due to unauthorized access, invalid relationship, or disposition code not found
Applied to: Skip Email Notification - Validation Failed
WHEN
The system processes the validation failure
THEN
The system bypasses email notification processing and continues with standard disposition code processing
R-GCX016E-cbl-03551 (+22) File: GCX016E.cbl Apply Hold Validation Rules Merged 23 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Hold Validation Rules':
  • Context - a cargo record exists with associated status information:
    For Retrieve Current Hold Status Array:
    When the hold validation process is initiated, then the system retrieves the current s09 status array containing all active disposition codes and hold statuses for the cargo.
  • Context - a cargo status array has been retrieved:
    For Check for Multiple Hold Types:
    When the system processes the status array for hold validation, then the system identifies and flags the presence of multiple concurrent hold types.
  • Context - a cargo status array contains disposition codes:
    For Border Hold Present? & Destination Hold Present? & FDA Hold Present? & Piece Count Hold Present?:
    When the system evaluates hold types, then the system returns true if a border hold disposition code is found, false otherwise and the system returns true if a destination hold disposition code is found, false otherwise and the system returns true if an fda hold disposition code is found, false otherwise and the system returns true if a piece count hold disposition code is found, false otherwise.
    For Manual Release Present?:
    When the system evaluates for manual release overrides, then the system returns true if a manual release disposition code is found, false otherwise.
  • Context - multiple hold types have been identified in the cargo status:
    For Evaluate Hold Combination Rules:
    When the system validates hold combinations, then the system determines if the combination of holds is valid based on business rules and regulatory requirements.
  • Context - hold combination rules have been evaluated:
    For Hold Combination Valid?:
    When the system checks combination validity, then the system returns true if the hold combination is valid, false if it violates business rules.
  • Context - multiple valid holds are present on a cargo:
    For Apply Regulatory Priority Rules:
    When the system applies regulatory priority rules, then the system determines the priority order of holds based on regulatory requirements.
  • Context - fda hold is present along with other hold types:
    For FDA Hold Takes Priority?:
    When the system evaluates hold priority, then the system returns true if fda hold takes priority over other holds, false otherwise.
  • Context - border hold is present and fda hold does not take priority:
    For Border Hold Takes Priority?:
    When the system evaluates hold priority, then the system returns true if border hold takes priority over remaining hold types, false otherwise.
  • Context - piece count hold is present and higher priority holds do not apply:
    For Piece Count Hold Active?:
    When the system evaluates remaining hold types, then the system returns true if piece count hold is active, false otherwise.
  • Context - fda hold has been determined to take priority:
    For Set Final Hold Status - FDA Priority:
    When the system sets the final hold status, then the system sets the cargo status to fda hold and updates all related status flags.
  • Context - border hold has been determined to take priority:
    For Set Final Hold Status - Border Priority:
    When the system sets the final hold status, then the system sets the cargo status to border hold and updates all related status flags.
  • Context - destination hold is present and no higher priority holds apply:
    For Set Final Hold Status - Destination Hold:
    When the system sets the final hold status, then the system sets the cargo status to destination hold and updates all related status flags.
  • Context - piece count hold is active and no higher priority holds apply:
    For Set Final Hold Status - Piece Count Hold:
    When the system sets the final hold status, then the system sets the cargo status to piece count hold and updates all related status flags.
  • Context - manual release disposition code is present:
    For Set Final Hold Status - Manual Release Override:
    When the system processes manual release override, then the system overrides system holds and sets the cargo status to released with manual release flag.
  • Context - hold combination validation has been performed:
    For Conflicting Holds Detected?:
    When the system checks for conflicting holds, then the system returns true if conflicting holds are detected, false otherwise.
  • Context - conflicting holds have been detected:
    For Generate Hold Conflict Warning:
    When the system processes the conflict, then the system generates a hold conflict warning message for operational review.
  • Context - standard hold priority rules do not determine a clear status or conflicts exist:
    For Apply Default Hold Hierarchy:
    When the system applies default hierarchy rules, then the system applies the default hold hierarchy to determine the final hold status.
  • Context - a final hold status has been determined:
    For Validate Final Hold Status:
    When the system validates the final status, then the system confirms the final hold status meets all business rules and regulatory requirements.
  • Context - final hold status has been validated:
    For Update Hold Status Flags:
    When the system updates status flags, then the system updates all hold status flags, indicators, and related cargo status information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with associated status information
GIVEN
A cargo record exists with associated status information
Applied to: Retrieve Current Hold Status Array
WHEN
The hold validation process is initiated
THEN
The system retrieves the current S09 status array containing all active disposition codes and hold statuses for the cargo
Context: A cargo status array has been retrieved
GIVEN
A cargo status array has been retrieved
Applied to: Check for Multiple Hold Types
WHEN
The system processes the status array for hold validation
THEN
The system identifies and flags the presence of multiple concurrent hold types
Context: A cargo status array contains disposition codes
GIVEN
A cargo status array contains disposition codes
Applied to: Border Hold Present? & Destination Hold Present? & FDA Hold Present? & Piece Count Hold Present?
WHEN
The system evaluates hold types
THEN
The system returns true if a border hold disposition code is found, false otherwise AND The system returns true if a destination hold disposition code is found, false otherwise AND The system returns true if an FDA hold disposition code is found, false otherwise AND The system returns true if a piece count hold disposition code is found, false otherwise
Applied to: Manual Release Present?
WHEN
The system evaluates for manual release overrides
THEN
The system returns true if a manual release disposition code is found, false otherwise
Context: Multiple hold types have been identified in the cargo status
GIVEN
Multiple hold types have been identified in the cargo status
Applied to: Evaluate Hold Combination Rules
WHEN
The system validates hold combinations
THEN
The system determines if the combination of holds is valid based on business rules and regulatory requirements
Context: Hold combination rules have been evaluated
GIVEN
Hold combination rules have been evaluated
Applied to: Hold Combination Valid?
WHEN
The system checks combination validity
THEN
The system returns true if the hold combination is valid, false if it violates business rules
Context: Multiple valid holds are present on a cargo
GIVEN
Multiple valid holds are present on a cargo
Applied to: Apply Regulatory Priority Rules
WHEN
The system applies regulatory priority rules
THEN
The system determines the priority order of holds based on regulatory requirements
Context: FDA hold is present along with other hold types
GIVEN
FDA hold is present along with other hold types
Applied to: FDA Hold Takes Priority?
WHEN
The system evaluates hold priority
THEN
The system returns true if FDA hold takes priority over other holds, false otherwise
Context: Border hold is present and FDA hold does not take priority
GIVEN
Border hold is present and FDA hold does not take priority
Applied to: Border Hold Takes Priority?
WHEN
The system evaluates hold priority
THEN
The system returns true if border hold takes priority over remaining hold types, false otherwise
Context: Piece count hold is present and higher priority holds do not apply
GIVEN
Piece count hold is present and higher priority holds do not apply
Applied to: Piece Count Hold Active?
WHEN
The system evaluates remaining hold types
THEN
The system returns true if piece count hold is active, false otherwise
Context: FDA hold has been determined to take priority
GIVEN
FDA hold has been determined to take priority
Applied to: Set Final Hold Status - FDA Priority
WHEN
The system sets the final hold status
THEN
The system sets the cargo status to FDA hold and updates all related status flags
Context: Border hold has been determined to take priority
GIVEN
Border hold has been determined to take priority
Applied to: Set Final Hold Status - Border Priority
WHEN
The system sets the final hold status
THEN
The system sets the cargo status to border hold and updates all related status flags
Context: Destination hold is present and no higher priority holds apply
GIVEN
Destination hold is present and no higher priority holds apply
Applied to: Set Final Hold Status - Destination Hold
WHEN
The system sets the final hold status
THEN
The system sets the cargo status to destination hold and updates all related status flags
Context: Piece count hold is active and no higher priority holds apply
GIVEN
Piece count hold is active and no higher priority holds apply
Applied to: Set Final Hold Status - Piece Count Hold
WHEN
The system sets the final hold status
THEN
The system sets the cargo status to piece count hold and updates all related status flags
Context: Manual release disposition code is present
GIVEN
Manual release disposition code is present
Applied to: Set Final Hold Status - Manual Release Override
WHEN
The system processes manual release override
THEN
The system overrides system holds and sets the cargo status to released with manual release flag
Context: Hold combination validation has been performed
GIVEN
Hold combination validation has been performed
Applied to: Conflicting Holds Detected?
WHEN
The system checks for conflicting holds
THEN
The system returns true if conflicting holds are detected, false otherwise
Context: Conflicting holds have been detected
GIVEN
Conflicting holds have been detected
Applied to: Generate Hold Conflict Warning
WHEN
The system processes the conflict
THEN
The system generates a hold conflict warning message for operational review
Context: Standard hold priority rules do not determine a clear status or conflicts exist
GIVEN
Standard hold priority rules do not determine a clear status or conflicts exist
Applied to: Apply Default Hold Hierarchy
WHEN
The system applies default hierarchy rules
THEN
The system applies the default hold hierarchy to determine the final hold status
Context: A final hold status has been determined
GIVEN
A final hold status has been determined
Applied to: Validate Final Hold Status
WHEN
The system validates the final status
THEN
The system confirms the final hold status meets all business rules and regulatory requirements
Context: Final hold status has been validated
GIVEN
Final hold status has been validated
Applied to: Update Hold Status Flags
WHEN
The system updates status flags
THEN
The system updates all hold status flags, indicators, and related cargo status information