Bits In Glass
BIG Pega COE Team

Detailed Acceptance Criteria (ACs)

Category: GCX016

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.

🎯 GCX016 Scope Detected: Extracted 4747 rules, Optimally Merged into 337 Feature Scenarios.
R-GCX016-cbl-00001 (+44) File: GCX016.cbl Overview Rules Merged 45 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Overview Rules':
  • Context - a message queue connection is established:
    For 138:IMS Queue Reading:
    When the system checks for message availability and the completion code is not ok and the reason code equals 2033, then the system sets message not available status.
  • Context - a message is retrieved from the queue:
    For 138:IMS Queue Reading:
    When the completion code is ok and the message backout count is not equal to zero, then the system sets skip message found status and does not process the message.
    For 138:IMS Queue Reading:
    When the completion code is ok and the message backout count equals zero, then the system sets good message found status and proceeds with processing.
  • Context - an edi message segment is received:
    For 2:EDI Transaction Set Processing:
    When the segment type is evaluated, then the system routes st segments to header processing, m10 to manifest processing, p4 to port processing, v9 to event processing, k1 to remarks processing, x4 to customs release processing, n7 to equipment processing, and se to trailer processing.
  • Context - a manifest information segment is processed:
    For 3:Manifest Information Processing:
    When the vessel name does not start with 'train', then the system fetches train list and validates train existence in the system.
  • Context - train validation is performed:
    For 3:Manifest Information Processing:
    When the train is not found in the system, then the system generates an error report and sets train not found status.
  • Context - an event detail segment with event code is received:
    For 5:Event Detail Processing:
    When the event code is evaluated, then the system executes hmi for hold train, hre for release hold, pod/aad for train arrival, rc for review completed, oca for train not arrived, coc for cancel arrival, lck for lock train, ulc for unlock train, sei for seize train, or ser for release seizure.
  • Context - a customs release information segment is received:
    For 21:Customs Release Information Processing:
    When the processing method is determined, then the system processes cargo by bond number for grouped processing, by car and waybill for transportation unit processing, or individually for single cargo items.
  • Context - cargo processing by bond is selected:
    For 24:Bond-based Cargo Processing:
    When multiple cargo records share the same bond number, then the system processes all cargo records with the same bond number as a group.
  • Context - cargo processing by car and waybill is selected:
    For 25:Car/Waybill Cargo Processing:
    When multiple cargo records share the same car id and waybill number, then the system processes all cargo records with the same car id and waybill combination as a transportation unit.
  • Context - cargo record retrieval is required:
    For 203:Cargo Record Retrieval by Car Index:
    When exact match search using car id and us ccn key fails, then the system performs broader search criteria and sets cargo found or not found flags based on search results.
  • Context - cargo search has been performed:
    For 99:New Cargo Record Creation:
    When no existing cargo record is found, then the system creates a new cargo record with appropriate initial status.
  • Context - a new cargo record is being created:
    For 99:New Cargo Record Creation:
    When the cargo is identified as cprs type, then the system sets the cargo status to error with error description.
    For 99:New Cargo Record Creation:
    When the cargo is not cprs type, then the system sets the cargo status to sent with sent description.
    For 99:New Cargo Record Creation:
    When the disposition code is 1j, 69, or 55, then the system sets master in-bond flag and processes entry type codes for different bond types.
  • Context - in-bond processing is triggered:
    For 99:New Cargo Record Creation:
    When entry type code is evaluated, then the system processes 61 as immediate transport, 62 as transport export, 63 as immediate export, 69 as us-canada-us movement, and 00 as default border processing.
  • Context - a new cargo record with entry number is being created:
    For 99:New Cargo Record Creation:
    When the entry number starts with v prefix, then the system places it in the entry number field, otherwise places it in the in-bond control number field.
  • Context - a disposition code is received for processing:
    For 218:Disposition Code Table Lookup:
    When the system performs table lookup, then the system retrieves disposition code details and sets found or not found flags with corresponding merlin messages.
  • Context - a disposition code is processed:
    For 218:Disposition Code Table Lookup:
    When the disposition type is arl (auto release), then the system generates auto release message and processes the release automatically.
    For 218:Disposition Code Table Lookup:
    When the disposition type is mrl (manual release), then the system processes manual release request and clears destination index.
    For 218:Disposition Code Table Lookup:
    When the disposition code is a1 or a3, then the system triggers fda notification processing.
  • Context - a disposition code with removal action is processed:
    For 218:Disposition Code Table Lookup:
    When the disposition type is dc removal, then the system removes existing disposition codes from the status array.
  • Context - a disposition code for hold or release is processed:
    For 218:Disposition Code Table Lookup:
    When the disposition type is dc hold/release, then the system adds hold or release status with location and quantity information to the cargo status.
  • Context - a new hold or release disposition code is being added:
    For 218:Disposition Code Table Lookup:
    When counterpart disposition codes exist in the status array, then the system removes counterpart codes before adding the new disposition code.
  • Context - cargo status analysis is performed:
    For 257:Cargo Status Transition Management:
    When multiple status conditions exist, then the system applies priority logic with manual release as highest priority, followed by fda hold, ptt status, acknowledge status, proceed status, hold statuses, release status, and export/arrival statuses.
  • Context - cargo has ptt status:
    For 257:Cargo Status Transition Management:
    When status transition is evaluated based on quantity thresholds, then the system preserves ptt status when quantity thresholds are met and logs changes for canadian manifest processing.
  • Context - cargo release processing is performed:
    For 257:Cargo Status Transition Management:
    When release quantities are compared to total quantities, then the system sets partial release status when released quantity is less than total quantity, and full release status when released quantity equals or exceeds total quantity.
  • Context - a disposition code with add_quantity action is processed:
    For 257:Cargo Status Transition Management:
    When the system updates release quantities, then the system adds the specified quantity to the existing release quantity.
  • Context - a disposition code with subtract_quantity action is processed:
    For 257:Cargo Status Transition Management:
    When the system updates release quantities, then the system subtracts the specified quantity from existing release quantity with minimum value of zero.
  • Context - cargo release processing is completed:
    For 90:Multi-cargo Release Verification:
    When all cargo records on the same car and waybill combination are evaluated, then the system triggers container/trailer processing if the entire waybill is released.
    For 92:Merlin Release Message Generation:
    When release message generation is required, then the system creates release message with car information, date, time, and quantity details.
  • Context - waybill release verification is performed:
    For 90:Multi-cargo Release Verification:
    When individual cargo records are evaluated, then the system checks for deleted cargo, manually released cargo, held cargo, partial releases, and fully released cargo to determine overall waybill status.
  • Context - export status change occurs:
    For 92:Merlin Release Message Generation:
    When export or cancel export processing is required, then the system generates appropriate merlin messages for export status changes.
  • Context - arrival status change occurs:
    For 92:Merlin Release Message Generation:
    When arrival or cancel arrival processing is required, then the system generates appropriate merlin messages for arrival status changes.
  • Context - cargo processing is completed:
    For 89:Integration Service Calls:
    When iis integration is evaluated and cargo is held (not ptt status) and equipment type is container or trailer, then the system calls iis integration services with appropriate status descriptions.
    For 126:Cargo Information Logging:
    When logging is performed and disposition code is not 54 or 55, then the system logs cargo processing information via gct1051e transaction.
  • Context - iis integration processing is performed:
    For 89:Integration Service Calls:
    When disposition code is 4e and cargo has full release quantities, then the system performs special 4e processing logic for release handling.
  • Context - cargo processing requires payer information:
    For 97:Payer of Freight Identification:
    When payer of freight search is performed in cargo sections, then the system retrieves payer of freight information and gets broker short name if payer is found.
  • Context - broker information lookup is required:
    For 110:Broker Information Lookup:
    When payer of freight broker is found, then the system uses payer of freight broker, otherwise uses cargo broker.
  • Context - broker notification is required:
    For 111:Email vs Merlin Routing:
    When broker configuration is evaluated, then the system uses internet notification if broker is configured for internet, otherwise uses standard merlin messaging.
  • Context - quantity processing results in mismatch:
    For 111:Email vs Merlin Routing:
    When broker notification is generated, then the system sends quantity mismatch notifications to brokers with disposition code descriptions.
  • Context - disposition code processing is completed:
    For 174:KCSM Disposition Code Processing:
    When kcsm integration requirements are evaluated, then the system determines if kcsm disposition code processing and edi message copying is required.
  • Context - kcsm integration is required:
    For 175:EDI 350 Message Copying for KCSM:
    When edi message copying is performed, then the system copies the edi 350 message structure for kcsm transaction processing.
  • Context - kcsm message copying is completed:
    For 312:KCSM Transaction Spawning:
    When transaction spawning is required, then the system spawns kcsm transaction with copied message data.
  • Context - message routing is required:
    For 92:Merlin Release Message Generation:
    When message type is evaluated, then the system routes error/arrcanl to in and userr destinations, info to in and station-specific merlin ids, unrlse to default and cancel-specific merlin ids, rlse to station-specific merlin ids only, and export with equipment type validation.
👨‍💻 Technical ACs (Gherkin)
Context: A message queue connection is established
GIVEN
A message queue connection is established
Applied to: 138:IMS Queue Reading
WHEN
The system checks for message availability AND the completion code is not OK AND the reason code equals 2033
THEN
The system sets message not available status
Context: A message is retrieved from the queue
GIVEN
A message is retrieved from the queue
Applied to: 138:IMS Queue Reading
WHEN
The completion code is OK AND the message backout count is not equal to zero
THEN
The system sets skip message found status and does not process the message
Applied to: 138:IMS Queue Reading
WHEN
The completion code is OK AND the message backout count equals zero
THEN
The system sets good message found status and proceeds with processing
Context: An EDI message segment is received
GIVEN
An EDI message segment is received
Applied to: 2:EDI Transaction Set Processing
WHEN
The segment type is evaluated
THEN
The system routes ST segments to header processing, M10 to manifest processing, P4 to port processing, V9 to event processing, K1 to remarks processing, X4 to customs release processing, N7 to equipment processing, and SE to trailer processing
Context: A manifest information segment is processed
GIVEN
A manifest information segment is processed
Applied to: 3:Manifest Information Processing
WHEN
The vessel name does not start with 'TRAIN'
THEN
The system fetches train list and validates train existence in the system
Context: Train validation is performed
GIVEN
Train validation is performed
Applied to: 3:Manifest Information Processing
WHEN
The train is not found in the system
THEN
The system generates an error report and sets train not found status
Context: An event detail segment with event code is received
GIVEN
An event detail segment with event code is received
Applied to: 5:Event Detail Processing
WHEN
The event code is evaluated
THEN
The system executes HMI for hold train, HRE for release hold, POD/AAD for train arrival, RC for review completed, OCA for train not arrived, COC for cancel arrival, LCK for lock train, ULC for unlock train, SEI for seize train, or SER for release seizure
Context: A customs release information segment is received
GIVEN
A customs release information segment is received
Applied to: 21:Customs Release Information Processing
WHEN
The processing method is determined
THEN
The system processes cargo by bond number for grouped processing, by car and waybill for transportation unit processing, or individually for single cargo items
Context: Cargo processing by bond is selected
GIVEN
Cargo processing by bond is selected
Applied to: 24:Bond-based Cargo Processing
WHEN
Multiple cargo records share the same bond number
THEN
The system processes all cargo records with the same bond number as a group
Context: Cargo processing by car and waybill is selected
GIVEN
Cargo processing by car and waybill is selected
Applied to: 25:Car/Waybill Cargo Processing
WHEN
Multiple cargo records share the same car ID and waybill number
THEN
The system processes all cargo records with the same car ID and waybill combination as a transportation unit
Context: Cargo record retrieval is required
GIVEN
Cargo record retrieval is required
Applied to: 203:Cargo Record Retrieval by Car Index
WHEN
Exact match search using car ID and US CCN key fails
THEN
The system performs broader search criteria and sets cargo found or not found flags based on search results
Context: Cargo search has been performed
GIVEN
Cargo search has been performed
Applied to: 99:New Cargo Record Creation
WHEN
No existing cargo record is found
THEN
The system creates a new cargo record with appropriate initial status
Context: A new cargo record is being created
GIVEN
A new cargo record is being created
Applied to: 99:New Cargo Record Creation
WHEN
The cargo is identified as CPRS type
THEN
The system sets the cargo status to ERROR with ERROR description
Applied to: 99:New Cargo Record Creation
WHEN
The cargo is not CPRS type
THEN
The system sets the cargo status to SENT with SENT description
Applied to: 99:New Cargo Record Creation
WHEN
The disposition code is 1J, 69, or 55
THEN
The system sets master in-bond flag and processes entry type codes for different bond types
Context: In-bond processing is triggered
GIVEN
In-bond processing is triggered
Applied to: 99:New Cargo Record Creation
WHEN
Entry type code is evaluated
THEN
The system processes 61 as immediate transport, 62 as transport export, 63 as immediate export, 69 as US-Canada-US movement, and 00 as default border processing
Context: A new cargo record with entry number is being created
GIVEN
A new cargo record with entry number is being created
Applied to: 99:New Cargo Record Creation
WHEN
The entry number starts with V prefix
THEN
The system places it in the entry number field, otherwise places it in the in-bond control number field
Context: A disposition code is received for processing
GIVEN
A disposition code is received for processing
Applied to: 218:Disposition Code Table Lookup
WHEN
The system performs table lookup
THEN
The system retrieves disposition code details and sets found or not found flags with corresponding Merlin messages
Context: A disposition code is processed
GIVEN
A disposition code is processed
Applied to: 218:Disposition Code Table Lookup
WHEN
The disposition type is ARL (Auto Release)
THEN
The system generates auto release message and processes the release automatically
Applied to: 218:Disposition Code Table Lookup
WHEN
The disposition type is MRL (Manual Release)
THEN
The system processes manual release request and clears destination index
Applied to: 218:Disposition Code Table Lookup
WHEN
The disposition code is A1 or A3
THEN
The system triggers FDA notification processing
Context: A disposition code with removal action is processed
GIVEN
A disposition code with removal action is processed
Applied to: 218:Disposition Code Table Lookup
WHEN
The disposition type is DC Removal
THEN
The system removes existing disposition codes from the status array
Context: A disposition code for hold or release is processed
GIVEN
A disposition code for hold or release is processed
Applied to: 218:Disposition Code Table Lookup
WHEN
The disposition type is DC Hold/Release
THEN
The system adds hold or release status with location and quantity information to the cargo status
Context: A new hold or release disposition code is being added
GIVEN
A new hold or release disposition code is being added
Applied to: 218:Disposition Code Table Lookup
WHEN
Counterpart disposition codes exist in the status array
THEN
The system removes counterpart codes before adding the new disposition code
Context: Cargo status analysis is performed
GIVEN
Cargo status analysis is performed
Applied to: 257:Cargo Status Transition Management
WHEN
Multiple status conditions exist
THEN
The system applies priority logic with Manual Release as highest priority, followed by FDA Hold, PTT status, Acknowledge status, Proceed status, Hold statuses, Release status, and Export/Arrival statuses
Context: Cargo has PTT status
GIVEN
Cargo has PTT status
Applied to: 257:Cargo Status Transition Management
WHEN
Status transition is evaluated based on quantity thresholds
THEN
The system preserves PTT status when quantity thresholds are met and logs changes for Canadian manifest processing
Context: Cargo release processing is performed
GIVEN
Cargo release processing is performed
Applied to: 257:Cargo Status Transition Management
WHEN
Release quantities are compared to total quantities
THEN
The system sets partial release status when released quantity is less than total quantity, and full release status when released quantity equals or exceeds total quantity
Context: A disposition code with ADD_QUANTITY action is processed
GIVEN
A disposition code with ADD_QUANTITY action is processed
Applied to: 257:Cargo Status Transition Management
WHEN
The system updates release quantities
THEN
The system adds the specified quantity to the existing release quantity
Context: A disposition code with SUBTRACT_QUANTITY action is processed
GIVEN
A disposition code with SUBTRACT_QUANTITY action is processed
Applied to: 257:Cargo Status Transition Management
WHEN
The system updates release quantities
THEN
The system subtracts the specified quantity from existing release quantity with minimum value of zero
Context: Cargo release processing is completed
GIVEN
Cargo release processing is completed
Applied to: 90:Multi-cargo Release Verification
WHEN
All cargo records on the same car and waybill combination are evaluated
THEN
The system triggers container/trailer processing if the entire waybill is released
Applied to: 92:Merlin Release Message Generation
WHEN
Release message generation is required
THEN
The system creates release message with car information, date, time, and quantity details
Context: Waybill release verification is performed
GIVEN
Waybill release verification is performed
Applied to: 90:Multi-cargo Release Verification
WHEN
Individual cargo records are evaluated
THEN
The system checks for deleted cargo, manually released cargo, held cargo, partial releases, and fully released cargo to determine overall waybill status
Context: Export status change occurs
GIVEN
Export status change occurs
Applied to: 92:Merlin Release Message Generation
WHEN
Export or cancel export processing is required
THEN
The system generates appropriate Merlin messages for export status changes
Context: Arrival status change occurs
GIVEN
Arrival status change occurs
Applied to: 92:Merlin Release Message Generation
WHEN
Arrival or cancel arrival processing is required
THEN
The system generates appropriate Merlin messages for arrival status changes
Context: Cargo processing is completed
GIVEN
Cargo processing is completed
Applied to: 89:Integration Service Calls
WHEN
IIS integration is evaluated AND cargo is held (not PTT status) AND equipment type is container or trailer
THEN
The system calls IIS integration services with appropriate status descriptions
Applied to: 126:Cargo Information Logging
WHEN
Logging is performed AND disposition code is not 54 or 55
THEN
The system logs cargo processing information via GCT1051E transaction
Context: IIS integration processing is performed
GIVEN
IIS integration processing is performed
Applied to: 89:Integration Service Calls
WHEN
Disposition code is 4E AND cargo has full release quantities
THEN
The system performs special 4E processing logic for release handling
Context: Cargo processing requires payer information
GIVEN
Cargo processing requires payer information
Applied to: 97:Payer of Freight Identification
WHEN
Payer of freight search is performed in cargo sections
THEN
The system retrieves payer of freight information and gets broker short name if payer is found
Context: Broker information lookup is required
GIVEN
Broker information lookup is required
Applied to: 110:Broker Information Lookup
WHEN
Payer of freight broker is found
THEN
The system uses payer of freight broker, otherwise uses cargo broker
Context: Broker notification is required
GIVEN
Broker notification is required
Applied to: 111:Email vs Merlin Routing
WHEN
Broker configuration is evaluated
THEN
The system uses internet notification if broker is configured for internet, otherwise uses standard Merlin messaging
Context: Quantity processing results in mismatch
GIVEN
Quantity processing results in mismatch
Applied to: 111:Email vs Merlin Routing
WHEN
Broker notification is generated
THEN
The system sends quantity mismatch notifications to brokers with disposition code descriptions
Context: Disposition code processing is completed
GIVEN
Disposition code processing is completed
Applied to: 174:KCSM Disposition Code Processing
WHEN
KCSM integration requirements are evaluated
THEN
The system determines if KCSM disposition code processing and EDI message copying is required
Context: KCSM integration is required
GIVEN
KCSM integration is required
Applied to: 175:EDI 350 Message Copying for KCSM
WHEN
EDI message copying is performed
THEN
The system copies the EDI 350 message structure for KCSM transaction processing
Context: KCSM message copying is completed
GIVEN
KCSM message copying is completed
Applied to: 312:KCSM Transaction Spawning
WHEN
Transaction spawning is required
THEN
The system spawns KCSM transaction with copied message data
Context: Message routing is required
GIVEN
Message routing is required
Applied to: 92:Merlin Release Message Generation
WHEN
Message type is evaluated
THEN
The system routes ERROR/ARRCANL to IN and USERR destinations, INFO to IN and station-specific Merlin IDs, UNRLSE to default and cancel-specific Merlin IDs, RLSE to station-specific Merlin IDs only, and EXPORT with equipment type validation
R-GCX016-cbl-00046 (+11) File: GCX016.cbl Program Initialization Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Program Initialization':
  • Context - the program gcx016 has started:
    For Initialize Working Storage Fields:
    When the system begins initialization process, then all working storage fields are set to their initial default values including counters, flags, and data areas.
  • Context - working storage fields have been initialized:
    For Initialize MQ Message Arrays:
    When the system prepares for mq message processing, then mq message arrays are initialized with proper structure and capacity for message handling.
  • Context - mq message arrays have been initialized:
    For Set Processing Parameters:
    When the system determines the message source type, then processing parameters are configured appropriately for the specific input method.
  • Context - processing parameters have been set:
    For Message Source Type?:
    When the system checks the message source indicator, then the system routes to either mq queue processing or direct gcw016 input processing based on the message source type.
  • Context - message source type is determined as mq queue:
    For Initialize for MQ Queue Processing:
    When the system initializes mq queue processing, then mq-specific configuration parameters are set including queue names, connection settings, and message handling options.
  • Context - message source type is determined as direct input:
    For Initialize for Direct GCW016 Input:
    When the system initializes direct gcw016 input processing, then direct input configuration parameters are set for handling gcw016 message format.
  • Context - message source initialization is complete:
    For Load System Tables:
    When the system loads system tables, then all required reference tables including disposition codes, broker information, and validation tables are loaded into memory.
  • Context - system tables have been loaded:
    For Establish Database Connections:
    When the system establishes database connections, then connections to cargo database, train database, and reference data sources are established and verified.
  • Context - database connections have been established:
    For Initialize Error Handling:
    When the system initializes error handling, then error handling framework is configured including error logging, merlin messaging, and error recovery procedures.
  • Context - error handling has been initialized:
    For Set Transaction Counters:
    When the system sets transaction counters, then all counters for processed messages, errors, warnings, and cargo records are set to zero.
  • Context - transaction counters have been set:
    For Initialize Status Flags:
    When the system initializes status flags, then all processing control flags including end-of-file, error conditions, and processing states are set to their initial values.
  • Context - all status flags have been initialized:
    For Ready for Message Processing:
    When the system completes initialization sequence, then the system is ready to begin processing messages with all components properly initialized and configured.
👨‍💻 Technical ACs (Gherkin)
Context: The program GCX016 has started
GIVEN
The program GCX016 has started
Applied to: Initialize Working Storage Fields
WHEN
The system begins initialization process
THEN
All working storage fields are set to their initial default values including counters, flags, and data areas
Context: Working storage fields have been initialized
GIVEN
Working storage fields have been initialized
Applied to: Initialize MQ Message Arrays
WHEN
The system prepares for MQ message processing
THEN
MQ message arrays are initialized with proper structure and capacity for message handling
Context: MQ message arrays have been initialized
GIVEN
MQ message arrays have been initialized
Applied to: Set Processing Parameters
WHEN
The system determines the message source type
THEN
Processing parameters are configured appropriately for the specific input method
Context: Processing parameters have been set
GIVEN
Processing parameters have been set
Applied to: Message Source Type?
WHEN
The system checks the message source indicator
THEN
The system routes to either MQ queue processing or direct GCW016 input processing based on the message source type
Context: Message source type is determined as MQ Queue
GIVEN
Message source type is determined as MQ Queue
Applied to: Initialize for MQ Queue Processing
WHEN
The system initializes MQ queue processing
THEN
MQ-specific configuration parameters are set including queue names, connection settings, and message handling options
Context: Message source type is determined as Direct Input
GIVEN
Message source type is determined as Direct Input
Applied to: Initialize for Direct GCW016 Input
WHEN
The system initializes direct GCW016 input processing
THEN
Direct input configuration parameters are set for handling GCW016 message format
Context: Message source initialization is complete
GIVEN
Message source initialization is complete
Applied to: Load System Tables
WHEN
The system loads system tables
THEN
All required reference tables including disposition codes, broker information, and validation tables are loaded into memory
Context: System tables have been loaded
GIVEN
System tables have been loaded
Applied to: Establish Database Connections
WHEN
The system establishes database connections
THEN
Connections to cargo database, train database, and reference data sources are established and verified
Context: Database connections have been established
GIVEN
Database connections have been established
Applied to: Initialize Error Handling
WHEN
The system initializes error handling
THEN
Error handling framework is configured including error logging, Merlin messaging, and error recovery procedures
Context: Error handling has been initialized
GIVEN
Error handling has been initialized
Applied to: Set Transaction Counters
WHEN
The system sets transaction counters
THEN
All counters for processed messages, errors, warnings, and cargo records are set to zero
Context: Transaction counters have been set
GIVEN
Transaction counters have been set
Applied to: Initialize Status Flags
WHEN
The system initializes status flags
THEN
All processing control flags including end-of-file, error conditions, and processing states are set to their initial values
Context: All status flags have been initialized
GIVEN
All status flags have been initialized
Applied to: Ready for Message Processing
WHEN
The system completes initialization sequence
THEN
The system is ready to begin processing messages with all components properly initialized and configured
R-GCX016-cbl-00058 (+5) File: GCX016.cbl EDI Transaction Set Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI Transaction Set Processing':
  • Context - an st segment is received from the message queue:
    For ST Segment Received:
    When the system processes the st segment header, then the system should set the header found flag and initialize transaction set processing.
  • Context - an st segment with transaction set control number is being processed:
    For Extract Transaction Set Control Number:
    When the system extracts the control number from the segment, then the control number should be stored for transaction boundary validation.
  • Context - a transaction set identifier code is extracted from the st segment:
    For Valid Transaction Set ID?:
    When the system validates the transaction set identifier, then the system should accept valid edi 350 transaction types and reject invalid identifier codes.
  • Context - a valid transaction set identifier has been validated:
    For Initialize Transaction Set Processing:
    When the system initializes transaction set processing, then the system should set up the transaction boundary and enable segment validation.
  • Context - transaction set processing has been successfully initialized:
    For Set Transaction Set Active Flag:
    When the system sets the transaction set active flag, then the active flag should be set to enable subsequent segment processing within the transaction boundary.
  • Context - an invalid transaction set identifier code is detected:
    For Generate Error Message:
    When the system processes the invalid identifier, then the system should generate an error message and skip the transaction set processing.
👨‍💻 Technical ACs (Gherkin)
Context: An ST segment is received from the message queue
GIVEN
An ST segment is received from the message queue
Applied to: ST Segment Received
WHEN
The system processes the ST segment header
THEN
The system should set the header found flag and initialize transaction set processing
Context: An ST segment with transaction set control number is being processed
GIVEN
An ST segment with transaction set control number is being processed
Applied to: Extract Transaction Set Control Number
WHEN
The system extracts the control number from the segment
THEN
The control number should be stored for transaction boundary validation
Context: A transaction set identifier code is extracted from the ST segment
GIVEN
A transaction set identifier code is extracted from the ST segment
Applied to: Valid Transaction Set ID?
WHEN
The system validates the transaction set identifier
THEN
The system should accept valid EDI 350 transaction types and reject invalid identifier codes
Context: A valid transaction set identifier has been validated
GIVEN
A valid transaction set identifier has been validated
Applied to: Initialize Transaction Set Processing
WHEN
The system initializes transaction set processing
THEN
The system should set up the transaction boundary and enable segment validation
Context: Transaction set processing has been successfully initialized
GIVEN
Transaction set processing has been successfully initialized
Applied to: Set Transaction Set Active Flag
WHEN
The system sets the transaction set active flag
THEN
The active flag should be set to enable subsequent segment processing within the transaction boundary
Context: An invalid transaction set identifier code is detected
GIVEN
An invalid transaction set identifier code is detected
Applied to: Generate Error Message
WHEN
The system processes the invalid identifier
THEN
The system should generate an error message and skip the transaction set processing
R-GCX016-cbl-00064 (+10) File: GCX016.cbl Manifest Information Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Information Processing':
  • Context - an m10 manifest segment is received with train information:
    For Extract Train Information from M10:
    When the system processes the m10 segment, then the system extracts scac code from m10-02, equipment initial from m10-03, and equipment number from m10-04 to build the train identification key.
  • Context - a train identification key has been built from m10 segment data:
    For Search Train List Database:
    When the system searches the train list database, then the system determines if the train exists in the gcwtl-train-list database and sets appropriate found/not found flags.
  • Context - the train database search has been completed:
    For Train Found in System?:
    When the system evaluates the search results, then if the train is found, the system proceeds to validate train status; if not found, the system generates a train not found error.
  • Context - a train has been found in the train list database:
    For Validate Train Status:
    When the system validates the train status, then the system verifies the train is in an acceptable operational state for processing manifest information.
  • Context - a train has been successfully validated:
    For Set Train Processing Flag:
    When the system completes train validation, then the system sets the train processing flag to indicate the train is ready for manifest processing.
  • Context - a train search has been completed and the train was not found:
    For Generate Train Not Found Error:
    When the system processes the not found condition, then the system generates a train not found error and initiates error notification procedures.
  • Context - a train not found error has been generated:
    For Format Error Message with Train Details:
    When the system formats the error message, then the system includes the scac code, equipment initial, equipment number, and other relevant train details in the error message using data from gcstbrt error tables.
  • Context - an error message has been formatted with train details:
    For Send Error Notification to Operations:
    When the system sends the error notification, then the system delivers the error notification to operations personnel through the designated notification channels.
  • Context - an error notification has been sent to operations:
    For Log Train Validation Failure:
    When the system logs the validation failure, then the system records the train validation failure details in the system audit log for future reference and analysis.
  • Context - train validation and status checks have been completed successfully:
    For Process Train Information Successfully:
    When the system processes the successful validation, then the system marks the train processing as successful and prepares to continue processing other manifest segments.
  • Context - train processing has been completed (either successfully or with errors logged):
    For Continue Processing Other Segments:
    When the system continues manifest processing, then the system proceeds to process other segments in the manifest message to ensure complete message handling.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 manifest segment is received with train information
GIVEN
An M10 manifest segment is received with train information
Applied to: Extract Train Information from M10
WHEN
The system processes the M10 segment
THEN
The system extracts SCAC code from M10-02, equipment initial from M10-03, and equipment number from M10-04 to build the train identification key
Context: A train identification key has been built from M10 segment data
GIVEN
A train identification key has been built from M10 segment data
Applied to: Search Train List Database
WHEN
The system searches the train list database
THEN
The system determines if the train exists in the GCWTL-TRAIN-LIST database and sets appropriate found/not found flags
Context: The train database search has been completed
GIVEN
The train database search has been completed
Applied to: Train Found in System?
WHEN
The system evaluates the search results
THEN
If the train is found, the system proceeds to validate train status; if not found, the system generates a train not found error
Context: A train has been found in the train list database
GIVEN
A train has been found in the train list database
Applied to: Validate Train Status
WHEN
The system validates the train status
THEN
The system verifies the train is in an acceptable operational state for processing manifest information
Context: A train has been successfully validated
GIVEN
A train has been successfully validated
Applied to: Set Train Processing Flag
WHEN
The system completes train validation
THEN
The system sets the train processing flag to indicate the train is ready for manifest processing
Context: A train search has been completed and the train was not found
GIVEN
A train search has been completed and the train was not found
Applied to: Generate Train Not Found Error
WHEN
The system processes the not found condition
THEN
The system generates a train not found error and initiates error notification procedures
Context: A train not found error has been generated
GIVEN
A train not found error has been generated
Applied to: Format Error Message with Train Details
WHEN
The system formats the error message
THEN
The system includes the SCAC code, equipment initial, equipment number, and other relevant train details in the error message using data from GCSTBRT error tables
Context: An error message has been formatted with train details
GIVEN
An error message has been formatted with train details
Applied to: Send Error Notification to Operations
WHEN
The system sends the error notification
THEN
The system delivers the error notification to operations personnel through the designated notification channels
Context: An error notification has been sent to operations
GIVEN
An error notification has been sent to operations
Applied to: Log Train Validation Failure
WHEN
The system logs the validation failure
THEN
The system records the train validation failure details in the system audit log for future reference and analysis
Context: Train validation and status checks have been completed successfully
GIVEN
Train validation and status checks have been completed successfully
Applied to: Process Train Information Successfully
WHEN
The system processes the successful validation
THEN
The system marks the train processing as successful and prepares to continue processing other manifest segments
Context: Train processing has been completed (either successfully or with errors logged)
GIVEN
Train processing has been completed (either successfully or with errors logged)
Applied to: Continue Processing Other Segments
WHEN
The system continues manifest processing
THEN
The system proceeds to process other segments in the manifest message to ensure complete message handling
R-GCX016-cbl-00075 File: GCX016.cbl Port Information Processing
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Port Information Processing':
  • Context - a message contains a p4 segment type:
    For P4 Segment Received:
    When the system processes message segments, then the system calls b200-process-p4-segment to handle port information processing.
👨‍💻 Technical ACs (Gherkin)
Context: A message contains a P4 segment type
GIVEN
A message contains a P4 segment type
Applied to: P4 Segment Received
WHEN
The system processes message segments
THEN
The system calls B200-PROCESS-P4-SEGMENT to handle port information processing
R-GCX016-cbl-00076 (+12) File: GCX016.cbl Event Detail Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Event Detail Processing':
  • Context - a v9 event detail segment is received with disposition code hmi:
    For HMI - Train Hold Operations:
    When the system processes the hmi disposition code, then the train status is updated to held and vid segments are processed for equipment holds.
  • Context - a v9 event detail segment is received with disposition code hre:
    For HRE - Train Release Operations:
    When the system processes the hre disposition code, then the train status is updated to released and vid segments are processed for equipment releases.
  • Context - a v9 event detail segment is received with disposition code pod:
    For POD - Train Arrival at Port of Discharge:
    When the system processes the pod disposition code, then the train status is set to arrived and arrival date and location are updated.
  • Context - a v9 event detail segment is received with disposition code aad:
    For AAD - Train Arrival at Destination:
    When the system processes the aad disposition code, then the train status is set to arrived and arrival date and location are updated.
  • Context - a v9 event detail segment is received with disposition code rc:
    For RC - Export Manifest Review Complete:
    When the system processes the rc disposition code, then the export manifest is marked as reviewed and the train record is updated.
  • Context - a v9 event detail segment is received with disposition code oca:
    For OCA - Train Not Arrived Notification:
    When the system processes the oca disposition code, then a train not arrived warning is generated with instructions to re-arrive the train or contact uscs.
  • Context - a v9 event detail segment is received with disposition code coc:
    For COC - Train Arrival Cancellation:
    When the system processes the coc disposition code, then the previous arrival status is cancelled and the train record is updated with cancellation details.
  • Context - a v9 event detail segment is received with disposition code lck:
    For LCK - Train Lock Operations:
    When the system processes the lck disposition code, then the train lock status is set and the train record is updated to prevent modifications.
  • Context - a v9 event detail segment is received with disposition code ulc:
    For ULC - Train Unlock Operations:
    When the system processes the ulc disposition code, then the train lock status is removed and the train record is updated to allow modifications.
  • Context - a v9 event detail segment is received with disposition code sei:
    For SEI - Train Seizure by Customs:
    When the system processes the sei disposition code, then the train seizure status is set by customs, vid segments are processed for equipment seizure, and the train record is updated.
  • Context - a v9 event detail segment is received with disposition code ser:
    For SER - Train Seizure Release:
    When the system processes the ser disposition code, then the train seizure status is removed, vid segments are processed for equipment release from seizure, and the train record is updated.
  • Context - a v9 event detail segment is received:
    For Extract Disposition Code from V9-02:
    When the system extracts the disposition code from v9-02 field, then the disposition code is evaluated to determine which train operation to perform (hmi, hre, pod, aad, rc, oca, coc, lck, ulc, sei, or ser).
  • Context - v9 segments are being processed and status notification messages have been generated:
    For More V9 Segments?:
    When the system checks if more v9 segments exist in the message, then if more v9 segments exist, processing continues with the next segment, otherwise v9 processing is completed.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 event detail segment is received with disposition code HMI
GIVEN
A V9 event detail segment is received with disposition code HMI
Applied to: HMI - Train Hold Operations
WHEN
The system processes the HMI disposition code
THEN
The train status is updated to HELD and VID segments are processed for equipment holds
Context: A V9 event detail segment is received with disposition code HRE
GIVEN
A V9 event detail segment is received with disposition code HRE
Applied to: HRE - Train Release Operations
WHEN
The system processes the HRE disposition code
THEN
The train status is updated to RELEASED and VID segments are processed for equipment releases
Context: A V9 event detail segment is received with disposition code POD
GIVEN
A V9 event detail segment is received with disposition code POD
Applied to: POD - Train Arrival at Port of Discharge
WHEN
The system processes the POD disposition code
THEN
The train status is set to ARRIVED and arrival date and location are updated
Context: A V9 event detail segment is received with disposition code AAD
GIVEN
A V9 event detail segment is received with disposition code AAD
Applied to: AAD - Train Arrival at Destination
WHEN
The system processes the AAD disposition code
THEN
The train status is set to ARRIVED and arrival date and location are updated
Context: A V9 event detail segment is received with disposition code RC
GIVEN
A V9 event detail segment is received with disposition code RC
Applied to: RC - Export Manifest Review Complete
WHEN
The system processes the RC disposition code
THEN
The export manifest is marked as reviewed and the train record is updated
Context: A V9 event detail segment is received with disposition code OCA
GIVEN
A V9 event detail segment is received with disposition code OCA
Applied to: OCA - Train Not Arrived Notification
WHEN
The system processes the OCA disposition code
THEN
A train not arrived warning is generated with instructions to re-arrive the train or contact USCS
Context: A V9 event detail segment is received with disposition code COC
GIVEN
A V9 event detail segment is received with disposition code COC
Applied to: COC - Train Arrival Cancellation
WHEN
The system processes the COC disposition code
THEN
The previous arrival status is cancelled and the train record is updated with cancellation details
Context: A V9 event detail segment is received with disposition code LCK
GIVEN
A V9 event detail segment is received with disposition code LCK
Applied to: LCK - Train Lock Operations
WHEN
The system processes the LCK disposition code
THEN
The train lock status is set and the train record is updated to prevent modifications
Context: A V9 event detail segment is received with disposition code ULC
GIVEN
A V9 event detail segment is received with disposition code ULC
Applied to: ULC - Train Unlock Operations
WHEN
The system processes the ULC disposition code
THEN
The train lock status is removed and the train record is updated to allow modifications
Context: A V9 event detail segment is received with disposition code SEI
GIVEN
A V9 event detail segment is received with disposition code SEI
Applied to: SEI - Train Seizure by Customs
WHEN
The system processes the SEI disposition code
THEN
The train seizure status is set by customs, VID segments are processed for equipment seizure, and the train record is updated
Context: A V9 event detail segment is received with disposition code SER
GIVEN
A V9 event detail segment is received with disposition code SER
Applied to: SER - Train Seizure Release
WHEN
The system processes the SER disposition code
THEN
The train seizure status is removed, VID segments are processed for equipment release from seizure, and the train record is updated
Context: A V9 event detail segment is received
GIVEN
A V9 event detail segment is received
Applied to: Extract Disposition Code from V9-02
WHEN
The system extracts the disposition code from V9-02 field
THEN
The disposition code is evaluated to determine which train operation to perform (HMI, HRE, POD, AAD, RC, OCA, COC, LCK, ULC, SEI, or SER)
Context: V9 segments are being processed and status notification messages have been generated
GIVEN
V9 segments are being processed and status notification messages have been generated
Applied to: More V9 Segments?
WHEN
The system checks if more V9 segments exist in the message
THEN
If more V9 segments exist, processing continues with the next segment, otherwise V9 processing is completed
R-GCX016-cbl-00089 (+12) File: GCX016.cbl Train Hold Operations Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Hold Operations':
  • Context - a v9 segment with hmi disposition code is received containing train identification information:
    For Validate Train Exists in System:
    When the system processes the train hold request, then the system validates the train exists in gcwtl-train-list and sets appropriate processing flags.
  • Context - a train hold operation is being processed and train validation has been performed:
    For Generate Train Not Found Error Message:
    When the train is not found in the train list system, then the system generates a train not found error message and stops further hold processing.
  • Context - a valid train exists in the system and hmi disposition code is received:
    For Set Train Hold Status Flag:
    When the train validation is successful, then the system sets the train hold status flag to indicate the train is being held.
  • Context - train hold status has been set successfully:
    For Initialize Equipment Hold Counter:
    When the system prepares to process equipment holds, then the system initializes the equipment hold counter to zero.
  • Context - train hold processing is in progress and equipment hold counter is initialized:
    For VID Segments Follow?:
    When the system checks for additional message segments, then the system determines if vid segments are present for equipment-specific hold processing.
  • Context - vid segments are available and train hold is in progress:
    For Process VID Segment for Equipment Hold:
    When each vid segment is processed, then the system applies hold status to the specific equipment identified in the vid segment.
  • Context - a vid segment has been successfully processed for equipment hold:
    For Increment Equipment Hold Counter:
    When the equipment hold is applied, then the system increments the equipment hold counter by one.
  • Context - one vid segment has been processed and equipment hold counter updated:
    For More VID Segments?:
    When the system checks for more vid segments in the message, then the system determines if additional vid segments exist and continues processing or proceeds to train record update.
  • Context - all vid segments have been processed or no vid segments exist:
    For Update Train Record with Hold Status:
    When train hold processing is ready for database update, then the system updates the train record with hold status in the gcstbrt table.
  • Context - train record has been updated with hold status and equipment hold counter contains final count:
    For Update Equipment Hold Count:
    When the system finalizes the hold operation, then the system updates the train record with the total number of equipment units held.
  • Context - train record and equipment hold count have been updated successfully:
    For Log Train Hold Operation:
    When the hold operation is complete, then the system logs the train hold operation with train identification, hold status, and equipment count.
  • Context - train hold operation has been logged successfully:
    For Generate Hold Notification Message:
    When the system prepares notifications, then the system generates a hold notification message containing train and equipment hold details.
  • Context - hold notification message has been generated:
    For Send Message to Customs/Brokers:
    When the system sends notifications, then the system transmits the hold notification to customs authorities and affected brokers.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with HMI disposition code is received containing train identification information
GIVEN
A V9 segment with HMI disposition code is received containing train identification information
Applied to: Validate Train Exists in System
WHEN
The system processes the train hold request
THEN
The system validates the train exists in GCWTL-TRAIN-LIST and sets appropriate processing flags
Context: A train hold operation is being processed and train validation has been performed
GIVEN
A train hold operation is being processed and train validation has been performed
Applied to: Generate Train Not Found Error Message
WHEN
The train is not found in the train list system
THEN
The system generates a train not found error message and stops further hold processing
Context: A valid train exists in the system and HMI disposition code is received
GIVEN
A valid train exists in the system and HMI disposition code is received
Applied to: Set Train Hold Status Flag
WHEN
The train validation is successful
THEN
The system sets the train hold status flag to indicate the train is being held
Context: Train hold status has been set successfully
GIVEN
Train hold status has been set successfully
Applied to: Initialize Equipment Hold Counter
WHEN
The system prepares to process equipment holds
THEN
The system initializes the equipment hold counter to zero
Context: Train hold processing is in progress and equipment hold counter is initialized
GIVEN
Train hold processing is in progress and equipment hold counter is initialized
Applied to: VID Segments Follow?
WHEN
The system checks for additional message segments
THEN
The system determines if VID segments are present for equipment-specific hold processing
Context: VID segments are available and train hold is in progress
GIVEN
VID segments are available and train hold is in progress
Applied to: Process VID Segment for Equipment Hold
WHEN
Each VID segment is processed
THEN
The system applies hold status to the specific equipment identified in the VID segment
Context: A VID segment has been successfully processed for equipment hold
GIVEN
A VID segment has been successfully processed for equipment hold
Applied to: Increment Equipment Hold Counter
WHEN
The equipment hold is applied
THEN
The system increments the equipment hold counter by one
Context: One VID segment has been processed and equipment hold counter updated
GIVEN
One VID segment has been processed and equipment hold counter updated
Applied to: More VID Segments?
WHEN
The system checks for more VID segments in the message
THEN
The system determines if additional VID segments exist and continues processing or proceeds to train record update
Context: All VID segments have been processed or no VID segments exist
GIVEN
All VID segments have been processed or no VID segments exist
Applied to: Update Train Record with Hold Status
WHEN
Train hold processing is ready for database update
THEN
The system updates the train record with hold status in the GCSTBRT table
Context: Train record has been updated with hold status and equipment hold counter contains final count
GIVEN
Train record has been updated with hold status and equipment hold counter contains final count
Applied to: Update Equipment Hold Count
WHEN
The system finalizes the hold operation
THEN
The system updates the train record with the total number of equipment units held
Context: Train record and equipment hold count have been updated successfully
GIVEN
Train record and equipment hold count have been updated successfully
Applied to: Log Train Hold Operation
WHEN
The hold operation is complete
THEN
The system logs the train hold operation with train identification, hold status, and equipment count
Context: Train hold operation has been logged successfully
GIVEN
Train hold operation has been logged successfully
Applied to: Generate Hold Notification Message
WHEN
The system prepares notifications
THEN
The system generates a hold notification message containing train and equipment hold details
Context: Hold notification message has been generated
GIVEN
Hold notification message has been generated
Applied to: Send Message to Customs/Brokers
WHEN
The system sends notifications
THEN
The system transmits the hold notification to customs authorities and affected brokers
R-GCX016-cbl-00102 (+12) File: GCX016.cbl Train Release Operations Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Release Operations':
  • Context - an hre disposition code is received for train hold release:
    For Validate Train Exists in System:
    When the system processes the m10 manifest segment to validate train existence, then the system checks if the vessel name exists in gcwtl-train-list and sets appropriate found/not found flags.
  • Context - an hre disposition code is being processed for train hold release:
    For Send Train Not Found Error Message:
    When the train is not found in gcwtl-train-list, then the system generates a train not found error message and terminates hre processing.
  • Context - a valid train exists in the system for hre processing:
    For Check Current Train Hold Status:
    When the system checks the train's current status, then the system determines if the train is currently held and requires release processing.
    For No Action Required - Train Not Held:
    When the train is not currently held, then the system bypasses release processing and completes without action.
  • Context - a train is currently held and hre disposition code is being processed:
    For Process VID Segments for Equipment Release:
    When vid segments are present in the message, then the system processes each vid segment to release individual equipment holds.
  • Context - vid segments are present for equipment release processing:
    For Release Individual Equipment/Cars:
    When the system processes each equipment item in the vid segments, then the system removes hold status from each specified equipment or car.
  • Context - individual equipment items are being released from hold:
    For Update Equipment Hold Count:
    When each equipment hold is processed and released, then the system updates the count of remaining equipment holds for the train.
  • Context - equipment hold counts have been updated after individual releases:
    For All Equipment Released?:
    When the system evaluates the remaining hold count, then the system determines if all equipment has been released (hold count equals zero).
  • Context - all equipment on the train has been released from hold or no vid segments were present:
    For Remove Train-Level Hold Status:
    When the system processes train-level hold removal, then the system removes the train-level hold status.
  • Context - train-level hold status has been removed:
    For Update Train Status to Released:
    When the system updates train operational status, then the system sets the train status to released.
  • Context - train status has been updated to released:
    For Log Train Release Operation:
    When the system completes the release operation, then the system logs the train release operation with relevant details.
  • Context - train release operation has been logged:
    For Generate Train Release Notification:
    When the system generates notifications, then the system creates a train release notification message.
  • Context - train release notification has been generated:
    For Send Success Message to Requestor:
    When the system sends response messages, then the system transmits success message to the original requestor.
👨‍💻 Technical ACs (Gherkin)
Context: An HRE disposition code is received for train hold release
GIVEN
An HRE disposition code is received for train hold release
Applied to: Validate Train Exists in System
WHEN
The system processes the M10 manifest segment to validate train existence
THEN
The system checks if the vessel name exists in GCWTL-TRAIN-LIST and sets appropriate found/not found flags
Context: An HRE disposition code is being processed for train hold release
GIVEN
An HRE disposition code is being processed for train hold release
Applied to: Send Train Not Found Error Message
WHEN
The train is not found in GCWTL-TRAIN-LIST
THEN
The system generates a train not found error message and terminates HRE processing
Context: A valid train exists in the system for HRE processing
GIVEN
A valid train exists in the system for HRE processing
Applied to: Check Current Train Hold Status
WHEN
The system checks the train's current status
THEN
The system determines if the train is currently held and requires release processing
Applied to: No Action Required - Train Not Held
WHEN
The train is not currently held
THEN
The system bypasses release processing and completes without action
Context: A train is currently held and HRE disposition code is being processed
GIVEN
A train is currently held and HRE disposition code is being processed
Applied to: Process VID Segments for Equipment Release
WHEN
VID segments are present in the message
THEN
The system processes each VID segment to release individual equipment holds
Context: VID segments are present for equipment release processing
GIVEN
VID segments are present for equipment release processing
Applied to: Release Individual Equipment/Cars
WHEN
The system processes each equipment item in the VID segments
THEN
The system removes hold status from each specified equipment or car
Context: Individual equipment items are being released from hold
GIVEN
Individual equipment items are being released from hold
Applied to: Update Equipment Hold Count
WHEN
Each equipment hold is processed and released
THEN
The system updates the count of remaining equipment holds for the train
Context: Equipment hold counts have been updated after individual releases
GIVEN
Equipment hold counts have been updated after individual releases
Applied to: All Equipment Released?
WHEN
The system evaluates the remaining hold count
THEN
The system determines if all equipment has been released (hold count equals zero)
Context: All equipment on the train has been released from hold OR no VID segments were present
GIVEN
All equipment on the train has been released from hold OR no VID segments were present
Applied to: Remove Train-Level Hold Status
WHEN
The system processes train-level hold removal
THEN
The system removes the train-level hold status
Context: Train-level hold status has been removed
GIVEN
Train-level hold status has been removed
Applied to: Update Train Status to Released
WHEN
The system updates train operational status
THEN
The system sets the train status to released
Context: Train status has been updated to released
GIVEN
Train status has been updated to released
Applied to: Log Train Release Operation
WHEN
The system completes the release operation
THEN
The system logs the train release operation with relevant details
Context: Train release operation has been logged
GIVEN
Train release operation has been logged
Applied to: Generate Train Release Notification
WHEN
The system generates notifications
THEN
The system creates a train release notification message
Context: Train release notification has been generated
GIVEN
Train release notification has been generated
Applied to: Send Success Message to Requestor
WHEN
The system sends response messages
THEN
The system transmits success message to the original requestor
R-GCX016-cbl-00115 (+10) File: GCX016.cbl Train Arrival Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Arrival Processing':
  • Context - a v9 event segment is received with disposition code:
    For Disposition Code Type?:
    When the disposition code is either pod or aad, then the system routes to appropriate train arrival processing.
  • Context - a train arrival event is being processed:
    For Train Found?:
    When the system checks if the train exists in the database, then if train is not found, generate train not found error and stop processing.
  • Context - a train arrival is being processed at a specific port:
    For Export Manifest Port?:
    When the port is configured for export manifest processing, then set pre-arrival status for export processing instead of standard arrival status.
  • Context - a valid train arrival event is being processed:
    For Update Train Arrival Date:
    When the train exists and port configuration is validated, then update the train record with the current arrival date and time.
  • Context - a train arrival event has been validated and processed:
    For Set Train Status to Arrived:
    When all arrival validations pass successfully, then update the train status to 'arrived' in the system.
  • Context - a train is arriving and has been previously locked:
    For Automatically Unlock Train on Arrival:
    When the train status is being updated to arrived, then automatically unlock the train to allow normal processing operations.
  • Context - equipment on an arriving train has hold or seizure status:
    For Maintain Equipment Status:
    When the train arrival processing is updating equipment status, then maintain the existing hold or seizure status and do not change to normal arrival status.
  • Context - a train has successfully arrived and equipment has been processed:
    For Generate AEI Arrival Notification:
    When equipment status updates are complete, then generate and send aei arrival notifications to relevant systems.
  • Context - a train with associated manifests has arrived:
    For Update Manifest Status:
    When train arrival processing is complete, then update all associated manifest records to reflect train arrival status.
  • Context - a train arrival has been processed and manifest status updated:
    For Send Arrival Notifications to Customs:
    When all internal processing is complete, then send arrival notifications to customs authorities for regulatory compliance.
  • Context - a train arrival event has been completely processed:
    For Log Train Arrival Event:
    When all notifications have been sent to customs, then log the complete train arrival event with timestamp and details for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 event segment is received with disposition code
GIVEN
A V9 event segment is received with disposition code
Applied to: Disposition Code Type?
WHEN
The disposition code is either POD or AAD
THEN
The system routes to appropriate train arrival processing
Context: A train arrival event is being processed
GIVEN
A train arrival event is being processed
Applied to: Train Found?
WHEN
The system checks if the train exists in the database
THEN
If train is not found, generate train not found error and stop processing
Context: A train arrival is being processed at a specific port
GIVEN
A train arrival is being processed at a specific port
Applied to: Export Manifest Port?
WHEN
The port is configured for export manifest processing
THEN
Set pre-arrival status for export processing instead of standard arrival status
Context: A valid train arrival event is being processed
GIVEN
A valid train arrival event is being processed
Applied to: Update Train Arrival Date
WHEN
The train exists and port configuration is validated
THEN
Update the train record with the current arrival date and time
Context: A train arrival event has been validated and processed
GIVEN
A train arrival event has been validated and processed
Applied to: Set Train Status to Arrived
WHEN
All arrival validations pass successfully
THEN
Update the train status to 'Arrived' in the system
Context: A train is arriving and has been previously locked
GIVEN
A train is arriving and has been previously locked
Applied to: Automatically Unlock Train on Arrival
WHEN
The train status is being updated to arrived
THEN
Automatically unlock the train to allow normal processing operations
Context: Equipment on an arriving train has hold or seizure status
GIVEN
Equipment on an arriving train has hold or seizure status
Applied to: Maintain Equipment Status
WHEN
The train arrival processing is updating equipment status
THEN
Maintain the existing hold or seizure status and do not change to normal arrival status
Context: A train has successfully arrived and equipment has been processed
GIVEN
A train has successfully arrived and equipment has been processed
Applied to: Generate AEI Arrival Notification
WHEN
Equipment status updates are complete
THEN
Generate and send AEI arrival notifications to relevant systems
Context: A train with associated manifests has arrived
GIVEN
A train with associated manifests has arrived
Applied to: Update Manifest Status
WHEN
Train arrival processing is complete
THEN
Update all associated manifest records to reflect train arrival status
Context: A train arrival has been processed and manifest status updated
GIVEN
A train arrival has been processed and manifest status updated
Applied to: Send Arrival Notifications to Customs
WHEN
All internal processing is complete
THEN
Send arrival notifications to customs authorities for regulatory compliance
Context: A train arrival event has been completely processed
GIVEN
A train arrival event has been completely processed
Applied to: Log Train Arrival Event
WHEN
All notifications have been sent to customs
THEN
Log the complete train arrival event with timestamp and details for audit trail
R-GCX016-cbl-00126 (+12) File: GCX016.cbl Export Manifest Review Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Manifest Review':
  • Context - a v9 segment with rc disposition code is received for export manifest review:
    For Validate Train Exists in System:
    When the system processes the train validation, then the system checks if the train exists in the system and sets appropriate flags.
  • Context - a v9 segment with rc disposition code is received and the train validation has been performed:
    For Generate Train Not Found Error Message:
    When the train is not found in the system, then the system generates a train not found error message and routes it to the merlin error system.
  • Context - a v9 segment with rc disposition code is received and the train exists in the system:
    For Process RC - Export Manifest Review Complete:
    When the system processes the rc disposition code, then the system initiates export manifest review complete processing.
  • Context - export manifest review complete processing has been initiated and the train exists in the system:
    For Update Train Status to Export Review Complete:
    When the system updates the train status, then the train status is set to export review complete.
  • Context - the train status has been updated to export review complete:
    For Check if Train is at Export Port:
    When the system validates the train location, then the system checks if the train is at a valid export port location.
  • Context - the train location has been validated and the train is at a valid export port:
    For Set Export Manifest Review Flag:
    When the system processes the export port validation result, then the export manifest review flag is set to indicate completion.
  • Context - the export manifest review flag has been set:
    For Update Train Export Status:
    When the system updates the train export status, then the train export status is updated to reflect the completed review.
  • Context - the train export status has been updated:
    For Generate Export Review Complete Notification:
    When the system generates notifications, then an export review complete notification is generated and sent to appropriate recipients.
  • Context - the export review complete notification has been generated:
    For Log Export Manifest Review Transaction:
    When the system logs the transaction, then the export manifest review transaction is logged with appropriate details.
  • Context - the export manifest review transaction has been logged:
    For Check for Additional V9 Segments:
    When the system checks for additional segments, then the system determines if more v9 segments exist for processing.
  • Context - additional v9 segments have been found:
    For Process Next V9 Segment:
    When the system processes the next segment, then the next v9 segment is processed following the same validation and processing rules.
  • Context - all v9 segments have been processed or an error has occurred:
    For Complete Export Manifest Review Processing:
    When the system finalizes the processing, then the export manifest review processing is marked as complete.
  • Context - a validation error has occurred or the train is not at a valid export port:
    For Send Error to Merlin System:
    When the system handles the error condition, then the error message is sent to the merlin system for appropriate handling.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with RC disposition code is received for export manifest review
GIVEN
A V9 segment with RC disposition code is received for export manifest review
Applied to: Validate Train Exists in System
WHEN
The system processes the train validation
THEN
The system checks if the train exists in the system and sets appropriate flags
Context: A V9 segment with RC disposition code is received AND the train validation has been performed
GIVEN
A V9 segment with RC disposition code is received AND the train validation has been performed
Applied to: Generate Train Not Found Error Message
WHEN
The train is not found in the system
THEN
The system generates a train not found error message and routes it to the Merlin error system
Context: A V9 segment with RC disposition code is received AND the train exists in the system
GIVEN
A V9 segment with RC disposition code is received AND the train exists in the system
Applied to: Process RC - Export Manifest Review Complete
WHEN
The system processes the RC disposition code
THEN
The system initiates export manifest review complete processing
Context: Export manifest review complete processing has been initiated AND the train exists in the system
GIVEN
Export manifest review complete processing has been initiated AND the train exists in the system
Applied to: Update Train Status to Export Review Complete
WHEN
The system updates the train status
THEN
The train status is set to export review complete
Context: The train status has been updated to export review complete
GIVEN
The train status has been updated to export review complete
Applied to: Check if Train is at Export Port
WHEN
The system validates the train location
THEN
The system checks if the train is at a valid export port location
Context: The train location has been validated AND the train is at a valid export port
GIVEN
The train location has been validated AND the train is at a valid export port
Applied to: Set Export Manifest Review Flag
WHEN
The system processes the export port validation result
THEN
The export manifest review flag is set to indicate completion
Context: The export manifest review flag has been set
GIVEN
The export manifest review flag has been set
Applied to: Update Train Export Status
WHEN
The system updates the train export status
THEN
The train export status is updated to reflect the completed review
Context: The train export status has been updated
GIVEN
The train export status has been updated
Applied to: Generate Export Review Complete Notification
WHEN
The system generates notifications
THEN
An export review complete notification is generated and sent to appropriate recipients
Context: The export review complete notification has been generated
GIVEN
The export review complete notification has been generated
Applied to: Log Export Manifest Review Transaction
WHEN
The system logs the transaction
THEN
The export manifest review transaction is logged with appropriate details
Context: The export manifest review transaction has been logged
GIVEN
The export manifest review transaction has been logged
Applied to: Check for Additional V9 Segments
WHEN
The system checks for additional segments
THEN
The system determines if more V9 segments exist for processing
Context: Additional V9 segments have been found
GIVEN
Additional V9 segments have been found
Applied to: Process Next V9 Segment
WHEN
The system processes the next segment
THEN
The next V9 segment is processed following the same validation and processing rules
Context: All V9 segments have been processed OR an error has occurred
GIVEN
All V9 segments have been processed OR an error has occurred
Applied to: Complete Export Manifest Review Processing
WHEN
The system finalizes the processing
THEN
The export manifest review processing is marked as complete
Context: A validation error has occurred OR the train is not at a valid export port
GIVEN
A validation error has occurred OR the train is not at a valid export port
Applied to: Send Error to Merlin System
WHEN
The system handles the error condition
THEN
The error message is sent to the Merlin system for appropriate handling
R-GCX016-cbl-00139 (+9) File: GCX016.cbl Train Not Arrived Notification Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Not Arrived Notification':
  • Context - a v9 segment with oca disposition code is received for a specific train:
    For Validate Train Exists in System:
    When the system validates the train existence in the gcwtl-train-list, then the system determines if the train is found or not found and sets appropriate processing flags.
  • Context - a train exists in the system and oca disposition code is being processed:
    For Generate Train Not Arrived Error Message:
    When the system processes the train not arrived condition, then the system creates an error message indicating the train has not arrived and requires re-arrival or uscs contact.
  • Context - train existence validation has been completed for oca disposition code processing:
    For Train Found?:
    When the system evaluates the train found status, then if train is found, proceed with not arrived notification processing, otherwise skip processing.
  • Context - a train not arrived condition has been identified for oca processing:
    For Format Error Message with Train Details:
    When the system formats the warning message, then the message includes instructions to re-arrive the train or contact uscs with train identification details.
  • Context - a train not arrived error message is being formatted for oca processing:
    For Include Manifest Information in Message:
    When the system includes manifest information in the message, then the message contains manifest details associated with the train that has not arrived.
  • Context - a train not arrived error message has been formatted for oca processing:
    For Route Error Message to Multiple Destinations:
    When the system routes the message to destinations, then the message is sent to both 'in' and 'userr' destinations as configured in the message routing tables.
  • Context - a train not arrived error message is being prepared for routing:
    For Set Message Keywords for Categorization:
    When the system sets message keywords, then the message is tagged with appropriate keywords for oca train not arrived categorization.
  • Context - a train not arrived message has been routed with proper keywords:
    For Send Notification to Configured Users:
    When the system sends notifications to configured users, then all users configured to receive oca train not arrived notifications receive the message.
  • Context - a train not arrived notification has been sent to configured users:
    For Log Train Not Arrived Event:
    When the system logs the event, then the train not arrived event is recorded in the system logs with timestamp and train details.
  • Context - a train not arrived event has been logged:
    For Update Train Status as Not Arrived:
    When the system updates the train status, then the train status is updated to indicate not arrived condition requiring re-arrival processing.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with OCA disposition code is received for a specific train
GIVEN
A V9 segment with OCA disposition code is received for a specific train
Applied to: Validate Train Exists in System
WHEN
The system validates the train existence in the GCWTL-TRAIN-LIST
THEN
The system determines if the train is found or not found and sets appropriate processing flags
Context: A train exists in the system and OCA disposition code is being processed
GIVEN
A train exists in the system and OCA disposition code is being processed
Applied to: Generate Train Not Arrived Error Message
WHEN
The system processes the train not arrived condition
THEN
The system creates an error message indicating the train has not arrived and requires re-arrival or USCS contact
Context: Train existence validation has been completed for OCA disposition code processing
GIVEN
Train existence validation has been completed for OCA disposition code processing
Applied to: Train Found?
WHEN
The system evaluates the train found status
THEN
If train is found, proceed with not arrived notification processing, otherwise skip processing
Context: A train not arrived condition has been identified for OCA processing
GIVEN
A train not arrived condition has been identified for OCA processing
Applied to: Format Error Message with Train Details
WHEN
The system formats the warning message
THEN
The message includes instructions to re-arrive the train or contact USCS with train identification details
Context: A train not arrived error message is being formatted for OCA processing
GIVEN
A train not arrived error message is being formatted for OCA processing
Applied to: Include Manifest Information in Message
WHEN
The system includes manifest information in the message
THEN
The message contains manifest details associated with the train that has not arrived
Context: A train not arrived error message has been formatted for OCA processing
GIVEN
A train not arrived error message has been formatted for OCA processing
Applied to: Route Error Message to Multiple Destinations
WHEN
The system routes the message to destinations
THEN
The message is sent to both 'IN' and 'USERR' destinations as configured in the message routing tables
Context: A train not arrived error message is being prepared for routing
GIVEN
A train not arrived error message is being prepared for routing
Applied to: Set Message Keywords for Categorization
WHEN
The system sets message keywords
THEN
The message is tagged with appropriate keywords for OCA train not arrived categorization
Context: A train not arrived message has been routed with proper keywords
GIVEN
A train not arrived message has been routed with proper keywords
Applied to: Send Notification to Configured Users
WHEN
The system sends notifications to configured users
THEN
All users configured to receive OCA train not arrived notifications receive the message
Context: A train not arrived notification has been sent to configured users
GIVEN
A train not arrived notification has been sent to configured users
Applied to: Log Train Not Arrived Event
WHEN
The system logs the event
THEN
The train not arrived event is recorded in the system logs with timestamp and train details
Context: A train not arrived event has been logged
GIVEN
A train not arrived event has been logged
Applied to: Update Train Status as Not Arrived
WHEN
The system updates the train status
THEN
The train status is updated to indicate not arrived condition requiring re-arrival processing
R-GCX016-cbl-00149 (+16) File: GCX016.cbl Train Arrival Cancellation Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Arrival Cancellation':
  • Context - a v9 segment with coc disposition code is received for a specific train:
    For Train Exists in System?:
    When the system checks if the train exists in gcwtl-train-list, then if train does not exist, generate train not found error and stop processing, otherwise continue with coc validation.
  • Context - a train exists in the system and coc disposition code is provided:
    For Validate COC Disposition Code:
    When the system looks up the coc code in gcstbrt disposition codes table, then if coc code is valid, proceed to check train arrival status, otherwise generate invalid disposition code error.
  • Context - a valid coc disposition code is received for an existing train:
    For Train Previously Arrived?:
    When the system checks the train's current arrival status, then if train has not previously arrived, generate train arrival cancellation warning and stop processing, otherwise proceed with cancellation.
  • Context - a coc disposition code is received for a train that has not previously arrived:
    For Generate Train Arrival Cancellation Warning:
    When the system detects the train arrival status is not 'arrived', then generate warning message 'train arrival being cancelled by cbp. contact cbp and re-arrive bonds if needed' and terminate processing.
  • Context - a train has previously arrived and coc disposition code is valid:
    For Update Train Status to Cancel Arrival:
    When the system processes the arrival cancellation, then update train status to 'arrival cancelled' in the train records.
  • Context - train status is being updated to cancel arrival:
    For Clear Train Arrival Date:
    When the system processes the arrival cancellation, then clear the train arrival date field and set it to null or empty.
  • Context - train arrival date has been cleared due to cancellation:
    For Restore Previous Bond Dates:
    When the system needs to restore bond processing dates, then restore all bond dates to their state prior to the cancelled arrival event.
  • Context - train status, arrival date, and bond dates have been updated for cancellation:
    For Update Train Records in Database:
    When all train data changes are ready to be persisted, then update train records in the database with all cancellation-related changes.
  • Context - train records have been updated for arrival cancellation:
    For Equipment Records Exist?:
    When the system checks for associated equipment records, then if equipment records exist, process equipment status changes, otherwise proceed to generate cancellation notifications.
  • Context - equipment records exist for the train with cancelled arrival:
    For Process Equipment Status Changes:
    When the system processes equipment status updates, then update equipment status to reflect the train arrival cancellation.
  • Context - equipment status changes are being processed for cancelled train arrival:
    For Update Equipment Arrival Status:
    When the system updates individual equipment records, then set equipment arrival status to cancelled or clear arrival status based on cancellation.
  • Context - train and equipment records have been updated for arrival cancellation:
    For Generate Cancellation Notifications:
    When the system prepares stakeholder notifications, then generate cancellation notifications containing train details and cancellation information.
  • Context - cancellation notifications have been generated:
    For KCSM Integration Required?:
    When the system checks kcsm integration requirements, then if kcsm integration is required, copy edi message for kcsm transmission, otherwise proceed to log cancellation.
  • Context - kcsm integration is required for the train arrival cancellation:
    For Copy EDI Message for KCSM:
    When the system prepares kcsm transmission, then copy the edi message to a9rt/a9dp kcsm transmission tables.
  • Context - edi message has been copied for kcsm transmission:
    For Create KCSM Transmission:
    When the system creates the kcsm transmission record, then create kcsm transmission record in a9rt/a9dp tables with appropriate transmission parameters.
  • Context - train arrival cancellation processing is complete and kcsm transmission is handled if required:
    For Log Train Arrival Cancellation:
    When the system logs the cancellation event, then create log entry with train details, cancellation timestamp, and processing results.
  • Context - train arrival cancellation has been logged:
    For Send Notifications to Stakeholders:
    When the system sends stakeholder notifications, then send notifications to brokers, customs, and other stakeholders with cancellation details and required actions.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with COC disposition code is received for a specific train
GIVEN
A V9 segment with COC disposition code is received for a specific train
Applied to: Train Exists in System?
WHEN
The system checks if the train exists in GCWTL-TRAIN-LIST
THEN
If train does not exist, generate train not found error and stop processing, otherwise continue with COC validation
Context: A train exists in the system and COC disposition code is provided
GIVEN
A train exists in the system and COC disposition code is provided
Applied to: Validate COC Disposition Code
WHEN
The system looks up the COC code in GCSTBRT disposition codes table
THEN
If COC code is valid, proceed to check train arrival status, otherwise generate invalid disposition code error
Context: A valid COC disposition code is received for an existing train
GIVEN
A valid COC disposition code is received for an existing train
Applied to: Train Previously Arrived?
WHEN
The system checks the train's current arrival status
THEN
If train has not previously arrived, generate train arrival cancellation warning and stop processing, otherwise proceed with cancellation
Context: A COC disposition code is received for a train that has not previously arrived
GIVEN
A COC disposition code is received for a train that has not previously arrived
Applied to: Generate Train Arrival Cancellation Warning
WHEN
The system detects the train arrival status is not 'arrived'
THEN
Generate warning message 'Train arrival being cancelled by CBP. Contact CBP and re-arrive bonds if needed' and terminate processing
Context: A train has previously arrived and COC disposition code is valid
GIVEN
A train has previously arrived and COC disposition code is valid
Applied to: Update Train Status to Cancel Arrival
WHEN
The system processes the arrival cancellation
THEN
Update train status to 'arrival cancelled' in the train records
Context: Train status is being updated to cancel arrival
GIVEN
Train status is being updated to cancel arrival
Applied to: Clear Train Arrival Date
WHEN
The system processes the arrival cancellation
THEN
Clear the train arrival date field and set it to null or empty
Context: Train arrival date has been cleared due to cancellation
GIVEN
Train arrival date has been cleared due to cancellation
Applied to: Restore Previous Bond Dates
WHEN
The system needs to restore bond processing dates
THEN
Restore all bond dates to their state prior to the cancelled arrival event
Context: Train status, arrival date, and bond dates have been updated for cancellation
GIVEN
Train status, arrival date, and bond dates have been updated for cancellation
Applied to: Update Train Records in Database
WHEN
All train data changes are ready to be persisted
THEN
Update train records in the database with all cancellation-related changes
Context: Train records have been updated for arrival cancellation
GIVEN
Train records have been updated for arrival cancellation
Applied to: Equipment Records Exist?
WHEN
The system checks for associated equipment records
THEN
If equipment records exist, process equipment status changes, otherwise proceed to generate cancellation notifications
Context: Equipment records exist for the train with cancelled arrival
GIVEN
Equipment records exist for the train with cancelled arrival
Applied to: Process Equipment Status Changes
WHEN
The system processes equipment status updates
THEN
Update equipment status to reflect the train arrival cancellation
Context: Equipment status changes are being processed for cancelled train arrival
GIVEN
Equipment status changes are being processed for cancelled train arrival
Applied to: Update Equipment Arrival Status
WHEN
The system updates individual equipment records
THEN
Set equipment arrival status to cancelled or clear arrival status based on cancellation
Context: Train and equipment records have been updated for arrival cancellation
GIVEN
Train and equipment records have been updated for arrival cancellation
Applied to: Generate Cancellation Notifications
WHEN
The system prepares stakeholder notifications
THEN
Generate cancellation notifications containing train details and cancellation information
Context: Cancellation notifications have been generated
GIVEN
Cancellation notifications have been generated
Applied to: KCSM Integration Required?
WHEN
The system checks KCSM integration requirements
THEN
If KCSM integration is required, copy EDI message for KCSM transmission, otherwise proceed to log cancellation
Context: KCSM integration is required for the train arrival cancellation
GIVEN
KCSM integration is required for the train arrival cancellation
Applied to: Copy EDI Message for KCSM
WHEN
The system prepares KCSM transmission
THEN
Copy the EDI message to A9RT/A9DP KCSM transmission tables
Context: EDI message has been copied for KCSM transmission
GIVEN
EDI message has been copied for KCSM transmission
Applied to: Create KCSM Transmission
WHEN
The system creates the KCSM transmission record
THEN
Create KCSM transmission record in A9RT/A9DP tables with appropriate transmission parameters
Context: Train arrival cancellation processing is complete and KCSM transmission is handled if required
GIVEN
Train arrival cancellation processing is complete and KCSM transmission is handled if required
Applied to: Log Train Arrival Cancellation
WHEN
The system logs the cancellation event
THEN
Create log entry with train details, cancellation timestamp, and processing results
Context: Train arrival cancellation has been logged
GIVEN
Train arrival cancellation has been logged
Applied to: Send Notifications to Stakeholders
WHEN
The system sends stakeholder notifications
THEN
Send notifications to brokers, customs, and other stakeholders with cancellation details and required actions
R-GCX016-cbl-00166 (+11) File: GCX016.cbl Train Lock Operations Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Lock Operations':
  • Context - a v9 segment is received with disposition code 'lck':
    For V9 Segment with LCK Disposition Code Received:
    When the system processes the v9 segment, then the system initiates train lock processing workflow.
  • Context - a train lock request is being processed:
    For Validate Train Exists in System:
    When the system validates the train information from m10 segment, then the system checks if the train exists in gcwtl-train-list table.
  • Context - a train lock operation is requested and the train does not exist in the system:
    For Generate Train Not Found Error Message:
    When the train validation fails, then the system generates a train not found error message and terminates the lock processing.
  • Context - a valid train exists in the system and m10 segment is available:
    For Extract Train Information from M10 Segment:
    When the system processes the train lock request, then the system extracts train identification and operational details from m10 segment.
  • Context - train information has been extracted and lck disposition code is present:
    For Process LCK Disposition Code:
    When the system processes the disposition code, then the system interprets lck code as a train lock operation and prepares lock parameters.
  • Context - lck disposition code has been processed successfully:
    For Set Train Lock Status:
    When the system applies the lock operation, then the system sets the train status to locked and prevents unauthorized modifications.
  • Context - train lock status has been set:
    For Update Train Record in GCWTL-TRAIN-LIST:
    When the system updates the train record, then the system updates gcwtl-train-list table with lock status and timestamp information.
  • Context - train record has been updated with lock status:
    For Log Train Lock Operation:
    When the system completes the lock operation, then the system creates an audit log entry with train id, lock timestamp, and operation details.
  • Context - train lock operation has been logged:
    For K1 Remarks Present?:
    When the system checks for additional information, then the system determines if k1 remarks segment is present in the message.
  • Context - k1 remarks segment is present in the message:
    For Process K1 Remarks for Train Lock:
    When the system processes the remarks, then the system extracts lock reason, duration, and additional operational notes from k1 segment.
  • Context - train lock operation is completed and k1 remarks have been processed (if present):
    For Generate Train Lock Confirmation Message:
    When the system generates confirmation, then the system creates a train lock confirmation message with train id, lock timestamp, and operation status.
  • Context - train lock confirmation message has been generated:
    For Send Notification to Operations:
    When the system sends notifications, then the system sends lock notification to operations team and updates operational dashboards.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment is received with disposition code 'LCK'
GIVEN
A V9 segment is received with disposition code 'LCK'
Applied to: V9 Segment with LCK Disposition Code Received
WHEN
The system processes the V9 segment
THEN
The system initiates train lock processing workflow
Context: A train lock request is being processed
GIVEN
A train lock request is being processed
Applied to: Validate Train Exists in System
WHEN
The system validates the train information from M10 segment
THEN
The system checks if the train exists in GCWTL-TRAIN-LIST table
Context: A train lock operation is requested AND the train does not exist in the system
GIVEN
A train lock operation is requested AND the train does not exist in the system
Applied to: Generate Train Not Found Error Message
WHEN
The train validation fails
THEN
The system generates a train not found error message AND terminates the lock processing
Context: A valid train exists in the system AND M10 segment is available
GIVEN
A valid train exists in the system AND M10 segment is available
Applied to: Extract Train Information from M10 Segment
WHEN
The system processes the train lock request
THEN
The system extracts train identification and operational details from M10 segment
Context: Train information has been extracted AND LCK disposition code is present
GIVEN
Train information has been extracted AND LCK disposition code is present
Applied to: Process LCK Disposition Code
WHEN
The system processes the disposition code
THEN
The system interprets LCK code as a train lock operation AND prepares lock parameters
Context: LCK disposition code has been processed successfully
GIVEN
LCK disposition code has been processed successfully
Applied to: Set Train Lock Status
WHEN
The system applies the lock operation
THEN
The system sets the train status to locked AND prevents unauthorized modifications
Context: Train lock status has been set
GIVEN
Train lock status has been set
Applied to: Update Train Record in GCWTL-TRAIN-LIST
WHEN
The system updates the train record
THEN
The system updates GCWTL-TRAIN-LIST table with lock status AND timestamp information
Context: Train record has been updated with lock status
GIVEN
Train record has been updated with lock status
Applied to: Log Train Lock Operation
WHEN
The system completes the lock operation
THEN
The system creates an audit log entry with train ID, lock timestamp, AND operation details
Context: Train lock operation has been logged
GIVEN
Train lock operation has been logged
Applied to: K1 Remarks Present?
WHEN
The system checks for additional information
THEN
The system determines if K1 remarks segment is present in the message
Context: K1 remarks segment is present in the message
GIVEN
K1 remarks segment is present in the message
Applied to: Process K1 Remarks for Train Lock
WHEN
The system processes the remarks
THEN
The system extracts lock reason, duration, AND additional operational notes from K1 segment
Context: Train lock operation is completed AND K1 remarks have been processed (if present)
GIVEN
Train lock operation is completed AND K1 remarks have been processed (if present)
Applied to: Generate Train Lock Confirmation Message
WHEN
The system generates confirmation
THEN
The system creates a train lock confirmation message with train ID, lock timestamp, AND operation status
Context: Train lock confirmation message has been generated
GIVEN
Train lock confirmation message has been generated
Applied to: Send Notification to Operations
WHEN
The system sends notifications
THEN
The system sends lock notification to operations team AND updates operational dashboards
R-GCX016-cbl-00178 (+8) File: GCX016.cbl Train Unlock Operations Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Unlock Operations':
  • Context - a v9 segment with ulc disposition code is received containing train identification information:
    For Validate Train Exists in System:
    When the system processes the ulc request and checks the train list for the specified train, then the system verifies train existence in gcwtl-train-list and sets appropriate validation flags.
  • Context - a ulc disposition code is being processed for a specific train:
    For Generate Train Not Found Error Message:
    When the train lookup validation fails and the train is not found in the system, then the system generates a train not found error message and stops ulc processing without updating any train status.
  • Context - a valid ulc disposition code is being processed and the train exists in the system:
    For Update Train Status to Unlocked:
    When the unlock operation is executed, then the system updates the train status records to reflect unlocked state.
  • Context - a train unlock operation has been successfully processed:
    For Log Train Unlock Activity:
    When the train status is updated to unlocked, then the system creates a log entry recording the train unlock activity with timestamp and relevant details.
  • Context - a train unlock operation is being processed:
    For Check for VID Equipment Segments:
    When the system examines the message segments for vid equipment information, then the system identifies whether vid segments are present and sets appropriate processing flags.
  • Context - vid equipment segments are present in the ulc message:
    For Process Individual Equipment Unlock:
    When the system processes individual equipment unlock operations, then the system iterates through each vid segment and processes unlock operations for the specified equipment.
  • Context - individual equipment unlock processing is being performed for vid segments:
    For Update Equipment Status to Unlocked:
    When each equipment item is processed for unlock, then the system updates the equipment records to reflect unlocked status for each specified equipment item.
  • Context - train unlock operations have been successfully completed including any individual equipment processing:
    For Generate Train Unlock Confirmation:
    When all unlock processing is finished, then the system generates a confirmation message indicating successful train unlock completion.
  • Context - train unlock confirmation has been generated:
    For Send Notification Messages:
    When the system processes notification distribution, then the system sends unlock notification messages to relevant parties and connected systems.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with ULC disposition code is received containing train identification information
GIVEN
A V9 segment with ULC disposition code is received containing train identification information
Applied to: Validate Train Exists in System
WHEN
The system processes the ULC request and checks the train list for the specified train
THEN
The system verifies train existence in GCWTL-TRAIN-LIST and sets appropriate validation flags
Context: A ULC disposition code is being processed for a specific train
GIVEN
A ULC disposition code is being processed for a specific train
Applied to: Generate Train Not Found Error Message
WHEN
The train lookup validation fails and the train is not found in the system
THEN
The system generates a train not found error message and stops ULC processing without updating any train status
Context: A valid ULC disposition code is being processed and the train exists in the system
GIVEN
A valid ULC disposition code is being processed and the train exists in the system
Applied to: Update Train Status to Unlocked
WHEN
The unlock operation is executed
THEN
The system updates the train status records to reflect unlocked state
Context: A train unlock operation has been successfully processed
GIVEN
A train unlock operation has been successfully processed
Applied to: Log Train Unlock Activity
WHEN
The train status is updated to unlocked
THEN
The system creates a log entry recording the train unlock activity with timestamp and relevant details
Context: A train unlock operation is being processed
GIVEN
A train unlock operation is being processed
Applied to: Check for VID Equipment Segments
WHEN
The system examines the message segments for VID equipment information
THEN
The system identifies whether VID segments are present and sets appropriate processing flags
Context: VID equipment segments are present in the ULC message
GIVEN
VID equipment segments are present in the ULC message
Applied to: Process Individual Equipment Unlock
WHEN
The system processes individual equipment unlock operations
THEN
The system iterates through each VID segment and processes unlock operations for the specified equipment
Context: Individual equipment unlock processing is being performed for VID segments
GIVEN
Individual equipment unlock processing is being performed for VID segments
Applied to: Update Equipment Status to Unlocked
WHEN
Each equipment item is processed for unlock
THEN
The system updates the equipment records to reflect unlocked status for each specified equipment item
Context: Train unlock operations have been successfully completed including any individual equipment processing
GIVEN
Train unlock operations have been successfully completed including any individual equipment processing
Applied to: Generate Train Unlock Confirmation
WHEN
All unlock processing is finished
THEN
The system generates a confirmation message indicating successful train unlock completion
Context: Train unlock confirmation has been generated
GIVEN
Train unlock confirmation has been generated
Applied to: Send Notification Messages
WHEN
The system processes notification distribution
THEN
The system sends unlock notification messages to relevant parties and connected systems
R-GCX016-cbl-00187 (+14) File: GCX016.cbl Train Seizure Operations Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Seizure Operations':
  • Context - a v9 segment with sei disposition code is received for train seizure:
    For Validate Train Exists in System:
    When the system validates the train against the train list using vessel name, then the system determines if the train exists and sets appropriate processing flags.
  • Context - a train seizure request is being processed:
    For Generate Train Not Found Error Message:
    When the train is not found in the system train list, then the system generates a train not found error message and terminates seizure processing.
  • Context - a valid train exists in the system:
    For Process SEI Train Seizure Code:
    When the v9 segment contains sei disposition code, then the system initiates train seizure processing and prepares for equipment seizure operations.
  • Context - train seizure processing has been initiated:
    For Initialize Equipment Seizure Counter:
    When the system begins processing equipment seizure operations, then the system initializes equipment seizure counter to zero.
  • Context - train seizure processing is active:
    For VID Segments Follow?:
    When the system checks for following vid segments in the message, then the system determines whether to process individual equipment seizure or proceed with train-level seizure.
  • Context - vid segments are present following the sei disposition code:
    For Process VID Segment for Equipment Seizure:
    When the system processes each vid segment, then the system marks the specific equipment identified in the vid segment as seized.
  • Context - a vid segment identifies specific equipment for seizure:
    For Mark Specific Equipment as Seized:
    When the system processes the equipment seizure request, then the system updates the equipment status to seized in the equipment records.
  • Context - an equipment item has been marked as seized:
    For Increment Equipment Seizure Count:
    When the seizure operation is completed for the equipment, then the system increments the equipment seizure counter by one.
  • Context - one vid segment has been processed for equipment seizure:
    For More VID Segments?:
    When the system checks for additional vid segments in the message, then the system either continues processing more vid segments or proceeds to train status update.
  • Context - equipment seizure operations have been completed:
    For All Equipment Seized?:
    When the system evaluates the seizure status of all equipment on the train, then the system determines whether the train is fully seized or partially seized.
  • Context - all equipment on the train has been seized:
    For Set Train Status to Fully Seized:
    When the system updates the train seizure status, then the system sets the train status to fully seized.
  • Context - only some equipment on the train has been seized:
    For Set Train Status to Partially Seized:
    When the system updates the train seizure status, then the system sets the train status to partially seized.
  • Context - train seizure status has been updated:
    For Log Train Seizure Operation:
    When the system completes the seizure operation, then the system logs the train seizure operation with seizure details and timestamp.
  • Context - train seizure operation has been logged:
    For Generate Seizure Notification Message:
    When the system prepares stakeholder notifications, then the system generates seizure notification message with train and equipment details.
  • Context - seizure notification message has been generated:
    For Update Train Record in Database:
    When the system persists the seizure operation results, then the system updates the train record in the database with the new seizure status and related information.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with SEI disposition code is received for train seizure
GIVEN
A V9 segment with SEI disposition code is received for train seizure
Applied to: Validate Train Exists in System
WHEN
The system validates the train against the train list using vessel name
THEN
The system determines if the train exists and sets appropriate processing flags
Context: A train seizure request is being processed
GIVEN
A train seizure request is being processed
Applied to: Generate Train Not Found Error Message
WHEN
The train is not found in the system train list
THEN
The system generates a train not found error message and terminates seizure processing
Context: A valid train exists in the system
GIVEN
A valid train exists in the system
Applied to: Process SEI Train Seizure Code
WHEN
The V9 segment contains SEI disposition code
THEN
The system initiates train seizure processing and prepares for equipment seizure operations
Context: Train seizure processing has been initiated
GIVEN
Train seizure processing has been initiated
Applied to: Initialize Equipment Seizure Counter
WHEN
The system begins processing equipment seizure operations
THEN
The system initializes equipment seizure counter to zero
Context: Train seizure processing is active
GIVEN
Train seizure processing is active
Applied to: VID Segments Follow?
WHEN
The system checks for following VID segments in the message
THEN
The system determines whether to process individual equipment seizure or proceed with train-level seizure
Context: VID segments are present following the SEI disposition code
GIVEN
VID segments are present following the SEI disposition code
Applied to: Process VID Segment for Equipment Seizure
WHEN
The system processes each VID segment
THEN
The system marks the specific equipment identified in the VID segment as seized
Context: A VID segment identifies specific equipment for seizure
GIVEN
A VID segment identifies specific equipment for seizure
Applied to: Mark Specific Equipment as Seized
WHEN
The system processes the equipment seizure request
THEN
The system updates the equipment status to seized in the equipment records
Context: An equipment item has been marked as seized
GIVEN
An equipment item has been marked as seized
Applied to: Increment Equipment Seizure Count
WHEN
The seizure operation is completed for the equipment
THEN
The system increments the equipment seizure counter by one
Context: One VID segment has been processed for equipment seizure
GIVEN
One VID segment has been processed for equipment seizure
Applied to: More VID Segments?
WHEN
The system checks for additional VID segments in the message
THEN
The system either continues processing more VID segments or proceeds to train status update
Context: Equipment seizure operations have been completed
GIVEN
Equipment seizure operations have been completed
Applied to: All Equipment Seized?
WHEN
The system evaluates the seizure status of all equipment on the train
THEN
The system determines whether the train is fully seized or partially seized
Context: All equipment on the train has been seized
GIVEN
All equipment on the train has been seized
Applied to: Set Train Status to Fully Seized
WHEN
The system updates the train seizure status
THEN
The system sets the train status to fully seized
Context: Only some equipment on the train has been seized
GIVEN
Only some equipment on the train has been seized
Applied to: Set Train Status to Partially Seized
WHEN
The system updates the train seizure status
THEN
The system sets the train status to partially seized
Context: Train seizure status has been updated
GIVEN
Train seizure status has been updated
Applied to: Log Train Seizure Operation
WHEN
The system completes the seizure operation
THEN
The system logs the train seizure operation with seizure details and timestamp
Context: Train seizure operation has been logged
GIVEN
Train seizure operation has been logged
Applied to: Generate Seizure Notification Message
WHEN
The system prepares stakeholder notifications
THEN
The system generates seizure notification message with train and equipment details
Context: Seizure notification message has been generated
GIVEN
Seizure notification message has been generated
Applied to: Update Train Record in Database
WHEN
The system persists the seizure operation results
THEN
The system updates the train record in the database with the new seizure status and related information
R-GCX016-cbl-00202 (+8) File: GCX016.cbl Train Seizure Release Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Seizure Release':
  • Context - a v9 segment with ser disposition code is received for a train:
    For Validate Train Exists in System:
    When the system attempts to validate the train exists in the train list, then the system checks the train list database and sets train found or not found status.
  • Context - a train seizure release is being processed:
    For Generate Train Not Found Error Message:
    When the train is not found in the system, then the system generates a train not found error message and stops processing.
    For Check for Following VID Segments:
    When the system checks for vid segments following the v9 segment, then the system identifies whether vid segments are present for individual equipment processing.
  • Context - a v9 segment contains ser disposition code and train exists in system:
    For Process SER - Train Seizure Release:
    When the system processes the ser disposition code, then the system initiates train seizure release processing.
  • Context - vid segments are present following a ser disposition code:
    For Process Each VID Segment for Equipment Release:
    When the system processes each vid segment, then the system releases the specified equipment from seizure and decrements the seized equipment count.
  • Context - individual equipment has been processed for seizure release:
    For Update Train Seizure Status:
    When the system evaluates if any equipment is still seized on the train, then if equipment remains seized, the train stays in seized status; otherwise, the entire train is released from seizure.
  • Context - train seizure status has been determined:
    For Update Train Status in Database:
    When the system updates the train status, then the train status is updated in the database to reflect the current seizure state.
  • Context - train status has been updated in the database:
    For Generate Train Seizure Release Notification:
    When the system completes seizure release processing, then the system generates a train seizure release notification message.
  • Context - train seizure release notification has been generated:
    For Log Train Seizure Release Activity:
    When the system completes the seizure release process, then the system logs the train seizure release activity with relevant details.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment with SER disposition code is received for a train
GIVEN
A V9 segment with SER disposition code is received for a train
Applied to: Validate Train Exists in System
WHEN
The system attempts to validate the train exists in the train list
THEN
The system checks the train list database and sets train found or not found status
Context: A train seizure release is being processed
GIVEN
A train seizure release is being processed
Applied to: Generate Train Not Found Error Message
WHEN
The train is not found in the system
THEN
The system generates a train not found error message and stops processing
Applied to: Check for Following VID Segments
WHEN
The system checks for VID segments following the V9 segment
THEN
The system identifies whether VID segments are present for individual equipment processing
Context: A V9 segment contains SER disposition code and train exists in system
GIVEN
A V9 segment contains SER disposition code and train exists in system
Applied to: Process SER - Train Seizure Release
WHEN
The system processes the SER disposition code
THEN
The system initiates train seizure release processing
Context: VID segments are present following a SER disposition code
GIVEN
VID segments are present following a SER disposition code
Applied to: Process Each VID Segment for Equipment Release
WHEN
The system processes each VID segment
THEN
The system releases the specified equipment from seizure and decrements the seized equipment count
Context: Individual equipment has been processed for seizure release
GIVEN
Individual equipment has been processed for seizure release
Applied to: Update Train Seizure Status
WHEN
The system evaluates if any equipment is still seized on the train
THEN
If equipment remains seized, the train stays in seized status; otherwise, the entire train is released from seizure
Context: Train seizure status has been determined
GIVEN
Train seizure status has been determined
Applied to: Update Train Status in Database
WHEN
The system updates the train status
THEN
The train status is updated in the database to reflect the current seizure state
Context: Train status has been updated in the database
GIVEN
Train status has been updated in the database
Applied to: Generate Train Seizure Release Notification
WHEN
The system completes seizure release processing
THEN
The system generates a train seizure release notification message
Context: Train seizure release notification has been generated
GIVEN
Train seizure release notification has been generated
Applied to: Log Train Seizure Release Activity
WHEN
The system completes the seizure release process
THEN
The system logs the train seizure release activity with relevant details
R-GCX016-cbl-00268 (+9) File: GCX016.cbl Remarks Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Remarks Processing':
  • Context - a k1 segment is received for processing:
    For Processing Context?:
    When the system evaluates the current processing context, then the system routes k1 remarks to either train-level processing or cargo-level processing based on the active context.
  • Context - a k1 segment contains remarks and the processing context is train-level:
    For 178:K1 Remarks Processing for Train Operations:
    When the system processes the k1 segment for train operations, then the system extracts the remarks from k1 segment and associates them with the current train record and logs the comments with train identification information.
  • Context - a k1 segment contains remarks and the processing context is cargo-level:
    For 179:K1 Remarks Processing for Cargo Operations:
    When the system processes the k1 segment for cargo operations, then the system extracts the remarks from k1 segment and stores the remarks in the associated cargo record and makes the remarks available for cargo-related messaging.
  • Context - k1 comments are being added to the comment array:
    For Maximum 4 Comments Reached?:
    When the system checks if the maximum limit of 4 comments has been reached, then if the comment array has fewer than 4 comments then the system adds the new k1 comment to the array else the system skips additional comments beyond the 4-comment limit.
  • Context - a k1 comment needs to be stored and the comment array has not reached the maximum limit of 4 comments:
    For Add K1 Comment to Array:
    When the system processes the k1 comment for storage, then the system adds the k1 comment to the next available position in the comment array and increments the comment counter.
  • Context - a k1 comment needs to be stored and the comment array has already reached the maximum limit of 4 comments:
    For Skip Additional Comments:
    When the system attempts to process additional k1 comments, then the system skips the additional k1 comments without adding them to the array and continues processing without error.
  • Context - k1 comments have been processed and stored in the comment array:
    For 106:K1 Comment Integration:
    When the system prepares messages for external communication, then the system retrieves all stored k1 comments from the array and integrates them into the appropriate message formats and makes them available for inclusion in merlin messages, release messages, and broker notifications.
  • Context - k1 comments are available in the comment array and a merlin message is being prepared:
    For Include Comments in Merlin Messages:
    When the system formats the merlin message, then the system includes all available k1 comments in the merlin message and formats them appropriately for merlin message standards.
  • Context - k1 comments are available in the comment array and a release message is being prepared:
    For Include Comments in Release Messages:
    When the system formats the release message, then the system includes all available k1 comments in the release message and ensures comments are properly formatted for release message recipients.
  • Context - k1 comments are available in the comment array and a broker notification is being prepared:
    For Include Comments in Broker Notifications:
    When the system formats the broker notification, then the system includes all available k1 comments in the broker notification and ensures comments are formatted appropriately for broker communication standards.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 segment is received for processing
GIVEN
A K1 segment is received for processing
Applied to: Processing Context?
WHEN
The system evaluates the current processing context
THEN
The system routes K1 remarks to either train-level processing or cargo-level processing based on the active context
Context: A K1 segment contains remarks AND the processing context is train-level
GIVEN
A K1 segment contains remarks AND the processing context is train-level
Applied to: 178:K1 Remarks Processing for Train Operations
WHEN
The system processes the K1 segment for train operations
THEN
The system extracts the remarks from K1 segment AND associates them with the current train record AND logs the comments with train identification information
Context: A K1 segment contains remarks AND the processing context is cargo-level
GIVEN
A K1 segment contains remarks AND the processing context is cargo-level
Applied to: 179:K1 Remarks Processing for Cargo Operations
WHEN
The system processes the K1 segment for cargo operations
THEN
The system extracts the remarks from K1 segment AND stores the remarks in the associated cargo record AND makes the remarks available for cargo-related messaging
Context: K1 comments are being added to the comment array
GIVEN
K1 comments are being added to the comment array
Applied to: Maximum 4 Comments Reached?
WHEN
The system checks if the maximum limit of 4 comments has been reached
THEN
IF the comment array has fewer than 4 comments THEN the system adds the new K1 comment to the array ELSE the system skips additional comments beyond the 4-comment limit
Context: A K1 comment needs to be stored AND the comment array has not reached the maximum limit of 4 comments
GIVEN
A K1 comment needs to be stored AND the comment array has not reached the maximum limit of 4 comments
Applied to: Add K1 Comment to Array
WHEN
The system processes the K1 comment for storage
THEN
The system adds the K1 comment to the next available position in the comment array AND increments the comment counter
Context: A K1 comment needs to be stored AND the comment array has already reached the maximum limit of 4 comments
GIVEN
A K1 comment needs to be stored AND the comment array has already reached the maximum limit of 4 comments
Applied to: Skip Additional Comments
WHEN
The system attempts to process additional K1 comments
THEN
The system skips the additional K1 comments without adding them to the array AND continues processing without error
Context: K1 comments have been processed and stored in the comment array
GIVEN
K1 comments have been processed and stored in the comment array
Applied to: 106:K1 Comment Integration
WHEN
The system prepares messages for external communication
THEN
The system retrieves all stored K1 comments from the array AND integrates them into the appropriate message formats AND makes them available for inclusion in Merlin messages, release messages, and broker notifications
Context: K1 comments are available in the comment array AND a Merlin message is being prepared
GIVEN
K1 comments are available in the comment array AND a Merlin message is being prepared
Applied to: Include Comments in Merlin Messages
WHEN
The system formats the Merlin message
THEN
The system includes all available K1 comments in the Merlin message AND formats them appropriately for Merlin message standards
Context: K1 comments are available in the comment array AND a release message is being prepared
GIVEN
K1 comments are available in the comment array AND a release message is being prepared
Applied to: Include Comments in Release Messages
WHEN
The system formats the release message
THEN
The system includes all available K1 comments in the release message AND ensures comments are properly formatted for release message recipients
Context: K1 comments are available in the comment array AND a broker notification is being prepared
GIVEN
K1 comments are available in the comment array AND a broker notification is being prepared
Applied to: Include Comments in Broker Notifications
WHEN
The system formats the broker notification
THEN
The system includes all available K1 comments in the broker notification AND ensures comments are formatted appropriately for broker communication standards
R-GCX016-cbl-00278 (+18) File: GCX016.cbl Customs Release Information Processing Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customs Release Information Processing':
  • Context - an x4 segment is received for processing:
    For X4 Segment Valid?:
    When the system validates the x4 segment structure and required fields, then the segment is accepted for processing if valid, otherwise an error is generated.
  • Context - a valid x4 segment is available for processing:
    For Extract Customs Release Information:
    When the system processes the x4 segment, then all customs release information including disposition code, entry number, release quantity, bond number, car id, and waybill are extracted and stored.
  • Context - an x4 segment with extracted customs release information:
    For Bond Number Present?:
    When the system checks for the presence of a bond number, then if bond number is present, process all cargo with the same bond number; otherwise check for car id and waybill combination.
  • Context - an x4 segment without a bond number:
    For Car ID and Waybill Present?:
    When the system checks for car id and waybill information, then if both car id and waybill are present, process cargo by car/waybill combination; otherwise process using us-ccn directly.
  • Context - processing method determined (bond, car/waybill, or us-ccn):
    For Cargo Found?:
    When the system searches for existing cargo records using the appropriate key, then if cargo is found, proceed with disposition processing; if not found, create new foreign bill record or generate error.
  • Context - no existing cargo record found for the processing key:
    For Create New Foreign Bill Record:
    When the system determines a new record is needed, then a new foreign bill record is created with information from the x4 segment and default status values.
  • Context - a disposition code extracted from the x4 segment:
    For Valid Disposition Code?:
    When the system validates the disposition code against the dc table, then if the disposition code is valid and authorized, proceed with processing; otherwise generate an error.
  • Context - a valid disposition code and existing or new cargo record:
    For Update Status Array with Disposition:
    When the system processes the disposition code, then the status array is updated with the disposition code, location information, quantities, and processing flags.
  • Context - a disposition code that requires fda processing (a1 or a3):
    For Process FDA Requirements:
    When the system identifies fda requirements, then fda notifications are generated and special fda hold status is applied to the cargo.
  • Context - a disposition code requiring in-bond processing:
    For Process In-Bond Entry Types:
    When the system processes entry types (61-immediate transport, 62-transport export, 63-immediate export, 69-us-canada-us, 00-border processing), then appropriate in-bond processing is applied based on the entry type with correct bond dates and destination handling.
  • Context - a disposition code that creates master in-bond entries (1j, 69, 55):
    For Process Master In-Bond Entries:
    When the system processes the master in-bond requirement, then master in-bond flag is set, appropriate entry type processing is applied, and broker information is processed from k1 segments.
  • Context - a disposition code 95 (proceed) is being processed:
    For Clear Bond Information for DC 95:
    When the system applies dc 95 processing, then existing bond information is cleared and proceed status is set with appropriate border arrival date.
  • Context - a processed disposition code with quantity information:
    For Update Cargo Release Quantities:
    When the system updates release quantities, then release quantities are added or subtracted based on disposition action, with validation to prevent negative values.
  • Context - updated cargo with disposition processing completed:
    For Release Conditions Met?:
    When the system evaluates release conditions, then if release quantity equals or exceeds total quantity and no holds exist, release conditions are met; otherwise hold processing is required.
  • Context - cargo that meets release conditions:
    For Generate Release Notification:
    When the system processes the release, then release notifications are sent to brokers and merlin system with cargo details, quantities, and release information.
  • Context - cargo that does not meet release conditions:
    For Hold Required?:
    When the system evaluates hold requirements, then if disposition code or cargo conditions require hold, hold processing is initiated; otherwise cargo status is updated without hold.
  • Context - cargo that requires hold status:
    For Generate Hold Notification:
    When the system applies hold processing, then hold notifications are sent to brokers and merlin system with hold reason, location, and cargo details.
  • Context - completed disposition processing with all notifications sent:
    For Update Cargo Status:
    When the system finalizes cargo status, then cargo status is updated to reflect current condition (released, held, proceed, etc.) and database records are updated.
  • Context - completed x4 segment processing:
    For Log Processing Information:
    When the system logs processing information, then all status changes, notifications sent, and processing actions are logged to gcx105 system for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is received for processing
GIVEN
An X4 segment is received for processing
Applied to: X4 Segment Valid?
WHEN
The system validates the X4 segment structure and required fields
THEN
The segment is accepted for processing if valid, otherwise an error is generated
Context: A valid X4 segment is available for processing
GIVEN
A valid X4 segment is available for processing
Applied to: Extract Customs Release Information
WHEN
The system processes the X4 segment
THEN
All customs release information including disposition code, entry number, release quantity, bond number, car ID, and waybill are extracted and stored
Context: An X4 segment with extracted customs release information
GIVEN
An X4 segment with extracted customs release information
Applied to: Bond Number Present?
WHEN
The system checks for the presence of a bond number
THEN
If bond number is present, process all cargo with the same bond number; otherwise check for car ID and waybill combination
Context: An X4 segment without a bond number
GIVEN
An X4 segment without a bond number
Applied to: Car ID and Waybill Present?
WHEN
The system checks for car ID and waybill information
THEN
If both car ID and waybill are present, process cargo by car/waybill combination; otherwise process using US-CCN directly
Context: Processing method determined (bond, car/waybill, or US-CCN)
GIVEN
Processing method determined (bond, car/waybill, or US-CCN)
Applied to: Cargo Found?
WHEN
The system searches for existing cargo records using the appropriate key
THEN
If cargo is found, proceed with disposition processing; if not found, create new foreign bill record or generate error
Context: No existing cargo record found for the processing key
GIVEN
No existing cargo record found for the processing key
Applied to: Create New Foreign Bill Record
WHEN
The system determines a new record is needed
THEN
A new foreign bill record is created with information from the X4 segment and default status values
Context: A disposition code extracted from the X4 segment
GIVEN
A disposition code extracted from the X4 segment
Applied to: Valid Disposition Code?
WHEN
The system validates the disposition code against the DC table
THEN
If the disposition code is valid and authorized, proceed with processing; otherwise generate an error
Context: A valid disposition code and existing or new cargo record
GIVEN
A valid disposition code and existing or new cargo record
Applied to: Update Status Array with Disposition
WHEN
The system processes the disposition code
THEN
The status array is updated with the disposition code, location information, quantities, and processing flags
Context: A disposition code that requires FDA processing (A1 or A3)
GIVEN
A disposition code that requires FDA processing (A1 or A3)
Applied to: Process FDA Requirements
WHEN
The system identifies FDA requirements
THEN
FDA notifications are generated and special FDA hold status is applied to the cargo
Context: A disposition code requiring in-bond processing
GIVEN
A disposition code requiring in-bond processing
Applied to: Process In-Bond Entry Types
WHEN
The system processes entry types (61-Immediate Transport, 62-Transport Export, 63-Immediate Export, 69-US-Canada-US, 00-Border Processing)
THEN
Appropriate in-bond processing is applied based on the entry type with correct bond dates and destination handling
Context: A disposition code that creates master in-bond entries (1J, 69, 55)
GIVEN
A disposition code that creates master in-bond entries (1J, 69, 55)
Applied to: Process Master In-Bond Entries
WHEN
The system processes the master in-bond requirement
THEN
Master in-bond flag is set, appropriate entry type processing is applied, and broker information is processed from K1 segments
Context: A disposition code 95 (Proceed) is being processed
GIVEN
A disposition code 95 (Proceed) is being processed
Applied to: Clear Bond Information for DC 95
WHEN
The system applies DC 95 processing
THEN
Existing bond information is cleared and proceed status is set with appropriate border arrival date
Context: A processed disposition code with quantity information
GIVEN
A processed disposition code with quantity information
Applied to: Update Cargo Release Quantities
WHEN
The system updates release quantities
THEN
Release quantities are added or subtracted based on disposition action, with validation to prevent negative values
Context: Updated cargo with disposition processing completed
GIVEN
Updated cargo with disposition processing completed
Applied to: Release Conditions Met?
WHEN
The system evaluates release conditions
THEN
If release quantity equals or exceeds total quantity and no holds exist, release conditions are met; otherwise hold processing is required
Context: Cargo that meets release conditions
GIVEN
Cargo that meets release conditions
Applied to: Generate Release Notification
WHEN
The system processes the release
THEN
Release notifications are sent to brokers and Merlin system with cargo details, quantities, and release information
Context: Cargo that does not meet release conditions
GIVEN
Cargo that does not meet release conditions
Applied to: Hold Required?
WHEN
The system evaluates hold requirements
THEN
If disposition code or cargo conditions require hold, hold processing is initiated; otherwise cargo status is updated without hold
Context: Cargo that requires hold status
GIVEN
Cargo that requires hold status
Applied to: Generate Hold Notification
WHEN
The system applies hold processing
THEN
Hold notifications are sent to brokers and Merlin system with hold reason, location, and cargo details
Context: Completed disposition processing with all notifications sent
GIVEN
Completed disposition processing with all notifications sent
Applied to: Update Cargo Status
WHEN
The system finalizes cargo status
THEN
Cargo status is updated to reflect current condition (released, held, proceed, etc.) and database records are updated
Context: Completed X4 segment processing
GIVEN
Completed X4 segment processing
Applied to: Log Processing Information
WHEN
The system logs processing information
THEN
All status changes, notifications sent, and processing actions are logged to GCX105 system for audit trail
R-GCX016-cbl-00297 (+12) File: GCX016.cbl Equipment Details Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Details Processing':
  • Context - an n7 equipment details segment is received:
    For Extract Equipment ID from N7 Segment:
    When the system processes the n7 segment, then equipment id information is extracted and stored for cargo record updates.
  • Context - raw equipment id data is extracted from n7 segment:
    For Format Equipment ID using GCCCARFM Utility:
    When the system applies gcccarfm formatting utility, then equipment id is formatted according to standard format rules and validated for correctness.
  • Context - equipment id has been formatted using gcccarfm utility:
    For Equipment ID Valid?:
    When the system validates the equipment id, then equipment id is accepted if valid or rejected if invalid with appropriate error handling.
  • Context - a valid equipment id is available:
    For Locate Cargo Records by Car ID:
    When the system searches for cargo records using the car id, then all cargo records associated with the car id are located and retrieved.
  • Context - system has searched for cargo records by car id:
    For Cargo Records Found?:
    When the search results are evaluated, then system determines if cargo records exist and proceeds with appropriate processing path.
  • Context - cargo records are found for the car id and n7 segment contains valid equipment data:
    For Update Car ID Information in Cargo Records:
    When the system processes the car id update, then car id information is updated in all associated cargo records with equipment details from n7 segment.
  • Context - car id information has been updated in cargo records:
    For Validate Equipment Type for Integration:
    When the system validates the equipment type, then equipment type is verified against integration requirements and appropriate processing path is determined.
  • Context - equipment type has been validated:
    For KCSM Integration Required?:
    When the system evaluates kcsm integration requirements, then system determines if kcsm integration is required and routes processing accordingly.
  • Context - kcsm integration is required:
    For Extract Equipment Details for KCSM:
    When the system extracts equipment details, then relevant equipment information is extracted and prepared for kcsm integration.
  • Context - equipment details have been processed and validated:
    For Update Equipment Information in Cargo Database:
    When the system updates the cargo database, then equipment information is permanently stored in the cargo database with all relevant details.
  • Context - equipment information has been updated in the database:
    For Log Equipment Processing Activity:
    When the system completes equipment processing, then all equipment processing activities are logged with appropriate details for audit trail.
  • Context - equipment id validation has failed:
    For Generate Equipment Validation Error:
    When the system processes the validation failure, then an equipment validation error is generated with appropriate error details and processing continues.
  • Context - no cargo records are found for the car id:
    For Log Cargo Not Found Warning:
    When the system processes the cargo search failure, then a cargo not found warning is logged and processing continues to next segment.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 equipment details segment is received
GIVEN
An N7 equipment details segment is received
Applied to: Extract Equipment ID from N7 Segment
WHEN
The system processes the N7 segment
THEN
Equipment ID information is extracted and stored for cargo record updates
Context: Raw equipment ID data is extracted from N7 segment
GIVEN
Raw equipment ID data is extracted from N7 segment
Applied to: Format Equipment ID using GCCCARFM Utility
WHEN
The system applies GCCCARFM formatting utility
THEN
Equipment ID is formatted according to standard format rules and validated for correctness
Context: Equipment ID has been formatted using GCCCARFM utility
GIVEN
Equipment ID has been formatted using GCCCARFM utility
Applied to: Equipment ID Valid?
WHEN
The system validates the equipment ID
THEN
Equipment ID is accepted if valid or rejected if invalid with appropriate error handling
Context: A valid equipment ID is available
GIVEN
A valid equipment ID is available
Applied to: Locate Cargo Records by Car ID
WHEN
The system searches for cargo records using the car ID
THEN
All cargo records associated with the car ID are located and retrieved
Context: System has searched for cargo records by car ID
GIVEN
System has searched for cargo records by car ID
Applied to: Cargo Records Found?
WHEN
The search results are evaluated
THEN
System determines if cargo records exist and proceeds with appropriate processing path
Context: Cargo records are found for the car ID and N7 segment contains valid equipment data
GIVEN
Cargo records are found for the car ID and N7 segment contains valid equipment data
Applied to: Update Car ID Information in Cargo Records
WHEN
The system processes the car ID update
THEN
Car ID information is updated in all associated cargo records with equipment details from N7 segment
Context: Car ID information has been updated in cargo records
GIVEN
Car ID information has been updated in cargo records
Applied to: Validate Equipment Type for Integration
WHEN
The system validates the equipment type
THEN
Equipment type is verified against integration requirements and appropriate processing path is determined
Context: Equipment type has been validated
GIVEN
Equipment type has been validated
Applied to: KCSM Integration Required?
WHEN
The system evaluates KCSM integration requirements
THEN
System determines if KCSM integration is required and routes processing accordingly
Context: KCSM integration is required
GIVEN
KCSM integration is required
Applied to: Extract Equipment Details for KCSM
WHEN
The system extracts equipment details
THEN
Relevant equipment information is extracted and prepared for KCSM integration
Context: Equipment details have been processed and validated
GIVEN
Equipment details have been processed and validated
Applied to: Update Equipment Information in Cargo Database
WHEN
The system updates the cargo database
THEN
Equipment information is permanently stored in the cargo database with all relevant details
Context: Equipment information has been updated in the database
GIVEN
Equipment information has been updated in the database
Applied to: Log Equipment Processing Activity
WHEN
The system completes equipment processing
THEN
All equipment processing activities are logged with appropriate details for audit trail
Context: Equipment ID validation has failed
GIVEN
Equipment ID validation has failed
Applied to: Generate Equipment Validation Error
WHEN
The system processes the validation failure
THEN
An equipment validation error is generated with appropriate error details and processing continues
Context: No cargo records are found for the car ID
GIVEN
No cargo records are found for the car ID
Applied to: Log Cargo Not Found Warning
WHEN
The system processes the cargo search failure
THEN
A cargo not found warning is logged and processing continues to next segment
R-GCX016-cbl-00310 (+12) File: GCX016.cbl Transaction Set Trailer Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transaction Set Trailer Processing':
  • Context - a message segment is being processed:
    For SE Segment Detected:
    When the segment type is identified as 'se', then the system initiates se segment processing for transaction set completion.
  • Context - an se segment has been detected:
    For Validate SE Segment Structure:
    When the system validates the segment structure, then the segment must contain transaction set control number and segment count in valid format.
  • Context - se segment structure has been validated:
    For Valid SE Segment?:
    When the validation results are evaluated, then if segment is valid, proceed to extract control data, otherwise generate validation error.
  • Context - a valid se segment is being processed:
    For Extract Transaction Set Control Number:
    When the system extracts the transaction set control number, then the control number is captured for comparison with the corresponding st segment.
  • Context - transaction set control number has been extracted:
    For Extract Number of Included Segments:
    When the system extracts the segment count from se segment, then the segment count is captured for validation against actual processed segments.
  • Context - se segment control number has been extracted:
    For Control Number Matches ST Segment?:
    When the control number is compared with the st segment control number, then if numbers match, proceed to segment count validation, otherwise log control number mismatch error.
  • Context - control numbers match between st and se segments:
    For Segment Count Matches Actual?:
    When the declared segment count is compared with actual processed segments, then if counts match, mark transaction set complete, otherwise log segment count mismatch error.
  • Context - all se segment validations have passed:
    For Mark Transaction Set as Complete:
    When the system marks the transaction set as complete, then the transaction set status is updated to indicate successful completion.
  • Context - transaction set has been marked as complete:
    For Update Transaction Set Status:
    When the system updates the transaction set status, then the status reflects successful processing and completion of the transaction set.
  • Context - current transaction set status has been updated:
    For Prepare for Next Transaction Set:
    When the system prepares for next transaction set, then processing flags and counters are reset for the next transaction set.
  • Context - se segment fails structural validation:
    For Generate SE Validation Error:
    When the system generates a validation error, then an error message is created indicating se segment validation failure.
  • Context - se control number does not match st control number:
    For Log Control Number Mismatch:
    When the system logs the control number mismatch, then an error is recorded indicating control number inconsistency between st and se segments.
  • Context - declared segment count does not match actual processed segments:
    For Log Segment Count Mismatch:
    When the system logs the segment count mismatch, then an error is recorded indicating inconsistency between declared and actual segment counts.
👨‍💻 Technical ACs (Gherkin)
Context: A message segment is being processed
GIVEN
A message segment is being processed
Applied to: SE Segment Detected
WHEN
The segment type is identified as 'SE'
THEN
The system initiates SE segment processing for transaction set completion
Context: An SE segment has been detected
GIVEN
An SE segment has been detected
Applied to: Validate SE Segment Structure
WHEN
The system validates the segment structure
THEN
The segment must contain transaction set control number and segment count in valid format
Context: SE segment structure has been validated
GIVEN
SE segment structure has been validated
Applied to: Valid SE Segment?
WHEN
The validation results are evaluated
THEN
If segment is valid, proceed to extract control data, otherwise generate validation error
Context: A valid SE segment is being processed
GIVEN
A valid SE segment is being processed
Applied to: Extract Transaction Set Control Number
WHEN
The system extracts the transaction set control number
THEN
The control number is captured for comparison with the corresponding ST segment
Context: Transaction set control number has been extracted
GIVEN
Transaction set control number has been extracted
Applied to: Extract Number of Included Segments
WHEN
The system extracts the segment count from SE segment
THEN
The segment count is captured for validation against actual processed segments
Context: SE segment control number has been extracted
GIVEN
SE segment control number has been extracted
Applied to: Control Number Matches ST Segment?
WHEN
The control number is compared with the ST segment control number
THEN
If numbers match, proceed to segment count validation, otherwise log control number mismatch error
Context: Control numbers match between ST and SE segments
GIVEN
Control numbers match between ST and SE segments
Applied to: Segment Count Matches Actual?
WHEN
The declared segment count is compared with actual processed segments
THEN
If counts match, mark transaction set complete, otherwise log segment count mismatch error
Context: All SE segment validations have passed
GIVEN
All SE segment validations have passed
Applied to: Mark Transaction Set as Complete
WHEN
The system marks the transaction set as complete
THEN
The transaction set status is updated to indicate successful completion
Context: Transaction set has been marked as complete
GIVEN
Transaction set has been marked as complete
Applied to: Update Transaction Set Status
WHEN
The system updates the transaction set status
THEN
The status reflects successful processing and completion of the transaction set
Context: Current transaction set status has been updated
GIVEN
Current transaction set status has been updated
Applied to: Prepare for Next Transaction Set
WHEN
The system prepares for next transaction set
THEN
Processing flags and counters are reset for the next transaction set
Context: SE segment fails structural validation
GIVEN
SE segment fails structural validation
Applied to: Generate SE Validation Error
WHEN
The system generates a validation error
THEN
An error message is created indicating SE segment validation failure
Context: SE control number does not match ST control number
GIVEN
SE control number does not match ST control number
Applied to: Log Control Number Mismatch
WHEN
The system logs the control number mismatch
THEN
An error is recorded indicating control number inconsistency between ST and SE segments
Context: Declared segment count does not match actual processed segments
GIVEN
Declared segment count does not match actual processed segments
Applied to: Log Segment Count Mismatch
WHEN
The system logs the segment count mismatch
THEN
An error is recorded indicating inconsistency between declared and actual segment counts
R-GCX016-cbl-00361 (+4) File: GCX016.cbl Disposition Code Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Validation':
  • Context - a disposition code is received from x4 segment:
    For Call B561-GET-DC-TABLE-INFO:
    When the system needs to validate the disposition code, then the system calls b561-get-dc-table-info to retrieve disposition code details from gcstbrt ims segment.
  • Context - a disposition code lookup has been performed against the dc table:
    For Disposition Code Found?:
    When the system checks if the disposition code was found in the table, then if disposition code is found, system proceeds to extract code details; if not found, system sets invalid disposition code flag and generates error.
  • Context - a disposition code has been found in the dc table:
    For Retrieve Disposition Code Details:
    When the system processes the valid disposition code, then the system extracts code description, counterpart code information, quantity action flag, processing instructions, and sets valid disposition code flag.
  • Context - a disposition code lookup has failed to find the code in the dc table:
    For Set Invalid Disposition Code Flag:
    When the system determines the disposition code is invalid, then the system sets invalid disposition code flag, generates error message, logs disposition code error, and continues processing with error status.
  • Context - a valid disposition code record has been retrieved from the dc table:
    For Extract Code Description:
    When the system processes the disposition code details, then the system extracts code description, counterpart code information, quantity action flag, and processing instructions for subsequent cargo processing.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received from X4 segment
GIVEN
A disposition code is received from X4 segment
Applied to: Call B561-GET-DC-TABLE-INFO
WHEN
The system needs to validate the disposition code
THEN
The system calls B561-GET-DC-TABLE-INFO to retrieve disposition code details from GCSTBRT IMS segment
Context: A disposition code lookup has been performed against the DC table
GIVEN
A disposition code lookup has been performed against the DC table
Applied to: Disposition Code Found?
WHEN
The system checks if the disposition code was found in the table
THEN
If disposition code is found, system proceeds to extract code details; if not found, system sets invalid disposition code flag and generates error
Context: A disposition code has been found in the DC table
GIVEN
A disposition code has been found in the DC table
Applied to: Retrieve Disposition Code Details
WHEN
The system processes the valid disposition code
THEN
The system extracts code description, counterpart code information, quantity action flag, processing instructions, and sets valid disposition code flag
Context: A disposition code lookup has failed to find the code in the DC table
GIVEN
A disposition code lookup has failed to find the code in the DC table
Applied to: Set Invalid Disposition Code Flag
WHEN
The system determines the disposition code is invalid
THEN
The system sets invalid disposition code flag, generates error message, logs disposition code error, and continues processing with error status
Context: A valid disposition code record has been retrieved from the DC table
GIVEN
A valid disposition code record has been retrieved from the DC table
Applied to: Extract Code Description
WHEN
The system processes the disposition code details
THEN
The system extracts code description, counterpart code information, quantity action flag, and processing instructions for subsequent cargo processing
R-GCX016-cbl-00366 (+18) File: GCX016.cbl Cargo Status Updates Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Updates':
  • Context - a cargo record exists without any s09 status segment:
    For Create New Status Array:
    When the system processes cargo status updates, then a new s09 segment is created with cargo ccn key and sequence '0001'.
  • Context - a cargo record has existing s09 status segments:
    For Load Existing Status Array:
    When the system processes cargo status updates, then all s09 sequences and occurrences are loaded into the status array for modification.
  • Context - status array contains existing disposition codes:
    For Analyze Current Status Codes:
    When the system analyzes current status, then flags are set for empty, held, released, ptt, export, and arrival conditions based on status codes.
  • Context - a hold disposition code is received for cargo:
    For Process Hold Code:
    When the disposition code type is identified as hold, then the hold code is added to status array and any existing counterpart release codes are removed.
  • Context - a release disposition code is received for cargo:
    For Process Release Code:
    When the disposition code type is identified as release, then the release code is added to status array, counterpart hold codes are removed, and release quantities are updated.
  • Context - an arrival disposition code is received for cargo:
    For Process Arrival Code:
    When the disposition code type is identified as arrival, then arrival status is set and arrival date is updated in the cargo record.
  • Context - an export disposition code is received for cargo:
    For Process Export Code:
    When the disposition code type is identified as export, then export status is set and destination index is cleared from the cargo record.
  • Context - a cancellation disposition code is received for cargo:
    For Process Cancellation Code:
    When the disposition code type is identified as cancellation, then previous status changes are reversed and previous bond dates are restored.
  • Context - a hold disposition code specifies border location:
    For Set Border Hold Status:
    When location determination identifies border as hold location, then border hold status is set in cargo record.
  • Context - a hold disposition code specifies destination location:
    For Set Destination Hold Status:
    When location determination identifies destination as hold location, then destination hold status is set in cargo record.
  • Context - a hold disposition code affects both border and destination locations:
    For Set Both Locations Hold:
    When location determination identifies both locations for hold, then hold status is set for both border and destination in cargo record.
  • Context - a release disposition code contains quantity information:
    For Calculate Release Quantities:
    When release quantities need to be updated, then quantities are added or subtracted from existing release quantity with minimum value of zero.
  • Context - cargo has updated release quantities:
    For Clear All Holds:
    When release quantity is greater than or equal to total quantity, then all hold statuses are cleared and cargo is marked as fully released.
    For Set Partial Release Status:
    When release quantity is less than total quantity, then partial release status (holdpcs) is set in cargo record.
  • Context - cargo arrival status is being updated:
    For Set Arrival Date:
    When arrival disposition code is processed, then current date and time are set as arrival date in cargo record.
  • Context - cargo is being exported or fully released:
    For Clear Destination Index:
    When export status is set or full release is achieved, then destination index information is cleared from cargo record.
  • Context - a cancellation disposition code is processed:
    For Restore Previous Bond Date:
    When previous status changes need to be reversed, then previous bond date is restored in cargo record.
  • Context - status array has been updated with new disposition codes:
    For Update Cargo Record Status:
    When all disposition code processing is complete, then cargo record status fields are updated with new status information.
  • Context - status array contains updated disposition codes:
    For Save Status Array to Database:
    When all status processing is complete, then updated status array is saved back to s09 segments in database.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists without any S09 status segment
GIVEN
A cargo record exists without any S09 status segment
Applied to: Create New Status Array
WHEN
The system processes cargo status updates
THEN
A new S09 segment is created with cargo CCN key and sequence '0001'
Context: A cargo record has existing S09 status segments
GIVEN
A cargo record has existing S09 status segments
Applied to: Load Existing Status Array
WHEN
The system processes cargo status updates
THEN
All S09 sequences and occurrences are loaded into the status array for modification
Context: Status array contains existing disposition codes
GIVEN
Status array contains existing disposition codes
Applied to: Analyze Current Status Codes
WHEN
The system analyzes current status
THEN
Flags are set for empty, held, released, PTT, export, and arrival conditions based on status codes
Context: A hold disposition code is received for cargo
GIVEN
A hold disposition code is received for cargo
Applied to: Process Hold Code
WHEN
The disposition code type is identified as hold
THEN
The hold code is added to status array and any existing counterpart release codes are removed
Context: A release disposition code is received for cargo
GIVEN
A release disposition code is received for cargo
Applied to: Process Release Code
WHEN
The disposition code type is identified as release
THEN
The release code is added to status array, counterpart hold codes are removed, and release quantities are updated
Context: An arrival disposition code is received for cargo
GIVEN
An arrival disposition code is received for cargo
Applied to: Process Arrival Code
WHEN
The disposition code type is identified as arrival
THEN
Arrival status is set and arrival date is updated in the cargo record
Context: An export disposition code is received for cargo
GIVEN
An export disposition code is received for cargo
Applied to: Process Export Code
WHEN
The disposition code type is identified as export
THEN
Export status is set and destination index is cleared from the cargo record
Context: A cancellation disposition code is received for cargo
GIVEN
A cancellation disposition code is received for cargo
Applied to: Process Cancellation Code
WHEN
The disposition code type is identified as cancellation
THEN
Previous status changes are reversed and previous bond dates are restored
Context: A hold disposition code specifies border location
GIVEN
A hold disposition code specifies border location
Applied to: Set Border Hold Status
WHEN
Location determination identifies border as hold location
THEN
Border hold status is set in cargo record
Context: A hold disposition code specifies destination location
GIVEN
A hold disposition code specifies destination location
Applied to: Set Destination Hold Status
WHEN
Location determination identifies destination as hold location
THEN
Destination hold status is set in cargo record
Context: A hold disposition code affects both border and destination locations
GIVEN
A hold disposition code affects both border and destination locations
Applied to: Set Both Locations Hold
WHEN
Location determination identifies both locations for hold
THEN
Hold status is set for both border and destination in cargo record
Context: A release disposition code contains quantity information
GIVEN
A release disposition code contains quantity information
Applied to: Calculate Release Quantities
WHEN
Release quantities need to be updated
THEN
Quantities are added or subtracted from existing release quantity with minimum value of zero
Context: Cargo has updated release quantities
GIVEN
Cargo has updated release quantities
Applied to: Clear All Holds
WHEN
Release quantity is greater than or equal to total quantity
THEN
All hold statuses are cleared and cargo is marked as fully released
Applied to: Set Partial Release Status
WHEN
Release quantity is less than total quantity
THEN
Partial release status (HOLDPCS) is set in cargo record
Context: Cargo arrival status is being updated
GIVEN
Cargo arrival status is being updated
Applied to: Set Arrival Date
WHEN
Arrival disposition code is processed
THEN
Current date and time are set as arrival date in cargo record
Context: Cargo is being exported or fully released
GIVEN
Cargo is being exported or fully released
Applied to: Clear Destination Index
WHEN
Export status is set or full release is achieved
THEN
Destination index information is cleared from cargo record
Context: A cancellation disposition code is processed
GIVEN
A cancellation disposition code is processed
Applied to: Restore Previous Bond Date
WHEN
Previous status changes need to be reversed
THEN
Previous bond date is restored in cargo record
Context: Status array has been updated with new disposition codes
GIVEN
Status array has been updated with new disposition codes
Applied to: Update Cargo Record Status
WHEN
All disposition code processing is complete
THEN
Cargo record status fields are updated with new status information
Context: Status array contains updated disposition codes
GIVEN
Status array contains updated disposition codes
Applied to: Save Status Array to Database
WHEN
All status processing is complete
THEN
Updated status array is saved back to S09 segments in database
R-GCX016-cbl-00385 (+16) File: GCX016.cbl Quantity Management Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Quantity Management':
  • Context - a disposition code is being processed for cargo:
    For Disposition Code Has Quantity Action?:
    When the system checks if the disposition code has quantity action requirements, then the system should proceed to quantity management if action is required, otherwise skip quantity processing.
  • Context - a cargo record requires quantity processing:
    For Get Current Cargo Quantities:
    When the system needs to access current quantity information, then the system should retrieve both total cargo quantity and current released quantity from the cargo record.
  • Context - a disposition code contains quantity information:
    For Get Disposition Code Quantity:
    When the system processes the disposition code, then the system should extract and validate the quantity value from the disposition code.
  • Context - a disposition code has been validated to contain quantity action:
    For Quantity Action Type?:
    When the system evaluates the disposition code action type, then the system should determine if the action is add_quantity or subtract_quantity based on the disposition code type.
  • Context - the disposition code action type is add_quantity and current released quantity exists:
    For Add Quantity to Released Amount:
    When the system processes the quantity addition, then the system should add the disposition code quantity to the current released quantity.
  • Context - the disposition code action type is subtract_quantity and current released quantity exists:
    For Subtract Quantity from Released Amount:
    When the system processes the quantity subtraction, then the system should subtract the disposition code quantity from the current released quantity.
  • Context - a quantity operation has been performed on released quantity:
    For Released Quantity Valid?:
    When the system validates the resulting released quantity, then the system should check if the released quantity is negative and flag invalid results.
  • Context - the calculated released quantity is negative:
    For Set Released Quantity to Zero:
    When the system applies quantity correction rules, then the system should set the released quantity to zero to prevent negative values.
  • Context - a valid released quantity has been calculated:
    For Update Cargo Released Quantity:
    When the system updates the cargo record, then the system should store the new released quantity in the cargo record.
  • Context - cargo has updated released quantity and known total quantity:
    For Released = Total Quantity?:
    When the system evaluates release completion status, then the system should determine if released quantity equals or exceeds total quantity for full release status.
  • Context - cargo released quantity equals or exceeds total quantity:
    For Mark Cargo as Fully Released:
    When the system assigns release status, then the system should mark the cargo as fully released and update appropriate status flags.
  • Context - cargo released quantity is less than total quantity:
    For Mark Cargo as Partially Released:
    When the system assigns release status, then the system should mark the cargo as partially released and maintain hold status for remaining quantity.
  • Context - cargo has total quantity and released quantity values:
    For Calculate Remaining Held Quantity:
    When the system calculates remaining held quantity, then the system should compute held quantity as total quantity minus released quantity.
  • Context - cargo has calculated total, released, and held quantities:
    For Update Cargo Status Based on Quantities:
    When the system updates cargo status, then the system should set appropriate cargo status codes based on quantity relationships and release completion.
  • Context - cargo has processed quantities and broker entry contains quantity information:
    For Quantity Mismatch with Broker Entry?:
    When the system compares cargo quantities with broker entry quantities, then the system should identify mismatches between cargo quantities and broker declared quantities.
  • Context - a quantity mismatch has been detected between cargo and broker entry:
    For Generate Broker Notification for Mismatch:
    When the system processes broker notifications, then the system should generate and send a quantity mismatch notification to the appropriate broker.
  • Context - quantity changes have been processed for cargo:
    For Log Quantity Changes:
    When the system completes quantity management operations, then the system should log all quantity changes, status updates, and related transaction details for audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo
GIVEN
A disposition code is being processed for cargo
Applied to: Disposition Code Has Quantity Action?
WHEN
The system checks if the disposition code has quantity action requirements
THEN
The system should proceed to quantity management if action is required, otherwise skip quantity processing
Context: A cargo record requires quantity processing
GIVEN
A cargo record requires quantity processing
Applied to: Get Current Cargo Quantities
WHEN
The system needs to access current quantity information
THEN
The system should retrieve both total cargo quantity and current released quantity from the cargo record
Context: A disposition code contains quantity information
GIVEN
A disposition code contains quantity information
Applied to: Get Disposition Code Quantity
WHEN
The system processes the disposition code
THEN
The system should extract and validate the quantity value from the disposition code
Context: A disposition code has been validated to contain quantity action
GIVEN
A disposition code has been validated to contain quantity action
Applied to: Quantity Action Type?
WHEN
The system evaluates the disposition code action type
THEN
The system should determine if the action is ADD_QUANTITY or SUBTRACT_QUANTITY based on the disposition code type
Context: The disposition code action type is ADD_QUANTITY and current released quantity exists
GIVEN
The disposition code action type is ADD_QUANTITY and current released quantity exists
Applied to: Add Quantity to Released Amount
WHEN
The system processes the quantity addition
THEN
The system should add the disposition code quantity to the current released quantity
Context: The disposition code action type is SUBTRACT_QUANTITY and current released quantity exists
GIVEN
The disposition code action type is SUBTRACT_QUANTITY and current released quantity exists
Applied to: Subtract Quantity from Released Amount
WHEN
The system processes the quantity subtraction
THEN
The system should subtract the disposition code quantity from the current released quantity
Context: A quantity operation has been performed on released quantity
GIVEN
A quantity operation has been performed on released quantity
Applied to: Released Quantity Valid?
WHEN
The system validates the resulting released quantity
THEN
The system should check if the released quantity is negative and flag invalid results
Context: The calculated released quantity is negative
GIVEN
The calculated released quantity is negative
Applied to: Set Released Quantity to Zero
WHEN
The system applies quantity correction rules
THEN
The system should set the released quantity to zero to prevent negative values
Context: A valid released quantity has been calculated
GIVEN
A valid released quantity has been calculated
Applied to: Update Cargo Released Quantity
WHEN
The system updates the cargo record
THEN
The system should store the new released quantity in the cargo record
Context: Cargo has updated released quantity and known total quantity
GIVEN
Cargo has updated released quantity and known total quantity
Applied to: Released = Total Quantity?
WHEN
The system evaluates release completion status
THEN
The system should determine if released quantity equals or exceeds total quantity for full release status
Context: Cargo released quantity equals or exceeds total quantity
GIVEN
Cargo released quantity equals or exceeds total quantity
Applied to: Mark Cargo as Fully Released
WHEN
The system assigns release status
THEN
The system should mark the cargo as fully released and update appropriate status flags
Context: Cargo released quantity is less than total quantity
GIVEN
Cargo released quantity is less than total quantity
Applied to: Mark Cargo as Partially Released
WHEN
The system assigns release status
THEN
The system should mark the cargo as partially released and maintain hold status for remaining quantity
Context: Cargo has total quantity and released quantity values
GIVEN
Cargo has total quantity and released quantity values
Applied to: Calculate Remaining Held Quantity
WHEN
The system calculates remaining held quantity
THEN
The system should compute held quantity as total quantity minus released quantity
Context: Cargo has calculated total, released, and held quantities
GIVEN
Cargo has calculated total, released, and held quantities
Applied to: Update Cargo Status Based on Quantities
WHEN
The system updates cargo status
THEN
The system should set appropriate cargo status codes based on quantity relationships and release completion
Context: Cargo has processed quantities and broker entry contains quantity information
GIVEN
Cargo has processed quantities and broker entry contains quantity information
Applied to: Quantity Mismatch with Broker Entry?
WHEN
The system compares cargo quantities with broker entry quantities
THEN
The system should identify mismatches between cargo quantities and broker declared quantities
Context: A quantity mismatch has been detected between cargo and broker entry
GIVEN
A quantity mismatch has been detected between cargo and broker entry
Applied to: Generate Broker Notification for Mismatch
WHEN
The system processes broker notifications
THEN
The system should generate and send a quantity mismatch notification to the appropriate broker
Context: Quantity changes have been processed for cargo
GIVEN
Quantity changes have been processed for cargo
Applied to: Log Quantity Changes
WHEN
The system completes quantity management operations
THEN
The system should log all quantity changes, status updates, and related transaction details for audit purposes
R-GCX016-cbl-00402 (+13) File: GCX016.cbl Broker Notification for Quantity Mismatch Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Notification for Quantity Mismatch':
  • Context - cargo processing is complete and broker entry quantities exist:
    For Compare Broker Entry Quantity vs Manifest Quantity:
    When system compares broker entry quantity against manifest quantity, then system identifies quantity mismatch and flags for broker notification.
  • Context - a quantity mismatch has been detected for cargo:
    For Retrieve Broker Information from BK/B1 Tables:
    When system needs to send broker notification, then system retrieves broker information from gcstbrt broker tables including contact details and notification configuration.
  • Context - broker information has been retrieved from broker tables:
    For Broker Configured for Notifications?:
    When system checks broker notification configuration settings, then system proceeds with notification only if broker is configured for notifications, otherwise skips notification process.
  • Context - broker is configured for notifications and quantity mismatch exists:
    For Validate Disposition Code for Broker Notifications:
    When system validates the disposition code against notification criteria, then system proceeds with notification preparation only if disposition code is valid for broker notifications.
  • Context - disposition code is valid for broker notifications:
    For Prepare Quantity Mismatch Email Message:
    When system prepares the notification message, then system creates formatted email message with quantity mismatch details, broker entry numbers, and relevant cargo information.
  • Context - email message preparation is in progress:
    For Include Broker Entry Numbers and Quantities:
    When system formats the message content, then system includes broker entry numbers, expected quantities, actual quantities, and variance details in the notification.
  • Context - broker entry numbers and quantities have been included in message:
    For Format Mismatch Details for Report:
    When system formats the mismatch details, then system creates structured report format showing discrepancies, affected cargo, and recommended actions for broker review.
  • Context - mismatch details have been formatted for report:
    For Email or Merlin Routing?:
    When system determines routing method, then system routes via internet email if broker is configured for email notifications, otherwise routes via traditional merlin messaging system.
  • Context - broker is configured for email notifications:
    For Route via Internet Email:
    When system routes the notification, then system sends notification through internet email system using broker's registered email address.
  • Context - broker is not configured for email notifications or email routing fails:
    For Route via Traditional Merlin:
    When system routes the notification, then system sends notification through traditional merlin messaging system using broker's merlin id.
  • Context - notification routing method has been determined:
    For Set Email Keywords for Categorization:
    When system sets email keywords, then system assigns relevant keywords such as 'quantity_mismatch', 'broker_notification', and cargo-specific identifiers for proper categorization.
  • Context - email keywords have been set for categorization:
    For Send Notification to Broker:
    When system sends the notification, then system delivers notification to broker through selected method and confirms successful transmission.
  • Context - notification has been sent to broker:
    For Log Notification Activity:
    When system logs the activity, then system records notification details including timestamp, broker id, notification method, message content summary, and delivery status in audit logs.
  • Context - broker is not configured for notifications or no quantity mismatch detected or disposition code is invalid for notifications:
    For No Notification Required:
    When system evaluates notification requirements, then system skips notification process and continues with normal cargo processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: Cargo processing is complete and broker entry quantities exist
GIVEN
Cargo processing is complete and broker entry quantities exist
Applied to: Compare Broker Entry Quantity vs Manifest Quantity
WHEN
System compares broker entry quantity against manifest quantity
THEN
System identifies quantity mismatch and flags for broker notification
Context: A quantity mismatch has been detected for cargo
GIVEN
A quantity mismatch has been detected for cargo
Applied to: Retrieve Broker Information from BK/B1 Tables
WHEN
System needs to send broker notification
THEN
System retrieves broker information from GCSTBRT broker tables including contact details and notification configuration
Context: Broker information has been retrieved from broker tables
GIVEN
Broker information has been retrieved from broker tables
Applied to: Broker Configured for Notifications?
WHEN
System checks broker notification configuration settings
THEN
System proceeds with notification only if broker is configured for notifications, otherwise skips notification process
Context: Broker is configured for notifications and quantity mismatch exists
GIVEN
Broker is configured for notifications and quantity mismatch exists
Applied to: Validate Disposition Code for Broker Notifications
WHEN
System validates the disposition code against notification criteria
THEN
System proceeds with notification preparation only if disposition code is valid for broker notifications
Context: Disposition code is valid for broker notifications
GIVEN
Disposition code is valid for broker notifications
Applied to: Prepare Quantity Mismatch Email Message
WHEN
System prepares the notification message
THEN
System creates formatted email message with quantity mismatch details, broker entry numbers, and relevant cargo information
Context: Email message preparation is in progress
GIVEN
Email message preparation is in progress
Applied to: Include Broker Entry Numbers and Quantities
WHEN
System formats the message content
THEN
System includes broker entry numbers, expected quantities, actual quantities, and variance details in the notification
Context: Broker entry numbers and quantities have been included in message
GIVEN
Broker entry numbers and quantities have been included in message
Applied to: Format Mismatch Details for Report
WHEN
System formats the mismatch details
THEN
System creates structured report format showing discrepancies, affected cargo, and recommended actions for broker review
Context: Mismatch details have been formatted for report
GIVEN
Mismatch details have been formatted for report
Applied to: Email or Merlin Routing?
WHEN
System determines routing method
THEN
System routes via internet email if broker is configured for email notifications, otherwise routes via traditional Merlin messaging system
Context: Broker is configured for email notifications
GIVEN
Broker is configured for email notifications
Applied to: Route via Internet Email
WHEN
System routes the notification
THEN
System sends notification through internet email system using broker's registered email address
Context: Broker is not configured for email notifications or email routing fails
GIVEN
Broker is not configured for email notifications or email routing fails
Applied to: Route via Traditional Merlin
WHEN
System routes the notification
THEN
System sends notification through traditional Merlin messaging system using broker's Merlin ID
Context: Notification routing method has been determined
GIVEN
Notification routing method has been determined
Applied to: Set Email Keywords for Categorization
WHEN
System sets email keywords
THEN
System assigns relevant keywords such as 'QUANTITY_MISMATCH', 'BROKER_NOTIFICATION', and cargo-specific identifiers for proper categorization
Context: Email keywords have been set for categorization
GIVEN
Email keywords have been set for categorization
Applied to: Send Notification to Broker
WHEN
System sends the notification
THEN
System delivers notification to broker through selected method and confirms successful transmission
Context: Notification has been sent to broker
GIVEN
Notification has been sent to broker
Applied to: Log Notification Activity
WHEN
System logs the activity
THEN
System records notification details including timestamp, broker ID, notification method, message content summary, and delivery status in audit logs
Context: Broker is not configured for notifications OR no quantity mismatch detected OR disposition code is invalid for notifications
GIVEN
Broker is not configured for notifications OR no quantity mismatch detected OR disposition code is invalid for notifications
Applied to: No Notification Required
WHEN
System evaluates notification requirements
THEN
System skips notification process and continues with normal cargo processing workflow
R-GCX016-cbl-00416 (+12) File: GCX016.cbl Broker Notification for CIH Holds Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Notification for CIH Holds':
  • Context - a cih hold code has been detected for cargo processing:
    For 112: Broker Disposition Code Validation:
    When the system checks the disposition code configuration in the broker notification table, then the system determines if the disposition code is configured for broker notification and sets appropriate processing flags.
    For Skip Notification - Not Configured:
    When the disposition code is not configured for broker notification in the system tables, then the system skips broker notification processing and continues with standard cargo processing.
  • Context - the disposition code is configured for broker notification:
    For 110: Broker Information Lookup:
    When the system performs broker lookup using broker identification keys, then the system retrieves broker contact information and sets broker found status flags.
    For Skip Notification - Broker Not Found:
    When the broker information cannot be found in the broker tables, then the system skips notification processing and logs the missing broker condition.
  • Context - a broker record has been found in the broker tables:
    For Retrieve Broker Contact Information:
    When the system accesses the broker contact information fields, then the system retrieves email addresses, merlin ids, and notification preferences for the broker.
  • Context - broker contact information has been retrieved successfully:
    For 111: Email vs Merlin Routing:
    When the system evaluates broker notification preferences and available contact methods, then the system selects either email or merlin messaging as the notification delivery method.
  • Context - email has been selected as the notification method for the broker:
    For Prepare CIH Hold Email Message:
    When the system prepares the cih hold notification email content, then the system formats cargo information, hold details, and disposition code information into the email message body.
  • Context - the cih hold email message content has been prepared:
    For Set Email Keywords for CIH Hold:
    When the system configures email routing and keyword parameters, then the system sets appropriate email keywords, routing codes, and delivery parameters specific to cih hold notifications.
  • Context - email keywords and routing parameters have been configured for cih hold notification:
    For 119: Subject Line Formatting:
    When the system formats the email subject line, then the system creates a subject line containing cargo identification, hold type, and relevant disposition code information.
  • Context - the cih hold email message and subject line have been formatted completely:
    For Send Email to Broker:
    When the system initiates email transmission to the broker, then the system sends the email notification and logs the transmission status.
  • Context - merlin messaging has been selected as the notification method for the broker:
    For Prepare Merlin Message for CIH Hold:
    When the system prepares the cih hold notification for merlin transmission, then the system formats cargo details, hold information, and disposition codes into merlin message format.
  • Context - the cih hold merlin message has been formatted and prepared:
    For Route to Broker Merlin Basket:
    When the system routes the message to the broker's merlin basket, then the system delivers the message to the correct broker merlin id and logs the routing status.
  • Context - the cih hold notification has been successfully sent via email or merlin:
    For 126: Cargo Information Logging:
    When the system performs audit logging for the notification transaction, then the system records cargo identification, broker information, notification method, and timestamp in the audit log.
👨‍💻 Technical ACs (Gherkin)
Context: A CIH hold code has been detected for cargo processing
GIVEN
A CIH hold code has been detected for cargo processing
Applied to: 112: Broker Disposition Code Validation
WHEN
The system checks the disposition code configuration in the broker notification table
THEN
The system determines if the disposition code is configured for broker notification and sets appropriate processing flags
Applied to: Skip Notification - Not Configured
WHEN
The disposition code is not configured for broker notification in the system tables
THEN
The system skips broker notification processing and continues with standard cargo processing
Context: The disposition code is configured for broker notification
GIVEN
The disposition code is configured for broker notification
Applied to: 110: Broker Information Lookup
WHEN
The system performs broker lookup using broker identification keys
THEN
The system retrieves broker contact information and sets broker found status flags
Applied to: Skip Notification - Broker Not Found
WHEN
The broker information cannot be found in the broker tables
THEN
The system skips notification processing and logs the missing broker condition
Context: A broker record has been found in the broker tables
GIVEN
A broker record has been found in the broker tables
Applied to: Retrieve Broker Contact Information
WHEN
The system accesses the broker contact information fields
THEN
The system retrieves email addresses, Merlin IDs, and notification preferences for the broker
Context: Broker contact information has been retrieved successfully
GIVEN
Broker contact information has been retrieved successfully
Applied to: 111: Email vs Merlin Routing
WHEN
The system evaluates broker notification preferences and available contact methods
THEN
The system selects either email or Merlin messaging as the notification delivery method
Context: Email has been selected as the notification method for the broker
GIVEN
Email has been selected as the notification method for the broker
Applied to: Prepare CIH Hold Email Message
WHEN
The system prepares the CIH hold notification email content
THEN
The system formats cargo information, hold details, and disposition code information into the email message body
Context: The CIH hold email message content has been prepared
GIVEN
The CIH hold email message content has been prepared
Applied to: Set Email Keywords for CIH Hold
WHEN
The system configures email routing and keyword parameters
THEN
The system sets appropriate email keywords, routing codes, and delivery parameters specific to CIH hold notifications
Context: Email keywords and routing parameters have been configured for CIH hold notification
GIVEN
Email keywords and routing parameters have been configured for CIH hold notification
Applied to: 119: Subject Line Formatting
WHEN
The system formats the email subject line
THEN
The system creates a subject line containing cargo identification, hold type, and relevant disposition code information
Context: The CIH hold email message and subject line have been formatted completely
GIVEN
The CIH hold email message and subject line have been formatted completely
Applied to: Send Email to Broker
WHEN
The system initiates email transmission to the broker
THEN
The system sends the email notification and logs the transmission status
Context: Merlin messaging has been selected as the notification method for the broker
GIVEN
Merlin messaging has been selected as the notification method for the broker
Applied to: Prepare Merlin Message for CIH Hold
WHEN
The system prepares the CIH hold notification for Merlin transmission
THEN
The system formats cargo details, hold information, and disposition codes into Merlin message format
Context: The CIH hold Merlin message has been formatted and prepared
GIVEN
The CIH hold Merlin message has been formatted and prepared
Applied to: Route to Broker Merlin Basket
WHEN
The system routes the message to the broker's Merlin basket
THEN
The system delivers the message to the correct broker Merlin ID and logs the routing status
Context: The CIH hold notification has been successfully sent via email or Merlin
GIVEN
The CIH hold notification has been successfully sent via email or Merlin
Applied to: 126: Cargo Information Logging
WHEN
The system performs audit logging for the notification transaction
THEN
The system records cargo identification, broker information, notification method, and timestamp in the audit log
R-GCX016-cbl-00429 (+9) File: GCX016.cbl Payer of Freight Notification Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Payer of Freight Notification':
  • Context - a cih hold code has been detected on cargo:
    For 97: Payer of Freight Identification:
    When the system searches for payer of freight information in secondary cargo records, then the system retrieves payer of freight details from gcsa2rt records if available.
  • Context - the system has searched secondary cargo records for payer of freight:
    For Payer of Freight Found?:
    When the search results are evaluated for valid payer entity, then the system proceeds with broker name resolution if payer found, otherwise skips notification processing.
  • Context - a valid payer of freight entity has been identified:
    For 98: Broker Name Resolution:
    When the system performs broker name lookup using pf= prefix in gcstbrt broker tables, then the system retrieves the corresponding broker short name for the payer entity.
  • Context - broker name resolution has been attempted for the payer of freight:
    For Valid Payer Entity?:
    When the system evaluates the validity of the resolved payer entity, then the system proceeds with cih hold notification preparation if valid, otherwise skips notification.
  • Context - a valid payer entity has been verified for cih hold notification:
    For Prepare CIH Hold Notification:
    When the system formats the notification message content including hold code details and cargo information, then the system creates a complete notification message ready for routing.
  • Context - a cih hold notification message has been prepared for the payer of freight:
    For 111: Email vs Merlin Routing:
    When the system checks email routing preferences in routing tables, then the system routes via internet email if preference available, otherwise uses traditional merlin routing.
  • Context - the system needs to route a cih hold notification to payer of freight:
    For Email Preference Available?:
    When the system checks email routing tables for configured preferences, then the system determines routing method based on preference availability.
  • Context - email preference is available for the payer of freight entity:
    For Route via Internet Email:
    When the system routes the cih hold notification, then the system sends the notification via internet email to the configured address.
  • Context - email preference is not available for the payer of freight entity:
    For Route via Traditional Merlin:
    When the system routes the cih hold notification, then the system sends the notification via traditional merlin messaging system.
  • Context - a routing method has been determined for the cih hold notification:
    For Send Notification to Payer:
    When the system sends the notification to the payer of freight, then the system delivers the notification and logs the successful transmission.
👨‍💻 Technical ACs (Gherkin)
Context: A CIH hold code has been detected on cargo
GIVEN
A CIH hold code has been detected on cargo
Applied to: 97: Payer of Freight Identification
WHEN
The system searches for payer of freight information in secondary cargo records
THEN
The system retrieves payer of freight details from GCSA2RT records if available
Context: The system has searched secondary cargo records for payer of freight
GIVEN
The system has searched secondary cargo records for payer of freight
Applied to: Payer of Freight Found?
WHEN
The search results are evaluated for valid payer entity
THEN
The system proceeds with broker name resolution if payer found, otherwise skips notification processing
Context: A valid payer of freight entity has been identified
GIVEN
A valid payer of freight entity has been identified
Applied to: 98: Broker Name Resolution
WHEN
The system performs broker name lookup using PF= prefix in GCSTBRT broker tables
THEN
The system retrieves the corresponding broker short name for the payer entity
Context: Broker name resolution has been attempted for the payer of freight
GIVEN
Broker name resolution has been attempted for the payer of freight
Applied to: Valid Payer Entity?
WHEN
The system evaluates the validity of the resolved payer entity
THEN
The system proceeds with CIH hold notification preparation if valid, otherwise skips notification
Context: A valid payer entity has been verified for CIH hold notification
GIVEN
A valid payer entity has been verified for CIH hold notification
Applied to: Prepare CIH Hold Notification
WHEN
The system formats the notification message content including hold code details and cargo information
THEN
The system creates a complete notification message ready for routing
Context: A CIH hold notification message has been prepared for the payer of freight
GIVEN
A CIH hold notification message has been prepared for the payer of freight
Applied to: 111: Email vs Merlin Routing
WHEN
The system checks email routing preferences in routing tables
THEN
The system routes via internet email if preference available, otherwise uses traditional Merlin routing
Context: The system needs to route a CIH hold notification to payer of freight
GIVEN
The system needs to route a CIH hold notification to payer of freight
Applied to: Email Preference Available?
WHEN
The system checks email routing tables for configured preferences
THEN
The system determines routing method based on preference availability
Context: Email preference is available for the payer of freight entity
GIVEN
Email preference is available for the payer of freight entity
Applied to: Route via Internet Email
WHEN
The system routes the CIH hold notification
THEN
The system sends the notification via internet email to the configured address
Context: Email preference is not available for the payer of freight entity
GIVEN
Email preference is not available for the payer of freight entity
Applied to: Route via Traditional Merlin
WHEN
The system routes the CIH hold notification
THEN
The system sends the notification via traditional Merlin messaging system
Context: A routing method has been determined for the CIH hold notification
GIVEN
A routing method has been determined for the CIH hold notification
Applied to: Send Notification to Payer
WHEN
The system sends the notification to the payer of freight
THEN
The system delivers the notification and logs the successful transmission
R-GCX016-cbl-00439 (+9) File: GCX016.cbl Diversion Approval Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Diversion Approval Processing':
  • Context - an x4 segment is received with a 3w disposition code:
    For Validate 3W Disposition Code in DC Table:
    When the system validates the 3w disposition code against the dc table, then the system confirms the code is valid and allows diversion processing to continue, or generates an error if the code is not found in the table.
    For Generate Error Message - Invalid 3W Code:
    When the 3w disposition code is not found in the dc table, then the system generates an error message indicating invalid 3w disposition code and stops diversion processing.
  • Context - a valid 3w disposition code has been confirmed in the dc table:
    For Extract New Bonded-To Station from X4 Segment:
    When the system processes the x4 segment data, then the system extracts the new bonded-to station code from the appropriate field in the x4 segment.
  • Context - a new bonded-to station code has been extracted from the x4 segment:
    For Validate New Station Code in DS Table:
    When the system validates the station code against the ds table, then the system confirms the station code is valid and allows the diversion to proceed, or generates an error if the station is not found.
  • Context - the new bonded-to station code has been validated in the ds table:
    For Update Cargo Record Bonded-To Station:
    When the system processes the diversion approval, then the system updates the cargo record's bonded-to station field with the new validated station code.
  • Context - the cargo record has been updated with the new bonded-to station:
    For Update Cargo Status Array with 3W Code:
    When the system processes the status update, then the system adds the 3w disposition code to the cargo status array with appropriate sequence and occurrence numbers.
  • Context - the cargo status array has been updated with the 3w code:
    For Log Diversion Approval Action:
    When the system completes the diversion processing, then the system logs the diversion approval action with cargo details, old station, new station, and timestamp.
  • Context - the diversion approval action has been logged:
    For Generate Diversion Approval Notification:
    When the system processes notifications, then the system generates and sends diversion approval notifications to brokers, carriers, and other relevant parties.
  • Context - diversion approval notifications have been generated:
    For Update Destination Index if Required:
    When the system evaluates if destination index update is required, then the system updates the destination index if the new bonded-to station requires it based on cargo status and routing rules.
  • Context - a new bonded-to station code has been extracted from x4 segment:
    For Generate Error Message - Invalid Station:
    When the station code is not found in the ds table, then the system generates an error message indicating invalid station code and stops diversion processing.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is received with a 3W disposition code
GIVEN
An X4 segment is received with a 3W disposition code
Applied to: Validate 3W Disposition Code in DC Table
WHEN
The system validates the 3W disposition code against the DC table
THEN
The system confirms the code is valid and allows diversion processing to continue, or generates an error if the code is not found in the table
Applied to: Generate Error Message - Invalid 3W Code
WHEN
The 3W disposition code is not found in the DC table
THEN
The system generates an error message indicating invalid 3W disposition code and stops diversion processing
Context: A valid 3W disposition code has been confirmed in the DC table
GIVEN
A valid 3W disposition code has been confirmed in the DC table
Applied to: Extract New Bonded-To Station from X4 Segment
WHEN
The system processes the X4 segment data
THEN
The system extracts the new bonded-to station code from the appropriate field in the X4 segment
Context: A new bonded-to station code has been extracted from the X4 segment
GIVEN
A new bonded-to station code has been extracted from the X4 segment
Applied to: Validate New Station Code in DS Table
WHEN
The system validates the station code against the DS table
THEN
The system confirms the station code is valid and allows the diversion to proceed, or generates an error if the station is not found
Context: The new bonded-to station code has been validated in the DS table
GIVEN
The new bonded-to station code has been validated in the DS table
Applied to: Update Cargo Record Bonded-To Station
WHEN
The system processes the diversion approval
THEN
The system updates the cargo record's bonded-to station field with the new validated station code
Context: The cargo record has been updated with the new bonded-to station
GIVEN
The cargo record has been updated with the new bonded-to station
Applied to: Update Cargo Status Array with 3W Code
WHEN
The system processes the status update
THEN
The system adds the 3W disposition code to the cargo status array with appropriate sequence and occurrence numbers
Context: The cargo status array has been updated with the 3W code
GIVEN
The cargo status array has been updated with the 3W code
Applied to: Log Diversion Approval Action
WHEN
The system completes the diversion processing
THEN
The system logs the diversion approval action with cargo details, old station, new station, and timestamp
Context: The diversion approval action has been logged
GIVEN
The diversion approval action has been logged
Applied to: Generate Diversion Approval Notification
WHEN
The system processes notifications
THEN
The system generates and sends diversion approval notifications to brokers, carriers, and other relevant parties
Context: Diversion approval notifications have been generated
GIVEN
Diversion approval notifications have been generated
Applied to: Update Destination Index if Required
WHEN
The system evaluates if destination index update is required
THEN
The system updates the destination index if the new bonded-to station requires it based on cargo status and routing rules
Context: A new bonded-to station code has been extracted from X4 segment
GIVEN
A new bonded-to station code has been extracted from X4 segment
Applied to: Generate Error Message - Invalid Station
WHEN
The station code is not found in the DS table
THEN
The system generates an error message indicating invalid station code and stops diversion processing
R-GCX016-cbl-00449 (+16) File: GCX016.cbl Standard Release Processing Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Standard Release Processing':
  • Context - a disposition code 02 is received for processing:
    For Validate Disposition Code 02 in DC Table:
    When the system looks up the disposition code in the dc table, then the system confirms the code exists and retrieves its properties, or generates an error if not found.
  • Context - a valid disposition code 02 is found in the dc table:
    For Retrieve Code Properties and Counterpart Information:
    When the system retrieves the code properties, then the system loads counterpart disposition codes, release flags, and processing instructions for the code.
  • Context - a disposition code 02 is being processed for a cargo record:
    For Check if Code Already Exists in Status Array:
    When the system searches the current status array for the same disposition code, then if the code already exists, processing is skipped; if not found, processing continues.
  • Context - a disposition code 02 has counterpart codes defined in the dc table:
    For Remove Any Counterpart Disposition Codes:
    When the system processes the new disposition code, then all counterpart disposition codes are removed from the cargo status array before adding the new code.
  • Context - a disposition code 02 includes entry number and quantity information:
    For Validate Entry Number and Quantity Information:
    When the system validates the entry data, then entry numbers must be properly formatted and quantities must be positive numeric values within cargo limits.
  • Context - a valid disposition code 02 with quantity information:
    For Calculate Release Quantity Impact:
    When the system calculates the quantity impact, then the system determines whether to add or subtract from existing release quantities based on the disposition code action.
  • Context - a validated disposition code 02 with calculated quantity impact:
    For Add Release Code to Status Array with Released Flag:
    When the system adds the code to the status array, then the code is added with released flag set to true and quantity information included.
  • Context - the status array has been updated with disposition code 02:
    For Analyze Updated Status Array for Cargo State:
    When the system analyzes the cargo state, then if released quantity equals or exceeds total quantity and no hold codes exist, cargo qualifies for full release.
  • Context - cargo meets all full release conditions:
    For Set Full Release Status:
    When the system processes the full release, then cargo status is set to fully released and destination index is cleared.
  • Context - released quantity is less than total cargo quantity:
    For Set Hold on Piece Counts Status:
    When the system processes the partial release, then cargo status is set to hold on piece counts and destination index is maintained.
  • Context - a disposition code 02 has been processed with quantity impact:
    For Update Released Quantity in Cargo Record:
    When the system updates the cargo record, then the released quantity field is updated to reflect the new release amount.
  • Context - a cargo record has been successfully processed for release:
    For Generate Release Message with Quantity Details:
    When the system generates the release message, then the message includes cargo identification, release quantities, and disposition code details.
  • Context - a cargo release has been processed and message generated:
    For Call Integration Services for Release Notification:
    When the system calls integration services, then external systems are notified of the cargo release status change.
  • Context - all release processing has been completed successfully:
    For Update Cargo Record in Database:
    When the system updates the database, then the cargo record is updated with new status, quantities, and disposition codes.
  • Context - a cargo release transaction has been completed:
    For Log Release Transaction for Audit Trail:
    When the system logs the transaction, then audit trail includes cargo id, disposition code, quantities, timestamps, and user information.
  • Context - a disposition code 02 cannot be found in the dc table:
    For Generate Error Message for Invalid Code:
    When the system processes the invalid code, then an error message is generated indicating the disposition code is not valid in the system.
  • Context - quantity information in disposition code 02 fails validation:
    For Generate Error Message for Quantity Mismatch:
    When the system detects the quantity mismatch, then an error message is generated indicating the quantity validation failure.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code 02 is received for processing
GIVEN
A disposition code 02 is received for processing
Applied to: Validate Disposition Code 02 in DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The system confirms the code exists and retrieves its properties, or generates an error if not found
Context: A valid disposition code 02 is found in the DC table
GIVEN
A valid disposition code 02 is found in the DC table
Applied to: Retrieve Code Properties and Counterpart Information
WHEN
The system retrieves the code properties
THEN
The system loads counterpart disposition codes, release flags, and processing instructions for the code
Context: A disposition code 02 is being processed for a cargo record
GIVEN
A disposition code 02 is being processed for a cargo record
Applied to: Check if Code Already Exists in Status Array
WHEN
The system searches the current status array for the same disposition code
THEN
If the code already exists, processing is skipped; if not found, processing continues
Context: A disposition code 02 has counterpart codes defined in the DC table
GIVEN
A disposition code 02 has counterpart codes defined in the DC table
Applied to: Remove Any Counterpart Disposition Codes
WHEN
The system processes the new disposition code
THEN
All counterpart disposition codes are removed from the cargo status array before adding the new code
Context: A disposition code 02 includes entry number and quantity information
GIVEN
A disposition code 02 includes entry number and quantity information
Applied to: Validate Entry Number and Quantity Information
WHEN
The system validates the entry data
THEN
Entry numbers must be properly formatted and quantities must be positive numeric values within cargo limits
Context: A valid disposition code 02 with quantity information
GIVEN
A valid disposition code 02 with quantity information
Applied to: Calculate Release Quantity Impact
WHEN
The system calculates the quantity impact
THEN
The system determines whether to add or subtract from existing release quantities based on the disposition code action
Context: A validated disposition code 02 with calculated quantity impact
GIVEN
A validated disposition code 02 with calculated quantity impact
Applied to: Add Release Code to Status Array with Released Flag
WHEN
The system adds the code to the status array
THEN
The code is added with released flag set to true and quantity information included
Context: The status array has been updated with disposition code 02
GIVEN
The status array has been updated with disposition code 02
Applied to: Analyze Updated Status Array for Cargo State
WHEN
The system analyzes the cargo state
THEN
If released quantity equals or exceeds total quantity and no hold codes exist, cargo qualifies for full release
Context: Cargo meets all full release conditions
GIVEN
Cargo meets all full release conditions
Applied to: Set Full Release Status
WHEN
The system processes the full release
THEN
Cargo status is set to fully released and destination index is cleared
Context: Released quantity is less than total cargo quantity
GIVEN
Released quantity is less than total cargo quantity
Applied to: Set Hold on Piece Counts Status
WHEN
The system processes the partial release
THEN
Cargo status is set to hold on piece counts and destination index is maintained
Context: A disposition code 02 has been processed with quantity impact
GIVEN
A disposition code 02 has been processed with quantity impact
Applied to: Update Released Quantity in Cargo Record
WHEN
The system updates the cargo record
THEN
The released quantity field is updated to reflect the new release amount
Context: A cargo record has been successfully processed for release
GIVEN
A cargo record has been successfully processed for release
Applied to: Generate Release Message with Quantity Details
WHEN
The system generates the release message
THEN
The message includes cargo identification, release quantities, and disposition code details
Context: A cargo release has been processed and message generated
GIVEN
A cargo release has been processed and message generated
Applied to: Call Integration Services for Release Notification
WHEN
The system calls integration services
THEN
External systems are notified of the cargo release status change
Context: All release processing has been completed successfully
GIVEN
All release processing has been completed successfully
Applied to: Update Cargo Record in Database
WHEN
The system updates the database
THEN
The cargo record is updated with new status, quantities, and disposition codes
Context: A cargo release transaction has been completed
GIVEN
A cargo release transaction has been completed
Applied to: Log Release Transaction for Audit Trail
WHEN
The system logs the transaction
THEN
Audit trail includes cargo ID, disposition code, quantities, timestamps, and user information
Context: A disposition code 02 cannot be found in the DC table
GIVEN
A disposition code 02 cannot be found in the DC table
Applied to: Generate Error Message for Invalid Code
WHEN
The system processes the invalid code
THEN
An error message is generated indicating the disposition code is not valid in the system
Context: Quantity information in disposition code 02 fails validation
GIVEN
Quantity information in disposition code 02 fails validation
Applied to: Generate Error Message for Quantity Mismatch
WHEN
The system detects the quantity mismatch
THEN
An error message is generated indicating the quantity validation failure
R-GCX016-cbl-00466 (+10) File: GCX016.cbl Various Release Code Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Various Release Code Processing':
  • Context - a disposition code 50, 51, or 52 is received for cargo release processing:
    For Validate Disposition Code:
    When the system looks up the disposition code in the dc table, then if the code is found, processing continues; if not found, an error message is generated and processing stops.
  • Context - a valid disposition code has been received for cargo release:
    For Check Train Status:
    When the system checks if the associated train exists in the system, then if train is not found, a train not found error is generated and processing stops; if found, release processing continues.
  • Context - a train exists and disposition code is valid:
    For Check Release Conditions:
    When the system validates cargo quantities and checks current hold status, then if release conditions are not met, the release request is rejected; if conditions are met, release processing proceeds.
  • Context - disposition code 50 is received and release conditions are validated:
    For Process Release Code 50:
    When the system processes the standard release request, then standard release processing is performed, status array is updated, and release quantities are calculated.
  • Context - disposition code 51 is received and release conditions are validated:
    For Process Release Code 51:
    When the system processes the conditional release request, then conditional release processing is performed with additional validation checks, status array is updated, and release quantities are calculated.
  • Context - disposition code 52 is received and release conditions are validated:
    For Process Release Code 52:
    When the system processes the special release request, then special release processing is performed with enhanced validation and handling, status array is updated, and release quantities are calculated.
  • Context - a release code has been processed and status array is updated:
    For Calculate Release Quantities:
    When the system calculates release quantities based on the disposition code action, then release quantities are calculated using add_quantity or subtract_quantity logic, ensuring quantities do not go below zero.
  • Context - release quantities have been calculated:
    For Remove Counterpart Codes:
    When the system processes counterpart codes in the status array, then counterpart disposition codes are removed from the status array to prevent conflicts with the new release status.
  • Context - release processing is complete and release flag is set:
    For Update Train Status:
    When the system updates the train status, then train status is updated to reflect the cargo release, and train movement restrictions may be lifted if all cargo is released.
  • Context - release message has been generated:
    For Call Integration Services:
    When the system calls integration services (gcciis), then external systems are notified of the cargo release for container/trailer equipment processing and customs clearance.
  • Context - release processing is complete (successful or rejected):
    For Log Transaction:
    When the system logs the transaction, then transaction details including disposition code, cargo information, and processing results are logged via gct1051e for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code 50, 51, or 52 is received for cargo release processing
GIVEN
A disposition code 50, 51, or 52 is received for cargo release processing
Applied to: Validate Disposition Code
WHEN
The system looks up the disposition code in the DC table
THEN
If the code is found, processing continues; if not found, an error message is generated and processing stops
Context: A valid disposition code has been received for cargo release
GIVEN
A valid disposition code has been received for cargo release
Applied to: Check Train Status
WHEN
The system checks if the associated train exists in the system
THEN
If train is not found, a train not found error is generated and processing stops; if found, release processing continues
Context: A train exists and disposition code is valid
GIVEN
A train exists and disposition code is valid
Applied to: Check Release Conditions
WHEN
The system validates cargo quantities and checks current hold status
THEN
If release conditions are not met, the release request is rejected; if conditions are met, release processing proceeds
Context: Disposition code 50 is received and release conditions are validated
GIVEN
Disposition code 50 is received and release conditions are validated
Applied to: Process Release Code 50
WHEN
The system processes the standard release request
THEN
Standard release processing is performed, status array is updated, and release quantities are calculated
Context: Disposition code 51 is received and release conditions are validated
GIVEN
Disposition code 51 is received and release conditions are validated
Applied to: Process Release Code 51
WHEN
The system processes the conditional release request
THEN
Conditional release processing is performed with additional validation checks, status array is updated, and release quantities are calculated
Context: Disposition code 52 is received and release conditions are validated
GIVEN
Disposition code 52 is received and release conditions are validated
Applied to: Process Release Code 52
WHEN
The system processes the special release request
THEN
Special release processing is performed with enhanced validation and handling, status array is updated, and release quantities are calculated
Context: A release code has been processed and status array is updated
GIVEN
A release code has been processed and status array is updated
Applied to: Calculate Release Quantities
WHEN
The system calculates release quantities based on the disposition code action
THEN
Release quantities are calculated using ADD_QUANTITY or SUBTRACT_QUANTITY logic, ensuring quantities do not go below zero
Context: Release quantities have been calculated
GIVEN
Release quantities have been calculated
Applied to: Remove Counterpart Codes
WHEN
The system processes counterpart codes in the status array
THEN
Counterpart disposition codes are removed from the status array to prevent conflicts with the new release status
Context: Release processing is complete and release flag is set
GIVEN
Release processing is complete and release flag is set
Applied to: Update Train Status
WHEN
The system updates the train status
THEN
Train status is updated to reflect the cargo release, and train movement restrictions may be lifted if all cargo is released
Context: Release message has been generated
GIVEN
Release message has been generated
Applied to: Call Integration Services
WHEN
The system calls integration services (GCCIIS)
THEN
External systems are notified of the cargo release for container/trailer equipment processing and customs clearance
Context: Release processing is complete (successful or rejected)
GIVEN
Release processing is complete (successful or rejected)
Applied to: Log Transaction
WHEN
The system logs the transaction
THEN
Transaction details including disposition code, cargo information, and processing results are logged via GCT1051E for audit trail
R-GCX016-cbl-00477 (+18) File: GCX016.cbl Hold/Examination Code Processing Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hold/Examination Code Processing':
  • Context - an x4 segment is received with a disposition code:
    For Disposition Code = 66, 67, or 68?:
    When the disposition code is evaluated for hold and examination processing, then the system should only process codes 66 (hold for examination), 67 (intensive examination), or 68 (x-ray examination) and skip all other codes.
  • Context - a valid disposition code (66, 67, or 68) has been identified:
    For Retrieve Disposition Code Details from DC Table:
    When the system needs to process the disposition code, then the system should retrieve the disposition code details from the dc table including code description and processing instructions.
  • Context - a disposition code needs to be applied to cargo:
    For Validate Cargo Record Exists:
    When the system searches for the cargo record using the ccn key from the x4 segment, then the system should verify that a valid cargo record exists and is not marked as deleted.
  • Context - a disposition code (66, 67, or 68) needs to be applied to cargo:
    For Generate Error Message - Cargo Not Found:
    When the cargo record cannot be found in the system, then the system should generate an error message indicating cargo not found, increment the error counter, and continue processing the next segment.
  • Context - a cargo record exists and a disposition code (66, 67, or 68) needs to be applied:
    For Code Already Exists?:
    When the system checks the cargo's status array for existing codes, then if the same disposition code already exists in the status array, the system should skip processing and continue to the next segment.
  • Context - a disposition code already exists in the cargo's status array:
    For Skip Duplicate Code Processing:
    When the same disposition code is received again for the same cargo, then the system should skip all processing for this code and continue to the next segment without making any changes.
  • Context - a valid disposition code (66, 67, or 68) needs to be applied to existing cargo:
    For Determine Hold Location - Border or Destination:
    When the system evaluates the cargo's current location and status, then the system should determine whether to apply the hold at the border location or destination location based on cargo movement status.
  • Context - disposition code 66 (hold for examination) is received for valid cargo:
    For Code 66 - Hold for Examination?:
    When the code is not a duplicate and cargo exists, then the system should set border hold status for standard examination requirements.
  • Context - disposition code 67 (intensive examination) is received for valid cargo:
    For Code 67 - Intensive Examination?:
    When the code is not a duplicate and cargo exists, then the system should set intensive examination hold status with enhanced security requirements.
  • Context - disposition code 68 (x-ray examination) is received for valid cargo:
    For Code 68 - X-Ray Examination?:
    When the code is not a duplicate and cargo exists, then the system should set x-ray examination hold status requiring imaging inspection.
  • Context - a disposition code 66 requires border examination:
    For Set Border Hold Status:
    When the hold location is determined to be at the border, then the system should set border hold status preventing cargo movement until examination is completed.
  • Context - a disposition code requires examination at destination:
    For Set Destination Hold Status:
    When the hold location is determined to be at the destination, then the system should set destination hold status allowing border movement but preventing final release until examination.
  • Context - disposition code 67 (intensive examination) is being processed:
    For Set Intensive Examination Hold:
    When the cargo requires intensive examination, then the system should set intensive examination hold status with enhanced security flags and inspection requirements.
  • Context - disposition code 68 (x-ray examination) is being processed:
    For Set X-Ray Examination Hold:
    When the cargo requires x-ray examination, then the system should set x-ray examination hold status requiring imaging inspection before release.
  • Context - a hold status has been determined for the cargo:
    For Add Hold Code to Status Array:
    When the disposition code needs to be recorded in the cargo status, then the system should add the hold code to the cargo's status array with appropriate sequence and occurrence numbers.
  • Context - a hold code has been added to the status array:
    For Update Cargo Hold Flags:
    When the cargo record needs to reflect the current hold status, then the system should update the cargo hold flags to indicate border hold, destination hold, or examination hold status as appropriate.
  • Context - a hold has been successfully applied to cargo:
    For Generate Hold Notification Message:
    When notification is required for the hold action, then the system should generate a hold notification message including cargo details, hold type, and location information.
  • Context - a hold notification message has been generated:
    For Call Integration Services for Hold Notification:
    When external systems need to be notified of the hold status, then the system should call integration services (gcciis) to notify equipment and other systems of the hold status.
  • Context - hold processing has been completed for cargo:
    For Log Hold Processing Activity:
    When activity logging is required for audit purposes, then the system should log the hold processing activity including disposition code, cargo details, and processing timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is received with a disposition code
GIVEN
An X4 segment is received with a disposition code
Applied to: Disposition Code = 66, 67, or 68?
WHEN
The disposition code is evaluated for hold and examination processing
THEN
The system should only process codes 66 (Hold for Examination), 67 (Intensive Examination), or 68 (X-Ray Examination) and skip all other codes
Context: A valid disposition code (66, 67, or 68) has been identified
GIVEN
A valid disposition code (66, 67, or 68) has been identified
Applied to: Retrieve Disposition Code Details from DC Table
WHEN
The system needs to process the disposition code
THEN
The system should retrieve the disposition code details from the DC table including code description and processing instructions
Context: A disposition code needs to be applied to cargo
GIVEN
A disposition code needs to be applied to cargo
Applied to: Validate Cargo Record Exists
WHEN
The system searches for the cargo record using the CCN key from the X4 segment
THEN
The system should verify that a valid cargo record exists and is not marked as deleted
Context: A disposition code (66, 67, or 68) needs to be applied to cargo
GIVEN
A disposition code (66, 67, or 68) needs to be applied to cargo
Applied to: Generate Error Message - Cargo Not Found
WHEN
The cargo record cannot be found in the system
THEN
The system should generate an error message indicating cargo not found, increment the error counter, and continue processing the next segment
Context: A cargo record exists and a disposition code (66, 67, or 68) needs to be applied
GIVEN
A cargo record exists and a disposition code (66, 67, or 68) needs to be applied
Applied to: Code Already Exists?
WHEN
The system checks the cargo's status array for existing codes
THEN
If the same disposition code already exists in the status array, the system should skip processing and continue to the next segment
Context: A disposition code already exists in the cargo's status array
GIVEN
A disposition code already exists in the cargo's status array
Applied to: Skip Duplicate Code Processing
WHEN
The same disposition code is received again for the same cargo
THEN
The system should skip all processing for this code and continue to the next segment without making any changes
Context: A valid disposition code (66, 67, or 68) needs to be applied to existing cargo
GIVEN
A valid disposition code (66, 67, or 68) needs to be applied to existing cargo
Applied to: Determine Hold Location - Border or Destination
WHEN
The system evaluates the cargo's current location and status
THEN
The system should determine whether to apply the hold at the border location or destination location based on cargo movement status
Context: Disposition code 66 (Hold for Examination) is received for valid cargo
GIVEN
Disposition code 66 (Hold for Examination) is received for valid cargo
Applied to: Code 66 - Hold for Examination?
WHEN
The code is not a duplicate and cargo exists
THEN
The system should set border hold status for standard examination requirements
Context: Disposition code 67 (Intensive Examination) is received for valid cargo
GIVEN
Disposition code 67 (Intensive Examination) is received for valid cargo
Applied to: Code 67 - Intensive Examination?
WHEN
The code is not a duplicate and cargo exists
THEN
The system should set intensive examination hold status with enhanced security requirements
Context: Disposition code 68 (X-Ray Examination) is received for valid cargo
GIVEN
Disposition code 68 (X-Ray Examination) is received for valid cargo
Applied to: Code 68 - X-Ray Examination?
WHEN
The code is not a duplicate and cargo exists
THEN
The system should set X-ray examination hold status requiring imaging inspection
Context: A disposition code 66 requires border examination
GIVEN
A disposition code 66 requires border examination
Applied to: Set Border Hold Status
WHEN
The hold location is determined to be at the border
THEN
The system should set border hold status preventing cargo movement until examination is completed
Context: A disposition code requires examination at destination
GIVEN
A disposition code requires examination at destination
Applied to: Set Destination Hold Status
WHEN
The hold location is determined to be at the destination
THEN
The system should set destination hold status allowing border movement but preventing final release until examination
Context: Disposition code 67 (Intensive Examination) is being processed
GIVEN
Disposition code 67 (Intensive Examination) is being processed
Applied to: Set Intensive Examination Hold
WHEN
The cargo requires intensive examination
THEN
The system should set intensive examination hold status with enhanced security flags and inspection requirements
Context: Disposition code 68 (X-Ray Examination) is being processed
GIVEN
Disposition code 68 (X-Ray Examination) is being processed
Applied to: Set X-Ray Examination Hold
WHEN
The cargo requires X-ray examination
THEN
The system should set X-ray examination hold status requiring imaging inspection before release
Context: A hold status has been determined for the cargo
GIVEN
A hold status has been determined for the cargo
Applied to: Add Hold Code to Status Array
WHEN
The disposition code needs to be recorded in the cargo status
THEN
The system should add the hold code to the cargo's status array with appropriate sequence and occurrence numbers
Context: A hold code has been added to the status array
GIVEN
A hold code has been added to the status array
Applied to: Update Cargo Hold Flags
WHEN
The cargo record needs to reflect the current hold status
THEN
The system should update the cargo hold flags to indicate border hold, destination hold, or examination hold status as appropriate
Context: A hold has been successfully applied to cargo
GIVEN
A hold has been successfully applied to cargo
Applied to: Generate Hold Notification Message
WHEN
Notification is required for the hold action
THEN
The system should generate a hold notification message including cargo details, hold type, and location information
Context: A hold notification message has been generated
GIVEN
A hold notification message has been generated
Applied to: Call Integration Services for Hold Notification
WHEN
External systems need to be notified of the hold status
THEN
The system should call integration services (GCCIIS) to notify equipment and other systems of the hold status
Context: Hold processing has been completed for cargo
GIVEN
Hold processing has been completed for cargo
Applied to: Log Hold Processing Activity
WHEN
Activity logging is required for audit purposes
THEN
The system should log the hold processing activity including disposition code, cargo details, and processing timestamp
R-GCX016-cbl-00496 (+8) File: GCX016.cbl New Disposition Code Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'New Disposition Code Processing':
  • Context - an x4 segment contains disposition code 88, 89, or 90:
    For 218: Disposition Code Table Lookup:
    When the system performs disposition code table lookup, then the system retrieves code properties and processing instructions from gcstbrt table.
  • Context - a disposition code 88, 89, or 90 is being processed:
    For Code Found in DC Table?:
    When the system checks the disposition code table, then if the code is found, processing continues with code properties; if not found, error handling is triggered.
  • Context - disposition code is validated as 88, 89, or 90:
    For Apply Special Processing Rules for 88/89/90:
    When the system processes the code type determination, then special processing rules are applied specific to new customs requirements including status updates and compliance checks.
  • Context - new customs requirement disposition code has been processed:
    For Update Cargo Status Array:
    When the system updates cargo status information, then the gcsuss09 status array is updated with the new customs requirement status and related information.
  • Context - cargo status array has been updated with new customs requirements:
    For 224: Status Array Analysis:
    When the system performs status array analysis, then the system determines compliance status, required notifications, and subsequent processing steps.
  • Context - new customs requirements have been processed and status analyzed:
    For Generate Customs Compliance Notifications:
    When the system determines notifications are required, then customs compliance notifications are generated and routed to appropriate parties including brokers and customs authorities.
  • Context - new customs requirements need external system integration:
    For 89: Integration Service Calls for New Requirements:
    When the system processes disposition codes 88, 89, or 90, then integration service calls are made to external systems for customs compliance processing.
  • Context - new customs requirements have been processed:
    For 126: Cargo Information Logging:
    When the system completes processing of disposition codes 88, 89, or 90, then cargo information and processing details are logged for audit trail and compliance tracking.
  • Context - a disposition code 88, 89, or 90 cannot be found in the system or fails validation:
    For 228: Disposition Code Error Handling:
    When the system encounters an error during processing, then error handling procedures are invoked including error logging, notification generation, and appropriate error status setting.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment contains disposition code 88, 89, or 90
GIVEN
An X4 segment contains disposition code 88, 89, or 90
Applied to: 218: Disposition Code Table Lookup
WHEN
The system performs disposition code table lookup
THEN
The system retrieves code properties and processing instructions from GCSTBRT table
Context: A disposition code 88, 89, or 90 is being processed
GIVEN
A disposition code 88, 89, or 90 is being processed
Applied to: Code Found in DC Table?
WHEN
The system checks the disposition code table
THEN
If the code is found, processing continues with code properties; if not found, error handling is triggered
Context: Disposition code is validated as 88, 89, or 90
GIVEN
Disposition code is validated as 88, 89, or 90
Applied to: Apply Special Processing Rules for 88/89/90
WHEN
The system processes the code type determination
THEN
Special processing rules are applied specific to new customs requirements including status updates and compliance checks
Context: New customs requirement disposition code has been processed
GIVEN
New customs requirement disposition code has been processed
Applied to: Update Cargo Status Array
WHEN
The system updates cargo status information
THEN
The GCSUSS09 status array is updated with the new customs requirement status and related information
Context: Cargo status array has been updated with new customs requirements
GIVEN
Cargo status array has been updated with new customs requirements
Applied to: 224: Status Array Analysis
WHEN
The system performs status array analysis
THEN
The system determines compliance status, required notifications, and subsequent processing steps
Context: New customs requirements have been processed and status analyzed
GIVEN
New customs requirements have been processed and status analyzed
Applied to: Generate Customs Compliance Notifications
WHEN
The system determines notifications are required
THEN
Customs compliance notifications are generated and routed to appropriate parties including brokers and customs authorities
Context: New customs requirements need external system integration
GIVEN
New customs requirements need external system integration
Applied to: 89: Integration Service Calls for New Requirements
WHEN
The system processes disposition codes 88, 89, or 90
THEN
Integration service calls are made to external systems for customs compliance processing
Context: New customs requirements have been processed
GIVEN
New customs requirements have been processed
Applied to: 126: Cargo Information Logging
WHEN
The system completes processing of disposition codes 88, 89, or 90
THEN
Cargo information and processing details are logged for audit trail and compliance tracking
Context: A disposition code 88, 89, or 90 cannot be found in the system or fails validation
GIVEN
A disposition code 88, 89, or 90 cannot be found in the system or fails validation
Applied to: 228: Disposition Code Error Handling
WHEN
The system encounters an error during processing
THEN
Error handling procedures are invoked including error logging, notification generation, and appropriate error status setting
R-GCX016-cbl-00505 (+11) File: GCX016.cbl Special Processing Code Handling Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Processing Code Handling':
  • Context - a disposition code 95 is received for processing:
    For Validate DC 95 in System Tables:
    When the system looks up the disposition code in the gcstbrt disposition code table, then the system confirms the code exists and is valid for special processing, or flags it as invalid if not found.
  • Context - a valid disposition code 95 and cargo identifier:
    For Retrieve Cargo Record:
    When the system accesses the gccc-cargo-root cargo records database, then the system retrieves the complete cargo record for processing or returns cargo not found error.
  • Context - a cargo record with an existing bond control number and disposition code 95:
    For Clear Bond Control Number:
    When the system processes the special customs handling request, then the system removes the bond control number from the cargo record.
  • Context - a cargo record with an existing broker entry number and disposition code 95:
    For Clear Broker Entry Number:
    When the system processes the special customs handling request, then the system removes the broker entry number from the cargo record.
  • Context - a cargo record with existing bond-related data fields and disposition code 95:
    For Clear Related Bond Data:
    When the system processes the special customs handling request, then the system removes all bond-related data including bond numbers, dates, and references.
  • Context - a cargo record with disposition code 95 and existing status array:
    For Update Cargo Status Array:
    When the system processes the special customs handling, then the system adds the disposition code 95 status to the cargo status array with appropriate sequence and occurrence numbers.
  • Context - a cargo record being processed with disposition code 95:
    For Set Special Processing Flag:
    When the system completes the bond data clearing operations, then the system sets a special processing flag to track the cargo's special handling status.
  • Context - a cargo record that has undergone disposition code 95 processing:
    For Log Special Processing Action:
    When the system completes the special processing operations, then the system creates an audit log entry documenting the special processing action with timestamp and cargo details.
  • Context - a cargo record with completed disposition code 95 processing changes:
    For Update Cargo Record in Database:
    When the system commits the changes to the gccc-cargo-root database, then the system successfully updates the cargo record with cleared bond data and new status information.
  • Context - a cargo record that has completed disposition code 95 processing:
    For Generate Status Message:
    When the system finalizes the database updates, then the system generates a status message containing cargo details and processing results for distribution.
  • Context - a generated status message for disposition code 95 processing:
    For Route Message to Customs:
    When the system determines the appropriate customs routing destination, then the system sends the message to the designated customs authority for their processing.
  • Context - a disposition code 95 that fails validation in system tables:
    For Error: Invalid DC 95:
    When the system attempts to process the invalid disposition code, then the system generates an error message indicating invalid disposition code and stops processing.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code 95 is received for processing
GIVEN
A disposition code 95 is received for processing
Applied to: Validate DC 95 in System Tables
WHEN
The system looks up the disposition code in the GCSTBRT disposition code table
THEN
The system confirms the code exists and is valid for special processing, or flags it as invalid if not found
Context: A valid disposition code 95 and cargo identifier
GIVEN
A valid disposition code 95 and cargo identifier
Applied to: Retrieve Cargo Record
WHEN
The system accesses the GCCC-CARGO-ROOT cargo records database
THEN
The system retrieves the complete cargo record for processing or returns cargo not found error
Context: A cargo record with an existing bond control number and disposition code 95
GIVEN
A cargo record with an existing bond control number and disposition code 95
Applied to: Clear Bond Control Number
WHEN
The system processes the special customs handling request
THEN
The system removes the bond control number from the cargo record
Context: A cargo record with an existing broker entry number and disposition code 95
GIVEN
A cargo record with an existing broker entry number and disposition code 95
Applied to: Clear Broker Entry Number
WHEN
The system processes the special customs handling request
THEN
The system removes the broker entry number from the cargo record
Context: A cargo record with existing bond-related data fields and disposition code 95
GIVEN
A cargo record with existing bond-related data fields and disposition code 95
Applied to: Clear Related Bond Data
WHEN
The system processes the special customs handling request
THEN
The system removes all bond-related data including bond numbers, dates, and references
Context: A cargo record with disposition code 95 and existing status array
GIVEN
A cargo record with disposition code 95 and existing status array
Applied to: Update Cargo Status Array
WHEN
The system processes the special customs handling
THEN
The system adds the disposition code 95 status to the cargo status array with appropriate sequence and occurrence numbers
Context: A cargo record being processed with disposition code 95
GIVEN
A cargo record being processed with disposition code 95
Applied to: Set Special Processing Flag
WHEN
The system completes the bond data clearing operations
THEN
The system sets a special processing flag to track the cargo's special handling status
Context: A cargo record that has undergone disposition code 95 processing
GIVEN
A cargo record that has undergone disposition code 95 processing
Applied to: Log Special Processing Action
WHEN
The system completes the special processing operations
THEN
The system creates an audit log entry documenting the special processing action with timestamp and cargo details
Context: A cargo record with completed disposition code 95 processing changes
GIVEN
A cargo record with completed disposition code 95 processing changes
Applied to: Update Cargo Record in Database
WHEN
The system commits the changes to the GCCC-CARGO-ROOT database
THEN
The system successfully updates the cargo record with cleared bond data and new status information
Context: A cargo record that has completed disposition code 95 processing
GIVEN
A cargo record that has completed disposition code 95 processing
Applied to: Generate Status Message
WHEN
The system finalizes the database updates
THEN
The system generates a status message containing cargo details and processing results for distribution
Context: A generated status message for disposition code 95 processing
GIVEN
A generated status message for disposition code 95 processing
Applied to: Route Message to Customs
WHEN
The system determines the appropriate customs routing destination
THEN
The system sends the message to the designated customs authority for their processing
Context: A disposition code 95 that fails validation in system tables
GIVEN
A disposition code 95 that fails validation in system tables
Applied to: Error: Invalid DC 95
WHEN
The system attempts to process the invalid disposition code
THEN
The system generates an error message indicating invalid disposition code and stops processing
R-GCX016-cbl-00517 (+13) File: GCX016.cbl FDA Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FDA Processing':
  • Context - a disposition code is received for cargo processing:
    For Validate Disposition Code A1/A3:
    When the disposition code is a1 or a3, then the system validates the code as a valid fda disposition code and proceeds with fda processing.
  • Context - a valid fda disposition code a1 or a3 has been validated:
    For Retrieve N9 Reference Segments:
    When the system needs fda reference information for compliance processing, then the system retrieves all available n9 reference segments associated with the cargo.
  • Context - the system has attempted to retrieve n9 reference segments for fda processing:
    For N9 Segments Available?:
    When n9 segments are found and available for processing, then the system proceeds with fda reference number processing, otherwise generates fda compliance error.
  • Context - n9 segments are available and contain fda reference information:
    For Process FDA Reference Numbers:
    When the system processes the n9 segments for fda compliance, then the system extracts fda reference numbers and prepares them for qualifier validation.
  • Context - fda reference numbers have been processed from n9 segments:
    For Extract FDA Qualifier Information:
    When the system extracts qualifier information from the n9 segments, then the system obtains fda qualifier codes and associated compliance data for validation.
  • Context - fda qualifier information and reference numbers have been extracted from n9 segments:
    For Validate FDA Compliance Requirements:
    When the system validates fda compliance requirements, then the system determines if all fda requirements are met based on the qualifier codes and reference data.
  • Context - fda compliance requirements have been validated against cargo information:
    For FDA Requirements Met?:
    When all fda requirements are met, then the system sets fda hold status at destination, otherwise generates fda compliance error.
  • Context - fda compliance requirements have been validated and met:
    For Set FDA Hold Status at Destination:
    When cargo requires fda hold for inspection at destination, then the system sets fda hold status specifically at the destination location.
  • Context - fda hold status has been set at destination:
    For Update Cargo Status Array with FDA Code:
    When the cargo status array needs to be updated with fda information, then the system adds fda disposition codes and hold status to the cargo status array.
  • Context - cargo status array has been updated with fda codes:
    For Generate FDA Hold Message:
    When fda hold message needs to be generated for stakeholder notification, then the system creates fda hold message with relevant compliance information and cargo details.
  • Context - fda hold message has been generated:
    For Route FDA Notification to Appropriate Parties:
    When fda notification needs to be distributed to stakeholders, then the system routes the notification to fda, brokers, and other appropriate parties based on cargo and compliance requirements.
  • Context - fda notifications have been routed to appropriate parties:
    For Log FDA Processing Activity:
    When fda processing activity needs to be recorded for audit purposes, then the system logs all fda processing steps, decisions, and notifications for compliance tracking.
  • Context - fda processing has encountered validation failures or missing required information:
    For Generate FDA Compliance Error:
    When fda compliance cannot be validated or n9 segments are unavailable, then the system generates fda compliance error with specific details about the failure.
  • Context - fda compliance error has been generated:
    For Route Error to FDA Processing Team:
    When error needs to be routed for resolution, then the system routes the fda compliance error to the fda processing team with all relevant cargo and error details.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received for cargo processing
GIVEN
A disposition code is received for cargo processing
Applied to: Validate Disposition Code A1/A3
WHEN
The disposition code is A1 or A3
THEN
The system validates the code as a valid FDA disposition code and proceeds with FDA processing
Context: A valid FDA disposition code A1 or A3 has been validated
GIVEN
A valid FDA disposition code A1 or A3 has been validated
Applied to: Retrieve N9 Reference Segments
WHEN
The system needs FDA reference information for compliance processing
THEN
The system retrieves all available N9 reference segments associated with the cargo
Context: The system has attempted to retrieve N9 reference segments for FDA processing
GIVEN
The system has attempted to retrieve N9 reference segments for FDA processing
Applied to: N9 Segments Available?
WHEN
N9 segments are found and available for processing
THEN
The system proceeds with FDA reference number processing, otherwise generates FDA compliance error
Context: N9 segments are available and contain FDA reference information
GIVEN
N9 segments are available and contain FDA reference information
Applied to: Process FDA Reference Numbers
WHEN
The system processes the N9 segments for FDA compliance
THEN
The system extracts FDA reference numbers and prepares them for qualifier validation
Context: FDA reference numbers have been processed from N9 segments
GIVEN
FDA reference numbers have been processed from N9 segments
Applied to: Extract FDA Qualifier Information
WHEN
The system extracts qualifier information from the N9 segments
THEN
The system obtains FDA qualifier codes and associated compliance data for validation
Context: FDA qualifier information and reference numbers have been extracted from N9 segments
GIVEN
FDA qualifier information and reference numbers have been extracted from N9 segments
Applied to: Validate FDA Compliance Requirements
WHEN
The system validates FDA compliance requirements
THEN
The system determines if all FDA requirements are met based on the qualifier codes and reference data
Context: FDA compliance requirements have been validated against cargo information
GIVEN
FDA compliance requirements have been validated against cargo information
Applied to: FDA Requirements Met?
WHEN
All FDA requirements are met
THEN
The system sets FDA hold status at destination, otherwise generates FDA compliance error
Context: FDA compliance requirements have been validated and met
GIVEN
FDA compliance requirements have been validated and met
Applied to: Set FDA Hold Status at Destination
WHEN
Cargo requires FDA hold for inspection at destination
THEN
The system sets FDA hold status specifically at the destination location
Context: FDA hold status has been set at destination
GIVEN
FDA hold status has been set at destination
Applied to: Update Cargo Status Array with FDA Code
WHEN
The cargo status array needs to be updated with FDA information
THEN
The system adds FDA disposition codes and hold status to the cargo status array
Context: Cargo status array has been updated with FDA codes
GIVEN
Cargo status array has been updated with FDA codes
Applied to: Generate FDA Hold Message
WHEN
FDA hold message needs to be generated for stakeholder notification
THEN
The system creates FDA hold message with relevant compliance information and cargo details
Context: FDA hold message has been generated
GIVEN
FDA hold message has been generated
Applied to: Route FDA Notification to Appropriate Parties
WHEN
FDA notification needs to be distributed to stakeholders
THEN
The system routes the notification to FDA, brokers, and other appropriate parties based on cargo and compliance requirements
Context: FDA notifications have been routed to appropriate parties
GIVEN
FDA notifications have been routed to appropriate parties
Applied to: Log FDA Processing Activity
WHEN
FDA processing activity needs to be recorded for audit purposes
THEN
The system logs all FDA processing steps, decisions, and notifications for compliance tracking
Context: FDA processing has encountered validation failures or missing required information
GIVEN
FDA processing has encountered validation failures or missing required information
Applied to: Generate FDA Compliance Error
WHEN
FDA compliance cannot be validated or N9 segments are unavailable
THEN
The system generates FDA compliance error with specific details about the failure
Context: FDA compliance error has been generated
GIVEN
FDA compliance error has been generated
Applied to: Route Error to FDA Processing Team
WHEN
Error needs to be routed for resolution
THEN
The system routes the FDA compliance error to the FDA processing team with all relevant cargo and error details
R-GCX016-cbl-00531 (+12) File: GCX016.cbl KCSM Integration Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Integration':
  • Context - an edi 350 message with a disposition code is being processed:
    For Is Disposition Code KCSM-eligible?:
    When the system evaluates the disposition code for kcsm eligibility, then the system determines whether kcsm processing is required based on the disposition code value.
  • Context - a disposition code has been identified as potentially kcsm-eligible:
    For Check AECWRKTB Table for KCSM Configuration:
    When the system queries the aecwrktb table for kcsm configuration parameters, then the system retrieves the kcsm processing configuration and routing information for the disposition code.
  • Context - kcsm configuration has been retrieved from aecwrktb table:
    For KCSM Processing Required?:
    When the system evaluates the configuration settings against current message context, then the system decides to either proceed with kcsm processing or skip it entirely.
  • Context - kcsm processing has been determined as required:
    For Copy Current EDI 350 Message:
    When the system initiates kcsm message preparation, then the system creates a complete copy of the original edi 350 message preserving all segment data and structure.
  • Context - an edi 350 message copy has been created for kcsm processing:
    For Create Transmission Root Segment A9RT:
    When the system creates the transmission structure, then the system generates an a9rt root segment with proper transmission identifiers and routing information.
  • Context - an a9rt root segment has been created:
    For Set KCSM Transmission Parameters:
    When the system configures transmission parameters, then the system sets routing codes, transmission priorities, and kcsm-specific processing flags based on configuration data.
  • Context - kcsm transmission parameters have been configured:
    For Create Dependent Segment A9DP:
    When the system creates dependent segments, then the system generates a9dp segments containing the edi 350 message data with proper sequencing and linkage to the a9rt root.
  • Context - a9dp dependent segments have been created:
    For Copy EDI Segment Data to Transmission File:
    When the system copies edi segment data, then the system transfers all segment data from the original edi 350 message to the transmission file maintaining data integrity and segment relationships.
  • Context - edi segment data has been copied to the transmission file:
    For Set Transmission Status and Routing:
    When the system finalizes transmission preparation, then the system sets transmission status to ready for processing and assigns appropriate routing codes for kcsm delivery.
  • Context - transmission status and routing have been configured:
    For Spawn GCT1091E Transaction for KCSM:
    When the system initiates kcsm transaction processing, then the system spawns gct1091e transaction with proper parameters for kcsm message handling and transmission.
  • Context - gct1091e transaction has been spawned for kcsm processing:
    For Queue Message for KCSM Transmission:
    When the system queues the message for transmission, then the system places the kcsm message in the transmission queue with proper priority and delivery scheduling.
  • Context - a kcsm message has been queued for transmission:
    For Log KCSM Transmission Details:
    When the system logs transmission activity, then the system records transmission details including message identifiers, routing information, and processing timestamps for audit trail.
  • Context - a disposition code has been evaluated for kcsm eligibility or kcsm configuration indicates no processing required:
    For Skip KCSM Processing:
    When the system determines kcsm processing should be skipped, then the system bypasses all kcsm processing steps and continues with normal edi 350 message processing.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message with a disposition code is being processed
GIVEN
An EDI 350 message with a disposition code is being processed
Applied to: Is Disposition Code KCSM-eligible?
WHEN
The system evaluates the disposition code for KCSM eligibility
THEN
The system determines whether KCSM processing is required based on the disposition code value
Context: A disposition code has been identified as potentially KCSM-eligible
GIVEN
A disposition code has been identified as potentially KCSM-eligible
Applied to: Check AECWRKTB Table for KCSM Configuration
WHEN
The system queries the AECWRKTB table for KCSM configuration parameters
THEN
The system retrieves the KCSM processing configuration and routing information for the disposition code
Context: KCSM configuration has been retrieved from AECWRKTB table
GIVEN
KCSM configuration has been retrieved from AECWRKTB table
Applied to: KCSM Processing Required?
WHEN
The system evaluates the configuration settings against current message context
THEN
The system decides to either proceed with KCSM processing or skip it entirely
Context: KCSM processing has been determined as required
GIVEN
KCSM processing has been determined as required
Applied to: Copy Current EDI 350 Message
WHEN
The system initiates KCSM message preparation
THEN
The system creates a complete copy of the original EDI 350 message preserving all segment data and structure
Context: An EDI 350 message copy has been created for KCSM processing
GIVEN
An EDI 350 message copy has been created for KCSM processing
Applied to: Create Transmission Root Segment A9RT
WHEN
The system creates the transmission structure
THEN
The system generates an A9RT root segment with proper transmission identifiers and routing information
Context: An A9RT root segment has been created
GIVEN
An A9RT root segment has been created
Applied to: Set KCSM Transmission Parameters
WHEN
The system configures transmission parameters
THEN
The system sets routing codes, transmission priorities, and KCSM-specific processing flags based on configuration data
Context: KCSM transmission parameters have been configured
GIVEN
KCSM transmission parameters have been configured
Applied to: Create Dependent Segment A9DP
WHEN
The system creates dependent segments
THEN
The system generates A9DP segments containing the EDI 350 message data with proper sequencing and linkage to the A9RT root
Context: A9DP dependent segments have been created
GIVEN
A9DP dependent segments have been created
Applied to: Copy EDI Segment Data to Transmission File
WHEN
The system copies EDI segment data
THEN
The system transfers all segment data from the original EDI 350 message to the transmission file maintaining data integrity and segment relationships
Context: EDI segment data has been copied to the transmission file
GIVEN
EDI segment data has been copied to the transmission file
Applied to: Set Transmission Status and Routing
WHEN
The system finalizes transmission preparation
THEN
The system sets transmission status to ready for processing and assigns appropriate routing codes for KCSM delivery
Context: Transmission status and routing have been configured
GIVEN
Transmission status and routing have been configured
Applied to: Spawn GCT1091E Transaction for KCSM
WHEN
The system initiates KCSM transaction processing
THEN
The system spawns GCT1091E transaction with proper parameters for KCSM message handling and transmission
Context: GCT1091E transaction has been spawned for KCSM processing
GIVEN
GCT1091E transaction has been spawned for KCSM processing
Applied to: Queue Message for KCSM Transmission
WHEN
The system queues the message for transmission
THEN
The system places the KCSM message in the transmission queue with proper priority and delivery scheduling
Context: A KCSM message has been queued for transmission
GIVEN
A KCSM message has been queued for transmission
Applied to: Log KCSM Transmission Details
WHEN
The system logs transmission activity
THEN
The system records transmission details including message identifiers, routing information, and processing timestamps for audit trail
Context: A disposition code has been evaluated for KCSM eligibility OR KCSM configuration indicates no processing required
GIVEN
A disposition code has been evaluated for KCSM eligibility OR KCSM configuration indicates no processing required
Applied to: Skip KCSM Processing
WHEN
The system determines KCSM processing should be skipped
THEN
The system bypasses all KCSM processing steps and continues with normal EDI 350 message processing
R-GCX016-cbl-00544 (+12) File: GCX016.cbl Bond Information Clearing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Information Clearing':
  • Context - a cargo record exists in the system and disposition code 95 is being processed:
    For Disposition Code 95 Detected:
    When the system processes the disposition code 95 for bond clearing, then the system should identify the cargo record and initiate bond information clearing process.
  • Context - a request to clear bond information for a specific cargo:
    For Cargo Record Exists?:
    When the system attempts to access the cargo record, then the system should verify the cargo record exists and either proceed with clearing or generate an error if not found.
    For Error: Cargo Not Found:
    When the cargo record cannot be found in the database, then the system should generate a cargo not found error and terminate the bond clearing process.
  • Context - a valid cargo record is accessed for bond clearing:
    For Clear Bond Control Number:
    When the system processes bond control number clearing, then the bond control number field should be set to spaces or null value.
  • Context - a cargo record with bond information is being processed:
    For Clear Broker Entry Number:
    When the system clears broker entry number information, then the broker entry number field should be set to spaces or null value.
  • Context - a cargo record contains various bond-related data fields:
    For Clear Related Bond Data:
    When the system processes related bond data clearing, then all bond-related data fields should be cleared or reset to default values.
  • Context - a cargo record contains bonded-to station information:
    For Clear Bonded-To Station Information:
    When the system clears bonded-to station information, then the bonded-to station field should be set to spaces or null value.
  • Context - a cargo record contains a bond start date:
    For Clear Bond Start Date:
    When the system clears bond start date information, then the bond start date field should be set to zeros or null value.
  • Context - a cargo record contains bond type information:
    For Clear Bond Type Information:
    When the system clears bond type information, then the bond type field should be set to spaces or null value.
  • Context - all bond information has been cleared from the cargo record:
    For Update Cargo Status:
    When the system updates the cargo status, then the cargo status should be updated to reflect the removal of bonding requirements.
  • Context - bond information has been cleared from a cargo record:
    For Log Bond Clearing Action:
    When the system logs the bond clearing action, then an audit log entry should be created documenting the bond clearing action with relevant details.
  • Context - a cargo record has been modified with cleared bond information:
    For Replace Cargo Record in Database:
    When the system replaces the cargo record in the database, then the updated cargo record should be successfully saved to the database with all bond information cleared.
  • Context - all bond clearing operations have been completed successfully:
    For Bond Information Cleared Successfully:
    When the system completes the bond clearing process, then the system should indicate successful completion of bond information clearing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system and disposition code 95 is being processed
GIVEN
A cargo record exists in the system and disposition code 95 is being processed
Applied to: Disposition Code 95 Detected
WHEN
The system processes the disposition code 95 for bond clearing
THEN
The system should identify the cargo record and initiate bond information clearing process
Context: A request to clear bond information for a specific cargo
GIVEN
A request to clear bond information for a specific cargo
Applied to: Cargo Record Exists?
WHEN
The system attempts to access the cargo record
THEN
The system should verify the cargo record exists and either proceed with clearing or generate an error if not found
Applied to: Error: Cargo Not Found
WHEN
The cargo record cannot be found in the database
THEN
The system should generate a cargo not found error and terminate the bond clearing process
Context: A valid cargo record is accessed for bond clearing
GIVEN
A valid cargo record is accessed for bond clearing
Applied to: Clear Bond Control Number
WHEN
The system processes bond control number clearing
THEN
The bond control number field should be set to spaces or null value
Context: A cargo record with bond information is being processed
GIVEN
A cargo record with bond information is being processed
Applied to: Clear Broker Entry Number
WHEN
The system clears broker entry number information
THEN
The broker entry number field should be set to spaces or null value
Context: A cargo record contains various bond-related data fields
GIVEN
A cargo record contains various bond-related data fields
Applied to: Clear Related Bond Data
WHEN
The system processes related bond data clearing
THEN
All bond-related data fields should be cleared or reset to default values
Context: A cargo record contains bonded-to station information
GIVEN
A cargo record contains bonded-to station information
Applied to: Clear Bonded-To Station Information
WHEN
The system clears bonded-to station information
THEN
The bonded-to station field should be set to spaces or null value
Context: A cargo record contains a bond start date
GIVEN
A cargo record contains a bond start date
Applied to: Clear Bond Start Date
WHEN
The system clears bond start date information
THEN
The bond start date field should be set to zeros or null value
Context: A cargo record contains bond type information
GIVEN
A cargo record contains bond type information
Applied to: Clear Bond Type Information
WHEN
The system clears bond type information
THEN
The bond type field should be set to spaces or null value
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
WHEN
The system updates the cargo status
THEN
The cargo status should be updated to reflect the removal of bonding requirements
Context: Bond information has been cleared from a cargo record
GIVEN
Bond information has been cleared from a cargo record
Applied to: Log Bond Clearing Action
WHEN
The system logs the bond clearing action
THEN
An audit log entry should be created documenting the bond clearing action with relevant details
Context: A cargo record has been modified with cleared bond information
GIVEN
A cargo record has been modified with cleared bond information
Applied to: Replace Cargo Record in Database
WHEN
The system replaces the cargo record in the database
THEN
The updated cargo record should be successfully saved to the database with all bond information cleared
Context: All bond clearing operations have been completed successfully
GIVEN
All bond clearing operations have been completed successfully
Applied to: Bond Information Cleared Successfully
WHEN
The system completes the bond clearing process
THEN
The system should indicate successful completion of bond information clearing
R-GCX016-cbl-00557 (+8) File: GCX016.cbl Entry Number Validation Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Entry Number Validation':
  • Context - an x4 segment is being processed for customs release:
    For Entry Number Present?:
    When the system checks the x4-04 entry number field, then if entry number is not present, skip entry processing and continue to next segment.
  • Context - an entry number is present in x4-04 field:
    For Entry Number Valid?:
    When the system validates the entry number format, then if entry number format is invalid, generate entry validation error and skip processing.
  • Context - a valid entry number is present and entry type is determined:
    For Entry Type = V37?:
    When the entry type is v37, then apply v37 special processing rules and set v37 entry flag.
  • Context - entry type has been identified as v37:
    For Set V37 Entry Flag:
    When v37 special processing rules are applied, then set v37 entry flag to indicate special handling required.
  • Context - entry number is valid format and entry type is not v37:
    For Length Valid?:
    When the system validates entry number length, then if length is invalid, generate entry validation error and skip processing.
  • Context - entry number has valid length:
    For Characters Valid?:
    When the system validates entry number characters, then if characters are invalid, generate entry validation error and skip processing.
  • Context - entry number passes all validation checks:
    For Mark Entry as Valid:
    When all format, length, and character validations are successful, then mark entry as valid and continue to disposition code processing.
  • Context - entry number fails any validation check:
    For Generate Entry Validation Error:
    When format, length, or character validation fails, then generate entry validation error message and log the issue.
  • Context - an entry validation error has been generated:
    For Log Entry Number Issue:
    When the system processes the validation failure, then log the entry number issue with details for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed for customs release
GIVEN
An X4 segment is being processed for customs release
Applied to: Entry Number Present?
WHEN
The system checks the X4-04 entry number field
THEN
If entry number is not present, skip entry processing and continue to next segment
Context: An entry number is present in X4-04 field
GIVEN
An entry number is present in X4-04 field
Applied to: Entry Number Valid?
WHEN
The system validates the entry number format
THEN
If entry number format is invalid, generate entry validation error and skip processing
Context: A valid entry number is present and entry type is determined
GIVEN
A valid entry number is present and entry type is determined
Applied to: Entry Type = V37?
WHEN
The entry type is V37
THEN
Apply V37 special processing rules and set V37 entry flag
Context: Entry type has been identified as V37
GIVEN
Entry type has been identified as V37
Applied to: Set V37 Entry Flag
WHEN
V37 special processing rules are applied
THEN
Set V37 entry flag to indicate special handling required
Context: Entry number is valid format and entry type is not V37
GIVEN
Entry number is valid format and entry type is not V37
Applied to: Length Valid?
WHEN
The system validates entry number length
THEN
If length is invalid, generate entry validation error and skip processing
Context: Entry number has valid length
GIVEN
Entry number has valid length
Applied to: Characters Valid?
WHEN
The system validates entry number characters
THEN
If characters are invalid, generate entry validation error and skip processing
Context: Entry number passes all validation checks
GIVEN
Entry number passes all validation checks
Applied to: Mark Entry as Valid
WHEN
All format, length, and character validations are successful
THEN
Mark entry as valid and continue to disposition code processing
Context: Entry number fails any validation check
GIVEN
Entry number fails any validation check
Applied to: Generate Entry Validation Error
WHEN
Format, length, or character validation fails
THEN
Generate entry validation error message and log the issue
Context: An entry validation error has been generated
GIVEN
An entry validation error has been generated
Applied to: Log Entry Number Issue
WHEN
The system processes the validation failure
THEN
Log the entry number issue with details for audit trail
R-GCX016-cbl-00566 (+45) File: GCX016.cbl In Merged 46 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'In':
  • Context - an x4 customs release segment is received for processing:
    For Entry Number Present in X4-04?:
    When the system checks for entry number presence in field x4-04, then if entry number is present, proceed to entry number validation, otherwise start in-bond broker processing directly.
  • Context - entry number validation has been completed:
    For Entry Type Code Present?:
    When the system evaluates entry type code availability, then if entry type code is present, proceed to in-bond broker processing, otherwise complete processing.
  • Context - in-bond broker processing has started with an entry number:
    For Entry Number Format Valid?:
    When the system validates the entry number format, then if format is invalid, handle v37 entry specially, otherwise proceed to in-bond type code processing.
  • Context - an entry number with invalid standard format is identified:
    For Handle V37 Entry Specially:
    When the entry number requires v37 special handling, then apply v37-specific processing rules and continue to in-bond type code processing.
  • Context - entry number format validation is complete:
    For In-Bond Type Code Processing?:
    When the system evaluates if in-bond type code processing is needed, then if required, perform snp processing to convert edi to internal codes, otherwise check for border entry type 00.
  • Context - in-bond type code processing is required:
    For SNP Processing - Convert EDI to Internal Codes:
    When snp processing is initiated for code conversion, then convert edi codes to internal system codes and proceed to border entry type evaluation.
  • Context - code conversion processing is complete or not required:
    For Border Entry Type 00?:
    When the system checks if entry type is border entry type 00, then if entry type is 00, proceed to border entry handling, otherwise check for master in-bond entry.
  • Context - entry type is identified as border entry type 00:
    For Border Entry Handling:
    When border entry handling is initiated, then clear bond control numbers and clear broker entry numbers, then proceed to canadian border processing check.
  • Context - entry is not border entry type 00:
    For Master In-Bond Entry?:
    When the system evaluates if entry is a master in-bond entry, then if master in-bond entry, proceed to master in-bond processing, otherwise check for canadian border processing.
  • Context - entry is identified as master in-bond entry:
    For Master In-Bond Processing:
    When master in-bond processing is initiated, then process entry types 61, 62, 63, and 69 with their specific requirements and proceed to canadian border processing check.
  • Context - master in-bond processing is active:
    For Process Entry Types 61,62,63,69:
    When entry types 61, 62, 63, or 69 are encountered, then apply type-specific processing rules: 61 for immediate transport, 62 for transport export, 63 for immediate export, 69 for us-canada-us movement.
  • Context - border entry type 00 is being processed:
    For Clear Bond Control Numbers:
    When bond control number clearing is required, then remove all existing bond control numbers from the cargo record.
    For Clear Broker Entry Numbers:
    When broker entry number clearing is required, then remove all existing broker entry numbers from the cargo record.
  • Context - border entry handling or master in-bond processing is complete:
    For Canadian Border Processing?:
    When the system evaluates canadian border processing requirements, then if canadian border processing is required, proceed to canadian border processing, otherwise proceed to broker vs qp bond processing.
  • Context - canadian border processing is required:
    For Canadian Border Processing:
    When canadian border processing is initiated, then map us port codes to canadian names and proceed to broker vs qp bond processing.
  • Context - canadian border processing is active:
    For Map US Port Codes to Canadian Names:
    When us port codes need to be mapped to canadian equivalents, then apply port code mapping rules to convert us codes to canadian port names.
  • Context - broker vs qp bond processing evaluation is initiated:
    For Broker Bond or QP Bond?:
    When the system determines bond type classification, then if broker bond, process broker bond information; if qp bond, process qp bond information.
  • Context - bond is classified as broker bond:
    For Process Broker Bond Information:
    When broker bond information processing is initiated, then process broker-specific bond information, validate broker details, and update cargo with entry information.
  • Context - bond is classified as qp bond:
    For Process QP Bond Information:
    When qp bond information processing is initiated, then process qp-specific bond information, validate qp requirements, and update cargo with entry information.
  • Context - broker bond or qp bond processing is complete:
    For Update Cargo with Entry Information:
    When cargo entry information update is required, then update cargo record with all processed entry information and complete in-bond broker processing.
  • Context - an in-bond type code is received from cprail system:
    For Validate In-bond Type Code Format:
    When the system validates the code format, then the code is accepted if it meets format requirements, otherwise an invalid code error is triggered.
  • Context - a valid cprail in-bond type code is provided:
    For Lookup EDI 309 Mapping Table:
    When the system searches the edi 309 mapping table, then if mapping is found, the edi 309 value is retrieved, otherwise a default value is used.
  • Context - a mapping exists between cprail code and edi 309 value:
    For Convert CPRAIL Code to EDI 309 Value:
    When the conversion process is executed, then the cprail code is converted to the corresponding edi 309 value.
  • Context - an edi 309 code has been successfully converted from cprail format:
    For Update U1 Segment with EDI 309 Code:
    When the u1 segment update is performed, then the u1 segment contains the edi 309 in-bond type code for further processing.
  • Context - no mapping exists for the provided cprail in-bond type code:
    For Set Default EDI 309 Value:
    When the mapping lookup fails, then a default edi 309 value is assigned and a mapping error is logged.
  • Context - cprail code has been successfully converted to edi 309 format:
    For Log Successful Conversion:
    When the conversion process completes successfully, then a success log entry is created documenting the conversion.
  • Context - no mapping exists for the cprail in-bond type code:
    For Log Mapping Error:
    When a default value is assigned due to mapping failure, then an error log entry is created documenting the mapping failure.
  • Context - an edi entry type code is received from x4 segment:
    For Border Entry Processing Type Code '00':
    When the entry type code value is '00', then the system should clear bond information and process as border entry.
    For Master In-Bond Entry Types 61, 62, 63, 69:
    When the entry type code value is '61', '62', '63', or '69', then the system should process as master in-bond entry and map to appropriate transport type.
    For Standard In-Bond Entry Other Type Codes:
    When the entry type code value is not '00', '61', '62', '63', or '69', then the system should process as standard in-bond entry.
  • Context - a master in-bond entry type code ('61', '62', '63', or '69') is being processed:
    For Map to Transport Type for Master In-Bond:
    When the system maps the edi code to transport type, then entry type '61' maps to immediate transport, '62' maps to transport for export, '63' maps to immediate export, '69' maps to us-canada-us movement.
  • Context - an edi entry type code has been received and categorized:
    For Convert EDI Code to Internal CPRAIL Value:
    When the system converts the edi code to internal format, then the edi code should be mapped to the corresponding internal cprail value.
  • Context - an entry type code has been converted to internal cprail format:
    For Validate Entry Type Code Against System Tables:
    When the system validates the code against system tables, then the system should verify the code exists in the reference tables and is valid for processing.
  • Context - a valid master in-bond entry type code has been processed:
    For Set Transport Type in Cargo Record:
    When the system updates the cargo record, then the transport type should be set in the cargo record based on the entry type mapping.
  • Context - a valid standard in-bond entry type code has been processed:
    For Update In-Bond Status in Cargo Record:
    When the system updates the cargo record, then the in-bond status should be updated in the cargo record.
  • Context - an entry type code has been successfully processed and cargo record updated:
    For Log Entry Type Processing:
    When the system completes the entry type processing, then the system should log the entry type processing activity.
  • Context - an entry type code has been validated against system tables:
    For Generate Error Message Invalid Entry Type:
    When the entry type code is not found or is invalid, then the system should generate an error message indicating invalid entry type.
  • Context - a cprail in-bond type code is received for conversion:
    For Access In-Bond Type Code Lookup Table:
    When the system accesses the gcstbrt ims segment lookup table, then the lookup table is made available for code conversion processing.
  • Context - a cprail in-bond type code and access to the lookup table:
    For CPRAIL Code Found in Table?:
    When the system searches for the cprail code in the lookup table, then the system determines if the code exists and sets appropriate processing path.
  • Context - a cprail in-bond type code that exists in the lookup table:
    For Retrieve Corresponding EDI 309 Standard Value:
    When the system finds a matching entry in the lookup table, then the corresponding edi 309 standard value is retrieved for conversion.
  • Context - a cprail in-bond type code that does not exist in the lookup table:
    For Apply Default EDI 309 Value:
    When the system cannot find a matching entry in the lookup table, then a default edi 309 value is applied for the conversion process.
  • Context - either a retrieved edi 309 standard value or a default edi 309 value:
    For Convert CPRAIL Code to EDI 309 Format:
    When the system performs the format conversion from cprail to edi 309, then the cprail code is converted to the appropriate edi 309 format.
  • Context - a converted edi 309 in-bond type code:
    For Validate Converted Code:
    When the system validates the converted code against edi 309 standards, then the system determines if the conversion is valid and sets appropriate processing path.
  • Context - a successfully validated edi 309 in-bond type code:
    For Update U1 Segment with EDI 309 Value:
    When the conversion validation passes, then the u1 segment is updated with the converted edi 309 value.
  • Context - an edi 309 in-bond type code that fails validation:
    For Log Conversion Error:
    When the conversion validation fails, then the system logs the conversion error for audit and troubleshooting purposes.
  • Context - a conversion error has been logged:
    For Use Original CPRAIL Value:
    When the edi 309 conversion cannot be completed successfully, then the system uses the original cprail in-bond type code value.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 customs release segment is received for processing
GIVEN
An X4 customs release segment is received for processing
Applied to: Entry Number Present in X4-04?
WHEN
The system checks for entry number presence in field X4-04
THEN
If entry number is present, proceed to entry number validation, otherwise start in-bond broker processing directly
Context: Entry number validation has been completed
GIVEN
Entry number validation has been completed
Applied to: Entry Type Code Present?
WHEN
The system evaluates entry type code availability
THEN
If entry type code is present, proceed to in-bond broker processing, otherwise complete processing
Context: In-bond broker processing has started with an entry number
GIVEN
In-bond broker processing has started with an entry number
Applied to: Entry Number Format Valid?
WHEN
The system validates the entry number format
THEN
If format is invalid, handle V37 entry specially, otherwise proceed to in-bond type code processing
Context: An entry number with invalid standard format is identified
GIVEN
An entry number with invalid standard format is identified
Applied to: Handle V37 Entry Specially
WHEN
The entry number requires V37 special handling
THEN
Apply V37-specific processing rules and continue to in-bond type code processing
Context: Entry number format validation is complete
GIVEN
Entry number format validation is complete
Applied to: In-Bond Type Code Processing?
WHEN
The system evaluates if in-bond type code processing is needed
THEN
If required, perform SNP processing to convert EDI to internal codes, otherwise check for border entry type 00
Context: In-bond type code processing is required
GIVEN
In-bond type code processing is required
Applied to: SNP Processing - Convert EDI to Internal Codes
WHEN
SNP processing is initiated for code conversion
THEN
Convert EDI codes to internal system codes and proceed to border entry type evaluation
Context: Code conversion processing is complete or not required
GIVEN
Code conversion processing is complete or not required
Applied to: Border Entry Type 00?
WHEN
The system checks if entry type is border entry type 00
THEN
If entry type is 00, proceed to border entry handling, otherwise check for master in-bond entry
Context: Entry type is identified as border entry type 00
GIVEN
Entry type is identified as border entry type 00
Applied to: Border Entry Handling
WHEN
Border entry handling is initiated
THEN
Clear bond control numbers and clear broker entry numbers, then proceed to Canadian border processing check
Context: Entry is not border entry type 00
GIVEN
Entry is not border entry type 00
Applied to: Master In-Bond Entry?
WHEN
The system evaluates if entry is a master in-bond entry
THEN
If master in-bond entry, proceed to master in-bond processing, otherwise check for Canadian border processing
Context: Entry is identified as master in-bond entry
GIVEN
Entry is identified as master in-bond entry
Applied to: Master In-Bond Processing
WHEN
Master in-bond processing is initiated
THEN
Process entry types 61, 62, 63, and 69 with their specific requirements and proceed to Canadian border processing check
Context: Master in-bond processing is active
GIVEN
Master in-bond processing is active
Applied to: Process Entry Types 61,62,63,69
WHEN
Entry types 61, 62, 63, or 69 are encountered
THEN
Apply type-specific processing rules: 61 for immediate transport, 62 for transport export, 63 for immediate export, 69 for US-Canada-US movement
Context: Border entry type 00 is being processed
GIVEN
Border entry type 00 is being processed
Applied to: Clear Bond Control Numbers
WHEN
Bond control number clearing is required
THEN
Remove all existing bond control numbers from the cargo record
Applied to: Clear Broker Entry Numbers
WHEN
Broker entry number clearing is required
THEN
Remove all existing broker entry numbers from the cargo record
Context: Border entry handling or master in-bond processing is complete
GIVEN
Border entry handling or master in-bond processing is complete
Applied to: Canadian Border Processing?
WHEN
The system evaluates Canadian border processing requirements
THEN
If Canadian border processing is required, proceed to Canadian border processing, otherwise proceed to broker vs QP bond processing
Context: Canadian border processing is required
GIVEN
Canadian border processing is required
Applied to: Canadian Border Processing
WHEN
Canadian border processing is initiated
THEN
Map US port codes to Canadian names and proceed to broker vs QP bond processing
Context: Canadian border processing is active
GIVEN
Canadian border processing is active
Applied to: Map US Port Codes to Canadian Names
WHEN
US port codes need to be mapped to Canadian equivalents
THEN
Apply port code mapping rules to convert US codes to Canadian port names
Context: Broker vs QP bond processing evaluation is initiated
GIVEN
Broker vs QP bond processing evaluation is initiated
Applied to: Broker Bond or QP Bond?
WHEN
The system determines bond type classification
THEN
If broker bond, process broker bond information; if QP bond, process QP bond information
Context: Bond is classified as broker bond
GIVEN
Bond is classified as broker bond
Applied to: Process Broker Bond Information
WHEN
Broker bond information processing is initiated
THEN
Process broker-specific bond information, validate broker details, and update cargo with entry information
Context: Bond is classified as QP bond
GIVEN
Bond is classified as QP bond
Applied to: Process QP Bond Information
WHEN
QP bond information processing is initiated
THEN
Process QP-specific bond information, validate QP requirements, and update cargo with entry information
Context: Broker bond or QP bond processing is complete
GIVEN
Broker bond or QP bond processing is complete
Applied to: Update Cargo with Entry Information
WHEN
Cargo entry information update is required
THEN
Update cargo record with all processed entry information and complete in-bond broker processing
Context: An in-bond type code is received from CPRAIL system
GIVEN
An in-bond type code is received from CPRAIL system
Applied to: Validate In-bond Type Code Format
WHEN
The system validates the code format
THEN
The code is accepted if it meets format requirements, otherwise an invalid code error is triggered
Context: A valid CPRAIL in-bond type code is provided
GIVEN
A valid CPRAIL in-bond type code is provided
Applied to: Lookup EDI 309 Mapping Table
WHEN
The system searches the EDI 309 mapping table
THEN
If mapping is found, the EDI 309 value is retrieved, otherwise a default value is used
Context: A mapping exists between CPRAIL code and EDI 309 value
GIVEN
A mapping exists between CPRAIL code and EDI 309 value
Applied to: Convert CPRAIL Code to EDI 309 Value
WHEN
The conversion process is executed
THEN
The CPRAIL code is converted to the corresponding EDI 309 value
Context: An EDI 309 code has been successfully converted from CPRAIL format
GIVEN
An EDI 309 code has been successfully converted from CPRAIL format
Applied to: Update U1 Segment with EDI 309 Code
WHEN
The U1 segment update is performed
THEN
The U1 segment contains the EDI 309 in-bond type code for further processing
Context: No mapping exists for the provided CPRAIL in-bond type code
GIVEN
No mapping exists for the provided CPRAIL in-bond type code
Applied to: Set Default EDI 309 Value
WHEN
The mapping lookup fails
THEN
A default EDI 309 value is assigned and a mapping error is logged
Context: CPRAIL code has been successfully converted to EDI 309 format
GIVEN
CPRAIL code has been successfully converted to EDI 309 format
Applied to: Log Successful Conversion
WHEN
The conversion process completes successfully
THEN
A success log entry is created documenting the conversion
Context: No mapping exists for the CPRAIL in-bond type code
GIVEN
No mapping exists for the CPRAIL in-bond type code
Applied to: Log Mapping Error
WHEN
A default value is assigned due to mapping failure
THEN
An error log entry is created documenting the mapping failure
Context: An EDI entry type code is received from X4 segment
GIVEN
An EDI entry type code is received from X4 segment
Applied to: Border Entry Processing Type Code '00'
WHEN
The entry type code value is '00'
THEN
The system should clear bond information and process as border entry
Applied to: Master In-Bond Entry Types 61, 62, 63, 69
WHEN
The entry type code value is '61', '62', '63', or '69'
THEN
The system should process as master in-bond entry and map to appropriate transport type
Applied to: Standard In-Bond Entry Other Type Codes
WHEN
The entry type code value is not '00', '61', '62', '63', or '69'
THEN
The system should process as standard in-bond entry
Context: A master in-bond entry type code ('61', '62', '63', or '69') is being processed
GIVEN
A master in-bond entry type code ('61', '62', '63', or '69') is being processed
Applied to: Map to Transport Type for Master In-Bond
WHEN
The system maps the EDI code to transport type
THEN
Entry type '61' maps to immediate transport, '62' maps to transport for export, '63' maps to immediate export, '69' maps to US-Canada-US movement
Context: An EDI entry type code has been received and categorized
GIVEN
An EDI entry type code has been received and categorized
Applied to: Convert EDI Code to Internal CPRAIL Value
WHEN
The system converts the EDI code to internal format
THEN
The EDI code should be mapped to the corresponding internal CPRAIL value
Context: An entry type code has been converted to internal CPRAIL format
GIVEN
An entry type code has been converted to internal CPRAIL format
Applied to: Validate Entry Type Code Against System Tables
WHEN
The system validates the code against system tables
THEN
The system should verify the code exists in the reference tables and is valid for processing
Context: A valid master in-bond entry type code has been processed
GIVEN
A valid master in-bond entry type code has been processed
Applied to: Set Transport Type in Cargo Record
WHEN
The system updates the cargo record
THEN
The transport type should be set in the cargo record based on the entry type mapping
Context: A valid standard in-bond entry type code has been processed
GIVEN
A valid standard in-bond entry type code has been processed
Applied to: Update In-Bond Status in Cargo Record
WHEN
The system updates the cargo record
THEN
The in-bond status should be updated in the cargo record
Context: An entry type code has been successfully processed and cargo record updated
GIVEN
An entry type code has been successfully processed and cargo record updated
Applied to: Log Entry Type Processing
WHEN
The system completes the entry type processing
THEN
The system should log the entry type processing activity
Context: An entry type code has been validated against system tables
GIVEN
An entry type code has been validated against system tables
Applied to: Generate Error Message Invalid Entry Type
WHEN
The entry type code is not found or is invalid
THEN
The system should generate an error message indicating invalid entry type
Context: A CPRAIL in-bond type code is received for conversion
GIVEN
A CPRAIL in-bond type code is received for conversion
Applied to: Access In-Bond Type Code Lookup Table
WHEN
The system accesses the GCSTBRT IMS segment lookup table
THEN
The lookup table is made available for code conversion processing
Context: A CPRAIL in-bond type code and access to the lookup table
GIVEN
A CPRAIL in-bond type code and access to the lookup table
Applied to: CPRAIL Code Found in Table?
WHEN
The system searches for the CPRAIL code in the lookup table
THEN
The system determines if the code exists and sets appropriate processing path
Context: A CPRAIL in-bond type code that exists in the lookup table
GIVEN
A CPRAIL in-bond type code that exists in the lookup table
Applied to: Retrieve Corresponding EDI 309 Standard Value
WHEN
The system finds a matching entry in the lookup table
THEN
The corresponding EDI 309 standard value is retrieved for conversion
Context: A CPRAIL in-bond type code that does not exist in the lookup table
GIVEN
A CPRAIL in-bond type code that does not exist in the lookup table
Applied to: Apply Default EDI 309 Value
WHEN
The system cannot find a matching entry in the lookup table
THEN
A default EDI 309 value is applied for the conversion process
Context: Either a retrieved EDI 309 standard value or a default EDI 309 value
GIVEN
Either a retrieved EDI 309 standard value or a default EDI 309 value
Applied to: Convert CPRAIL Code to EDI 309 Format
WHEN
The system performs the format conversion from CPRAIL to EDI 309
THEN
The CPRAIL code is converted to the appropriate EDI 309 format
Context: A converted EDI 309 in-bond type code
GIVEN
A converted EDI 309 in-bond type code
Applied to: Validate Converted Code
WHEN
The system validates the converted code against EDI 309 standards
THEN
The system determines if the conversion is valid and sets appropriate processing path
Context: A successfully validated EDI 309 in-bond type code
GIVEN
A successfully validated EDI 309 in-bond type code
Applied to: Update U1 Segment with EDI 309 Value
WHEN
The conversion validation passes
THEN
The U1 segment is updated with the converted EDI 309 value
Context: An EDI 309 in-bond type code that fails validation
GIVEN
An EDI 309 in-bond type code that fails validation
Applied to: Log Conversion Error
WHEN
The conversion validation fails
THEN
The system logs the conversion error for audit and troubleshooting purposes
Context: A conversion error has been logged
GIVEN
A conversion error has been logged
Applied to: Use Original CPRAIL Value
WHEN
The EDI 309 conversion cannot be completed successfully
THEN
The system uses the original CPRAIL in-bond type code value
R-GCX016-cbl-00586 (+6) File: GCX016.cbl SNP Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'SNP Processing':
  • Context - an edi message contains an in-bond type code:
    For Valid EDI Code?:
    When the system receives the edi code for processing, then the system validates if the edi code exists in the recognized code list and sets validation status accordingly.
  • Context - a valid edi in-bond type code has been received:
    For Lookup EDI to CPRAIL Conversion Table:
    When the system needs to convert the edi code to internal cprail format, then the system looks up the conversion table to find the matching cprail code for the edi code.
  • Context - an edi 309 value exists in the conversion table:
    For Convert EDI 309 Value to Internal CPRAIL Code:
    When the system processes the edi code conversion, then the system transforms the edi 309 value into the corresponding internal cprail code format.
  • Context - an edi code has been successfully converted to cprail format:
    For Create U1 Segment with Converted Code:
    When the system needs to store the converted code information, then the system creates a new u1 segment record and populates it with the converted cprail code.
  • Context - a u1 segment has been created with converted in-bond code information:
    For Update Shipment Record with In-Bond Information:
    When the system processes the shipment record update, then the system updates the shipment root record with the in-bond type information from the u1 segment.
  • Context - the edi code conversion and shipment update have completed successfully:
    For Log Conversion Success:
    When the system finalizes the conversion process, then the system creates a log entry recording the successful conversion of the edi code to cprail format.
  • Context - an edi in-bond type code fails validation:
    For Generate Error Message:
    When the system cannot find the edi code in the recognized code list, then the system generates an error message indicating the edi code is invalid or unrecognized.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI message contains an in-bond type code
GIVEN
An EDI message contains an in-bond type code
Applied to: Valid EDI Code?
WHEN
The system receives the EDI code for processing
THEN
The system validates if the EDI code exists in the recognized code list and sets validation status accordingly
Context: A valid EDI in-bond type code has been received
GIVEN
A valid EDI in-bond type code has been received
Applied to: Lookup EDI to CPRAIL Conversion Table
WHEN
The system needs to convert the EDI code to internal CPRAIL format
THEN
The system looks up the conversion table to find the matching CPRAIL code for the EDI code
Context: An EDI 309 value exists in the conversion table
GIVEN
An EDI 309 value exists in the conversion table
Applied to: Convert EDI 309 Value to Internal CPRAIL Code
WHEN
The system processes the EDI code conversion
THEN
The system transforms the EDI 309 value into the corresponding internal CPRAIL code format
Context: An EDI code has been successfully converted to CPRAIL format
GIVEN
An EDI code has been successfully converted to CPRAIL format
Applied to: Create U1 Segment with Converted Code
WHEN
The system needs to store the converted code information
THEN
The system creates a new U1 segment record and populates it with the converted CPRAIL code
Context: A U1 segment has been created with converted in-bond code information
GIVEN
A U1 segment has been created with converted in-bond code information
Applied to: Update Shipment Record with In-Bond Information
WHEN
The system processes the shipment record update
THEN
The system updates the shipment root record with the in-bond type information from the U1 segment
Context: The EDI code conversion and shipment update have completed successfully
GIVEN
The EDI code conversion and shipment update have completed successfully
Applied to: Log Conversion Success
WHEN
The system finalizes the conversion process
THEN
The system creates a log entry recording the successful conversion of the EDI code to CPRAIL format
Context: An EDI in-bond type code fails validation
GIVEN
An EDI in-bond type code fails validation
Applied to: Generate Error Message
WHEN
The system cannot find the EDI code in the recognized code list
THEN
The system generates an error message indicating the EDI code is invalid or unrecognized
R-GCX016-cbl-00593 (+12) File: GCX016.cbl Border Entry Handling Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Border Entry Handling':
  • Context - a cargo record with entry type information is being processed:
    For Check Entry Type Code:
    When the system evaluates the entry type code field, then the system identifies if the entry type code equals '00' for border entry processing.
  • Context - a cargo record is being evaluated for processing type:
    For Identify Type Code '00':
    When the entry type code is '00', then the cargo is classified as a border entry requiring special processing rules.
  • Context - a cargo record is classified as border entry with type code '00':
    For Validate Border Entry Requirements:
    When the system validates border entry processing requirements, then the system confirms the cargo meets border entry criteria and can proceed with bond information clearing.
  • Context - a cargo record is validated as border entry type '00':
    For Clear Bond Information:
    When the system processes the border entry clearing requirements, then all existing bond information fields are cleared from the cargo record.
  • Context - a border entry cargo record with existing bond control numbers:
    For Clear Bond Control Numbers:
    When the system processes bond information clearing, then all bond control number fields are set to blank or null values.
  • Context - a border entry cargo record with existing broker entry numbers:
    For Clear Broker Entry Numbers:
    When the system clears bond-related information, then all broker entry number fields are cleared from the cargo record.
  • Context - a border entry cargo record with various bond-related data fields populated:
    For Clear Related Bond Data:
    When the system performs comprehensive bond data clearing, then all related bond data fields including dates, amounts, and references are cleared.
  • Context - a cargo record has completed bond information clearing for border entry:
    For Set Border Entry Status:
    When the system sets the processing status, then the cargo status is set to indicate border entry processing with appropriate status code.
  • Context - a cargo record has been processed as border entry type '00':
    For Update Cargo Record with Border Entry Flag:
    When the system updates the cargo record, then the border entry flag is set in the cargo record to indicate special processing status.
  • Context - a cargo record is flagged as border entry:
    For Process Special Border Entry Rules:
    When the system applies border entry specific rules, then special border entry processing rules are applied including customs clearance and cross-border requirements.
  • Context - a border entry cargo record with special processing rules applied:
    For Validate Cross-Border Requirements:
    When the system validates cross-border movement requirements, then the cargo is confirmed to meet all cross-border regulatory and processing requirements.
  • Context - a border entry cargo record that has passed cross-border validation:
    For Set Default Processing Parameters:
    When the system sets processing parameters, then default border entry processing parameters are assigned for customs clearance and movement tracking.
  • Context - a cargo record has completed border entry processing with default parameters set:
    For Log Border Entry Processing:
    When the system performs logging activities, then all border entry processing steps and status changes are logged for audit trail and tracking.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with entry type information is being processed
GIVEN
A cargo record with entry type information is being processed
Applied to: Check Entry Type Code
WHEN
The system evaluates the entry type code field
THEN
The system identifies if the entry type code equals '00' for border entry processing
Context: A cargo record is being evaluated for processing type
GIVEN
A cargo record is being evaluated for processing type
Applied to: Identify Type Code '00'
WHEN
The entry type code is '00'
THEN
The cargo is classified as a border entry requiring special processing rules
Context: A cargo record is classified as border entry with type code '00'
GIVEN
A cargo record is classified as border entry with type code '00'
Applied to: Validate Border Entry Requirements
WHEN
The system validates border entry processing requirements
THEN
The system confirms the cargo meets border entry criteria and can proceed with bond information clearing
Context: A cargo record is validated as border entry type '00'
GIVEN
A cargo record is validated as border entry type '00'
Applied to: Clear Bond Information
WHEN
The system processes the border entry clearing requirements
THEN
All existing bond information fields are cleared from the cargo record
Context: A border entry cargo record with existing bond control numbers
GIVEN
A border entry cargo record with existing bond control numbers
Applied to: Clear Bond Control Numbers
WHEN
The system processes bond information clearing
THEN
All bond control number fields are set to blank or null values
Context: A border entry cargo record with existing broker entry numbers
GIVEN
A border entry cargo record with existing broker entry numbers
Applied to: Clear Broker Entry Numbers
WHEN
The system clears bond-related information
THEN
All broker entry number fields are cleared from the cargo record
Context: A border entry cargo record with various bond-related data fields populated
GIVEN
A border entry cargo record with various bond-related data fields populated
Applied to: Clear Related Bond Data
WHEN
The system performs comprehensive bond data clearing
THEN
All related bond data fields including dates, amounts, and references are cleared
Context: A cargo record has completed bond information clearing for border entry
GIVEN
A cargo record has completed bond information clearing for border entry
Applied to: Set Border Entry Status
WHEN
The system sets the processing status
THEN
The cargo status is set to indicate border entry processing with appropriate status code
Context: A cargo record has been processed as border entry type '00'
GIVEN
A cargo record has been processed as border entry type '00'
Applied to: Update Cargo Record with Border Entry Flag
WHEN
The system updates the cargo record
THEN
The border entry flag is set in the cargo record to indicate special processing status
Context: A cargo record is flagged as border entry
GIVEN
A cargo record is flagged as border entry
Applied to: Process Special Border Entry Rules
WHEN
The system applies border entry specific rules
THEN
Special border entry processing rules are applied including customs clearance and cross-border requirements
Context: A border entry cargo record with special processing rules applied
GIVEN
A border entry cargo record with special processing rules applied
Applied to: Validate Cross-Border Requirements
WHEN
The system validates cross-border movement requirements
THEN
The cargo is confirmed to meet all cross-border regulatory and processing requirements
Context: A border entry cargo record that has passed cross-border validation
GIVEN
A border entry cargo record that has passed cross-border validation
Applied to: Set Default Processing Parameters
WHEN
The system sets processing parameters
THEN
Default border entry processing parameters are assigned for customs clearance and movement tracking
Context: A cargo record has completed border entry processing with default parameters set
GIVEN
A cargo record has completed border entry processing with default parameters set
Applied to: Log Border Entry Processing
WHEN
The system performs logging activities
THEN
All border entry processing steps and status changes are logged for audit trail and tracking
R-GCX016-cbl-00606 (+23) File: GCX016.cbl Master In Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Master In':
  • Context - a master in-bond entry is received with disposition codes '1j', '69', or '55':
    For Type 61: IT/BL In-Transit:
    When the entry type code is '61', then set transport type to immediate transport and process as it/bl in-transit cargo.
    For Type 62: TE/WD Transportation & Exportation:
    When the entry type code is '62', then set transport type to transportation for export and process as te/wd cargo.
    For Type 63: IE Immediate Exportation:
    When the entry type code is '63', then set transport type to immediate export and process as ie cargo.
    For Type 69: FTZ Foreign Trade Zone:
    When the entry type code is '69', then set transport type to us-canada-us movement and process as ftz cargo.
  • Context - a cargo record with disposition codes '1j', '69', or '55' indicating master in-bond processing:
    For Check Entry Type Code:
    When the system evaluates the entry type code, then the entry type must be one of '61', '62', '63', or '69' for valid master in-bond processing.
  • Context - a master in-bond entry is being processed:
    For Clear Bond Information:
    When the entry type is '00' indicating border processing, then clear all bond information from the cargo record.
    For Retain Bond Information:
    When the entry type is not '00', then retain all existing bond information in the cargo record.
  • Context - a cargo record with disposition codes '1j', '69', or '55' has been processed:
    For Set Master In-Bond Status:
    When the entry type mapping and bond information processing is complete, then set the m1109 master in-bond flag to true to indicate master in-bond processing.
  • Context - a cargo record with disposition code requiring master in-bond processing:
    For Entry Type 61 Master In-Bond:
    When the entry type code is 61, then set master in-bond flag m1109 and configure for immediate transport processing.
    For Entry Type 62 Master In-Bond:
    When the entry type code is 62, then set master in-bond flag m1109 and configure for transport export processing.
    For Entry Type 63 Master In-Bond:
    When the entry type code is 63, then set master in-bond flag m1109 and configure for immediate export processing.
    For Entry Type 69 Master In-Bond:
    When the entry type code is 69, then set master in-bond flag m1109 and configure for us-canada-us movement processing.
  • Context - a cargo record with entry type code in (61, 62, 63, 69):
    For Set Master In-Bond Flag:
    When processing disposition codes 1j, 69, or 55, then set the m1109 master in-bond flag to indicate master in-bond processing is required.
  • Context - a cargo record with a disposition code requiring evaluation:
    For Check Entry Type Code:
    When the entry type code is evaluated, then route to appropriate master in-bond processing based on entry type (61, 62, 63, 69) or skip if not a master in-bond type.
  • Context - a cargo record with an entry type code:
    For Skip - Not Master In-Bond Type:
    When the entry type code is not 61, 62, 63, or 69, then skip master in-bond processing and continue with standard cargo processing.
  • Context - a validated entry type code for master in-bond processing:
    For Map Entry Type to Transport Type:
    When the entry type requires transport type determination, then map entry type 61 to immediate transport, 62 to transport export, 63 to immediate export, and 69 to us-canada-us movement.
  • Context - a cargo record with disposition code requiring master in-bond processing and entry type code is '61':
    For Entry Type 61 - Master In-Bond:
    When the system processes the x4 segment for master in-bond entry, then the system sets the transport type to immediate transport and sets the master in-bond flag and processes the bond control number.
  • Context - a cargo record with disposition code requiring master in-bond processing and entry type code is '62':
    For Entry Type 62 - Master In-Bond:
    When the system processes the x4 segment for master in-bond entry, then the system sets the transport type to transport for export and sets the master in-bond flag and processes the bond control number.
  • Context - a cargo record with disposition code requiring master in-bond processing and entry type code is '63':
    For Entry Type 63 - Master In-Bond:
    When the system processes the x4 segment for master in-bond entry, then the system sets the transport type to immediate export and sets the master in-bond flag and processes the bond control number.
  • Context - a cargo record with disposition code requiring master in-bond processing and entry type code is '69':
    For Entry Type 69 - Master In-Bond:
    When the system processes the x4 segment for master in-bond entry, then the system sets the transport type to us-canada-us movement and sets the master in-bond flag and processes the bond control number.
  • Context - a cargo record with disposition code requiring master in-bond processing and entry type code is not '61', '62', '63', or '69':
    For Other Entry Types:
    When the system processes the x4 segment for master in-bond entry, then the system sets the transport type to default border processing ('00') and sets the master in-bond flag and processes the bond control number.
  • Context - a cargo record with disposition code in ('1j', '69', '55'):
    For Set Master In-Bond Flag:
    When the system processes the master in-bond entry, then the system sets the m1109 master in-bond flag to indicate master in-bond processing is required.
  • Context - a cargo record with an entry number from the x4 segment:
    For Process Bond Control Number:
    When the system processes the entry number format, then if the entry number starts with 'v' then place it in the entry number field, otherwise place it in the in-bond control number field.
  • Context - an entry type code from the x4 segment:
    For Map Entry Type to Internal Transport Type:
    When the system maps the entry type to internal transport type, then entry type '61' maps to immediate transport, '62' maps to transport export, '63' maps to immediate export, '69' maps to us-canada-us movement, and all others map to border processing ('00').
👨‍💻 Technical ACs (Gherkin)
Context: A master in-bond entry is received with disposition codes '1J', '69', or '55'
GIVEN
A master in-bond entry is received with disposition codes '1J', '69', or '55'
Applied to: Type 61: IT/BL In-Transit
WHEN
The entry type code is '61'
THEN
Set transport type to immediate transport and process as IT/BL in-transit cargo
Applied to: Type 62: TE/WD Transportation & Exportation
WHEN
The entry type code is '62'
THEN
Set transport type to transportation for export and process as TE/WD cargo
Applied to: Type 63: IE Immediate Exportation
WHEN
The entry type code is '63'
THEN
Set transport type to immediate export and process as IE cargo
Applied to: Type 69: FTZ Foreign Trade Zone
WHEN
The entry type code is '69'
THEN
Set transport type to US-Canada-US movement and process as FTZ cargo
Context: A cargo record with disposition codes '1J', '69', or '55' indicating master in-bond processing
GIVEN
A cargo record with disposition codes '1J', '69', or '55' indicating master in-bond processing
Applied to: Check Entry Type Code
WHEN
The system evaluates the entry type code
THEN
The entry type must be one of '61', '62', '63', or '69' for valid master in-bond processing
Context: A master in-bond entry is being processed
GIVEN
A master in-bond entry is being processed
Applied to: Clear Bond Information
WHEN
The entry type is '00' indicating border processing
THEN
Clear all bond information from the cargo record
Applied to: Retain Bond Information
WHEN
The entry type is not '00'
THEN
Retain all existing bond information in the cargo record
Context: A cargo record with disposition codes '1J', '69', or '55' has been processed
GIVEN
A cargo record with disposition codes '1J', '69', or '55' has been processed
Applied to: Set Master In-Bond Status
WHEN
The entry type mapping and bond information processing is complete
THEN
Set the M1109 master in-bond flag to true to indicate master in-bond processing
Context: A cargo record with disposition code requiring master in-bond processing
GIVEN
A cargo record with disposition code requiring master in-bond processing
Applied to: Entry Type 61 Master In-Bond
WHEN
The entry type code is 61
THEN
Set master in-bond flag M1109 and configure for immediate transport processing
Applied to: Entry Type 62 Master In-Bond
WHEN
The entry type code is 62
THEN
Set master in-bond flag M1109 and configure for transport export processing
Applied to: Entry Type 63 Master In-Bond
WHEN
The entry type code is 63
THEN
Set master in-bond flag M1109 and configure for immediate export processing
Applied to: Entry Type 69 Master In-Bond
WHEN
The entry type code is 69
THEN
Set master in-bond flag M1109 and configure for US-Canada-US movement processing
Context: A cargo record with entry type code in (61, 62, 63, 69)
GIVEN
A cargo record with entry type code in (61, 62, 63, 69)
Applied to: Set Master In-Bond Flag
WHEN
Processing disposition codes 1J, 69, or 55
THEN
Set the M1109 master in-bond flag to indicate master in-bond processing is required
Context: A cargo record with a disposition code requiring evaluation
GIVEN
A cargo record with a disposition code requiring evaluation
Applied to: Check Entry Type Code
WHEN
The entry type code is evaluated
THEN
Route to appropriate master in-bond processing based on entry type (61, 62, 63, 69) or skip if not a master in-bond type
Context: A cargo record with an entry type code
GIVEN
A cargo record with an entry type code
Applied to: Skip - Not Master In-Bond Type
WHEN
The entry type code is not 61, 62, 63, or 69
THEN
Skip master in-bond processing and continue with standard cargo processing
Context: A validated entry type code for master in-bond processing
GIVEN
A validated entry type code for master in-bond processing
Applied to: Map Entry Type to Transport Type
WHEN
The entry type requires transport type determination
THEN
Map entry type 61 to immediate transport, 62 to transport export, 63 to immediate export, and 69 to US-Canada-US movement
Context: A cargo record with disposition code requiring master in-bond processing AND entry type code is '61'
GIVEN
A cargo record with disposition code requiring master in-bond processing AND entry type code is '61'
Applied to: Entry Type 61 - Master In-Bond
WHEN
The system processes the X4 segment for master in-bond entry
THEN
The system sets the transport type to immediate transport AND sets the master in-bond flag AND processes the bond control number
Context: A cargo record with disposition code requiring master in-bond processing AND entry type code is '62'
GIVEN
A cargo record with disposition code requiring master in-bond processing AND entry type code is '62'
Applied to: Entry Type 62 - Master In-Bond
WHEN
The system processes the X4 segment for master in-bond entry
THEN
The system sets the transport type to transport for export AND sets the master in-bond flag AND processes the bond control number
Context: A cargo record with disposition code requiring master in-bond processing AND entry type code is '63'
GIVEN
A cargo record with disposition code requiring master in-bond processing AND entry type code is '63'
Applied to: Entry Type 63 - Master In-Bond
WHEN
The system processes the X4 segment for master in-bond entry
THEN
The system sets the transport type to immediate export AND sets the master in-bond flag AND processes the bond control number
Context: A cargo record with disposition code requiring master in-bond processing AND entry type code is '69'
GIVEN
A cargo record with disposition code requiring master in-bond processing AND entry type code is '69'
Applied to: Entry Type 69 - Master In-Bond
WHEN
The system processes the X4 segment for master in-bond entry
THEN
The system sets the transport type to US-Canada-US movement AND sets the master in-bond flag AND processes the bond control number
Context: A cargo record with disposition code requiring master in-bond processing AND entry type code is not '61', '62', '63', or '69'
GIVEN
A cargo record with disposition code requiring master in-bond processing AND entry type code is not '61', '62', '63', or '69'
Applied to: Other Entry Types
WHEN
The system processes the X4 segment for master in-bond entry
THEN
The system sets the transport type to default border processing ('00') AND sets the master in-bond flag AND processes the bond control number
Context: A cargo record with disposition code in ('1J', '69', '55')
GIVEN
A cargo record with disposition code in ('1J', '69', '55')
Applied to: Set Master In-Bond Flag
WHEN
The system processes the master in-bond entry
THEN
The system sets the M1109 master in-bond flag to indicate master in-bond processing is required
Context: A cargo record with an entry number from the X4 segment
GIVEN
A cargo record with an entry number from the X4 segment
Applied to: Process Bond Control Number
WHEN
The system processes the entry number format
THEN
If the entry number starts with 'V' then place it in the entry number field, otherwise place it in the in-bond control number field
Context: An entry type code from the X4 segment
GIVEN
An entry type code from the X4 segment
Applied to: Map Entry Type to Internal Transport Type
WHEN
The system maps the entry type to internal transport type
THEN
Entry type '61' maps to immediate transport, '62' maps to transport export, '63' maps to immediate export, '69' maps to US-Canada-US movement, and all others map to border processing ('00')
R-GCX016-cbl-00614 (+14) File: GCX016.cbl FDA Reference Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FDA Reference Processing':
  • Context - an n9 segment is received with reference qualifier and reference number:
    For FDA-Related Reference?:
    When the system evaluates the reference qualifier code, then the system determines if the reference is fda-related based on predefined fda qualifier codes.
  • Context - an n9 segment contains fda-related reference qualifier:
    For Extract FDA Reference Number:
    When the system processes the n9 segment, then the fda reference number is extracted from the reference identification field.
  • Context - an n9 segment contains fda-related information:
    For Extract FDA Qualifier Code:
    When the system processes the fda reference, then the fda qualifier code is extracted and stored for reference type identification.
  • Context - an fda reference number and qualifier code have been extracted:
    For Validate FDA Reference Format:
    When the system validates the reference format, then the reference is checked against fda format requirements for length, character set, and structure.
  • Context - an fda reference has been validated for format compliance:
    For Valid FDA Reference?:
    When the system evaluates validation results, then the system determines if the fda reference is valid and can be processed further.
  • Context - a valid fda reference number and qualifier have been identified:
    For Store FDA Reference in Cargo Record:
    When the system processes the fda reference for storage, then the fda reference number and qualifier are stored in the cargo record's fda reference fields.
  • Context - fda reference has been stored in the primary cargo record:
    For Update Secondary Cargo Records:
    When secondary cargo records exist for the same shipment, then all secondary cargo records are updated with the same fda reference information.
  • Context - fda reference has been stored in cargo records:
    For Link FDA Reference to Shipment:
    When the system processes shipment linkage, then the fda reference is linked to the shipment identifier for tracking and compliance purposes.
  • Context - fda reference has been linked to the shipment:
    For A1/A3 Disposition Code Present?:
    When the system evaluates disposition codes for the cargo, then the system determines if a1 or a3 disposition codes are present requiring fda compliance actions.
  • Context - a1 or a3 disposition codes are present with fda reference:
    For Process FDA Compliance Requirements:
    When the system processes fda compliance requirements, then fda-specific compliance checks and notifications are initiated based on the disposition code type.
  • Context - fda compliance requirements have been identified:
    For Set FDA Processing Flag:
    When the system processes fda requirements, then an fda processing flag is set to ensure proper handling throughout the cargo lifecycle.
  • Context - fda processing flag has been set and compliance evaluation completed:
    For Generate FDA Hold if Required:
    When fda compliance requirements mandate cargo hold, then an fda hold status is generated and applied to the cargo preventing release until fda clearance.
  • Context - fda reference processing has been completed:
    For Log FDA Reference Processing:
    When the system finalizes fda processing, then all fda reference processing activities are logged with timestamps and processing details.
  • Context - an fda reference has failed format validation:
    For Reject Invalid FDA Reference:
    When the system processes the invalid reference, then the fda reference is rejected and not stored in cargo records.
  • Context - an invalid fda reference has been rejected:
    For Generate Error Message:
    When the system processes the rejection, then an error message is generated indicating the fda reference validation failure with specific details.
👨‍💻 Technical ACs (Gherkin)
Context: An N9 segment is received with reference qualifier and reference number
GIVEN
An N9 segment is received with reference qualifier and reference number
Applied to: FDA-Related Reference?
WHEN
The system evaluates the reference qualifier code
THEN
The system determines if the reference is FDA-related based on predefined FDA qualifier codes
Context: An N9 segment contains FDA-related reference qualifier
GIVEN
An N9 segment contains FDA-related reference qualifier
Applied to: Extract FDA Reference Number
WHEN
The system processes the N9 segment
THEN
The FDA reference number is extracted from the reference identification field
Context: An N9 segment contains FDA-related information
GIVEN
An N9 segment contains FDA-related information
Applied to: Extract FDA Qualifier Code
WHEN
The system processes the FDA reference
THEN
The FDA qualifier code is extracted and stored for reference type identification
Context: An FDA reference number and qualifier code have been extracted
GIVEN
An FDA reference number and qualifier code have been extracted
Applied to: Validate FDA Reference Format
WHEN
The system validates the reference format
THEN
The reference is checked against FDA format requirements for length, character set, and structure
Context: An FDA reference has been validated for format compliance
GIVEN
An FDA reference has been validated for format compliance
Applied to: Valid FDA Reference?
WHEN
The system evaluates validation results
THEN
The system determines if the FDA reference is valid and can be processed further
Context: A valid FDA reference number and qualifier have been identified
GIVEN
A valid FDA reference number and qualifier have been identified
Applied to: Store FDA Reference in Cargo Record
WHEN
The system processes the FDA reference for storage
THEN
The FDA reference number and qualifier are stored in the cargo record's FDA reference fields
Context: FDA reference has been stored in the primary cargo record
GIVEN
FDA reference has been stored in the primary cargo record
Applied to: Update Secondary Cargo Records
WHEN
Secondary cargo records exist for the same shipment
THEN
All secondary cargo records are updated with the same FDA reference information
Context: FDA reference has been stored in cargo records
GIVEN
FDA reference has been stored in cargo records
Applied to: Link FDA Reference to Shipment
WHEN
The system processes shipment linkage
THEN
The FDA reference is linked to the shipment identifier for tracking and compliance purposes
Context: FDA reference has been linked to the shipment
GIVEN
FDA reference has been linked to the shipment
Applied to: A1/A3 Disposition Code Present?
WHEN
The system evaluates disposition codes for the cargo
THEN
The system determines if A1 or A3 disposition codes are present requiring FDA compliance actions
Context: A1 or A3 disposition codes are present with FDA reference
GIVEN
A1 or A3 disposition codes are present with FDA reference
Applied to: Process FDA Compliance Requirements
WHEN
The system processes FDA compliance requirements
THEN
FDA-specific compliance checks and notifications are initiated based on the disposition code type
Context: FDA compliance requirements have been identified
GIVEN
FDA compliance requirements have been identified
Applied to: Set FDA Processing Flag
WHEN
The system processes FDA requirements
THEN
An FDA processing flag is set to ensure proper handling throughout the cargo lifecycle
Context: FDA processing flag has been set and compliance evaluation completed
GIVEN
FDA processing flag has been set and compliance evaluation completed
Applied to: Generate FDA Hold if Required
WHEN
FDA compliance requirements mandate cargo hold
THEN
An FDA hold status is generated and applied to the cargo preventing release until FDA clearance
Context: FDA reference processing has been completed
GIVEN
FDA reference processing has been completed
Applied to: Log FDA Reference Processing
WHEN
The system finalizes FDA processing
THEN
All FDA reference processing activities are logged with timestamps and processing details
Context: An FDA reference has failed format validation
GIVEN
An FDA reference has failed format validation
Applied to: Reject Invalid FDA Reference
WHEN
The system processes the invalid reference
THEN
The FDA reference is rejected and not stored in cargo records
Context: An invalid FDA reference has been rejected
GIVEN
An invalid FDA reference has been rejected
Applied to: Generate Error Message
WHEN
The system processes the rejection
THEN
An error message is generated indicating the FDA reference validation failure with specific details
R-GCX016-cbl-00643 (+15) File: GCX016.cbl Car/Waybill Cargo Fetching Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car/Waybill Cargo Fetching':
  • Context - an n7 equipment segment is available in the message:
    For Extract Car ID from N7 Segment:
    When the system processes the n7 segment for car identification, then the car initial and car number are extracted and combined to form the complete car id.
  • Context - an x4 customs release segment contains waybill information:
    For Extract Waybill Number from X4 Segment:
    When the system processes the x4 segment for waybill identification, then the waybill number is extracted from the x4 segment data.
  • Context - car initial and car number are available from n7 segment:
    For Format Equipment ID using GCCCARFM:
    When the system needs to format the equipment id for database operations, then the gcccarfm utility is called to format the car id into standard equipment format.
  • Context - car id and waybill number have been extracted from message segments:
    For Car ID and Waybill Valid?:
    When the system validates the extracted identification data, then processing continues if both car id and waybill are valid, otherwise error handling is initiated.
  • Context - valid car id and waybill number are available:
    For Build Cargo Key with Car ID + Waybill:
    When the system prepares to search for cargo records, then a composite key is built combining the car id and waybill number for database search operations.
  • Context - a composite search key with car id and waybill is constructed:
    For Search Cargo Database by Car/Waybill Index:
    When the system searches the cargo database, then the database is queried using the car/waybill index to locate matching 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 the system determines if cargo records were found and sets appropriate processing flags.
  • Context - cargo records have been found for the car id and waybill combination:
    For Retrieve Cargo Record:
    When the system processes the search results, then the matching cargo record is retrieved from the database for further processing.
  • Context - a cargo record has been retrieved from the database:
    For Cargo Usable?:
    When the system validates the cargo record status, then the cargo record is deemed usable if it is not deleted and meets processing criteria.
  • Context - a cargo record has been validated as usable:
    For Return Cargo Record for Processing:
    When the system completes cargo retrieval operations, then the cargo record is returned for customs release processing with success status.
  • Context - initial cargo search using standard car id format has failed:
    For Try Alternative Car ID Format:
    When the system attempts alternative search strategies, then alternative car id formats are tried to locate cargo records.
  • Context - standard car id format search has failed:
    For Alternative Format Available?:
    When the system evaluates alternative search options, then the system determines if alternative car id formats can be attempted.
  • Context - exact car id matching has failed and alternative formats are available:
    For Search with Partial Car ID Match:
    When the system performs partial matching search, then the database is searched using partial car id criteria to locate potential matches.
  • Context - partial car id matching search has been performed:
    For Partial Match Found?:
    When the system evaluates the partial match results, then the system determines if acceptable cargo records were found through partial matching.
  • Context - all search attempts for cargo using car id and waybill have failed:
    For Log Car/Waybill Not Found Error:
    When the system handles the cargo not found condition, then an error is logged indicating that cargo could not be found for the specified car and waybill.
  • Context - cargo cannot be found for the specified car id and waybill combination:
    For Create Foreign Bill Entry:
    When the system handles missing cargo scenarios, then a foreign bill entry is created to handle the unmatched cargo information.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 equipment segment is available in the message
GIVEN
An N7 equipment segment is available in the message
Applied to: Extract Car ID from N7 Segment
WHEN
The system processes the N7 segment for car identification
THEN
The car initial and car number are extracted and combined to form the complete car ID
Context: An X4 customs release segment contains waybill information
GIVEN
An X4 customs release segment contains waybill information
Applied to: Extract Waybill Number from X4 Segment
WHEN
The system processes the X4 segment for waybill identification
THEN
The waybill number is extracted from the X4 segment data
Context: Car initial and car number are available from N7 segment
GIVEN
Car initial and car number are available from N7 segment
Applied to: Format Equipment ID using GCCCARFM
WHEN
The system needs to format the equipment ID for database operations
THEN
The GCCCARFM utility is called to format the car ID into standard equipment format
Context: Car ID and waybill number have been extracted from message segments
GIVEN
Car ID and waybill number have been extracted from message segments
Applied to: Car ID and Waybill Valid?
WHEN
The system validates the extracted identification data
THEN
Processing continues if both car ID and waybill are valid, otherwise error handling is initiated
Context: Valid car ID and waybill number are available
GIVEN
Valid car ID and waybill number are available
Applied to: Build Cargo Key with Car ID + Waybill
WHEN
The system prepares to search for cargo records
THEN
A composite key is built combining the car ID and waybill number for database search operations
Context: A composite search key with car ID and waybill is constructed
GIVEN
A composite search key with car ID and waybill is constructed
Applied to: Search Cargo Database by Car/Waybill Index
WHEN
The system searches the cargo database
THEN
The database is queried using the car/waybill index to locate matching 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
The system determines if cargo records were found and sets appropriate processing flags
Context: Cargo records have been found for the car ID and waybill combination
GIVEN
Cargo records have been found for the car ID and waybill combination
Applied to: Retrieve Cargo Record
WHEN
The system processes the search results
THEN
The matching cargo record is retrieved from the database for further processing
Context: A cargo record has been retrieved from the database
GIVEN
A cargo record has been retrieved from the database
Applied to: Cargo Usable?
WHEN
The system validates the cargo record status
THEN
The cargo record is deemed usable if it is not deleted and meets processing criteria
Context: A cargo record has been validated as usable
GIVEN
A cargo record has been validated as usable
Applied to: Return Cargo Record for Processing
WHEN
The system completes cargo retrieval operations
THEN
The cargo record is returned for customs release processing with success status
Context: Initial cargo search using standard car ID format has failed
GIVEN
Initial cargo search using standard car ID format has failed
Applied to: Try Alternative Car ID Format
WHEN
The system attempts alternative search strategies
THEN
Alternative car ID formats are tried to locate cargo records
Context: Standard car ID format search has failed
GIVEN
Standard car ID format search has failed
Applied to: Alternative Format Available?
WHEN
The system evaluates alternative search options
THEN
The system determines if alternative car ID formats can be attempted
Context: Exact car ID matching has failed and alternative formats are available
GIVEN
Exact car ID matching has failed and alternative formats are available
Applied to: Search with Partial Car ID Match
WHEN
The system performs partial matching search
THEN
The database is searched using partial car ID criteria to locate potential matches
Context: Partial car ID matching search has been performed
GIVEN
Partial car ID matching search has been performed
Applied to: Partial Match Found?
WHEN
The system evaluates the partial match results
THEN
The system determines if acceptable cargo records were found through partial matching
Context: All search attempts for cargo using car ID and waybill have failed
GIVEN
All search attempts for cargo using car ID and waybill have failed
Applied to: Log Car/Waybill Not Found Error
WHEN
The system handles the cargo not found condition
THEN
An error is logged indicating that cargo could not be found for the specified car and waybill
Context: Cargo cannot be found for the specified car ID and waybill combination
GIVEN
Cargo cannot be found for the specified car ID and waybill combination
Applied to: Create Foreign Bill Entry
WHEN
The system handles missing cargo scenarios
THEN
A foreign bill entry is created to handle the unmatched cargo information
R-GCX016-cbl-00659 (+6) File: GCX016.cbl CPRS Cargo Handling Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CPRS Cargo Handling':
  • Context - a cprs cargo processing request is received with disposition code and ccn key:
    For Generate CPRS Cargo Not Found Error:
    When the cprs cargo is not found in the system, then the system increments the error counter and creates error message with format 'uscs *error** dc:' + disposition code + ccn key + '*notfound*' and sets cargo not found flag and generates error report.
  • Context - a cprs cargo is found in the system with a disposition code:
    For Process Manual Release for CPRS:
    When the disposition code is mrl (manual release), then the system processes the manual release and clears the destination index and processes canadian manifest coordination.
  • Context - a cprs cargo is being processed for manual release:
    For Clear Destination Index:
    When the manual release processing is initiated, then the system clears the destination index to remove destination routing requirements.
  • Context - a cprs cargo is being processed with tax number information available:
    For Process CPRS Tax Number:
    When canadian pacific tax number is present in the cargo record, then the system processes the cprs tax number and updates tax information in the cargo record.
  • Context - a cprs cargo is being processed with cross-border status coordination requirements:
    For Find Matching Canadian Manifest:
    When canadian manifest match is required for the cargo, then the system finds the matching canadian manifest and generates log message for canadian ccn.
  • Context - a cprs cargo has been processed through disposition code handling and canadian manifest coordination:
    For Update CPRS Cargo Status:
    When all cprs processing steps are completed, then the system updates the cprs cargo status and generates cprs processing audit trail.
  • Context - a cprs cargo has completed all processing steps including status updates:
    For Generate CPRS Processing Audit Trail:
    When cprs cargo processing is finalized, then the system generates a comprehensive cprs processing audit trail for compliance and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A CPRS cargo processing request is received with disposition code and CCN key
GIVEN
A CPRS cargo processing request is received with disposition code and CCN key
Applied to: Generate CPRS Cargo Not Found Error
WHEN
The CPRS cargo is not found in the system
THEN
The system increments the error counter AND creates error message with format 'USCS *ERROR** DC:' + disposition code + CCN key + '*NotFound*' AND sets cargo not found flag AND generates error report
Context: A CPRS cargo is found in the system with a disposition code
GIVEN
A CPRS cargo is found in the system with a disposition code
Applied to: Process Manual Release for CPRS
WHEN
The disposition code is MRL (Manual Release)
THEN
The system processes the manual release AND clears the destination index AND processes Canadian manifest coordination
Context: A CPRS cargo is being processed for manual release
GIVEN
A CPRS cargo is being processed for manual release
Applied to: Clear Destination Index
WHEN
The manual release processing is initiated
THEN
The system clears the destination index to remove destination routing requirements
Context: A CPRS cargo is being processed with tax number information available
GIVEN
A CPRS cargo is being processed with tax number information available
Applied to: Process CPRS Tax Number
WHEN
Canadian Pacific tax number is present in the cargo record
THEN
The system processes the CPRS tax number AND updates tax information in the cargo record
Context: A CPRS cargo is being processed with cross-border status coordination requirements
GIVEN
A CPRS cargo is being processed with cross-border status coordination requirements
Applied to: Find Matching Canadian Manifest
WHEN
Canadian manifest match is required for the cargo
THEN
The system finds the matching Canadian manifest AND generates log message for Canadian CCN
Context: A CPRS cargo has been processed through disposition code handling and Canadian manifest coordination
GIVEN
A CPRS cargo has been processed through disposition code handling and Canadian manifest coordination
Applied to: Update CPRS Cargo Status
WHEN
All CPRS processing steps are completed
THEN
The system updates the CPRS cargo status AND generates CPRS processing audit trail
Context: A CPRS cargo has completed all processing steps including status updates
GIVEN
A CPRS cargo has completed all processing steps including status updates
Applied to: Generate CPRS Processing Audit Trail
WHEN
CPRS cargo processing is finalized
THEN
The system generates a comprehensive CPRS processing audit trail for compliance and tracking purposes
R-GCX016-cbl-00666 (+20) File: GCX016.cbl Foreign Bill Processing Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Foreign Bill Processing':
  • Context - a foreign bill is not found in the system and x4 segment data is available:
    For Create New Cargo Record:
    When the system creates a new cargo record, then the cargo record is initialized with default values including ccn key, waybill number, car information, and segment data from x4.
  • Context - a new cargo record is being created and the cargo type is cprs:
    For Set CPRS/USCS Status:
    When the system sets the cargo status, then the cargo status is set to 'error' and the status description is set to 'error'.
  • Context - a new cargo record is being created and the cargo type is not cprs:
    For Set CPRS/USCS Status:
    When the system sets the cargo status, then the cargo status is set to 'sent' and the status description is set to 'sent'.
  • Context - a new cargo record is being created and the current acknowledgment status is blank or 'ack-r':
    For Set Default Broker Information:
    When the system sets the acknowledgment status, then the acknowledgment status is set to 'ack' or 'ack-r' based on system defaults.
  • Context - a disposition code is being processed for a new cargo record:
    For Check Entry Type Code:
    When the disposition code is '1j', '69', or '55', then the cargo is flagged as master in-bond and requires entry type code processing.
  • Context - a master in-bond cargo has entry type code '61':
    For Process Master In-Bond Entry Types 61, 62, 63, 69:
    When the system processes the entry type, then the cargo is classified as immediate transport and appropriate transport flags are set.
  • Context - a master in-bond cargo has entry type code '62':
    For Process Master In-Bond Entry Types 61, 62, 63, 69:
    When the system processes the entry type, then the cargo is classified as transport for export and appropriate export flags are set.
  • Context - a master in-bond cargo has entry type code '63':
    For Process Master In-Bond Entry Types 61, 62, 63, 69:
    When the system processes the entry type, then the cargo is classified as immediate export and appropriate export flags are set.
  • Context - a master in-bond cargo has entry type code '69':
    For Process Master In-Bond Entry Types 61, 62, 63, 69:
    When the system processes the entry type, then the cargo is classified as us-canada-us movement and appropriate movement flags are set.
  • Context - a cargo has entry type code '00' or no specific entry type:
    For Process Border Entry Type Code 00:
    When the system processes the entry type, then the cargo is processed as standard border entry with default processing rules.
  • Context - a cargo is being processed as border entry type:
    For Clear Bond Information:
    When the system processes bond information, then all bond-related fields are cleared and set to default values.
  • Context - an entry number starts with the letter 'v':
    For Build M10 Manifest Information:
    When the system processes the entry number, then the entry number is placed in the entry number field and not in the in-bond control number field.
  • Context - an entry number does not start with the letter 'v':
    For Build M10 Manifest Information:
    When the system processes the entry number, then the entry number is placed in the in-bond control number field and not in the entry number field.
  • Context - m10 segment data contains scac information:
    For Set SCAC Code:
    When the system builds manifest information, then the scac code is set from the m10 segment scac field.
  • Context - an entry type code has been processed and mapped to a transport type:
    For Set Transport Type:
    When the system sets transport information, then the transport type is set according to the entry type code mapping (immediate transport, export, etc.).
  • Context - manifest data requires country code information:
    For Set Country Code:
    When the system sets country information, then the country code is set based on cargo routing and manifest requirements.
  • Context - m10 segment contains vessel and flight information:
    For Set Vessel/Flight Information:
    When the system builds manifest data, then the vessel name and flight information are set from the m10 segment data.
  • Context - x4 segment contains quantity information:
    For Set Quantity Information:
    When the system processes cargo quantities, then the cargo quantity fields are populated from the x4 segment quantity data.
  • Context - cargo and transport information has been processed:
    For Set Manifest Type Code:
    When the system determines manifest type, then the manifest type code is set based on cargo characteristics and transport mode.
  • Context - cargo processing has been completed with specific conditions:
    For Set Condition Response Code:
    When the system sets response codes, then the condition response code is set to reflect the cargo processing outcome and status.
  • Context - a new cargo record has been created and all required fields populated:
    For Store New Cargo Record:
    When the system stores the cargo record, then the cargo record is inserted into the database and becomes available for further processing.
👨‍💻 Technical ACs (Gherkin)
Context: A foreign bill is not found in the system and X4 segment data is available
GIVEN
A foreign bill is not found in the system and X4 segment data is available
Applied to: Create New Cargo Record
WHEN
The system creates a new cargo record
THEN
The cargo record is initialized with default values including CCN key, waybill number, car information, and segment data from X4
Context: A new cargo record is being created and the cargo type is CPRS
GIVEN
A new cargo record is being created and the cargo type is CPRS
Applied to: Set CPRS/USCS Status
WHEN
The system sets the cargo status
THEN
The cargo status is set to 'ERROR' and the status description is set to 'ERROR'
Context: A new cargo record is being created and the cargo type is not CPRS
GIVEN
A new cargo record is being created and the cargo type is not CPRS
Applied to: Set CPRS/USCS Status
WHEN
The system sets the cargo status
THEN
The cargo status is set to 'SENT' and the status description is set to 'SENT'
Context: A new cargo record is being created and the current acknowledgment status is blank or 'ACK-R'
GIVEN
A new cargo record is being created and the current acknowledgment status is blank or 'ACK-R'
Applied to: Set Default Broker Information
WHEN
The system sets the acknowledgment status
THEN
The acknowledgment status is set to 'ACK' or 'ACK-R' based on system defaults
Context: A disposition code is being processed for a new cargo record
GIVEN
A disposition code is being processed for a new cargo record
Applied to: Check Entry Type Code
WHEN
The disposition code is '1J', '69', or '55'
THEN
The cargo is flagged as master in-bond and requires entry type code processing
Context: A master in-bond cargo has entry type code '61'
GIVEN
A master in-bond cargo has entry type code '61'
Applied to: Process Master In-Bond Entry Types 61, 62, 63, 69
WHEN
The system processes the entry type
THEN
The cargo is classified as immediate transport and appropriate transport flags are set
Context: A master in-bond cargo has entry type code '62'
GIVEN
A master in-bond cargo has entry type code '62'
Applied to: Process Master In-Bond Entry Types 61, 62, 63, 69
WHEN
The system processes the entry type
THEN
The cargo is classified as transport for export and appropriate export flags are set
Context: A master in-bond cargo has entry type code '63'
GIVEN
A master in-bond cargo has entry type code '63'
Applied to: Process Master In-Bond Entry Types 61, 62, 63, 69
WHEN
The system processes the entry type
THEN
The cargo is classified as immediate export and appropriate export flags are set
Context: A master in-bond cargo has entry type code '69'
GIVEN
A master in-bond cargo has entry type code '69'
Applied to: Process Master In-Bond Entry Types 61, 62, 63, 69
WHEN
The system processes the entry type
THEN
The cargo is classified as US-Canada-US movement and appropriate movement flags are set
Context: A cargo has entry type code '00' or no specific entry type
GIVEN
A cargo has entry type code '00' or no specific entry type
Applied to: Process Border Entry Type Code 00
WHEN
The system processes the entry type
THEN
The cargo is processed as standard border entry with default processing rules
Context: A cargo is being processed as border entry type
GIVEN
A cargo is being processed as border entry type
Applied to: Clear Bond Information
WHEN
The system processes bond information
THEN
All bond-related fields are cleared and set to default values
Context: An entry number starts with the letter 'V'
GIVEN
An entry number starts with the letter 'V'
Applied to: Build M10 Manifest Information
WHEN
The system processes the entry number
THEN
The entry number is placed in the entry number field and not in the in-bond control number field
Context: An entry number does not start with the letter 'V'
GIVEN
An entry number does not start with the letter 'V'
Applied to: Build M10 Manifest Information
WHEN
The system processes the entry number
THEN
The entry number is placed in the in-bond control number field and not in the entry number field
Context: M10 segment data contains SCAC information
GIVEN
M10 segment data contains SCAC information
Applied to: Set SCAC Code
WHEN
The system builds manifest information
THEN
The SCAC code is set from the M10 segment SCAC field
Context: An entry type code has been processed and mapped to a transport type
GIVEN
An entry type code has been processed and mapped to a transport type
Applied to: Set Transport Type
WHEN
The system sets transport information
THEN
The transport type is set according to the entry type code mapping (immediate transport, export, etc.)
Context: Manifest data requires country code information
GIVEN
Manifest data requires country code information
Applied to: Set Country Code
WHEN
The system sets country information
THEN
The country code is set based on cargo routing and manifest requirements
Context: M10 segment contains vessel and flight information
GIVEN
M10 segment contains vessel and flight information
Applied to: Set Vessel/Flight Information
WHEN
The system builds manifest data
THEN
The vessel name and flight information are set from the M10 segment data
Context: X4 segment contains quantity information
GIVEN
X4 segment contains quantity information
Applied to: Set Quantity Information
WHEN
The system processes cargo quantities
THEN
The cargo quantity fields are populated from the X4 segment quantity data
Context: Cargo and transport information has been processed
GIVEN
Cargo and transport information has been processed
Applied to: Set Manifest Type Code
WHEN
The system determines manifest type
THEN
The manifest type code is set based on cargo characteristics and transport mode
Context: Cargo processing has been completed with specific conditions
GIVEN
Cargo processing has been completed with specific conditions
Applied to: Set Condition Response Code
WHEN
The system sets response codes
THEN
The condition response code is set to reflect the cargo processing outcome and status
Context: A new cargo record has been created and all required fields populated
GIVEN
A new cargo record has been created and all required fields populated
Applied to: Store New Cargo Record
WHEN
The system stores the cargo record
THEN
The cargo record is inserted into the database and becomes available for further processing
R-GCX016-cbl-00687 (+9) File: GCX016.cbl Car ID Matching Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car ID Matching':
  • Context - equipment information contains car identification data:
    For Extract Car ID from Equipment Information:
    When car id extraction process is initiated, then car id is extracted from equipment segment and formatted using gcccarfm utility for standardized format.
  • Context - car id has been extracted and formatted from equipment information:
    For Car ID Valid?:
    When car id validation is performed, then system determines if car id is valid for cargo matching operations or terminates matching process if invalid.
  • Context - valid car id is available and us-ccn key exists:
    For Attempt Exact Match with US-CCN Key:
    When exact match query is executed against cargo database using car id index, then system searches for cargo record that matches both car id and us-ccn key exactly.
  • Context - exact match query has been executed with car id and us-ccn key:
    For Cargo Found with US-CCN?:
    When query results are evaluated for exact match, then if cargo found with matching us-ccn, return matched cargo record, otherwise proceed to partial matching.
  • Context - exact match with us-ccn key failed and valid car id exists:
    For Attempt Partial Match without US-CCN:
    When partial match query is executed against cargo database, then system searches for cargo records matching car id only without us-ccn key requirement.
  • Context - partial match query has been executed with car id only:
    For Cargo Found without US-CCN?:
    When query results are evaluated for partial match, then if cargo found without us-ccn requirement, proceed to validation, otherwise declare match failure.
  • Context - cargo record found through partial matching with car id only:
    For Validate Cargo Record Status:
    When cargo record status validation is performed, then system checks if cargo record is in valid status for business processing.
  • Context - cargo record status validation has been completed:
    For Cargo Record Valid?:
    When validation results are evaluated, then if cargo record is valid, return partially matched cargo, otherwise declare car id match failed.
  • Context - car id is invalid or no cargo found with exact match or no cargo found with partial match or cargo record is invalid:
    For Car ID Match Failed:
    When match failure condition is detected, then system declares car id match failed and proceeds to logging.
  • Context - car id matching process has completed with success, partial success, or failure:
    For Log Car ID Match Attempt:
    When logging process is initiated, then system records car id match attempt results for audit trail and business tracking.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment information contains car identification data
GIVEN
Equipment information contains car identification data
Applied to: Extract Car ID from Equipment Information
WHEN
Car ID extraction process is initiated
THEN
Car ID is extracted from equipment segment and formatted using GCCCARFM utility for standardized format
Context: Car ID has been extracted and formatted from equipment information
GIVEN
Car ID has been extracted and formatted from equipment information
Applied to: Car ID Valid?
WHEN
Car ID validation is performed
THEN
System determines if car ID is valid for cargo matching operations or terminates matching process if invalid
Context: Valid car ID is available and US-CCN key exists
GIVEN
Valid car ID is available and US-CCN key exists
Applied to: Attempt Exact Match with US-CCN Key
WHEN
Exact match query is executed against cargo database using car ID index
THEN
System searches for cargo record that matches both car ID and US-CCN key exactly
Context: Exact match query has been executed with car ID and US-CCN key
GIVEN
Exact match query has been executed with car ID and US-CCN key
Applied to: Cargo Found with US-CCN?
WHEN
Query results are evaluated for exact match
THEN
If cargo found with matching US-CCN, return matched cargo record, otherwise proceed to partial matching
Context: Exact match with US-CCN key failed and valid car ID exists
GIVEN
Exact match with US-CCN key failed and valid car ID exists
Applied to: Attempt Partial Match without US-CCN
WHEN
Partial match query is executed against cargo database
THEN
System searches for cargo records matching car ID only without US-CCN key requirement
Context: Partial match query has been executed with car ID only
GIVEN
Partial match query has been executed with car ID only
Applied to: Cargo Found without US-CCN?
WHEN
Query results are evaluated for partial match
THEN
If cargo found without US-CCN requirement, proceed to validation, otherwise declare match failure
Context: Cargo record found through partial matching with car ID only
GIVEN
Cargo record found through partial matching with car ID only
Applied to: Validate Cargo Record Status
WHEN
Cargo record status validation is performed
THEN
System checks if cargo record is in valid status for business processing
Context: Cargo record status validation has been completed
GIVEN
Cargo record status validation has been completed
Applied to: Cargo Record Valid?
WHEN
Validation results are evaluated
THEN
If cargo record is valid, return partially matched cargo, otherwise declare car ID match failed
Context: Car ID is invalid OR no cargo found with exact match OR no cargo found with partial match OR cargo record is invalid
GIVEN
Car ID is invalid OR no cargo found with exact match OR no cargo found with partial match OR cargo record is invalid
Applied to: Car ID Match Failed
WHEN
Match failure condition is detected
THEN
System declares car ID match failed and proceeds to logging
Context: Car ID matching process has completed with success, partial success, or failure
GIVEN
Car ID matching process has completed with success, partial success, or failure
Applied to: Log Car ID Match Attempt
WHEN
Logging process is initiated
THEN
System records car ID match attempt results for audit trail and business tracking
R-GCX016-cbl-00697 (+84) File: GCX016.cbl Multi Merged 85 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Multi':
  • Context - a manifest record is being processed:
    For Lead Manifest Identified:
    When the manifest ccn key matches the saved ccn from previous processing, then the system identifies this as a lead manifest requiring follower processing.
    For Is Lead Manifest?:
    When the system evaluates the manifest type, then the system identifies whether it is a lead manifest with associated followers or a single manifest.
  • Context - a lead manifest has been identified:
    For Follower Manifests Exist?:
    When the system checks for associated follower manifests, then the system sets follower end-of-database flag based on whether follower records are found.
    For Get Follower Manifest List:
    When the system needs to process associated follower manifests, then the system retrieves the complete list of follower manifests from gcwtl-train-list.
  • Context - follower manifests exist for the lead manifest:
    For Retrieve Follower Manifest List:
    When the system initiates follower manifest retrieval, then the system calls gct0161e to retrieve all follower manifest records.
  • Context - a list of follower manifests has been retrieved:
    For Select Next Follower Manifest:
    When the system needs to process the next follower manifest, then the system selects the next available follower manifest record from the list.
    For More Followers Available?:
    When the system is iterating through the follower manifest list, then the system determines if more follower manifests are available for processing or if all have been processed.
  • Context - a follower manifest has been selected for processing:
    For Prepare EDI 350 Message for Follower:
    When the system prepares the edi message for the follower, then the system sets special action code '350' and copies disposition code, quantity, and entry number from x4 segment.
    For Format EDI 350 Message for Follower:
    When the system needs to create an edi message for the follower, then the system formats an edi 350 message with follower-specific data and parameters.
  • Context - an edi 350 message has been prepared for a follower manifest:
    For Format Message with Follower Details:
    When the system formats the message with follower details, then the system includes follower manifest ccn, cargo details, and processing instructions in the formatted message.
  • Context - a follower message has been formatted with all required details:
    For Spawn GCT0161E Transaction for Follower:
    When the system initiates follower processing, then the system spawns gct0161e transaction with the formatted follower message for independent processing.
  • Context - a follower manifest has been processed and gct0161e transaction spawned:
    For More Followers to Process?:
    When the system checks for remaining follower manifests, then the system evaluates the follower end-of-database flag to determine if more followers exist.
  • Context - all follower manifests have been processed and transactions spawned:
    For All Follower Manifests Processed:
    When no more follower manifests remain in the list, then the system sets completion status and prepares to continue with lead manifest processing.
  • Context - all follower manifests have been processed or no follower manifests exist:
    For Continue with Lead Manifest Processing:
    When the system completes follower processing workflow, then the system returns control to continue processing the original lead manifest.
  • Context - a cargo record is being processed for release verification:
    For Get Car ID and Waybill from Current Cargo:
    When the system needs to verify release status for all related cargo, then the car id and waybill number are extracted from the current cargo record and stored for subsequent cargo matching operations.
    For Retrieve Car ID and Waybill from Current Cargo:
    When the system needs to identify related cargo records by transportation unit, then the car id and waybill number are extracted from the current cargo record for use in subsequent searches.
  • Context - multi-cargo release verification is starting:
    For Initialize Cargo Scan Counter:
    When the system begins scanning related cargo records, then all cargo scan counters and release eligibility flags are reset to initial values.
  • Context - car id and waybill criteria are established:
    For Fetch All Cargo Records Matching Car ID and Waybill:
    When the system searches for related cargo records, then all cargo records matching the car id and waybill combination are retrieved and made available for release verification processing.
  • Context - cargo records are being scanned for release verification:
    For More Cargo Records?:
    When the system checks for remaining unprocessed cargo records, then if more cargo records exist, processing continues with the next record, otherwise the verification analysis phase begins.
  • Context - additional cargo records are available for processing:
    For Get Next Cargo Record:
    When the system continues the release verification scan, then the next cargo record matching the car id and waybill is retrieved and made current for release status checking.
  • Context - a cargo record is being evaluated for release verification:
    For Check Cargo Release Status:
    When the system checks the cargo's current release status, then the cargo's release status is determined and used to direct further validation checks.
  • Context - cargo release status has been evaluated:
    For Is Cargo Released?:
    When the system determines if the cargo is currently in released status, then if cargo is not released, active hold checks are performed, otherwise manual release flag validation is conducted.
  • Context - cargo is not currently in released status:
    For Check for Active Holds:
    When the system checks for active hold conditions on the cargo, then all active hold flags and conditions are evaluated to determine if holds exist that prevent release.
  • Context - active hold conditions have been checked:
    For Has Active Holds?:
    When the system evaluates whether active holds exist, then if active holds are present, cargo is marked as not release eligible, otherwise manual release flag checking continues.
  • Context - cargo has active hold conditions:
    For Mark as Not Release Eligible:
    When the system processes cargo with active holds, then the cargo is marked as not eligible for release and the release eligibility counter is updated accordingly.
  • Context - cargo does not have active holds or is in released status:
    For Check Manual Release Flag:
    When the system checks for manual release authorization, then the manual release flag is evaluated to determine if special release authorization has been granted.
  • Context - manual release flag has been checked:
    For Manually Released?:
    When the system evaluates manual release authorization, then if manual release is authorized, cargo is marked as release eligible, otherwise quantity validation is performed.
  • Context - cargo has manual release authorization or passes all validation checks:
    For Mark as Release Eligible:
    When the system processes cargo with release authorization, then the cargo is marked as eligible for release and the release eligibility counter is updated.
  • Context - cargo does not have manual release authorization:
    For Check Quantity Validation:
    When the system performs quantity validation for release eligibility, then cargo quantities are compared against expected values and release thresholds to determine validation status.
  • Context - quantity validation has been performed:
    For Quantities Match?:
    When the system evaluates whether quantities match requirements, then if quantities match, cargo is marked as release eligible, otherwise cargo is marked for partial release.
  • Context - cargo quantities do not match full release requirements:
    For Mark as Partial Release:
    When the system processes cargo with quantity mismatches, then the cargo is marked for partial release status and the release eligibility counter is updated to reflect partial release.
  • Context - cargo release eligibility has been determined:
    For Update Release Eligibility Counter:
    When the system updates release verification statistics, then release eligibility counters are incremented based on the cargo's determined status (eligible, not eligible, or partial).
  • Context - current cargo record processing is complete:
    For Move to Next Cargo Record:
    When the system continues the multi-cargo verification process, then the system positions to process the next cargo record in the car id and waybill group.
  • Context - all cargo records for the car id and waybill have been processed:
    For Analyze Overall Release Status:
    When the system analyzes overall release verification results, then individual cargo release statuses are consolidated to determine the overall release eligibility for the entire car and waybill group.
  • Context - overall release status analysis is complete:
    For All Cargo Release Eligible?:
    When the system determines final release authorization, then if all cargo is release eligible, overall status is set to yes, otherwise overall status is set to no.
  • Context - all cargo in the car and waybill group is release eligible:
    For Set Overall Release Status = YES:
    When the system sets final release authorization, then the overall release status is set to yes, indicating full authorization for release of all cargo.
  • Context - one or more cargo records in the car and waybill group are not release eligible:
    For Set Overall Release Status = NO:
    When the system sets final release authorization, then the overall release status is set to no, preventing release of the entire car and waybill group.
  • Context - release verification analysis is complete:
    For Generate Release Verification Report:
    When the system generates verification documentation, then a detailed report is created showing all cargo evaluated, their individual statuses, and the final overall release determination.
  • Context - release verification process is complete and documented:
    For Return Release Verification Result:
    When the system returns verification results, then the final release status (yes/no) and supporting verification details are returned to enable appropriate cargo handling decisions.
  • Context - an error message has been generated and requires routing:
    For Set Primary Destination User:
    When the system determines the message type and attempts to set the primary destination user, then the primary destination user is identified and validated for message routing.
  • Context - a primary destination user has been identified:
    For Is Primary User Valid?:
    When the system validates the primary user credentials and routing permissions, then the system determines if the primary user is valid and can receive the message.
  • Context - the primary user has been validated as a valid recipient:
    For Route to Primary User:
    When the system processes the routing request, then the error message is routed to the primary user destination.
  • Context - the primary user has been determined to be invalid:
    For Route to Default Error User:
    When the system needs to route the error message, then the error message is routed to the default error user destination.
  • Context - the error message has been routed to either primary or default error user:
    For Additional Recipients Required?:
    When the system evaluates the message type and routing requirements, then the system determines whether additional recipients are required for this message type.
  • Context - additional recipients have been determined to be required:
    For Identify Secondary Recipients:
    When the system processes the secondary recipient identification logic, then the system identifies all secondary recipients that should receive the error message.
  • Context - secondary recipients have been identified:
    For Check Secondary User Validity:
    When the system validates each secondary user's credentials and routing permissions, then the system determines which secondary users are valid recipients.
  • Context - a secondary user has been validated as a valid recipient:
    For Add Valid Secondary User to Route List:
    When the system processes the routing list update, then the valid secondary user is added to the message routing list.
  • Context - a secondary user has been determined to be invalid:
    For Skip Invalid Secondary User:
    When the system processes the routing list, then the invalid secondary user is skipped and not added to the routing list.
  • Context - all valid recipients have been identified and added to the routing list:
    For Set Message Keywords for Categorization:
    When the system processes message categorization requirements, then appropriate keywords are set for message categorization and proper routing.
  • Context - message keywords have been set for categorization:
    For Export Container Type?:
    When the system evaluates the message content and type, then the system determines if this is an export container type message.
  • Context - the message has been determined to be an export container type:
    For Route to USEXP Basket:
    When the system processes the specialized routing requirement, then the message is routed to the usexp basket for export container processing.
  • Context - the message has been determined to not be an export container type:
    For Route to Standard Error Basket:
    When the system processes the standard routing requirement, then the message is routed to the standard error basket for general error processing.
  • Context - all routing destinations have been determined and validated:
    For Send Message to All Valid Destinations:
    When the system executes the message delivery process, then the error message is successfully sent to all valid destinations in the routing list.
  • Context - the error message has been sent to all valid destinations:
    For Log Routing Information:
    When the system processes the logging requirements, then routing information including destinations and delivery status is logged for audit purposes.
  • Context - a lead manifest is identified for processing:
    For Check for Follower Manifests:
    When the system checks if the lead manifest ccn matches the saved ccn from previous processing, then the system identifies whether follower manifests exist and need to be processed.
  • Context - follower manifests are found for a lead manifest:
    For Initialize Follower Processing:
    When the system initiates follower processing, then the follower end-of-database flag is reset and processing begins.
  • Context - follower manifest processing is in progress:
    For More Followers to Process?:
    When the system checks the follower end-of-database flag, then processing continues if more followers exist or terminates if all followers are processed.
  • Context - a follower manifest is selected for processing:
    For Prepare EDI 350 Message for Follower:
    When the system prepares the edi message, then the special action code is set to '350', disposition code is copied from x4 segment, quantity is transferred, and entry number is populated.
  • Context - edi 350 message is prepared for a follower manifest:
    For Spawn GCT0161E Transaction:
    When the system spawns the gct0161e transaction, then the follower manifest is submitted for independent cargo processing with the prepared message data.
  • Context - a follower manifest has been submitted for processing via gct0161e:
    For Processing Successful?:
    When the processing transaction completes, then the system determines if the processing was successful or encountered errors.
  • Context - a follower manifest processing attempt has completed (either successfully or with errors):
    For Continue to Next Follower:
    When the system continues processing, then the next follower manifest in the sequence is selected for processing.
  • Context - all follower manifests associated with a lead manifest have been processed:
    For Complete Multi-manifest Processing:
    When no more followers remain in the processing queue, then the multi-manifest processing operation is marked as complete and control returns to the main processing flow.
  • Context - more follower manifests are available for processing:
    For Select Next Follower Manifest:
    When the system needs to process the next follower manifest, then the system selects and loads the next follower manifest from the list.
  • Context - an edi 350 message has been formatted for a follower manifest:
    For Prepare Message Array for Follower:
    When the system needs to prepare the message for transaction spawning, then the system populates the edi message array with the formatted follower manifest data.
  • Context - the message array has been prepared for a follower manifest:
    For Set Follower Manifest Parameters:
    When the system needs to configure processing parameters, then the system sets follower-specific parameters including manifest identifiers and processing flags.
  • Context - follower manifest parameters have been configured:
    For Spawn GCT0161E Transaction:
    When the system is ready to process the follower manifest, then the system spawns a gct0161e transaction with the prepared message array and parameters.
  • Context - a gct0161e transaction has been attempted for a follower manifest:
    For Transaction Spawn Successful?:
    When the system receives the spawn response, then the system determines if the transaction spawn was successful or failed.
  • Context - a gct0161e transaction was successfully spawned for a follower manifest:
    For Log Follower Processing Success:
    When the system confirms successful transaction spawn, then the system logs the successful follower manifest processing to the transaction log.
  • Context - a gct0161e transaction spawn failed for a follower manifest:
    For Log Spawn Error:
    When the system detects the spawn failure, then the system logs the spawn error details to the transaction log for troubleshooting.
  • Context - a follower manifest has been successfully processed:
    For Move to Next Follower:
    When the system needs to continue with remaining followers, then the system moves to the next follower manifest in the list for processing.
  • Context - a transaction spawn error has been logged for a follower manifest:
    For Continue with Next Follower:
    When the system needs to continue processing remaining followers, then the system continues with the next follower manifest without stopping the entire process.
  • Context - the system has iterated through all follower manifests in the list:
    For All Followers Processed:
    When no more follower manifests are available for processing, then the system confirms that all follower manifests have been processed.
  • Context - all follower manifests have been processed:
    For Update Lead Manifest Status:
    When the system needs to finalize the lead manifest processing, then the system updates the lead manifest status to reflect completion of follower processing.
  • Context - the lead manifest status has been updated after follower processing:
    For Complete Multi-manifest Processing:
    When all multi-manifest processing tasks are complete, then the system completes the multi-manifest processing workflow and returns control.
  • Context - a manifest is not identified as a lead manifest:
    For Skip - Single Manifest Only:
    When the system evaluates the manifest for multi-manifest processing, then the system skips follower processing and proceeds directly to completion.
  • Context - a car id and waybill number have been identified from a cargo record:
    For Search All Cargo Records with Matching Car ID and Waybill:
    When the system searches for all related cargo records, then all cargo records matching the same car id and waybill combination are retrieved for group processing.
  • Context - a search has been performed for cargo records matching a car id and waybill:
    For More Cargo Records Found?:
    When the system processes the search results, then each cargo record in the result set is processed individually until all records are evaluated.
  • Context - a cargo record is being evaluated for release eligibility:
    For Is Cargo Already Released?:
    When the cargo status indicates it has already been released, then the cargo is excluded from further release processing and the system continues to the next cargo record.
  • Context - a cargo record that is not already released is being evaluated:
    For Are There Active Holds?:
    When the system checks for active hold conditions, then if active holds exist, the cargo requires manual release authorization; if no active holds exist, the cargo is eligible for release.
  • Context - a cargo record has active holds that would normally prevent release:
    For Is Manual Release Set?:
    When manual release authorization has been granted for the cargo, then the cargo is marked as release eligible despite the active holds.
  • Context - a cargo record has been evaluated and either has no active holds or has manual release authorization:
    For Mark Cargo as Release Eligible:
    When the release eligibility determination is made, then the cargo is marked as release eligible and added to the release eligible list.
  • Context - a cargo record has active holds and no manual release authorization has been granted:
    For Mark Cargo as Not Release Eligible:
    When the release eligibility determination is made, then the cargo is marked as not release eligible and added to the hold list.
  • Context - cargo records are being processed for a specific car id and waybill combination:
    For All Cargo Records Processed?:
    When the system checks if all matching records have been evaluated, then if all records are processed, proceed to generate release verification summary; otherwise continue processing remaining records.
  • Context - all cargo records for a car id and waybill combination have been evaluated for release eligibility:
    For Generate Release Verification Summary:
    When the system generates the verification summary, then a summary report is created showing which cargo records are release eligible and which are held, along with the reasons for hold status.
  • Context - release verification has been completed for all cargo records matching a car id and waybill:
    For Update Release Eligibility Status for All Matching Cargo:
    When the system updates the release eligibility status, then all cargo records in the group have their release eligibility status updated based on the verification results.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record is being processed
GIVEN
A manifest record is being processed
Applied to: Lead Manifest Identified
WHEN
The manifest CCN key matches the saved CCN from previous processing
THEN
The system identifies this as a lead manifest requiring follower processing
Applied to: Is Lead Manifest?
WHEN
The system evaluates the manifest type
THEN
The system identifies whether it is a lead manifest with associated followers or a single manifest
Context: A lead manifest has been identified
GIVEN
A lead manifest has been identified
Applied to: Follower Manifests Exist?
WHEN
The system checks for associated follower manifests
THEN
The system sets follower end-of-database flag based on whether follower records are found
Applied to: Get Follower Manifest List
WHEN
The system needs to process associated follower manifests
THEN
The system retrieves the complete list of follower manifests from GCWTL-TRAIN-LIST
Context: Follower manifests exist for the lead manifest
GIVEN
Follower manifests exist for the lead manifest
Applied to: Retrieve Follower Manifest List
WHEN
The system initiates follower manifest retrieval
THEN
The system calls GCT0161E to retrieve all follower manifest records
Context: A list of follower manifests has been retrieved
GIVEN
A list of follower manifests has been retrieved
Applied to: Select Next Follower Manifest
WHEN
The system needs to process the next follower manifest
THEN
The system selects the next available follower manifest record from the list
Applied to: More Followers Available?
WHEN
The system is iterating through the follower manifest list
THEN
The system determines if more follower manifests are available for processing or if all have been processed
Context: A follower manifest has been selected for processing
GIVEN
A follower manifest has been selected for processing
Applied to: Prepare EDI 350 Message for Follower
WHEN
The system prepares the EDI message for the follower
THEN
The system sets special action code '350' and copies disposition code, quantity, and entry number from X4 segment
Applied to: Format EDI 350 Message for Follower
WHEN
The system needs to create an EDI message for the follower
THEN
The system formats an EDI 350 message with follower-specific data and parameters
Context: An EDI 350 message has been prepared for a follower manifest
GIVEN
An EDI 350 message has been prepared for a follower manifest
Applied to: Format Message with Follower Details
WHEN
The system formats the message with follower details
THEN
The system includes follower manifest CCN, cargo details, and processing instructions in the formatted message
Context: A follower message has been formatted with all required details
GIVEN
A follower message has been formatted with all required details
Applied to: Spawn GCT0161E Transaction for Follower
WHEN
The system initiates follower processing
THEN
The system spawns GCT0161E transaction with the formatted follower message for independent processing
Context: A follower manifest has been processed and GCT0161E transaction spawned
GIVEN
A follower manifest has been processed and GCT0161E transaction spawned
Applied to: More Followers to Process?
WHEN
The system checks for remaining follower manifests
THEN
The system evaluates the follower end-of-database flag to determine if more followers exist
Context: All follower manifests have been processed and transactions spawned
GIVEN
All follower manifests have been processed and transactions spawned
Applied to: All Follower Manifests Processed
WHEN
No more follower manifests remain in the list
THEN
The system sets completion status and prepares to continue with lead manifest processing
Context: All follower manifests have been processed OR no follower manifests exist
GIVEN
All follower manifests have been processed OR no follower manifests exist
Applied to: Continue with Lead Manifest Processing
WHEN
The system completes follower processing workflow
THEN
The system returns control to continue processing the original lead manifest
Context: A cargo record is being processed for release verification
GIVEN
A cargo record is being processed for release verification
Applied to: Get Car ID and Waybill from Current Cargo
WHEN
The system needs to verify release status for all related cargo
THEN
The car ID and waybill number are extracted from the current cargo record and stored for subsequent cargo matching operations
Applied to: Retrieve Car ID and Waybill from Current Cargo
WHEN
The system needs to identify related cargo records by transportation unit
THEN
The car ID and waybill number are extracted from the current cargo record for use in subsequent searches
Context: Multi-cargo release verification is starting
GIVEN
Multi-cargo release verification is starting
Applied to: Initialize Cargo Scan Counter
WHEN
The system begins scanning related cargo records
THEN
All cargo scan counters and release eligibility flags are reset to initial values
Context: Car ID and waybill criteria are established
GIVEN
Car ID and waybill criteria are established
Applied to: Fetch All Cargo Records Matching Car ID and Waybill
WHEN
The system searches for related cargo records
THEN
All cargo records matching the car ID and waybill combination are retrieved and made available for release verification processing
Context: Cargo records are being scanned for release verification
GIVEN
Cargo records are being scanned for release verification
Applied to: More Cargo Records?
WHEN
The system checks for remaining unprocessed cargo records
THEN
If more cargo records exist, processing continues with the next record, otherwise the verification analysis phase begins
Context: Additional cargo records are available for processing
GIVEN
Additional cargo records are available for processing
Applied to: Get Next Cargo Record
WHEN
The system continues the release verification scan
THEN
The next cargo record matching the car ID and waybill is retrieved and made current for release status checking
Context: A cargo record is being evaluated for release verification
GIVEN
A cargo record is being evaluated for release verification
Applied to: Check Cargo Release Status
WHEN
The system checks the cargo's current release status
THEN
The cargo's release status is determined and used to direct further validation checks
Context: Cargo release status has been evaluated
GIVEN
Cargo release status has been evaluated
Applied to: Is Cargo Released?
WHEN
The system determines if the cargo is currently in released status
THEN
If cargo is not released, active hold checks are performed, otherwise manual release flag validation is conducted
Context: Cargo is not currently in released status
GIVEN
Cargo is not currently in released status
Applied to: Check for Active Holds
WHEN
The system checks for active hold conditions on the cargo
THEN
All active hold flags and conditions are evaluated to determine if holds exist that prevent release
Context: Active hold conditions have been checked
GIVEN
Active hold conditions have been checked
Applied to: Has Active Holds?
WHEN
The system evaluates whether active holds exist
THEN
If active holds are present, cargo is marked as not release eligible, otherwise manual release flag checking continues
Context: Cargo has active hold conditions
GIVEN
Cargo has active hold conditions
Applied to: Mark as Not Release Eligible
WHEN
The system processes cargo with active holds
THEN
The cargo is marked as not eligible for release and the release eligibility counter is updated accordingly
Context: Cargo does not have active holds or is in released status
GIVEN
Cargo does not have active holds or is in released status
Applied to: Check Manual Release Flag
WHEN
The system checks for manual release authorization
THEN
The manual release flag is evaluated to determine if special release authorization has been granted
Context: Manual release flag has been checked
GIVEN
Manual release flag has been checked
Applied to: Manually Released?
WHEN
The system evaluates manual release authorization
THEN
If manual release is authorized, cargo is marked as release eligible, otherwise quantity validation is performed
Context: Cargo has manual release authorization or passes all validation checks
GIVEN
Cargo has manual release authorization or passes all validation checks
Applied to: Mark as Release Eligible
WHEN
The system processes cargo with release authorization
THEN
The cargo is marked as eligible for release and the release eligibility counter is updated
Context: Cargo does not have manual release authorization
GIVEN
Cargo does not have manual release authorization
Applied to: Check Quantity Validation
WHEN
The system performs quantity validation for release eligibility
THEN
Cargo quantities are compared against expected values and release thresholds to determine validation status
Context: Quantity validation has been performed
GIVEN
Quantity validation has been performed
Applied to: Quantities Match?
WHEN
The system evaluates whether quantities match requirements
THEN
If quantities match, cargo is marked as release eligible, otherwise cargo is marked for partial release
Context: Cargo quantities do not match full release requirements
GIVEN
Cargo quantities do not match full release requirements
Applied to: Mark as Partial Release
WHEN
The system processes cargo with quantity mismatches
THEN
The cargo is marked for partial release status and the release eligibility counter is updated to reflect partial release
Context: Cargo release eligibility has been determined
GIVEN
Cargo release eligibility has been determined
Applied to: Update Release Eligibility Counter
WHEN
The system updates release verification statistics
THEN
Release eligibility counters are incremented based on the cargo's determined status (eligible, not eligible, or partial)
Context: Current cargo record processing is complete
GIVEN
Current cargo record processing is complete
Applied to: Move to Next Cargo Record
WHEN
The system continues the multi-cargo verification process
THEN
The system positions to process the next cargo record in the car ID and waybill group
Context: All cargo records for the car ID and waybill have been processed
GIVEN
All cargo records for the car ID and waybill have been processed
Applied to: Analyze Overall Release Status
WHEN
The system analyzes overall release verification results
THEN
Individual cargo release statuses are consolidated to determine the overall release eligibility for the entire car and waybill group
Context: Overall release status analysis is complete
GIVEN
Overall release status analysis is complete
Applied to: All Cargo Release Eligible?
WHEN
The system determines final release authorization
THEN
If all cargo is release eligible, overall status is set to YES, otherwise overall status is set to NO
Context: All cargo in the car and waybill group is release eligible
GIVEN
All cargo in the car and waybill group is release eligible
Applied to: Set Overall Release Status = YES
WHEN
The system sets final release authorization
THEN
The overall release status is set to YES, indicating full authorization for release of all cargo
Context: One or more cargo records in the car and waybill group are not release eligible
GIVEN
One or more cargo records in the car and waybill group are not release eligible
Applied to: Set Overall Release Status = NO
WHEN
The system sets final release authorization
THEN
The overall release status is set to NO, preventing release of the entire car and waybill group
Context: Release verification analysis is complete
GIVEN
Release verification analysis is complete
Applied to: Generate Release Verification Report
WHEN
The system generates verification documentation
THEN
A detailed report is created showing all cargo evaluated, their individual statuses, and the final overall release determination
Context: Release verification process is complete and documented
GIVEN
Release verification process is complete and documented
Applied to: Return Release Verification Result
WHEN
The system returns verification results
THEN
The final release status (YES/NO) and supporting verification details are returned to enable appropriate cargo handling decisions
Context: An error message has been generated and requires routing
GIVEN
An error message has been generated and requires routing
Applied to: Set Primary Destination User
WHEN
The system determines the message type and attempts to set the primary destination user
THEN
The primary destination user is identified and validated for message routing
Context: A primary destination user has been identified
GIVEN
A primary destination user has been identified
Applied to: Is Primary User Valid?
WHEN
The system validates the primary user credentials and routing permissions
THEN
The system determines if the primary user is valid and can receive the message
Context: The primary user has been validated as a valid recipient
GIVEN
The primary user has been validated as a valid recipient
Applied to: Route to Primary User
WHEN
The system processes the routing request
THEN
The error message is routed to the primary user destination
Context: The primary user has been determined to be invalid
GIVEN
The primary user has been determined to be invalid
Applied to: Route to Default Error User
WHEN
The system needs to route the error message
THEN
The error message is routed to the default error user destination
Context: The error message has been routed to either primary or default error user
GIVEN
The error message has been routed to either primary or default error user
Applied to: Additional Recipients Required?
WHEN
The system evaluates the message type and routing requirements
THEN
The system determines whether additional recipients are required for this message type
Context: Additional recipients have been determined to be required
GIVEN
Additional recipients have been determined to be required
Applied to: Identify Secondary Recipients
WHEN
The system processes the secondary recipient identification logic
THEN
The system identifies all secondary recipients that should receive the error message
Context: Secondary recipients have been identified
GIVEN
Secondary recipients have been identified
Applied to: Check Secondary User Validity
WHEN
The system validates each secondary user's credentials and routing permissions
THEN
The system determines which secondary users are valid recipients
Context: A secondary user has been validated as a valid recipient
GIVEN
A secondary user has been validated as a valid recipient
Applied to: Add Valid Secondary User to Route List
WHEN
The system processes the routing list update
THEN
The valid secondary user is added to the message routing list
Context: A secondary user has been determined to be invalid
GIVEN
A secondary user has been determined to be invalid
Applied to: Skip Invalid Secondary User
WHEN
The system processes the routing list
THEN
The invalid secondary user is skipped and not added to the routing list
Context: All valid recipients have been identified and added to the routing list
GIVEN
All valid recipients have been identified and added to the routing list
Applied to: Set Message Keywords for Categorization
WHEN
The system processes message categorization requirements
THEN
Appropriate keywords are set for message categorization and proper routing
Context: Message keywords have been set for categorization
GIVEN
Message keywords have been set for categorization
Applied to: Export Container Type?
WHEN
The system evaluates the message content and type
THEN
The system determines if this is an export container type message
Context: The message has been determined to be an export container type
GIVEN
The message has been determined to be an export container type
Applied to: Route to USEXP Basket
WHEN
The system processes the specialized routing requirement
THEN
The message is routed to the USEXP basket for export container processing
Context: The message has been determined to not be an export container type
GIVEN
The message has been determined to not be an export container type
Applied to: Route to Standard Error Basket
WHEN
The system processes the standard routing requirement
THEN
The message is routed to the standard error basket for general error processing
Context: All routing destinations have been determined and validated
GIVEN
All routing destinations have been determined and validated
Applied to: Send Message to All Valid Destinations
WHEN
The system executes the message delivery process
THEN
The error message is successfully sent to all valid destinations in the routing list
Context: The error message has been sent to all valid destinations
GIVEN
The error message has been sent to all valid destinations
Applied to: Log Routing Information
WHEN
The system processes the logging requirements
THEN
Routing information including destinations and delivery status is logged for audit purposes
Context: A lead manifest is identified for processing
GIVEN
A lead manifest is identified for processing
Applied to: Check for Follower Manifests
WHEN
The system checks if the lead manifest CCN matches the saved CCN from previous processing
THEN
The system identifies whether follower manifests exist and need to be processed
Context: Follower manifests are found for a lead manifest
GIVEN
Follower manifests are found for a lead manifest
Applied to: Initialize Follower Processing
WHEN
The system initiates follower processing
THEN
The follower end-of-database flag is reset and processing begins
Context: Follower manifest processing is in progress
GIVEN
Follower manifest processing is in progress
Applied to: More Followers to Process?
WHEN
The system checks the follower end-of-database flag
THEN
Processing continues if more followers exist or terminates if all followers are processed
Context: A follower manifest is selected for processing
GIVEN
A follower manifest is selected for processing
Applied to: Prepare EDI 350 Message for Follower
WHEN
The system prepares the EDI message
THEN
The special action code is set to '350', disposition code is copied from X4 segment, quantity is transferred, and entry number is populated
Context: EDI 350 message is prepared for a follower manifest
GIVEN
EDI 350 message is prepared for a follower manifest
Applied to: Spawn GCT0161E Transaction
WHEN
The system spawns the GCT0161E transaction
THEN
The follower manifest is submitted for independent cargo processing with the prepared message data
Context: A follower manifest has been submitted for processing via GCT0161E
GIVEN
A follower manifest has been submitted for processing via GCT0161E
Applied to: Processing Successful?
WHEN
The processing transaction completes
THEN
The system determines if the processing was successful or encountered errors
Context: A follower manifest processing attempt has completed (either successfully or with errors)
GIVEN
A follower manifest processing attempt has completed (either successfully or with errors)
Applied to: Continue to Next Follower
WHEN
The system continues processing
THEN
The next follower manifest in the sequence is selected for processing
Context: All follower manifests associated with a lead manifest have been processed
GIVEN
All follower manifests associated with a lead manifest have been processed
Applied to: Complete Multi-manifest Processing
WHEN
No more followers remain in the processing queue
THEN
The multi-manifest processing operation is marked as complete and control returns to the main processing flow
Context: More follower manifests are available for processing
GIVEN
More follower manifests are available for processing
Applied to: Select Next Follower Manifest
WHEN
The system needs to process the next follower manifest
THEN
The system selects and loads the next follower manifest from the list
Context: An EDI 350 message has been formatted for a follower manifest
GIVEN
An EDI 350 message has been formatted for a follower manifest
Applied to: Prepare Message Array for Follower
WHEN
The system needs to prepare the message for transaction spawning
THEN
The system populates the EDI message array with the formatted follower manifest data
Context: The message array has been prepared for a follower manifest
GIVEN
The message array has been prepared for a follower manifest
Applied to: Set Follower Manifest Parameters
WHEN
The system needs to configure processing parameters
THEN
The system sets follower-specific parameters including manifest identifiers and processing flags
Context: Follower manifest parameters have been configured
GIVEN
Follower manifest parameters have been configured
Applied to: Spawn GCT0161E Transaction
WHEN
The system is ready to process the follower manifest
THEN
The system spawns a GCT0161E transaction with the prepared message array and parameters
Context: A GCT0161E transaction has been attempted for a follower manifest
GIVEN
A GCT0161E transaction has been attempted for a follower manifest
Applied to: Transaction Spawn Successful?
WHEN
The system receives the spawn response
THEN
The system determines if the transaction spawn was successful or failed
Context: A GCT0161E transaction was successfully spawned for a follower manifest
GIVEN
A GCT0161E transaction was successfully spawned for a follower manifest
Applied to: Log Follower Processing Success
WHEN
The system confirms successful transaction spawn
THEN
The system logs the successful follower manifest processing to the transaction log
Context: A GCT0161E transaction spawn failed for a follower manifest
GIVEN
A GCT0161E transaction spawn failed for a follower manifest
Applied to: Log Spawn Error
WHEN
The system detects the spawn failure
THEN
The system logs the spawn error details to the transaction log for troubleshooting
Context: A follower manifest has been successfully processed
GIVEN
A follower manifest has been successfully processed
Applied to: Move to Next Follower
WHEN
The system needs to continue with remaining followers
THEN
The system moves to the next follower manifest in the list for processing
Context: A transaction spawn error has been logged for a follower manifest
GIVEN
A transaction spawn error has been logged for a follower manifest
Applied to: Continue with Next Follower
WHEN
The system needs to continue processing remaining followers
THEN
The system continues with the next follower manifest without stopping the entire process
Context: The system has iterated through all follower manifests in the list
GIVEN
The system has iterated through all follower manifests in the list
Applied to: All Followers Processed
WHEN
No more follower manifests are available for processing
THEN
The system confirms that all follower manifests have been processed
Context: All follower manifests have been processed
GIVEN
All follower manifests have been processed
Applied to: Update Lead Manifest Status
WHEN
The system needs to finalize the lead manifest processing
THEN
The system updates the lead manifest status to reflect completion of follower processing
Context: The lead manifest status has been updated after follower processing
GIVEN
The lead manifest status has been updated after follower processing
Applied to: Complete Multi-manifest Processing
WHEN
All multi-manifest processing tasks are complete
THEN
The system completes the multi-manifest processing workflow and returns control
Context: A manifest is not identified as a lead manifest
GIVEN
A manifest is not identified as a lead manifest
Applied to: Skip - Single Manifest Only
WHEN
The system evaluates the manifest for multi-manifest processing
THEN
The system skips follower processing and proceeds directly to completion
Context: A car ID and waybill number have been identified from a cargo record
GIVEN
A car ID and waybill number have been identified from a cargo record
Applied to: Search All Cargo Records with Matching Car ID and Waybill
WHEN
The system searches for all related cargo records
THEN
All cargo records matching the same car ID and waybill combination are retrieved for group processing
Context: A search has been performed for cargo records matching a car ID and waybill
GIVEN
A search has been performed for cargo records matching a car ID and waybill
Applied to: More Cargo Records Found?
WHEN
The system processes the search results
THEN
Each cargo record in the result set is processed individually until all records are evaluated
Context: A cargo record is being evaluated for release eligibility
GIVEN
A cargo record is being evaluated for release eligibility
Applied to: Is Cargo Already Released?
WHEN
The cargo status indicates it has already been released
THEN
The cargo is excluded from further release processing and the system continues to the next cargo record
Context: A cargo record that is not already released is being evaluated
GIVEN
A cargo record that is not already released is being evaluated
Applied to: Are There Active Holds?
WHEN
The system checks for active hold conditions
THEN
If active holds exist, the cargo requires manual release authorization; if no active holds exist, the cargo is eligible for release
Context: A cargo record has active holds that would normally prevent release
GIVEN
A cargo record has active holds that would normally prevent release
Applied to: Is Manual Release Set?
WHEN
Manual release authorization has been granted for the cargo
THEN
The cargo is marked as release eligible despite the active holds
Context: A cargo record has been evaluated and either has no active holds or has manual release authorization
GIVEN
A cargo record has been evaluated and either has no active holds or has manual release authorization
Applied to: Mark Cargo as Release Eligible
WHEN
The release eligibility determination is made
THEN
The cargo is marked as release eligible and added to the release eligible list
Context: A cargo record has active holds and no manual release authorization has been granted
GIVEN
A cargo record has active holds and no manual release authorization has been granted
Applied to: Mark Cargo as Not Release Eligible
WHEN
The release eligibility determination is made
THEN
The cargo is marked as not release eligible and added to the hold list
Context: Cargo records are being processed for a specific car ID and waybill combination
GIVEN
Cargo records are being processed for a specific car ID and waybill combination
Applied to: All Cargo Records Processed?
WHEN
The system checks if all matching records have been evaluated
THEN
If all records are processed, proceed to generate release verification summary; otherwise continue processing remaining records
Context: All cargo records for a car ID and waybill combination have been evaluated for release eligibility
GIVEN
All cargo records for a car ID and waybill combination have been evaluated for release eligibility
Applied to: Generate Release Verification Summary
WHEN
The system generates the verification summary
THEN
A summary report is created showing which cargo records are release eligible and which are held, along with the reasons for hold status
Context: Release verification has been completed for all cargo records matching a car ID and waybill
GIVEN
Release verification has been completed for all cargo records matching a car ID and waybill
Applied to: Update Release Eligibility Status for All Matching Cargo
WHEN
The system updates the release eligibility status
THEN
All cargo records in the group have their release eligibility status updated based on the verification results
R-GCX016-cbl-00715 (+24) File: GCX016.cbl Disposition Code Table Lookup Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Table Lookup':
  • Context - an x4 customs release segment is being processed:
    For Extract Disposition Code from X4 Segment:
    When the system needs to identify the disposition code, then the disposition code is extracted from the x4 segment and stored for lookup processing.
  • Context - a disposition code has been extracted from the x4 segment:
    For Call GCCTBIO to Access DC Table:
    When the system needs to lookup disposition code details, then the gcctbio table access routine is called to retrieve information from the dc table.
    For Disposition Code Found in DC Table?:
    When the system searches for the disposition code in the dc table, then the system determines if the disposition code exists and sets appropriate processing flags.
  • Context - a disposition code lookup has been performed against the dc table:
    For Disposition Code Found in Table?:
    When the system checks if the disposition code exists in the table, then if the code is found, processing continues with code details retrieval, otherwise an error status is set.
    For Set Error Status - Code Not Found:
    When the disposition code is not found in the table, then an error status is set to indicate the disposition code is invalid or not supported.
  • Context - a valid disposition code has been found in the dc table:
    For Retrieve Disposition Code Details:
    When the system processes the disposition code record, then all disposition code details including description, counterpart code, quantity action flag, and processing instructions are retrieved and stored.
  • Context - a disposition code record has been retrieved from the dc table:
    For Get Code Description:
    When the system extracts the code description, then the disposition code description is stored for use in processing and user messaging.
  • Context - a disposition code record contains counterpart code information:
    For Get Counterpart Code Information:
    When the system processes counterpart code relationships, then counterpart code information is retrieved to support removal of conflicting or superseded disposition codes.
  • Context - a disposition code record contains quantity action information:
    For Get Quantity Action Flag:
    When the system evaluates quantity impact requirements, then the quantity action flag is retrieved to determine if release quantities should be increased, decreased, or remain unchanged.
  • Context - a disposition code record contains processing instruction flags:
    For Get Processing Instructions:
    When the system needs to determine processing behavior, then processing instructions are retrieved including hold/release flags, removal requirements, and status update methods.
  • Context - all disposition code details have been successfully retrieved from the dc table:
    For Set Disposition Code Information in Working Storage:
    When the system prepares for disposition code processing, then all disposition code information including description, counterpart codes, quantity actions, and processing flags are stored in working storage variables.
  • Context - disposition code information has been successfully retrieved and stored:
    For Return Success Status:
    When the lookup process completes successfully, then a success status is returned to indicate the disposition code is ready for processing.
  • Context - a disposition code has not been found in the dc table:
    For Log Disposition Code Not Found Error:
    When an error status has been set for the invalid code, then the disposition code not found error is logged with relevant details for business review and system monitoring.
  • Context - an x4 segment is available for processing:
    For Extract Disposition Code from X4 Segment:
    When the system needs to process disposition code information, then the disposition code is extracted from the x4 segment and stored in working storage.
  • Context - a disposition code needs to be validated and processed:
    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 disposition code lookup.
  • Context - the disposition code exists in the dc table:
    For Retrieve Disposition Code Information:
    When the system processes the found disposition code record, then all disposition code information including counterpart codes, processing instructions, quantity actions, removal flags, and status information flags are extracted.
  • Context - disposition code information is available from the dc table:
    For Extract Counterpart Code:
    When the system processes the disposition code record, then the counterpart code is extracted and stored for subsequent processing operations.
  • Context - disposition code record is retrieved from the dc table:
    For Extract Processing Instructions:
    When the system processes the disposition code information, then processing instructions are extracted and made available for disposition code handling logic.
  • Context - disposition code information is being processed:
    For Extract Quantity Action Flag:
    When the system extracts quantity-related flags from the dc table record, then the quantity action flag is extracted to determine whether release quantities will be added, subtracted, or remain unchanged.
  • Context - disposition code record is available from the dc table:
    For Extract Removal Flag:
    When the system processes removal-related information, then the removal flag is extracted to determine whether existing disposition codes should be removed from cargo status.
  • Context - disposition code information is being extracted from the dc table:
    For Extract Status Information Flag:
    When the system processes status-related flags, then the status information flag is extracted to determine whether the disposition code represents informational status or actionable processing.
  • Context - all disposition code information has been extracted from the dc table:
    For Store DC Information in Working Storage:
    When the system needs to store the information for subsequent processing, then all dc information including counterpart codes, processing instructions, and flags are stored in working storage variables.
  • Context - disposition code has been successfully found in the dc table and all information extracted:
    For Set Found Flag to True:
    When the system completes the disposition code lookup process, then the found flag is set to true to indicate successful disposition code processing.
  • Context - a disposition code has been searched in the dc table:
    For Log Disposition Code Not Found Error:
    When the disposition code is not found in the dc table, then an error is logged indicating the disposition code was not found and appropriate error handling is initiated.
  • Context - disposition code lookup has failed due to code not being found in dc table:
    For Set Found Flag to False:
    When the system needs to indicate lookup failure, then the found flag is set to false to indicate unsuccessful disposition code processing.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 customs release segment is being processed
GIVEN
An X4 customs release segment is being processed
Applied to: Extract Disposition Code from X4 Segment
WHEN
The system needs to identify the disposition code
THEN
The disposition code is extracted from the X4 segment and stored for lookup processing
Context: A disposition code has been extracted from the X4 segment
GIVEN
A disposition code has been extracted from the X4 segment
Applied to: Call GCCTBIO to Access DC Table
WHEN
The system needs to lookup disposition code details
THEN
The GCCTBIO table access routine is called to retrieve information from the DC table
Applied to: Disposition Code Found in DC Table?
WHEN
The system searches for the disposition code in the DC table
THEN
The system determines if the disposition code exists and sets appropriate processing flags
Context: A disposition code lookup has been performed against the DC table
GIVEN
A disposition code lookup has been performed against the DC table
Applied to: Disposition Code Found in Table?
WHEN
The system checks if the disposition code exists in the table
THEN
If the code is found, processing continues with code details retrieval, otherwise an error status is set
Applied to: Set Error Status - Code Not Found
WHEN
The disposition code is not found in the table
THEN
An error status is set to indicate the disposition code is invalid or not supported
Context: A valid disposition code has been found in the DC table
GIVEN
A valid disposition code has been found in the DC table
Applied to: Retrieve Disposition Code Details
WHEN
The system processes the disposition code record
THEN
All disposition code details including description, counterpart code, quantity action flag, and processing instructions are retrieved and stored
Context: A disposition code record has been retrieved from the DC table
GIVEN
A disposition code record has been retrieved from the DC table
Applied to: Get Code Description
WHEN
The system extracts the code description
THEN
The disposition code description is stored for use in processing and user messaging
Context: A disposition code record contains counterpart code information
GIVEN
A disposition code record contains counterpart code information
Applied to: Get Counterpart Code Information
WHEN
The system processes counterpart code relationships
THEN
Counterpart code information is retrieved to support removal of conflicting or superseded disposition codes
Context: A disposition code record contains quantity action information
GIVEN
A disposition code record contains quantity action information
Applied to: Get Quantity Action Flag
WHEN
The system evaluates quantity impact requirements
THEN
The quantity action flag is retrieved to determine if release quantities should be increased, decreased, or remain unchanged
Context: A disposition code record contains processing instruction flags
GIVEN
A disposition code record contains processing instruction flags
Applied to: Get Processing Instructions
WHEN
The system needs to determine processing behavior
THEN
Processing instructions are retrieved including hold/release flags, removal requirements, and status update methods
Context: All disposition code details have been successfully retrieved from the DC table
GIVEN
All disposition code details have been successfully retrieved from the DC table
Applied to: Set Disposition Code Information in Working Storage
WHEN
The system prepares for disposition code processing
THEN
All disposition code information including description, counterpart codes, quantity actions, and processing flags are stored in working storage variables
Context: Disposition code information has been successfully retrieved and stored
GIVEN
Disposition code information has been successfully retrieved and stored
Applied to: Return Success Status
WHEN
The lookup process completes successfully
THEN
A success status is returned to indicate the disposition code is ready for processing
Context: A disposition code has not been found in the DC table
GIVEN
A disposition code has not been found in the DC table
Applied to: Log Disposition Code Not Found Error
WHEN
An error status has been set for the invalid code
THEN
The disposition code not found error is logged with relevant details for business review and system monitoring
Context: An X4 segment is available for processing
GIVEN
An X4 segment is available for processing
Applied to: Extract Disposition Code from X4 Segment
WHEN
The system needs to process disposition code information
THEN
The disposition code is extracted from the X4 segment and stored in working storage
Context: A disposition code needs to be validated and processed
GIVEN
A disposition code needs to be validated and processed
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 disposition code lookup
Context: The disposition code exists in the DC table
GIVEN
The disposition code exists in the DC table
Applied to: Retrieve Disposition Code Information
WHEN
The system processes the found disposition code record
THEN
All disposition code information including counterpart codes, processing instructions, quantity actions, removal flags, and status information flags are extracted
Context: Disposition code information is available from the DC table
GIVEN
Disposition code information is available from the DC table
Applied to: Extract Counterpart Code
WHEN
The system processes the disposition code record
THEN
The counterpart code is extracted and stored for subsequent processing operations
Context: Disposition code record is retrieved from the DC table
GIVEN
Disposition code record is retrieved from the DC table
Applied to: Extract Processing Instructions
WHEN
The system processes the disposition code information
THEN
Processing instructions are extracted and made available for disposition code handling logic
Context: Disposition code information is being processed
GIVEN
Disposition code information is being processed
Applied to: Extract Quantity Action Flag
WHEN
The system extracts quantity-related flags from the DC table record
THEN
The quantity action flag is extracted to determine whether release quantities will be added, subtracted, or remain unchanged
Context: Disposition code record is available from the DC table
GIVEN
Disposition code record is available from the DC table
Applied to: Extract Removal Flag
WHEN
The system processes removal-related information
THEN
The removal flag is extracted to determine whether existing disposition codes should be removed from cargo status
Context: Disposition code information is being extracted from the DC table
GIVEN
Disposition code information is being extracted from the DC table
Applied to: Extract Status Information Flag
WHEN
The system processes status-related flags
THEN
The status information flag is extracted to determine whether the disposition code represents informational status or actionable processing
Context: All disposition code information has been extracted from the DC table
GIVEN
All disposition code information has been extracted from the DC table
Applied to: Store DC Information in Working Storage
WHEN
The system needs to store the information for subsequent processing
THEN
All DC information including counterpart codes, processing instructions, and flags are stored in working storage variables
Context: Disposition code has been successfully found in the DC table and all information extracted
GIVEN
Disposition code has been successfully found in the DC table and all information extracted
Applied to: Set Found Flag to True
WHEN
The system completes the disposition code lookup process
THEN
The found flag is set to true to indicate successful disposition code processing
Context: A disposition code has been searched in the DC table
GIVEN
A disposition code has been searched in the DC table
Applied to: Log Disposition Code Not Found Error
WHEN
The disposition code is not found in the DC table
THEN
An error is logged indicating the disposition code was not found and appropriate error handling is initiated
Context: Disposition code lookup has failed due to code not being found in DC table
GIVEN
Disposition code lookup has failed due to code not being found in DC table
Applied to: Set Found Flag to False
WHEN
The system needs to indicate lookup failure
THEN
The found flag is set to false to indicate unsuccessful disposition code processing
R-GCX016-cbl-00727 (+8) File: GCX016.cbl Status Array Duplicate Detection Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Duplicate Detection':
  • Context - a new disposition code needs to be added to the cargo status array:
    For Start Status Array Duplicate Detection:
    When the system searches through the s09a array elements, then the system initializes array search parameters and begins sequential element checking.
  • Context - an array index position is being evaluated for processing:
    For Array Index <= Maximum Elements?:
    When the array index is compared against the maximum number of elements, then processing continues if index is within bounds, otherwise search terminates.
  • Context - a specific array element is being examined:
    For Element Contains Data?:
    When the system checks if the element contains data, then comparison proceeds if data exists, otherwise the system moves to the next element.
  • Context - a new disposition code and an existing array element with data:
    For Codes Match?:
    When the system compares the disposition codes, then entry number validation proceeds if codes match, otherwise the system moves to the next element.
  • Context - disposition codes match between new entry and existing array element:
    For Entry Numbers Match?:
    When the system compares entry numbers, then quantity validation proceeds if entry numbers match, otherwise the system moves to the next element.
  • Context - disposition codes and entry numbers match between new entry and existing array element:
    For Quantities Match?:
    When the system compares quantities, then duplicate is confirmed if quantities match, otherwise the system moves to the next element.
  • Context - disposition code, entry number, and quantity all match an existing array element:
    For Duplicate Found - Set Flag:
    When the system confirms a complete duplicate match, then the duplicate found flag is set and search processing terminates.
  • Context - current array element does not match the new disposition code or contains no data:
    For Increment Array Index:
    When the system needs to continue searching, then the array index is incremented to examine the next element.
  • Context - all array elements have been examined:
    For No Duplicate Found:
    When no matching disposition code, entry number, and quantity combination is found, then the system sets no duplicate found status and returns the search result.
👨‍💻 Technical ACs (Gherkin)
Context: A new disposition code needs to be added to the cargo status array
GIVEN
A new disposition code needs to be added to the cargo status array
Applied to: Start Status Array Duplicate Detection
WHEN
The system searches through the S09A array elements
THEN
The system initializes array search parameters and begins sequential element checking
Context: An array index position is being evaluated for processing
GIVEN
An array index position is being evaluated for processing
Applied to: Array Index <= Maximum Elements?
WHEN
The array index is compared against the maximum number of elements
THEN
Processing continues if index is within bounds, otherwise search terminates
Context: A specific array element is being examined
GIVEN
A specific array element is being examined
Applied to: Element Contains Data?
WHEN
The system checks if the element contains data
THEN
Comparison proceeds if data exists, otherwise the system moves to the next element
Context: A new disposition code and an existing array element with data
GIVEN
A new disposition code and an existing array element with data
Applied to: Codes Match?
WHEN
The system compares the disposition codes
THEN
Entry number validation proceeds if codes match, otherwise the system moves to the next element
Context: Disposition codes match between new entry and existing array element
GIVEN
Disposition codes match between new entry and existing array element
Applied to: Entry Numbers Match?
WHEN
The system compares entry numbers
THEN
Quantity validation proceeds if entry numbers match, otherwise the system moves to the next element
Context: Disposition codes and entry numbers match between new entry and existing array element
GIVEN
Disposition codes and entry numbers match between new entry and existing array element
Applied to: Quantities Match?
WHEN
The system compares quantities
THEN
Duplicate is confirmed if quantities match, otherwise the system moves to the next element
Context: Disposition code, entry number, and quantity all match an existing array element
GIVEN
Disposition code, entry number, and quantity all match an existing array element
Applied to: Duplicate Found - Set Flag
WHEN
The system confirms a complete duplicate match
THEN
The duplicate found flag is set and search processing terminates
Context: Current array element does not match the new disposition code or contains no data
GIVEN
Current array element does not match the new disposition code or contains no data
Applied to: Increment Array Index
WHEN
The system needs to continue searching
THEN
The array index is incremented to examine the next element
Context: All array elements have been examined
GIVEN
All array elements have been examined
Applied to: No Duplicate Found
WHEN
No matching disposition code, entry number, and quantity combination is found
THEN
The system sets no duplicate found status and returns the search result
R-GCX016-cbl-00736 (+8) File: GCX016.cbl Counterpart Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Counterpart Processing':
  • Context - a new disposition code is received for processing:
    For Check if Code Has Counterpart:
    When the system checks the disposition code table for counterpart relationships, then the system identifies whether the code has a counterpart that needs to be removed.
  • Context - a counterpart disposition code exists for the new code:
    For Search Status Array for Counterpart:
    When the system searches through the status array elements, then the system identifies if the counterpart code is present in the array.
  • Context - a counterpart code is found in the status array:
    For Match by Status Info:
    When the system compares status information fields between the counterpart and new code, then the system determines if the status information matches for removal eligibility.
  • Context - status information criteria are evaluated for the counterpart code:
    For Match by Entry Number:
    When the system compares entry numbers between the counterpart and new code, then the system determines if the entry numbers match for removal eligibility.
  • Context - entry number criteria are evaluated for the counterpart code:
    For Match by Quantity:
    When the system compares quantities between the counterpart and new code, then the system determines if the quantities match for removal eligibility.
  • Context - quantity criteria are evaluated for the counterpart code:
    For Match by Specific Code Pattern:
    When the system applies specific pattern matching rules for special codes like 4e disposition, then the system determines if the code patterns match for removal eligibility.
  • Context - all matching criteria are met for the counterpart code:
    For Remove Counterpart Code from Array:
    When the system removes the counterpart code from its position in the status array, then the counterpart code is eliminated from the array and marked for compaction.
  • Context - counterpart codes have been removed from the status array:
    For Compact Remaining Array Elements:
    When the system compacts the array by moving remaining elements forward, then all gaps in the array are eliminated and elements are contiguous.
  • Context - the status array has been compacted after counterpart removal:
    For Update Array Element Count:
    When the system recalculates the number of active array elements, then the array element count reflects the reduced number of status entries.
👨‍💻 Technical ACs (Gherkin)
Context: A new disposition code is received for processing
GIVEN
A new disposition code is received for processing
Applied to: Check if Code Has Counterpart
WHEN
The system checks the disposition code table for counterpart relationships
THEN
The system identifies whether the code has a counterpart that needs to be removed
Context: A counterpart disposition code exists for the new code
GIVEN
A counterpart disposition code exists for the new code
Applied to: Search Status Array for Counterpart
WHEN
The system searches through the status array elements
THEN
The system identifies if the counterpart code is present in the array
Context: A counterpart code is found in the status array
GIVEN
A counterpart code is found in the status array
Applied to: Match by Status Info
WHEN
The system compares status information fields between the counterpart and new code
THEN
The system determines if the status information matches for removal eligibility
Context: Status information criteria are evaluated for the counterpart code
GIVEN
Status information criteria are evaluated for the counterpart code
Applied to: Match by Entry Number
WHEN
The system compares entry numbers between the counterpart and new code
THEN
The system determines if the entry numbers match for removal eligibility
Context: Entry number criteria are evaluated for the counterpart code
GIVEN
Entry number criteria are evaluated for the counterpart code
Applied to: Match by Quantity
WHEN
The system compares quantities between the counterpart and new code
THEN
The system determines if the quantities match for removal eligibility
Context: Quantity criteria are evaluated for the counterpart code
GIVEN
Quantity criteria are evaluated for the counterpart code
Applied to: Match by Specific Code Pattern
WHEN
The system applies specific pattern matching rules for special codes like 4E disposition
THEN
The system determines if the code patterns match for removal eligibility
Context: All matching criteria are met for the counterpart code
GIVEN
All matching criteria are met for the counterpart code
Applied to: Remove Counterpart Code from Array
WHEN
The system removes the counterpart code from its position in the status array
THEN
The counterpart code is eliminated from the array and marked for compaction
Context: Counterpart codes have been removed from the status array
GIVEN
Counterpart codes have been removed from the status array
Applied to: Compact Remaining Array Elements
WHEN
The system compacts the array by moving remaining elements forward
THEN
All gaps in the array are eliminated and elements are contiguous
Context: The status array has been compacted after counterpart removal
GIVEN
The status array has been compacted after counterpart removal
Applied to: Update Array Element Count
WHEN
The system recalculates the number of active array elements
THEN
The array element count reflects the reduced number of status entries
R-GCX016-cbl-00745 (+13) File: GCX016.cbl ARL Auto Release Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ARL Auto Release Processing':
  • Context - a disposition code is received in the x4 segment:
    For ARL Auto Release Request Received:
    When the disposition code equals 'arl', then the system initiates auto release processing workflow.
  • Context - an arl disposition code is being processed:
    For Skip Status Code Insertion:
    When the system reaches status code insertion logic, then status code insertion is skipped and existing status array is analyzed.
  • Context - arl processing requires status analysis:
    For Retrieve Current Status Array S09A:
    When the system needs current status information, then current s09a status array is retrieved from gcsuss09 status segments.
  • Context - current status array s09a is available:
    For Analyze Existing Status Codes:
    When arl processing analyzes existing status codes, then system evaluates hold conditions, release quantities, and cargo status flags.
  • Context - existing status codes have been analyzed:
    For Release Conditions Met?:
    When the system evaluates release eligibility, then release conditions are validated based on hold status, quantities, and regulatory requirements.
  • Context - release conditions are met for arl processing:
    For Set Auto Release Flag:
    When the system confirms cargo eligibility, then auto release flag is set to enable release processing.
  • Context - auto release flag is set and cargo is eligible:
    For Calculate Release Quantities:
    When the system processes release quantities, then release quantities are calculated based on total cargo quantities and existing releases.
  • Context - release quantities are calculated and auto release flag is set:
    For Update Cargo Status:
    When the system updates cargo status, then cargo status is updated to reflect automatic release processing results.
  • Context - cargo status has been updated for arl processing:
    For Manual Release Override?:
    When the system checks for manual release conditions, then manual release override flag is evaluated based on cargo status and processing requirements.
  • Context - manual release override conditions are detected:
    For Clear Destination Index:
    When the system processes the override, then destination index is cleared to reflect manual release status.
  • Context - arl processing is complete with or without manual override:
    For Generate Release Notification:
    When the system generates notifications, then release notifications are created and routed to appropriate destinations.
  • Context - release notifications are generated and processing is complete:
    For Update Cargo Record:
    When the system updates the cargo record, then cargo record is updated in gccc-cargo-root with new status and release information.
  • Context - arl disposition code is processed but release conditions are not met:
    For Process Complete - No Status Change:
    When the system completes processing, then processing completes without status changes and logs the no-change result.
  • Context - arl processing is complete with or without status changes:
    For Log ARL Processing:
    When the system logs the processing result, then arl processing completion is logged with appropriate status and outcome information.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received in the X4 segment
GIVEN
A disposition code is received in the X4 segment
Applied to: ARL Auto Release Request Received
WHEN
The disposition code equals 'ARL'
THEN
The system initiates auto release processing workflow
Context: An ARL disposition code is being processed
GIVEN
An ARL disposition code is being processed
Applied to: Skip Status Code Insertion
WHEN
The system reaches status code insertion logic
THEN
Status code insertion is skipped and existing status array is analyzed
Context: ARL processing requires status analysis
GIVEN
ARL processing requires status analysis
Applied to: Retrieve Current Status Array S09A
WHEN
The system needs current status information
THEN
Current S09A status array is retrieved from GCSUSS09 status segments
Context: Current status array S09A is available
GIVEN
Current status array S09A is available
Applied to: Analyze Existing Status Codes
WHEN
ARL processing analyzes existing status codes
THEN
System evaluates hold conditions, release quantities, and cargo status flags
Context: Existing status codes have been analyzed
GIVEN
Existing status codes have been analyzed
Applied to: Release Conditions Met?
WHEN
The system evaluates release eligibility
THEN
Release conditions are validated based on hold status, quantities, and regulatory requirements
Context: Release conditions are met for ARL processing
GIVEN
Release conditions are met for ARL processing
Applied to: Set Auto Release Flag
WHEN
The system confirms cargo eligibility
THEN
Auto release flag is set to enable release processing
Context: Auto release flag is set and cargo is eligible
GIVEN
Auto release flag is set and cargo is eligible
Applied to: Calculate Release Quantities
WHEN
The system processes release quantities
THEN
Release quantities are calculated based on total cargo quantities and existing releases
Context: Release quantities are calculated and auto release flag is set
GIVEN
Release quantities are calculated and auto release flag is set
Applied to: Update Cargo Status
WHEN
The system updates cargo status
THEN
Cargo status is updated to reflect automatic release processing results
Context: Cargo status has been updated for ARL processing
GIVEN
Cargo status has been updated for ARL processing
Applied to: Manual Release Override?
WHEN
The system checks for manual release conditions
THEN
Manual release override flag is evaluated based on cargo status and processing requirements
Context: Manual release override conditions are detected
GIVEN
Manual release override conditions are detected
Applied to: Clear Destination Index
WHEN
The system processes the override
THEN
Destination index is cleared to reflect manual release status
Context: ARL processing is complete with or without manual override
GIVEN
ARL processing is complete with or without manual override
Applied to: Generate Release Notification
WHEN
The system generates notifications
THEN
Release notifications are created and routed to appropriate destinations
Context: Release notifications are generated and processing is complete
GIVEN
Release notifications are generated and processing is complete
Applied to: Update Cargo Record
WHEN
The system updates the cargo record
THEN
Cargo record is updated in GCCC-CARGO-ROOT with new status and release information
Context: ARL disposition code is processed but release conditions are not met
GIVEN
ARL disposition code is processed but release conditions are not met
Applied to: Process Complete - No Status Change
WHEN
The system completes processing
THEN
Processing completes without status changes and logs the no-change result
Context: ARL processing is complete with or without status changes
GIVEN
ARL processing is complete with or without status changes
Applied to: Log ARL Processing
WHEN
The system logs the processing result
THEN
ARL processing completion is logged with appropriate status and outcome information
R-GCX016-cbl-00759 (+8) File: GCX016.cbl MRL Manual Release Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MRL Manual Release Processing':
  • Context - a cargo record with mrl disposition code is being processed:
    For Is Cargo CPRS?:
    When the system evaluates the cargo type to determine if it is cprs cargo, then the system identifies cprs cargo and routes it to manual release processing or continues with standard processing for non-cprs cargo.
  • Context - a cargo record is identified as cprs cargo with mrl disposition code:
    For Force Manual Release Flag:
    When the system processes the manual release request, then the system sets the manual release flag to force manual release processing workflow.
  • Context - cprs cargo is being processed for manual release with mrl disposition code:
    For Clear Destination Index:
    When the manual release flag is activated, then the system clears the destination index to remove destination routing information.
  • Context - cprs cargo with cleared destination index is being manually released:
    For Process Canadian Manifest Coordination:
    When the system processes the manual release workflow, then the system initiates canadian manifest coordination processing to synchronize release information across border systems.
  • Context - canadian manifest coordination has been processed for manual release:
    For Log Manual Release Action:
    When the system completes the coordination process, then the system logs the manual release action with relevant cargo and processing details for audit purposes.
  • Context - manual release action has been logged for cprs cargo:
    For Update Cargo Status to Released:
    When the system processes the status update, then the system updates the cargo status to released state indicating successful manual release completion.
  • Context - cargo status has been updated to released for manual release:
    For Generate Release Notification:
    When the system completes the status update process, then the system generates release notification messages to inform relevant parties of the manual release completion.
  • Context - release notification has been generated for manual release:
    For Skip Standard Release Processing:
    When the system evaluates next processing steps, then the system skips standard release processing workflow since manual release has been completed.
  • Context - a cargo record with mrl disposition code is identified as non-cprs cargo:
    For Continue Standard Processing:
    When the system evaluates the processing workflow, then the system continues with standard processing workflow without manual release procedures.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with MRL disposition code is being processed
GIVEN
A cargo record with MRL disposition code is being processed
Applied to: Is Cargo CPRS?
WHEN
The system evaluates the cargo type to determine if it is CPRS cargo
THEN
The system identifies CPRS cargo and routes it to manual release processing or continues with standard processing for non-CPRS cargo
Context: A cargo record is identified as CPRS cargo with MRL disposition code
GIVEN
A cargo record is identified as CPRS cargo with MRL disposition code
Applied to: Force Manual Release Flag
WHEN
The system processes the manual release request
THEN
The system sets the manual release flag to force manual release processing workflow
Context: CPRS cargo is being processed for manual release with MRL disposition code
GIVEN
CPRS cargo is being processed for manual release with MRL disposition code
Applied to: Clear Destination Index
WHEN
The manual release flag is activated
THEN
The system clears the destination index to remove destination routing information
Context: CPRS cargo with cleared destination index is being manually released
GIVEN
CPRS cargo with cleared destination index is being manually released
Applied to: Process Canadian Manifest Coordination
WHEN
The system processes the manual release workflow
THEN
The system initiates Canadian manifest coordination processing to synchronize release information across border systems
Context: Canadian manifest coordination has been processed for manual release
GIVEN
Canadian manifest coordination has been processed for manual release
Applied to: Log Manual Release Action
WHEN
The system completes the coordination process
THEN
The system logs the manual release action with relevant cargo and processing details for audit purposes
Context: Manual release action has been logged for CPRS cargo
GIVEN
Manual release action has been logged for CPRS cargo
Applied to: Update Cargo Status to Released
WHEN
The system processes the status update
THEN
The system updates the cargo status to released state indicating successful manual release completion
Context: Cargo status has been updated to released for manual release
GIVEN
Cargo status has been updated to released for manual release
Applied to: Generate Release Notification
WHEN
The system completes the status update process
THEN
The system generates release notification messages to inform relevant parties of the manual release completion
Context: Release notification has been generated for manual release
GIVEN
Release notification has been generated for manual release
Applied to: Skip Standard Release Processing
WHEN
The system evaluates next processing steps
THEN
The system skips standard release processing workflow since manual release has been completed
Context: A cargo record with MRL disposition code is identified as non-CPRS cargo
GIVEN
A cargo record with MRL disposition code is identified as non-CPRS cargo
Applied to: Continue Standard Processing
WHEN
The system evaluates the processing workflow
THEN
The system continues with standard processing workflow without manual release procedures
R-GCX016-cbl-00768 (+15) File: GCX016.cbl Hold Code Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hold Code Processing':
  • Context - a disposition code is received from x4 segment processing:
    For Is Disposition Code a Hold Code?:
    When the system evaluates the disposition code type, then the system determines if the code represents a hold action and proceeds to hold processing or skips to completion.
  • Context - a hold disposition code needs validation:
    For Validate Hold Code in DC Table:
    When the system looks up the code in the dc table, then the system retrieves the code details and sets validation status.
  • Context - a disposition code has been looked up in the dc table:
    For Hold Code Valid?:
    When the system checks if the lookup was successful, then the system either proceeds with hold processing for valid codes or generates an error for invalid codes.
  • Context - a valid hold disposition code is being processed:
    For Determine Hold Location:
    When the system evaluates the hold location requirements, then the system determines whether the hold applies to border location or destination location.
  • Context - a hold location needs to be determined for cargo:
    For Border Hold or Destination Hold?:
    When the system evaluates the cargo routing and disposition code requirements, then the system classifies the hold as either border hold or destination hold and sets appropriate location information.
  • Context - a hold is classified as a border hold:
    For Set Border Hold Location Info:
    When the system sets up the hold location information, then the system configures border-specific location details and hold parameters.
  • Context - a hold is classified as a destination hold:
    For Set Destination Hold Location Info:
    When the system sets up the hold location information, then the system configures destination-specific location details and hold parameters.
  • Context - a hold code is ready to be inserted into the status array:
    For Check Status Array for Duplicates:
    When the system searches the existing status array for the same hold code, then the system identifies whether the hold code already exists in the array.
  • Context - the system has checked for duplicate hold codes in the status array:
    For Hold Code Already Exists?:
    When a duplicate hold code is found, then the system skips the duplicate entry to avoid redundant hold codes.
  • Context - a hold code already exists in the status array:
    For Skip Duplicate Entry:
    When the system attempts to insert the same hold code, then the system skips the insertion and proceeds to completion without adding the duplicate.
  • Context - a valid hold code that does not exist in the status array:
    For Insert Hold Code into S09A Array:
    When the system inserts the hold code into the s09a array, then the system adds the hold code with proper sequence number and status information.
  • Context - a hold code has been successfully inserted into the status array:
    For Set Hold Status Flag:
    When the system updates the cargo status flags, then the system sets the hold status flag to indicate the cargo is held.
  • Context - a hold code has been inserted with status flag set:
    For Set Location Information:
    When the system updates location information, then the system sets the appropriate border or destination location details for the hold.
  • Context - a hold code has been successfully added to the status array:
    For Update Array Element Count:
    When the system updates the array management counters, then the system increments the element count to maintain accurate array size tracking.
  • Context - a hold code has been successfully processed and added to the status array:
    For Log Hold Code Processing:
    When the system performs logging operations, then the system creates appropriate log entries for the hold code processing activity.
  • Context - a disposition code lookup in the dc table fails:
    For Invalid Hold Code Error:
    When the system determines the code is invalid, then the system generates an appropriate error message and proceeds to completion without processing the hold.
👨‍💻 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: Is Disposition Code a Hold Code?
WHEN
The system evaluates the disposition code type
THEN
The system determines if the code represents a hold action and proceeds to hold processing or skips to completion
Context: A hold disposition code needs validation
GIVEN
A hold disposition code needs validation
Applied to: Validate Hold Code in DC Table
WHEN
The system looks up the code in the DC table
THEN
The system retrieves the code details and sets validation status
Context: A disposition code has been looked up in the DC table
GIVEN
A disposition code has been looked up in the DC table
Applied to: Hold Code Valid?
WHEN
The system checks if the lookup was successful
THEN
The system either proceeds with hold processing for valid codes or generates an error for invalid codes
Context: A valid hold disposition code is being processed
GIVEN
A valid hold disposition code is being processed
Applied to: Determine Hold Location
WHEN
The system evaluates the hold location requirements
THEN
The system determines whether the hold applies to border location or destination location
Context: A hold location needs to be determined for cargo
GIVEN
A hold location needs to be determined for cargo
Applied to: Border Hold or Destination Hold?
WHEN
The system evaluates the cargo routing and disposition code requirements
THEN
The system classifies the hold as either border hold or destination hold and sets appropriate location information
Context: A hold is classified as a border hold
GIVEN
A hold is classified as a border hold
Applied to: Set Border Hold Location Info
WHEN
The system sets up the hold location information
THEN
The system configures border-specific location details and hold parameters
Context: A hold is classified as a destination hold
GIVEN
A hold is classified as a destination hold
Applied to: Set Destination Hold Location Info
WHEN
The system sets up the hold location information
THEN
The system configures destination-specific location details and hold parameters
Context: A hold code is ready to be inserted into the status array
GIVEN
A hold code is ready to be inserted into the status array
Applied to: Check Status Array for Duplicates
WHEN
The system searches the existing status array for the same hold code
THEN
The system identifies whether the hold code already exists in the array
Context: The system has checked for duplicate hold codes in the status array
GIVEN
The system has checked for duplicate hold codes in the status array
Applied to: Hold Code Already Exists?
WHEN
A duplicate hold code is found
THEN
The system skips the duplicate entry to avoid redundant hold codes
Context: A hold code already exists in the status array
GIVEN
A hold code already exists in the status array
Applied to: Skip Duplicate Entry
WHEN
The system attempts to insert the same hold code
THEN
The system skips the insertion and proceeds to completion without adding the duplicate
Context: A valid hold code that does not exist in the status array
GIVEN
A valid hold code that does not exist in the status array
Applied to: Insert Hold Code into S09A Array
WHEN
The system inserts the hold code into the S09A array
THEN
The system adds the hold code with proper sequence number and status information
Context: A hold code has been successfully inserted into the status array
GIVEN
A hold code has been successfully inserted into the status array
Applied to: Set Hold Status Flag
WHEN
The system updates the cargo status flags
THEN
The system sets the hold status flag to indicate the cargo is held
Context: A hold code has been inserted with status flag set
GIVEN
A hold code has been inserted with status flag set
Applied to: Set Location Information
WHEN
The system updates location information
THEN
The system sets the appropriate border or destination location details for the hold
Context: A hold code has been successfully added to the status array
GIVEN
A hold code has been successfully added to the status array
Applied to: Update Array Element Count
WHEN
The system updates the array management counters
THEN
The system increments the element count to maintain accurate array size tracking
Context: A hold code has been successfully processed and added to the status array
GIVEN
A hold code has been successfully processed and added to the status array
Applied to: Log Hold Code Processing
WHEN
The system performs logging operations
THEN
The system creates appropriate log entries for the hold code processing activity
Context: A disposition code lookup in the DC table fails
GIVEN
A disposition code lookup in the DC table fails
Applied to: Invalid Hold Code Error
WHEN
The system determines the code is invalid
THEN
The system generates an appropriate error message and proceeds to completion without processing the hold
R-GCX016-cbl-00784 (+12) File: GCX016.cbl Release Code Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Code Processing':
  • Context - a release disposition code is received in x4 segment:
    For Validate Disposition Code in DC Table:
    When the system looks up the disposition code in the dc table, then if the code exists in dc table, processing continues; if not found, an error is generated.
  • Context - a valid release disposition code needs to be processed:
    For Check Status Array for Duplicates:
    When the system searches the s09a status array for existing entries with the same disposition code, then if the code already exists, skip processing to prevent duplicates; if not found, continue with processing.
  • Context - a validated release disposition code is being processed:
    For Determine Release Location:
    When the system evaluates the disposition code properties to determine location type, then the system sets either border release location or destination release location based on code characteristics.
  • Context - a release disposition code is determined to be for border location:
    For Set Border Release Location:
    When the system processes the border release, then the system sets the location information to border-specific values.
  • Context - a release disposition code is determined to be for destination location:
    For Set Destination Release Location:
    When the system processes the destination release, then the system sets the location information to destination-specific values.
  • Context - a valid release disposition code has been validated and location determined:
    For Create Status Array Entry:
    When the system creates a new status array entry, then a new entry is created in the s09a status array with the disposition code information.
  • Context - a status array entry is being created for a release disposition code:
    For Set Released Flag = 'Y':
    When the system sets the release status flag, then the released flag is set to 'y' to indicate active release status.
  • Context - a release status entry is being populated:
    For Set Entry Number from X4-04:
    When the system processes the x4-04 field containing the entry number, then the entry number from x4-04 is assigned to the status array entry.
  • Context - a release status entry is being populated with quantity information:
    For Set Quantity from X4-05:
    When the system processes the x4-05 field containing the quantity, then the quantity from x4-05 is assigned to the status array entry.
  • Context - a complete status entry has been created with all required information:
    For Insert Entry into S09A Status Array:
    When the system inserts the entry into the s09a status array, then the status entry is added to the s09a array for cargo status tracking.
  • Context - a status entry has been successfully inserted into the s09a array:
    For Update Array Element Count:
    When the system updates the array management counters, then the element count for the s09a status array is incremented by one.
  • Context - a disposition code is not found in the dc table:
    For Generate Error Message:
    When the system processes the validation failure, then an error message is generated indicating the invalid disposition code.
  • Context - an error message has been generated for invalid disposition code:
    For Route Error to Merlin Users:
    When the system routes the error message, then the error message is sent to designated merlin users for appropriate action.
👨‍💻 Technical ACs (Gherkin)
Context: A release disposition code is received in X4 segment
GIVEN
A release disposition code is received in X4 segment
Applied to: Validate Disposition Code in DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
If the code exists in DC table, processing continues; if not found, an error is generated
Context: A valid release disposition code needs to be processed
GIVEN
A valid release disposition code needs to be processed
Applied to: Check Status Array for Duplicates
WHEN
The system searches the S09A status array for existing entries with the same disposition code
THEN
If the code already exists, skip processing to prevent duplicates; if not found, continue with processing
Context: A validated release disposition code is being processed
GIVEN
A validated release disposition code is being processed
Applied to: Determine Release Location
WHEN
The system evaluates the disposition code properties to determine location type
THEN
The system sets either border release location or destination release location based on code characteristics
Context: A release disposition code is determined to be for border location
GIVEN
A release disposition code is determined to be for border location
Applied to: Set Border Release Location
WHEN
The system processes the border release
THEN
The system sets the location information to border-specific values
Context: A release disposition code is determined to be for destination location
GIVEN
A release disposition code is determined to be for destination location
Applied to: Set Destination Release Location
WHEN
The system processes the destination release
THEN
The system sets the location information to destination-specific values
Context: A valid release disposition code has been validated and location determined
GIVEN
A valid release disposition code has been validated and location determined
Applied to: Create Status Array Entry
WHEN
The system creates a new status array entry
THEN
A new entry is created in the S09A status array with the disposition code information
Context: A status array entry is being created for a release disposition code
GIVEN
A status array entry is being created for a release disposition code
Applied to: Set Released Flag = 'Y'
WHEN
The system sets the release status flag
THEN
The released flag is set to 'Y' to indicate active release status
Context: A release status entry is being populated
GIVEN
A release status entry is being populated
Applied to: Set Entry Number from X4-04
WHEN
The system processes the X4-04 field containing the entry number
THEN
The entry number from X4-04 is assigned to the status array entry
Context: A release status entry is being populated with quantity information
GIVEN
A release status entry is being populated with quantity information
Applied to: Set Quantity from X4-05
WHEN
The system processes the X4-05 field containing the quantity
THEN
The quantity from X4-05 is assigned to the status array entry
Context: A complete status entry has been created with all required information
GIVEN
A complete status entry has been created with all required information
Applied to: Insert Entry into S09A Status Array
WHEN
The system inserts the entry into the S09A status array
THEN
The status entry is added to the S09A array for cargo status tracking
Context: A status entry has been successfully inserted into the S09A array
GIVEN
A status entry has been successfully inserted into the S09A array
Applied to: Update Array Element Count
WHEN
The system updates the array management counters
THEN
The element count for the S09A status array is incremented by one
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 Error Message
WHEN
The system processes the validation failure
THEN
An error message is generated indicating the invalid disposition code
Context: An error message has been generated for invalid disposition code
GIVEN
An error message has been generated for invalid disposition code
Applied to: Route Error to Merlin Users
WHEN
The system routes the error message
THEN
The error message is sent to designated Merlin users for appropriate action
R-GCX016-cbl-00797 (+4) File: GCX016.cbl Status Info Processing Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Info Processing':
  • Context - a disposition code is identified as status information type and the s09a status array contains existing status entries:
    For Check for Duplicate in Status Array:
    When the system checks if the same disposition code already exists in the status array, then if duplicate found, skip processing to prevent duplicate entry, otherwise proceed with adding the status code.
  • Context - a disposition code is validated as status information type and no duplicate exists in the status array:
    For Add Informational Status Code:
    When the system processes the informational status code, then add the disposition code to the next available position in the s09a status array.
  • Context - a disposition code is being added as status information:
    For Set Status Info Flag:
    When the system updates the status array element, then set the status information flag to indicate this is informational only and not an actionable status.
  • Context - a status code is marked as informational only:
    For Skip Quantity Processing:
    When the system evaluates whether quantity processing is required, then skip all quantity-related processing including release quantity calculations and quantity impact assessments.
  • Context - an informational status code has been successfully added to the status array:
    For Log Status Information:
    When the system completes the status information processing, then log the status change with disposition code details and timestamp for audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is identified as status information type AND the S09A status array contains existing status entries
GIVEN
A disposition code is identified as status information type AND the S09A status array contains existing status entries
Applied to: Check for Duplicate in Status Array
WHEN
The system checks if the same disposition code already exists in the status array
THEN
If duplicate found, skip processing to prevent duplicate entry, otherwise proceed with adding the status code
Context: A disposition code is validated as status information type AND no duplicate exists in the status array
GIVEN
A disposition code is validated as status information type AND no duplicate exists in the status array
Applied to: Add Informational Status Code
WHEN
The system processes the informational status code
THEN
Add the disposition code to the next available position in the S09A status array
Context: A disposition code is being added as status information
GIVEN
A disposition code is being added as status information
Applied to: Set Status Info Flag
WHEN
The system updates the status array element
THEN
Set the status information flag to indicate this is informational only and not an actionable status
Context: A status code is marked as informational only
GIVEN
A status code is marked as informational only
Applied to: Skip Quantity Processing
WHEN
The system evaluates whether quantity processing is required
THEN
Skip all quantity-related processing including release quantity calculations and quantity impact assessments
Context: An informational status code has been successfully added to the status array
GIVEN
An informational status code has been successfully added to the status array
Applied to: Log Status Information
WHEN
The system completes the status information processing
THEN
Log the status change with disposition code details and timestamp for audit purposes
R-GCX016-cbl-00802 (+12) File: GCX016.cbl Bond Processing for Proceed Codes Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Processing for Proceed Codes':
  • Context - non-bonded traffic cargo with proceed disposition code:
    For Broker Bond Information Available?:
    When system checks for broker bond information in k1 remarks segment, then system identifies if bond control number is available from broker.
  • Context - broker bond information is available in k1 segment:
    For Retrieve Bond Information from Broker:
    When system processes k1 remarks containing bond details, then system extracts bond control number and broker information for cargo processing.
  • Context - bond control number extracted from broker information:
    For Validate Bond Control Number:
    When system validates bond number format and checks against bond database, then system determines if bond number is valid and active.
  • Context - valid bond control number and non-bonded cargo record:
    For Apply Bond to Non-bonded Traffic:
    When system processes bond assignment for proceed code, then system updates cargo record with bond control number and changes status from non-bonded to bonded.
  • Context - cargo with valid bond assignment:
    For Set Proceed Status with Bond:
    When system processes proceed disposition code with bond, then system sets cargo status to proceed and includes bond control number in status record.
  • Context - cargo with proceed status and valid bond:
    For Update Border Arrival Date:
    When system processes border arrival information, then system updates cargo record with current border arrival date and time.
  • Context - cargo previously marked as non-bonded with new bond assignment:
    For Clear Previous Non-bonded Status:
    When system updates cargo status with bond information, then system clears all non-bonded status flags and updates status array.
  • Context - cargo with validated bond information and updated status:
    For Update Cargo Record with Bond Info:
    When system commits cargo record changes, then system updates cargo database record with bond control number, proceed status, and border arrival date.
  • Context - cargo successfully updated with bond and proceed status:
    For Generate Proceed Notification:
    When system generates status notification, then system creates merlin message with proceed status, bond information, and cargo details for broker notification.
  • Context - completed bond assignment to cargo:
    For Log Bond Assignment Transaction:
    When system logs transaction details, then system creates audit log entry with cargo ccn, bond number, broker information, and timestamp.
  • Context - non-bonded cargo with proceed code and invalid or missing bond information:
    For Reject Proceed Code:
    When system validates bond information and finds it invalid, then system rejects proceed code processing and maintains current cargo status.
  • Context - failed bond validation or missing bond information for proceed code:
    For Generate Error Message:
    When system generates error notification, then system creates error message indicating bond processing failure with cargo details and reason code.
  • Context - non-bonded cargo with failed bond processing:
    For Maintain Non-bonded Status:
    When system maintains current status, then system keeps cargo in non-bonded status and does not apply proceed disposition code.
👨‍💻 Technical ACs (Gherkin)
Context: Non-bonded traffic cargo with proceed disposition code
GIVEN
Non-bonded traffic cargo with proceed disposition code
Applied to: Broker Bond Information Available?
WHEN
System checks for broker bond information in K1 remarks segment
THEN
System identifies if bond control number is available from broker
Context: Broker bond information is available in K1 segment
GIVEN
Broker bond information is available in K1 segment
Applied to: Retrieve Bond Information from Broker
WHEN
System processes K1 remarks containing bond details
THEN
System extracts bond control number and broker information for cargo processing
Context: Bond control number extracted from broker information
GIVEN
Bond control number extracted from broker information
Applied to: Validate Bond Control Number
WHEN
System validates bond number format and checks against bond database
THEN
System determines if bond number is valid and active
Context: Valid bond control number and non-bonded cargo record
GIVEN
Valid bond control number and non-bonded cargo record
Applied to: Apply Bond to Non-bonded Traffic
WHEN
System processes bond assignment for proceed code
THEN
System updates cargo record with bond control number and changes status from non-bonded to bonded
Context: Cargo with valid bond assignment
GIVEN
Cargo with valid bond assignment
Applied to: Set Proceed Status with Bond
WHEN
System processes proceed disposition code with bond
THEN
System sets cargo status to proceed and includes bond control number in status record
Context: Cargo with proceed status and valid bond
GIVEN
Cargo with proceed status and valid bond
Applied to: Update Border Arrival Date
WHEN
System processes border arrival information
THEN
System updates cargo record with current border arrival date and time
Context: Cargo previously marked as non-bonded with new bond assignment
GIVEN
Cargo previously marked as non-bonded with new bond assignment
Applied to: Clear Previous Non-bonded Status
WHEN
System updates cargo status with bond information
THEN
System clears all non-bonded status flags and updates status array
Context: Cargo with validated bond information and updated status
GIVEN
Cargo with validated bond information and updated status
Applied to: Update Cargo Record with Bond Info
WHEN
System commits cargo record changes
THEN
System updates cargo database record with bond control number, proceed status, and border arrival date
Context: Cargo successfully updated with bond and proceed status
GIVEN
Cargo successfully updated with bond and proceed status
Applied to: Generate Proceed Notification
WHEN
System generates status notification
THEN
System creates Merlin message with proceed status, bond information, and cargo details for broker notification
Context: Completed bond assignment to cargo
GIVEN
Completed bond assignment to cargo
Applied to: Log Bond Assignment Transaction
WHEN
System logs transaction details
THEN
System creates audit log entry with cargo CCN, bond number, broker information, and timestamp
Context: Non-bonded cargo with proceed code and invalid or missing bond information
GIVEN
Non-bonded cargo with proceed code and invalid or missing bond information
Applied to: Reject Proceed Code
WHEN
System validates bond information and finds it invalid
THEN
System rejects proceed code processing and maintains current cargo status
Context: Failed bond validation or missing bond information for proceed code
GIVEN
Failed bond validation or missing bond information for proceed code
Applied to: Generate Error Message
WHEN
System generates error notification
THEN
System creates error message indicating bond processing failure with cargo details and reason code
Context: Non-bonded cargo with failed bond processing
GIVEN
Non-bonded cargo with failed bond processing
Applied to: Maintain Non-bonded Status
WHEN
System maintains current status
THEN
System keeps cargo in non-bonded status and does not apply proceed disposition code
R-GCX016-cbl-00815 (+2) File: GCX016.cbl Broker vs QP Bond Processing Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker vs QP Bond Processing':
  • Context - a cargo record with disposition codes '1j', '69', or '55' is being processed:
    For Bond Processing Required:
    When the system evaluates the disposition code for in-bond requirements, then the system sets master in-bond flag and processes bond number information.
  • Context - a cargo record is being processed with disposition code 95:
    For Clear Bond Information if DC 95:
    When the system processes the disposition code, then the system clears existing bond control numbers and processes as proceed status.
  • Context - an entry number is provided in the x4 segment:
    For Process Broker Entry Numbers:
    When the entry number starts with 'v' prefix, then the system places the entry number in the entry number field, otherwise places it in the in-bond control number field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with disposition codes '1J', '69', or '55' is being processed
GIVEN
A cargo record with disposition codes '1J', '69', or '55' is being processed
Applied to: Bond Processing Required
WHEN
The system evaluates the disposition code for in-bond requirements
THEN
The system sets master in-bond flag and processes bond number information
Context: A cargo record is being processed with disposition code 95
GIVEN
A cargo record is being processed with disposition code 95
Applied to: Clear Bond Information if DC 95
WHEN
The system processes the disposition code
THEN
The system clears existing bond control numbers and processes as proceed status
Context: An entry number is provided in the X4 segment
GIVEN
An entry number is provided in the X4 segment
Applied to: Process Broker Entry Numbers
WHEN
The entry number starts with 'V' prefix
THEN
The system places the entry number in the entry number field, otherwise places it in the in-bond control number field
R-GCX016-cbl-00818 File: GCX016.cbl Tax Number Processing
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Tax Number Processing':
  • Context - a cargo record with disposition code 95 and entry type in (61, 62, 63, 69) and cargo type is cprs:
    For Tax Number Processing - Handle CPRS tax numbers for Canadian Pacific entities:
    When the system processes the x4 segment for in-bond processing, then the system should lookup cprs tax number for broker identification and prepare appropriate broker messages.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with disposition code 95 and entry type in (61, 62, 63, 69) and cargo type is CPRS
GIVEN
A cargo record with disposition code 95 and entry type in (61, 62, 63, 69) and cargo type is CPRS
Applied to: Tax Number Processing - Handle CPRS tax numbers for Canadian Pacific entities
WHEN
The system processes the X4 segment for in-bond processing
THEN
The system should lookup CPRS tax number for broker identification and prepare appropriate broker messages
R-GCX016-cbl-00819 (+8) File: GCX016.cbl Port Mapping Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Port Mapping':
  • Context - a cargo record is being processed for port mapping:
    For Port Code Available?:
    When the system evaluates the bonded-to port code field, then the system determines if a port code is present and proceeds with mapping or completes the process.
  • Context - a cargo record contains a bonded-to port code:
    For Extract Bonded-To Port Code:
    When the port mapping process requires the port code for lookup, then the system extracts the bonded-to port code from the cargo record.
  • Context - a bonded-to port code has been extracted from the cargo record:
    For Call GCCTBIO for DS Table Lookup:
    When the system needs to retrieve the corresponding port name, then the system calls gcctbio to lookup the port information in the ds table.
  • Context - a ds table lookup has been performed for a port code:
    For DS Table Record Found?:
    When the system evaluates the lookup results, then the system determines if a matching ds table record was found and proceeds with port name retrieval or uses default handling.
  • Context - a matching ds table record has been found for the port code:
    For Retrieve Port Name from DS Table:
    When the system needs to obtain the port name, then the system retrieves the port name from the ds table record.
  • Context - a port name has been retrieved from the ds table:
    For Map Port Code to Port Name:
    When the system needs to establish the port code to port name relationship, then the system maps the port code to the retrieved port name.
  • Context - a ds table lookup has failed to find a matching record for the port code:
    For Use Default Port Name:
    When the system needs to provide a port name for the cargo record, then the system uses a default port name.
  • Context - a port code lookup has failed in the ds table:
    For Log Port Code Not Found:
    When the system needs to record the lookup failure, then the system logs that the port code was not found.
  • Context - port mapping has been completed with either retrieved or default port name:
    For Update Cargo Record with Port Information:
    When the cargo record needs to be updated with port information, then the system updates the cargo record with the port code and corresponding port name.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for port mapping
GIVEN
A cargo record is being processed for port mapping
Applied to: Port Code Available?
WHEN
The system evaluates the bonded-to port code field
THEN
The system determines if a port code is present and proceeds with mapping or completes the process
Context: A cargo record contains a bonded-to port code
GIVEN
A cargo record contains a bonded-to port code
Applied to: Extract Bonded-To Port Code
WHEN
The port mapping process requires the port code for lookup
THEN
The system extracts the bonded-to port code from the cargo record
Context: A bonded-to port code has been extracted from the cargo record
GIVEN
A bonded-to port code has been extracted from the cargo record
Applied to: Call GCCTBIO for DS Table Lookup
WHEN
The system needs to retrieve the corresponding port name
THEN
The system calls GCCTBIO to lookup the port information in the DS table
Context: A DS table lookup has been performed for a port code
GIVEN
A DS table lookup has been performed for a port code
Applied to: DS Table Record Found?
WHEN
The system evaluates the lookup results
THEN
The system determines if a matching DS table record was found and proceeds with port name retrieval or uses default handling
Context: A matching DS table record has been found for the port code
GIVEN
A matching DS table record has been found for the port code
Applied to: Retrieve Port Name from DS Table
WHEN
The system needs to obtain the port name
THEN
The system retrieves the port name from the DS table record
Context: A port name has been retrieved from the DS table
GIVEN
A port name has been retrieved from the DS table
Applied to: Map Port Code to Port Name
WHEN
The system needs to establish the port code to port name relationship
THEN
The system maps the port code to the retrieved port name
Context: A DS table lookup has failed to find a matching record for the port code
GIVEN
A DS table lookup has failed to find a matching record for the port code
Applied to: Use Default Port Name
WHEN
The system needs to provide a port name for the cargo record
THEN
The system uses a default port name
Context: A port code lookup has failed in the DS table
GIVEN
A port code lookup has failed in the DS table
Applied to: Log Port Code Not Found
WHEN
The system needs to record the lookup failure
THEN
The system logs that the port code was not found
Context: Port mapping has been completed with either retrieved or default port name
GIVEN
Port mapping has been completed with either retrieved or default port name
Applied to: Update Cargo Record with Port Information
WHEN
The cargo record needs to be updated with port information
THEN
The system updates the cargo record with the port code and corresponding port name
R-GCX016-cbl-00828 (+19) File: GCX016.cbl Arrival Status Processing Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Arrival Status Processing':
  • Context - a cargo record exists with pod disposition code in the message:
    For POD - Proof of Delivery Code:
    When the system processes the pod disposition code, then the system sets arrival status and updates arrival date based on cargo location (border or destination).
  • Context - a cargo record exists with aad disposition code in the message:
    For AAD - Arrival at Destination Code:
    When the system processes the aad disposition code, then the system sets destination arrival status and updates destination arrival date.
  • Context - a cargo record with arrival disposition code is being processed:
    For Cargo Location Check:
    When the system checks the cargo's current location status, then the system routes to either border location processing or destination location processing based on cargo location.
  • Context - cargo is determined to be at border location with arrival disposition code:
    For Border Location Processing:
    When the system processes border arrival, then the system sets border arrival flag and updates border arrival date.
  • Context - cargo is determined to be at destination location with arrival disposition code:
    For Destination Location Processing:
    When the system processes destination arrival, then the system sets destination arrival flag and updates destination arrival date.
  • Context - cargo is being processed for border arrival:
    For Set Border Arrival Flag:
    When the system updates cargo status for border arrival, then the system sets the border arrival flag to true.
  • Context - cargo is being processed for destination arrival:
    For Set Destination Arrival Flag:
    When the system updates cargo status for destination arrival, then the system sets the destination arrival flag to true.
  • Context - cargo has border arrival flag set and current system date/time is available:
    For Update Border Arrival Date:
    When the system processes border arrival date update, then the system updates the border arrival date field with current date and time.
  • Context - cargo has destination arrival flag set and current system date/time is available:
    For Update Destination Arrival Date:
    When the system processes destination arrival date update, then the system updates the destination arrival date field with current date and time.
  • Context - cargo arrival processing is in progress:
    For Export Manifest Check:
    When the system checks the cargo's manifest type, then the system determines if cargo is export or import based on manifest type.
  • Context - cargo is determined to be on export manifest:
    For Set Export Arrival Status:
    When the system processes arrival status for export cargo, then the system sets export arrival status in cargo record.
  • Context - cargo is determined to be on import manifest:
    For Set Import Arrival Status:
    When the system processes arrival status for import cargo, then the system sets import arrival status in cargo record.
  • Context - cargo has arrival status set and may have previous hold status:
    For Clear Previous Hold Status:
    When the system processes arrival status update, then the system clears any existing hold status flags and codes.
  • Context - cargo arrival processing is complete with arrival flags and dates set:
    For Update Cargo Status Array:
    When the system updates the cargo status array, then the system adds arrival status codes and information to the cargo status array.
  • Context - cargo arrival processing is complete:
    For Train Level Processing:
    When the system checks if train-level processing is required, then the system either proceeds to train arrival status update or skips to cargo record update.
  • Context - train-level processing is required for arrival:
    For Update Train Arrival Status:
    When the system processes train arrival status, then the system updates the train record with arrival status and date.
  • Context - train arrival status has been updated:
    For Send Train Arrival Notification:
    When the system processes train arrival notification, then the system sends arrival notification message to appropriate recipients.
  • Context - all arrival processing is complete including status array updates:
    For Update Cargo Record in Database:
    When the system updates the cargo record in database, then the system saves all arrival flags, dates, and status changes to the cargo record.
  • Context - cargo record has been updated in database with arrival information:
    For Generate Arrival Message:
    When the system generates arrival message, then the system creates and formats arrival message with cargo and arrival details.
  • Context - arrival message has been generated and all processing is complete:
    For Log Arrival Processing:
    When the system logs arrival processing, then the system creates audit log entry with arrival processing details and timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with POD disposition code in the message
GIVEN
A cargo record exists with POD disposition code in the message
Applied to: POD - Proof of Delivery Code
WHEN
The system processes the POD disposition code
THEN
The system sets arrival status and updates arrival date based on cargo location (border or destination)
Context: A cargo record exists with AAD disposition code in the message
GIVEN
A cargo record exists with AAD disposition code in the message
Applied to: AAD - Arrival at Destination Code
WHEN
The system processes the AAD disposition code
THEN
The system sets destination arrival status and updates destination arrival date
Context: A cargo record with arrival disposition code is being processed
GIVEN
A cargo record with arrival disposition code is being processed
Applied to: Cargo Location Check
WHEN
The system checks the cargo's current location status
THEN
The system routes to either border location processing or destination location processing based on cargo location
Context: Cargo is determined to be at border location with arrival disposition code
GIVEN
Cargo is determined to be at border location with arrival disposition code
Applied to: Border Location Processing
WHEN
The system processes border arrival
THEN
The system sets border arrival flag and updates border arrival date
Context: Cargo is determined to be at destination location with arrival disposition code
GIVEN
Cargo is determined to be at destination location with arrival disposition code
Applied to: Destination Location Processing
WHEN
The system processes destination arrival
THEN
The system sets destination arrival flag and updates destination arrival date
Context: Cargo is being processed for border arrival
GIVEN
Cargo is being processed for border arrival
Applied to: Set Border Arrival Flag
WHEN
The system updates cargo status for border arrival
THEN
The system sets the border arrival flag to true
Context: Cargo is being processed for destination arrival
GIVEN
Cargo is being processed for destination arrival
Applied to: Set Destination Arrival Flag
WHEN
The system updates cargo status for destination arrival
THEN
The system sets the destination arrival flag to true
Context: Cargo has border arrival flag set and current system date/time is available
GIVEN
Cargo has border arrival flag set and current system date/time is available
Applied to: Update Border Arrival Date
WHEN
The system processes border arrival date update
THEN
The system updates the border arrival date field with current date and time
Context: Cargo has destination arrival flag set and current system date/time is available
GIVEN
Cargo has destination arrival flag set and current system date/time is available
Applied to: Update Destination Arrival Date
WHEN
The system processes destination arrival date update
THEN
The system updates the destination arrival date field with current date and time
Context: Cargo arrival processing is in progress
GIVEN
Cargo arrival processing is in progress
Applied to: Export Manifest Check
WHEN
The system checks the cargo's manifest type
THEN
The system determines if cargo is export or import based on manifest type
Context: Cargo is determined to be on export manifest
GIVEN
Cargo is determined to be on export manifest
Applied to: Set Export Arrival Status
WHEN
The system processes arrival status for export cargo
THEN
The system sets export arrival status in cargo record
Context: Cargo is determined to be on import manifest
GIVEN
Cargo is determined to be on import manifest
Applied to: Set Import Arrival Status
WHEN
The system processes arrival status for import cargo
THEN
The system sets import arrival status in cargo record
Context: Cargo has arrival status set and may have previous hold status
GIVEN
Cargo has arrival status set and may have previous hold status
Applied to: Clear Previous Hold Status
WHEN
The system processes arrival status update
THEN
The system clears any existing hold status flags and codes
Context: Cargo arrival processing is complete with arrival flags and dates set
GIVEN
Cargo arrival processing is complete with arrival flags and dates set
Applied to: Update Cargo Status Array
WHEN
The system updates the cargo status array
THEN
The system adds arrival status codes and information to the cargo status array
Context: Cargo arrival processing is complete
GIVEN
Cargo arrival processing is complete
Applied to: Train Level Processing
WHEN
The system checks if train-level processing is required
THEN
The system either proceeds to train arrival status update or skips to cargo record update
Context: Train-level processing is required for arrival
GIVEN
Train-level processing is required for arrival
Applied to: Update Train Arrival Status
WHEN
The system processes train arrival status
THEN
The system updates the train record with arrival status and date
Context: Train arrival status has been updated
GIVEN
Train arrival status has been updated
Applied to: Send Train Arrival Notification
WHEN
The system processes train arrival notification
THEN
The system sends arrival notification message to appropriate recipients
Context: All arrival processing is complete including status array updates
GIVEN
All arrival processing is complete including status array updates
Applied to: Update Cargo Record in Database
WHEN
The system updates the cargo record in database
THEN
The system saves all arrival flags, dates, and status changes to the cargo record
Context: Cargo record has been updated in database with arrival information
GIVEN
Cargo record has been updated in database with arrival information
Applied to: Generate Arrival Message
WHEN
The system generates arrival message
THEN
The system creates and formats arrival message with cargo and arrival details
Context: Arrival message has been generated and all processing is complete
GIVEN
Arrival message has been generated and all processing is complete
Applied to: Log Arrival Processing
WHEN
The system logs arrival processing
THEN
The system creates audit log entry with arrival processing details and timestamp
R-GCX016-cbl-00848 (+15) File: GCX016.cbl Export Status Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Status Processing':
  • Context - a cargo record exists in the system with valid status information:
    For Export Status Processing Triggered:
    When export status processing is triggered for the cargo, then the system begins export status evaluation workflow.
  • Context - export status processing has been initiated for a cargo record:
    For Cargo Status Analysis Complete?:
    When the system checks if cargo status analysis is complete, then processing continues if analysis is complete, otherwise processing stops with error.
  • Context - cargo status analysis is confirmed complete:
    For Check Current Cargo Status:
    When the system checks current cargo status from gcsuss09 status segments, then current cargo status information is retrieved and made available for export evaluation.
  • Context - current cargo status has been retrieved from status segments:
    For Is Cargo Ready for Export?:
    When the system evaluates cargo readiness for export based on status conditions, then export processing continues if cargo is ready, otherwise export conditions not met error is generated.
  • Context - cargo has been determined ready for export:
    For Set Export Status Flag:
    When the system sets export status flag for the cargo, then export status flag is activated and cargo is marked for export processing.
  • Context - export status flag has been set for cargo:
    For Clear Destination Index RT076:
    When the system clears destination index rt076, then destination index is cleared and cargo is no longer tied to specific destination.
  • Context - export status flag is set and destination index is cleared:
    For Update Cargo Record Status:
    When the system updates cargo record status in gccc-cargo-root, then cargo record reflects updated export status and cleared destination information.
  • Context - cargo record status has been updated with export information:
    For Log Export Status Change:
    When the system logs export status change, then export status change is recorded in system logs for audit trail.
  • Context - export status change has been logged for cargo:
    For Canadian Manifest Coordination Required?:
    When the system checks if canadian manifest coordination is required, then processing branches to canadian manifest handling if required, otherwise continues to database update.
  • Context - canadian manifest coordination is required for export cargo:
    For Find Matching Canadian Manifest:
    When the system searches for matching canadian manifest records, then matching canadian manifest records are identified and retrieved for coordination.
  • Context - matching canadian manifest records have been found:
    For Generate Cross-Border Log Message:
    When the system generates cross-border log message, then cross-border coordination message is created and logged to canadian manifest records.
  • Context - cross-border coordination is complete or not required:
    For Update Database with Export Status:
    When the system updates database with export status, then export status changes are permanently stored in the database.
  • Context - database has been updated with export status:
    For Prepare Export Notification Message:
    When the system prepares export notification message, then export notification message is formatted and ready for routing.
  • Context - export notification message has been prepared:
    For Route Export Message to USEXP Basket:
    When the system routes export message to usexp basket, then export notification message is delivered to usexp basket for further processing.
  • Context - export message has been routed successfully or error conditions have been handled:
    For Export Status Processing Complete:
    When the system completes export status processing, then export status processing workflow is finished and control returns to calling process.
  • Context - cargo status analysis is incomplete or cargo is not ready for export:
    For Error: Export Conditions Not Met:
    When export conditions are not met, then error condition is set and export processing terminates without status changes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with valid status information
GIVEN
A cargo record exists in the system with valid status information
Applied to: Export Status Processing Triggered
WHEN
Export status processing is triggered for the cargo
THEN
The system begins export status evaluation workflow
Context: Export status processing has been initiated for a cargo record
GIVEN
Export status processing has been initiated for a cargo record
Applied to: Cargo Status Analysis Complete?
WHEN
The system checks if cargo status analysis is complete
THEN
Processing continues if analysis is complete, otherwise processing stops with error
Context: Cargo status analysis is confirmed complete
GIVEN
Cargo status analysis is confirmed complete
Applied to: Check Current Cargo Status
WHEN
The system checks current cargo status from GCSUSS09 status segments
THEN
Current cargo status information is retrieved and made available for export evaluation
Context: Current cargo status has been retrieved from status segments
GIVEN
Current cargo status has been retrieved from status segments
Applied to: Is Cargo Ready for Export?
WHEN
The system evaluates cargo readiness for export based on status conditions
THEN
Export processing continues if cargo is ready, otherwise export conditions not met error is generated
Context: Cargo has been determined ready for export
GIVEN
Cargo has been determined ready for export
Applied to: Set Export Status Flag
WHEN
The system sets export status flag for the cargo
THEN
Export status flag is activated and cargo is marked for export processing
Context: Export status flag has been set for cargo
GIVEN
Export status flag has been set for cargo
Applied to: Clear Destination Index RT076
WHEN
The system clears destination index RT076
THEN
Destination index is cleared and cargo is no longer tied to specific destination
Context: Export status flag is set and destination index is cleared
GIVEN
Export status flag is set and destination index is cleared
Applied to: Update Cargo Record Status
WHEN
The system updates cargo record status in GCCC-CARGO-ROOT
THEN
Cargo record reflects updated export status and cleared destination information
Context: Cargo record status has been updated with export information
GIVEN
Cargo record status has been updated with export information
Applied to: Log Export Status Change
WHEN
The system logs export status change
THEN
Export status change is recorded in system logs for audit trail
Context: Export status change has been logged for cargo
GIVEN
Export status change has been logged for cargo
Applied to: Canadian Manifest Coordination Required?
WHEN
The system checks if Canadian manifest coordination is required
THEN
Processing branches to Canadian manifest handling if required, otherwise continues to database update
Context: Canadian manifest coordination is required for export cargo
GIVEN
Canadian manifest coordination is required for export cargo
Applied to: Find Matching Canadian Manifest
WHEN
The system searches for matching Canadian manifest records
THEN
Matching Canadian manifest records are identified and retrieved for coordination
Context: Matching Canadian manifest records have been found
GIVEN
Matching Canadian manifest records have been found
Applied to: Generate Cross-Border Log Message
WHEN
The system generates cross-border log message
THEN
Cross-border coordination message is created and logged to Canadian manifest records
Context: Cross-border coordination is complete or not required
GIVEN
Cross-border coordination is complete or not required
Applied to: Update Database with Export Status
WHEN
The system updates database with export status
THEN
Export status changes are permanently stored in the database
Context: Database has been updated with export status
GIVEN
Database has been updated with export status
Applied to: Prepare Export Notification Message
WHEN
The system prepares export notification message
THEN
Export notification message is formatted and ready for routing
Context: Export notification message has been prepared
GIVEN
Export notification message has been prepared
Applied to: Route Export Message to USEXP Basket
WHEN
The system routes export message to USEXP basket
THEN
Export notification message is delivered to USEXP basket for further processing
Context: Export message has been routed successfully or error conditions have been handled
GIVEN
Export message has been routed successfully or error conditions have been handled
Applied to: Export Status Processing Complete
WHEN
The system completes export status processing
THEN
Export status processing workflow is finished and control returns to calling process
Context: Cargo status analysis is incomplete or cargo is not ready for export
GIVEN
Cargo status analysis is incomplete or cargo is not ready for export
Applied to: Error: Export Conditions Not Met
WHEN
Export conditions are not met
THEN
Error condition is set and export processing terminates without status changes
R-GCX016-cbl-00864 (+9) File: GCX016.cbl Cancellation Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cancellation Processing':
  • Context - a cancellation processing request is received with disposition code and cargo status information:
    For Cancellation Type?:
    When the system evaluates the message type and cargo current status, then the system routes to either arrival cancellation processing or export cancellation processing based on the evaluation criteria.
  • Context - an arrival cancellation request is identified for cargo:
    For Process Arrival Cancellation:
    When the system processes the arrival cancellation, then the system prepares arrival cancellation message and sends it via merlin messaging system.
  • Context - an export cancellation request is identified for cargo:
    For Process Export Cancellation:
    When the system processes the export cancellation, then the system prepares export cancellation message and sends it via merlin messaging system.
  • Context - an arrival cancellation has been processed for cargo:
    For Restore Previous Bond Dates:
    When the system needs to restore previous bond state, then the system restores previous bond dates and clears current arrival information to return cargo to pre-arrival state.
  • Context - an export cancellation has been processed for cargo:
    For Re-establish Destination Index:
    When the system needs to restore destination routing, then the system re-establishes destination index and updates routing information to restore proper cargo destination tracking.
  • Context - cancellation processing has been completed and previous dates/indexes restored:
    For Update Cargo Status:
    When the system updates cargo status, then the system sets appropriate cargo status based on cancellation type and updates cargo record with new status information.
  • Context - cancellation processing requires status array updates:
    For Update Status Array:
    When the system processes status array changes, then the system removes cancelled status codes from s09 array and adds appropriate cancellation status information.
  • Context - cancellation processing is complete with updated status and cargo information:
    For Generate Cancellation Notice:
    When the system generates cancellation notices, then the system creates formatted cancellation messages with cargo details, cancellation type, and routing information for distribution.
  • Context - cancellation notice has been generated:
    For Log Cancellation Transaction:
    When the system logs the transaction, then the system records cancellation details including cargo information, cancellation type, timestamp, and user information in transaction log.
  • Context - cancellation transaction has been logged:
    For Notify Integration Services:
    When the system notifies integration services, then the system sends cancellation notification to gcciis and other integration services with updated cargo status and cancellation details.
👨‍💻 Technical ACs (Gherkin)
Context: A cancellation processing request is received with disposition code and cargo status information
GIVEN
A cancellation processing request is received with disposition code and cargo status information
Applied to: Cancellation Type?
WHEN
The system evaluates the message type and cargo current status
THEN
The system routes to either arrival cancellation processing or export cancellation processing based on the evaluation criteria
Context: An arrival cancellation request is identified for cargo
GIVEN
An arrival cancellation request is identified for cargo
Applied to: Process Arrival Cancellation
WHEN
The system processes the arrival cancellation
THEN
The system prepares arrival cancellation message and sends it via Merlin messaging system
Context: An export cancellation request is identified for cargo
GIVEN
An export cancellation request is identified for cargo
Applied to: Process Export Cancellation
WHEN
The system processes the export cancellation
THEN
The system prepares export cancellation message and sends it via Merlin messaging system
Context: An arrival cancellation has been processed for cargo
GIVEN
An arrival cancellation has been processed for cargo
Applied to: Restore Previous Bond Dates
WHEN
The system needs to restore previous bond state
THEN
The system restores previous bond dates and clears current arrival information to return cargo to pre-arrival state
Context: An export cancellation has been processed for cargo
GIVEN
An export cancellation has been processed for cargo
Applied to: Re-establish Destination Index
WHEN
The system needs to restore destination routing
THEN
The system re-establishes destination index and updates routing information to restore proper cargo destination tracking
Context: Cancellation processing has been completed and previous dates/indexes restored
GIVEN
Cancellation processing has been completed and previous dates/indexes restored
Applied to: Update Cargo Status
WHEN
The system updates cargo status
THEN
The system sets appropriate cargo status based on cancellation type and updates cargo record with new status information
Context: Cancellation processing requires status array updates
GIVEN
Cancellation processing requires status array updates
Applied to: Update Status Array
WHEN
The system processes status array changes
THEN
The system removes cancelled status codes from S09 array and adds appropriate cancellation status information
Context: Cancellation processing is complete with updated status and cargo information
GIVEN
Cancellation processing is complete with updated status and cargo information
Applied to: Generate Cancellation Notice
WHEN
The system generates cancellation notices
THEN
The system creates formatted cancellation messages with cargo details, cancellation type, and routing information for distribution
Context: Cancellation notice has been generated
GIVEN
Cancellation notice has been generated
Applied to: Log Cancellation Transaction
WHEN
The system logs the transaction
THEN
The system records cancellation details including cargo information, cancellation type, timestamp, and user information in transaction log
Context: Cancellation transaction has been logged
GIVEN
Cancellation transaction has been logged
Applied to: Notify Integration Services
WHEN
The system notifies integration services
THEN
The system sends cancellation notification to GCCIIS and other integration services with updated cargo status and cancellation details
R-GCX016-cbl-00874 (+3) File: GCX016.cbl Age Calculation Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Age Calculation':
  • Context - a cargo record with bond start date information is being processed:
    For Calculate Age in Days:
    When the system needs to calculate cargo age for destination indexing, then the system converts both bond start date and current date to julian format and calculates the difference in days.
  • Context - a cargo record is being processed for age calculation:
    For Bond Start Date Available?:
    When the system checks for bond start date availability, then if bond start date is available, proceed with age calculation; otherwise set age to zero.
  • Context - a cargo record without a valid bond start date:
    For Set Age to Zero - No Bond Date:
    When age calculation is required for destination indexing, then the system sets cargo age to zero days.
  • Context - cargo age has been calculated or set to zero:
    For Use Age for Destination Indexing Decision:
    When the system processes destination indexing decisions, then the calculated age value is used to determine cargo priority for destination processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with bond start date information is being processed
GIVEN
A cargo record with bond start date information is being processed
Applied to: Calculate Age in Days
WHEN
The system needs to calculate cargo age for destination indexing
THEN
The system converts both bond start date and current date to Julian format and calculates the difference in days
Context: A cargo record is being processed for age calculation
GIVEN
A cargo record is being processed for age calculation
Applied to: Bond Start Date Available?
WHEN
The system checks for bond start date availability
THEN
If bond start date is available, proceed with age calculation; otherwise set age to zero
Context: A cargo record without a valid bond start date
GIVEN
A cargo record without a valid bond start date
Applied to: Set Age to Zero - No Bond Date
WHEN
Age calculation is required for destination indexing
THEN
The system sets cargo age to zero days
Context: Cargo age has been calculated or set to zero
GIVEN
Cargo age has been calculated or set to zero
Applied to: Use Age for Destination Indexing Decision
WHEN
The system processes destination indexing decisions
THEN
The calculated age value is used to determine cargo priority for destination processing
R-GCX016-cbl-00878 (+16) File: GCX016.cbl Counterpart Removal Logic Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Counterpart Removal Logic':
  • Context - a disposition code needs to be processed for counterpart removal:
    For Get Disposition Code from DC Table:
    When the system looks up the disposition code in the dc table, then the disposition code information including counterpart code is retrieved from the table.
  • Context - disposition code information has been retrieved from the dc table:
    For Has Counterpart Code?:
    When the system checks if a counterpart code exists for the disposition code, then if counterpart code exists, proceed with counterpart removal logic, otherwise skip counterpart removal processing.
  • Context - a counterpart code exists and needs to be removed from the status array:
    For Initialize Status Array Search:
    When the system initializes the search process for the s09a status array, then search parameters are set up to iterate through all elements in the status array.
  • Context - the status array search has been initialized with counterpart code criteria:
    For Search S09A Array for Matching Elements:
    When the system searches through each element in the s09a status array, then each array element is evaluated against the counterpart code matching criteria.
  • Context - a status array element is being evaluated against counterpart code criteria:
    For Match Found?:
    When the system compares the element against the counterpart matching rules, then if a match is found, proceed with detailed matching criteria validation, otherwise continue searching remaining elements.
  • Context - a potential counterpart match has been found in the status array:
    For Check Matching Criteria:
    When the system begins detailed matching criteria evaluation, then multiple matching criteria are evaluated in sequence to determine if the element should be removed.
  • Context - a status array element is being evaluated for counterpart removal:
    For Status Info Match?:
    When the system checks if the status information matches the counterpart criteria, then if status information matches, mark element for removal, otherwise continue with entry number validation.
  • Context - status information did not match counterpart criteria for a status array element:
    For Entry Number Match?:
    When the system checks if the entry number matches the counterpart criteria, then if entry number matches, mark element for removal, otherwise continue with quantity validation.
  • Context - entry number did not match counterpart criteria for a status array element:
    For Quantity Match?:
    When the system checks if the quantity matches the counterpart criteria, then if quantity matches, mark element for removal, otherwise continue with specific code pattern validation.
  • Context - quantity did not match counterpart criteria for a status array element:
    For Specific Code Pattern Match?:
    When the system checks if the element matches specific code patterns for counterpart removal, then if specific code pattern matches, mark element for removal, otherwise continue searching remaining elements.
  • Context - a status array element has been identified as matching counterpart removal criteria:
    For Remove Element from Array:
    When the system removes the element from the s09a status array, then the matching element is marked for removal from the status array.
  • Context - one or more elements have been removed from the s09a status array:
    For Compact Remaining Array Elements:
    When the system compacts the remaining array elements, then all remaining elements are moved to eliminate gaps and maintain array integrity.
  • Context - the status array has been compacted after element removal:
    For Update Array Count:
    When the system updates the array element count, then the array count reflects the actual number of remaining elements after counterpart removal.
  • Context - a counterpart element has been removed and the array has been updated:
    For Continue Search for More Matches:
    When the system continues searching for additional counterpart matches, then the search process resumes with the remaining elements in the status array.
  • Context - the system has processed a status array element for counterpart matching:
    For More Elements to Check?:
    When the system checks if more elements remain to be processed, then if more elements exist, continue searching, otherwise complete the counterpart removal process.
  • Context - all elements in the status array have been checked for counterpart matches:
    For Counterpart Removal Complete:
    When the counterpart removal process is completed, then the status array contains only non-counterpart elements and the removal process is finished.
  • Context - a disposition code has been retrieved from the dc table:
    For No Counterpart Code - Skip Removal:
    When the disposition code has no associated counterpart code, then the counterpart removal process is skipped and processing continues without array modification.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code needs to be processed for counterpart removal
GIVEN
A disposition code needs to be processed for counterpart removal
Applied to: Get Disposition Code from DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The disposition code information including counterpart code is retrieved from the table
Context: Disposition code information has been retrieved from the DC table
GIVEN
Disposition code information has been retrieved from the DC table
Applied to: Has Counterpart Code?
WHEN
The system checks if a counterpart code exists for the disposition code
THEN
If counterpart code exists, proceed with counterpart removal logic, otherwise skip counterpart removal processing
Context: A counterpart code exists and needs to be removed from the status array
GIVEN
A counterpart code exists and needs to be removed from the status array
Applied to: Initialize Status Array Search
WHEN
The system initializes the search process for the S09A status array
THEN
Search parameters are set up to iterate through all elements in the status array
Context: The status array search has been initialized with counterpart code criteria
GIVEN
The status array search has been initialized with counterpart code criteria
Applied to: Search S09A Array for Matching Elements
WHEN
The system searches through each element in the S09A status array
THEN
Each array element is evaluated against the counterpart code matching criteria
Context: A status array element is being evaluated against counterpart code criteria
GIVEN
A status array element is being evaluated against counterpart code criteria
Applied to: Match Found?
WHEN
The system compares the element against the counterpart matching rules
THEN
If a match is found, proceed with detailed matching criteria validation, otherwise continue searching remaining elements
Context: A potential counterpart match has been found in the status array
GIVEN
A potential counterpart match has been found in the status array
Applied to: Check Matching Criteria
WHEN
The system begins detailed matching criteria evaluation
THEN
Multiple matching criteria are evaluated in sequence to determine if the element should be removed
Context: A status array element is being evaluated for counterpart removal
GIVEN
A status array element is being evaluated for counterpart removal
Applied to: Status Info Match?
WHEN
The system checks if the status information matches the counterpart criteria
THEN
If status information matches, mark element for removal, otherwise continue with entry number validation
Context: Status information did not match counterpart criteria for a status array element
GIVEN
Status information did not match counterpart criteria for a status array element
Applied to: Entry Number Match?
WHEN
The system checks if the entry number matches the counterpart criteria
THEN
If entry number matches, mark element for removal, otherwise continue with quantity validation
Context: Entry number did not match counterpart criteria for a status array element
GIVEN
Entry number did not match counterpart criteria for a status array element
Applied to: Quantity Match?
WHEN
The system checks if the quantity matches the counterpart criteria
THEN
If quantity matches, mark element for removal, otherwise continue with specific code pattern validation
Context: Quantity did not match counterpart criteria for a status array element
GIVEN
Quantity did not match counterpart criteria for a status array element
Applied to: Specific Code Pattern Match?
WHEN
The system checks if the element matches specific code patterns for counterpart removal
THEN
If specific code pattern matches, mark element for removal, otherwise continue searching remaining elements
Context: A status array element has been identified as matching counterpart removal criteria
GIVEN
A status array element has been identified as matching counterpart removal criteria
Applied to: Remove Element from Array
WHEN
The system removes the element from the S09A status array
THEN
The matching element is marked for removal from the status array
Context: One or more elements have been removed from the S09A status array
GIVEN
One or more elements have been removed from the S09A status array
Applied to: Compact Remaining Array Elements
WHEN
The system compacts the remaining array elements
THEN
All remaining elements are moved to eliminate gaps and maintain array integrity
Context: The status array has been compacted after element removal
GIVEN
The status array has been compacted after element removal
Applied to: Update Array Count
WHEN
The system updates the array element count
THEN
The array count reflects the actual number of remaining elements after counterpart removal
Context: A counterpart element has been removed and the array has been updated
GIVEN
A counterpart element has been removed and the array has been updated
Applied to: Continue Search for More Matches
WHEN
The system continues searching for additional counterpart matches
THEN
The search process resumes with the remaining elements in the status array
Context: The system has processed a status array element for counterpart matching
GIVEN
The system has processed a status array element for counterpart matching
Applied to: More Elements to Check?
WHEN
The system checks if more elements remain to be processed
THEN
If more elements exist, continue searching, otherwise complete the counterpart removal process
Context: All elements in the status array have been checked for counterpart matches
GIVEN
All elements in the status array have been checked for counterpart matches
Applied to: Counterpart Removal Complete
WHEN
The counterpart removal process is completed
THEN
The status array contains only non-counterpart elements and the removal process is finished
Context: A disposition code has been retrieved from the DC table
GIVEN
A disposition code has been retrieved from the DC table
Applied to: No Counterpart Code - Skip Removal
WHEN
The disposition code has no associated counterpart code
THEN
The counterpart removal process is skipped and processing continues without array modification
R-GCX016-cbl-00895 (+8) File: GCX016.cbl Release Quantity Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Quantity Processing':
  • Context - a disposition code is being processed for cargo release:
    For Disposition Code Has Quantity Action?:
    When the system evaluates if the disposition code has an associated quantity action, then the system should proceed to quantity processing if action exists, otherwise skip quantity calculations.
  • Context - a cargo record exists with current released quantity information:
    For Get Current Released Quantity from Cargo:
    When the system needs to perform quantity calculations, then the system should retrieve the current released quantity from the cargo record.
  • Context - a disposition code with quantity action is being processed:
    For Quantity Action Type?:
    When the system evaluates the type of quantity action required, then the system should identify whether to add or subtract the quantity from current released amount.
  • Context - a disposition code requires adding quantity to released amount and current released quantity exists and x4 segment contains quantity value:
    For Add Action: Released Qty = Released Qty + X4 Quantity:
    When the system performs add quantity action, then the system should calculate new released quantity as current released quantity plus x4 quantity.
  • Context - a disposition code requires subtracting quantity from released amount and current released quantity exists and x4 segment contains quantity value:
    For Subtract Action: Released Qty = Released Qty - X4 Quantity:
    When the system performs subtract quantity action, then the system should calculate new released quantity as current released quantity minus x4 quantity.
  • Context - a quantity calculation has been performed for released amount:
    For Result Less Than Zero?:
    When the calculated result is less than zero, then the system should identify this as an invalid negative quantity condition.
  • Context - a quantity calculation results in a negative value:
    For Set Released Quantity to Zero:
    When the system needs to assign a valid released quantity, then the system should set the released quantity to zero to prevent negative inventory.
  • Context - a quantity calculation results in zero or positive value:
    For Keep Calculated Released Quantity:
    When the system needs to assign the released quantity, then the system should retain the calculated released quantity value.
  • Context - a final released quantity has been determined through calculations and validations:
    For Update Cargo Record with New Released Quantity:
    When the system needs to persist the quantity changes, then the system should update the cargo record with the new released quantity value.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo release
GIVEN
A disposition code is being processed for cargo release
Applied to: Disposition Code Has Quantity Action?
WHEN
The system evaluates if the disposition code has an associated quantity action
THEN
The system should proceed to quantity processing if action exists, otherwise skip quantity calculations
Context: A cargo record exists with current released quantity information
GIVEN
A cargo record exists with current released quantity information
Applied to: Get Current Released Quantity from Cargo
WHEN
The system needs to perform quantity calculations
THEN
The system should retrieve the current released quantity from the cargo record
Context: A disposition code with quantity action is being processed
GIVEN
A disposition code with quantity action is being processed
Applied to: Quantity Action Type?
WHEN
The system evaluates the type of quantity action required
THEN
The system should identify whether to add or subtract the quantity from current released amount
Context: A disposition code requires adding quantity to released amount AND current released quantity exists AND X4 segment contains quantity value
GIVEN
A disposition code requires adding quantity to released amount AND current released quantity exists AND X4 segment contains quantity value
Applied to: Add Action: Released Qty = Released Qty + X4 Quantity
WHEN
The system performs add quantity action
THEN
The system should calculate new released quantity as current released quantity plus X4 quantity
Context: A disposition code requires subtracting quantity from released amount AND current released quantity exists AND X4 segment contains quantity value
GIVEN
A disposition code requires subtracting quantity from released amount AND current released quantity exists AND X4 segment contains quantity value
Applied to: Subtract Action: Released Qty = Released Qty - X4 Quantity
WHEN
The system performs subtract quantity action
THEN
The system should calculate new released quantity as current released quantity minus X4 quantity
Context: A quantity calculation has been performed for released amount
GIVEN
A quantity calculation has been performed for released amount
Applied to: Result Less Than Zero?
WHEN
The calculated result is less than zero
THEN
The system should identify this as an invalid negative quantity condition
Context: A quantity calculation results in a negative value
GIVEN
A quantity calculation results in a negative value
Applied to: Set Released Quantity to Zero
WHEN
The system needs to assign a valid released quantity
THEN
The system should set the released quantity to zero to prevent negative inventory
Context: A quantity calculation results in zero or positive value
GIVEN
A quantity calculation results in zero or positive value
Applied to: Keep Calculated Released Quantity
WHEN
The system needs to assign the released quantity
THEN
The system should retain the calculated released quantity value
Context: A final released quantity has been determined through calculations and validations
GIVEN
A final released quantity has been determined through calculations and validations
Applied to: Update Cargo Record with New Released Quantity
WHEN
The system needs to persist the quantity changes
THEN
The system should update the cargo record with the new released quantity value
R-GCX016-cbl-00904 (+15) File: GCX016.cbl Cargo Hold Message Generation Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Hold Message Generation':
  • Context - a cargo item has been identified as having hold status:
    For Determine Hold Location:
    When the system evaluates the cargo hold location type, then the system determines if the hold is at border location or destination location based on cargo status flags.
  • Context - a cargo hold location has been determined as either border or destination:
    For Format Hold Message with Location Details:
    When the system formats the hold message, then the system includes appropriate location details in the message format based on hold location type.
  • Context - a hold message is being formatted for cargo:
    For Include Cargo Information:
    When the system adds cargo information to the message, then the system includes car id, waybill number, us-ccn key, and other cargo identifiers in the message.
  • Context - a hold message is being formatted with cargo information:
    For Add Disposition Code Details:
    When the system adds disposition code details, then the system includes the disposition code and its description from the dc table in the message.
  • Context - a hold message is being formatted with disposition code details:
    For Include Quantity Information:
    When the system adds quantity information, then the system includes total cargo quantity and quantity affected by the hold in the message.
  • Context - a hold message is being formatted with quantity information:
    For Add K1 Comments if Available:
    When the system checks for k1 comments availability, then if k1 comments exist, the system adds the remarks to the hold message, otherwise proceeds without comments.
  • Context - a hold message has been formatted with all required information:
    For Message Routing Required?:
    When the system evaluates routing requirements, then if message routing is required, the system proceeds to determine recipients, otherwise logs the message generation.
  • Context - a hold message requires routing to external recipients:
    For Determine Message Recipients:
    When the system determines message recipients, then the system identifies recipients including station merlin ids, broker contacts, and payer of freight based on cargo configuration.
  • Context - message recipients have been determined for hold message:
    For Broker Notification Required?:
    When the system checks broker notification requirements, then if broker notification is required, the system retrieves broker information, otherwise sends to multiple standard destinations.
  • Context - broker notification is required for cargo hold message:
    For Get Broker Information:
    When the system retrieves broker information, then the system gets payer of freight broker information if available, otherwise uses cargo broker information.
  • Context - broker information has been retrieved for notification:
    For Check Broker Preferences:
    When the system checks broker communication preferences, then the system determines if broker prefers email notification or merlin messaging based on broker configuration.
  • Context - broker preferences indicate email as preferred communication method:
    For Route via Email:
    When the system routes the message via email, then the system sends the hold message to broker's email address and proceeds to send to payer of freight.
  • Context - broker preferences indicate merlin as preferred communication method:
    For Route via Merlin:
    When the system routes the message via merlin, then the system sends the hold message to broker's merlin id and proceeds to send to payer of freight.
  • Context - hold message has been routed to broker via preferred communication method:
    For Send to Payer of Freight:
    When the system sends message to payer of freight, then if payer of freight information exists, the system sends the hold message to payer of freight contact.
  • Context - hold message routing to specific recipients has been completed or broker notification is not required:
    For Send to Multiple Destinations:
    When the system sends message to multiple destinations, then the system sends the hold message to station-specific merlin ids and other configured destinations.
  • Context - hold message has been sent to all required destinations:
    For Log Hold Message Generation:
    When the system logs the message generation, then the system records the hold message generation event including recipients and message details for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo item has been identified as having hold status
GIVEN
A cargo item has been identified as having hold status
Applied to: Determine Hold Location
WHEN
The system evaluates the cargo hold location type
THEN
The system determines if the hold is at border location or destination location based on cargo status flags
Context: A cargo hold location has been determined as either border or destination
GIVEN
A cargo hold location has been determined as either border or destination
Applied to: Format Hold Message with Location Details
WHEN
The system formats the hold message
THEN
The system includes appropriate location details in the message format based on hold location type
Context: A hold message is being formatted for cargo
GIVEN
A hold message is being formatted for cargo
Applied to: Include Cargo Information
WHEN
The system adds cargo information to the message
THEN
The system includes car ID, waybill number, US-CCN key, and other cargo identifiers in the message
Context: A hold message is being formatted with cargo information
GIVEN
A hold message is being formatted with cargo information
Applied to: Add Disposition Code Details
WHEN
The system adds disposition code details
THEN
The system includes the disposition code and its description from the DC table in the message
Context: A hold message is being formatted with disposition code details
GIVEN
A hold message is being formatted with disposition code details
Applied to: Include Quantity Information
WHEN
The system adds quantity information
THEN
The system includes total cargo quantity and quantity affected by the hold in the message
Context: A hold message is being formatted with quantity information
GIVEN
A hold message is being formatted with quantity information
Applied to: Add K1 Comments if Available
WHEN
The system checks for K1 comments availability
THEN
If K1 comments exist, the system adds the remarks to the hold message, otherwise proceeds without comments
Context: A hold message has been formatted with all required information
GIVEN
A hold message has been formatted with all required information
Applied to: Message Routing Required?
WHEN
The system evaluates routing requirements
THEN
If message routing is required, the system proceeds to determine recipients, otherwise logs the message generation
Context: A hold message requires routing to external recipients
GIVEN
A hold message requires routing to external recipients
Applied to: Determine Message Recipients
WHEN
The system determines message recipients
THEN
The system identifies recipients including station Merlin IDs, broker contacts, and payer of freight based on cargo configuration
Context: Message recipients have been determined for hold message
GIVEN
Message recipients have been determined for hold message
Applied to: Broker Notification Required?
WHEN
The system checks broker notification requirements
THEN
If broker notification is required, the system retrieves broker information, otherwise sends to multiple standard destinations
Context: Broker notification is required for cargo hold message
GIVEN
Broker notification is required for cargo hold message
Applied to: Get Broker Information
WHEN
The system retrieves broker information
THEN
The system gets payer of freight broker information if available, otherwise uses cargo broker information
Context: Broker information has been retrieved for notification
GIVEN
Broker information has been retrieved for notification
Applied to: Check Broker Preferences
WHEN
The system checks broker communication preferences
THEN
The system determines if broker prefers email notification or Merlin messaging based on broker configuration
Context: Broker preferences indicate email as preferred communication method
GIVEN
Broker preferences indicate email as preferred communication method
Applied to: Route via Email
WHEN
The system routes the message via email
THEN
The system sends the hold message to broker's email address and proceeds to send to payer of freight
Context: Broker preferences indicate Merlin as preferred communication method
GIVEN
Broker preferences indicate Merlin as preferred communication method
Applied to: Route via Merlin
WHEN
The system routes the message via Merlin
THEN
The system sends the hold message to broker's Merlin ID and proceeds to send to payer of freight
Context: Hold message has been routed to broker via preferred communication method
GIVEN
Hold message has been routed to broker via preferred communication method
Applied to: Send to Payer of Freight
WHEN
The system sends message to payer of freight
THEN
If payer of freight information exists, the system sends the hold message to payer of freight contact
Context: Hold message routing to specific recipients has been completed or broker notification is not required
GIVEN
Hold message routing to specific recipients has been completed or broker notification is not required
Applied to: Send to Multiple Destinations
WHEN
The system sends message to multiple destinations
THEN
The system sends the hold message to station-specific Merlin IDs and other configured destinations
Context: Hold message has been sent to all required destinations
GIVEN
Hold message has been sent to all required destinations
Applied to: Log Hold Message Generation
WHEN
The system logs the message generation
THEN
The system records the hold message generation event including recipients and message details for audit trail
R-GCX016-cbl-00947 (+11) File: GCX016.cbl Complex Cargo Status Determination Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Complex Cargo Status Determination':
  • Context - a cargo record is being processed for status determination:
    For Manual Release Flag Set?:
    When the manual release flag is set to true, then the destination index should be cleared and canadian manifest coordination should be initiated.
  • Context - a cargo record is being evaluated for fda hold requirements:
    For FDA Hold at Destination?:
    When fda hold conditions are present at the destination location, then the cargo status should be set to fda hold with code 66.
  • Context - a cargo record is being processed for status updates:
    For PTT Status Present?:
    When the cargo currently has ptt status assigned, then the current ptt status should be saved for potential restoration later in the process.
  • Context - a cargo record with defined total quantity and released quantity:
    For Released Quantity < Total Quantity?:
    When the released quantity is less than the total quantity, then the cargo status should be set to hold on piece counts to reflect partial release.
  • Context - a cargo record with released quantity and total quantity values:
    For Released Quantity = Total Quantity?:
    When the released quantity equals the total quantity, then the system should process full release and clear the destination index.
  • Context - a cargo record being evaluated for proceed status:
    For Proceed Status Present?:
    When proceed status conditions are present in the cargo data, then the cargo status should be set to proceed and the border arrival date should be updated.
  • Context - a cargo record with hold status conditions present:
    For Hold at Border?:
    When the hold location is determined to be at the border, then the cargo status should be set to border hold, otherwise it should be set to destination hold.
  • Context - a cargo record being processed for arrival status:
    For Arrival Status Present?:
    When arrival status conditions are present in the cargo data, then the cargo status should be set to arrival and the arrival date should be updated.
  • Context - a cargo record being evaluated for export status:
    For Export Status Present?:
    When export status conditions are present in the cargo data, then the cargo status should be set to export and the destination index should be cleared.
  • Context - a cargo record with potential cancel release conditions:
    For Cancel Release Status?:
    When cancel release status is detected in the cargo data, then the cargo status should be set to unrelease, an unrelease notification should be generated, and the destination index should be re-established.
  • Context - a cargo record completing status determination processing:
    For Calculate Cargo Age:
    When final status calculations are being performed, then the cargo age should be calculated and bond dates should be updated accordingly.
  • Context - a cargo record that had ptt status saved during processing:
    For Restore PTT Status if Saved:
    When all other status determinations have been completed, then the previously saved ptt status should be restored if it was saved earlier in the process.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for status determination
GIVEN
A cargo record is being processed for status determination
Applied to: Manual Release Flag Set?
WHEN
The manual release flag is set to true
THEN
The destination index should be cleared and Canadian manifest coordination should be initiated
Context: A cargo record is being evaluated for FDA hold requirements
GIVEN
A cargo record is being evaluated for FDA hold requirements
Applied to: FDA Hold at Destination?
WHEN
FDA hold conditions are present at the destination location
THEN
The cargo status should be set to FDA hold with code 66
Context: A cargo record is being processed for status updates
GIVEN
A cargo record is being processed for status updates
Applied to: PTT Status Present?
WHEN
The cargo currently has PTT status assigned
THEN
The current PTT status should be saved for potential restoration later in the process
Context: A cargo record with defined total quantity and released quantity
GIVEN
A cargo record with defined total quantity and released quantity
Applied to: Released Quantity < Total Quantity?
WHEN
The released quantity is less than the total quantity
THEN
The cargo status should be set to hold on piece counts to reflect partial release
Context: A cargo record with released quantity and total quantity values
GIVEN
A cargo record with released quantity and total quantity values
Applied to: Released Quantity = Total Quantity?
WHEN
The released quantity equals the total quantity
THEN
The system should process full release and clear the destination index
Context: A cargo record being evaluated for proceed status
GIVEN
A cargo record being evaluated for proceed status
Applied to: Proceed Status Present?
WHEN
Proceed status conditions are present in the cargo data
THEN
The cargo status should be set to proceed and the border arrival date should be updated
Context: A cargo record with hold status conditions present
GIVEN
A cargo record with hold status conditions present
Applied to: Hold at Border?
WHEN
The hold location is determined to be at the border
THEN
The cargo status should be set to border hold, otherwise it should be set to destination hold
Context: A cargo record being processed for arrival status
GIVEN
A cargo record being processed for arrival status
Applied to: Arrival Status Present?
WHEN
Arrival status conditions are present in the cargo data
THEN
The cargo status should be set to arrival and the arrival date should be updated
Context: A cargo record being evaluated for export status
GIVEN
A cargo record being evaluated for export status
Applied to: Export Status Present?
WHEN
Export status conditions are present in the cargo data
THEN
The cargo status should be set to export and the destination index should be cleared
Context: A cargo record with potential cancel release conditions
GIVEN
A cargo record with potential cancel release conditions
Applied to: Cancel Release Status?
WHEN
Cancel release status is detected in the cargo data
THEN
The cargo status should be set to unrelease, an unrelease notification should be generated, and the destination index should be re-established
Context: A cargo record completing status determination processing
GIVEN
A cargo record completing status determination processing
Applied to: Calculate Cargo Age
WHEN
Final status calculations are being performed
THEN
The cargo age should be calculated and bond dates should be updated accordingly
Context: A cargo record that had PTT status saved during processing
GIVEN
A cargo record that had PTT status saved during processing
Applied to: Restore PTT Status if Saved
WHEN
All other status determinations have been completed
THEN
The previously saved PTT status should be restored if it was saved earlier in the process
R-GCX016-cbl-00959 (+36) File: GCX016.cbl Manual Release Processing Merged 37 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manual Release Processing':
  • Context - a cargo record exists in the system and the cargo belongs to cprs (canadian pacific railway system):
    For Force Manual Release for CPRS:
    When a manual release request is processed for the cargo, then the system shall force set the manual release flag to true and bypass standard release validation checks.
  • Context - a cargo record exists in the system with a current status:
    For Check Current Cargo Status:
    When manual release processing is initiated, then the system shall check if the cargo is currently in a held status and only proceed with manual release if cargo is held.
  • Context - cargo is confirmed to be in held status and manual release is authorized:
    For Clear Destination Index:
    When manual release processing begins, then the system shall clear the destination index field and remove any destination-based routing restrictions.
  • Context - destination index has been cleared and cargo was previously held:
    For Update Cargo Status to Released:
    When manual release processing continues, then the system shall update the cargo status to 'released' and record the manual release timestamp.
  • Context - cargo status has been updated to released:
    For Cross-Border Cargo?:
    When the system evaluates cargo movement requirements, then the system shall determine if the cargo involves cross-border movement between us and canada and set cross-border processing flag accordingly.
  • Context - cargo is identified as cross-border movement and cargo has been manually released:
    For Find Matching Canadian Manifest:
    When canadian coordination processing is initiated, then the system shall search for matching canadian manifest records using waybill number and equipment id and establish coordination link if found.
  • Context - matching canadian manifest record is found and cargo is manually released:
    For Generate Canadian Coordination Log:
    When cross-border coordination is established, then the system shall generate a coordination log entry and record cargo release details in gcx105 system and include waybill and equipment information.
  • Context - manual release processing is confirmed and canadian coordination is complete (if required):
    For Update Status Array without New Codes:
    When status array update is performed, then the system shall update the s09 status array to reflect manual release and shall not add new disposition codes and preserve existing status history.
  • Context - status array has been updated and manual release processing is in progress:
    For Save Manual Release Flag:
    When cargo record finalization occurs, then the system shall save the manual release flag in the cargo record and maintain the flag for audit purposes and ensure flag persists through subsequent processing.
  • Context - manual release flag is saved and cargo has associated bond dates:
    For Clear Bond Dates if Applicable:
    When bond date evaluation is performed, then the system shall clear bond dates if cargo status allows and remove time-based movement restrictions and update bond-related fields accordingly.
  • Context - manual release processing is complete and all status updates are finalized:
    For Generate Release Notification:
    When notification generation is triggered, then the system shall generate release notification messages and send notifications to relevant parties and include cargo details and release timestamp.
  • Context - a manual release request is received for cargo:
    For Is Cargo CPRS Type?:
    When the system checks the cargo type in the ccn key, then if cargo type is cprs, proceed with manual release validation, otherwise reject the manual release request.
  • Context - a cprs cargo requires manual release:
    For Validate Manual Release Authority:
    When the system validates the manual release authority, then if authorized, allow manual release processing, otherwise reject the request.
  • Context - manual release authority is validated for cprs cargo:
    For Clear Destination Index RT076:
    When the system processes the manual release, then clear the rt076 destination index to remove destination constraints.
  • Context - destination index has been cleared for manual release:
    For Save Current Cargo Status:
    When the system prepares to update cargo status, then save the current cargo status information for potential restoration.
  • Context - current cargo status has been saved:
    For Update Cargo to Manual Release Status:
    When the system applies manual release processing, then update cargo status to manual release (mrl) and set manual release indicators.
  • Context - cargo has been updated to manual release status:
    For Search for Canadian Manifest Match:
    When the system searches for canadian manifest coordination, then search canadian manifest records using car id and waybill number to find matching records.
  • Context - canadian manifest match is found for the released cargo:
    For Generate Canadian Log Message:
    When the system processes the canadian manifest coordination, then generate canadian log message with cargo release details including car id, waybill, and release information.
  • Context - canadian log message has been generated:
    For Update Canadian Manifest Status:
    When the system coordinates with canadian manifest system, then update canadian manifest status to reflect the cargo release and maintain cross-border coordination.
  • Context - canadian manifest processing is complete or no canadian manifest was found:
    For Restore Cargo Status Information:
    When the system finalizes manual release processing, then restore the preserved cargo status information while maintaining manual release indicators.
    For Restore Cargo Status Information:
    When the system needs to restore cargo status information, then previously saved cargo status information is restored to the cargo record.
  • Context - cargo status information has been restored:
    For Generate Manual Release Notification:
    When the system completes manual release processing, then generate manual release notification messages to inform relevant parties of the cargo release.
    For Age Calculation Required?:
    When the system evaluates cargo processing requirements, then processing branches to age calculation if required, or continues to destination index re-establishment if not required.
  • Context - manual release notification has been generated:
    For Update Cargo Record in Database:
    When the system finalizes the manual release transaction, then update the cargo record in database with all manual release changes and status modifications.
  • Context - cargo record has been updated in database:
    For Manual Release Complete:
    When all manual release processing steps are completed successfully, then confirm manual release completion and return success status.
  • Context - manual release request fails validation or authorization:
    For Manual Release Rejected:
    When the system determines manual release cannot be processed, then reject the manual release request and return appropriate error status without modifying cargo.
  • Context - a cargo record with potential manual release status:
    For Check if Manual Release Flag Set:
    When the system checks the manual release flag in the cargo status, then processing continues to manual release workflow if flag is set, otherwise processing completes.
  • Context - a cargo record undergoing manual release processing:
    For Clear Destination Index:
    When the manual release flag is confirmed as set, then the destination index is cleared to remove destination routing constraints.
  • Context - a cargo record with existing status information:
    For Save Current Cargo Status:
    When manual release processing begins, then current cargo status is saved to temporary storage for potential restoration.
  • Context - a cargo record undergoing manual release:
    For Process Canadian Manifest Coordination:
    When destination index has been cleared and status saved, then system searches for corresponding canadian manifest records for coordination.
  • Context - a search for canadian manifest records has been initiated:
    For Canadian Manifest Found?:
    When the system searches canadian manifest database using cargo identifiers, then processing branches to update canadian records if found, or continues to status restoration if not found.
  • Context - canadian manifest records exist for the cargo being manually released:
    For Generate Log Message for Canadian CCN:
    When the system confirms canadian manifest record availability, then a log message is generated containing the canadian ccn information for audit purposes.
  • Context - canadian manifest records found and log message generated:
    For Update Canadian Manifest Status:
    When the system processes the canadian manifest coordination, then canadian manifest status is updated to reflect the manual release action.
  • Context - age calculation is required for the cargo:
    For Calculate Cargo Age Using Julian Date:
    When the system processes cargo age requirements, then cargo age is calculated using julian date conversion methods.
  • Context - age calculation is complete or not required:
    For Re-establish Destination Index:
    When the system needs to restore destination routing capability, then destination index is re-established based on current cargo status and routing requirements.
  • Context - destination index has been re-established:
    For Update Cargo Record with Manual Release Status:
    When the system finalizes manual release processing, then cargo record is updated with manual release status information.
  • Context - cargo record has been updated with manual release status:
    For Generate Manual Release Notification:
    When the system completes manual release processing, then notification messages are generated and sent to appropriate recipients regarding the manual release.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system AND the cargo belongs to CPRS (Canadian Pacific Railway System)
GIVEN
A cargo record exists in the system AND the cargo belongs to CPRS (Canadian Pacific Railway System)
Applied to: Force Manual Release for CPRS
WHEN
A manual release request is processed for the cargo
THEN
The system shall force set the manual release flag to true AND bypass standard release validation checks
Context: A cargo record exists in the system with a current status
GIVEN
A cargo record exists in the system with a current status
Applied to: Check Current Cargo Status
WHEN
Manual release processing is initiated
THEN
The system shall check if the cargo is currently in a held status AND only proceed with manual release if cargo is held
Context: Cargo is confirmed to be in held status AND manual release is authorized
GIVEN
Cargo is confirmed to be in held status AND manual release is authorized
Applied to: Clear Destination Index
WHEN
Manual release processing begins
THEN
The system shall clear the destination index field AND remove any destination-based routing restrictions
Context: Destination index has been cleared AND cargo was previously held
GIVEN
Destination index has been cleared AND cargo was previously held
Applied to: Update Cargo Status to Released
WHEN
Manual release processing continues
THEN
The system shall update the cargo status to 'Released' AND record the manual release timestamp
Context: Cargo status has been updated to released
GIVEN
Cargo status has been updated to released
Applied to: Cross-Border Cargo?
WHEN
The system evaluates cargo movement requirements
THEN
The system shall determine if the cargo involves cross-border movement between US and Canada AND set cross-border processing flag accordingly
Context: Cargo is identified as cross-border movement AND cargo has been manually released
GIVEN
Cargo is identified as cross-border movement AND cargo has been manually released
Applied to: Find Matching Canadian Manifest
WHEN
Canadian coordination processing is initiated
THEN
The system shall search for matching Canadian manifest records using waybill number AND equipment ID AND establish coordination link if found
Context: Matching Canadian manifest record is found AND cargo is manually released
GIVEN
Matching Canadian manifest record is found AND cargo is manually released
Applied to: Generate Canadian Coordination Log
WHEN
Cross-border coordination is established
THEN
The system shall generate a coordination log entry AND record cargo release details in GCX105 system AND include waybill and equipment information
Context: Manual release processing is confirmed AND Canadian coordination is complete (if required)
GIVEN
Manual release processing is confirmed AND Canadian coordination is complete (if required)
Applied to: Update Status Array without New Codes
WHEN
Status array update is performed
THEN
The system shall update the S09 status array to reflect manual release AND shall not add new disposition codes AND preserve existing status history
Context: Status array has been updated AND manual release processing is in progress
GIVEN
Status array has been updated AND manual release processing is in progress
Applied to: Save Manual Release Flag
WHEN
Cargo record finalization occurs
THEN
The system shall save the manual release flag in the cargo record AND maintain the flag for audit purposes AND ensure flag persists through subsequent processing
Context: Manual release flag is saved AND cargo has associated bond dates
GIVEN
Manual release flag is saved AND cargo has associated bond dates
Applied to: Clear Bond Dates if Applicable
WHEN
Bond date evaluation is performed
THEN
The system shall clear bond dates if cargo status allows AND remove time-based movement restrictions AND update bond-related fields accordingly
Context: Manual release processing is complete AND all status updates are finalized
GIVEN
Manual release processing is complete AND all status updates are finalized
Applied to: Generate Release Notification
WHEN
Notification generation is triggered
THEN
The system shall generate release notification messages AND send notifications to relevant parties AND include cargo details and release timestamp
Context: A manual release request is received for cargo
GIVEN
A manual release request is received for cargo
Applied to: Is Cargo CPRS Type?
WHEN
The system checks the cargo type in the CCN key
THEN
If cargo type is CPRS, proceed with manual release validation, otherwise reject the manual release request
Context: A CPRS cargo requires manual release
GIVEN
A CPRS cargo requires manual release
Applied to: Validate Manual Release Authority
WHEN
The system validates the manual release authority
THEN
If authorized, allow manual release processing, otherwise reject the request
Context: Manual release authority is validated for CPRS cargo
GIVEN
Manual release authority is validated for CPRS cargo
Applied to: Clear Destination Index RT076
WHEN
The system processes the manual release
THEN
Clear the RT076 destination index to remove destination constraints
Context: Destination index has been cleared for manual release
GIVEN
Destination index has been cleared for manual release
Applied to: Save Current Cargo Status
WHEN
The system prepares to update cargo status
THEN
Save the current cargo status information for potential restoration
Context: Current cargo status has been saved
GIVEN
Current cargo status has been saved
Applied to: Update Cargo to Manual Release Status
WHEN
The system applies manual release processing
THEN
Update cargo status to manual release (MRL) and set manual release indicators
Context: Cargo has been updated to manual release status
GIVEN
Cargo has been updated to manual release status
Applied to: Search for Canadian Manifest Match
WHEN
The system searches for Canadian manifest coordination
THEN
Search Canadian manifest records using car ID and waybill number to find matching records
Context: Canadian manifest match is found for the released cargo
GIVEN
Canadian manifest match is found for the released cargo
Applied to: Generate Canadian Log Message
WHEN
The system processes the Canadian manifest coordination
THEN
Generate Canadian log message with cargo release details including car ID, waybill, and release information
Context: Canadian log message has been generated
GIVEN
Canadian log message has been generated
Applied to: Update Canadian Manifest Status
WHEN
The system coordinates with Canadian manifest system
THEN
Update Canadian manifest status to reflect the cargo release and maintain cross-border coordination
Context: Canadian manifest processing is complete or no Canadian manifest was found
GIVEN
Canadian manifest processing is complete or no Canadian manifest was found
Applied to: Restore Cargo Status Information
WHEN
The system finalizes manual release processing
THEN
Restore the preserved cargo status information while maintaining manual release indicators
Applied to: Restore Cargo Status Information
WHEN
The system needs to restore cargo status information
THEN
Previously saved cargo status information is restored to the cargo record
Context: Cargo status information has been restored
GIVEN
Cargo status information has been restored
Applied to: Generate Manual Release Notification
WHEN
The system completes manual release processing
THEN
Generate manual release notification messages to inform relevant parties of the cargo release
Applied to: Age Calculation Required?
WHEN
The system evaluates cargo processing requirements
THEN
Processing branches to age calculation if required, or continues to destination index re-establishment if not required
Context: Manual release notification has been generated
GIVEN
Manual release notification has been generated
Applied to: Update Cargo Record in Database
WHEN
The system finalizes the manual release transaction
THEN
Update the cargo record in database with all manual release changes and status modifications
Context: Cargo record has been updated in database
GIVEN
Cargo record has been updated in database
Applied to: Manual Release Complete
WHEN
All manual release processing steps are completed successfully
THEN
Confirm manual release completion and return success status
Context: Manual release request fails validation or authorization
GIVEN
Manual release request fails validation or authorization
Applied to: Manual Release Rejected
WHEN
The system determines manual release cannot be processed
THEN
Reject the manual release request and return appropriate error status without modifying cargo
Context: A cargo record with potential manual release status
GIVEN
A cargo record with potential manual release status
Applied to: Check if Manual Release Flag Set
WHEN
The system checks the manual release flag in the cargo status
THEN
Processing continues to manual release workflow if flag is set, otherwise processing completes
Context: A cargo record undergoing manual release processing
GIVEN
A cargo record undergoing manual release processing
Applied to: Clear Destination Index
WHEN
The manual release flag is confirmed as set
THEN
The destination index is cleared to remove destination routing constraints
Context: A cargo record with existing status information
GIVEN
A cargo record with existing status information
Applied to: Save Current Cargo Status
WHEN
Manual release processing begins
THEN
Current cargo status is saved to temporary storage for potential restoration
Context: A cargo record undergoing manual release
GIVEN
A cargo record undergoing manual release
Applied to: Process Canadian Manifest Coordination
WHEN
Destination index has been cleared and status saved
THEN
System searches for corresponding Canadian manifest records for coordination
Context: A search for Canadian manifest records has been initiated
GIVEN
A search for Canadian manifest records has been initiated
Applied to: Canadian Manifest Found?
WHEN
The system searches Canadian manifest database using cargo identifiers
THEN
Processing branches to update Canadian records if found, or continues to status restoration if not found
Context: Canadian manifest records exist for the cargo being manually released
GIVEN
Canadian manifest records exist for the cargo being manually released
Applied to: Generate Log Message for Canadian CCN
WHEN
The system confirms Canadian manifest record availability
THEN
A log message is generated containing the Canadian CCN information for audit purposes
Context: Canadian manifest records found and log message generated
GIVEN
Canadian manifest records found and log message generated
Applied to: Update Canadian Manifest Status
WHEN
The system processes the Canadian manifest coordination
THEN
Canadian manifest status is updated to reflect the manual release action
Context: Age calculation is required for the cargo
GIVEN
Age calculation is required for the cargo
Applied to: Calculate Cargo Age Using Julian Date
WHEN
The system processes cargo age requirements
THEN
Cargo age is calculated using Julian date conversion methods
Context: Age calculation is complete or not required
GIVEN
Age calculation is complete or not required
Applied to: Re-establish Destination Index
WHEN
The system needs to restore destination routing capability
THEN
Destination index is re-established based on current cargo status and routing requirements
Context: Destination index has been re-established
GIVEN
Destination index has been re-established
Applied to: Update Cargo Record with Manual Release Status
WHEN
The system finalizes manual release processing
THEN
Cargo record is updated with manual release status information
Context: Cargo record has been updated with manual release status
GIVEN
Cargo record has been updated with manual release status
Applied to: Generate Manual Release Notification
WHEN
The system completes manual release processing
THEN
Notification messages are generated and sent to appropriate recipients regarding the manual release
R-GCX016-cbl-00970 (+31) File: GCX016.cbl FDA Hold Processing Merged 32 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FDA Hold Processing':
  • Context - a cargo record exists in the system:
    For FDA Hold Processing Start:
    When fda hold processing is triggered for the cargo, then the system begins fda hold evaluation workflow.
  • Context - a cargo record with location information exists:
    For Cargo at Destination?:
    When the system evaluates cargo location status, then the system determines if cargo is at destination and proceeds with appropriate fda processing path.
  • Context - cargo is at destination location and has a status array:
    For Check Status Array for FDA Codes:
    When the system scans the status array for fda codes, then the system identifies all fda-related status codes present in the array.
  • Context - the status array has been examined for fda codes:
    For FDA Hold Code Found?:
    When the system evaluates the presence of fda hold codes, then the system either proceeds with fda hold processing if codes are found or exits fda processing if no codes are present.
  • Context - fda hold codes are found in the status array and cargo is at destination:
    For Set FDA Hold Status at Destination:
    When the system processes fda hold assignment, then the system sets fda hold status with destination location designation.
  • Context - fda hold status has been set at destination:
    For Apply FDA-Specific Status Codes:
    When the system applies fda-specific status codes, then the cargo record is updated with appropriate fda regulatory status codes.
  • Context - fda-specific status codes have been applied to cargo:
    For Generate FDA Hold Description:
    When the system generates fda hold description, then a clear, business-readable description of the fda hold is created and associated with the cargo.
  • Context - fda hold description has been generated for cargo:
    For Other Hold Codes Present?:
    When the system checks for other hold codes in the status array, then the system determines if additional hold codes exist that require combination with fda hold.
  • Context - fda hold exists and other hold codes are present in the status array:
    For Combine FDA Hold with Other Holds:
    When the system combines fda hold with other holds, then a comprehensive hold status is created that includes fda hold and all other applicable hold codes.
  • Context - fda hold processing is complete (with or without other holds):
    For Set Destination Hold Flag:
    When the system sets destination hold flag, then the cargo record is marked with destination hold flag indicating hold status at destination.
  • Context - destination hold flag has been set and all fda processing is complete:
    For Update Cargo Status Record:
    When the system updates the cargo status record, then the cargo record is permanently updated with fda hold status, descriptions, and all related information.
  • Context - cargo status record has been updated with fda hold information:
    For Generate FDA Hold Notification:
    When the system generates fda hold notification, then appropriate notification messages are created for brokers, carriers, and other stakeholders about the fda hold.
  • Context - fda hold notification has been generated:
    For Route to FDA Processing Queue:
    When the system routes to fda processing queue, then the notification is sent to the appropriate fda processing queue for regulatory review and action.
  • Context - fda processing queue routing is complete:
    For Log FDA Hold Action:
    When the system logs fda hold action, then a complete audit record of the fda hold action is created including timestamps, cargo details, and regulatory codes.
  • Context - fda hold action has been logged successfully:
    For FDA Hold Processing Complete:
    When the system completes fda hold processing, then fda hold processing workflow is marked complete and control returns to main cargo processing flow.
  • Context - cargo is not at destination or no fda hold codes are found:
    For No FDA Hold Required:
    When the system determines no fda hold is required, then fda hold processing is bypassed and the system proceeds to completion without applying fda holds.
  • Context - cargo status analysis has been completed:
    For Check for FDA Hold Conditions:
    When system evaluates cargo for fda hold requirements, then system identifies whether fda hold conditions exist for the cargo.
  • Context - fda hold conditions have been identified for cargo:
    For FDA Hold Required at Destination?:
    When system determines the appropriate hold location, then system decides whether fda hold is required at destination or can proceed with other status processing.
  • Context - fda hold is required at destination for the cargo:
    For Set FDA Hold Status Flag:
    When system processes fda hold assignment, then system sets the fda hold status flag to active state.
  • Context - fda hold status flag has been set for cargo:
    For Apply FDA-Specific Status Code:
    When system assigns fda regulatory codes, then system applies the fda-specific status code corresponding to the hold type.
  • Context - fda-specific status code has been applied to cargo:
    For Set Destination Hold Location:
    When system determines hold enforcement location, then system sets the destination as the hold location for fda regulatory compliance.
  • Context - destination hold location has been set for fda requirements:
    For Update Cargo Status Description:
    When system updates cargo status information, then system updates the cargo status description to indicate fda hold status.
  • Context - cargo status description has been updated for fda hold:
    For Preserve Current Release Quantities:
    When system processes quantity information during fda hold application, then system preserves current release quantities without modification.
  • Context - current release quantities have been preserved for cargo under fda hold:
    For Set Hold on Piece Counts Status:
    When system applies piece-level hold controls, then system sets hold status on piece counts to prevent unauthorized releases.
  • Context - hold on piece counts status has been set for cargo:
    For Multiple FDA Codes Present?:
    When system evaluates fda code complexity, then system determines whether multiple fda codes are present requiring additional processing.
  • Context - multiple fda codes are present for the cargo:
    For Process Primary FDA Code:
    When system processes fda codes in priority order, then system processes the primary fda code first to establish main hold requirements.
  • Context - primary fda code has been processed for cargo:
    For Process Secondary FDA Codes:
    When system continues with remaining fda codes, then system processes secondary fda codes to complete regulatory requirements.
  • Context - fda code processing has been completed (primary and secondary if applicable):
    For Update Status Array with FDA Code:
    When system updates cargo status tracking, then system updates the status array with fda code information.
  • Context - status array has been updated with fda code information:
    For Mark Cargo as Held at Destination:
    When system applies destination hold markers, then system marks cargo as held at destination location.
  • Context - cargo has been marked as held at destination:
    For Set FDA Hold Description Text:
    When system assigns status description text, then system sets fda hold description text explaining the regulatory hold reason.
  • Context - fda hold description text has been set for cargo:
    For Update Hold Location Indicator:
    When system finalizes hold location information, then system updates the hold location indicator to reflect fda enforcement location.
  • Context - hold location indicator has been updated for cargo:
    For Log FDA Hold Action:
    When system performs audit logging, then system logs the fda hold action with timestamp and regulatory details.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: FDA Hold Processing Start
WHEN
FDA hold processing is triggered for the cargo
THEN
The system begins FDA hold evaluation workflow
Context: A cargo record with location information exists
GIVEN
A cargo record with location information exists
Applied to: Cargo at Destination?
WHEN
The system evaluates cargo location status
THEN
The system determines if cargo is at destination and proceeds with appropriate FDA processing path
Context: Cargo is at destination location and has a status array
GIVEN
Cargo is at destination location and has a status array
Applied to: Check Status Array for FDA Codes
WHEN
The system scans the status array for FDA codes
THEN
The system identifies all FDA-related status codes present in the array
Context: The status array has been examined for FDA codes
GIVEN
The status array has been examined for FDA codes
Applied to: FDA Hold Code Found?
WHEN
The system evaluates the presence of FDA hold codes
THEN
The system either proceeds with FDA hold processing if codes are found or exits FDA processing if no codes are present
Context: FDA hold codes are found in the status array and cargo is at destination
GIVEN
FDA hold codes are found in the status array and cargo is at destination
Applied to: Set FDA Hold Status at Destination
WHEN
The system processes FDA hold assignment
THEN
The system sets FDA hold status with destination location designation
Context: FDA hold status has been set at destination
GIVEN
FDA hold status has been set at destination
Applied to: Apply FDA-Specific Status Codes
WHEN
The system applies FDA-specific status codes
THEN
The cargo record is updated with appropriate FDA regulatory status codes
Context: FDA-specific status codes have been applied to cargo
GIVEN
FDA-specific status codes have been applied to cargo
Applied to: Generate FDA Hold Description
WHEN
The system generates FDA hold description
THEN
A clear, business-readable description of the FDA hold is created and associated with the cargo
Context: FDA hold description has been generated for cargo
GIVEN
FDA hold description has been generated for cargo
Applied to: Other Hold Codes Present?
WHEN
The system checks for other hold codes in the status array
THEN
The system determines if additional hold codes exist that require combination with FDA hold
Context: FDA hold exists and other hold codes are present in the status array
GIVEN
FDA hold exists and other hold codes are present in the status array
Applied to: Combine FDA Hold with Other Holds
WHEN
The system combines FDA hold with other holds
THEN
A comprehensive hold status is created that includes FDA hold and all other applicable hold codes
Context: FDA hold processing is complete (with or without other holds)
GIVEN
FDA hold processing is complete (with or without other holds)
Applied to: Set Destination Hold Flag
WHEN
The system sets destination hold flag
THEN
The cargo record is marked with destination hold flag indicating hold status at destination
Context: Destination hold flag has been set and all FDA processing is complete
GIVEN
Destination hold flag has been set and all FDA processing is complete
Applied to: Update Cargo Status Record
WHEN
The system updates the cargo status record
THEN
The cargo record is permanently updated with FDA hold status, descriptions, and all related information
Context: Cargo status record has been updated with FDA hold information
GIVEN
Cargo status record has been updated with FDA hold information
Applied to: Generate FDA Hold Notification
WHEN
The system generates FDA hold notification
THEN
Appropriate notification messages are created for brokers, carriers, and other stakeholders about the FDA hold
Context: FDA hold notification has been generated
GIVEN
FDA hold notification has been generated
Applied to: Route to FDA Processing Queue
WHEN
The system routes to FDA processing queue
THEN
The notification is sent to the appropriate FDA processing queue for regulatory review and action
Context: FDA processing queue routing is complete
GIVEN
FDA processing queue routing is complete
Applied to: Log FDA Hold Action
WHEN
The system logs FDA hold action
THEN
A complete audit record of the FDA hold action is created including timestamps, cargo details, and regulatory codes
Context: FDA hold action has been logged successfully
GIVEN
FDA hold action has been logged successfully
Applied to: FDA Hold Processing Complete
WHEN
The system completes FDA hold processing
THEN
FDA hold processing workflow is marked complete and control returns to main cargo processing flow
Context: Cargo is not at destination or no FDA hold codes are found
GIVEN
Cargo is not at destination or no FDA hold codes are found
Applied to: No FDA Hold Required
WHEN
The system determines no FDA hold is required
THEN
FDA hold processing is bypassed and the system proceeds to completion without applying FDA holds
Context: Cargo status analysis has been completed
GIVEN
Cargo status analysis has been completed
Applied to: Check for FDA Hold Conditions
WHEN
System evaluates cargo for FDA hold requirements
THEN
System identifies whether FDA hold conditions exist for the cargo
Context: FDA hold conditions have been identified for cargo
GIVEN
FDA hold conditions have been identified for cargo
Applied to: FDA Hold Required at Destination?
WHEN
System determines the appropriate hold location
THEN
System decides whether FDA hold is required at destination or can proceed with other status processing
Context: FDA hold is required at destination for the cargo
GIVEN
FDA hold is required at destination for the cargo
Applied to: Set FDA Hold Status Flag
WHEN
System processes FDA hold assignment
THEN
System sets the FDA hold status flag to active state
Context: FDA hold status flag has been set for cargo
GIVEN
FDA hold status flag has been set for cargo
Applied to: Apply FDA-Specific Status Code
WHEN
System assigns FDA regulatory codes
THEN
System applies the FDA-specific status code corresponding to the hold type
Context: FDA-specific status code has been applied to cargo
GIVEN
FDA-specific status code has been applied to cargo
Applied to: Set Destination Hold Location
WHEN
System determines hold enforcement location
THEN
System sets the destination as the hold location for FDA regulatory compliance
Context: Destination hold location has been set for FDA requirements
GIVEN
Destination hold location has been set for FDA requirements
Applied to: Update Cargo Status Description
WHEN
System updates cargo status information
THEN
System updates the cargo status description to indicate FDA hold status
Context: Cargo status description has been updated for FDA hold
GIVEN
Cargo status description has been updated for FDA hold
Applied to: Preserve Current Release Quantities
WHEN
System processes quantity information during FDA hold application
THEN
System preserves current release quantities without modification
Context: Current release quantities have been preserved for cargo under FDA hold
GIVEN
Current release quantities have been preserved for cargo under FDA hold
Applied to: Set Hold on Piece Counts Status
WHEN
System applies piece-level hold controls
THEN
System sets hold status on piece counts to prevent unauthorized releases
Context: Hold on piece counts status has been set for cargo
GIVEN
Hold on piece counts status has been set for cargo
Applied to: Multiple FDA Codes Present?
WHEN
System evaluates FDA code complexity
THEN
System determines whether multiple FDA codes are present requiring additional processing
Context: Multiple FDA codes are present for the cargo
GIVEN
Multiple FDA codes are present for the cargo
Applied to: Process Primary FDA Code
WHEN
System processes FDA codes in priority order
THEN
System processes the primary FDA code first to establish main hold requirements
Context: Primary FDA code has been processed for cargo
GIVEN
Primary FDA code has been processed for cargo
Applied to: Process Secondary FDA Codes
WHEN
System continues with remaining FDA codes
THEN
System processes secondary FDA codes to complete regulatory requirements
Context: FDA code processing has been completed (primary and secondary if applicable)
GIVEN
FDA code processing has been completed (primary and secondary if applicable)
Applied to: Update Status Array with FDA Code
WHEN
System updates cargo status tracking
THEN
System updates the status array with FDA code information
Context: Status array has been updated with FDA code information
GIVEN
Status array has been updated with FDA code information
Applied to: Mark Cargo as Held at Destination
WHEN
System applies destination hold markers
THEN
System marks cargo as held at destination location
Context: Cargo has been marked as held at destination
GIVEN
Cargo has been marked as held at destination
Applied to: Set FDA Hold Description Text
WHEN
System assigns status description text
THEN
System sets FDA hold description text explaining the regulatory hold reason
Context: FDA hold description text has been set for cargo
GIVEN
FDA hold description text has been set for cargo
Applied to: Update Hold Location Indicator
WHEN
System finalizes hold location information
THEN
System updates the hold location indicator to reflect FDA enforcement location
Context: Hold location indicator has been updated for cargo
GIVEN
Hold location indicator has been updated for cargo
Applied to: Log FDA Hold Action
WHEN
System performs audit logging
THEN
System logs the FDA hold action with timestamp and regulatory details
R-GCX016-cbl-00986 (+18) File: GCX016.cbl PTT Processing Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PTT Processing':
  • Context - a cargo record is being processed for ptt status changes:
    For Cargo Has PTT Status?:
    When the system evaluates the cargo's current status, then if cargo has existing ptt status, preserve current ptt status for comparison, otherwise proceed with ptt analysis.
  • Context - cargo has an existing ptt status:
    For Save Current PTT Status:
    When ptt processing begins, then save the current ptt status values to working storage for potential restoration.
  • Context - a cargo status array exists with multiple status entries:
    For Analyze Status Array for PTT Codes:
    When the system analyzes the status array for ptt codes, then identify and flag any ptt disposition codes present in the status array.
  • Context - the status array has been analyzed for ptt codes:
    For PTT Disposition Code Found?:
    When the system checks for ptt disposition code presence, then if ptt disposition code is found, proceed with ptt quantity extraction, otherwise restore previous ptt status if needed.
  • Context - a ptt disposition code has been found in the status array:
    For Extract PTT Quantity from Status Array:
    When the system extracts quantity information, then retrieve the ptt quantity value from the status array entry for validation.
  • Context - ptt quantity has been extracted from the status array:
    For Validate PTT Quantity Against Cargo Quantity:
    When the system validates the ptt quantity against total cargo quantity, then if ptt quantity is valid and within acceptable range, proceed with quantity calculations, otherwise generate ptt validation error.
  • Context - ptt quantity has been validated against business rules:
    For Quantity Valid?:
    When the system checks validation results, then if quantity is valid, calculate remaining quantity after ptt, otherwise log ptt validation error.
  • Context - ptt quantity has been validated as acceptable:
    For Calculate Remaining Quantity After PTT:
    When the system calculates remaining quantities, then subtract ptt quantity from total cargo quantity to determine remaining quantity for further processing.
  • Context - remaining quantity after ptt has been calculated:
    For Partial Release Scenario?:
    When the system evaluates if this is a partial release scenario, then if released quantity is less than total quantity, set ptt status with partial quantity, otherwise set full ptt release status.
  • Context - a partial release scenario has been identified:
    For Set PTT Status with Partial Quantity:
    When the system sets ptt status, then set ptt status with the partial quantity value and maintain tracking for remaining unreleased cargo.
  • Context - ptt status has been set with partial quantity:
    For Update Released Quantity:
    When the system updates released quantity, then add ptt quantity to the cargo's total released quantity field.
  • Context - released quantity has been updated for partial release:
    For Preserve PTT for Remaining Cargo:
    When the system processes remaining cargo, then preserve ptt status for the remaining unreleased cargo quantity to enable future processing.
  • Context - the scenario is determined to be a full release (not partial):
    For Set Full PTT Release Status:
    When the system sets ptt release status, then set full ptt release status for the entire cargo quantity.
  • Context - full ptt release status has been set:
    For Clear PTT Status from Array:
    When the system cleans up the status array, then remove ptt status codes from the cargo status array to prevent duplicate processing.
  • Context - no ptt disposition code was found in the current processing:
    For Restore Previous PTT Status if Needed:
    When the system needs to restore previous state, then restore the previously saved ptt status to maintain cargo status consistency.
  • Context - ptt status has been determined (new, preserved, or restored):
    For Update Cargo Record with PTT Status:
    When the system updates the cargo record, then write the final ptt status and associated quantities to the cargo database record.
  • Context - cargo record has been updated with ptt status:
    For Generate PTT Status Message:
    When the system generates status messages, then create and send ptt status notification messages to relevant external systems and stakeholders.
  • Context - ptt quantity validation has failed:
    For PTT Validation Error:
    When the system encounters validation errors, then generate ptt validation error and proceed to error logging.
  • Context - a ptt validation error has occurred:
    For Log PTT Error Message:
    When the system logs the error, then create detailed error log entry with ptt validation failure details and cargo information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for PTT status changes
GIVEN
A cargo record is being processed for PTT status changes
Applied to: Cargo Has PTT Status?
WHEN
The system evaluates the cargo's current status
THEN
If cargo has existing PTT status, preserve current PTT status for comparison, otherwise proceed with PTT analysis
Context: Cargo has an existing PTT status
GIVEN
Cargo has an existing PTT status
Applied to: Save Current PTT Status
WHEN
PTT processing begins
THEN
Save the current PTT status values to working storage for potential restoration
Context: A cargo status array exists with multiple status entries
GIVEN
A cargo status array exists with multiple status entries
Applied to: Analyze Status Array for PTT Codes
WHEN
The system analyzes the status array for PTT codes
THEN
Identify and flag any PTT disposition codes present in the status array
Context: The status array has been analyzed for PTT codes
GIVEN
The status array has been analyzed for PTT codes
Applied to: PTT Disposition Code Found?
WHEN
The system checks for PTT disposition code presence
THEN
If PTT disposition code is found, proceed with PTT quantity extraction, otherwise restore previous PTT status if needed
Context: A PTT disposition code has been found in the status array
GIVEN
A PTT disposition code has been found in the status array
Applied to: Extract PTT Quantity from Status Array
WHEN
The system extracts quantity information
THEN
Retrieve the PTT quantity value from the status array entry for validation
Context: PTT quantity has been extracted from the status array
GIVEN
PTT quantity has been extracted from the status array
Applied to: Validate PTT Quantity Against Cargo Quantity
WHEN
The system validates the PTT quantity against total cargo quantity
THEN
If PTT quantity is valid and within acceptable range, proceed with quantity calculations, otherwise generate PTT validation error
Context: PTT quantity has been validated against business rules
GIVEN
PTT quantity has been validated against business rules
Applied to: Quantity Valid?
WHEN
The system checks validation results
THEN
If quantity is valid, calculate remaining quantity after PTT, otherwise log PTT validation error
Context: PTT quantity has been validated as acceptable
GIVEN
PTT quantity has been validated as acceptable
Applied to: Calculate Remaining Quantity After PTT
WHEN
The system calculates remaining quantities
THEN
Subtract PTT quantity from total cargo quantity to determine remaining quantity for further processing
Context: Remaining quantity after PTT has been calculated
GIVEN
Remaining quantity after PTT has been calculated
Applied to: Partial Release Scenario?
WHEN
The system evaluates if this is a partial release scenario
THEN
If released quantity is less than total quantity, set PTT status with partial quantity, otherwise set full PTT release status
Context: A partial release scenario has been identified
GIVEN
A partial release scenario has been identified
Applied to: Set PTT Status with Partial Quantity
WHEN
The system sets PTT status
THEN
Set PTT status with the partial quantity value and maintain tracking for remaining unreleased cargo
Context: PTT status has been set with partial quantity
GIVEN
PTT status has been set with partial quantity
Applied to: Update Released Quantity
WHEN
The system updates released quantity
THEN
Add PTT quantity to the cargo's total released quantity field
Context: Released quantity has been updated for partial release
GIVEN
Released quantity has been updated for partial release
Applied to: Preserve PTT for Remaining Cargo
WHEN
The system processes remaining cargo
THEN
Preserve PTT status for the remaining unreleased cargo quantity to enable future processing
Context: The scenario is determined to be a full release (not partial)
GIVEN
The scenario is determined to be a full release (not partial)
Applied to: Set Full PTT Release Status
WHEN
The system sets PTT release status
THEN
Set full PTT release status for the entire cargo quantity
Context: Full PTT release status has been set
GIVEN
Full PTT release status has been set
Applied to: Clear PTT Status from Array
WHEN
The system cleans up the status array
THEN
Remove PTT status codes from the cargo status array to prevent duplicate processing
Context: No PTT disposition code was found in the current processing
GIVEN
No PTT disposition code was found in the current processing
Applied to: Restore Previous PTT Status if Needed
WHEN
The system needs to restore previous state
THEN
Restore the previously saved PTT status to maintain cargo status consistency
Context: PTT status has been determined (new, preserved, or restored)
GIVEN
PTT status has been determined (new, preserved, or restored)
Applied to: Update Cargo Record with PTT Status
WHEN
The system updates the cargo record
THEN
Write the final PTT status and associated quantities to the cargo database record
Context: Cargo record has been updated with PTT status
GIVEN
Cargo record has been updated with PTT status
Applied to: Generate PTT Status Message
WHEN
The system generates status messages
THEN
Create and send PTT status notification messages to relevant external systems and stakeholders
Context: PTT quantity validation has failed
GIVEN
PTT quantity validation has failed
Applied to: PTT Validation Error
WHEN
The system encounters validation errors
THEN
Generate PTT validation error and proceed to error logging
Context: A PTT validation error has occurred
GIVEN
A PTT validation error has occurred
Applied to: Log PTT Error Message
WHEN
The system logs the error
THEN
Create detailed error log entry with PTT validation failure details and cargo information
R-GCX016-cbl-01005 (+9) File: GCX016.cbl Proceed Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Proceed Processing':
  • Context - a cargo record is being processed for proceed status:
    For Cargo Status Analysis Complete?:
    When the system checks if cargo status analysis is complete, then the system either continues to proceed flag check or skips proceed processing based on analysis completion status.
  • Context - cargo status analysis is complete and status array is available:
    For Proceed Flag Set?:
    When the system checks the proceed flag in the status array, then if proceed flag is set, continue to border arrival validation, otherwise skip proceed processing.
  • Context - proceed flag is set in status array and border arrival requirements are being validated:
    For Border Arrival Date Available?:
    When the system checks for border arrival date availability, then if border arrival date is available, proceed to set proceed status, otherwise skip proceed processing.
  • Context - border arrival date is available and all proceed validation requirements are met:
    For Set Proceed Status in Cargo Record:
    When the system sets proceed status in the cargo record, then the cargo record status is updated to proceed and the system continues to update border arrival date.
  • Context - proceed status has been set in the cargo record:
    For Update Border Arrival Date:
    When the system updates the border arrival date, then the border arrival date is recorded in the cargo record and the system proceeds to clear conflicting hold status.
  • Context - border arrival date has been updated in the cargo record:
    For Clear Any Conflicting Hold Status:
    When the system clears conflicting hold status, then any hold status that conflicts with proceed status is removed and the system checks if cargo is cross-border.
  • Context - conflicting hold status has been cleared:
    For Cross-Border Cargo?:
    When the system checks if cargo is cross-border cargo, then if cargo is cross-border, coordinate with canadian system, otherwise proceed to update cargo status flags.
  • Context - cargo is identified as cross-border cargo:
    For Coordinate with Canadian System:
    When the system coordinates with canadian system, then canadian manifest records are updated or notified of proceed status and the system continues to update cargo status flags.
  • Context - proceed status has been set and any canadian system coordination is complete:
    For Update Cargo Status Flags:
    When the system updates cargo status flags, then all cargo status flags are updated to reflect proceed status and the system logs the status change.
  • Context - cargo status flags have been updated to reflect proceed status:
    For Log Proceed Status Change:
    When the system logs the proceed status change, then the proceed status change is recorded in the system log and proceed processing is marked as complete.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for proceed status
GIVEN
A cargo record is being processed for proceed status
Applied to: Cargo Status Analysis Complete?
WHEN
The system checks if cargo status analysis is complete
THEN
The system either continues to proceed flag check or skips proceed processing based on analysis completion status
Context: Cargo status analysis is complete and status array is available
GIVEN
Cargo status analysis is complete and status array is available
Applied to: Proceed Flag Set?
WHEN
The system checks the proceed flag in the status array
THEN
If proceed flag is set, continue to border arrival validation, otherwise skip proceed processing
Context: Proceed flag is set in status array and border arrival requirements are being validated
GIVEN
Proceed flag is set in status array and border arrival requirements are being validated
Applied to: Border Arrival Date Available?
WHEN
The system checks for border arrival date availability
THEN
If border arrival date is available, proceed to set proceed status, otherwise skip proceed processing
Context: Border arrival date is available and all proceed validation requirements are met
GIVEN
Border arrival date is available and all proceed validation requirements are met
Applied to: Set Proceed Status in Cargo Record
WHEN
The system sets proceed status in the cargo record
THEN
The cargo record status is updated to proceed and the system continues to update border arrival date
Context: Proceed status has been set in the cargo record
GIVEN
Proceed status has been set in the cargo record
Applied to: Update Border Arrival Date
WHEN
The system updates the border arrival date
THEN
The border arrival date is recorded in the cargo record and the system proceeds to clear conflicting hold status
Context: Border arrival date has been updated in the cargo record
GIVEN
Border arrival date has been updated in the cargo record
Applied to: Clear Any Conflicting Hold Status
WHEN
The system clears conflicting hold status
THEN
Any hold status that conflicts with proceed status is removed and the system checks if cargo is cross-border
Context: Conflicting hold status has been cleared
GIVEN
Conflicting hold status has been cleared
Applied to: Cross-Border Cargo?
WHEN
The system checks if cargo is cross-border cargo
THEN
If cargo is cross-border, coordinate with Canadian system, otherwise proceed to update cargo status flags
Context: Cargo is identified as cross-border cargo
GIVEN
Cargo is identified as cross-border cargo
Applied to: Coordinate with Canadian System
WHEN
The system coordinates with Canadian system
THEN
Canadian manifest records are updated or notified of proceed status and the system continues to update cargo status flags
Context: Proceed status has been set and any Canadian system coordination is complete
GIVEN
Proceed status has been set and any Canadian system coordination is complete
Applied to: Update Cargo Status Flags
WHEN
The system updates cargo status flags
THEN
All cargo status flags are updated to reflect proceed status and the system logs the status change
Context: Cargo status flags have been updated to reflect proceed status
GIVEN
Cargo status flags have been updated to reflect proceed status
Applied to: Log Proceed Status Change
WHEN
The system logs the proceed status change
THEN
The proceed status change is recorded in the system log and proceed processing is marked as complete
R-GCX016-cbl-01015 (+12) File: GCX016.cbl Hold Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hold Processing':
  • Context - a cargo record with status array s09a containing various disposition codes:
    For Analyze Status Array for Hold Codes:
    When the system processes the status array to identify hold-related codes, then the system sets appropriate flags for border holds, destination holds, fda holds, and piece count holds based on the codes found in the array.
  • Context - a cargo record with identified hold codes in the status array:
    For Hold Location Determination:
    When the system evaluates the hold codes to determine applicable locations, then the system classifies the hold as border-only, destination-only, or both locations based on the specific disposition codes present.
  • Context - a cargo record requiring border hold processing:
    For Set Border Hold Status:
    When the system determines that hold codes apply to border location, then the system sets the cargo status to border hold and updates the appropriate status flags.
  • Context - a cargo record requiring destination hold processing:
    For Set Destination Hold Status:
    When the system determines that hold codes apply to destination location, then the system sets the cargo status to destination hold and updates the appropriate status flags.
  • Context - a cargo record with hold codes requiring restrictions at multiple locations:
    For Set Both Border and Destination Hold:
    When the system determines that hold codes apply to both border and destination, then the system sets the cargo status to hold at both locations and updates all relevant status flags.
  • Context - a cargo record with proposed hold status changes:
    For Validate Hold Requirements:
    When the system validates the hold requirements against current cargo conditions, then the system confirms the hold is valid or rejects invalid hold attempts based on cargo state and business rules.
  • Context - a cargo record with disposition codes that may require fda oversight:
    For FDA Hold Required?:
    When the system evaluates disposition codes for fda hold requirements, then the system sets fda hold flag if a3 or other fda-related disposition codes are present.
  • Context - a cargo record requiring fda hold processing:
    For Set FDA Hold at Destination:
    When the system determines fda hold is required at destination, then the system sets holdfda status and applies destination hold with fda-specific processing requirements.
  • Context - a cargo record with release quantities that may be less than total quantities:
    For Partial Release Scenario?:
    When the system compares released quantities against total cargo quantities, then the system identifies partial release scenarios where released quantity is less than total quantity.
  • Context - a cargo record with partial release quantities:
    For Set Hold on Piece Counts Status:
    When the system determines that some pieces are released while others remain held, then the system sets holdpcs status to indicate hold on remaining piece counts.
  • Context - a cargo record with determined hold status requirements:
    For Update Cargo Hold Flags:
    When the system updates cargo hold flags and status indicators, then the system sets all appropriate hold flags including border hold, destination hold, fda hold, and piece count hold flags.
  • Context - a cargo record with confirmed hold status and location details:
    For Generate Hold Message with Location Details:
    When the system generates hold notification messages, then the system creates detailed messages including hold type, location information, and relevant cargo details for broker notifications.
  • Context - a cargo record with processed hold status changes:
    For Update Status Array with Hold Information:
    When the system updates the status array with hold information, then the system adds appropriate hold disposition codes to the s09a status array and maintains proper sequencing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with status array S09A containing various disposition codes
GIVEN
A cargo record with status array S09A containing various disposition codes
Applied to: Analyze Status Array for Hold Codes
WHEN
The system processes the status array to identify hold-related codes
THEN
The system sets appropriate flags for border holds, destination holds, FDA holds, and piece count holds based on the codes found in the array
Context: A cargo record with identified hold codes in the status array
GIVEN
A cargo record with identified hold codes in the status array
Applied to: Hold Location Determination
WHEN
The system evaluates the hold codes to determine applicable locations
THEN
The system classifies the hold as border-only, destination-only, or both locations based on the specific disposition codes present
Context: A cargo record requiring border hold processing
GIVEN
A cargo record requiring border hold processing
Applied to: Set Border Hold Status
WHEN
The system determines that hold codes apply to border location
THEN
The system sets the cargo status to border hold and updates the appropriate status flags
Context: A cargo record requiring destination hold processing
GIVEN
A cargo record requiring destination hold processing
Applied to: Set Destination Hold Status
WHEN
The system determines that hold codes apply to destination location
THEN
The system sets the cargo status to destination hold and updates the appropriate status flags
Context: A cargo record with hold codes requiring restrictions at multiple locations
GIVEN
A cargo record with hold codes requiring restrictions at multiple locations
Applied to: Set Both Border and Destination Hold
WHEN
The system determines that hold codes apply to both border and destination
THEN
The system sets the cargo status to hold at both locations and updates all relevant status flags
Context: A cargo record with proposed hold status changes
GIVEN
A cargo record with proposed hold status changes
Applied to: Validate Hold Requirements
WHEN
The system validates the hold requirements against current cargo conditions
THEN
The system confirms the hold is valid or rejects invalid hold attempts based on cargo state and business rules
Context: A cargo record with disposition codes that may require FDA oversight
GIVEN
A cargo record with disposition codes that may require FDA oversight
Applied to: FDA Hold Required?
WHEN
The system evaluates disposition codes for FDA hold requirements
THEN
The system sets FDA hold flag if A3 or other FDA-related disposition codes are present
Context: A cargo record requiring FDA hold processing
GIVEN
A cargo record requiring FDA hold processing
Applied to: Set FDA Hold at Destination
WHEN
The system determines FDA hold is required at destination
THEN
The system sets HOLDFDA status and applies destination hold with FDA-specific processing requirements
Context: A cargo record with release quantities that may be less than total quantities
GIVEN
A cargo record with release quantities that may be less than total quantities
Applied to: Partial Release Scenario?
WHEN
The system compares released quantities against total cargo quantities
THEN
The system identifies partial release scenarios where released quantity is less than total quantity
Context: A cargo record with partial release quantities
GIVEN
A cargo record with partial release quantities
Applied to: Set Hold on Piece Counts Status
WHEN
The system determines that some pieces are released while others remain held
THEN
The system sets HOLDPCS status to indicate hold on remaining piece counts
Context: A cargo record with determined hold status requirements
GIVEN
A cargo record with determined hold status requirements
Applied to: Update Cargo Hold Flags
WHEN
The system updates cargo hold flags and status indicators
THEN
The system sets all appropriate hold flags including border hold, destination hold, FDA hold, and piece count hold flags
Context: A cargo record with confirmed hold status and location details
GIVEN
A cargo record with confirmed hold status and location details
Applied to: Generate Hold Message with Location Details
WHEN
The system generates hold notification messages
THEN
The system creates detailed messages including hold type, location information, and relevant cargo details for broker notifications
Context: A cargo record with processed hold status changes
GIVEN
A cargo record with processed hold status changes
Applied to: Update Status Array with Hold Information
WHEN
The system updates the status array with hold information
THEN
The system adds appropriate hold disposition codes to the S09A status array and maintains proper sequencing
R-GCX016-cbl-01028 (+10) File: GCX016.cbl Release Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Processing':
  • Context - a cargo record with released quantity and total quantity values:
    For Check Released Quantity vs Total Quantity:
    When the system compares released quantity against total quantity, then the system determines if quantities match for full release processing or routes to partial release.
  • Context - released quantity equals total quantity:
    For Set Full Release Status:
    When the system processes the quantity match condition, then the system sets the cargo status to full release.
  • Context - cargo has achieved full release status:
    For Clear Destination Index RT076:
    When the system processes the full release, then the system clears the rt076 destination index field.
  • Context - cargo has been processed for full release:
    For Update Cargo Status to Released:
    When the system updates cargo status, then the system sets cargo status to released.
  • Context - cargo is being processed for full release:
    For Remove Hold Flags:
    When the system updates hold status, then the system removes all hold flags from the cargo record.
    For Update Release Quantity to Total:
    When the system updates release quantities, then the system sets release quantity equal to total quantity.
  • Context - cargo is being fully released:
    For Set Release Date:
    When the system processes the release, then the system sets the release date to current date.
  • Context - cargo has border hold status and is being fully released:
    For Clear Border Hold Status:
    When the system processes the full release, then the system clears the border hold status.
  • Context - cargo has destination hold status and is being fully released:
    For Clear Destination Hold Status:
    When the system processes the full release, then the system clears the destination hold status.
  • Context - all release processing steps are completed:
    For Mark Cargo as Fully Released:
    When the system finalizes the release process, then the system marks the cargo as fully released.
  • Context - all cargo release updates have been applied:
    For Save Updated Cargo Record:
    When the system completes release processing, then the system saves the updated cargo record to the database.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with released quantity and total quantity values
GIVEN
A cargo record with released quantity and total quantity values
Applied to: Check Released Quantity vs Total Quantity
WHEN
The system compares released quantity against total quantity
THEN
The system determines if quantities match for full release processing or routes to partial release
Context: Released quantity equals total quantity
GIVEN
Released quantity equals total quantity
Applied to: Set Full Release Status
WHEN
The system processes the quantity match condition
THEN
The system sets the cargo status to full release
Context: Cargo has achieved full release status
GIVEN
Cargo has achieved full release status
Applied to: Clear Destination Index RT076
WHEN
The system processes the full release
THEN
The system clears the RT076 destination index field
Context: Cargo has been processed for full release
GIVEN
Cargo has been processed for full release
Applied to: Update Cargo Status to Released
WHEN
The system updates cargo status
THEN
The system sets cargo status to released
Context: Cargo is being processed for full release
GIVEN
Cargo is being processed for full release
Applied to: Remove Hold Flags
WHEN
The system updates hold status
THEN
The system removes all hold flags from the cargo record
Applied to: Update Release Quantity to Total
WHEN
The system updates release quantities
THEN
The system sets release quantity equal to total quantity
Context: Cargo is being fully released
GIVEN
Cargo is being fully released
Applied to: Set Release Date
WHEN
The system processes the release
THEN
The system sets the release date to current date
Context: Cargo has border hold status and is being fully released
GIVEN
Cargo has border hold status and is being fully released
Applied to: Clear Border Hold Status
WHEN
The system processes the full release
THEN
The system clears the border hold status
Context: Cargo has destination hold status and is being fully released
GIVEN
Cargo has destination hold status and is being fully released
Applied to: Clear Destination Hold Status
WHEN
The system processes the full release
THEN
The system clears the destination hold status
Context: All release processing steps are completed
GIVEN
All release processing steps are completed
Applied to: Mark Cargo as Fully Released
WHEN
The system finalizes the release process
THEN
The system marks the cargo as fully released
Context: All cargo release updates have been applied
GIVEN
All cargo release updates have been applied
Applied to: Save Updated Cargo Record
WHEN
The system completes release processing
THEN
The system saves the updated cargo record to the database
R-GCX016-cbl-01039 (+9) File: GCX016.cbl Arrival/Export Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Arrival/Export Processing':
  • Context - a cargo record exists and arrival processing is being performed:
    For Set Arrival Status:
    When the arrival flag is set for the cargo, then the cargo status is updated to arrival status and the border arrival date is set to current date.
  • Context - cargo is being set to arrival status:
    For Update Border Arrival Date:
    When the arrival status is being applied, then the border arrival date is updated with the current system date.
  • Context - cargo has both arrival flag set and existing export status:
    For Clear Export Status if Set:
    When arrival status is being applied to the cargo, then the export status is cleared and removed from the cargo record.
  • Context - a cargo record exists and export processing is being performed:
    For Set Export Status:
    When the export flag is set for the cargo, then the cargo status is updated to export status.
  • Context - cargo is being set to export status:
    For Clear Destination Index & Update Export Date:
    When the export status is being applied, then the destination index is cleared and set to blank and the export date is updated with the current system date.
  • Context - cargo has both arrival and export flags set simultaneously:
    For Prioritize Export Status:
    When both statuses are being evaluated for application, then export status is applied and arrival status is overridden.
  • Context - cargo status is being changed to arrival or export:
    For Log Status Change:
    When the status change is being applied, then the status change is logged with timestamp and details for audit trail.
  • Context - arrival or export status has been determined for cargo:
    For Update Cargo Record:
    When status processing is complete, then the cargo record is updated in the database with the new status and associated dates.
  • Context - cargo status has been updated to arrival or export:
    For Generate Status Notification:
    When the status update is complete, then status change notifications are generated and sent to relevant parties including brokers and customs.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists and arrival processing is being performed
GIVEN
A cargo record exists and arrival processing is being performed
Applied to: Set Arrival Status
WHEN
The arrival flag is set for the cargo
THEN
The cargo status is updated to arrival status and the border arrival date is set to current date
Context: Cargo is being set to arrival status
GIVEN
Cargo is being set to arrival status
Applied to: Update Border Arrival Date
WHEN
The arrival status is being applied
THEN
The border arrival date is updated with the current system date
Context: Cargo has both arrival flag set and existing export status
GIVEN
Cargo has both arrival flag set and existing export status
Applied to: Clear Export Status if Set
WHEN
Arrival status is being applied to the cargo
THEN
The export status is cleared and removed from the cargo record
Context: A cargo record exists and export processing is being performed
GIVEN
A cargo record exists and export processing is being performed
Applied to: Set Export Status
WHEN
The export flag is set for the cargo
THEN
The cargo status is updated to export status
Context: Cargo is being set to export status
GIVEN
Cargo is being set to export status
Applied to: Clear Destination Index & Update Export Date
WHEN
The export status is being applied
THEN
The destination index is cleared and set to blank AND The export date is updated with the current system date
Context: Cargo has both arrival and export flags set simultaneously
GIVEN
Cargo has both arrival and export flags set simultaneously
Applied to: Prioritize Export Status
WHEN
Both statuses are being evaluated for application
THEN
Export status is applied and arrival status is overridden
Context: Cargo status is being changed to arrival or export
GIVEN
Cargo status is being changed to arrival or export
Applied to: Log Status Change
WHEN
The status change is being applied
THEN
The status change is logged with timestamp and details for audit trail
Context: Arrival or export status has been determined for cargo
GIVEN
Arrival or export status has been determined for cargo
Applied to: Update Cargo Record
WHEN
Status processing is complete
THEN
The cargo record is updated in the database with the new status and associated dates
Context: Cargo status has been updated to arrival or export
GIVEN
Cargo status has been updated to arrival or export
Applied to: Generate Status Notification
WHEN
The status update is complete
THEN
Status change notifications are generated and sent to relevant parties including brokers and customs
R-GCX016-cbl-01049 (+15) File: GCX016.cbl Cancel Release Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cancel Release Processing':
  • Context - a cargo record exists in the system with status information:
    For Previously Released Cargo Detected?:
    When the system analyzes the cargo's current status array for release indicators, then the system determines if the cargo was previously released based on release status flags and proceeds to status analysis or completes processing.
  • Context - previously released cargo has been identified:
    For Analyze Current Status Array:
    When the system calls b570-verify-the-array to analyze status conditions, then the system sets flags for cargo conditions including empty, held, released, ptt status and prepares for release status change detection.
  • Context - the current status array has been analyzed and cargo was previously released:
    For Release Status Changed to Unreleased?:
    When the system compares current release status against previous release status, then if release status changed from released to unreleased, proceed to unrelease scenario identification, otherwise complete processing.
  • Context - release status has changed from released to unreleased:
    For Identify Cargo Unrelease Scenario:
    When the system evaluates the disposition code and current cargo conditions, then the system identifies the specific unrelease scenario type and prepares appropriate processing actions.
  • Context - an unrelease scenario has been identified:
    For Generate Unrelease Notification:
    When the system calls c600-format-merlin-info to format the unrelease message, then the system creates a formatted notification message containing disposition code, cargo details, and unrelease information.
  • Context - unrelease notification has been generated:
    For Update Cargo Status to Unreleased:
    When the system calls b580-set-us-cargo-status to update cargo status, then the cargo status is updated to unreleased condition with appropriate status description and flags.
  • Context - cargo status has been updated to unreleased:
    For Clear Release Quantities:
    When the system processes quantity adjustments for unrelease, then release quantities are cleared or adjusted to reflect the unreleased status.
  • Context - release quantities have been cleared:
    For Re-establish Destination Index:
    When the system calls b585-set-rt076-dest-index to restore destination information, then destination index is re-established with appropriate bond dates and routing information for the unreleased cargo.
  • Context - destination index has been re-established for unreleased cargo:
    For Canadian Manifest Coordination Required?:
    When the system checks if cargo has canadian manifest cross-references, then if canadian manifest coordination is required, proceed to canadian manifest processing, otherwise proceed to message routing.
  • Context - canadian manifest coordination is required:
    For Process Canadian Manifest Cross-reference:
    When the system calls b583-process-cdn-mfst to handle canadian manifest processing, then canadian manifest records are updated to reflect the cargo unrelease status.
  • Context - canadian manifest cross-reference has been processed:
    For Send Notification to Canadian System:
    When the system sends notification to canadian system about cargo unrelease, then canadian system receives notification of cargo status change to unreleased.
  • Context - canadian system notification has been sent or canadian coordination is not required:
    For Route Unrelease Message to Appropriate Users:
    When the system calls z110-prep-emcsend with message type unrlse, then unrelease message is routed to default and cancel-specific merlin ids for appropriate user notification.
  • Context - unrelease message has been routed to appropriate users:
    For Broker Notification Required?:
    When the system checks broker notification requirements for the cargo, then if broker notification is required, proceed to send broker notification, otherwise proceed to transaction logging.
  • Context - broker notification is required for the unrelease event:
    For Send Broker Notification for Unrelease:
    When the system calls c801-notify-broker with unrelease information, then broker receives notification about cargo unrelease with relevant details and disposition code information.
  • Context - broker notification has been sent or is not required:
    For Log Cargo Unrelease Transaction:
    When the system calls z300-spawn-gct1051e to log the transaction, then cargo unrelease transaction is logged with complete details for audit trail and system tracking.
  • Context - cargo unrelease transaction has been logged:
    For Update Integration Services:
    When the system calls c700-call-gcciis with unrelease status information, then integration services are updated with cargo unrelease status for equipment and container processing systems.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with status information
GIVEN
A cargo record exists in the system with status information
Applied to: Previously Released Cargo Detected?
WHEN
The system analyzes the cargo's current status array for release indicators
THEN
The system determines if the cargo was previously released based on release status flags and proceeds to status analysis or completes processing
Context: Previously released cargo has been identified
GIVEN
Previously released cargo has been identified
Applied to: Analyze Current Status Array
WHEN
The system calls B570-VERIFY-THE-ARRAY to analyze status conditions
THEN
The system sets flags for cargo conditions including empty, held, released, PTT status and prepares for release status change detection
Context: The current status array has been analyzed and cargo was previously released
GIVEN
The current status array has been analyzed and cargo was previously released
Applied to: Release Status Changed to Unreleased?
WHEN
The system compares current release status against previous release status
THEN
If release status changed from released to unreleased, proceed to unrelease scenario identification, otherwise complete processing
Context: Release status has changed from released to unreleased
GIVEN
Release status has changed from released to unreleased
Applied to: Identify Cargo Unrelease Scenario
WHEN
The system evaluates the disposition code and current cargo conditions
THEN
The system identifies the specific unrelease scenario type and prepares appropriate processing actions
Context: An unrelease scenario has been identified
GIVEN
An unrelease scenario has been identified
Applied to: Generate Unrelease Notification
WHEN
The system calls C600-FORMAT-MERLIN-INFO to format the unrelease message
THEN
The system creates a formatted notification message containing disposition code, cargo details, and unrelease information
Context: Unrelease notification has been generated
GIVEN
Unrelease notification has been generated
Applied to: Update Cargo Status to Unreleased
WHEN
The system calls B580-SET-US-CARGO-STATUS to update cargo status
THEN
The cargo status is updated to unreleased condition with appropriate status description and flags
Context: Cargo status has been updated to unreleased
GIVEN
Cargo status has been updated to unreleased
Applied to: Clear Release Quantities
WHEN
The system processes quantity adjustments for unrelease
THEN
Release quantities are cleared or adjusted to reflect the unreleased status
Context: Release quantities have been cleared
GIVEN
Release quantities have been cleared
Applied to: Re-establish Destination Index
WHEN
The system calls B585-SET-RT076-DEST-INDEX to restore destination information
THEN
Destination index is re-established with appropriate bond dates and routing information for the unreleased cargo
Context: Destination index has been re-established for unreleased cargo
GIVEN
Destination index has been re-established for unreleased cargo
Applied to: Canadian Manifest Coordination Required?
WHEN
The system checks if cargo has Canadian manifest cross-references
THEN
If Canadian manifest coordination is required, proceed to Canadian manifest processing, otherwise proceed to message routing
Context: Canadian manifest coordination is required
GIVEN
Canadian manifest coordination is required
Applied to: Process Canadian Manifest Cross-reference
WHEN
The system calls B583-PROCESS-CDN-MFST to handle Canadian manifest processing
THEN
Canadian manifest records are updated to reflect the cargo unrelease status
Context: Canadian manifest cross-reference has been processed
GIVEN
Canadian manifest cross-reference has been processed
Applied to: Send Notification to Canadian System
WHEN
The system sends notification to Canadian system about cargo unrelease
THEN
Canadian system receives notification of cargo status change to unreleased
Context: Canadian system notification has been sent or Canadian coordination is not required
GIVEN
Canadian system notification has been sent or Canadian coordination is not required
Applied to: Route Unrelease Message to Appropriate Users
WHEN
The system calls Z110-PREP-EMCSEND with message type UNRLSE
THEN
Unrelease message is routed to default and cancel-specific Merlin IDs for appropriate user notification
Context: Unrelease message has been routed to appropriate users
GIVEN
Unrelease message has been routed to appropriate users
Applied to: Broker Notification Required?
WHEN
The system checks broker notification requirements for the cargo
THEN
If broker notification is required, proceed to send broker notification, otherwise proceed to transaction logging
Context: Broker notification is required for the unrelease event
GIVEN
Broker notification is required for the unrelease event
Applied to: Send Broker Notification for Unrelease
WHEN
The system calls C801-NOTIFY-BROKER with unrelease information
THEN
Broker receives notification about cargo unrelease with relevant details and disposition code information
Context: Broker notification has been sent or is not required
GIVEN
Broker notification has been sent or is not required
Applied to: Log Cargo Unrelease Transaction
WHEN
The system calls Z300-SPAWN-GCT1051E to log the transaction
THEN
Cargo unrelease transaction is logged with complete details for audit trail and system tracking
Context: Cargo unrelease transaction has been logged
GIVEN
Cargo unrelease transaction has been logged
Applied to: Update Integration Services
WHEN
The system calls C700-CALL-GCCIIS with unrelease status information
THEN
Integration services are updated with cargo unrelease status for equipment and container processing systems
R-GCX016-cbl-01065 (+11) File: GCX016.cbl Canadian Manifest Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Manifest Processing':
  • Context - a us cargo has been released:
    For Canadian Manifest Coordination Required?:
    When the system evaluates if canadian manifest coordination is needed, then the system should proceed with canadian manifest processing if coordination is required, otherwise skip canadian processing.
  • Context - canadian manifest coordination is required:
    For Access Canadian Cargo Database Records:
    When the system needs to access canadian cargo records, then the system should connect to and query the canadian cargo database.
  • Context - canadian cargo database records are accessible:
    For Match Canadian Cargo by Equipment ID:
    When the system searches for matching canadian cargo using equipment id, then the system should locate canadian cargo records that match the equipment identifier.
  • Context - the system has searched for canadian cargo by equipment id:
    For Canadian Cargo Record Found?:
    When the search results are evaluated, then the system should determine if a valid canadian cargo record was found and proceed accordingly or terminate canadian processing.
  • Context - a canadian cargo record has been found:
    For Validate Canadian Record Status:
    When the system validates the record status, then the system should verify the canadian record is in a valid state for processing.
  • Context - a canadian cargo record status has been validated:
    For Canadian Record Valid and Usable?:
    When the system checks if the record is usable for coordination, then the system should proceed with log message creation if the record is valid and usable, otherwise terminate canadian processing.
  • Context - a valid and usable canadian cargo record exists:
    For Create Cross-Border Log Message:
    When the system creates a cross-border coordination log message, then the system should generate a properly formatted log message containing relevant cargo release information.
  • Context - a cross-border log message has been created:
    For Place Log Message on Canadian CCN:
    When the system places the log message on the canadian ccn, then the system should successfully transmit and store the log message in the canadian ccn system.
  • Context - the log message has been placed on canadian ccn:
    For Update Canadian Manifest Status:
    When the system updates the canadian manifest status, then the system should update the canadian manifest record to indicate successful cross-border coordination.
  • Context - the canadian manifest status has been updated:
    For Canadian Coordination Complete:
    When the coordination process completes, then the system should mark the canadian coordination as complete and continue with normal processing.
  • Context - us cargo has been released:
    For No Canadian Manifest Processing Required:
    When canadian manifest coordination is not required, then the system should bypass all canadian manifest processing and continue with normal operations.
  • Context - the system has attempted to find and validate canadian cargo records:
    For Canadian Record Not Found or Invalid:
    When no valid canadian record is found or the record is invalid, then the system should terminate canadian coordination processing and continue with normal operations.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo has been released
GIVEN
A US cargo has been released
Applied to: Canadian Manifest Coordination Required?
WHEN
The system evaluates if Canadian manifest coordination is needed
THEN
The system should proceed with Canadian manifest processing if coordination is required, otherwise skip Canadian processing
Context: Canadian manifest coordination is required
GIVEN
Canadian manifest coordination is required
Applied to: Access Canadian Cargo Database Records
WHEN
The system needs to access Canadian cargo records
THEN
The system should connect to and query the Canadian cargo database
Context: Canadian cargo database records are accessible
GIVEN
Canadian cargo database records are accessible
Applied to: Match Canadian Cargo by Equipment ID
WHEN
The system searches for matching Canadian cargo using equipment ID
THEN
The system should locate Canadian cargo records that match the equipment identifier
Context: The system has searched for Canadian cargo by equipment ID
GIVEN
The system has searched for Canadian cargo by equipment ID
Applied to: Canadian Cargo Record Found?
WHEN
The search results are evaluated
THEN
The system should determine if a valid Canadian cargo record was found and proceed accordingly or terminate Canadian processing
Context: A Canadian cargo record has been found
GIVEN
A Canadian cargo record has been found
Applied to: Validate Canadian Record Status
WHEN
The system validates the record status
THEN
The system should verify the Canadian record is in a valid state for processing
Context: A Canadian cargo record status has been validated
GIVEN
A Canadian cargo record status has been validated
Applied to: Canadian Record Valid and Usable?
WHEN
The system checks if the record is usable for coordination
THEN
The system should proceed with log message creation if the record is valid and usable, otherwise terminate Canadian processing
Context: A valid and usable Canadian cargo record exists
GIVEN
A valid and usable Canadian cargo record exists
Applied to: Create Cross-Border Log Message
WHEN
The system creates a cross-border coordination log message
THEN
The system should generate a properly formatted log message containing relevant cargo release information
Context: A cross-border log message has been created
GIVEN
A cross-border log message has been created
Applied to: Place Log Message on Canadian CCN
WHEN
The system places the log message on the Canadian CCN
THEN
The system should successfully transmit and store the log message in the Canadian CCN system
Context: The log message has been placed on Canadian CCN
GIVEN
The log message has been placed on Canadian CCN
Applied to: Update Canadian Manifest Status
WHEN
The system updates the Canadian manifest status
THEN
The system should update the Canadian manifest record to indicate successful cross-border coordination
Context: The Canadian manifest status has been updated
GIVEN
The Canadian manifest status has been updated
Applied to: Canadian Coordination Complete
WHEN
The coordination process completes
THEN
The system should mark the Canadian coordination as complete and continue with normal processing
Context: US cargo has been released
GIVEN
US cargo has been released
Applied to: No Canadian Manifest Processing Required
WHEN
Canadian manifest coordination is not required
THEN
The system should bypass all Canadian manifest processing and continue with normal operations
Context: The system has attempted to find and validate Canadian cargo records
GIVEN
The system has attempted to find and validate Canadian cargo records
Applied to: Canadian Record Not Found or Invalid
WHEN
No valid Canadian record is found or the record is invalid
THEN
The system should terminate Canadian coordination processing and continue with normal operations
R-GCX016-cbl-01077 (+9) File: GCX016.cbl Canadian Release Notification Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Release Notification':
  • Context - us cargo has been released:
    For Canadian Manifest Coordination Required?:
    When the system evaluates if canadian manifest coordination is needed, then the system should proceed to find matching canadian manifests if coordination is required, otherwise skip canadian processing.
  • Context - canadian manifest coordination is required:
    For Find Matching Canadian Manifests:
    When the system searches for matching canadian manifests using equipment id, then the system should access the canadian cargo database to find related records.
  • Context - matching canadian manifests need to be found:
    For Access Canadian Cargo Database:
    When the system accesses the canadian cargo database, then the system should retrieve canadian ccn records for processing.
  • Context - the canadian cargo database has been accessed:
    For Canadian CCN Records Found?:
    When the system checks for canadian ccn records, then if canadian ccn records are found, proceed to match canadian cargo by equipment id, otherwise skip canadian processing.
  • Context - canadian ccn records are found:
    For Match Canadian Cargo by Equipment ID:
    When the system matches canadian cargo by equipment id, then the system should validate if the canadian records are usable for processing.
  • Context - canadian cargo has been matched by equipment id:
    For Valid Canadian Records?:
    When the system validates canadian records, then if records are valid, generate log message for canadian ccn, otherwise exclude deleted or unusable records.
  • Context - canadian records need validation:
    For Exclude Deleted/Unusable Canadian Records:
    When the system encounters deleted or unusable canadian records, then the system should exclude these records and re-validate the remaining records.
  • Context - valid canadian records are identified:
    For Generate Log Message for Canadian CCN:
    When the system generates a log message for canadian ccn, then the system should place the log message on the canadian system.
  • Context - a log message has been generated for canadian ccn:
    For Place Log Message on Canadian System:
    When the system places the log message on the canadian system, then the system should create an audit trail for the cross-border release.
  • Context - the log message has been placed on the canadian system:
    For Create Audit Trail for Cross-Border Release:
    When the system creates an audit trail for cross-border release, then the canadian notification process should be marked as complete.
👨‍💻 Technical ACs (Gherkin)
Context: US cargo has been released
GIVEN
US cargo has been released
Applied to: Canadian Manifest Coordination Required?
WHEN
the system evaluates if Canadian manifest coordination is needed
THEN
the system should proceed to find matching Canadian manifests if coordination is required, otherwise skip Canadian processing
Context: Canadian manifest coordination is required
GIVEN
Canadian manifest coordination is required
Applied to: Find Matching Canadian Manifests
WHEN
the system searches for matching Canadian manifests using equipment ID
THEN
the system should access the Canadian cargo database to find related records
Context: matching Canadian manifests need to be found
GIVEN
matching Canadian manifests need to be found
Applied to: Access Canadian Cargo Database
WHEN
the system accesses the Canadian cargo database
THEN
the system should retrieve Canadian CCN records for processing
Context: the Canadian cargo database has been accessed
GIVEN
the Canadian cargo database has been accessed
Applied to: Canadian CCN Records Found?
WHEN
the system checks for Canadian CCN records
THEN
if Canadian CCN records are found, proceed to match Canadian cargo by equipment ID, otherwise skip Canadian processing
Context: Canadian CCN records are found
GIVEN
Canadian CCN records are found
Applied to: Match Canadian Cargo by Equipment ID
WHEN
the system matches Canadian cargo by equipment ID
THEN
the system should validate if the Canadian records are usable for processing
Context: Canadian cargo has been matched by equipment ID
GIVEN
Canadian cargo has been matched by equipment ID
Applied to: Valid Canadian Records?
WHEN
the system validates Canadian records
THEN
if records are valid, generate log message for Canadian CCN, otherwise exclude deleted or unusable records
Context: Canadian records need validation
GIVEN
Canadian records need validation
Applied to: Exclude Deleted/Unusable Canadian Records
WHEN
the system encounters deleted or unusable Canadian records
THEN
the system should exclude these records and re-validate the remaining records
Context: valid Canadian records are identified
GIVEN
valid Canadian records are identified
Applied to: Generate Log Message for Canadian CCN
WHEN
the system generates a log message for Canadian CCN
THEN
the system should place the log message on the Canadian system
Context: a log message has been generated for Canadian CCN
GIVEN
a log message has been generated for Canadian CCN
Applied to: Place Log Message on Canadian System
WHEN
the system places the log message on the Canadian system
THEN
the system should create an audit trail for the cross-border release
Context: the log message has been placed on the Canadian system
GIVEN
the log message has been placed on the Canadian system
Applied to: Create Audit Trail for Cross-Border Release
WHEN
the system creates an audit trail for cross-border release
THEN
the Canadian notification process should be marked as complete
R-GCX016-cbl-01087 (+8) File: GCX016.cbl Destination Index Management Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Index Management':
  • Context - a cargo record exists with manual release status (mrl) and has an existing destination index:
    For Manual Release Processing:
    When the cargo status is set to manual release, then the rt076 destination index should be cleared and the cargo should no longer be tracked for destination-specific requirements.
  • Context - a cargo record exists and fda hold disposition code (a3) is applied at destination location:
    For FDA Hold at Destination:
    When the cargo status is set to fda hold at destination, then the rt076 destination index should be set with fda hold status and destination location information.
  • Context - a cargo record exists with full release status where released quantity equals or exceeds total quantity:
    For Full Release Processing:
    When the cargo status is set to full release, then the rt076 destination index should be cleared and destination tracking requirements should be removed.
  • Context - a cargo record exists and arrival status is being processed with valid arrival date and destination location:
    For Arrival Status Processing:
    When the cargo status is set to arrival at destination, then the rt076 destination index should be set with arrival date and destination location information.
  • Context - a cargo record exists and export status is being applied:
    For Export Status Processing:
    When the cargo status is set to export, then the rt076 destination index should be cleared and domestic destination tracking should be removed.
  • Context - a cargo record exists with cancelled arrival status and has previous bond date information available:
    For Arrival Cancellation:
    When the cargo arrival status is cancelled, then the previous bond date should be restored and the rt076 destination index should be re-established with the restored bond date.
  • Context - a cargo record exists with cancelled export status and has bond date information available:
    For Export Cancellation:
    When the cargo export status is cancelled, then the rt076 destination index should be re-established with bond date information to resume domestic destination tracking.
  • Context - a cargo record requires bond date processing with valid calendar date information:
    For Calculate Julian Date for Bond Start:
    When bond date calculation is initiated for cargo processing, then the system should convert the calendar date to julian date format for bond tracking and cargo age calculation purposes.
  • Context - a cargo record has undergone status changes that affect destination tracking requirements:
    For Update RT076 Destination Index:
    When destination index updates are processed, then the rt076 destination index record should be updated with current status, dates, and location information reflecting the cargo's destination tracking requirements.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with manual release status (MRL) and has an existing destination index
GIVEN
A cargo record exists with manual release status (MRL) and has an existing destination index
Applied to: Manual Release Processing
WHEN
The cargo status is set to manual release
THEN
The RT076 destination index should be cleared and the cargo should no longer be tracked for destination-specific requirements
Context: A cargo record exists and FDA hold disposition code (A3) is applied at destination location
GIVEN
A cargo record exists and FDA hold disposition code (A3) is applied at destination location
Applied to: FDA Hold at Destination
WHEN
The cargo status is set to FDA hold at destination
THEN
The RT076 destination index should be set with FDA hold status and destination location information
Context: A cargo record exists with full release status where released quantity equals or exceeds total quantity
GIVEN
A cargo record exists with full release status where released quantity equals or exceeds total quantity
Applied to: Full Release Processing
WHEN
The cargo status is set to full release
THEN
The RT076 destination index should be cleared and destination tracking requirements should be removed
Context: A cargo record exists and arrival status is being processed with valid arrival date and destination location
GIVEN
A cargo record exists and arrival status is being processed with valid arrival date and destination location
Applied to: Arrival Status Processing
WHEN
The cargo status is set to arrival at destination
THEN
The RT076 destination index should be set with arrival date and destination location information
Context: A cargo record exists and export status is being applied
GIVEN
A cargo record exists and export status is being applied
Applied to: Export Status Processing
WHEN
The cargo status is set to export
THEN
The RT076 destination index should be cleared and domestic destination tracking should be removed
Context: A cargo record exists with cancelled arrival status and has previous bond date information available
GIVEN
A cargo record exists with cancelled arrival status and has previous bond date information available
Applied to: Arrival Cancellation
WHEN
The cargo arrival status is cancelled
THEN
The previous bond date should be restored and the RT076 destination index should be re-established with the restored bond date
Context: A cargo record exists with cancelled export status and has bond date information available
GIVEN
A cargo record exists with cancelled export status and has bond date information available
Applied to: Export Cancellation
WHEN
The cargo export status is cancelled
THEN
The RT076 destination index should be re-established with bond date information to resume domestic destination tracking
Context: A cargo record requires bond date processing with valid calendar date information
GIVEN
A cargo record requires bond date processing with valid calendar date information
Applied to: Calculate Julian Date for Bond Start
WHEN
Bond date calculation is initiated for cargo processing
THEN
The system should convert the calendar date to Julian date format for bond tracking and cargo age calculation purposes
Context: A cargo record has undergone status changes that affect destination tracking requirements
GIVEN
A cargo record has undergone status changes that affect destination tracking requirements
Applied to: Update RT076 Destination Index
WHEN
Destination index updates are processed
THEN
The RT076 destination index record should be updated with current status, dates, and location information reflecting the cargo's destination tracking requirements
R-GCX016-cbl-01096 (+10) File: GCX016.cbl Cargo Record Updates Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Record Updates':
  • Context - status array has been updated with new cargo status information:
    For Move S09A Array Data to Database Segments:
    When the system prepares to update cargo records in the database, then the status array data is moved to the appropriate database segment structure.
  • Context - cargo status has been determined and validated:
    For Update Cargo Root Record Fields:
    When the system updates the cargo root record, then core cargo fields including status description, processing timestamps, and control information are updated.
  • Context - disposition codes have been processed and status flags determined:
    For Update Status Information:
    When the system updates cargo status information, then current status codes, hold flags, release flags, and processing indicators are applied to the cargo record.
  • Context - quantity changes have been calculated from disposition code processing:
    For Update Quantity Information:
    When the system updates cargo quantity information, then total quantities, released quantities, piece counts, and quantity-related flags are updated in the cargo record.
  • Context - cargo status has been determined as held, released, or partially released:
    For Update Hold/Release Flags:
    When the system updates hold and release flags, then hold flags, release flags, border hold indicators, destination hold indicators, and partial release flags are set correctly.
  • Context - arrival or export events have been processed for the cargo:
    For Update Arrival/Export Status:
    When the system updates arrival and export status, then arrival flags, export flags, arrival dates, export dates, and location-specific indicators are updated.
  • Context - bond processing has been completed and bond information validated:
    For Update Bond Information:
    When the system updates bond information in the cargo record, then bond numbers, entry numbers, in-bond control numbers, and bond-related flags are updated.
  • Context - all cargo record fields have been updated with current processing results:
    For Replace Cargo Record in Database:
    When the system executes the database replacement operation, then the cargo record is successfully replaced in the database with all updated information.
  • Context - a database update operation has been attempted:
    For Database Update Successful?:
    When the system checks the update operation result, then if the update was successful, processing continues; if the update failed, error handling is initiated.
  • Context - a cargo record has been successfully updated in the database:
    For Log Successful Update:
    When the system logs the successful update, then update confirmation information including cargo identifier, timestamp, and processing details are recorded.
  • Context - a database update operation has failed:
    For Handle Database Error:
    When the system handles the database error, then error information is logged, appropriate error messages are generated, and error recovery procedures are initiated.
👨‍💻 Technical ACs (Gherkin)
Context: Status array has been updated with new cargo status information
GIVEN
Status array has been updated with new cargo status information
Applied to: Move S09A Array Data to Database Segments
WHEN
The system prepares to update cargo records in the database
THEN
The status array data is moved to the appropriate database segment structure
Context: Cargo status has been determined and validated
GIVEN
Cargo status has been determined and validated
Applied to: Update Cargo Root Record Fields
WHEN
The system updates the cargo root record
THEN
Core cargo fields including status description, processing timestamps, and control information are updated
Context: Disposition codes have been processed and status flags determined
GIVEN
Disposition codes have been processed and status flags determined
Applied to: Update Status Information
WHEN
The system updates cargo status information
THEN
Current status codes, hold flags, release flags, and processing indicators are applied to the cargo record
Context: Quantity changes have been calculated from disposition code processing
GIVEN
Quantity changes have been calculated from disposition code processing
Applied to: Update Quantity Information
WHEN
The system updates cargo quantity information
THEN
Total quantities, released quantities, piece counts, and quantity-related flags are updated in the cargo record
Context: Cargo status has been determined as held, released, or partially released
GIVEN
Cargo status has been determined as held, released, or partially released
Applied to: Update Hold/Release Flags
WHEN
The system updates hold and release flags
THEN
Hold flags, release flags, border hold indicators, destination hold indicators, and partial release flags are set correctly
Context: Arrival or export events have been processed for the cargo
GIVEN
Arrival or export events have been processed for the cargo
Applied to: Update Arrival/Export Status
WHEN
The system updates arrival and export status
THEN
Arrival flags, export flags, arrival dates, export dates, and location-specific indicators are updated
Context: Bond processing has been completed and bond information validated
GIVEN
Bond processing has been completed and bond information validated
Applied to: Update Bond Information
WHEN
The system updates bond information in the cargo record
THEN
Bond numbers, entry numbers, in-bond control numbers, and bond-related flags are updated
Context: All cargo record fields have been updated with current processing results
GIVEN
All cargo record fields have been updated with current processing results
Applied to: Replace Cargo Record in Database
WHEN
The system executes the database replacement operation
THEN
The cargo record is successfully replaced in the database with all updated information
Context: A database update operation has been attempted
GIVEN
A database update operation has been attempted
Applied to: Database Update Successful?
WHEN
The system checks the update operation result
THEN
If the update was successful, processing continues; if the update failed, error handling is initiated
Context: A cargo record has been successfully updated in the database
GIVEN
A cargo record has been successfully updated in the database
Applied to: Log Successful Update
WHEN
The system logs the successful update
THEN
Update confirmation information including cargo identifier, timestamp, and processing details are recorded
Context: A database update operation has failed
GIVEN
A database update operation has failed
Applied to: Handle Database Error
WHEN
The system handles the database error
THEN
Error information is logged, appropriate error messages are generated, and error recovery procedures are initiated
R-GCX016-cbl-01107 (+14) File: GCX016.cbl Integration Service Calls Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Integration Service Calls':
  • Context - an integration service call is required for cargo equipment:
    For Container Type Valid?:
    When the system checks the equipment type for integration eligibility, then only valid container types (containers, trailers, etc.) are allowed to proceed with integration processing, while invalid types are skipped.
  • Context - a container type has been determined as valid for integration:
    For Validate Equipment Type:
    When the system validates the specific equipment type details, then the equipment type is confirmed as eligible for hold/release notifications and status changes.
  • Context - valid equipment type has been confirmed for integration:
    For Map Internal Status to Integration Format:
    When the system maps internal cargo status to integration service format, then internal status codes are translated to appropriate gcciis-compatible status values.
  • Context - cargo status has been mapped to integration format:
    For Hold Notification Required?:
    When the system evaluates if hold notification is required, then hold notification is required when cargo has hold status conditions that need to be communicated to external systems.
  • Context - hold notification has been determined as required:
    For Prepare Hold Notification Data:
    When the system prepares hold notification data, then all required hold information including cargo details, hold reasons, and status descriptions are formatted for gcciis transmission.
  • Context - hold notification data has been prepared:
    For Call GCCIIS for Hold:
    When the system calls gcciis for hold notification, then the hold notification is transmitted to gcciis with all required cargo hold information.
  • Context - hold notification processing has been completed or skipped:
    For Release Notification Required?:
    When the system evaluates if release notification is required, then release notification is required when cargo has release status conditions that need to be communicated to external systems.
  • Context - release notification has been determined as required:
    For Prepare Release Notification Data:
    When the system prepares release notification data, then all required release information including cargo details, release quantities, and status descriptions are formatted for gcciis transmission.
  • Context - release notification data has been prepared:
    For Call GCCIIS for Release:
    When the system calls gcciis for release notification, then the release notification is transmitted to gcciis with all required cargo release information.
  • Context - release notification processing has been completed or skipped:
    For Status Change Required?:
    When the system evaluates if status change notification is required, then status change notification is required when cargo status has changed and needs to be synchronized with external systems.
  • Context - status change notification has been determined as required:
    For Prepare Status Change Data:
    When the system prepares status change data, then all required status change information including cargo details, new status, and change reasons are formatted for gcciis transmission.
  • Context - status change data has been prepared:
    For Call GCCIIS for Status Update:
    When the system calls gcciis for status update, then the status change notification is transmitted to gcciis with all required cargo status information.
  • Context - gcciis integration calls have been completed:
    For Log Integration Call Results:
    When the system logs integration call results, then all integration service call results including success/failure status and response details are recorded for audit trail.
  • Context - all required integration calls have been made and results logged:
    For Integration Complete:
    When the system completes integration processing, then integration service processing is marked as complete and control returns to the calling process.
  • Context - container type validation has failed:
    For Skip Integration - Invalid Container:
    When the system determines container type is invalid for integration, then all gcciis integration processing is skipped and control proceeds to completion.
👨‍💻 Technical ACs (Gherkin)
Context: An integration service call is required for cargo equipment
GIVEN
An integration service call is required for cargo equipment
Applied to: Container Type Valid?
WHEN
The system checks the equipment type for integration eligibility
THEN
Only valid container types (containers, trailers, etc.) are allowed to proceed with integration processing, while invalid types are skipped
Context: A container type has been determined as valid for integration
GIVEN
A container type has been determined as valid for integration
Applied to: Validate Equipment Type
WHEN
The system validates the specific equipment type details
THEN
The equipment type is confirmed as eligible for hold/release notifications and status changes
Context: Valid equipment type has been confirmed for integration
GIVEN
Valid equipment type has been confirmed for integration
Applied to: Map Internal Status to Integration Format
WHEN
The system maps internal cargo status to integration service format
THEN
Internal status codes are translated to appropriate GCCIIS-compatible status values
Context: Cargo status has been mapped to integration format
GIVEN
Cargo status has been mapped to integration format
Applied to: Hold Notification Required?
WHEN
The system evaluates if hold notification is required
THEN
Hold notification is required when cargo has hold status conditions that need to be communicated to external systems
Context: Hold notification has been determined as required
GIVEN
Hold notification has been determined as required
Applied to: Prepare Hold Notification Data
WHEN
The system prepares hold notification data
THEN
All required hold information including cargo details, hold reasons, and status descriptions are formatted for GCCIIS transmission
Context: Hold notification data has been prepared
GIVEN
Hold notification data has been prepared
Applied to: Call GCCIIS for Hold
WHEN
The system calls GCCIIS for hold notification
THEN
The hold notification is transmitted to GCCIIS with all required cargo hold information
Context: Hold notification processing has been completed or skipped
GIVEN
Hold notification processing has been completed or skipped
Applied to: Release Notification Required?
WHEN
The system evaluates if release notification is required
THEN
Release notification is required when cargo has release status conditions that need to be communicated to external systems
Context: Release notification has been determined as required
GIVEN
Release notification has been determined as required
Applied to: Prepare Release Notification Data
WHEN
The system prepares release notification data
THEN
All required release information including cargo details, release quantities, and status descriptions are formatted for GCCIIS transmission
Context: Release notification data has been prepared
GIVEN
Release notification data has been prepared
Applied to: Call GCCIIS for Release
WHEN
The system calls GCCIIS for release notification
THEN
The release notification is transmitted to GCCIIS with all required cargo release information
Context: Release notification processing has been completed or skipped
GIVEN
Release notification processing has been completed or skipped
Applied to: Status Change Required?
WHEN
The system evaluates if status change notification is required
THEN
Status change notification is required when cargo status has changed and needs to be synchronized with external systems
Context: Status change notification has been determined as required
GIVEN
Status change notification has been determined as required
Applied to: Prepare Status Change Data
WHEN
The system prepares status change data
THEN
All required status change information including cargo details, new status, and change reasons are formatted for GCCIIS transmission
Context: Status change data has been prepared
GIVEN
Status change data has been prepared
Applied to: Call GCCIIS for Status Update
WHEN
The system calls GCCIIS for status update
THEN
The status change notification is transmitted to GCCIIS with all required cargo status information
Context: GCCIIS integration calls have been completed
GIVEN
GCCIIS integration calls have been completed
Applied to: Log Integration Call Results
WHEN
The system logs integration call results
THEN
All integration service call results including success/failure status and response details are recorded for audit trail
Context: All required integration calls have been made and results logged
GIVEN
All required integration calls have been made and results logged
Applied to: Integration Complete
WHEN
The system completes integration processing
THEN
Integration service processing is marked as complete and control returns to the calling process
Context: Container type validation has failed
GIVEN
Container type validation has failed
Applied to: Skip Integration - Invalid Container
WHEN
The system determines container type is invalid for integration
THEN
All GCCIIS integration processing is skipped and control proceeds to completion
R-GCX016-cbl-01146 (+19) File: GCX016.cbl Release Validation Merged 20 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Validation':
  • Context - a cargo record exists with status information:
    For Manual Release Flag Set?:
    When the system checks for manual release flag in cargo status, then the system identifies if manual release conditions apply and proceeds to validate manual release requirements.
  • Context - cargo has manual release flag set:
    For Validate Manual Release Conditions:
    When the system validates manual release conditions including broker authorization and cargo status, then the system confirms manual release is valid and clears destination index for further processing.
  • Context - a cargo record with current status information:
    For Cargo Currently Held?:
    When the system examines cargo status for hold conditions including border holds, destination holds, fda holds, or seizure status, then the system identifies if cargo is held and determines the type and location of hold.
  • Context - cargo is currently held:
    For Check Hold Location - Border vs Destination:
    When the system checks hold location information in cargo status, then the system identifies whether cargo is held at border, destination, or both locations and validates release authority for that location.
  • Context - cargo is held at a specific location with a particular hold type:
    For Hold Status Valid for Release?:
    When the system validates if the disposition code has authority to release the specific hold type at the specific location, then the system confirms hold can be released or rejects release attempt if disposition code lacks authority.
  • Context - a release request with specified quantities:
    For Validate Release Quantities:
    When the system compares requested release quantity against total cargo quantity and existing released quantity, then the system validates that total released quantity does not exceed total cargo quantity and prevents negative quantities.
  • Context - cargo with existing released quantities and a new release request:
    For Released Quantity <= Total Quantity?:
    When the system calculates total released quantity including the new release amount, then the system confirms total released quantity is less than or equal to total cargo quantity, or rejects the release if it would exceed total.
  • Context - cargo with ptt (proceed to transfer) status:
    For Check PTT Status:
    When the system checks ptt permit validity and associated conditions, then the system validates ptt permit is current and allows for the requested release action.
  • Context - cargo with ptt status and associated permit information:
    For PTT Permit Valid?:
    When the system validates ptt permit dates, conditions, and authorization, then the system confirms ptt permit is valid for current release request or rejects if permit is expired or invalid.
  • Context - a disposition code that requires counterpart code removal:
    For Validate Counterpart Codes Removed:
    When the system processes the disposition code and checks for existing counterpart codes in cargo status, then the system removes all applicable counterpart codes before applying the new disposition code.
  • Context - disposition code processing that requires counterpart code removal:
    For All Counterpart Codes Cleared?:
    When the system completes counterpart code removal process, then the system confirms all applicable counterpart codes have been cleared from cargo status array.
  • Context - cargo that may be subject to fda regulations:
    For Check FDA Hold Status:
    When the system checks for fda hold status in cargo disposition codes, then the system identifies if cargo is under fda hold and determines if release is permitted.
  • Context - cargo with fda hold status:
    For FDA Hold Prevents Release?:
    When the system evaluates if fda hold conditions prevent release, then the system blocks release if fda hold is active or allows release if fda clearance is obtained.
  • Context - cargo requiring bond validation for release:
    For Validate Bond Information:
    When the system checks bond number, bond type, and bond status information, then the system validates bond information is complete and bond is active for cargo movement.
  • Context - cargo with validated bond information:
    For Bond Status Allows Release?:
    When the system checks if bond status and type allow for the requested release action, then the system authorizes release if bond permits the action or rejects if bond restrictions apply.
  • Context - cargo and associated transportation equipment:
    For Check Seizure Status:
    When the system checks for seizure status on cargo or equipment, then the system identifies if seizure conditions exist that would prevent release.
  • Context - cargo with potential equipment seizure status:
    For Equipment Seized?:
    When the system evaluates if seizure status prevents cargo release, then the system blocks release if equipment is seized or allows release if seizure is cleared.
  • Context - cargo that has passed all release validation checks:
    For Release Validation Passed:
    When all validation criteria including quantities, holds, permits, bonds, and seizure status are satisfied, then the system confirms release validation is successful and cargo is eligible for release processing.
  • Context - cargo that fails one or more release validation checks:
    For Release Validation Failed:
    When validation criteria for quantities, holds, permits, bonds, or seizure status are not satisfied, then the system rejects the release request and maintains current cargo status.
  • Context - completed release validation process with success or failure outcome:
    For Log Validation Results:
    When the system completes all validation checks, then the system logs validation results including specific reasons for success or failure and updates cargo processing history.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with status information
GIVEN
A cargo record exists with status information
Applied to: Manual Release Flag Set?
WHEN
The system checks for manual release flag in cargo status
THEN
The system identifies if manual release conditions apply and proceeds to validate manual release requirements
Context: Cargo has manual release flag set
GIVEN
Cargo has manual release flag set
Applied to: Validate Manual Release Conditions
WHEN
The system validates manual release conditions including broker authorization and cargo status
THEN
The system confirms manual release is valid and clears destination index for further processing
Context: A cargo record with current status information
GIVEN
A cargo record with current status information
Applied to: Cargo Currently Held?
WHEN
The system examines cargo status for hold conditions including border holds, destination holds, FDA holds, or seizure status
THEN
The system identifies if cargo is held and determines the type and location of hold
Context: Cargo is currently held
GIVEN
Cargo is currently held
Applied to: Check Hold Location - Border vs Destination
WHEN
The system checks hold location information in cargo status
THEN
The system identifies whether cargo is held at border, destination, or both locations and validates release authority for that location
Context: Cargo is held at a specific location with a particular hold type
GIVEN
Cargo is held at a specific location with a particular hold type
Applied to: Hold Status Valid for Release?
WHEN
The system validates if the disposition code has authority to release the specific hold type at the specific location
THEN
The system confirms hold can be released or rejects release attempt if disposition code lacks authority
Context: A release request with specified quantities
GIVEN
A release request with specified quantities
Applied to: Validate Release Quantities
WHEN
The system compares requested release quantity against total cargo quantity and existing released quantity
THEN
The system validates that total released quantity does not exceed total cargo quantity and prevents negative quantities
Context: Cargo with existing released quantities and a new release request
GIVEN
Cargo with existing released quantities and a new release request
Applied to: Released Quantity <= Total Quantity?
WHEN
The system calculates total released quantity including the new release amount
THEN
The system confirms total released quantity is less than or equal to total cargo quantity, or rejects the release if it would exceed total
Context: Cargo with PTT (Proceed to Transfer) status
GIVEN
Cargo with PTT (Proceed to Transfer) status
Applied to: Check PTT Status
WHEN
The system checks PTT permit validity and associated conditions
THEN
The system validates PTT permit is current and allows for the requested release action
Context: Cargo with PTT status and associated permit information
GIVEN
Cargo with PTT status and associated permit information
Applied to: PTT Permit Valid?
WHEN
The system validates PTT permit dates, conditions, and authorization
THEN
The system confirms PTT permit is valid for current release request or rejects if permit is expired or invalid
Context: A disposition code that requires counterpart code removal
GIVEN
A disposition code that requires counterpart code removal
Applied to: Validate Counterpart Codes Removed
WHEN
The system processes the disposition code and checks for existing counterpart codes in cargo status
THEN
The system removes all applicable counterpart codes before applying the new disposition code
Context: Disposition code processing that requires counterpart code removal
GIVEN
Disposition code processing that requires counterpart code removal
Applied to: All Counterpart Codes Cleared?
WHEN
The system completes counterpart code removal process
THEN
The system confirms all applicable counterpart codes have been cleared from cargo status array
Context: Cargo that may be subject to FDA regulations
GIVEN
Cargo that may be subject to FDA regulations
Applied to: Check FDA Hold Status
WHEN
The system checks for FDA hold status in cargo disposition codes
THEN
The system identifies if cargo is under FDA hold and determines if release is permitted
Context: Cargo with FDA hold status
GIVEN
Cargo with FDA hold status
Applied to: FDA Hold Prevents Release?
WHEN
The system evaluates if FDA hold conditions prevent release
THEN
The system blocks release if FDA hold is active or allows release if FDA clearance is obtained
Context: Cargo requiring bond validation for release
GIVEN
Cargo requiring bond validation for release
Applied to: Validate Bond Information
WHEN
The system checks bond number, bond type, and bond status information
THEN
The system validates bond information is complete and bond is active for cargo movement
Context: Cargo with validated bond information
GIVEN
Cargo with validated bond information
Applied to: Bond Status Allows Release?
WHEN
The system checks if bond status and type allow for the requested release action
THEN
The system authorizes release if bond permits the action or rejects if bond restrictions apply
Context: Cargo and associated transportation equipment
GIVEN
Cargo and associated transportation equipment
Applied to: Check Seizure Status
WHEN
The system checks for seizure status on cargo or equipment
THEN
The system identifies if seizure conditions exist that would prevent release
Context: Cargo with potential equipment seizure status
GIVEN
Cargo with potential equipment seizure status
Applied to: Equipment Seized?
WHEN
The system evaluates if seizure status prevents cargo release
THEN
The system blocks release if equipment is seized or allows release if seizure is cleared
Context: Cargo that has passed all release validation checks
GIVEN
Cargo that has passed all release validation checks
Applied to: Release Validation Passed
WHEN
All validation criteria including quantities, holds, permits, bonds, and seizure status are satisfied
THEN
The system confirms release validation is successful and cargo is eligible for release processing
Context: Cargo that fails one or more release validation checks
GIVEN
Cargo that fails one or more release validation checks
Applied to: Release Validation Failed
WHEN
Validation criteria for quantities, holds, permits, bonds, or seizure status are not satisfied
THEN
The system rejects the release request and maintains current cargo status
Context: Completed release validation process with success or failure outcome
GIVEN
Completed release validation process with success or failure outcome
Applied to: Log Validation Results
WHEN
The system completes all validation checks
THEN
The system logs validation results including specific reasons for success or failure and updates cargo processing history
R-GCX016-cbl-01166 (+13) File: GCX016.cbl Merlin Release Message Generation Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Release Message Generation':
  • Context - a merlin release message needs to be generated:
    For Check Message Type:
    When the system evaluates the message type for formatting, then the system selects either standard release format or broker bond message format based on the message classification.
  • Context - a release message is being formatted:
    For Include Cargo Information:
    When cargo information needs to be included in the message, then the system adds cargo status, identification numbers, and relevant cargo details to the message content.
  • Context - a release message contains cargo information:
    For Add Disposition Code Details:
    When disposition code details need to be added, then the system includes the disposition code, its description, and associated customs action details in the message.
  • Context - a release message contains disposition code details:
    For Add Quantity Information:
    When quantity information needs to be added, then the system includes total quantities, release quantities, and remaining quantities in the message.
  • Context - a release message has quantity information:
    For K1 Comments Available?:
    When the system checks for k1 comment segments, then if k1 comments are available, the system proceeds to include them; otherwise, it continues to quantity action formatting.
  • Context - k1 comment segments are available:
    For Include Up to 4 K1 Comment Segments:
    When the system includes k1 comments in the message, then the system adds up to 4 k1 comment segments to the release message content.
  • Context - the release message formatting is in progress:
    For Show Add/Subtract Operations?:
    When the system evaluates whether to show quantity operations, then if quantity changes need to be displayed, the system shows add/subtract operations; otherwise, it proceeds to format equipment information.
  • Context - quantity operations need to be displayed:
    For Display Quantity Changes:
    When the system formats quantity changes, then the system shows the specific add or subtract operations being performed on the release quantities.
  • Context - the release message requires equipment information:
    For Format Car ID and Waybill Info:
    When car id and waybill information is formatted, then the system includes formatted car identification numbers and waybill details in the message.
  • Context - the release message contains equipment information:
    For Add US-CCN Information:
    When us-ccn information needs to be added, then the system includes the us customs control number and related identification details in the message.
  • Context - the release message contains us-ccn information:
    For Include Processing Timestamps:
    When processing timestamps need to be included, then the system adds the date and time when the release processing was performed.
  • Context - the release message contains all required information:
    For Set Message Destination:
    When message destination needs to be set, then the system assigns the appropriate merlin destination based on message type and routing requirements.
  • Context - the release message has a destination assigned:
    For Prepare Final Message Format:
    When final message format is prepared, then the system formats the complete message according to merlin system requirements with all components properly structured.
  • Context - the final message format is prepared:
    For Send to Merlin System:
    When the message is sent to merlin system, then the system transmits the release message to the merlin system for processing and distribution to recipients.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin release message needs to be generated
GIVEN
A Merlin release message needs to be generated
Applied to: Check Message Type
WHEN
The system evaluates the message type for formatting
THEN
The system selects either standard release format or broker bond message format based on the message classification
Context: A release message is being formatted
GIVEN
A release message is being formatted
Applied to: Include Cargo Information
WHEN
Cargo information needs to be included in the message
THEN
The system adds cargo status, identification numbers, and relevant cargo details to the message content
Context: A release message contains cargo information
GIVEN
A release message contains cargo information
Applied to: Add Disposition Code Details
WHEN
Disposition code details need to be added
THEN
The system includes the disposition code, its description, and associated customs action details in the message
Context: A release message contains disposition code details
GIVEN
A release message contains disposition code details
Applied to: Add Quantity Information
WHEN
Quantity information needs to be added
THEN
The system includes total quantities, release quantities, and remaining quantities in the message
Context: A release message has quantity information
GIVEN
A release message has quantity information
Applied to: K1 Comments Available?
WHEN
The system checks for K1 comment segments
THEN
If K1 comments are available, the system proceeds to include them; otherwise, it continues to quantity action formatting
Context: K1 comment segments are available
GIVEN
K1 comment segments are available
Applied to: Include Up to 4 K1 Comment Segments
WHEN
The system includes K1 comments in the message
THEN
The system adds up to 4 K1 comment segments to the release message content
Context: The release message formatting is in progress
GIVEN
The release message formatting is in progress
Applied to: Show Add/Subtract Operations?
WHEN
The system evaluates whether to show quantity operations
THEN
If quantity changes need to be displayed, the system shows add/subtract operations; otherwise, it proceeds to format equipment information
Context: Quantity operations need to be displayed
GIVEN
Quantity operations need to be displayed
Applied to: Display Quantity Changes
WHEN
The system formats quantity changes
THEN
The system shows the specific add or subtract operations being performed on the release quantities
Context: The release message requires equipment information
GIVEN
The release message requires equipment information
Applied to: Format Car ID and Waybill Info
WHEN
Car ID and waybill information is formatted
THEN
The system includes formatted car identification numbers and waybill details in the message
Context: The release message contains equipment information
GIVEN
The release message contains equipment information
Applied to: Add US-CCN Information
WHEN
US-CCN information needs to be added
THEN
The system includes the US Customs Control Number and related identification details in the message
Context: The release message contains US-CCN information
GIVEN
The release message contains US-CCN information
Applied to: Include Processing Timestamps
WHEN
Processing timestamps need to be included
THEN
The system adds the date and time when the release processing was performed
Context: The release message contains all required information
GIVEN
The release message contains all required information
Applied to: Set Message Destination
WHEN
Message destination needs to be set
THEN
The system assigns the appropriate Merlin destination based on message type and routing requirements
Context: The release message has a destination assigned
GIVEN
The release message has a destination assigned
Applied to: Prepare Final Message Format
WHEN
Final message format is prepared
THEN
The system formats the complete message according to Merlin system requirements with all components properly structured
Context: The final message format is prepared
GIVEN
The final message format is prepared
Applied to: Send to Merlin System
WHEN
The message is sent to Merlin system
THEN
The system transmits the release message to the Merlin system for processing and distribution to recipients
R-GCX016-cbl-01180 (+15) File: GCX016.cbl Container Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Processing':
  • Context - an n7 equipment segment is available in the message queue:
    For Receive N7 Equipment Segment:
    When the system processes the n7 segment, then equipment data including container type, car initial, and car number are extracted and made available for processing.
  • Context - n7 segment data contains equipment type information:
    For Extract Container/Equipment Type:
    When the system extracts container type from the segment, then container type code is identified and stored for validation and processing.
  • Context - a container type code has been extracted from n7 segment:
    For Validate Container Type Against System Tables:
    When the system validates the container type against gcstbrt container type tables, then container type is confirmed as valid or invalid based on table lookup results.
  • Context - container type validation has been performed against system tables:
    For Container Type Valid?:
    When the validation result indicates container type status, then processing continues for valid container types or error handling is triggered for invalid types.
  • Context - container type is valid and equipment data is available from n7 segment:
    For Update Equipment Information in Cargo Record:
    When the system updates cargo record with equipment information, then cargo record contains updated car initial, car number, and equipment type information from the n7 segment.
  • Context - equipment information has been updated in cargo record:
    For Integration Service Required?:
    When the system evaluates integration service requirements based on cargo hold status and equipment type, then integration service call is required for held cargo with container or trailer equipment types, or skipped for ptt status cargo.
  • Context - integration service call is required for the container:
    For Prepare Container Data for Integration Call:
    When the system prepares data for gcciis integration, then container data including equipment type, status, and cargo information is formatted and ready for integration service call.
  • Context - container data is prepared for integration service:
    For Call GCCIIS Integration Service:
    When the system calls gcciis integration service, then equipment interface system is notified of container status changes and processes hold or release actions accordingly.
  • Context - container processing is in progress:
    For Export Container?:
    When the system evaluates export status based on cargo routing and destination information, then container is identified as export or domestic based on routing criteria and cargo status.
  • Context - container is identified as export container:
    For Route to USEXP Basket for Export Processing:
    When the system routes container for export processing, then container information is sent to usexp basket for export-specific processing and documentation.
  • Context - container type has been validated and processing is in progress:
    For Special Container Type?:
    When the system evaluates container type for special handling requirements, then container is classified as requiring special handling or standard processing based on type characteristics.
  • Context - container is identified as requiring special handling:
    For Apply Special Container Handling Rules:
    When the system applies special container handling rules, then container processing follows specialized rules appropriate for the specific container type characteristics.
  • Context - container processing including special handling (if required) has been completed:
    For Update Container Status in Cargo Record:
    When the system updates container status in cargo record, then cargo record reflects current container status including any status changes from processing activities.
  • Context - container status has been updated in cargo record:
    For Log Container Processing Information:
    When the system logs container processing information, then processing activities, status changes, and container information are recorded in system logs for audit and tracking purposes.
  • Context - container type validation has failed against system tables:
    For Generate Container Type Error Message:
    When the system generates container type error message, then error message is created indicating invalid container type and processing is directed to skip container processing.
  • Context - container type error has been generated or invalid container type detected:
    For Skip Container Processing:
    When the system skips container processing, then container processing is bypassed and system continues with next processing step without updating container information.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 equipment segment is available in the message queue
GIVEN
An N7 equipment segment is available in the message queue
Applied to: Receive N7 Equipment Segment
WHEN
The system processes the N7 segment
THEN
Equipment data including container type, car initial, and car number are extracted and made available for processing
Context: N7 segment data contains equipment type information
GIVEN
N7 segment data contains equipment type information
Applied to: Extract Container/Equipment Type
WHEN
The system extracts container type from the segment
THEN
Container type code is identified and stored for validation and processing
Context: A container type code has been extracted from N7 segment
GIVEN
A container type code has been extracted from N7 segment
Applied to: Validate Container Type Against System Tables
WHEN
The system validates the container type against GCSTBRT container type tables
THEN
Container type is confirmed as valid or invalid based on table lookup results
Context: Container type validation has been performed against system tables
GIVEN
Container type validation has been performed against system tables
Applied to: Container Type Valid?
WHEN
The validation result indicates container type status
THEN
Processing continues for valid container types or error handling is triggered for invalid types
Context: Container type is valid and equipment data is available from N7 segment
GIVEN
Container type is valid and equipment data is available from N7 segment
Applied to: Update Equipment Information in Cargo Record
WHEN
The system updates cargo record with equipment information
THEN
Cargo record contains updated car initial, car number, and equipment type information from the N7 segment
Context: Equipment information has been updated in cargo record
GIVEN
Equipment information has been updated in cargo record
Applied to: Integration Service Required?
WHEN
The system evaluates integration service requirements based on cargo hold status and equipment type
THEN
Integration service call is required for held cargo with container or trailer equipment types, or skipped for PTT status cargo
Context: Integration service call is required for the container
GIVEN
Integration service call is required for the container
Applied to: Prepare Container Data for Integration Call
WHEN
The system prepares data for GCCIIS integration
THEN
Container data including equipment type, status, and cargo information is formatted and ready for integration service call
Context: Container data is prepared for integration service
GIVEN
Container data is prepared for integration service
Applied to: Call GCCIIS Integration Service
WHEN
The system calls GCCIIS integration service
THEN
Equipment interface system is notified of container status changes and processes hold or release actions accordingly
Context: Container processing is in progress
GIVEN
Container processing is in progress
Applied to: Export Container?
WHEN
The system evaluates export status based on cargo routing and destination information
THEN
Container is identified as export or domestic based on routing criteria and cargo status
Context: Container is identified as export container
GIVEN
Container is identified as export container
Applied to: Route to USEXP Basket for Export Processing
WHEN
The system routes container for export processing
THEN
Container information is sent to USEXP basket for export-specific processing and documentation
Context: Container type has been validated and processing is in progress
GIVEN
Container type has been validated and processing is in progress
Applied to: Special Container Type?
WHEN
The system evaluates container type for special handling requirements
THEN
Container is classified as requiring special handling or standard processing based on type characteristics
Context: Container is identified as requiring special handling
GIVEN
Container is identified as requiring special handling
Applied to: Apply Special Container Handling Rules
WHEN
The system applies special container handling rules
THEN
Container processing follows specialized rules appropriate for the specific container type characteristics
Context: Container processing including special handling (if required) has been completed
GIVEN
Container processing including special handling (if required) has been completed
Applied to: Update Container Status in Cargo Record
WHEN
The system updates container status in cargo record
THEN
Cargo record reflects current container status including any status changes from processing activities
Context: Container status has been updated in cargo record
GIVEN
Container status has been updated in cargo record
Applied to: Log Container Processing Information
WHEN
The system logs container processing information
THEN
Processing activities, status changes, and container information are recorded in system logs for audit and tracking purposes
Context: Container type validation has failed against system tables
GIVEN
Container type validation has failed against system tables
Applied to: Generate Container Type Error Message
WHEN
The system generates container type error message
THEN
Error message is created indicating invalid container type and processing is directed to skip container processing
Context: Container type error has been generated or invalid container type detected
GIVEN
Container type error has been generated or invalid container type detected
Applied to: Skip Container Processing
WHEN
The system skips container processing
THEN
Container processing is bypassed and system continues with next processing step without updating container information
R-GCX016-cbl-01196 (+7) File: GCX016.cbl IM Tag Removal Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'IM Tag Removal':
  • Context - a cargo record exists in the system with current status information:
    For Check Cargo Release Status:
    When the system checks the cargo release status during release processing, then the system determines whether the cargo qualifies for im tag removal based on its release status.
  • Context - cargo has a release status and associated release quantities:
    For Verify Full Release Conditions:
    When the system verifies full release conditions, then the system confirms that released quantity equals or exceeds total quantity and no hold conditions exist.
  • Context - cargo has release quantity information and status array data:
    For Is Cargo Fully Released?:
    When the system evaluates if cargo is fully released, then if released quantity is greater than or equal to total quantity and no active holds exist, then cargo is considered fully released, otherwise it is partially released or held.
  • Context - cargo is confirmed as fully released:
    For IM Tags Present?:
    When the system checks for existing im inspection tags in the cargo status array, then if im tags are found in the status array, proceed with tag removal, otherwise skip im tag processing.
  • Context - cargo is fully released and im tags are present in the status array:
    For Remove IM Inspection Tags:
    When the system processes im tag removal, then all im inspection tags are removed from the cargo status array.
  • Context - im tags have been removed from the cargo status array:
    For Update Cargo Status Records:
    When the system updates cargo status records, then the cargo record is updated in the database with the modified status array and the cargo status description is updated to reflect the removal.
  • Context - im tags have been successfully removed from cargo:
    For Log IM Tag Removal:
    When the system logs the im tag removal activity, then a log entry is created documenting the im tag removal with cargo identifier, timestamp, and removal details.
  • Context - cargo is determined to be partially released, held, or not released:
    For Skip IM Tag Processing:
    When the system evaluates im tag processing requirements, then im tag processing is skipped and the system continues with standard release processing.
👨‍💻 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: Check Cargo Release Status
WHEN
The system checks the cargo release status during release processing
THEN
The system determines whether the cargo qualifies for IM tag removal based on its release status
Context: Cargo has a release status and associated release quantities
GIVEN
Cargo has a release status and associated release quantities
Applied to: Verify Full Release Conditions
WHEN
The system verifies full release conditions
THEN
The system confirms that released quantity equals or exceeds total quantity AND no hold conditions exist
Context: Cargo has release quantity information and status array data
GIVEN
Cargo has release quantity information and status array data
Applied to: Is Cargo Fully Released?
WHEN
The system evaluates if cargo is fully released
THEN
If released quantity is greater than or equal to total quantity AND no active holds exist, then cargo is considered fully released, otherwise it is partially released or held
Context: Cargo is confirmed as fully released
GIVEN
Cargo is confirmed as fully released
Applied to: IM Tags Present?
WHEN
The system checks for existing IM inspection tags in the cargo status array
THEN
If IM tags are found in the status array, proceed with tag removal, otherwise skip IM tag processing
Context: Cargo is fully released AND IM tags are present in the status array
GIVEN
Cargo is fully released AND IM tags are present in the status array
Applied to: Remove IM Inspection Tags
WHEN
The system processes IM tag removal
THEN
All IM inspection tags are removed from the cargo status array
Context: IM tags have been removed from the cargo status array
GIVEN
IM tags have been removed from the cargo status array
Applied to: Update Cargo Status Records
WHEN
The system updates cargo status records
THEN
The cargo record is updated in the database with the modified status array AND the cargo status description is updated to reflect the removal
Context: IM tags have been successfully removed from cargo
GIVEN
IM tags have been successfully removed from cargo
Applied to: Log IM Tag Removal
WHEN
The system logs the IM tag removal activity
THEN
A log entry is created documenting the IM tag removal with cargo identifier, timestamp, and removal details
Context: Cargo is determined to be partially released, held, or not released
GIVEN
Cargo is determined to be partially released, held, or not released
Applied to: Skip IM Tag Processing
WHEN
The system evaluates IM tag processing requirements
THEN
IM tag processing is skipped AND the system continues with standard release processing
R-GCX016-cbl-01204 (+11) File: GCX016.cbl Export Notification Generation Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Notification Generation':
  • Context - a cargo export status has been detected in cargo processing:
    For Export Operation Type?:
    When the system evaluates the export operation type, then the system identifies whether it is a standard export or export cancellation operation.
  • Context - the operation has been identified as a standard export:
    For Set Export Message Type:
    When the system sets the export message type, then the message type is configured for standard export processing.
  • Context - the operation has been identified as an export cancellation:
    For Set Export Cancellation Message Type:
    When the system sets the export cancellation message type, then the message type is configured for export cancellation processing.
  • Context - the export message type has been configured:
    For Call Z110-PREP-EMCSEND Message Preparation:
    When the system calls the message preparation service z110-prep-emcsend, then the export message is formatted and prepared for transmission.
  • Context - an export message has been prepared for transmission:
    For Container Type Validation:
    When the system validates the container type, then the system determines if the equipment type is a valid container for special routing.
  • Context - the container type validation has determined the equipment is a valid container:
    For Route to USEXP Baskets for Container Types:
    When the system routes the export message, then the message is routed to usexp baskets for container-specific processing.
  • Context - the export message routing has been determined:
    For Set Export Message Keywords:
    When the system sets export message keywords, then the message is tagged with appropriate keywords for export processing.
  • Context - export message keywords have been configured:
    For Format Export Subject Line:
    When the system formats the export subject line, then the subject line contains formatted cargo and export operation information.
  • Context - the export subject line has been formatted:
    For Valid Destination User?:
    When the system validates the destination user from message routing tables, then the system determines if the destination user is valid for receiving export notifications.
  • Context - the destination user validation has determined the user is invalid:
    For Route to Default USEXP User:
    When the system routes to the default usexp user, then the export message is assigned to the default usexp user for processing.
  • Context - a valid destination user has been determined (either original or default):
    For Send Export Notification Message:
    When the system sends the export notification message, then the export notification is transmitted to the designated user.
  • Context - the export notification message has been sent successfully:
    For Log Export Message Transaction:
    When the system logs the export message transaction, then the export message transaction is recorded in the system logs.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo export status has been detected in cargo processing
GIVEN
A cargo export status has been detected in cargo processing
Applied to: Export Operation Type?
WHEN
The system evaluates the export operation type
THEN
The system identifies whether it is a standard export or export cancellation operation
Context: The operation has been identified as a standard export
GIVEN
The operation has been identified as a standard export
Applied to: Set Export Message Type
WHEN
The system sets the export message type
THEN
The message type is configured for standard export processing
Context: The operation has been identified as an export cancellation
GIVEN
The operation has been identified as an export cancellation
Applied to: Set Export Cancellation Message Type
WHEN
The system sets the export cancellation message type
THEN
The message type is configured for export cancellation processing
Context: The export message type has been configured
GIVEN
The export message type has been configured
Applied to: Call Z110-PREP-EMCSEND Message Preparation
WHEN
The system calls the message preparation service Z110-PREP-EMCSEND
THEN
The export message is formatted and prepared for transmission
Context: An export message has been prepared for transmission
GIVEN
An export message has been prepared for transmission
Applied to: Container Type Validation
WHEN
The system validates the container type
THEN
The system determines if the equipment type is a valid container for special routing
Context: The container type validation has determined the equipment is a valid container
GIVEN
The container type validation has determined the equipment is a valid container
Applied to: Route to USEXP Baskets for Container Types
WHEN
The system routes the export message
THEN
The message is routed to USEXP baskets for container-specific processing
Context: The export message routing has been determined
GIVEN
The export message routing has been determined
Applied to: Set Export Message Keywords
WHEN
The system sets export message keywords
THEN
The message is tagged with appropriate keywords for export processing
Context: Export message keywords have been configured
GIVEN
Export message keywords have been configured
Applied to: Format Export Subject Line
WHEN
The system formats the export subject line
THEN
The subject line contains formatted cargo and export operation information
Context: The export subject line has been formatted
GIVEN
The export subject line has been formatted
Applied to: Valid Destination User?
WHEN
The system validates the destination user from message routing tables
THEN
The system determines if the destination user is valid for receiving export notifications
Context: The destination user validation has determined the user is invalid
GIVEN
The destination user validation has determined the user is invalid
Applied to: Route to Default USEXP User
WHEN
The system routes to the default USEXP user
THEN
The export message is assigned to the default USEXP user for processing
Context: A valid destination user has been determined (either original or default)
GIVEN
A valid destination user has been determined (either original or default)
Applied to: Send Export Notification Message
WHEN
The system sends the export notification message
THEN
The export notification is transmitted to the designated user
Context: The export notification message has been sent successfully
GIVEN
The export notification message has been sent successfully
Applied to: Log Export Message Transaction
WHEN
The system logs the export message transaction
THEN
The export message transaction is recorded in the system logs
R-GCX016-cbl-01216 (+20) File: GCX016.cbl Arrival Notification Generation Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Arrival Notification Generation':
  • Context - a train arrival event message is received from the message queue:
    For Train Arrival Event Received:
    When the system processes the v9 event segment, then the system identifies the event type and prepares for appropriate arrival or cancellation processing.
  • Context - a v9 segment with event code 'pod' is received:
    For POD - Train Arrived at Port:
    When the system evaluates the disposition code, then the system sets arrival processing flags and prepares port arrival notification.
  • Context - a v9 segment with event code 'aad' is received:
    For AAD - Train Arrived at Destination:
    When the system evaluates the disposition code, then the system sets arrival processing flags and prepares destination arrival notification.
  • Context - a v9 segment with event code 'coc' is received:
    For COC - Cancel Train Arrival:
    When the system evaluates the disposition code, then the system sets cancellation processing flags and prepares arrival cancellation notification.
  • Context - an arrival event (pod or aad) has been identified:
    For Set Arrival Message Type:
    When the system prepares message routing configuration, then the system sets arrival message type flag and configures routing parameters.
  • Context - a cancellation event (coc) has been identified:
    For Set Cancellation Message Type:
    When the system prepares message routing configuration, then the system sets cancellation message type flag and configures routing parameters.
  • Context - arrival message type has been set for pod or aad events:
    For Prepare USCS Arrival Message:
    When the system formats the notification message, then the system creates a properly formatted uscs arrival message with train and location details.
  • Context - cancellation message type has been set for coc events:
    For Prepare USCS Cancellation Message:
    When the system formats the notification message, then the system creates a properly formatted uscs cancellation message with train and location details.
  • Context - a uscs message has been prepared for arrival or cancellation:
    For Format Message Content:
    When the system formats the message content, then the system structures the message with proper headers, data fields, and formatting requirements.
  • Context - message content formatting is in progress:
    For Include Train Information:
    When the system adds train-specific information, then the system includes train id, vessel name, and current status in the message.
  • Context - train information has been included in the message:
    For Include Port/Destination Details:
    When the system adds location details, then the system includes appropriate port or destination information based on the event type (pod/aad).
  • Context - location details have been included in the message:
    For Include Timestamp Information:
    When the system adds temporal information, then the system includes event date, time, and timezone information in the notification message.
  • Context - a complete notification message has been formatted:
    For Message Routing Required?:
    When the system evaluates routing requirements, then the system determines if the message should be routed to uscs, brokers, or payer of freight based on message type and content.
  • Context - message routing evaluation determines uscs routing is required:
    For Route to USCS System:
    When the system initiates uscs routing, then the system sends the notification message to uscs system endpoints.
  • Context - message routing evaluation determines broker notification is required:
    For Route to Broker Notifications:
    When the system initiates broker routing, then the system sends the notification message to identified brokers via configured communication channels.
  • Context - message routing evaluation determines payer of freight notification is required:
    For Route to Payer of Freight:
    When the system initiates payer of freight routing, then the system sends the notification message to payer of freight contacts via configured communication channels.
  • Context - message routing has been configured for arrival notifications:
    For Send Arrival Notification:
    When the system transmits the arrival notification, then the system successfully sends arrival messages to uscs, brokers, and payer of freight as configured.
  • Context - message routing has been configured for cancellation notifications:
    For Send Cancellation Notification:
    When the system transmits the cancellation notification, then the system successfully sends cancellation messages to uscs, brokers, and payer of freight as configured.
  • Context - arrival or cancellation notifications have been transmitted:
    For Log Message Activity:
    When the system performs activity logging, then the system records message transmission details, recipients, timestamps, and status in audit logs.
  • Context - message activity has been logged successfully:
    For Update Train Status:
    When the system updates train status, then the system modifies train status to reflect current arrival state and processing completion.
  • Context - train status has been updated successfully:
    For Arrival Notification Complete:
    When the system finalizes arrival notification processing, then the system marks the arrival notification process as complete and returns to main message processing flow.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event message is received from the message queue
GIVEN
A train arrival event message is received from the message queue
Applied to: Train Arrival Event Received
WHEN
The system processes the V9 event segment
THEN
The system identifies the event type and prepares for appropriate arrival or cancellation processing
Context: A V9 segment with event code 'POD' is received
GIVEN
A V9 segment with event code 'POD' is received
Applied to: POD - Train Arrived at Port
WHEN
The system evaluates the disposition code
THEN
The system sets arrival processing flags and prepares port arrival notification
Context: A V9 segment with event code 'AAD' is received
GIVEN
A V9 segment with event code 'AAD' is received
Applied to: AAD - Train Arrived at Destination
WHEN
The system evaluates the disposition code
THEN
The system sets arrival processing flags and prepares destination arrival notification
Context: A V9 segment with event code 'COC' is received
GIVEN
A V9 segment with event code 'COC' is received
Applied to: COC - Cancel Train Arrival
WHEN
The system evaluates the disposition code
THEN
The system sets cancellation processing flags and prepares arrival cancellation notification
Context: An arrival event (POD or AAD) has been identified
GIVEN
An arrival event (POD or AAD) has been identified
Applied to: Set Arrival Message Type
WHEN
The system prepares message routing configuration
THEN
The system sets arrival message type flag and configures routing parameters
Context: A cancellation event (COC) has been identified
GIVEN
A cancellation event (COC) has been identified
Applied to: Set Cancellation Message Type
WHEN
The system prepares message routing configuration
THEN
The system sets cancellation message type flag and configures routing parameters
Context: Arrival message type has been set for POD or AAD events
GIVEN
Arrival message type has been set for POD or AAD events
Applied to: Prepare USCS Arrival Message
WHEN
The system formats the notification message
THEN
The system creates a properly formatted USCS arrival message with train and location details
Context: Cancellation message type has been set for COC events
GIVEN
Cancellation message type has been set for COC events
Applied to: Prepare USCS Cancellation Message
WHEN
The system formats the notification message
THEN
The system creates a properly formatted USCS cancellation message with train and location details
Context: A USCS message has been prepared for arrival or cancellation
GIVEN
A USCS message has been prepared for arrival or cancellation
Applied to: Format Message Content
WHEN
The system formats the message content
THEN
The system structures the message with proper headers, data fields, and formatting requirements
Context: Message content formatting is in progress
GIVEN
Message content formatting is in progress
Applied to: Include Train Information
WHEN
The system adds train-specific information
THEN
The system includes train ID, vessel name, and current status in the message
Context: Train information has been included in the message
GIVEN
Train information has been included in the message
Applied to: Include Port/Destination Details
WHEN
The system adds location details
THEN
The system includes appropriate port or destination information based on the event type (POD/AAD)
Context: Location details have been included in the message
GIVEN
Location details have been included in the message
Applied to: Include Timestamp Information
WHEN
The system adds temporal information
THEN
The system includes event date, time, and timezone information in the notification message
Context: A complete notification message has been formatted
GIVEN
A complete notification message has been formatted
Applied to: Message Routing Required?
WHEN
The system evaluates routing requirements
THEN
The system determines if the message should be routed to USCS, brokers, or payer of freight based on message type and content
Context: Message routing evaluation determines USCS routing is required
GIVEN
Message routing evaluation determines USCS routing is required
Applied to: Route to USCS System
WHEN
The system initiates USCS routing
THEN
The system sends the notification message to USCS system endpoints
Context: Message routing evaluation determines broker notification is required
GIVEN
Message routing evaluation determines broker notification is required
Applied to: Route to Broker Notifications
WHEN
The system initiates broker routing
THEN
The system sends the notification message to identified brokers via configured communication channels
Context: Message routing evaluation determines payer of freight notification is required
GIVEN
Message routing evaluation determines payer of freight notification is required
Applied to: Route to Payer of Freight
WHEN
The system initiates payer of freight routing
THEN
The system sends the notification message to payer of freight contacts via configured communication channels
Context: Message routing has been configured for arrival notifications
GIVEN
Message routing has been configured for arrival notifications
Applied to: Send Arrival Notification
WHEN
The system transmits the arrival notification
THEN
The system successfully sends arrival messages to USCS, brokers, and payer of freight as configured
Context: Message routing has been configured for cancellation notifications
GIVEN
Message routing has been configured for cancellation notifications
Applied to: Send Cancellation Notification
WHEN
The system transmits the cancellation notification
THEN
The system successfully sends cancellation messages to USCS, brokers, and payer of freight as configured
Context: Arrival or cancellation notifications have been transmitted
GIVEN
Arrival or cancellation notifications have been transmitted
Applied to: Log Message Activity
WHEN
The system performs activity logging
THEN
The system records message transmission details, recipients, timestamps, and status in audit logs
Context: Message activity has been logged successfully
GIVEN
Message activity has been logged successfully
Applied to: Update Train Status
WHEN
The system updates train status
THEN
The system modifies train status to reflect current arrival state and processing completion
Context: Train status has been updated successfully
GIVEN
Train status has been updated successfully
Applied to: Arrival Notification Complete
WHEN
The system finalizes arrival notification processing
THEN
The system marks the arrival notification process as complete and returns to main message processing flow
R-GCX016-cbl-01237 (+9) File: GCX016.cbl Payer of Freight Identification Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Payer of Freight Identification':
  • Context - a cargo record exists in the system:
    For Access Cargo Secondary Records:
    When the system needs to identify payer of freight information, then the system accesses the cargo secondary records (gcsa2rt) to search for payer information.
  • Context - cargo secondary records are accessible:
    For Search for N101 Segments:
    When the system searches for payer of freight information, then the system iterates through secondary records to find n101 segments containing payer codes.
  • Context - the system is searching cargo secondary records:
    For N101 Segment Found?:
    When no n101 segments are found in the secondary records, then the system returns with no payer found status.
  • Context - an n101 segment is found in cargo secondary records:
    For Extract Payer of Freight Code:
    When the system processes the n101 segment, then the system extracts the payer of freight code from the segment data.
  • Context - a payer of freight code has been extracted from n101 segment:
    For Check if Code Starts with 'PF=':
    When the payer code does not start with 'pf=', then the system treats it as a standard payer code.
  • Context - the payer code starts with 'pf=':
    For Extract Broker Code After 'PF=':
    When the system processes the pf-formatted code, then the system extracts the broker code portion after the 'pf=' prefix.
  • Context - a broker code has been extracted from the pf= formatted payer code:
    For Lookup Broker Short Name:
    When the system looks up the broker information, then the system searches the bk broker table and b1 broker detail table to retrieve the broker short name.
  • Context - the payer code does not start with 'pf=':
    For Use Standard Payer Code:
    When the system processes the payer code, then the system uses the code directly as the payer of freight identifier without broker lookup.
  • Context - payer of freight information has been identified through either broker lookup or standard processing:
    For Store Payer of Freight Information:
    When the system completes payer identification, then the system stores the payer of freight information in working storage for subsequent cargo processing.
  • Context - payer of freight identification process is complete:
    For Return Payer Information:
    When the system has either found payer information or determined no payer exists, then the system returns the payer information results with appropriate status indicators.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Access Cargo Secondary Records
WHEN
The system needs to identify payer of freight information
THEN
The system accesses the cargo secondary records (GCSA2RT) to search for payer information
Context: Cargo secondary records are accessible
GIVEN
Cargo secondary records are accessible
Applied to: Search for N101 Segments
WHEN
The system searches for payer of freight information
THEN
The system iterates through secondary records to find N101 segments containing payer codes
Context: The system is searching cargo secondary records
GIVEN
The system is searching cargo secondary records
Applied to: N101 Segment Found?
WHEN
No N101 segments are found in the secondary records
THEN
The system returns with no payer found status
Context: An N101 segment is found in cargo secondary records
GIVEN
An N101 segment is found in cargo secondary records
Applied to: Extract Payer of Freight Code
WHEN
The system processes the N101 segment
THEN
The system extracts the payer of freight code from the segment data
Context: A payer of freight code has been extracted from N101 segment
GIVEN
A payer of freight code has been extracted from N101 segment
Applied to: Check if Code Starts with 'PF='
WHEN
The payer code does not start with 'PF='
THEN
The system treats it as a standard payer code
Context: The payer code starts with 'PF='
GIVEN
The payer code starts with 'PF='
Applied to: Extract Broker Code After 'PF='
WHEN
The system processes the PF-formatted code
THEN
The system extracts the broker code portion after the 'PF=' prefix
Context: A broker code has been extracted from the PF= formatted payer code
GIVEN
A broker code has been extracted from the PF= formatted payer code
Applied to: Lookup Broker Short Name
WHEN
The system looks up the broker information
THEN
The system searches the BK broker table and B1 broker detail table to retrieve the broker short name
Context: The payer code does not start with 'PF='
GIVEN
The payer code does not start with 'PF='
Applied to: Use Standard Payer Code
WHEN
The system processes the payer code
THEN
The system uses the code directly as the payer of freight identifier without broker lookup
Context: Payer of freight information has been identified through either broker lookup or standard processing
GIVEN
Payer of freight information has been identified through either broker lookup or standard processing
Applied to: Store Payer of Freight Information
WHEN
The system completes payer identification
THEN
The system stores the payer of freight information in working storage for subsequent cargo processing
Context: Payer of freight identification process is complete
GIVEN
Payer of freight identification process is complete
Applied to: Return Payer Information
WHEN
The system has either found payer information or determined no payer exists
THEN
The system returns the payer information results with appropriate status indicators
R-GCX016-cbl-01247 (+6) File: GCX016.cbl Broker Name Resolution Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Name Resolution':
  • Context - an entity code is provided for broker name resolution:
    For Is Entity a Payer of Freight?:
    When the system evaluates the entity type, then the system identifies whether the entity is classified as a payer of freight entity.
  • Context - an entity has been identified as a payer of freight:
    For Add PF= Prefix to Entity Code:
    When the system prepares the entity code for broker lookup, then the system adds 'pf=' prefix to the entity code to create the lookup key.
  • Context - a formatted entity code (with or without pf= prefix) is available:
    For Lookup Broker Information in BK Table:
    When the system searches for broker information in the bk table, then the system attempts to locate matching broker record in gcstbrt bk table.
  • Context - a broker lookup has been performed in the bk table:
    For Broker Found in BK Table?:
    When the system evaluates the lookup results, then the system determines if a valid broker record was found or not found.
  • Context - a valid broker record has been found in the bk table:
    For Retrieve Broker Short Name:
    When the system processes the broker information, then the system retrieves and returns the broker short name from the broker record.
  • Context - either no broker record was found in the bk table or the entity is not a payer of freight:
    For Use Default Name if Not Found:
    When the system needs to provide a broker name, then the system uses a default name value for the broker name.
  • Context - either a broker short name has been retrieved from the bk table or a default name has been assigned:
    For Return Broker Short Name:
    When the broker name resolution process completes, then the system returns the final broker short name for use in subsequent processing.
👨‍💻 Technical ACs (Gherkin)
Context: An entity code is provided for broker name resolution
GIVEN
An entity code is provided for broker name resolution
Applied to: Is Entity a Payer of Freight?
WHEN
The system evaluates the entity type
THEN
The system identifies whether the entity is classified as a payer of freight entity
Context: An entity has been identified as a payer of freight
GIVEN
An entity has been identified as a payer of freight
Applied to: Add PF= Prefix to Entity Code
WHEN
The system prepares the entity code for broker lookup
THEN
The system adds 'PF=' prefix to the entity code to create the lookup key
Context: A formatted entity code (with or without PF= prefix) is available
GIVEN
A formatted entity code (with or without PF= prefix) is available
Applied to: Lookup Broker Information in BK Table
WHEN
The system searches for broker information in the BK table
THEN
The system attempts to locate matching broker record in GCSTBRT BK table
Context: A broker lookup has been performed in the BK table
GIVEN
A broker lookup has been performed in the BK table
Applied to: Broker Found in BK Table?
WHEN
The system evaluates the lookup results
THEN
The system determines if a valid broker record was found or not found
Context: A valid broker record has been found in the BK table
GIVEN
A valid broker record has been found in the BK table
Applied to: Retrieve Broker Short Name
WHEN
The system processes the broker information
THEN
The system retrieves and returns the broker short name from the broker record
Context: Either no broker record was found in the BK table OR the entity is not a payer of freight
GIVEN
Either no broker record was found in the BK table OR the entity is not a payer of freight
Applied to: Use Default Name if Not Found
WHEN
The system needs to provide a broker name
THEN
The system uses a default name value for the broker name
Context: Either a broker short name has been retrieved from the BK table OR a default name has been assigned
GIVEN
Either a broker short name has been retrieved from the BK table OR a default name has been assigned
Applied to: Return Broker Short Name
WHEN
The broker name resolution process completes
THEN
The system returns the final broker short name for use in subsequent processing
R-GCX016-cbl-01254 (+20) File: GCX016.cbl New Cargo Record Creation Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'New Cargo Record 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 initialize a new cargo record structure and clear all data fields to default values.
  • Context - a new cargo record is being created:
    For Set Default CPRS/USCS Status:
    When the cargo record type is cprs, then set the cargo status to 'error' and status description to 'error'.
    For Set Default CPRS/USCS Status:
    When the cargo record type is not cprs, then set the cargo status to 'sent' and status description to 'sent'.
    For Set Default CPRS/USCS Status:
    When the current cargo status is blank or equals 'ack-r', then set the acknowledgment status to 'ack' or 'ack-r' as default.
    For Set Default Broker Information:
    When broker information needs to be initialized, then set default broker fields and clear broker-specific data elements.
    For Set SCAC Code:
    When scac code needs to be assigned, then set the scac code from the x4 segment to identify the transportation carrier.
  • Context - a new cargo record requires manifest information:
    For Build M10 Manifest Information:
    When m10 manifest data needs to be populated, then build the manifest structure with vessel name, voyage number, and transportation details from the x4 segment.
  • Context - a new cargo record has an entry type code:
    For Entry Type Code?:
    When the entry type code is evaluated, then route to master in-bond processing for codes 61, 62, 63, 69, border entry processing for code 00, or standard entry processing for other codes.
    For Master In-Bond Processing Types 61,62,63,69:
    When the entry type code is 61 (immediate transport), 62 (transport export), 63 (immediate export), or 69 (us-canada-us movement), then set the m1109 master in-bond flag and process according to the specific entry type requirements.
    For Border Entry Processing Type 00:
    When the entry type code is 00 (border processing), then clear bond information and process as border entry with default border processing rules.
    For Standard Entry Processing:
    When the entry type code is not 61, 62, 63, 69, or 00, then process using standard entry processing rules without special in-bond or border handling.
  • Context - a cargo record is being processed for master in-bond entry:
    For Map Transport Type Codes:
    When the entry type code needs to be mapped to transport type, then map code 61 to immediate transport, 62 to transport export, 63 to immediate export, and 69 to us-canada-us movement.
  • Context - a cargo record is being processed as border entry type 00:
    For Clear Bond Information for Border Entry:
    When bond information needs to be cleared, then clear all bond-related fields and set appropriate border processing flags.
  • Context - a new cargo record requires manifest data:
    For Set Manifest Data Fields:
    When manifest fields need to be populated, then set manifest data fields from x4 segment including arrival date, arrival time, and manifest reference numbers.
  • Context - a new cargo record requires transport type assignment:
    For Set Transport Type:
    When transport type needs to be set, then set the transport type code based on the transportation mode from the manifest information.
  • Context - a new cargo record requires country identification:
    For Set Country Code:
    When country code needs to be assigned, then set the appropriate country code from the manifest data to identify origin or destination country.
  • Context - a new cargo record requires conveyance information:
    For Set Vessel/Flight Information:
    When vessel or flight information needs to be set, then set vessel name, voyage number, or flight details from the m10 manifest segment.
  • Context - a new cargo record requires quantity data:
    For Set Quantity Information:
    When quantity information needs to be populated, then set total quantity, release quantity, and unit of measure from the x4 segment data.
  • Context - a new cargo record requires manifest type classification:
    For Set Manifest Type Code:
    When manifest type code needs to be assigned, then set the manifest type code based on the document type and transportation mode.
  • Context - a new cargo record requires status indication:
    For Set Condition Response Code:
    When condition response code needs to be set, then set appropriate condition response codes to reflect the current processing status and any special handling requirements.
  • Context - a new cargo record has been fully populated with required data:
    For Store New Cargo Record:
    When the record needs to be saved to the system, then store the cargo record in the database and confirm successful creation.
👨‍💻 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
Initialize a new cargo record structure and clear all data fields to default values
Context: A new cargo record is being created
GIVEN
A new cargo record is being created
Applied to: Set Default CPRS/USCS Status
WHEN
The cargo record type is CPRS
THEN
Set the cargo status to 'ERROR' and status description to 'ERROR'
Applied to: Set Default CPRS/USCS Status
WHEN
The cargo record type is not CPRS
THEN
Set the cargo status to 'SENT' and status description to 'SENT'
Applied to: Set Default CPRS/USCS Status
WHEN
The current cargo status is blank or equals 'ACK-R'
THEN
Set the acknowledgment status to 'ACK' or 'ACK-R' as default
Applied to: Set Default Broker Information
WHEN
Broker information needs to be initialized
THEN
Set default broker fields and clear broker-specific data elements
Applied to: Set SCAC Code
WHEN
SCAC code needs to be assigned
THEN
Set the SCAC code from the X4 segment to identify the transportation carrier
Context: A new cargo record requires manifest information
GIVEN
A new cargo record requires manifest information
Applied to: Build M10 Manifest Information
WHEN
M10 manifest data needs to be populated
THEN
Build the manifest structure with vessel name, voyage number, and transportation details from the X4 segment
Context: A new cargo record has an entry type code
GIVEN
A new cargo record has an entry type code
Applied to: Entry Type Code?
WHEN
The entry type code is evaluated
THEN
Route to master in-bond processing for codes 61, 62, 63, 69, border entry processing for code 00, or standard entry processing for other codes
Applied to: Master In-Bond Processing Types 61,62,63,69
WHEN
The entry type code is 61 (immediate transport), 62 (transport export), 63 (immediate export), or 69 (US-Canada-US movement)
THEN
Set the M1109 master in-bond flag and process according to the specific entry type requirements
Applied to: Border Entry Processing Type 00
WHEN
The entry type code is 00 (border processing)
THEN
Clear bond information and process as border entry with default border processing rules
Applied to: Standard Entry Processing
WHEN
The entry type code is not 61, 62, 63, 69, or 00
THEN
Process using standard entry processing rules without special in-bond or border handling
Context: A cargo record is being processed for master in-bond entry
GIVEN
A cargo record is being processed for master in-bond entry
Applied to: Map Transport Type Codes
WHEN
The entry type code needs to be mapped to transport type
THEN
Map code 61 to immediate transport, 62 to transport export, 63 to immediate export, and 69 to US-Canada-US movement
Context: A cargo record is being processed as border entry type 00
GIVEN
A cargo record is being processed as border entry type 00
Applied to: Clear Bond Information for Border Entry
WHEN
Bond information needs to be cleared
THEN
Clear all bond-related fields and set appropriate border processing flags
Context: A new cargo record requires manifest data
GIVEN
A new cargo record requires manifest data
Applied to: Set Manifest Data Fields
WHEN
Manifest fields need to be populated
THEN
Set manifest data fields from X4 segment including arrival date, arrival time, and manifest reference numbers
Context: A new cargo record requires transport type assignment
GIVEN
A new cargo record requires transport type assignment
Applied to: Set Transport Type
WHEN
Transport type needs to be set
THEN
Set the transport type code based on the transportation mode from the manifest information
Context: A new cargo record requires country identification
GIVEN
A new cargo record requires country identification
Applied to: Set Country Code
WHEN
Country code needs to be assigned
THEN
Set the appropriate country code from the manifest data to identify origin or destination country
Context: A new cargo record requires conveyance information
GIVEN
A new cargo record requires conveyance information
Applied to: Set Vessel/Flight Information
WHEN
Vessel or flight information needs to be set
THEN
Set vessel name, voyage number, or flight details from the M10 manifest segment
Context: A new cargo record requires quantity data
GIVEN
A new cargo record requires quantity data
Applied to: Set Quantity Information
WHEN
Quantity information needs to be populated
THEN
Set total quantity, release quantity, and unit of measure from the X4 segment data
Context: A new cargo record requires manifest type classification
GIVEN
A new cargo record requires manifest type classification
Applied to: Set Manifest Type Code
WHEN
Manifest type code needs to be assigned
THEN
Set the manifest type code based on the document type and transportation mode
Context: A new cargo record requires status indication
GIVEN
A new cargo record requires status indication
Applied to: Set Condition Response Code
WHEN
Condition response code needs to be set
THEN
Set appropriate condition response codes to reflect the current processing status and any special handling requirements
Context: A new cargo record has been fully populated with required data
GIVEN
A new cargo record has been fully populated with required data
Applied to: Store New Cargo Record
WHEN
The record needs to be saved to the system
THEN
Store the cargo record in the database and confirm successful creation
R-GCX016-cbl-01275 (+12) File: GCX016.cbl Manifest Data Integration Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Data Integration':
  • Context - an m10 manifest segment is received with carrier information in field m10-02:
    For Extract SCAC Code from M10-02:
    When the system processes the m10 segment for manifest data integration, then the scac code is extracted from m10-02 field and stored for carrier identification.
  • Context - an m10 manifest segment is received with transport type information in field m10-03:
    For Extract Transport Type from M10-03:
    When the system processes the m10 segment for manifest data integration, then the transport type is extracted from m10-03 field and stored for transportation mode identification.
  • Context - an m10 manifest segment is received with country information in field m10-04:
    For Extract Country Code from M10-04:
    When the system processes the m10 segment for manifest data integration, then the country code is extracted from m10-04 field and stored for origin country identification.
  • Context - an m10 manifest segment is received with vessel information in field m10-05:
    For Extract Vessel Name from M10-05:
    When the system processes the m10 segment for manifest data integration, then the vessel name is extracted from m10-05 field and stored for carrier vessel identification.
  • Context - an m10 manifest segment is received with flight/voyage information in field m10-06:
    For Extract Flight/Voyage Number from M10-06:
    When the system processes the m10 segment for manifest data integration, then the flight/voyage number is extracted from m10-06 field and stored for trip identification.
  • Context - an m10 manifest segment is received with quantity information in field m10-07:
    For Extract Quantity from M10-07:
    When the system processes the m10 segment for manifest data integration, then the quantity is extracted from m10-07 field and stored for cargo quantity tracking.
  • Context - an m10 manifest segment is received with manifest type information in field m10-08:
    For Extract Manifest Type Code from M10-08:
    When the system processes the m10 segment for manifest data integration, then the manifest type code is extracted from m10-08 field and stored for manifest classification.
  • Context - an m10 manifest segment is received with condition response information in field m10-09:
    For Extract Condition Response Code from M10-09:
    When the system processes the m10 segment for manifest data integration, then the condition response code is extracted from m10-09 field and stored for manifest condition tracking.
  • Context - a transport type code has been extracted from m10-03 field:
    For Is Transport Type Valid?:
    When the system validates the transport type against valid transportation modes, then the system determines if the transport type is valid for further processing.
  • Context - a transport type code has been validated as a recognized transportation mode:
    For Map Transport Type to Internal Code:
    When the system maps the transport type to internal coding standards, then the transport type is converted to the appropriate internal system code.
  • Context - a transport type code has been extracted but is not a recognized valid transportation mode:
    For Set Default Transport Type:
    When the system cannot map the transport type to internal coding standards, then the system assigns a default transport type code for processing.
  • Context - all m10 manifest data elements have been extracted and validated:
    For Build Manifest Information into Cargo Record:
    When the system builds the manifest information into cargo record structure, then all manifest data is consolidated into a complete cargo record with scac, transport type, country, vessel, voyage, quantity, manifest type, and condition codes.
  • Context - manifest information has been built into a structured cargo record format:
    For Update Cargo Record with M10 Data:
    When the system updates the cargo record with m10 manifest data, then the cargo record is updated with all manifest information including carrier, transport mode, origin, vessel details, quantities, and status codes.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 manifest segment is received with carrier information in field M10-02
GIVEN
An M10 manifest segment is received with carrier information in field M10-02
Applied to: Extract SCAC Code from M10-02
WHEN
The system processes the M10 segment for manifest data integration
THEN
The SCAC code is extracted from M10-02 field and stored for carrier identification
Context: An M10 manifest segment is received with transport type information in field M10-03
GIVEN
An M10 manifest segment is received with transport type information in field M10-03
Applied to: Extract Transport Type from M10-03
WHEN
The system processes the M10 segment for manifest data integration
THEN
The transport type is extracted from M10-03 field and stored for transportation mode identification
Context: An M10 manifest segment is received with country information in field M10-04
GIVEN
An M10 manifest segment is received with country information in field M10-04
Applied to: Extract Country Code from M10-04
WHEN
The system processes the M10 segment for manifest data integration
THEN
The country code is extracted from M10-04 field and stored for origin country identification
Context: An M10 manifest segment is received with vessel information in field M10-05
GIVEN
An M10 manifest segment is received with vessel information in field M10-05
Applied to: Extract Vessel Name from M10-05
WHEN
The system processes the M10 segment for manifest data integration
THEN
The vessel name is extracted from M10-05 field and stored for carrier vessel identification
Context: An M10 manifest segment is received with flight/voyage information in field M10-06
GIVEN
An M10 manifest segment is received with flight/voyage information in field M10-06
Applied to: Extract Flight/Voyage Number from M10-06
WHEN
The system processes the M10 segment for manifest data integration
THEN
The flight/voyage number is extracted from M10-06 field and stored for trip identification
Context: An M10 manifest segment is received with quantity information in field M10-07
GIVEN
An M10 manifest segment is received with quantity information in field M10-07
Applied to: Extract Quantity from M10-07
WHEN
The system processes the M10 segment for manifest data integration
THEN
The quantity is extracted from M10-07 field and stored for cargo quantity tracking
Context: An M10 manifest segment is received with manifest type information in field M10-08
GIVEN
An M10 manifest segment is received with manifest type information in field M10-08
Applied to: Extract Manifest Type Code from M10-08
WHEN
The system processes the M10 segment for manifest data integration
THEN
The manifest type code is extracted from M10-08 field and stored for manifest classification
Context: An M10 manifest segment is received with condition response information in field M10-09
GIVEN
An M10 manifest segment is received with condition response information in field M10-09
Applied to: Extract Condition Response Code from M10-09
WHEN
The system processes the M10 segment for manifest data integration
THEN
The condition response code is extracted from M10-09 field and stored for manifest condition tracking
Context: A transport type code has been extracted from M10-03 field
GIVEN
A transport type code has been extracted from M10-03 field
Applied to: Is Transport Type Valid?
WHEN
The system validates the transport type against valid transportation modes
THEN
The system determines if the transport type is valid for further processing
Context: A transport type code has been validated as a recognized transportation mode
GIVEN
A transport type code has been validated as a recognized transportation mode
Applied to: Map Transport Type to Internal Code
WHEN
The system maps the transport type to internal coding standards
THEN
The transport type is converted to the appropriate internal system code
Context: A transport type code has been extracted but is not a recognized valid transportation mode
GIVEN
A transport type code has been extracted but is not a recognized valid transportation mode
Applied to: Set Default Transport Type
WHEN
The system cannot map the transport type to internal coding standards
THEN
The system assigns a default transport type code for processing
Context: All M10 manifest data elements have been extracted and validated
GIVEN
All M10 manifest data elements have been extracted and validated
Applied to: Build Manifest Information into Cargo Record
WHEN
The system builds the manifest information into cargo record structure
THEN
All manifest data is consolidated into a complete cargo record with SCAC, transport type, country, vessel, voyage, quantity, manifest type, and condition codes
Context: Manifest information has been built into a structured cargo record format
GIVEN
Manifest information has been built into a structured cargo record format
Applied to: Update Cargo Record with M10 Data
WHEN
The system updates the cargo record with M10 manifest data
THEN
The cargo record is updated with all manifest information including carrier, transport mode, origin, vessel details, quantities, and status codes
R-GCX016-cbl-01288 (+12) File: GCX016.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 received:
    For Station Type?:
    When the system evaluates the station type, then the system routes to bonded-to station lookup for bonded stations or border crossing station lookup for border stations.
  • Context - a station lookup request is initiated:
    For Search SD Table:
    When the system searches the sd table using station identifier, then the system retrieves station directory information if found.
  • Context - the sd table has been searched for a station:
    For Station Found in SD?:
    When the system checks if the station was found in sd table, then if found, retrieve station name; if not found, search ds table.
  • Context - station was not found in sd table:
    For Search DS Table:
    When the system searches the ds table using station identifier, then the system retrieves destination station information if found.
  • Context - the ds table has been searched for a station:
    For Station Found in DS?:
    When the system checks if the station was found in ds table, then if found, retrieve station description; if not found, search ks table.
  • Context - station was not found in sd or ds tables:
    For Search KS Table:
    When the system searches the ks table using station identifier, then the system retrieves known station information if found.
  • Context - the ks table has been searched for a station:
    For Station Found in KS?:
    When the system checks if the station was found in ks table, then if found, retrieve location details; if not found, generate station not found error.
  • Context - station is found in sd table:
    For Retrieve Station Name:
    When the system retrieves station data, then the system extracts and stores the station name for formatting.
  • Context - station is found in ds table:
    For Retrieve Station Description:
    When the system retrieves station data, then the system extracts and stores the station description for formatting.
  • Context - station is found in ks table:
    For Retrieve Location Details:
    When the system retrieves station data, then the system extracts and stores the location details for formatting.
  • Context - station information has been retrieved from any of the station tables:
    For Format Station Information:
    When the system formats the station data, then the system creates a standardized station information structure with name, description, and location details.
  • Context - station information has been formatted:
    For Update Cargo Record with Station Data:
    When the system updates the cargo record, then the system stores the station data in the appropriate cargo record fields.
  • Context - station was not found in sd, ds, or ks tables:
    For Station Not Found Error:
    When the system completes all station table searches, then the system generates a station not found error and continues with lookup completion.
👨‍💻 Technical ACs (Gherkin)
Context: A station data lookup request is received
GIVEN
A station data lookup request is received
Applied to: Station Type?
WHEN
The system evaluates the station type
THEN
The system routes to bonded-to station lookup for bonded stations or border crossing station lookup for border stations
Context: A station lookup request is initiated
GIVEN
A station lookup request is initiated
Applied to: Search SD Table
WHEN
The system searches the SD table using station identifier
THEN
The system retrieves station directory information if found
Context: The SD table has been searched for a station
GIVEN
The SD table has been searched for a station
Applied to: Station Found in SD?
WHEN
The system checks if the station was found in SD table
THEN
If found, retrieve station name; if not found, search DS table
Context: Station was not found in SD table
GIVEN
Station was not found in SD table
Applied to: Search DS Table
WHEN
The system searches the DS table using station identifier
THEN
The system retrieves destination station information if found
Context: The DS table has been searched for a station
GIVEN
The DS table has been searched for a station
Applied to: Station Found in DS?
WHEN
The system checks if the station was found in DS table
THEN
If found, retrieve station description; if not found, search KS table
Context: Station was not found in SD or DS tables
GIVEN
Station was not found in SD or DS tables
Applied to: Search KS Table
WHEN
The system searches the KS table using station identifier
THEN
The system retrieves known station information if found
Context: The KS table has been searched for a station
GIVEN
The KS table has been searched for a station
Applied to: Station Found in KS?
WHEN
The system checks if the station was found in KS table
THEN
If found, retrieve location details; if not found, generate station not found error
Context: Station is found in SD table
GIVEN
Station is found in SD table
Applied to: Retrieve Station Name
WHEN
The system retrieves station data
THEN
The system extracts and stores the station name for formatting
Context: Station is found in DS table
GIVEN
Station is found in DS table
Applied to: Retrieve Station Description
WHEN
The system retrieves station data
THEN
The system extracts and stores the station description for formatting
Context: Station is found in KS table
GIVEN
Station is found in KS table
Applied to: Retrieve Location Details
WHEN
The system retrieves station data
THEN
The system extracts and stores the location details for formatting
Context: Station information has been retrieved from any of the station tables
GIVEN
Station information has been retrieved from any of the station tables
Applied to: Format Station Information
WHEN
The system formats the station data
THEN
The system creates a standardized station information structure with name, description, and location details
Context: Station information has been formatted
GIVEN
Station information has been formatted
Applied to: Update Cargo Record with Station Data
WHEN
The system updates the cargo record
THEN
The system stores the station data in the appropriate cargo record fields
Context: Station was not found in SD, DS, or KS tables
GIVEN
Station was not found in SD, DS, or KS tables
Applied to: Station Not Found Error
WHEN
The system completes all station table searches
THEN
The system generates a station not found error and continues with lookup completion
R-GCX016-cbl-01301 (+13) File: GCX016.cbl Destination Station Lookup Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Station Lookup':
  • Context - a cargo record is being processed for destination station lookup:
    For Location ID Available?:
    When the system checks for location id availability in the cargo record, then the system proceeds to extract location id if available, otherwise uses default/unknown station.
  • Context - a cargo record contains a valid location id:
    For Extract Location ID from Cargo Record:
    When the system extracts the location id from the cargo record, then the location id is available for station table lookup operations.
  • Context - a location id has been extracted from the cargo record:
    For Lookup Station in DS Table:
    When the system searches the ds table using the location id, then the system retrieves station information if found or proceeds to secondary lookup.
  • Context - a ds table lookup has been performed using the location id:
    For DS Table Entry Found?:
    When the system checks if a matching ds table entry was found, then the system extracts station information if found, otherwise performs ks table lookup.
  • Context - the ds table lookup did not find a matching station entry:
    For Lookup Station in KS Table:
    When the system searches the ks table using the location id, then the system retrieves station information if found or logs station not found warning.
  • Context - a ks table lookup has been performed using the location id:
    For KS Table Entry Found?:
    When the system checks if a matching ks table entry was found, then the system extracts station information if found, otherwise logs station not found warning.
  • Context - a station entry has been found in either ds or ks table:
    For Extract Station Name and Description:
    When the system extracts station name and description from the table entry, then the station information is available for mapping to the cargo record.
  • Context - station name and description have been extracted from the table lookup:
    For Map Location ID to Station Information:
    When the system maps the location id to the station information, then the location id is associated with the corresponding station details.
  • Context - location id has been mapped to station information:
    For Update Cargo Record with Station Details:
    When the system updates the cargo record with station details, then the cargo record contains the station name and description for the location id.
  • Context - the cargo record has been updated with station details:
    For KCSM Station Required?:
    When the system checks if kcsm station lookup is required, then the system performs kcsm station lookup if required, otherwise completes station lookup.
  • Context - kcsm station lookup is required for the cargo record:
    For Perform KCSM Station Lookup:
    When the system performs kcsm station lookup, then the system retrieves kcsm-specific station information for mapping.
  • Context - kcsm station lookup has been performed successfully:
    For Apply KCSM Station Mapping:
    When the system applies kcsm station mapping, then the cargo record is updated with kcsm-specific station information.
  • Context - both ds and ks table lookups have failed to find a matching station entry:
    For Log Station Not Found Warning:
    When the system logs a station not found warning, then a warning is recorded indicating the location id could not be resolved to station information.
  • Context - station lookup has failed or location id is not available:
    For Use Default/Unknown Station:
    When the system uses default/unknown station information, then the cargo record is assigned default station details to complete processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for destination station lookup
GIVEN
A cargo record is being processed for destination station lookup
Applied to: Location ID Available?
WHEN
The system checks for location ID availability in the cargo record
THEN
The system proceeds to extract location ID if available, otherwise uses default/unknown station
Context: A cargo record contains a valid location ID
GIVEN
A cargo record contains a valid location ID
Applied to: Extract Location ID from Cargo Record
WHEN
The system extracts the location ID from the cargo record
THEN
The location ID is available for station table lookup operations
Context: A location ID has been extracted from the cargo record
GIVEN
A location ID has been extracted from the cargo record
Applied to: Lookup Station in DS Table
WHEN
The system searches the DS table using the location ID
THEN
The system retrieves station information if found or proceeds to secondary lookup
Context: A DS table lookup has been performed using the location ID
GIVEN
A DS table lookup has been performed using the location ID
Applied to: DS Table Entry Found?
WHEN
The system checks if a matching DS table entry was found
THEN
The system extracts station information if found, otherwise performs KS table lookup
Context: The DS table lookup did not find a matching station entry
GIVEN
The DS table lookup did not find a matching station entry
Applied to: Lookup Station in KS Table
WHEN
The system searches the KS table using the location ID
THEN
The system retrieves station information if found or logs station not found warning
Context: A KS table lookup has been performed using the location ID
GIVEN
A KS table lookup has been performed using the location ID
Applied to: KS Table Entry Found?
WHEN
The system checks if a matching KS table entry was found
THEN
The system extracts station information if found, otherwise logs station not found warning
Context: A station entry has been found in either DS or KS table
GIVEN
A station entry has been found in either DS or KS table
Applied to: Extract Station Name and Description
WHEN
The system extracts station name and description from the table entry
THEN
The station information is available for mapping to the cargo record
Context: Station name and description have been extracted from the table lookup
GIVEN
Station name and description have been extracted from the table lookup
Applied to: Map Location ID to Station Information
WHEN
The system maps the location ID to the station information
THEN
The location ID is associated with the corresponding station details
Context: Location ID has been mapped to station information
GIVEN
Location ID has been mapped to station information
Applied to: Update Cargo Record with Station Details
WHEN
The system updates the cargo record with station details
THEN
The cargo record contains the station name and description for the location ID
Context: The cargo record has been updated with station details
GIVEN
The cargo record has been updated with station details
Applied to: KCSM Station Required?
WHEN
The system checks if KCSM station lookup is required
THEN
The system performs KCSM station lookup if required, otherwise completes station lookup
Context: KCSM station lookup is required for the cargo record
GIVEN
KCSM station lookup is required for the cargo record
Applied to: Perform KCSM Station Lookup
WHEN
The system performs KCSM station lookup
THEN
The system retrieves KCSM-specific station information for mapping
Context: KCSM station lookup has been performed successfully
GIVEN
KCSM station lookup has been performed successfully
Applied to: Apply KCSM Station Mapping
WHEN
The system applies KCSM station mapping
THEN
The cargo record is updated with KCSM-specific station information
Context: Both DS and KS table lookups have failed to find a matching station entry
GIVEN
Both DS and KS table lookups have failed to find a matching station entry
Applied to: Log Station Not Found Warning
WHEN
The system logs a station not found warning
THEN
A warning is recorded indicating the location ID could not be resolved to station information
Context: Station lookup has failed or location ID is not available
GIVEN
Station lookup has failed or location ID is not available
Applied to: Use Default/Unknown Station
WHEN
The system uses default/unknown station information
THEN
The cargo record is assigned default station details to complete processing
R-GCX016-cbl-01315 (+9) File: GCX016.cbl KCSM Station Lookup Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Station Lookup':
  • Context - a station lookup request is received:
    For Station Type Check:
    When the system evaluates the station type, then the system routes to either ds table for standard stations or ks table for kcsm stations.
  • Context - a standard station type is identified:
    For Access DS Table for Standard Stations:
    When the system accesses the ds table, then station code, name, and description are retrieved from ds table records.
  • Context - a kcsm station type is identified:
    For Access KS Table for KCSM Stations:
    When the system accesses the ks table, then station code, name, and description are retrieved from ks table records.
  • Context - station information has been retrieved:
    For KCSM Specific Mapping Required?:
    When the system evaluates if kcsm-specific mapping is required, then the system either applies kcsm mapping rules or proceeds to validation.
  • Context - kcsm-specific mapping is required:
    For Apply KCSM Station Mapping Rules:
    When the system applies kcsm station mapping rules, then station information is transformed according to kcsm business requirements.
  • Context - kcsm mapping rules have been applied:
    For Format Station Information for KCSM:
    When the system formats station information for kcsm, then station data is presented in kcsm-compliant format.
  • Context - station information has been retrieved and optionally formatted:
    For Validate Station Data:
    When the system validates station data, then station data is confirmed as complete and accurate or flagged as invalid.
  • Context - station data validation has been completed:
    For Station Found?:
    When the system checks if station was found, then the system either returns station information or handles station not found condition.
  • Context - station lookup has failed to find valid station:
    For Log Station Not Found Error:
    When the system logs station not found error, then error is recorded with station lookup details for troubleshooting.
  • Context - station not found error has been logged:
    For Use Default Station Information:
    When the system uses default station information, then default station values are provided to ensure processing continuity.
👨‍💻 Technical ACs (Gherkin)
Context: A station lookup request is received
GIVEN
A station lookup request is received
Applied to: Station Type Check
WHEN
The system evaluates the station type
THEN
The system routes to either DS table for standard stations or KS table for KCSM stations
Context: A standard station type is identified
GIVEN
A standard station type is identified
Applied to: Access DS Table for Standard Stations
WHEN
The system accesses the DS table
THEN
Station code, name, and description are retrieved from DS table records
Context: A KCSM station type is identified
GIVEN
A KCSM station type is identified
Applied to: Access KS Table for KCSM Stations
WHEN
The system accesses the KS table
THEN
Station code, name, and description are retrieved from KS table records
Context: Station information has been retrieved
GIVEN
Station information has been retrieved
Applied to: KCSM Specific Mapping Required?
WHEN
The system evaluates if KCSM-specific mapping is required
THEN
The system either applies KCSM mapping rules or proceeds to validation
Context: KCSM-specific mapping is required
GIVEN
KCSM-specific mapping is required
Applied to: Apply KCSM Station Mapping Rules
WHEN
The system applies KCSM station mapping rules
THEN
Station information is transformed according to KCSM business requirements
Context: KCSM mapping rules have been applied
GIVEN
KCSM mapping rules have been applied
Applied to: Format Station Information for KCSM
WHEN
The system formats station information for KCSM
THEN
Station data is presented in KCSM-compliant format
Context: Station information has been retrieved and optionally formatted
GIVEN
Station information has been retrieved and optionally formatted
Applied to: Validate Station Data
WHEN
The system validates station data
THEN
Station data is confirmed as complete and accurate or flagged as invalid
Context: Station data validation has been completed
GIVEN
Station data validation has been completed
Applied to: Station Found?
WHEN
The system checks if station was found
THEN
The system either returns station information or handles station not found condition
Context: Station lookup has failed to find valid station
GIVEN
Station lookup has failed to find valid station
Applied to: Log Station Not Found Error
WHEN
The system logs station not found error
THEN
Error is recorded with station lookup details for troubleshooting
Context: Station not found error has been logged
GIVEN
Station not found error has been logged
Applied to: Use Default Station Information
WHEN
The system uses default station information
THEN
Default station values are provided to ensure processing continuity
R-GCX016-cbl-01325 (+19) File: GCX016.cbl Disposition Code Message Formatting Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Message Formatting':
  • Context - a disposition code message needs to be formatted and message type is standard disposition message:
    For Format Standard Disposition Message:
    When the system processes the message formatting request, then the system creates a standard disposition message format with disposition code and cargo details.
  • Context - a disposition code message needs to be formatted and message type is broker bond message:
    For Format Broker Bond Message:
    When the system processes the message formatting request, then the system creates a broker bond message format with bond-specific information.
  • Context - a message is being formatted with disposition code information:
    For Add Disposition Code Information:
    When the system adds disposition code details to the message, then the message includes the disposition code value and related processing information.
  • Context - a message contains disposition code information:
    For Add Disposition Description:
    When the system adds disposition description to the message, then the message includes the descriptive text explaining the disposition code meaning.
  • Context - a disposition code is being processed that affects cargo quantities:
    For Determine Quantity Action:
    When the system evaluates the quantity impact of the disposition code, then the system determines whether quantities will be added, subtracted, or remain unchanged.
  • Context - quantity action type is determined to be add quantity:
    For Format Add Quantity Message:
    When the system formats the quantity action message, then the message indicates that the specified quantity will be added to the cargo release amount.
  • Context - quantity action type is determined to be subtract quantity:
    For Format Subtract Quantity Message:
    When the system formats the quantity action message, then the message indicates that the specified quantity will be subtracted from the cargo release amount.
  • Context - quantity action type is determined to be no change:
    For Format No Quantity Change Message:
    When the system formats the quantity action message, then the message indicates that no quantity changes will be made to the cargo.
  • Context - a disposition message is being formatted and entry number information is available:
    For Include Entry Number Information:
    When the system includes entry number information in the message, then the message contains the entry number for customs reference and tracking.
  • Context - a disposition message is being formatted:
    For K1 Comments Available?:
    When the system checks for available k1 comments, then the system determines whether k1 comment information exists and should be included in the message.
  • Context - k1 comments are available and first k1 comment exists:
    For Add First K1 Comment:
    When the system adds the first k1 comment to the message, then the message includes the first k1 comment text for additional context.
  • Context - k1 comments are available and second k1 comment exists:
    For Add Second K1 Comment:
    When the system adds the second k1 comment to the message, then the message includes the second k1 comment text for additional context.
  • Context - k1 comments are available and third k1 comment exists:
    For Add Third K1 Comment:
    When the system adds the third k1 comment to the message, then the message includes the third k1 comment text for additional context.
  • Context - k1 comments are available and fourth k1 comment exists:
    For Add Fourth K1 Comment:
    When the system adds the fourth k1 comment to the message, then the message includes the fourth k1 comment text for additional context.
  • Context - a disposition message requires cargo details:
    For Format Cargo Details:
    When the system formats cargo details for the message, then the message includes formatted cargo identification and tracking information.
  • Context - cargo details are being formatted and car id information is available:
    For Add Car ID Information:
    When the system adds car id information to the message, then the message includes the railroad car identification for equipment tracking.
  • Context - cargo details are being formatted and waybill information is available:
    For Add Waybill Information:
    When the system adds waybill information to the message, then the message includes the waybill number for shipment tracking and reference.
  • Context - cargo details are being formatted and us-ccn information is available:
    For Add US-CCN Information:
    When the system adds us-ccn information to the message, then the message includes the us customs control number for customs tracking and processing.
  • Context - a disposition message is being finalized:
    For Add Processing Timestamp:
    When the system adds processing timestamp to the message, then the message includes the current processing date and time for audit trail.
  • Context - all message components have been added to the disposition message:
    For Finalize Message Format:
    When the system finalizes the message format, then the message is properly formatted and ready for transmission to recipients.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code message needs to be formatted AND message type is standard disposition message
GIVEN
A disposition code message needs to be formatted AND message type is standard disposition message
Applied to: Format Standard Disposition Message
WHEN
The system processes the message formatting request
THEN
The system creates a standard disposition message format with disposition code and cargo details
Context: A disposition code message needs to be formatted AND message type is broker bond message
GIVEN
A disposition code message needs to be formatted AND message type is broker bond message
Applied to: Format Broker Bond Message
WHEN
The system processes the message formatting request
THEN
The system creates a broker bond message format with bond-specific information
Context: A message is being formatted with disposition code information
GIVEN
A message is being formatted with disposition code information
Applied to: Add Disposition Code Information
WHEN
The system adds disposition code details to the message
THEN
The message includes the disposition code value and related processing information
Context: A message contains disposition code information
GIVEN
A message contains disposition code information
Applied to: Add Disposition Description
WHEN
The system adds disposition description to the message
THEN
The message includes the descriptive text explaining the disposition code meaning
Context: A disposition code is being processed that affects cargo quantities
GIVEN
A disposition code is being processed that affects cargo quantities
Applied to: Determine Quantity Action
WHEN
The system evaluates the quantity impact of the disposition code
THEN
The system determines whether quantities will be added, subtracted, or remain unchanged
Context: Quantity action type is determined to be add quantity
GIVEN
Quantity action type is determined to be add quantity
Applied to: Format Add Quantity Message
WHEN
The system formats the quantity action message
THEN
The message indicates that the specified quantity will be added to the cargo release amount
Context: Quantity action type is determined to be subtract quantity
GIVEN
Quantity action type is determined to be subtract quantity
Applied to: Format Subtract Quantity Message
WHEN
The system formats the quantity action message
THEN
The message indicates that the specified quantity will be subtracted from the cargo release amount
Context: Quantity action type is determined to be no change
GIVEN
Quantity action type is determined to be no change
Applied to: Format No Quantity Change Message
WHEN
The system formats the quantity action message
THEN
The message indicates that no quantity changes will be made to the cargo
Context: A disposition message is being formatted AND entry number information is available
GIVEN
A disposition message is being formatted AND entry number information is available
Applied to: Include Entry Number Information
WHEN
The system includes entry number information in the message
THEN
The message contains the entry number for customs reference and tracking
Context: A disposition message is being formatted
GIVEN
A disposition message is being formatted
Applied to: K1 Comments Available?
WHEN
The system checks for available K1 comments
THEN
The system determines whether K1 comment information exists and should be included in the message
Context: K1 comments are available AND first K1 comment exists
GIVEN
K1 comments are available AND first K1 comment exists
Applied to: Add First K1 Comment
WHEN
The system adds the first K1 comment to the message
THEN
The message includes the first K1 comment text for additional context
Context: K1 comments are available AND second K1 comment exists
GIVEN
K1 comments are available AND second K1 comment exists
Applied to: Add Second K1 Comment
WHEN
The system adds the second K1 comment to the message
THEN
The message includes the second K1 comment text for additional context
Context: K1 comments are available AND third K1 comment exists
GIVEN
K1 comments are available AND third K1 comment exists
Applied to: Add Third K1 Comment
WHEN
The system adds the third K1 comment to the message
THEN
The message includes the third K1 comment text for additional context
Context: K1 comments are available AND fourth K1 comment exists
GIVEN
K1 comments are available AND fourth K1 comment exists
Applied to: Add Fourth K1 Comment
WHEN
The system adds the fourth K1 comment to the message
THEN
The message includes the fourth K1 comment text for additional context
Context: A disposition message requires cargo details
GIVEN
A disposition message requires cargo details
Applied to: Format Cargo Details
WHEN
The system formats cargo details for the message
THEN
The message includes formatted cargo identification and tracking information
Context: Cargo details are being formatted AND car ID information is available
GIVEN
Cargo details are being formatted AND car ID information is available
Applied to: Add Car ID Information
WHEN
The system adds car ID information to the message
THEN
The message includes the railroad car identification for equipment tracking
Context: Cargo details are being formatted AND waybill information is available
GIVEN
Cargo details are being formatted AND waybill information is available
Applied to: Add Waybill Information
WHEN
The system adds waybill information to the message
THEN
The message includes the waybill number for shipment tracking and reference
Context: Cargo details are being formatted AND US-CCN information is available
GIVEN
Cargo details are being formatted AND US-CCN information is available
Applied to: Add US-CCN Information
WHEN
The system adds US-CCN information to the message
THEN
The message includes the US Customs Control Number for customs tracking and processing
Context: A disposition message is being finalized
GIVEN
A disposition message is being finalized
Applied to: Add Processing Timestamp
WHEN
The system adds processing timestamp to the message
THEN
The message includes the current processing date and time for audit trail
Context: All message components have been added to the disposition message
GIVEN
All message components have been added to the disposition message
Applied to: Finalize Message Format
WHEN
The system finalizes the message format
THEN
The message is properly formatted and ready for transmission to recipients
R-GCX016-cbl-01345 (+14) File: GCX016.cbl Quantity Action Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Quantity Action Processing':
  • Context - a disposition code is received in the x4 segment:
    For Disposition Code Has Quantity Action?:
    When the system checks if the disposition code has an associated quantity action in the dc table, then the system determines whether quantity processing is required and proceeds accordingly.
  • Context - a disposition code has been identified as having quantity action:
    For Retrieve Quantity Action from DC Table:
    When the system retrieves the quantity action details from the dc table, then the quantity action type and parameters are available for processing.
  • Context - quantity action details have been retrieved from the dc table:
    For Action Type?:
    When the system evaluates the action type field, then the system routes to either add or subtract quantity processing based on the action type.
  • Context - the quantity action type is add:
    For Format ADD Quantity Message:
    When the system formats the quantity action message, then a message is created showing the quantity that will be added to the release quantity.
  • Context - the quantity action type is subtract:
    For Format SUBTRACT Quantity Message:
    When the system formats the quantity action message, then a message is created showing the quantity that will be subtracted from the release quantity.
  • Context - the current release quantity and quantity action amount are known:
    For Calculate New Release Quantity:
    When the system calculates the new release quantity based on the action type, then the new release quantity is computed by adding or subtracting the action amount from the current quantity.
  • Context - a new release quantity has been calculated:
    For Quantity Would Be Negative?:
    When the calculated quantity would be less than zero, then the system identifies this as an invalid condition requiring correction.
  • Context - a calculated release quantity would be negative:
    For Set Quantity to Zero:
    When the system applies the minimum quantity constraint, then the release quantity is set to zero to prevent negative values.
  • Context - a new release quantity has been calculated and is not negative:
    For Use Calculated Quantity:
    When the system validates the calculated quantity, then the calculated quantity is accepted as the new release quantity.
  • Context - the final release quantity has been determined:
    For Format Quantity Action Display Message:
    When the system formats the quantity action display message, then a formatted message is created containing all relevant quantity action information.
  • Context - a quantity action display message is being formatted:
    For Include Current Released Quantity:
    When the system includes current quantity information, then the current released quantity is added to the message for broker reference.
    For Include Quantity Change Amount:
    When the system includes the quantity change details, then the exact amount being added or subtracted is included in the message.
  • Context - a quantity action display message is being formatted and broker entry number exists:
    For Include Broker Entry Number:
    When the system includes entry number information, then the broker entry number is added to the message for cargo identification.
  • Context - a complete quantity action message has been formatted:
    For Add to Merlin Message Buffer:
    When the system adds the message to the merlin buffer, then the message is appended to the buffer for subsequent transmission.
  • Context - quantity action processing has been completed successfully:
    For Continue Message Processing:
    When the system continues with message processing, then control returns to the main message processing flow for additional processing steps.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received in the X4 segment
GIVEN
A disposition code is received in the X4 segment
Applied to: Disposition Code Has Quantity Action?
WHEN
The system checks if the disposition code has an associated quantity action in the DC table
THEN
The system determines whether quantity processing is required and proceeds accordingly
Context: A disposition code has been identified as having quantity action
GIVEN
A disposition code has been identified as having quantity action
Applied to: Retrieve Quantity Action from DC Table
WHEN
The system retrieves the quantity action details from the DC table
THEN
The quantity action type and parameters are available for processing
Context: Quantity action details have been retrieved from the DC table
GIVEN
Quantity action details have been retrieved from the DC table
Applied to: Action Type?
WHEN
The system evaluates the action type field
THEN
The system routes to either ADD or SUBTRACT quantity processing based on the action type
Context: The quantity action type is ADD
GIVEN
The quantity action type is ADD
Applied to: Format ADD Quantity Message
WHEN
The system formats the quantity action message
THEN
A message is created showing the quantity that will be added to the release quantity
Context: The quantity action type is SUBTRACT
GIVEN
The quantity action type is SUBTRACT
Applied to: Format SUBTRACT Quantity Message
WHEN
The system formats the quantity action message
THEN
A message is created showing the quantity that will be subtracted from the release quantity
Context: The current release quantity and quantity action amount are known
GIVEN
The current release quantity and quantity action amount are known
Applied to: Calculate New Release Quantity
WHEN
The system calculates the new release quantity based on the action type
THEN
The new release quantity is computed by adding or subtracting the action amount from the current quantity
Context: A new release quantity has been calculated
GIVEN
A new release quantity has been calculated
Applied to: Quantity Would Be Negative?
WHEN
The calculated quantity would be less than zero
THEN
The system identifies this as an invalid condition requiring correction
Context: A calculated release quantity would be negative
GIVEN
A calculated release quantity would be negative
Applied to: Set Quantity to Zero
WHEN
The system applies the minimum quantity constraint
THEN
The release quantity is set to zero to prevent negative values
Context: A new release quantity has been calculated and is not negative
GIVEN
A new release quantity has been calculated and is not negative
Applied to: Use Calculated Quantity
WHEN
The system validates the calculated quantity
THEN
The calculated quantity is accepted as the new release quantity
Context: The final release quantity has been determined
GIVEN
The final release quantity has been determined
Applied to: Format Quantity Action Display Message
WHEN
The system formats the quantity action display message
THEN
A formatted message is created containing all relevant quantity action information
Context: A quantity action display message is being formatted
GIVEN
A quantity action display message is being formatted
Applied to: Include Current Released Quantity
WHEN
The system includes current quantity information
THEN
The current released quantity is added to the message for broker reference
Applied to: Include Quantity Change Amount
WHEN
The system includes the quantity change details
THEN
The exact amount being added or subtracted is included in the message
Context: A quantity action display message is being formatted and broker entry number exists
GIVEN
A quantity action display message is being formatted and broker entry number exists
Applied to: Include Broker Entry Number
WHEN
The system includes entry number information
THEN
The broker entry number is added to the message for cargo identification
Context: A complete quantity action message has been formatted
GIVEN
A complete quantity action message has been formatted
Applied to: Add to Merlin Message Buffer
WHEN
The system adds the message to the Merlin buffer
THEN
The message is appended to the buffer for subsequent transmission
Context: Quantity action processing has been completed successfully
GIVEN
Quantity action processing has been completed successfully
Applied to: Continue Message Processing
WHEN
The system continues with message processing
THEN
Control returns to the main message processing flow for additional processing steps
R-GCX016-cbl-01360 (+7) File: GCX016.cbl K1 Comment Integration Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'K1 Comment Integration':
  • Context - a k1 comment segment is received for processing:
    For Processing Context?:
    When the system evaluates the current processing context, then the system routes k1 processing to either train-level operations or cargo-level operations based on the context.
  • Context - a k1 comment segment is being processed in train operations context:
    For Store K1 Comment in Train Log:
    When the system processes the k1 segment, then the k1 comment is stored in the train log for future reference.
  • Context - a k1 comment segment is being processed for cargo operations:
    For Comment Count < 4?:
    When the system checks the current count of k1 comments already processed, then if comment count is less than 4, the comment is added to the array, otherwise additional comments are skipped.
  • Context - a k1 comment segment is received and comment count is less than 4:
    For Add K1 Comment to Array:
    When the system processes the k1 comment, then the k1 comment is added to the comment array for inclusion in messages.
  • Context - a k1 comment segment is received and comment count is already 4 or more:
    For Skip Additional Comments:
    When the system evaluates the comment for processing, then the additional k1 comment is skipped and not included in the comment array.
  • Context - k1 comments are ready for formatting and a message is being prepared:
    For Message Type?:
    When the system evaluates the message type (release, hold, status, or error), then the system routes k1 comment formatting to the appropriate message type handler.
  • Context - k1 comments are available and message type has been determined:
    For Format Free-Form Text:
    When the system formats the k1 comments for message inclusion, then the k1 comments are formatted as free-form text appropriate for the specific message type.
  • Context - k1 comments have been formatted as free-form text:
    For Append to Message Body:
    When the system prepares the final message for transmission, then the formatted k1 comments are appended to the message body.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 comment segment is received for processing
GIVEN
A K1 comment segment is received for processing
Applied to: Processing Context?
WHEN
The system evaluates the current processing context
THEN
The system routes K1 processing to either train-level operations or cargo-level operations based on the context
Context: A K1 comment segment is being processed in train operations context
GIVEN
A K1 comment segment is being processed in train operations context
Applied to: Store K1 Comment in Train Log
WHEN
The system processes the K1 segment
THEN
The K1 comment is stored in the train log for future reference
Context: A K1 comment segment is being processed for cargo operations
GIVEN
A K1 comment segment is being processed for cargo operations
Applied to: Comment Count < 4?
WHEN
The system checks the current count of K1 comments already processed
THEN
If comment count is less than 4, the comment is added to the array, otherwise additional comments are skipped
Context: A K1 comment segment is received and comment count is less than 4
GIVEN
A K1 comment segment is received and comment count is less than 4
Applied to: Add K1 Comment to Array
WHEN
The system processes the K1 comment
THEN
The K1 comment is added to the comment array for inclusion in messages
Context: A K1 comment segment is received and comment count is already 4 or more
GIVEN
A K1 comment segment is received and comment count is already 4 or more
Applied to: Skip Additional Comments
WHEN
The system evaluates the comment for processing
THEN
The additional K1 comment is skipped and not included in the comment array
Context: K1 comments are ready for formatting and a message is being prepared
GIVEN
K1 comments are ready for formatting and a message is being prepared
Applied to: Message Type?
WHEN
The system evaluates the message type (Release, Hold, Status, or Error)
THEN
The system routes K1 comment formatting to the appropriate message type handler
Context: K1 comments are available and message type has been determined
GIVEN
K1 comments are available and message type has been determined
Applied to: Format Free-Form Text
WHEN
The system formats the K1 comments for message inclusion
THEN
The K1 comments are formatted as free-form text appropriate for the specific message type
Context: K1 comments have been formatted as free-form text
GIVEN
K1 comments have been formatted as free-form text
Applied to: Append to Message Body
WHEN
The system prepares the final message for transmission
THEN
The formatted K1 comments are appended to the message body
R-GCX016-cbl-01368 (+7) File: GCX016.cbl Broker Bond Message Handling Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Bond Message Handling':
  • Context - a message is received for processing:
    For Message from Canadian Pacific Entity?:
    When the system evaluates the message source entity, then the message is classified as either canadian pacific entity or standard entity for appropriate processing path.
  • Context - a canadian pacific entity message is being processed:
    For Identify Broker-Created Bond:
    When the system analyzes the bond creation source, then the bond is identified as broker-created and flagged for special handling.
  • Context - a broker-created bond has been identified:
    For Extract Bond Information:
    When the system processes the bond message content, then bond control numbers, broker information, and related bond details are extracted and stored.
  • Context - bond information has been extracted from a broker-created bond:
    For Format Special Bond Message:
    When the system prepares the notification message, then the message is formatted with special bond message structure including bond control numbers and broker details.
  • Context - a special bond message has been formatted:
    For Apply Canadian Pacific Formatting Rules:
    When the message is from canadian pacific entity, then canadian pacific specific formatting rules are applied including entity-specific message structure and content requirements.
  • Context - canadian pacific formatting rules have been applied to the bond message:
    For Prepare Bond Notification:
    When the system finalizes the notification preparation, then the bond notification is prepared with complete formatting, bond details, and ready for routing.
  • Context - a bond notification has been prepared:
    For Route to Merlin Message System:
    When the system routes the message for delivery, then the notification is sent to the merlin message system for final delivery to appropriate recipients.
  • Context - a message is not from canadian pacific entity:
    For Standard Message Processing:
    When the system determines the processing path, then the message is processed through standard message handling procedures without special bond formatting.
👨‍💻 Technical ACs (Gherkin)
Context: A message is received for processing
GIVEN
A message is received for processing
Applied to: Message from Canadian Pacific Entity?
WHEN
The system evaluates the message source entity
THEN
The message is classified as either Canadian Pacific entity or standard entity for appropriate processing path
Context: A Canadian Pacific entity message is being processed
GIVEN
A Canadian Pacific entity message is being processed
Applied to: Identify Broker-Created Bond
WHEN
The system analyzes the bond creation source
THEN
The bond is identified as broker-created and flagged for special handling
Context: A broker-created bond has been identified
GIVEN
A broker-created bond has been identified
Applied to: Extract Bond Information
WHEN
The system processes the bond message content
THEN
Bond control numbers, broker information, and related bond details are extracted and stored
Context: Bond information has been extracted from a broker-created bond
GIVEN
Bond information has been extracted from a broker-created bond
Applied to: Format Special Bond Message
WHEN
The system prepares the notification message
THEN
The message is formatted with special bond message structure including bond control numbers and broker details
Context: A special bond message has been formatted
GIVEN
A special bond message has been formatted
Applied to: Apply Canadian Pacific Formatting Rules
WHEN
The message is from Canadian Pacific entity
THEN
Canadian Pacific specific formatting rules are applied including entity-specific message structure and content requirements
Context: Canadian Pacific formatting rules have been applied to the bond message
GIVEN
Canadian Pacific formatting rules have been applied to the bond message
Applied to: Prepare Bond Notification
WHEN
The system finalizes the notification preparation
THEN
The bond notification is prepared with complete formatting, bond details, and ready for routing
Context: A bond notification has been prepared
GIVEN
A bond notification has been prepared
Applied to: Route to Merlin Message System
WHEN
The system routes the message for delivery
THEN
The notification is sent to the Merlin message system for final delivery to appropriate recipients
Context: A message is not from Canadian Pacific entity
GIVEN
A message is not from Canadian Pacific entity
Applied to: Standard Message Processing
WHEN
The system determines the processing path
THEN
The message is processed through standard message handling procedures without special bond formatting
R-GCX016-cbl-01376 (+4) File: GCX016.cbl Container Type Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Type Validation':
  • Context - a cargo record is being processed for equipment integration:
    For Equipment Type Present?:
    When the system retrieves the equipment type from the cargo record, then the system should check if equipment type information is present and proceed to validation if available, or skip to invalid handling if not present.
  • Context - an equipment type has been retrieved from the cargo record:
    For Is Valid Container/Equipment Type?:
    When the system checks the equipment type against the list of valid container and equipment types including containers, trailers, and various other equipment types, then the system should classify the equipment type as valid if it matches approved container/equipment types, or invalid if it does not match.
  • Context - the equipment type has been validated as a recognized container or equipment type:
    For Set Integration Call Flag to Proceed:
    When the validation process determines the equipment type is valid for integration, then the system should set the integration call flag to proceed and allow the integration call to be made.
  • Context - the equipment type is either not present in the cargo record or does not match valid container/equipment types:
    For Log Invalid Equipment Type:
    When the validation process identifies an invalid or missing equipment type, then the system should log the invalid equipment type occurrence and set the integration call flag to skip processing.
  • Context - the equipment type validation has failed due to invalid or missing equipment type:
    For Set Integration Call Flag to Skip:
    When the system needs to determine the next processing step after validation failure, then the system should set the integration call flag to skip and prevent any integration calls from being made.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for equipment integration
GIVEN
A cargo record is being processed for equipment integration
Applied to: Equipment Type Present?
WHEN
The system retrieves the equipment type from the cargo record
THEN
The system should check if equipment type information is present and proceed to validation if available, or skip to invalid handling if not present
Context: An equipment type has been retrieved from the cargo record
GIVEN
An equipment type has been retrieved from the cargo record
Applied to: Is Valid Container/Equipment Type?
WHEN
The system checks the equipment type against the list of valid container and equipment types including containers, trailers, and various other equipment types
THEN
The system should classify the equipment type as valid if it matches approved container/equipment types, or invalid if it does not match
Context: The equipment type has been validated as a recognized container or equipment type
GIVEN
The equipment type has been validated as a recognized container or equipment type
Applied to: Set Integration Call Flag to Proceed
WHEN
The validation process determines the equipment type is valid for integration
THEN
The system should set the integration call flag to proceed and allow the integration call to be made
Context: The equipment type is either not present in the cargo record or does not match valid container/equipment types
GIVEN
The equipment type is either not present in the cargo record or does not match valid container/equipment types
Applied to: Log Invalid Equipment Type
WHEN
The validation process identifies an invalid or missing equipment type
THEN
The system should log the invalid equipment type occurrence and set the integration call flag to skip processing
Context: The equipment type validation has failed due to invalid or missing equipment type
GIVEN
The equipment type validation has failed due to invalid or missing equipment type
Applied to: Set Integration Call Flag to Skip
WHEN
The system needs to determine the next processing step after validation failure
THEN
The system should set the integration call flag to skip and prevent any integration calls from being made
R-GCX016-cbl-01381 (+9) File: GCX016.cbl Status Mapping Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Mapping':
  • Context - a cargo record has an internal hold status:
    For Map Hold Status:
    When the system processes the cargo status for integration service mapping, then the system maps the hold status to appropriate integration service status description based on hold type (border hold, destination hold, or combined hold conditions).
  • Context - a cargo record has an internal release status:
    For Map Release Status:
    When the system processes the cargo status for integration service mapping, then the system maps the release status to appropriate integration service status description based on release type (full release when released quantity equals total quantity, or partial release when released quantity is less than total quantity).
  • Context - a cargo record has an internal ptt (permit to transfer) status:
    For Map PTT Status:
    When the system processes the cargo status for integration service mapping, then the system maps the ptt status to 'permit to transfer' integration service status description.
  • Context - a cargo record has an internal proceed status with border arrival date:
    For Map Proceed Status:
    When the system processes the cargo status for integration service mapping, then the system maps the proceed status to integration service status description that includes the border arrival date information.
  • Context - a cargo record has an internal train arrival status:
    For Map Arrival Status:
    When the system processes the cargo status for integration service mapping, then the system maps the arrival status to 'train arrival' integration service status description.
  • Context - a cargo record has an internal export completion status:
    For Map Export Status:
    When the system processes the cargo status for integration service mapping, then the system maps the export status to 'export complete' integration service status description.
  • Context - a cargo record has an internal customs seizure status:
    For Map Seizure Status:
    When the system processes the cargo status for integration service mapping, then the system maps the seizure status to 'customs seizure' integration service status description.
  • Context - a cargo record has an internal fda hold status:
    For Map FDA Hold Status:
    When the system processes the cargo status for integration service mapping, then the system maps the fda hold status to 'fda destination hold' integration service status description.
  • Context - a status description has been generated for integration service mapping:
    For Validate Status Description Format:
    When the system validates the status description format, then the system ensures the status description meets integration service format requirements and standards.
  • Context - a validated status description exists for a cargo record:
    For Prepare Status for Integration Service Call:
    When the system prepares the status for integration service transmission, then the system formats and packages the status description for external integration service call.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has an internal hold status
GIVEN
A cargo record has an internal hold status
Applied to: Map Hold Status
WHEN
The system processes the cargo status for integration service mapping
THEN
The system maps the hold status to appropriate integration service status description based on hold type (border hold, destination hold, or combined hold conditions)
Context: A cargo record has an internal release status
GIVEN
A cargo record has an internal release status
Applied to: Map Release Status
WHEN
The system processes the cargo status for integration service mapping
THEN
The system maps the release status to appropriate integration service status description based on release type (full release when released quantity equals total quantity, or partial release when released quantity is less than total quantity)
Context: A cargo record has an internal PTT (Permit to Transfer) status
GIVEN
A cargo record has an internal PTT (Permit to Transfer) status
Applied to: Map PTT Status
WHEN
The system processes the cargo status for integration service mapping
THEN
The system maps the PTT status to 'Permit to Transfer' integration service status description
Context: A cargo record has an internal proceed status with border arrival date
GIVEN
A cargo record has an internal proceed status with border arrival date
Applied to: Map Proceed Status
WHEN
The system processes the cargo status for integration service mapping
THEN
The system maps the proceed status to integration service status description that includes the border arrival date information
Context: A cargo record has an internal train arrival status
GIVEN
A cargo record has an internal train arrival status
Applied to: Map Arrival Status
WHEN
The system processes the cargo status for integration service mapping
THEN
The system maps the arrival status to 'Train Arrival' integration service status description
Context: A cargo record has an internal export completion status
GIVEN
A cargo record has an internal export completion status
Applied to: Map Export Status
WHEN
The system processes the cargo status for integration service mapping
THEN
The system maps the export status to 'Export Complete' integration service status description
Context: A cargo record has an internal customs seizure status
GIVEN
A cargo record has an internal customs seizure status
Applied to: Map Seizure Status
WHEN
The system processes the cargo status for integration service mapping
THEN
The system maps the seizure status to 'Customs Seizure' integration service status description
Context: A cargo record has an internal FDA hold status
GIVEN
A cargo record has an internal FDA hold status
Applied to: Map FDA Hold Status
WHEN
The system processes the cargo status for integration service mapping
THEN
The system maps the FDA hold status to 'FDA Destination Hold' integration service status description
Context: A status description has been generated for integration service mapping
GIVEN
A status description has been generated for integration service mapping
Applied to: Validate Status Description Format
WHEN
The system validates the status description format
THEN
The system ensures the status description meets integration service format requirements and standards
Context: A validated status description exists for a cargo record
GIVEN
A validated status description exists for a cargo record
Applied to: Prepare Status for Integration Service Call
WHEN
The system prepares the status for integration service transmission
THEN
The system formats and packages the status description for external integration service call
R-GCX016-cbl-01391 (+17) File: GCX016.cbl Broker Information Lookup Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Information Lookup':
  • Context - a broker lookup request is initiated:
    For Broker Code Available?:
    When the system checks for broker code availability, then the system proceeds to broker table lookup if broker code exists, otherwise returns broker not found error.
  • Context - a valid broker code is available:
    For Retrieve BK Table Record:
    When the system performs bk table lookup using the broker code, then the system retrieves the corresponding broker master record from bk table.
  • Context - bk table lookup has been performed with broker code:
    For BK Record Found?:
    When the system checks if a matching bk record was found, then the system proceeds to extract broker short name if record found, otherwise returns broker not found error.
  • Context - a valid bk table record has been found:
    For Extract Broker Short Name:
    When the system processes the bk record, then the system extracts and stores the broker short name from the bk record.
  • Context - broker short name has been extracted from bk table:
    For Retrieve B1 Table Record:
    When the system performs b1 table lookup using the broker code, then the system retrieves the corresponding broker detail record from b1 table.
  • Context - b1 table lookup has been performed with broker code:
    For B1 Record Found?:
    When the system checks if a matching b1 record was found, then the system proceeds to extract broker contact details if record found, otherwise sets default broker values.
  • Context - a valid b1 table record has been found:
    For Extract Broker Contact Details:
    When the system processes the b1 record, then the system extracts and stores broker contact details from the b1 record.
  • Context - broker contact details have been extracted from b1 record:
    For Extract Email Preferences:
    When the system processes email preference fields, then the system extracts and stores broker email preferences for notification purposes.
  • Context - email preferences have been extracted from b1 record:
    For Extract Notification Settings:
    When the system processes notification setting fields, then the system extracts and stores broker notification settings for message routing.
  • Context - notification settings have been extracted from broker record:
    For Payer of Freight Entity?:
    When the system checks if this is a payer of freight entity lookup, then the system applies pf= prefix lookup if payer of freight entity, otherwise proceeds to validate broker information.
  • Context - the broker lookup is identified as payer of freight entity:
    For Apply PF= Prefix Lookup:
    When the system applies pf= prefix lookup logic, then the system performs specialized payer of freight broker name retrieval.
  • Context - pf= prefix lookup has been applied:
    For Get Special PF Broker Name:
    When the system performs special pf broker name lookup, then the system retrieves and stores the specialized payer of freight broker name.
  • Context - all broker information has been extracted from tables:
    For Validate Broker Information:
    When the system validates the completeness of broker information, then the system proceeds to store information if complete, otherwise sets default values.
  • Context - broker information validation has been performed:
    For Information Complete?:
    When the system checks for information completeness, then the system stores broker information if complete, otherwise applies default broker values.
  • Context - broker information is incomplete or b1 record was not found:
    For Set Default Broker Values:
    When the system applies default value assignment logic, then the system sets standard default values for missing broker information fields.
  • Context - broker information is complete or default values have been applied:
    For Store Broker Information:
    When the system stores the broker information, then the system saves all broker details for use in notification and processing workflows.
  • Context - broker information has been stored successfully:
    For Broker Lookup Complete:
    When the system completes the broker lookup process, then the system returns success status with complete broker information available for use.
  • Context - broker code is not available or broker records are not found in bk table:
    For Broker Not Found Error:
    When the system encounters broker lookup failure, then the system returns broker not found error status and terminates lookup process.
👨‍💻 Technical ACs (Gherkin)
Context: A broker lookup request is initiated
GIVEN
A broker lookup request is initiated
Applied to: Broker Code Available?
WHEN
The system checks for broker code availability
THEN
The system proceeds to broker table lookup if broker code exists, otherwise returns broker not found error
Context: A valid broker code is available
GIVEN
A valid broker code is available
Applied to: Retrieve BK Table Record
WHEN
The system performs BK table lookup using the broker code
THEN
The system retrieves the corresponding broker master record from BK table
Context: BK table lookup has been performed with broker code
GIVEN
BK table lookup has been performed with broker code
Applied to: BK Record Found?
WHEN
The system checks if a matching BK record was found
THEN
The system proceeds to extract broker short name if record found, otherwise returns broker not found error
Context: A valid BK table record has been found
GIVEN
A valid BK table record has been found
Applied to: Extract Broker Short Name
WHEN
The system processes the BK record
THEN
The system extracts and stores the broker short name from the BK record
Context: Broker short name has been extracted from BK table
GIVEN
Broker short name has been extracted from BK table
Applied to: Retrieve B1 Table Record
WHEN
The system performs B1 table lookup using the broker code
THEN
The system retrieves the corresponding broker detail record from B1 table
Context: B1 table lookup has been performed with broker code
GIVEN
B1 table lookup has been performed with broker code
Applied to: B1 Record Found?
WHEN
The system checks if a matching B1 record was found
THEN
The system proceeds to extract broker contact details if record found, otherwise sets default broker values
Context: A valid B1 table record has been found
GIVEN
A valid B1 table record has been found
Applied to: Extract Broker Contact Details
WHEN
The system processes the B1 record
THEN
The system extracts and stores broker contact details from the B1 record
Context: Broker contact details have been extracted from B1 record
GIVEN
Broker contact details have been extracted from B1 record
Applied to: Extract Email Preferences
WHEN
The system processes email preference fields
THEN
The system extracts and stores broker email preferences for notification purposes
Context: Email preferences have been extracted from B1 record
GIVEN
Email preferences have been extracted from B1 record
Applied to: Extract Notification Settings
WHEN
The system processes notification setting fields
THEN
The system extracts and stores broker notification settings for message routing
Context: Notification settings have been extracted from broker record
GIVEN
Notification settings have been extracted from broker record
Applied to: Payer of Freight Entity?
WHEN
The system checks if this is a payer of freight entity lookup
THEN
The system applies PF= prefix lookup if payer of freight entity, otherwise proceeds to validate broker information
Context: The broker lookup is identified as payer of freight entity
GIVEN
The broker lookup is identified as payer of freight entity
Applied to: Apply PF= Prefix Lookup
WHEN
The system applies PF= prefix lookup logic
THEN
The system performs specialized payer of freight broker name retrieval
Context: PF= prefix lookup has been applied
GIVEN
PF= prefix lookup has been applied
Applied to: Get Special PF Broker Name
WHEN
The system performs special PF broker name lookup
THEN
The system retrieves and stores the specialized payer of freight broker name
Context: All broker information has been extracted from tables
GIVEN
All broker information has been extracted from tables
Applied to: Validate Broker Information
WHEN
The system validates the completeness of broker information
THEN
The system proceeds to store information if complete, otherwise sets default values
Context: Broker information validation has been performed
GIVEN
Broker information validation has been performed
Applied to: Information Complete?
WHEN
The system checks for information completeness
THEN
The system stores broker information if complete, otherwise applies default broker values
Context: Broker information is incomplete or B1 record was not found
GIVEN
Broker information is incomplete or B1 record was not found
Applied to: Set Default Broker Values
WHEN
The system applies default value assignment logic
THEN
The system sets standard default values for missing broker information fields
Context: Broker information is complete or default values have been applied
GIVEN
Broker information is complete or default values have been applied
Applied to: Store Broker Information
WHEN
The system stores the broker information
THEN
The system saves all broker details for use in notification and processing workflows
Context: Broker information has been stored successfully
GIVEN
Broker information has been stored successfully
Applied to: Broker Lookup Complete
WHEN
The system completes the broker lookup process
THEN
The system returns success status with complete broker information available for use
Context: Broker code is not available or broker records are not found in BK table
GIVEN
Broker code is not available or broker records are not found in BK table
Applied to: Broker Not Found Error
WHEN
The system encounters broker lookup failure
THEN
The system returns broker not found error status and terminates lookup process
R-GCX016-cbl-01409 (+9) File: GCX016.cbl Email vs Merlin Routing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email vs Merlin Routing':
  • Context - a broker notification is required for cargo processing:
    For Check Broker Preferences:
    When the system checks broker preferences in the broker tables, then the system retrieves broker contact information and routing preferences from bk/b1 tables.
  • Context - broker contact information has been retrieved from broker tables:
    For Email Preference Set?:
    When the broker has internet notification preference set to 'y' or email preference is configured, then the system routes the notification to the internet email system.
    For Route to Traditional Merlin System:
    When the broker does not have internet notification preference set or email preference is not configured, then the system routes the notification to the traditional merlin messaging system.
  • Context - notification is being routed via internet email:
    For Format Email Message:
    When the system prepares the message content, then the system formats the message with cargo information, disposition codes, quantities, and broker-specific details for email delivery.
  • Context - email message has been formatted for delivery:
    For Set Email Keywords for Categorization:
    When the system prepares email routing parameters, then the system sets appropriate keywords and categories based on message type and content for email gateway processing.
  • Context - notification is being routed via traditional merlin system:
    For Format Merlin Message:
    When the system prepares the message content, then the system formats the message with cargo information, disposition codes, quantities, and broker-specific details according to merlin message standards.
  • Context - merlin message has been formatted for delivery:
    For Set Merlin User Codes:
    When the system prepares merlin routing parameters, then the system sets appropriate user codes, destination identifiers, and routing parameters based on broker location and message type.
  • Context - email message is formatted with proper keywords and categorization:
    For Send via Email Gateway:
    When the system initiates email transmission, then the system sends the notification through the email gateway to the broker's configured email address.
  • Context - merlin message is formatted with proper user codes and routing parameters:
    For Send via Merlin Gateway:
    When the system initiates merlin transmission, then the system sends the notification through the merlin gateway to the broker's configured merlin user id.
  • Context - notification has been transmitted via either email or merlin gateway:
    For Log Routing Decision:
    When the transmission is completed, then the system logs the routing method used, broker information, message type, and transmission status for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A broker notification is required for cargo processing
GIVEN
A broker notification is required for cargo processing
Applied to: Check Broker Preferences
WHEN
The system checks broker preferences in the broker tables
THEN
The system retrieves broker contact information and routing preferences from BK/B1 tables
Context: Broker contact information has been retrieved from broker tables
GIVEN
Broker contact information has been retrieved from broker tables
Applied to: Email Preference Set?
WHEN
The broker has internet notification preference set to 'Y' or email preference is configured
THEN
The system routes the notification to the internet email system
Applied to: Route to Traditional Merlin System
WHEN
The broker does not have internet notification preference set or email preference is not configured
THEN
The system routes the notification to the traditional Merlin messaging system
Context: Notification is being routed via internet email
GIVEN
Notification is being routed via internet email
Applied to: Format Email Message
WHEN
The system prepares the message content
THEN
The system formats the message with cargo information, disposition codes, quantities, and broker-specific details for email delivery
Context: Email message has been formatted for delivery
GIVEN
Email message has been formatted for delivery
Applied to: Set Email Keywords for Categorization
WHEN
The system prepares email routing parameters
THEN
The system sets appropriate keywords and categories based on message type and content for email gateway processing
Context: Notification is being routed via traditional Merlin system
GIVEN
Notification is being routed via traditional Merlin system
Applied to: Format Merlin Message
WHEN
The system prepares the message content
THEN
The system formats the message with cargo information, disposition codes, quantities, and broker-specific details according to Merlin message standards
Context: Merlin message has been formatted for delivery
GIVEN
Merlin message has been formatted for delivery
Applied to: Set Merlin User Codes
WHEN
The system prepares Merlin routing parameters
THEN
The system sets appropriate user codes, destination identifiers, and routing parameters based on broker location and message type
Context: Email message is formatted with proper keywords and categorization
GIVEN
Email message is formatted with proper keywords and categorization
Applied to: Send via Email Gateway
WHEN
The system initiates email transmission
THEN
The system sends the notification through the email gateway to the broker's configured email address
Context: Merlin message is formatted with proper user codes and routing parameters
GIVEN
Merlin message is formatted with proper user codes and routing parameters
Applied to: Send via Merlin Gateway
WHEN
The system initiates Merlin transmission
THEN
The system sends the notification through the Merlin gateway to the broker's configured Merlin user ID
Context: Notification has been transmitted via either email or Merlin gateway
GIVEN
Notification has been transmitted via either email or Merlin gateway
Applied to: Log Routing Decision
WHEN
The transmission is completed
THEN
The system logs the routing method used, broker information, message type, and transmission status for audit trail
R-GCX016-cbl-01419 (+6) File: GCX016.cbl Broker Disposition Code Validation Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Disposition Code Validation':
  • Context - a disposition code needs to be validated for broker notification eligibility:
    For Is Disposition Code Configured for Broker Notifications?:
    When the system checks the broker disposition code configuration in gcstbrt system tables, then the system sets validation flag to true if the disposition code is found in configuration tables, otherwise sets validation flag to false.
  • Context - a disposition code validation has been completed with a validation result:
    For Continue with Broker Notification Process:
    When the validation flag is true indicating the disposition code is configured for notifications, then the system continues with the broker notification process.
    For Skip Broker Notification Process:
    When the validation flag is false indicating the disposition code is not configured for notifications, then the system skips the broker notification process.
  • Context - a disposition code needs to be validated for broker notification configuration:
    For Access System Configuration Tables:
    When the system accesses the broker configuration tables to check if the disposition code exists, then the system retrieves the configuration status from the system tables.
  • Context - a disposition code has been looked up in the broker notification configuration table:
    For Is Disposition Code Found in Broker Notification Table?:
    When the disposition code is found in the broker notification table, then the broker notification flag is set to true.
    For Is Disposition Code Found in Broker Notification Table?:
    When the disposition code is not found in the broker notification table, then the broker notification flag is set to false.
  • Context - the broker notification flag has been set based on disposition code configuration lookup:
    For Return Validation Result:
    When the validation process is complete, then the system returns the validation result with the broker notification flag status.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code needs to be validated for broker notification eligibility
GIVEN
A disposition code needs to be validated for broker notification eligibility
Applied to: Is Disposition Code Configured for Broker Notifications?
WHEN
The system checks the broker disposition code configuration in GCSTBRT system tables
THEN
The system sets validation flag to TRUE if the disposition code is found in configuration tables, otherwise sets validation flag to FALSE
Context: A disposition code validation has been completed with a validation result
GIVEN
A disposition code validation has been completed with a validation result
Applied to: Continue with Broker Notification Process
WHEN
The validation flag is TRUE indicating the disposition code is configured for notifications
THEN
The system continues with the broker notification process
Applied to: Skip Broker Notification Process
WHEN
The validation flag is FALSE indicating the disposition code is not configured for notifications
THEN
The system skips the broker notification process
Context: A disposition code needs to be validated for broker notification configuration
GIVEN
A disposition code needs to be validated for broker notification configuration
Applied to: Access System Configuration Tables
WHEN
The system accesses the broker configuration tables to check if the disposition code exists
THEN
The system retrieves the configuration status from the system tables
Context: A disposition code has been looked up in the broker notification configuration table
GIVEN
A disposition code has been looked up in the broker notification configuration table
Applied to: Is Disposition Code Found in Broker Notification Table?
WHEN
The disposition code is found in the broker notification table
THEN
The broker notification flag is set to TRUE
Applied to: Is Disposition Code Found in Broker Notification Table?
WHEN
The disposition code is not found in the broker notification table
THEN
The broker notification flag is set to FALSE
Context: The broker notification flag has been set based on disposition code configuration lookup
GIVEN
The broker notification flag has been set based on disposition code configuration lookup
Applied to: Return Validation Result
WHEN
The validation process is complete
THEN
The system returns the validation result with the broker notification flag status
R-GCX016-cbl-01422 (+13) File: GCX016.cbl Secondary Record Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Secondary Record Processing':
  • Context - a cargo record exists in the system:
    For Access Cargo Secondary Records GCSA2RT Segment:
    When the system needs to access secondary cargo information, then the system retrieves gcsa2rt segment data from cargo secondary records.
  • Context - the system has accessed cargo secondary records:
    For Secondary Records Available?:
    When the system checks for secondary record availability, then the system determines if secondary records are available for processing or if no payer of freight information can be found.
  • Context - secondary records are available for the cargo:
    For Initialize Secondary Record Search:
    When the system begins searching for payer of freight information, then the system initializes the search process to examine n101 segments.
  • Context - the secondary record search has been initialized:
    For Read N101 Segments from Secondary Records:
    When the system reads n101 segments from secondary records, then the system retrieves n101 segment data for entity identification processing.
  • Context - the system has attempted to read n101 segments:
    For N101 Segment Found?:
    When the system checks for n101 segment existence, then the system determines if n101 segments are found for qualifier processing or continues searching for additional records.
  • Context - an n101 segment has been found in secondary records:
    For Check N101-01 Qualifier for Payer of Freight:
    When the system checks the n101-01 qualifier field, then the system identifies the entity type for further processing based on the qualifier value.
  • Context - the system has checked the n101-01 qualifier field:
    For Qualifier = 'PF' Payer of Freight?:
    When the qualifier equals 'pf' indicating payer of freight, then the system identifies this as payer of freight entity information and proceeds to extract the data.
  • Context - the n101 segment has been identified as containing payer of freight information:
    For Extract Payer of Freight Entity Information:
    When the system extracts payer of freight entity information, then the system retrieves the payer entity identification data from the n101 segment.
  • Context - payer of freight entity information has been extracted from n101 segment:
    For Store Payer Entity ID in Working Storage:
    When the system stores the payer entity id, then the payer entity identification is saved in working storage for broker lookup processing.
  • Context - the system has processed an n101 segment:
    For Continue Search for Additional N101 Records:
    When the system continues searching for additional n101 records, then the system examines remaining secondary records for more n101 segments.
  • Context - the system has processed available n101 segments:
    For More N101 Records?:
    When the system checks for more n101 records, then the system determines if additional n101 records exist for processing or if the search should conclude.
  • Context - payer of freight entity id has been stored and no more n101 records exist:
    For Lookup Broker Short Name Using PF= Prefix:
    When the system looks up broker short name using pf= prefix, then the system retrieves broker short name information from the broker table using the formatted payer entity id.
  • Context - broker short name has been successfully looked up:
    For Return Payer of Freight Information to Caller:
    When the system returns payer of freight information to caller, then the complete payer of freight information including broker details is provided to the calling process.
  • Context - secondary records are not available or contain no payer of freight information:
    For No Payer of Freight Information Found:
    When the system determines no payer of freight information is found, then the system indicates that no payer of freight information is available for the cargo.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Access Cargo Secondary Records GCSA2RT Segment
WHEN
The system needs to access secondary cargo information
THEN
The system retrieves GCSA2RT segment data from cargo secondary records
Context: The system has accessed cargo secondary records
GIVEN
The system has accessed cargo secondary records
Applied to: Secondary Records Available?
WHEN
The system checks for secondary record availability
THEN
The system determines if secondary records are available for processing or if no payer of freight information can be found
Context: Secondary records are available for the cargo
GIVEN
Secondary records are available for the cargo
Applied to: Initialize Secondary Record Search
WHEN
The system begins searching for payer of freight information
THEN
The system initializes the search process to examine N101 segments
Context: The secondary record search has been initialized
GIVEN
The secondary record search has been initialized
Applied to: Read N101 Segments from Secondary Records
WHEN
The system reads N101 segments from secondary records
THEN
The system retrieves N101 segment data for entity identification processing
Context: The system has attempted to read N101 segments
GIVEN
The system has attempted to read N101 segments
Applied to: N101 Segment Found?
WHEN
The system checks for N101 segment existence
THEN
The system determines if N101 segments are found for qualifier processing or continues searching for additional records
Context: An N101 segment has been found in secondary records
GIVEN
An N101 segment has been found in secondary records
Applied to: Check N101-01 Qualifier for Payer of Freight
WHEN
The system checks the N101-01 qualifier field
THEN
The system identifies the entity type for further processing based on the qualifier value
Context: The system has checked the N101-01 qualifier field
GIVEN
The system has checked the N101-01 qualifier field
Applied to: Qualifier = 'PF' Payer of Freight?
WHEN
The qualifier equals 'PF' indicating payer of freight
THEN
The system identifies this as payer of freight entity information and proceeds to extract the data
Context: The N101 segment has been identified as containing payer of freight information
GIVEN
The N101 segment has been identified as containing payer of freight information
Applied to: Extract Payer of Freight Entity Information
WHEN
The system extracts payer of freight entity information
THEN
The system retrieves the payer entity identification data from the N101 segment
Context: Payer of freight entity information has been extracted from N101 segment
GIVEN
Payer of freight entity information has been extracted from N101 segment
Applied to: Store Payer Entity ID in Working Storage
WHEN
The system stores the payer entity ID
THEN
The payer entity identification is saved in working storage for broker lookup processing
Context: The system has processed an N101 segment
GIVEN
The system has processed an N101 segment
Applied to: Continue Search for Additional N101 Records
WHEN
The system continues searching for additional N101 records
THEN
The system examines remaining secondary records for more N101 segments
Context: The system has processed available N101 segments
GIVEN
The system has processed available N101 segments
Applied to: More N101 Records?
WHEN
The system checks for more N101 records
THEN
The system determines if additional N101 records exist for processing or if the search should conclude
Context: Payer of freight entity ID has been stored and no more N101 records exist
GIVEN
Payer of freight entity ID has been stored and no more N101 records exist
Applied to: Lookup Broker Short Name Using PF= Prefix
WHEN
The system looks up broker short name using PF= prefix
THEN
The system retrieves broker short name information from the broker table using the formatted payer entity ID
Context: Broker short name has been successfully looked up
GIVEN
Broker short name has been successfully looked up
Applied to: Return Payer of Freight Information to Caller
WHEN
The system returns payer of freight information to caller
THEN
The complete payer of freight information including broker details is provided to the calling process
Context: Secondary records are not available or contain no payer of freight information
GIVEN
Secondary records are not available or contain no payer of freight information
Applied to: No Payer of Freight Information Found
WHEN
The system determines no payer of freight information is found
THEN
The system indicates that no payer of freight information is available for the cargo
R-GCX016-cbl-01436 (+18) File: GCX016.cbl Status Array Debugging Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Debugging':
  • Context - a status array debugging request is received:
    For Debug Mode Active?:
    When the system checks the debug mode status, then if debug mode is active, proceed with debug display initialization, otherwise skip debug processing.
    For Skip Debug Processing:
    When debug mode is not active, then skip all debug display processing and proceed to completion.
  • Context - debug mode is active:
    For Initialize Debug Display:
    When debug display initialization is triggered, then set up debug display headers and prepare for array content display.
  • Context - the s09a status array has been read:
    For Array Has Elements?:
    When the system checks for array elements, then if array has elements, display array header information, otherwise skip to array summary display.
  • Context - the status array contains elements:
    For Display Array Header Information:
    When array header display is initiated, then display array identification and structural information.
  • Context - the status array has elements to display:
    For Loop Through Array Elements:
    When element processing loop is initiated, then process each array element sequentially for detailed display.
  • Context - a status array element is being processed:
    For Display Element Details:
    When element detail display is requested, then display disposition code, status information, entry number, quantity information, location details, and released flag.
  • Context - a status array element is being displayed:
    For Show Disposition Code:
    When disposition code display is requested, then show the disposition code value for the current element.
    For Show Status Information:
    When status information display is requested, then show all status flags and related information for the current element.
    For Show Entry Number:
    When entry number display is requested, then show the entry number value for the current element.
    For Show Quantity Information:
    When quantity information display is requested, then show all quantity values and related information for the current element.
    For Show Location Details:
    When location details display is requested, then show location codes and related geographic information for the current element.
    For Show Released Flag:
    When released flag display is requested, then show the released status indicator for the current element.
  • Context - an array element has been processed and displayed:
    For More Elements?:
    When the system checks for additional elements, then if more elements exist, continue with the next element, otherwise proceed to array summary display.
  • Context - all array elements have been processed or no elements exist:
    For Display Array Summary:
    When array summary display is initiated, then display total element count and array capacity usage information.
  • Context - array summary display is being shown:
    For Show Total Element Count:
    When total element count display is requested, then show the count of elements currently in the status array.
    For Show Array Capacity Usage:
    When array capacity usage display is requested, then show the percentage or ratio of array capacity currently utilized.
  • Context - debug display has been completed:
    For Log Debug Information:
    When debug information logging is initiated, then record all displayed debug information in the system log.
  • Context - debug processing has been completed or skipped:
    For Debug Display Complete:
    When debug display completion is reached, then finalize debug display and return control to the main processing flow.
👨‍💻 Technical ACs (Gherkin)
Context: A status array debugging request is received
GIVEN
A status array debugging request is received
Applied to: Debug Mode Active?
WHEN
The system checks the debug mode status
THEN
If debug mode is active, proceed with debug display initialization, otherwise skip debug processing
Applied to: Skip Debug Processing
WHEN
Debug mode is not active
THEN
Skip all debug display processing and proceed to completion
Context: Debug mode is active
GIVEN
Debug mode is active
Applied to: Initialize Debug Display
WHEN
Debug display initialization is triggered
THEN
Set up debug display headers and prepare for array content display
Context: The S09A status array has been read
GIVEN
The S09A status array has been read
Applied to: Array Has Elements?
WHEN
The system checks for array elements
THEN
If array has elements, display array header information, otherwise skip to array summary display
Context: The status array contains elements
GIVEN
The status array contains elements
Applied to: Display Array Header Information
WHEN
Array header display is initiated
THEN
Display array identification and structural information
Context: The status array has elements to display
GIVEN
The status array has elements to display
Applied to: Loop Through Array Elements
WHEN
Element processing loop is initiated
THEN
Process each array element sequentially for detailed display
Context: A status array element is being processed
GIVEN
A status array element is being processed
Applied to: Display Element Details
WHEN
Element detail display is requested
THEN
Display disposition code, status information, entry number, quantity information, location details, and released flag
Context: A status array element is being displayed
GIVEN
A status array element is being displayed
Applied to: Show Disposition Code
WHEN
Disposition code display is requested
THEN
Show the disposition code value for the current element
Applied to: Show Status Information
WHEN
Status information display is requested
THEN
Show all status flags and related information for the current element
Applied to: Show Entry Number
WHEN
Entry number display is requested
THEN
Show the entry number value for the current element
Applied to: Show Quantity Information
WHEN
Quantity information display is requested
THEN
Show all quantity values and related information for the current element
Applied to: Show Location Details
WHEN
Location details display is requested
THEN
Show location codes and related geographic information for the current element
Applied to: Show Released Flag
WHEN
Released flag display is requested
THEN
Show the released status indicator for the current element
Context: An array element has been processed and displayed
GIVEN
An array element has been processed and displayed
Applied to: More Elements?
WHEN
The system checks for additional elements
THEN
If more elements exist, continue with the next element, otherwise proceed to array summary display
Context: All array elements have been processed or no elements exist
GIVEN
All array elements have been processed or no elements exist
Applied to: Display Array Summary
WHEN
Array summary display is initiated
THEN
Display total element count and array capacity usage information
Context: Array summary display is being shown
GIVEN
Array summary display is being shown
Applied to: Show Total Element Count
WHEN
Total element count display is requested
THEN
Show the count of elements currently in the status array
Applied to: Show Array Capacity Usage
WHEN
Array capacity usage display is requested
THEN
Show the percentage or ratio of array capacity currently utilized
Context: Debug display has been completed
GIVEN
Debug display has been completed
Applied to: Log Debug Information
WHEN
Debug information logging is initiated
THEN
Record all displayed debug information in the system log
Context: Debug processing has been completed or skipped
GIVEN
Debug processing has been completed or skipped
Applied to: Debug Display Complete
WHEN
Debug display completion is reached
THEN
Finalize debug display and return control to the main processing flow
R-GCX016-cbl-01455 (+19) File: GCX016.cbl Cargo Status Monitoring Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Monitoring':
  • Context - a cargo record exists in the system:
    For Display Cargo Identification:
    When cargo status monitoring is initiated, then the system displays cargo identification including car id, waybill number, and us-ccn status information.
  • Context - a cargo record with car identification exists:
    For Show Car ID Information:
    When car id information is requested for display, then the system shows the car id from the cargo record.
  • Context - a cargo record with waybill information exists:
    For Show Waybill Number:
    When waybill information is requested for display, then the system displays the waybill number from the cargo record.
  • Context - a cargo record with us-ccn information exists:
    For Display US-CCN Status:
    When us-ccn status is requested for display, then the system displays the current us-ccn status from the cargo record.
  • Context - a cargo record with cprs status information exists:
    For Show CPRS Status Description:
    When cprs status description is requested for display, then the system displays the cprs status description from the cargo record.
  • Context - a cargo record with uscs status information exists:
    For Show USCS Status Description:
    When uscs status description is requested for display, then the system displays the uscs status description from the cargo record.
  • Context - a cargo record with quantity information exists:
    For Show Total Quantity:
    When total quantity information is requested for display, then the system displays the total quantity from the cargo record.
  • Context - a cargo record with release quantity information exists:
    For Show Released Quantity:
    When released quantity information is requested for display, then the system displays the released quantity from the cargo record.
  • Context - a cargo record with broker entry number information exists:
    For Show Broker Entry Numbers:
    When broker entry numbers are requested for display, then the system displays the broker entry numbers from the cargo record.
  • Context - a cargo record with disposition code information exists:
    For Show Disposition Code:
    When disposition code is requested for display, then the system displays the disposition code from the cargo status array.
  • Context - a disposition code exists in the cargo status array:
    For Show Code Description:
    When code description is requested for display, then the system retrieves and displays the disposition code description from the disposition code table.
  • Context - a cargo status entry with timestamp information exists:
    For Show Processing Timestamp:
    When processing timestamp is requested for display, then the system displays the processing timestamp from the status array entry.
  • Context - a cargo record with status array exists:
    For Show Array Element Count:
    When status array element count is requested for display, then the system displays the count of elements in the s09a status array.
  • Context - a cargo status array with multiple entries exists:
    For Show Individual Status Entries:
    When individual status entries are requested for display, then the system displays each status entry from the s09a array with its associated details.
  • Context - a cargo record with hold status information exists:
    For Show Hold Location Border/Destination:
    When hold location information is requested for display, then the system displays whether the cargo is held at border location or destination location based on the status array analysis.
  • Context - a cargo record with release status information exists:
    For Show Release Status:
    When release status information is requested for display, then the system displays the release status based on analysis of the status array and release quantities.
  • Context - a cargo record with ptt status information exists:
    For Display PTT Status:
    When ptt status information is requested for display, then the system displays the ptt status based on analysis of the status array and quantity thresholds.
  • Context - a cargo record with proceed status information exists:
    For Show Proceed Status:
    When proceed status information is requested for display, then the system displays the proceed status based on analysis of the status array.
  • Context - a cargo record with arrival or export status information exists:
    For Display Arrival/Export Status:
    When arrival/export status information is requested for display, then the system displays the arrival or export status based on analysis of the status array.
  • Context - all cargo status information has been retrieved and analyzed:
    For Format Status Report:
    When a complete status report is requested, then the system formats all status information including identification, quantities, codes, and status flags into a structured report.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Display Cargo Identification
WHEN
Cargo status monitoring is initiated
THEN
The system displays cargo identification including car ID, waybill number, and US-CCN status information
Context: A cargo record with car identification exists
GIVEN
A cargo record with car identification exists
Applied to: Show Car ID Information
WHEN
Car ID information is requested for display
THEN
The system shows the car ID from the cargo record
Context: A cargo record with waybill information exists
GIVEN
A cargo record with waybill information exists
Applied to: Show Waybill Number
WHEN
Waybill information is requested for display
THEN
The system displays the waybill number from the cargo record
Context: A cargo record with US-CCN information exists
GIVEN
A cargo record with US-CCN information exists
Applied to: Display US-CCN Status
WHEN
US-CCN status is requested for display
THEN
The system displays the current US-CCN status from the cargo record
Context: A cargo record with CPRS status information exists
GIVEN
A cargo record with CPRS status information exists
Applied to: Show CPRS Status Description
WHEN
CPRS status description is requested for display
THEN
The system displays the CPRS status description from the cargo record
Context: A cargo record with USCS status information exists
GIVEN
A cargo record with USCS status information exists
Applied to: Show USCS Status Description
WHEN
USCS status description is requested for display
THEN
The system displays the USCS status description from the cargo record
Context: A cargo record with quantity information exists
GIVEN
A cargo record with quantity information exists
Applied to: Show Total Quantity
WHEN
Total quantity information is requested for display
THEN
The system displays the total quantity from the cargo record
Context: A cargo record with release quantity information exists
GIVEN
A cargo record with release quantity information exists
Applied to: Show Released Quantity
WHEN
Released quantity information is requested for display
THEN
The system displays the released quantity from the cargo record
Context: A cargo record with broker entry number information exists
GIVEN
A cargo record with broker entry number information exists
Applied to: Show Broker Entry Numbers
WHEN
Broker entry numbers are requested for display
THEN
The system displays the broker entry numbers from the cargo record
Context: A cargo record with disposition code information exists
GIVEN
A cargo record with disposition code information exists
Applied to: Show Disposition Code
WHEN
Disposition code is requested for display
THEN
The system displays the disposition code from the cargo status array
Context: A disposition code exists in the cargo status array
GIVEN
A disposition code exists in the cargo status array
Applied to: Show Code Description
WHEN
Code description is requested for display
THEN
The system retrieves and displays the disposition code description from the disposition code table
Context: A cargo status entry with timestamp information exists
GIVEN
A cargo status entry with timestamp information exists
Applied to: Show Processing Timestamp
WHEN
Processing timestamp is requested for display
THEN
The system displays the processing timestamp from the status array entry
Context: A cargo record with status array exists
GIVEN
A cargo record with status array exists
Applied to: Show Array Element Count
WHEN
Status array element count is requested for display
THEN
The system displays the count of elements in the S09A status array
Context: A cargo status array with multiple entries exists
GIVEN
A cargo status array with multiple entries exists
Applied to: Show Individual Status Entries
WHEN
Individual status entries are requested for display
THEN
The system displays each status entry from the S09A array with its associated details
Context: A cargo record with hold status information exists
GIVEN
A cargo record with hold status information exists
Applied to: Show Hold Location Border/Destination
WHEN
Hold location information is requested for display
THEN
The system displays whether the cargo is held at border location or destination location based on the status array analysis
Context: A cargo record with release status information exists
GIVEN
A cargo record with release status information exists
Applied to: Show Release Status
WHEN
Release status information is requested for display
THEN
The system displays the release status based on analysis of the status array and release quantities
Context: A cargo record with PTT status information exists
GIVEN
A cargo record with PTT status information exists
Applied to: Display PTT Status
WHEN
PTT status information is requested for display
THEN
The system displays the PTT status based on analysis of the status array and quantity thresholds
Context: A cargo record with proceed status information exists
GIVEN
A cargo record with proceed status information exists
Applied to: Show Proceed Status
WHEN
Proceed status information is requested for display
THEN
The system displays the proceed status based on analysis of the status array
Context: A cargo record with arrival or export status information exists
GIVEN
A cargo record with arrival or export status information exists
Applied to: Display Arrival/Export Status
WHEN
Arrival/export status information is requested for display
THEN
The system displays the arrival or export status based on analysis of the status array
Context: All cargo status information has been retrieved and analyzed
GIVEN
All cargo status information has been retrieved and analyzed
Applied to: Format Status Report
WHEN
A complete status report is requested
THEN
The system formats all status information including identification, quantities, codes, and status flags into a structured report
R-GCX016-cbl-01475 (+11) File: GCX016.cbl Email Preparation Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email Preparation':
  • Context - a message needs to be processed and routed:
    For Error Message Type:
    When the message type is identified as error or arrcanl (arrival cancellation), then the system should set error message keywords and route the message to both 'in' and 'userr' destinations.
    For Info Message Type:
    When the message type is identified as info, then the system should set info message keywords and route the message to 'in' destination and station-specific merlin ids.
    For Unrelease Message Type:
    When the message type is identified as unrlse (unrelease), then the system should set unrelease message keywords and route the message to cancel-specific merlin ids.
    For Release Message Type:
    When the message type is identified as rlse (release), then the system should set release message keywords and route the message to station-specific merlin ids only.
    For Export Message Type:
    When the message type is identified as export, then the system should set export message keywords and proceed to container type validation for appropriate routing.
  • Context - an export message needs to be routed:
    For Container Type Check:
    When the equipment type is container or trailer, then the system should route the message to usexp baskets for specialized container/trailer processing.
    For Container Type Check:
    When the equipment type is not container or trailer, then the system should route the message to standard export users for general export processing.
  • Context - a message is ready for delivery to a destination user:
    For Validate Destination User:
    When the destination user is validated as valid, then the system should send the message directly to the validated user.
    For Validate Destination User:
    When the destination user is validated as invalid, then the system should reroute the message to the default destination to ensure delivery.
  • Context - a message is prepared for email delivery:
    For Format Subject Line Based on Content:
    When the message content and type are determined, then the system should format an appropriate subject line that reflects the message content and type.
  • Context - a message has been formatted with subject line:
    For Apply Message Categorization:
    When message categorization needs to be applied, then the system should apply the appropriate message category based on message type and content.
  • Context - a message has been categorized and formatted:
    For Prepare Final Email Message:
    When final email preparation is required, then the system should prepare the complete email message with all necessary headers, content, and routing information.
👨‍💻 Technical ACs (Gherkin)
Context: A message needs to be processed and routed
GIVEN
A message needs to be processed and routed
Applied to: Error Message Type
WHEN
The message type is identified as ERROR or ARRCANL (arrival cancellation)
THEN
The system should set error message keywords and route the message to both 'IN' and 'USERR' destinations
Applied to: Info Message Type
WHEN
The message type is identified as INFO
THEN
The system should set info message keywords and route the message to 'IN' destination and station-specific Merlin IDs
Applied to: Unrelease Message Type
WHEN
The message type is identified as UNRLSE (unrelease)
THEN
The system should set unrelease message keywords and route the message to cancel-specific Merlin IDs
Applied to: Release Message Type
WHEN
The message type is identified as RLSE (release)
THEN
The system should set release message keywords and route the message to station-specific Merlin IDs only
Applied to: Export Message Type
WHEN
The message type is identified as EXPORT
THEN
The system should set export message keywords and proceed to container type validation for appropriate routing
Context: An export message needs to be routed
GIVEN
An export message needs to be routed
Applied to: Container Type Check
WHEN
The equipment type is container or trailer
THEN
The system should route the message to USEXP baskets for specialized container/trailer processing
Applied to: Container Type Check
WHEN
The equipment type is not container or trailer
THEN
The system should route the message to standard export users for general export processing
Context: A message is ready for delivery to a destination user
GIVEN
A message is ready for delivery to a destination user
Applied to: Validate Destination User
WHEN
The destination user is validated as valid
THEN
The system should send the message directly to the validated user
Applied to: Validate Destination User
WHEN
The destination user is validated as invalid
THEN
The system should reroute the message to the default destination to ensure delivery
Context: A message is prepared for email delivery
GIVEN
A message is prepared for email delivery
Applied to: Format Subject Line Based on Content
WHEN
The message content and type are determined
THEN
The system should format an appropriate subject line that reflects the message content and type
Context: A message has been formatted with subject line
GIVEN
A message has been formatted with subject line
Applied to: Apply Message Categorization
WHEN
Message categorization needs to be applied
THEN
The system should apply the appropriate message category based on message type and content
Context: A message has been categorized and formatted
GIVEN
A message has been categorized and formatted
Applied to: Prepare Final Email Message
WHEN
Final email preparation is required
THEN
The system should prepare the complete email message with all necessary headers, content, and routing information
R-GCX016-cbl-01502 (+13) File: GCX016.cbl Keyword Management Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Keyword Management':
  • Context - a message type is determined to be an error message:
    For Set Error Message Keywords:
    When the system processes error messages for cargo not found or train processing failures, then the system sets keywords 'cargo_error' for cargo-related errors and 'train_error' for train-related errors to enable proper message routing.
  • Context - a message type is determined to be an informational message:
    For Set Info Message Keywords:
    When the system processes cargo status updates or general information messages, then the system sets keywords 'cargo_info' and 'status_update' to ensure informational messages are routed to appropriate monitoring systems.
  • Context - a message type is determined to be an unrelease message:
    For Set Unrelease Message Keywords:
    When the system processes messages that apply holds to cargo or reverse previous release actions, then the system sets keywords 'unrelease' and 'hold_applied' to ensure hold notifications are properly categorized and routed.
  • Context - a message type is determined to be a release message:
    For Set Release Message Keywords:
    When the system processes messages that release cargo for movement or clear cargo holds, then the system sets keywords 'release' and 'cargo_cleared' to ensure release notifications are properly identified and routed.
  • Context - a message type is determined to be an export message:
    For Set Export Message Keywords:
    When the system processes messages related to cargo export operations or us export procedures, then the system sets keywords 'export' and 'usexp' to ensure export-related messages are properly categorized for customs and export processing systems.
  • Context - a message type is determined to be a hold message:
    For Set Hold Message Keywords:
    When the system processes messages that place cargo on hold for customs examination or inspection, then the system sets keywords 'hold' and 'examination' to ensure hold notifications are properly routed to examination and inspection systems.
  • Context - a message type is determined to be a broker notification:
    For Set Broker Notification Keywords:
    When the system processes messages that notify brokers of quantity mismatches or other cargo-related issues, then the system sets keywords 'broker' and 'quantity_mismatch' to ensure broker notifications are properly categorized and delivered.
  • Context - a message type is determined to be a train operation message:
    For Set Train Operation Keywords:
    When the system processes messages related to train arrivals, train holds, or other train operational events, then the system sets keywords 'train_arrival' and 'train_hold' to ensure train operation messages are properly categorized for train management systems.
  • Context - message keywords have been initially set based on message type:
    For Apply Container Type Keywords:
    When the system identifies the container or equipment type associated with the cargo, then the system applies additional container type keywords to enhance message categorization and routing specificity.
  • Context - container type keywords have been applied to the message:
    For Apply Disposition Code Keywords:
    When the system identifies the disposition code associated with the cargo processing action, then the system applies disposition code keywords to provide additional context for message routing and processing.
  • Context - disposition code keywords have been applied to the message:
    For Apply Cargo Status Keywords:
    When the system determines the current status of the cargo (held, released, in-transit, etc.), then the system applies cargo status keywords to indicate the current state of the cargo for proper message handling.
  • Context - cargo status keywords have been applied to the message:
    For Set Routing Priority Keywords:
    When the system evaluates the urgency and priority level of the message based on cargo status and disposition codes, then the system sets routing priority keywords to ensure high-priority messages are processed and delivered with appropriate urgency.
  • Context - routing priority keywords have been set for the message:
    For Set User Category Keywords:
    When the system determines the appropriate recipient categories (brokers, customs officers, train operators, etc.), then the system sets user category keywords to ensure messages are delivered to the correct recipient groups.
  • Context - user category keywords have been set for the message:
    For Finalize Email Keywords:
    When the system has completed all keyword assignment steps, then the system finalizes the complete set of email keywords to prepare the message for routing and delivery.
👨‍💻 Technical ACs (Gherkin)
Context: A message type is determined to be an error message
GIVEN
A message type is determined to be an error message
Applied to: Set Error Message Keywords
WHEN
The system processes error messages for cargo not found or train processing failures
THEN
The system sets keywords 'CARGO_ERROR' for cargo-related errors and 'TRAIN_ERROR' for train-related errors to enable proper message routing
Context: A message type is determined to be an informational message
GIVEN
A message type is determined to be an informational message
Applied to: Set Info Message Keywords
WHEN
The system processes cargo status updates or general information messages
THEN
The system sets keywords 'CARGO_INFO' and 'STATUS_UPDATE' to ensure informational messages are routed to appropriate monitoring systems
Context: A message type is determined to be an unrelease message
GIVEN
A message type is determined to be an unrelease message
Applied to: Set Unrelease Message Keywords
WHEN
The system processes messages that apply holds to cargo or reverse previous release actions
THEN
The system sets keywords 'UNRELEASE' and 'HOLD_APPLIED' to ensure hold notifications are properly categorized and routed
Context: A message type is determined to be a release message
GIVEN
A message type is determined to be a release message
Applied to: Set Release Message Keywords
WHEN
The system processes messages that release cargo for movement or clear cargo holds
THEN
The system sets keywords 'RELEASE' and 'CARGO_CLEARED' to ensure release notifications are properly identified and routed
Context: A message type is determined to be an export message
GIVEN
A message type is determined to be an export message
Applied to: Set Export Message Keywords
WHEN
The system processes messages related to cargo export operations or US export procedures
THEN
The system sets keywords 'EXPORT' and 'USEXP' to ensure export-related messages are properly categorized for customs and export processing systems
Context: A message type is determined to be a hold message
GIVEN
A message type is determined to be a hold message
Applied to: Set Hold Message Keywords
WHEN
The system processes messages that place cargo on hold for customs examination or inspection
THEN
The system sets keywords 'HOLD' and 'EXAMINATION' to ensure hold notifications are properly routed to examination and inspection systems
Context: A message type is determined to be a broker notification
GIVEN
A message type is determined to be a broker notification
Applied to: Set Broker Notification Keywords
WHEN
The system processes messages that notify brokers of quantity mismatches or other cargo-related issues
THEN
The system sets keywords 'BROKER' and 'QUANTITY_MISMATCH' to ensure broker notifications are properly categorized and delivered
Context: A message type is determined to be a train operation message
GIVEN
A message type is determined to be a train operation message
Applied to: Set Train Operation Keywords
WHEN
The system processes messages related to train arrivals, train holds, or other train operational events
THEN
The system sets keywords 'TRAIN_ARRIVAL' and 'TRAIN_HOLD' to ensure train operation messages are properly categorized for train management systems
Context: Message keywords have been initially set based on message type
GIVEN
Message keywords have been initially set based on message type
Applied to: Apply Container Type Keywords
WHEN
The system identifies the container or equipment type associated with the cargo
THEN
The system applies additional container type keywords to enhance message categorization and routing specificity
Context: Container type keywords have been applied to the message
GIVEN
Container type keywords have been applied to the message
Applied to: Apply Disposition Code Keywords
WHEN
The system identifies the disposition code associated with the cargo processing action
THEN
The system applies disposition code keywords to provide additional context for message routing and processing
Context: Disposition code keywords have been applied to the message
GIVEN
Disposition code keywords have been applied to the message
Applied to: Apply Cargo Status Keywords
WHEN
The system determines the current status of the cargo (held, released, in-transit, etc.)
THEN
The system applies cargo status keywords to indicate the current state of the cargo for proper message handling
Context: Cargo status keywords have been applied to the message
GIVEN
Cargo status keywords have been applied to the message
Applied to: Set Routing Priority Keywords
WHEN
The system evaluates the urgency and priority level of the message based on cargo status and disposition codes
THEN
The system sets routing priority keywords to ensure high-priority messages are processed and delivered with appropriate urgency
Context: Routing priority keywords have been set for the message
GIVEN
Routing priority keywords have been set for the message
Applied to: Set User Category Keywords
WHEN
The system determines the appropriate recipient categories (brokers, customs officers, train operators, etc.)
THEN
The system sets user category keywords to ensure messages are delivered to the correct recipient groups
Context: User category keywords have been set for the message
GIVEN
User category keywords have been set for the message
Applied to: Finalize Email Keywords
WHEN
The system has completed all keyword assignment steps
THEN
The system finalizes the complete set of email keywords to prepare the message for routing and delivery
R-GCX016-cbl-01516 (+5) File: GCX016.cbl Subject Line Formatting Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Subject Line Formatting':
  • Context - an email message needs to be prepared for sending:
    For Determine Message Type:
    When the system evaluates the message content and context, then the message type is determined as one of: error, info, release, hold, export, or unrelease.
  • Context - a message has been classified as an error or arrival cancellation type:
    For Error Message Subject:
    When the message routing process is executed, then the message is sent to both 'in' and 'userr' destinations with error-specific subject formatting.
  • Context - a message has been classified as an informational type:
    For Info Message Subject:
    When the message routing process is executed, then the message is sent to 'in' destination and station-specific merlin ids with info-specific subject formatting.
  • Context - a message has been classified as a release type:
    For Release Message Subject:
    When the message routing process is executed, then the message is sent to station-specific merlin ids only with release-specific subject formatting.
  • Context - a message has been classified as an unrelease type:
    For Unrelease Message Subject:
    When the message routing process is executed, then the message is sent to default and cancel-specific merlin ids with unrelease-specific subject formatting.
  • Context - a message has been classified as an export type:
    For Export Message Subject:
    When the message routing process is executed and equipment type is validated, then the message is sent with export-specific subject formatting after equipment type validation.
👨‍💻 Technical ACs (Gherkin)
Context: An email message needs to be prepared for sending
GIVEN
An email message needs to be prepared for sending
Applied to: Determine Message Type
WHEN
The system evaluates the message content and context
THEN
The message type is determined as one of: Error, Info, Release, Hold, Export, or Unrelease
Context: A message has been classified as an error or arrival cancellation type
GIVEN
A message has been classified as an error or arrival cancellation type
Applied to: Error Message Subject
WHEN
The message routing process is executed
THEN
The message is sent to both 'IN' and 'USERR' destinations with error-specific subject formatting
Context: A message has been classified as an informational type
GIVEN
A message has been classified as an informational type
Applied to: Info Message Subject
WHEN
The message routing process is executed
THEN
The message is sent to 'IN' destination and station-specific Merlin IDs with info-specific subject formatting
Context: A message has been classified as a release type
GIVEN
A message has been classified as a release type
Applied to: Release Message Subject
WHEN
The message routing process is executed
THEN
The message is sent to station-specific Merlin IDs only with release-specific subject formatting
Context: A message has been classified as an unrelease type
GIVEN
A message has been classified as an unrelease type
Applied to: Unrelease Message Subject
WHEN
The message routing process is executed
THEN
The message is sent to default and cancel-specific Merlin IDs with unrelease-specific subject formatting
Context: A message has been classified as an export type
GIVEN
A message has been classified as an export type
Applied to: Export Message Subject
WHEN
The message routing process is executed and equipment type is validated
THEN
The message is sent with export-specific subject formatting after equipment type validation
R-GCX016-cbl-01522 (+13) File: GCX016.cbl Error Message Routing Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Message Routing':
  • Context - a message has been generated for routing:
    For Message Type?:
    When the system evaluates the message type, then the message is classified as error, info, unrelease, release, or export type for appropriate routing.
  • Context - a message has been classified as an error type (error or arrcanl):
    For Set Error Message Routing:
    When the system configures routing destinations, then the message is set to route to both 'in' destination and 'userr' destination.
  • Context - a message has been classified as info type:
    For Set Info Message Routing:
    When the system configures routing destinations, then the message is set to route to 'in' destination and station-specific merlin ids.
  • Context - a message has been classified as unrelease type:
    For Set Unrelease Message Routing:
    When the system configures routing destinations, then the message is set to route with default merlin ids and cancel-specific merlin ids.
  • Context - a message has been classified as release type:
    For Set Release Message Routing:
    When the system configures routing destinations, then the message is set to route to station-specific merlin ids only.
  • Context - a message has been classified as export type:
    For Set Export Message Routing:
    When the system configures routing destinations, then equipment type validation is performed before setting routing destinations.
  • Context - destination user codes have been determined for message routing:
    For User Code Valid?:
    When the system validates the user codes, then valid user codes proceed to primary destination routing and invalid user codes are handled by the invalid user handler.
  • Context - a user code has been determined to be invalid:
    For Route to Invalid User Handler:
    When the system processes the invalid user code, then a default user code is set and the message is routed to multiple destinations.
  • Context - a user code has been validated as valid:
    For Route to Primary Destination:
    When the system routes the message, then the message is routed to multiple destinations using the valid user code.
  • Context - a message is being routed to multiple destinations:
    For Container Type Specific?:
    When the system evaluates if the message is container type specific, then container type specific messages are routed to usexp basket and non-container type messages are routed to standard basket.
  • Context - a message has been determined to be container type specific:
    For Route to USEXP Basket:
    When the system routes the export message, then the message is routed to the usexp basket for specialized container processing.
  • Context - a message has been determined to be non-container type specific:
    For Route to Standard Basket:
    When the system routes the message, then the message is routed to the standard basket for general processing.
  • Context - a message has been routed to its destination basket:
    For Set Message Keywords:
    When the system processes the message for final formatting, then appropriate keywords are assigned to the message for categorization.
  • Context - message keywords have been set:
    For Format Subject Line:
    When the system formats the message for delivery, then the subject line is formatted according to the message type and content requirements.
👨‍💻 Technical ACs (Gherkin)
Context: A message has been generated for routing
GIVEN
A message has been generated for routing
Applied to: Message Type?
WHEN
The system evaluates the message type
THEN
The message is classified as Error, Info, Unrelease, Release, or Export type for appropriate routing
Context: A message has been classified as an error type (ERROR or ARRCANL)
GIVEN
A message has been classified as an error type (ERROR or ARRCANL)
Applied to: Set Error Message Routing
WHEN
The system configures routing destinations
THEN
The message is set to route to both 'IN' destination and 'USERR' destination
Context: A message has been classified as info type
GIVEN
A message has been classified as info type
Applied to: Set Info Message Routing
WHEN
The system configures routing destinations
THEN
The message is set to route to 'IN' destination and station-specific Merlin IDs
Context: A message has been classified as unrelease type
GIVEN
A message has been classified as unrelease type
Applied to: Set Unrelease Message Routing
WHEN
The system configures routing destinations
THEN
The message is set to route with default Merlin IDs and cancel-specific Merlin IDs
Context: A message has been classified as release type
GIVEN
A message has been classified as release type
Applied to: Set Release Message Routing
WHEN
The system configures routing destinations
THEN
The message is set to route to station-specific Merlin IDs only
Context: A message has been classified as export type
GIVEN
A message has been classified as export type
Applied to: Set Export Message Routing
WHEN
The system configures routing destinations
THEN
Equipment type validation is performed before setting routing destinations
Context: Destination user codes have been determined for message routing
GIVEN
Destination user codes have been determined for message routing
Applied to: User Code Valid?
WHEN
The system validates the user codes
THEN
Valid user codes proceed to primary destination routing and invalid user codes are handled by the invalid user handler
Context: A user code has been determined to be invalid
GIVEN
A user code has been determined to be invalid
Applied to: Route to Invalid User Handler
WHEN
The system processes the invalid user code
THEN
A default user code is set and the message is routed to multiple destinations
Context: A user code has been validated as valid
GIVEN
A user code has been validated as valid
Applied to: Route to Primary Destination
WHEN
The system routes the message
THEN
The message is routed to multiple destinations using the valid user code
Context: A message is being routed to multiple destinations
GIVEN
A message is being routed to multiple destinations
Applied to: Container Type Specific?
WHEN
The system evaluates if the message is container type specific
THEN
Container type specific messages are routed to USEXP basket and non-container type messages are routed to standard basket
Context: A message has been determined to be container type specific
GIVEN
A message has been determined to be container type specific
Applied to: Route to USEXP Basket
WHEN
The system routes the export message
THEN
The message is routed to the USEXP basket for specialized container processing
Context: A message has been determined to be non-container type specific
GIVEN
A message has been determined to be non-container type specific
Applied to: Route to Standard Basket
WHEN
The system routes the message
THEN
The message is routed to the standard basket for general processing
Context: A message has been routed to its destination basket
GIVEN
A message has been routed to its destination basket
Applied to: Set Message Keywords
WHEN
The system processes the message for final formatting
THEN
Appropriate keywords are assigned to the message for categorization
Context: Message keywords have been set
GIVEN
Message keywords have been set
Applied to: Format Subject Line
WHEN
The system formats the message for delivery
THEN
The subject line is formatted according to the message type and content requirements
R-GCX016-cbl-01536 (+8) File: GCX016.cbl Info Message Distribution Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Info Message Distribution':
  • Context - a message is ready for distribution:
    For Message Type = INFO?:
    When the system checks the message type, then if message type equals info, proceed with info message distribution, otherwise skip info message processing.
  • Context - message type is confirmed as info:
    For Retrieve Configured User List:
    When the system needs to identify message recipients, then retrieve configured user list from gcstbrt user configuration table for info message distribution.
  • Context - configured user list has been retrieved:
    For Set Message Keywords for Categorization:
    When the system prepares the message for distribution, then set message keywords and categories based on message routing tables to enable proper message classification.
  • Context - message keywords have been set for categorization:
    For Format Subject Line for Info Message:
    When the system prepares the message subject line, then format subject line for info message according to business message formatting standards.
  • Context - subject line has been formatted for the info message:
    For User Valid?:
    When the system processes each user in the configured user list, then if user is valid and active, proceed to send message to user, otherwise route to default user with notification.
  • Context - user has been validated as valid and active:
    For Send Message to Configured User:
    When the system delivers the informational message, then send message to the configured valid user.
  • Context - user has been validated as invalid or inactive:
    For Route to Default User with Notification:
    When the system needs to deliver the informational message, then route message to default user and include notification about invalid user configuration.
  • Context - message has been sent to current user or routed to default user:
    For More Users to Process?:
    When the system checks for remaining users in the list, then if more users exist in configured list, continue processing next user, otherwise proceed to message distribution logging.
  • Context - all configured users have been processed for message delivery:
    For Log Message Distribution:
    When the system completes info message distribution, then log message distribution details including recipients and delivery status.
👨‍💻 Technical ACs (Gherkin)
Context: A message is ready for distribution
GIVEN
A message is ready for distribution
Applied to: Message Type = INFO?
WHEN
The system checks the message type
THEN
If message type equals INFO, proceed with info message distribution, otherwise skip info message processing
Context: Message type is confirmed as INFO
GIVEN
Message type is confirmed as INFO
Applied to: Retrieve Configured User List
WHEN
The system needs to identify message recipients
THEN
Retrieve configured user list from GCSTBRT user configuration table for info message distribution
Context: Configured user list has been retrieved
GIVEN
Configured user list has been retrieved
Applied to: Set Message Keywords for Categorization
WHEN
The system prepares the message for distribution
THEN
Set message keywords and categories based on message routing tables to enable proper message classification
Context: Message keywords have been set for categorization
GIVEN
Message keywords have been set for categorization
Applied to: Format Subject Line for Info Message
WHEN
The system prepares the message subject line
THEN
Format subject line for info message according to business message formatting standards
Context: Subject line has been formatted for the info message
GIVEN
Subject line has been formatted for the info message
Applied to: User Valid?
WHEN
The system processes each user in the configured user list
THEN
If user is valid and active, proceed to send message to user, otherwise route to default user with notification
Context: User has been validated as valid and active
GIVEN
User has been validated as valid and active
Applied to: Send Message to Configured User
WHEN
The system delivers the informational message
THEN
Send message to the configured valid user
Context: User has been validated as invalid or inactive
GIVEN
User has been validated as invalid or inactive
Applied to: Route to Default User with Notification
WHEN
The system needs to deliver the informational message
THEN
Route message to default user and include notification about invalid user configuration
Context: Message has been sent to current user or routed to default user
GIVEN
Message has been sent to current user or routed to default user
Applied to: More Users to Process?
WHEN
The system checks for remaining users in the list
THEN
If more users exist in configured list, continue processing next user, otherwise proceed to message distribution logging
Context: All configured users have been processed for message delivery
GIVEN
All configured users have been processed for message delivery
Applied to: Log Message Distribution
WHEN
The system completes info message distribution
THEN
Log message distribution details including recipients and delivery status
R-GCX016-cbl-01545 (+16) File: GCX016.cbl Unrelease Message Routing Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Unrelease Message Routing':
  • Context - a message has been received for processing:
    For Message Type = Unrelease?:
    When the system evaluates the message type, then the system identifies whether the message is an unrelease type and routes accordingly or completes processing for non-unrelease messages.
  • Context - an unrelease message type has been detected:
    For Set Unrelease Message Keywords:
    When the system prepares the message for routing, then the system sets appropriate unrelease-specific keywords and message identifiers.
  • Context - unrelease message keywords have been set:
    For Determine Target Baskets:
    When the system evaluates routing requirements, then the system determines the appropriate target baskets for message delivery.
  • Context - target baskets have been determined for the unrelease message:
    For Multiple Destinations?:
    When the system evaluates the number of required destinations, then the system routes to either a single primary basket or multiple baskets based on the destination count.
  • Context - the system has determined single destination routing is required:
    For Route to Primary Basket:
    When the primary basket has been identified, then the system routes the unrelease message to the primary basket only.
  • Context - the system has determined multiple destination routing is required:
    For Route to Multiple Baskets:
    When multiple target baskets have been identified, then the system routes the unrelease message to all designated baskets.
  • Context - basket routing has been determined for the unrelease message:
    For User ID Valid?:
    When the system evaluates the user id for routing, then the system routes to the specified user if valid or to the default user if invalid.
  • Context - the user id has been validated as valid:
    For Route to Specified User:
    When the system processes user-specific routing, then the system routes the unrelease message to the specified user.
  • Context - the user id has been validated as invalid:
    For Route to Default User:
    When the system processes default routing, then the system routes the unrelease message to the default user.
  • Context - user routing has been determined (either specified or default user):
    For Add User Code to Routing:
    When the system prepares routing information, then the system adds the appropriate user code to the message routing configuration.
  • Context - primary user code has been added to routing:
    For Additional Users Required?:
    When the system evaluates additional user requirements, then the system either adds secondary users or proceeds to set message priority based on requirements.
  • Context - the system has determined additional users are required:
    For Add Secondary Users:
    When secondary users are identified, then the system adds all required secondary users to the message routing.
  • Context - all required users have been added to routing:
    For Set Message Priority:
    When the system configures message properties, then the system sets the appropriate priority level for the unrelease message.
  • Context - message priority has been set for the unrelease message:
    For Format Subject Line for Unrelease:
    When the system prepares the message for delivery, then the system formats the subject line with unrelease-specific information and identifiers.
  • Context - the unrelease message has been fully formatted with subject line:
    For Send Message to Basket:
    When the system executes message delivery, then the system sends the message to all designated baskets and users.
  • Context - the unrelease message has been sent to designated baskets:
    For Log Message Routing:
    When the system completes message delivery, then the system logs the routing activity including destinations, users, and delivery status.
  • Context - message routing has been logged successfully:
    For Message Routing Complete:
    When all routing activities are complete, then the system marks the unrelease message routing as complete and returns control to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A message has been received for processing
GIVEN
A message has been received for processing
Applied to: Message Type = Unrelease?
WHEN
The system evaluates the message type
THEN
The system identifies whether the message is an unrelease type and routes accordingly or completes processing for non-unrelease messages
Context: An unrelease message type has been detected
GIVEN
An unrelease message type has been detected
Applied to: Set Unrelease Message Keywords
WHEN
The system prepares the message for routing
THEN
The system sets appropriate unrelease-specific keywords and message identifiers
Context: Unrelease message keywords have been set
GIVEN
Unrelease message keywords have been set
Applied to: Determine Target Baskets
WHEN
The system evaluates routing requirements
THEN
The system determines the appropriate target baskets for message delivery
Context: Target baskets have been determined for the unrelease message
GIVEN
Target baskets have been determined for the unrelease message
Applied to: Multiple Destinations?
WHEN
The system evaluates the number of required destinations
THEN
The system routes to either a single primary basket or multiple baskets based on the destination count
Context: The system has determined single destination routing is required
GIVEN
The system has determined single destination routing is required
Applied to: Route to Primary Basket
WHEN
The primary basket has been identified
THEN
The system routes the unrelease message to the primary basket only
Context: The system has determined multiple destination routing is required
GIVEN
The system has determined multiple destination routing is required
Applied to: Route to Multiple Baskets
WHEN
Multiple target baskets have been identified
THEN
The system routes the unrelease message to all designated baskets
Context: Basket routing has been determined for the unrelease message
GIVEN
Basket routing has been determined for the unrelease message
Applied to: User ID Valid?
WHEN
The system evaluates the user ID for routing
THEN
The system routes to the specified user if valid or to the default user if invalid
Context: The user ID has been validated as valid
GIVEN
The user ID has been validated as valid
Applied to: Route to Specified User
WHEN
The system processes user-specific routing
THEN
The system routes the unrelease message to the specified user
Context: The user ID has been validated as invalid
GIVEN
The user ID has been validated as invalid
Applied to: Route to Default User
WHEN
The system processes default routing
THEN
The system routes the unrelease message to the default user
Context: User routing has been determined (either specified or default user)
GIVEN
User routing has been determined (either specified or default user)
Applied to: Add User Code to Routing
WHEN
The system prepares routing information
THEN
The system adds the appropriate user code to the message routing configuration
Context: Primary user code has been added to routing
GIVEN
Primary user code has been added to routing
Applied to: Additional Users Required?
WHEN
The system evaluates additional user requirements
THEN
The system either adds secondary users or proceeds to set message priority based on requirements
Context: The system has determined additional users are required
GIVEN
The system has determined additional users are required
Applied to: Add Secondary Users
WHEN
Secondary users are identified
THEN
The system adds all required secondary users to the message routing
Context: All required users have been added to routing
GIVEN
All required users have been added to routing
Applied to: Set Message Priority
WHEN
The system configures message properties
THEN
The system sets the appropriate priority level for the unrelease message
Context: Message priority has been set for the unrelease message
GIVEN
Message priority has been set for the unrelease message
Applied to: Format Subject Line for Unrelease
WHEN
The system prepares the message for delivery
THEN
The system formats the subject line with unrelease-specific information and identifiers
Context: The unrelease message has been fully formatted with subject line
GIVEN
The unrelease message has been fully formatted with subject line
Applied to: Send Message to Basket
WHEN
The system executes message delivery
THEN
The system sends the message to all designated baskets and users
Context: The unrelease message has been sent to designated baskets
GIVEN
The unrelease message has been sent to designated baskets
Applied to: Log Message Routing
WHEN
The system completes message delivery
THEN
The system logs the routing activity including destinations, users, and delivery status
Context: Message routing has been logged successfully
GIVEN
Message routing has been logged successfully
Applied to: Message Routing Complete
WHEN
All routing activities are complete
THEN
The system marks the unrelease message routing as complete and returns control to the calling process
R-GCX016-cbl-01562 (+19) File: GCX016.cbl Release Message Distribution Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Message Distribution':
  • Context - a release message has been generated for cargo processing:
    For Message Type Check:
    When the system evaluates the message content and cargo status, then the message is classified as either release, export, arrival, or cancellation type for proper routing.
  • Context - the message type has been determined from cargo status evaluation:
    For Set Release Message Type:
    When the system processes the release action (release, export, arrival, or cancellation), then the appropriate message type flag is set to control downstream message formatting and routing.
  • Context - a release message type has been set and cargo broker information is available:
    For Determine Target Users:
    When the system evaluates broker configuration and payer of freight details, then target users are identified including cargo broker, payer of freight broker, and configured notification recipients.
  • Context - target users have been identified for release notification:
    For User Configuration Valid?:
    When the system checks user notification preferences and contact information, then users with valid configurations are approved for notification while invalid configurations trigger default routing.
  • Context - target users have been validated and have proper notification configurations:
    For Route to Configured Users:
    When the system processes the release message for delivery, then messages are routed to configured users based on their notification preferences.
  • Context - target users have been identified but lack valid notification configurations:
    For Route to Default Users:
    When the system attempts to deliver release notifications, then messages are routed to default notification recipients to ensure delivery.
  • Context - target users have been determined and routing decisions made:
    For Email or Merlin?:
    When the system evaluates user notification preferences and message characteristics, then the appropriate delivery method (email or merlin) is selected for each recipient.
  • Context - email delivery method has been selected for release notification:
    For Prepare Email Message:
    When the system prepares the message for email transmission, then email headers, subject line, and message body are formatted according to email standards.
  • Context - merlin delivery method has been selected for release notification:
    For Prepare Merlin Message:
    When the system prepares the message for merlin transmission, then merlin message format, routing codes, and destination identifiers are properly configured.
  • Context - message delivery method has been determined and basic message structure prepared:
    For Set Message Keywords:
    When the system processes message content for keyword assignment, then relevant keywords are assigned based on message type, cargo details, and disposition codes.
  • Context - message keywords have been set and cargo information is available:
    For Format Subject Line:
    When the system formats the message subject line, then subject line includes cargo identifier, disposition code, and action type for easy identification.
  • Context - message subject line has been formatted and cargo data is accessible:
    For Add Cargo Details:
    When the system adds cargo details to the message body, then cargo details including ccn, car id, waybill number, and shipment information are included in the message.
  • Context - cargo details have been added to the message and disposition codes are available:
    For Add Disposition Codes:
    When the system processes disposition code information for inclusion, then disposition codes and their business descriptions are added to provide context for the release action.
  • Context - disposition codes have been added and quantity information is available from cargo processing:
    For Add Quantity Information:
    When the system adds quantity details to the release message, then released quantities, total quantities, and remaining quantities are included to show the impact of the release action.
  • Context - quantity information has been added and k1 segment data is available:
    For Add K1 Comments:
    When the system processes k1 comments for message inclusion, then k1 remarks and special comments are added to provide additional context and instructions.
  • Context - release message has been fully formatted with all required information:
    For Send to Release Basket:
    When the system processes the message for release basket distribution, then message is sent to the release basket for general access and record keeping.
  • Context - message has been sent to release basket and broker information is available:
    For Send to Broker:
    When the system processes broker notification requirements, then release message is sent directly to the cargo broker using their configured notification method.
  • Context - broker notification has been completed and payer of freight information is available:
    For Send to Payer of Freight:
    When the system evaluates payer of freight notification requirements, then release message is sent to the payer of freight if they differ from the cargo broker.
  • Context - all release message distributions have been completed:
    For Log Message Distribution:
    When the system processes logging requirements for the distribution activity, then distribution details including recipients, delivery methods, and timestamps are logged for audit purposes.
  • Context - all message distributions have been completed and logged:
    For Message Distribution Complete:
    When the system finalizes the distribution process, then distribution process is marked as complete and control returns to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A release message has been generated for cargo processing
GIVEN
A release message has been generated for cargo processing
Applied to: Message Type Check
WHEN
The system evaluates the message content and cargo status
THEN
The message is classified as either release, export, arrival, or cancellation type for proper routing
Context: The message type has been determined from cargo status evaluation
GIVEN
The message type has been determined from cargo status evaluation
Applied to: Set Release Message Type
WHEN
The system processes the release action (release, export, arrival, or cancellation)
THEN
The appropriate message type flag is set to control downstream message formatting and routing
Context: A release message type has been set and cargo broker information is available
GIVEN
A release message type has been set and cargo broker information is available
Applied to: Determine Target Users
WHEN
The system evaluates broker configuration and payer of freight details
THEN
Target users are identified including cargo broker, payer of freight broker, and configured notification recipients
Context: Target users have been identified for release notification
GIVEN
Target users have been identified for release notification
Applied to: User Configuration Valid?
WHEN
The system checks user notification preferences and contact information
THEN
Users with valid configurations are approved for notification while invalid configurations trigger default routing
Context: Target users have been validated and have proper notification configurations
GIVEN
Target users have been validated and have proper notification configurations
Applied to: Route to Configured Users
WHEN
The system processes the release message for delivery
THEN
Messages are routed to configured users based on their notification preferences
Context: Target users have been identified but lack valid notification configurations
GIVEN
Target users have been identified but lack valid notification configurations
Applied to: Route to Default Users
WHEN
The system attempts to deliver release notifications
THEN
Messages are routed to default notification recipients to ensure delivery
Context: Target users have been determined and routing decisions made
GIVEN
Target users have been determined and routing decisions made
Applied to: Email or Merlin?
WHEN
The system evaluates user notification preferences and message characteristics
THEN
The appropriate delivery method (email or Merlin) is selected for each recipient
Context: Email delivery method has been selected for release notification
GIVEN
Email delivery method has been selected for release notification
Applied to: Prepare Email Message
WHEN
The system prepares the message for email transmission
THEN
Email headers, subject line, and message body are formatted according to email standards
Context: Merlin delivery method has been selected for release notification
GIVEN
Merlin delivery method has been selected for release notification
Applied to: Prepare Merlin Message
WHEN
The system prepares the message for Merlin transmission
THEN
Merlin message format, routing codes, and destination identifiers are properly configured
Context: Message delivery method has been determined and basic message structure prepared
GIVEN
Message delivery method has been determined and basic message structure prepared
Applied to: Set Message Keywords
WHEN
The system processes message content for keyword assignment
THEN
Relevant keywords are assigned based on message type, cargo details, and disposition codes
Context: Message keywords have been set and cargo information is available
GIVEN
Message keywords have been set and cargo information is available
Applied to: Format Subject Line
WHEN
The system formats the message subject line
THEN
Subject line includes cargo identifier, disposition code, and action type for easy identification
Context: Message subject line has been formatted and cargo data is accessible
GIVEN
Message subject line has been formatted and cargo data is accessible
Applied to: Add Cargo Details
WHEN
The system adds cargo details to the message body
THEN
Cargo details including CCN, car ID, waybill number, and shipment information are included in the message
Context: Cargo details have been added to the message and disposition codes are available
GIVEN
Cargo details have been added to the message and disposition codes are available
Applied to: Add Disposition Codes
WHEN
The system processes disposition code information for inclusion
THEN
Disposition codes and their business descriptions are added to provide context for the release action
Context: Disposition codes have been added and quantity information is available from cargo processing
GIVEN
Disposition codes have been added and quantity information is available from cargo processing
Applied to: Add Quantity Information
WHEN
The system adds quantity details to the release message
THEN
Released quantities, total quantities, and remaining quantities are included to show the impact of the release action
Context: Quantity information has been added and K1 segment data is available
GIVEN
Quantity information has been added and K1 segment data is available
Applied to: Add K1 Comments
WHEN
The system processes K1 comments for message inclusion
THEN
K1 remarks and special comments are added to provide additional context and instructions
Context: Release message has been fully formatted with all required information
GIVEN
Release message has been fully formatted with all required information
Applied to: Send to Release Basket
WHEN
The system processes the message for release basket distribution
THEN
Message is sent to the release basket for general access and record keeping
Context: Message has been sent to release basket and broker information is available
GIVEN
Message has been sent to release basket and broker information is available
Applied to: Send to Broker
WHEN
The system processes broker notification requirements
THEN
Release message is sent directly to the cargo broker using their configured notification method
Context: Broker notification has been completed and payer of freight information is available
GIVEN
Broker notification has been completed and payer of freight information is available
Applied to: Send to Payer of Freight
WHEN
The system evaluates payer of freight notification requirements
THEN
Release message is sent to the payer of freight if they differ from the cargo broker
Context: All release message distributions have been completed
GIVEN
All release message distributions have been completed
Applied to: Log Message Distribution
WHEN
The system processes logging requirements for the distribution activity
THEN
Distribution details including recipients, delivery methods, and timestamps are logged for audit purposes
Context: All message distributions have been completed and logged
GIVEN
All message distributions have been completed and logged
Applied to: Message Distribution Complete
WHEN
The system finalizes the distribution process
THEN
Distribution process is marked as complete and control returns to the calling process
R-GCX016-cbl-01582 (+7) File: GCX016.cbl Export Message Routing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Message Routing':
  • Context - an export message is generated for cargo processing:
    For Check Container Type:
    When the system evaluates the container type from the cargo record, then the container type is identified and categorized for routing decisions.
  • Context - a container type has been identified from the cargo record:
    For Container Type Matches USEXP Criteria?:
    When the container type is evaluated against usexp routing criteria for export containers, special equipment, or regulated cargo, then the system routes to usexp basket if criteria match, otherwise routes to standard export processing.
  • Context - a container has been qualified for usexp basket routing:
    For Set Export Message Keywords:
    When the system prepares the export message for usexp processing, then appropriate export message keywords are set based on container type and export requirements.
  • Context - export message keywords have been set for usexp processing:
    For Format Export Message Content:
    When the system formats the message content with cargo details, container information, and export requirements, then the export message is properly formatted with all required fields for usexp basket processing.
  • Context - export message content has been formatted for usexp processing:
    For Determine Destination Basket:
    When the system evaluates export processing type, customs clearance requirements, and documentation needs, then the appropriate usexp basket is selected from export processing, customs clearance, or documentation baskets.
  • Context - the destination usexp basket has been determined and message is formatted:
    For Send to USEXP Processing:
    When the system transmits the export message to the selected usexp basket, then the export message is successfully sent to usexp processing for customs clearance and documentation.
  • Context - a container type does not match usexp routing criteria:
    For Route to Standard Export Processing:
    When the system processes the export message for non-usexp qualified containers, then the export message is routed to standard export processing workflows.
  • Context - an export message has been routed to either usexp or standard processing:
    For Log Export Message Routing:
    When the routing decision is completed, then the system logs the routing decision, destination, container type, and processing path for audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: An export message is generated for cargo processing
GIVEN
An export message is generated for cargo processing
Applied to: Check Container Type
WHEN
The system evaluates the container type from the cargo record
THEN
The container type is identified and categorized for routing decisions
Context: A container type has been identified from the cargo record
GIVEN
A container type has been identified from the cargo record
Applied to: Container Type Matches USEXP Criteria?
WHEN
The container type is evaluated against USEXP routing criteria for export containers, special equipment, or regulated cargo
THEN
The system routes to USEXP basket if criteria match, otherwise routes to standard export processing
Context: A container has been qualified for USEXP basket routing
GIVEN
A container has been qualified for USEXP basket routing
Applied to: Set Export Message Keywords
WHEN
The system prepares the export message for USEXP processing
THEN
Appropriate export message keywords are set based on container type and export requirements
Context: Export message keywords have been set for USEXP processing
GIVEN
Export message keywords have been set for USEXP processing
Applied to: Format Export Message Content
WHEN
The system formats the message content with cargo details, container information, and export requirements
THEN
The export message is properly formatted with all required fields for USEXP basket processing
Context: Export message content has been formatted for USEXP processing
GIVEN
Export message content has been formatted for USEXP processing
Applied to: Determine Destination Basket
WHEN
The system evaluates export processing type, customs clearance requirements, and documentation needs
THEN
The appropriate USEXP basket is selected from export processing, customs clearance, or documentation baskets
Context: The destination USEXP basket has been determined and message is formatted
GIVEN
The destination USEXP basket has been determined and message is formatted
Applied to: Send to USEXP Processing
WHEN
The system transmits the export message to the selected USEXP basket
THEN
The export message is successfully sent to USEXP processing for customs clearance and documentation
Context: A container type does not match USEXP routing criteria
GIVEN
A container type does not match USEXP routing criteria
Applied to: Route to Standard Export Processing
WHEN
The system processes the export message for non-USEXP qualified containers
THEN
The export message is routed to standard export processing workflows
Context: An export message has been routed to either USEXP or standard processing
GIVEN
An export message has been routed to either USEXP or standard processing
Applied to: Log Export Message Routing
WHEN
The routing decision is completed
THEN
The system logs the routing decision, destination, container type, and processing path for audit purposes
R-GCX016-cbl-01590 (+9) File: GCX016.cbl Invalid User Handling Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Invalid User Handling':
  • Context - a message is ready for routing with a destination user id:
    For Check Destination User Valid?:
    When the system checks if the destination user id is valid, then the system determines whether the user exists in the system or not.
  • Context - a message needs to be routed and the destination user id exists in the system:
    For Route Message to Original User:
    When the user validation check passes, then the message is routed to the original intended user.
  • Context - a message needs to be routed but the destination user id does not exist in the system:
    For Identify Message Type:
    When the user validation check fails, then the system identifies the message type for appropriate rerouting.
  • Context - a message is identified as an error message and the original destination user is invalid:
    For Route to Default Error Users:
    When the message type is determined to be an error message, then the message is routed to the default error users.
  • Context - a message is identified as an info message and the original destination user is invalid:
    For Route to Default Info Users:
    When the message type is determined to be an informational message, then the message is routed to the default info users.
  • Context - a message is identified as a release message and the original destination user is invalid:
    For Route to Default Release Users:
    When the message type is determined to be a release message, then the message is routed to the default release users.
  • Context - a message is identified as an export message and the original destination user is invalid:
    For Route to Default Export Users:
    When the message type is determined to be an export message, then the message is routed to the default export users.
  • Context - a message has been rerouted due to invalid destination user:
    For Log Invalid User Notification:
    When the message rerouting is completed, then the system logs an invalid user notification for audit purposes.
  • Context - an invalid user notification has been logged:
    For Update Message Routing History:
    When the logging process is completed, then the system updates the message routing history with the rerouting details.
  • Context - the message routing history has been updated for an invalid user rerouting:
    For Send Notification to System Admin:
    When the routing history update is completed, then a notification is sent to the system administrator about the invalid user incident.
👨‍💻 Technical ACs (Gherkin)
Context: A message is ready for routing with a destination user ID
GIVEN
A message is ready for routing with a destination user ID
Applied to: Check Destination User Valid?
WHEN
The system checks if the destination user ID is valid
THEN
The system determines whether the user exists in the system or not
Context: A message needs to be routed and the destination user ID exists in the system
GIVEN
A message needs to be routed and the destination user ID exists in the system
Applied to: Route Message to Original User
WHEN
The user validation check passes
THEN
The message is routed to the original intended user
Context: A message needs to be routed but the destination user ID does not exist in the system
GIVEN
A message needs to be routed but the destination user ID does not exist in the system
Applied to: Identify Message Type
WHEN
The user validation check fails
THEN
The system identifies the message type for appropriate rerouting
Context: A message is identified as an error message and the original destination user is invalid
GIVEN
A message is identified as an error message and the original destination user is invalid
Applied to: Route to Default Error Users
WHEN
The message type is determined to be an error message
THEN
The message is routed to the default error users
Context: A message is identified as an info message and the original destination user is invalid
GIVEN
A message is identified as an info message and the original destination user is invalid
Applied to: Route to Default Info Users
WHEN
The message type is determined to be an informational message
THEN
The message is routed to the default info users
Context: A message is identified as a release message and the original destination user is invalid
GIVEN
A message is identified as a release message and the original destination user is invalid
Applied to: Route to Default Release Users
WHEN
The message type is determined to be a release message
THEN
The message is routed to the default release users
Context: A message is identified as an export message and the original destination user is invalid
GIVEN
A message is identified as an export message and the original destination user is invalid
Applied to: Route to Default Export Users
WHEN
The message type is determined to be an export message
THEN
The message is routed to the default export users
Context: A message has been rerouted due to invalid destination user
GIVEN
A message has been rerouted due to invalid destination user
Applied to: Log Invalid User Notification
WHEN
The message rerouting is completed
THEN
The system logs an invalid user notification for audit purposes
Context: An invalid user notification has been logged
GIVEN
An invalid user notification has been logged
Applied to: Update Message Routing History
WHEN
The logging process is completed
THEN
The system updates the message routing history with the rerouting details
Context: The message routing history has been updated for an invalid user rerouting
GIVEN
The message routing history has been updated for an invalid user rerouting
Applied to: Send Notification to System Admin
WHEN
The routing history update is completed
THEN
A notification is sent to the system administrator about the invalid user incident
R-GCX016-cbl-01600 (+26) File: GCX016.cbl Cargo Information Logging Merged 27 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Information Logging':
  • Context - a cargo processing transaction is being executed:
    For Prepare Log Message with Cargo Details:
    When the system needs to create an audit log entry, then the system prepares a detailed log message containing cargo identification, processing context, and transaction details.
  • Context - a log message is being prepared for cargo processing:
    For Include Security Information:
    When security information needs to be captured for audit purposes, then the system includes current user security context, authentication details, and access permissions in the log entry.
  • Context - a cargo processing transaction is in progress:
    For Add Transaction Information:
    When transaction details need to be logged for audit purposes, then the system adds transaction type, processing timestamps, transaction id, and related context information to the log entry.
  • Context - cargo processing details need to be logged:
    For Format Cargo Processing Details:
    When the system formats the cargo information for audit trail, then the system structures cargo id, waybill information, car details, manifest data, and processing status in a standardized log format.
  • Context - a disposition code is being processed for cargo:
    For Include Disposition Code Information:
    When the processing details need to be logged for audit trail, then the system includes disposition code value, description, processing action taken, and regulatory impact in the log entry.
  • Context - cargo quantities are being processed or modified:
    For Add Quantity Information:
    When quantity changes need to be documented for audit purposes, then the system logs original quantities, modified quantities, release quantities, and quantity calculation details in the audit entry.
  • Context - cargo status is being updated during processing:
    For Include Status Changes:
    When status changes need to be logged for audit trail, then the system documents previous status, new status, reason for change, and timestamp of status transition in the log entry.
  • Context - an audit log entry is being prepared:
    For Set Audit Trail Parameters:
    When audit trail parameters need to be configured, then the system sets log classification, retention period, access controls, and regulatory compliance flags for the audit entry.
  • Context - a complete audit log entry has been prepared:
    For Spawn GCT1051E Logging Transaction:
    When the log entry needs to be persisted to the audit system, then the system spawns gct1051e logging transaction with the prepared audit data and monitors execution status.
  • Context - a logging transaction has been executed:
    For Logging Successful?:
    When the system needs to verify logging completion status, then the system checks transaction completion status and determines whether logging was successful or encountered errors.
  • Context - the logging transaction completed successfully:
    For Log Entry Created Successfully:
    When confirmation of successful log creation is needed, then the system confirms audit log entry was created successfully and updates processing status to reflect successful logging.
  • Context - the logging transaction encountered an error:
    For Handle Logging Error:
    When logging failure needs to be handled, then the system captures error details, implements fallback logging mechanisms if available, and ensures main processing can continue despite logging failure.
  • Context - audit logging activities have been completed (successfully or with error handling):
    For Continue Processing:
    When main processing workflow needs to continue, then the system resumes normal cargo processing operations and continues with the next step in the business workflow.
  • Context - a cargo logging operation is initiated:
    For Initialize Log Message Fields:
    When the system begins preparing the log message, then all message fields are cleared and initialized to default values.
  • Context - a cargo logging message is being prepared:
    For Set Security Information:
    When security information needs to be recorded, then current user id and security context are captured and added to the log message.
  • Context - a cargo processing operation is being logged:
    For Set Transaction Type:
    When transaction type needs to be identified, then the appropriate transaction type code is set based on the processing operation.
  • Context - cargo information needs to be logged:
    For Format Cargo Details:
    When cargo details are being formatted, then all cargo identification fields are properly formatted and included in the log message.
  • Context - a cargo processing event is being logged:
    For Add Processing Timestamps:
    When timestamp information is required, then current date and time are captured and added to the log message.
  • Context - cargo processing involves disposition codes:
    For Include Disposition Code Information:
    When disposition code information needs to be logged, then disposition code, description, and related processing details are included in the log message.
  • Context - cargo processing involves quantity changes:
    For Add Quantity Information:
    When quantity information needs to be logged, then all relevant quantity information including changes and current values are added to the log message.
  • Context - cargo processing requires audit trail documentation:
    For Set Audit Trail Data:
    When audit trail data is being prepared, then complete audit trail information including references and status is set in the log message.
  • Context - all log message components have been prepared:
    For Prepare Log Message Structure:
    When the final log message structure needs to be assembled, then all components are properly structured into the required log message format.
  • Context - a cargo processing operation with disposition code is ready for logging:
    For Spawn GCT1051E Transaction:
    When the disposition code is 54 or 55, then the logging transaction is not spawned and no log entry is created.
  • Context - a cargo processing operation needs to be logged and disposition code is not 54 or 55:
    For Spawn GCT1051E Transaction:
    When the logging transaction is initiated, then gct1051e transaction is spawned with the prepared log message.
  • Context - a logging transaction has been attempted:
    For Log Transaction Successful?:
    When the transaction completion status is evaluated, then system determines if logging was successful or if error handling is required.
  • Context - cargo logging transaction completed successfully:
    For Update Audit Trail Status:
    When audit trail status needs to be updated, then audit trail status is updated to indicate successful logging completion.
  • Context - an error occurred during cargo logging transaction:
    For Handle Logging Error:
    When error handling is required, then appropriate error handling procedures are executed and error status is recorded.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing transaction is being executed
GIVEN
A cargo processing transaction is being executed
Applied to: Prepare Log Message with Cargo Details
WHEN
The system needs to create an audit log entry
THEN
The system prepares a detailed log message containing cargo identification, processing context, and transaction details
Context: A log message is being prepared for cargo processing
GIVEN
A log message is being prepared for cargo processing
Applied to: Include Security Information
WHEN
Security information needs to be captured for audit purposes
THEN
The system includes current user security context, authentication details, and access permissions in the log entry
Context: A cargo processing transaction is in progress
GIVEN
A cargo processing transaction is in progress
Applied to: Add Transaction Information
WHEN
Transaction details need to be logged for audit purposes
THEN
The system adds transaction type, processing timestamps, transaction ID, and related context information to the log entry
Context: Cargo processing details need to be logged
GIVEN
Cargo processing details need to be logged
Applied to: Format Cargo Processing Details
WHEN
The system formats the cargo information for audit trail
THEN
The system structures cargo ID, waybill information, car details, manifest data, and processing status in a standardized log format
Context: A disposition code is being processed for cargo
GIVEN
A disposition code is being processed for cargo
Applied to: Include Disposition Code Information
WHEN
The processing details need to be logged for audit trail
THEN
The system includes disposition code value, description, processing action taken, and regulatory impact in the log entry
Context: Cargo quantities are being processed or modified
GIVEN
Cargo quantities are being processed or modified
Applied to: Add Quantity Information
WHEN
Quantity changes need to be documented for audit purposes
THEN
The system logs original quantities, modified quantities, release quantities, and quantity calculation details in the audit entry
Context: Cargo status is being updated during processing
GIVEN
Cargo status is being updated during processing
Applied to: Include Status Changes
WHEN
Status changes need to be logged for audit trail
THEN
The system documents previous status, new status, reason for change, and timestamp of status transition in the log entry
Context: An audit log entry is being prepared
GIVEN
An audit log entry is being prepared
Applied to: Set Audit Trail Parameters
WHEN
Audit trail parameters need to be configured
THEN
The system sets log classification, retention period, access controls, and regulatory compliance flags for the audit entry
Context: A complete audit log entry has been prepared
GIVEN
A complete audit log entry has been prepared
Applied to: Spawn GCT1051E Logging Transaction
WHEN
The log entry needs to be persisted to the audit system
THEN
The system spawns GCT1051E logging transaction with the prepared audit data and monitors execution status
Context: A logging transaction has been executed
GIVEN
A logging transaction has been executed
Applied to: Logging Successful?
WHEN
The system needs to verify logging completion status
THEN
The system checks transaction completion status and determines whether logging was successful or encountered errors
Context: The logging transaction completed successfully
GIVEN
The logging transaction completed successfully
Applied to: Log Entry Created Successfully
WHEN
Confirmation of successful log creation is needed
THEN
The system confirms audit log entry was created successfully and updates processing status to reflect successful logging
Context: The logging transaction encountered an error
GIVEN
The logging transaction encountered an error
Applied to: Handle Logging Error
WHEN
Logging failure needs to be handled
THEN
The system captures error details, implements fallback logging mechanisms if available, and ensures main processing can continue despite logging failure
Context: Audit logging activities have been completed (successfully or with error handling)
GIVEN
Audit logging activities have been completed (successfully or with error handling)
Applied to: Continue Processing
WHEN
Main processing workflow needs to continue
THEN
The system resumes normal cargo processing operations and continues with the next step in the business workflow
Context: A cargo logging operation is initiated
GIVEN
A cargo logging operation is initiated
Applied to: Initialize Log Message Fields
WHEN
The system begins preparing the log message
THEN
All message fields are cleared and initialized to default values
Context: A cargo logging message is being prepared
GIVEN
A cargo logging message is being prepared
Applied to: Set Security Information
WHEN
Security information needs to be recorded
THEN
Current user ID and security context are captured and added to the log message
Context: A cargo processing operation is being logged
GIVEN
A cargo processing operation is being logged
Applied to: Set Transaction Type
WHEN
Transaction type needs to be identified
THEN
The appropriate transaction type code is set based on the processing operation
Context: Cargo information needs to be logged
GIVEN
Cargo information needs to be logged
Applied to: Format Cargo Details
WHEN
Cargo details are being formatted
THEN
All cargo identification fields are properly formatted and included in the log message
Context: A cargo processing event is being logged
GIVEN
A cargo processing event is being logged
Applied to: Add Processing Timestamps
WHEN
Timestamp information is required
THEN
Current date and time are captured and added to the log message
Context: Cargo processing involves disposition codes
GIVEN
Cargo processing involves disposition codes
Applied to: Include Disposition Code Information
WHEN
Disposition code information needs to be logged
THEN
Disposition code, description, and related processing details are included in the log message
Context: Cargo processing involves quantity changes
GIVEN
Cargo processing involves quantity changes
Applied to: Add Quantity Information
WHEN
Quantity information needs to be logged
THEN
All relevant quantity information including changes and current values are added to the log message
Context: Cargo processing requires audit trail documentation
GIVEN
Cargo processing requires audit trail documentation
Applied to: Set Audit Trail Data
WHEN
Audit trail data is being prepared
THEN
Complete audit trail information including references and status is set in the log message
Context: All log message components have been prepared
GIVEN
All log message components have been prepared
Applied to: Prepare Log Message Structure
WHEN
The final log message structure needs to be assembled
THEN
All components are properly structured into the required log message format
Context: A cargo processing operation with disposition code is ready for logging
GIVEN
A cargo processing operation with disposition code is ready for logging
Applied to: Spawn GCT1051E Transaction
WHEN
The disposition code is 54 or 55
THEN
The logging transaction is not spawned and no log entry is created
Context: A cargo processing operation needs to be logged and disposition code is not 54 or 55
GIVEN
A cargo processing operation needs to be logged and disposition code is not 54 or 55
Applied to: Spawn GCT1051E Transaction
WHEN
The logging transaction is initiated
THEN
GCT1051E transaction is spawned with the prepared log message
Context: A logging transaction has been attempted
GIVEN
A logging transaction has been attempted
Applied to: Log Transaction Successful?
WHEN
The transaction completion status is evaluated
THEN
System determines if logging was successful or if error handling is required
Context: Cargo logging transaction completed successfully
GIVEN
Cargo logging transaction completed successfully
Applied to: Update Audit Trail Status
WHEN
Audit trail status needs to be updated
THEN
Audit trail status is updated to indicate successful logging completion
Context: An error occurred during cargo logging transaction
GIVEN
An error occurred during cargo logging transaction
Applied to: Handle Logging Error
WHEN
Error handling is required
THEN
Appropriate error handling procedures are executed and error status is recorded
R-GCX016-cbl-01613 (+11) File: GCX016.cbl Log Message Preparation Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Log Message Preparation':
  • Context - a log message preparation process is initiated:
    For Gather Security Information:
    When security information needs to be gathered for audit purposes, then the system collects user id, terminal id, and security level and includes them in the log message structure.
  • Context - a transaction is being processed that requires logging:
    For Collect Transaction Details:
    When transaction details need to be collected for the log message, then the system captures transaction type, processing mode, and message source and formats them for inclusion in the log.
  • Context - cargo processing activities have occurred that need to be logged:
    For Format Cargo Processing Information:
    When cargo information needs to be formatted for the log message, then the system formats cargo id information, status changes, and quantity details into the appropriate log message structure.
  • Context - a disposition code has been processed for cargo:
    For Include Disposition Code Details:
    When disposition code details need to be included in the log message, then the system includes the disposition code, its description, and the processing action taken in the log message.
  • Context - a log message is being prepared:
    For Add Timestamp Information:
    When timestamp information needs to be added to the log, then the system adds processing date, processing time, and system timestamp to provide complete temporal context.
  • Context - a transaction is being logged:
    For Set User and Terminal Context:
    When user and terminal context needs to be established, then the system sets the user context and terminal context information in the log message structure.
  • Context - a status change or transaction has occurred that requires audit tracking:
    For Prepare Audit Trail Data:
    When audit trail data needs to be prepared for the log, then the system captures the before status, after status, and change reason to create a complete audit trail record.
  • Context - all log message components have been collected:
    For Format Log Message Structure:
    When the log message structure needs to be formatted, then the system formats all components into a standardized log message structure ready for transmission.
  • Context - a log message has been formatted:
    For Validate Message Completeness:
    When message completeness needs to be validated, then the system validates that all required fields are populated and the message structure is complete before proceeding.
  • Context - a log message has been validated for completeness:
    For Set Message Priority and Type:
    When message priority and type need to be assigned, then the system sets the appropriate priority level and message type based on the transaction characteristics and business rules.
  • Context - a complete log message is ready for transmission:
    For Prepare for GCT1051E Spawn:
    When the message needs to be prepared for gct1051e spawn, then the system prepares the message for gct1051e transmission, excluding disposition codes 54 and 55 from the logging process.
  • Context - all log message preparation steps have been completed:
    For Log Message Ready for Transmission:
    When the message readiness needs to be confirmed, then the system confirms the log message is complete, properly formatted, and ready for transmission to the logging system.
👨‍💻 Technical ACs (Gherkin)
Context: A log message preparation process is initiated
GIVEN
A log message preparation process is initiated
Applied to: Gather Security Information
WHEN
Security information needs to be gathered for audit purposes
THEN
The system collects user ID, terminal ID, and security level and includes them in the log message structure
Context: A transaction is being processed that requires logging
GIVEN
A transaction is being processed that requires logging
Applied to: Collect Transaction Details
WHEN
Transaction details need to be collected for the log message
THEN
The system captures transaction type, processing mode, and message source and formats them for inclusion in the log
Context: Cargo processing activities have occurred that need to be logged
GIVEN
Cargo processing activities have occurred that need to be logged
Applied to: Format Cargo Processing Information
WHEN
Cargo information needs to be formatted for the log message
THEN
The system formats cargo ID information, status changes, and quantity details into the appropriate log message structure
Context: A disposition code has been processed for cargo
GIVEN
A disposition code has been processed for cargo
Applied to: Include Disposition Code Details
WHEN
Disposition code details need to be included in the log message
THEN
The system includes the disposition code, its description, and the processing action taken in the log message
Context: A log message is being prepared
GIVEN
A log message is being prepared
Applied to: Add Timestamp Information
WHEN
Timestamp information needs to be added to the log
THEN
The system adds processing date, processing time, and system timestamp to provide complete temporal context
Context: A transaction is being logged
GIVEN
A transaction is being logged
Applied to: Set User and Terminal Context
WHEN
User and terminal context needs to be established
THEN
The system sets the user context and terminal context information in the log message structure
Context: A status change or transaction has occurred that requires audit tracking
GIVEN
A status change or transaction has occurred that requires audit tracking
Applied to: Prepare Audit Trail Data
WHEN
Audit trail data needs to be prepared for the log
THEN
The system captures the before status, after status, and change reason to create a complete audit trail record
Context: All log message components have been collected
GIVEN
All log message components have been collected
Applied to: Format Log Message Structure
WHEN
The log message structure needs to be formatted
THEN
The system formats all components into a standardized log message structure ready for transmission
Context: A log message has been formatted
GIVEN
A log message has been formatted
Applied to: Validate Message Completeness
WHEN
Message completeness needs to be validated
THEN
The system validates that all required fields are populated and the message structure is complete before proceeding
Context: A log message has been validated for completeness
GIVEN
A log message has been validated for completeness
Applied to: Set Message Priority and Type
WHEN
Message priority and type need to be assigned
THEN
The system sets the appropriate priority level and message type based on the transaction characteristics and business rules
Context: A complete log message is ready for transmission
GIVEN
A complete log message is ready for transmission
Applied to: Prepare for GCT1051E Spawn
WHEN
The message needs to be prepared for GCT1051E spawn
THEN
The system prepares the message for GCT1051E transmission, excluding disposition codes 54 and 55 from the logging process
Context: All log message preparation steps have been completed
GIVEN
All log message preparation steps have been completed
Applied to: Log Message Ready for Transmission
WHEN
The message readiness needs to be confirmed
THEN
The system confirms the log message is complete, properly formatted, and ready for transmission to the logging system
R-GCX016-cbl-01625 (+12) File: GCX016.cbl GCT1051E Spawning Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'GCT1051E Spawning':
  • Context - a cargo processing event occurs with a specific disposition code:
    For Logging Required?:
    When the system checks if logging is required and the disposition code is not '54' or '55', then the system proceeds with audit trail logging preparation.
  • Context - audit trail logging is required for a cargo processing event:
    For Prepare Log Message:
    When the system prepares the log message with cargo information, disposition codes, and processing context, then a complete audit log message is formatted with all required business information.
  • Context - an audit log message is being prepared:
    For Set Security Information:
    When the system sets security information including user context and access credentials, then security information is properly assigned to the audit trail record.
  • Context - security information has been set for the audit record:
    For Set Transaction Details:
    When the system configures transaction details with processing type and business context, then transaction details are properly configured in the audit trail record.
  • Context - transaction details have been configured for the audit record:
    For Format Cargo Information:
    When the system formats cargo information including shipment identifiers, quantities, and cargo status, then cargo information is properly formatted and included in the audit trail record.
  • Context - cargo information has been formatted for the audit record:
    For Include Disposition Code Details:
    When the system includes disposition code details and associated processing actions, then complete disposition code information is included in the audit trail record.
  • Context - disposition code details have been included in the audit record:
    For Add Processing Timestamps:
    When the system adds processing timestamps including event time and processing duration, then accurate timestamps are assigned to the audit trail record.
  • Context - processing timestamps have been added to the audit record:
    For Set Audit Trail Parameters:
    When the system sets audit trail parameters for retention and compliance, then audit trail parameters are properly configured for regulatory compliance.
  • Context - audit trail parameters have been configured:
    For Spawn GCT1051E Transaction:
    When the system spawns the gct1051e transaction with complete audit information, then the logging transaction is initiated to create the audit trail record.
  • Context - the gct1051e transaction has been spawned:
    For Spawn Successful?:
    When the system checks if the spawn operation completed successfully, then the system determines whether to proceed with normal processing or handle spawn errors.
  • Context - the gct1051e transaction spawn was successful:
    For Log Transaction Created:
    When the system confirms the log transaction has been created, then the audit trail record is confirmed as created and processing continues normally.
  • Context - the gct1051e transaction spawn failed:
    For Handle Spawn Error:
    When the system handles the spawn error condition, then error recovery procedures are initiated to address the logging failure.
  • Context - a spawn error has been handled:
    For Record Error Information:
    When the system records error information including failure details and context, then complete error information is recorded for compliance and troubleshooting purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing event occurs with a specific disposition code
GIVEN
A cargo processing event occurs with a specific disposition code
Applied to: Logging Required?
WHEN
The system checks if logging is required AND the disposition code is not '54' or '55'
THEN
The system proceeds with audit trail logging preparation
Context: Audit trail logging is required for a cargo processing event
GIVEN
Audit trail logging is required for a cargo processing event
Applied to: Prepare Log Message
WHEN
The system prepares the log message with cargo information, disposition codes, and processing context
THEN
A complete audit log message is formatted with all required business information
Context: An audit log message is being prepared
GIVEN
An audit log message is being prepared
Applied to: Set Security Information
WHEN
The system sets security information including user context and access credentials
THEN
Security information is properly assigned to the audit trail record
Context: Security information has been set for the audit record
GIVEN
Security information has been set for the audit record
Applied to: Set Transaction Details
WHEN
The system configures transaction details with processing type and business context
THEN
Transaction details are properly configured in the audit trail record
Context: Transaction details have been configured for the audit record
GIVEN
Transaction details have been configured for the audit record
Applied to: Format Cargo Information
WHEN
The system formats cargo information including shipment identifiers, quantities, and cargo status
THEN
Cargo information is properly formatted and included in the audit trail record
Context: Cargo information has been formatted for the audit record
GIVEN
Cargo information has been formatted for the audit record
Applied to: Include Disposition Code Details
WHEN
The system includes disposition code details and associated processing actions
THEN
Complete disposition code information is included in the audit trail record
Context: Disposition code details have been included in the audit record
GIVEN
Disposition code details have been included in the audit record
Applied to: Add Processing Timestamps
WHEN
The system adds processing timestamps including event time and processing duration
THEN
Accurate timestamps are assigned to the audit trail record
Context: Processing timestamps have been added to the audit record
GIVEN
Processing timestamps have been added to the audit record
Applied to: Set Audit Trail Parameters
WHEN
The system sets audit trail parameters for retention and compliance
THEN
Audit trail parameters are properly configured for regulatory compliance
Context: Audit trail parameters have been configured
GIVEN
Audit trail parameters have been configured
Applied to: Spawn GCT1051E Transaction
WHEN
The system spawns the GCT1051E transaction with complete audit information
THEN
The logging transaction is initiated to create the audit trail record
Context: The GCT1051E transaction has been spawned
GIVEN
The GCT1051E transaction has been spawned
Applied to: Spawn Successful?
WHEN
The system checks if the spawn operation completed successfully
THEN
The system determines whether to proceed with normal processing or handle spawn errors
Context: The GCT1051E transaction spawn was successful
GIVEN
The GCT1051E transaction spawn was successful
Applied to: Log Transaction Created
WHEN
The system confirms the log transaction has been created
THEN
The audit trail record is confirmed as created and processing continues normally
Context: The GCT1051E transaction spawn failed
GIVEN
The GCT1051E transaction spawn failed
Applied to: Handle Spawn Error
WHEN
The system handles the spawn error condition
THEN
Error recovery procedures are initiated to address the logging failure
Context: A spawn error has been handled
GIVEN
A spawn error has been handled
Applied to: Record Error Information
WHEN
The system records error information including failure details and context
THEN
Complete error information is recorded for compliance and troubleshooting purposes
R-GCX016-cbl-01638 (+4) File: GCX016.cbl Car Information Display Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car Information Display':
  • Context - a cargo record is being processed for car information display:
    For Car ID Present?:
    When the system checks for car id presence in the cargo record, then the system determines if car id exists and routes to appropriate processing path.
  • Context - a car id has been retrieved and formatted according to standard rules:
    For Format Valid?:
    When the system validates the formatted car id against format requirements, then the system determines if the format is valid and proceeds with display or error handling.
  • Context - a valid car id exists in the cargo record:
    For Format Car ID for Display:
    When the system formats the car id for display purposes, then the car id is formatted according to standard display rules and prepared for report output.
  • Context - a cargo record does not contain car id information:
    For Handle Missing Car ID:
    When the system processes the record for car information display, then the system sets a default display value for the missing car id information.
  • Context - a car id exists but fails format validation:
    For Log Car ID Formatting Issue:
    When the system encounters a car id formatting issue, then the system logs the formatting issue and proceeds with default value handling.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for car information display
GIVEN
A cargo record is being processed for car information display
Applied to: Car ID Present?
WHEN
The system checks for car ID presence in the cargo record
THEN
The system determines if car ID exists and routes to appropriate processing path
Context: A car ID has been retrieved and formatted according to standard rules
GIVEN
A car ID has been retrieved and formatted according to standard rules
Applied to: Format Valid?
WHEN
The system validates the formatted car ID against format requirements
THEN
The system determines if the format is valid and proceeds with display or error handling
Context: A valid car ID exists in the cargo record
GIVEN
A valid car ID exists in the cargo record
Applied to: Format Car ID for Display
WHEN
The system formats the car ID for display purposes
THEN
The car ID is formatted according to standard display rules and prepared for report output
Context: A cargo record does not contain car ID information
GIVEN
A cargo record does not contain car ID information
Applied to: Handle Missing Car ID
WHEN
The system processes the record for car information display
THEN
The system sets a default display value for the missing car ID information
Context: A car ID exists but fails format validation
GIVEN
A car ID exists but fails format validation
Applied to: Log Car ID Formatting Issue
WHEN
The system encounters a car ID formatting issue
THEN
The system logs the formatting issue and proceeds with default value handling
R-GCX016-cbl-01643 (+4) File: GCX016.cbl Waybill Information Display Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Waybill Information Display':
  • Context - a cargo record is retrieved from gccc-cargo-root:
    For Waybill Number Present?:
    When the system evaluates the waybill number field, then the system determines if waybill number is present or absent.
  • Context - a waybill number is present in the cargo record:
    For Format Waybill Number for Display:
    When the system processes the waybill for display, then the waybill number is formatted according to display standards.
  • Context - a waybill number has been formatted for display:
    For Set Waybill Display Field:
    When the system prepares the display field, then the formatted waybill number is assigned to the waybill display field.
  • Context - a cargo record has no waybill number present:
    For Display 'No Waybill' Message:
    When the system processes the waybill display requirement, then the system displays 'no waybill' message in the waybill field.
  • Context - waybill display field has been set with either waybill number or no waybill message:
    For Include in Report Output:
    When the system generates the report output, then the waybill information is included in the report.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is retrieved from GCCC-CARGO-ROOT
GIVEN
A cargo record is retrieved from GCCC-CARGO-ROOT
Applied to: Waybill Number Present?
WHEN
The system evaluates the waybill number field
THEN
The system determines if waybill number is present or absent
Context: A waybill number is present in the cargo record
GIVEN
A waybill number is present in the cargo record
Applied to: Format Waybill Number for Display
WHEN
The system processes the waybill for display
THEN
The waybill number is formatted according to display standards
Context: A waybill number has been formatted for display
GIVEN
A waybill number has been formatted for display
Applied to: Set Waybill Display Field
WHEN
The system prepares the display field
THEN
The formatted waybill number is assigned to the waybill display field
Context: A cargo record has no waybill number present
GIVEN
A cargo record has no waybill number present
Applied to: Display 'No Waybill' Message
WHEN
The system processes the waybill display requirement
THEN
The system displays 'No Waybill' message in the waybill field
Context: Waybill display field has been set with either waybill number or no waybill message
GIVEN
Waybill display field has been set with either waybill number or no waybill message
Applied to: Include in Report Output
WHEN
The system generates the report output
THEN
The waybill information is included in the report
R-GCX016-cbl-01648 (+20) File: GCX016.cbl US Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US':
  • Context - a cargo record exists with us-ccn number, cprs status code, and uscs status code:
    For Display Formatted US-CCN Status:
    When the system needs to display cargo status information, then the system formats and displays the us-ccn number combined with both cprs and uscs status descriptions in a readable format.
  • Context - a cprs status code exists in the cargo record:
    For Lookup CPRS Status Description:
    When the system needs to display cprs status information, then the system looks up and retrieves the corresponding cprs status description from the status description tables.
  • Context - a uscs status code exists in the cargo record:
    For Lookup USCS Status Description:
    When the system needs to display uscs status information, then the system looks up and retrieves the corresponding uscs status description from the status description tables.
  • Context - a cargo record contains us-ccn information:
    For Extract US-CCN Number:
    When the system processes cargo status display, then the system extracts the us-ccn number from the cargo record.
  • Context - a cargo record exists with cprs status information:
    For Get CPRS Status Code:
    When the system processes status display requirements, then the system retrieves the cprs status code from the cargo record.
  • Context - a cargo record exists with uscs status information:
    For Get USCS Status Code:
    When the system processes status display requirements, then the system retrieves the uscs status code from the cargo record.
  • Context - system is monitoring for changes that impact us-ccn key structure:
    For System Change Detected Requiring US-CCN Update:
    When a system change is detected that requires us-ccn key updates, then system initiates us-ccn renumbering process.
  • Context - system change has been detected requiring us-ccn updates:
    For Identify Affected Cargo Records:
    When system searches for affected cargo records, then all cargo records requiring us-ccn key changes are identified and flagged for processing.
  • Context - affected cargo records have been identified:
    For Retrieve Current US-CCN Key Structure:
    When system retrieves current us-ccn key structure from cargo records, then current key structure is available for renumbering process.
  • Context - current us-ccn key structure has been retrieved:
    For Generate New US-CCN Key Sequence:
    When system generates new us-ccn key sequence, then new key sequence is created following system numbering standards.
  • Context - new us-ccn key sequence has been generated:
    For Validate New Key Format?:
    When system validates the new key format against business rules, then key format is either approved for use or rejected for regeneration.
  • Context - new us-ccn key format has been validated as correct:
    For Update Cargo Record with New US-CCN:
    When system updates cargo record with new us-ccn key, then cargo record contains updated us-ccn key and maintains data integrity.
  • Context - cargo record has been updated with new us-ccn key:
    For Update Related Secondary Records:
    When system updates all related secondary records with new us-ccn key, then all secondary records maintain proper referential integrity with updated us-ccn key.
  • Context - related secondary records have been updated:
    For Update Cross-Reference Tables:
    When system updates cross-reference tables with new us-ccn key mappings, then cross-reference tables reflect updated us-ccn key relationships.
  • Context - cross-reference tables have been updated with new us-ccn keys:
    For Verify Key Uniqueness:
    When system verifies uniqueness of new us-ccn keys, then system confirms all new us-ccn keys are unique or identifies conflicts.
  • Context - key uniqueness verification has been completed:
    For Key Conflicts Exist?:
    When system checks for us-ccn key conflicts, then system either proceeds with commit or initiates conflict resolution.
  • Context - us-ccn key conflicts have been detected:
    For Resolve Key Conflicts:
    When system resolves key conflicts by regenerating new key sequences, then all key conflicts are resolved and system returns to key generation process.
  • Context - no us-ccn key conflicts exist:
    For Commit US-CCN Key Changes:
    When system commits all us-ccn key changes, then all us-ccn key updates are permanently saved to the database.
  • Context - us-ccn key changes have been committed:
    For Log Key Renumbering Activity:
    When system logs key renumbering activity, then complete audit trail of us-ccn key changes is recorded.
  • Context - key renumbering activity has been logged:
    For Notify Related Systems of Key Changes:
    When system notifies related systems of us-ccn key changes, then all related systems are informed of key changes and can update their references.
  • Context - an error occurs during us-ccn renumbering process:
    For Handle Renumbering Errors:
    When system handles the renumbering error, then error is logged and renumbering process is terminated with appropriate error status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with US-CCN number, CPRS status code, and USCS status code
GIVEN
A cargo record exists with US-CCN number, CPRS status code, and USCS status code
Applied to: Display Formatted US-CCN Status
WHEN
The system needs to display cargo status information
THEN
The system formats and displays the US-CCN number combined with both CPRS and USCS status descriptions in a readable format
Context: A CPRS status code exists in the cargo record
GIVEN
A CPRS status code exists in the cargo record
Applied to: Lookup CPRS Status Description
WHEN
The system needs to display CPRS status information
THEN
The system looks up and retrieves the corresponding CPRS status description from the status description tables
Context: A USCS status code exists in the cargo record
GIVEN
A USCS status code exists in the cargo record
Applied to: Lookup USCS Status Description
WHEN
The system needs to display USCS status information
THEN
The system looks up and retrieves the corresponding USCS status description from the status description tables
Context: A cargo record contains US-CCN information
GIVEN
A cargo record contains US-CCN information
Applied to: Extract US-CCN Number
WHEN
The system processes cargo status display
THEN
The system extracts the US-CCN number from the cargo record
Context: A cargo record exists with CPRS status information
GIVEN
A cargo record exists with CPRS status information
Applied to: Get CPRS Status Code
WHEN
The system processes status display requirements
THEN
The system retrieves the CPRS status code from the cargo record
Context: A cargo record exists with USCS status information
GIVEN
A cargo record exists with USCS status information
Applied to: Get USCS Status Code
WHEN
The system processes status display requirements
THEN
The system retrieves the USCS status code from the cargo record
Context: System is monitoring for changes that impact US-CCN key structure
GIVEN
System is monitoring for changes that impact US-CCN key structure
Applied to: System Change Detected Requiring US-CCN Update
WHEN
A system change is detected that requires US-CCN key updates
THEN
System initiates US-CCN renumbering process
Context: System change has been detected requiring US-CCN updates
GIVEN
System change has been detected requiring US-CCN updates
Applied to: Identify Affected Cargo Records
WHEN
System searches for affected cargo records
THEN
All cargo records requiring US-CCN key changes are identified and flagged for processing
Context: Affected cargo records have been identified
GIVEN
Affected cargo records have been identified
Applied to: Retrieve Current US-CCN Key Structure
WHEN
System retrieves current US-CCN key structure from cargo records
THEN
Current key structure is available for renumbering process
Context: Current US-CCN key structure has been retrieved
GIVEN
Current US-CCN key structure has been retrieved
Applied to: Generate New US-CCN Key Sequence
WHEN
System generates new US-CCN key sequence
THEN
New key sequence is created following system numbering standards
Context: New US-CCN key sequence has been generated
GIVEN
New US-CCN key sequence has been generated
Applied to: Validate New Key Format?
WHEN
System validates the new key format against business rules
THEN
Key format is either approved for use or rejected for regeneration
Context: New US-CCN key format has been validated as correct
GIVEN
New US-CCN key format has been validated as correct
Applied to: Update Cargo Record with New US-CCN
WHEN
System updates cargo record with new US-CCN key
THEN
Cargo record contains updated US-CCN key and maintains data integrity
Context: Cargo record has been updated with new US-CCN key
GIVEN
Cargo record has been updated with new US-CCN key
Applied to: Update Related Secondary Records
WHEN
System updates all related secondary records with new US-CCN key
THEN
All secondary records maintain proper referential integrity with updated US-CCN key
Context: Related secondary records have been updated
GIVEN
Related secondary records have been updated
Applied to: Update Cross-Reference Tables
WHEN
System updates cross-reference tables with new US-CCN key mappings
THEN
Cross-reference tables reflect updated US-CCN key relationships
Context: Cross-reference tables have been updated with new US-CCN keys
GIVEN
Cross-reference tables have been updated with new US-CCN keys
Applied to: Verify Key Uniqueness
WHEN
System verifies uniqueness of new US-CCN keys
THEN
System confirms all new US-CCN keys are unique or identifies conflicts
Context: Key uniqueness verification has been completed
GIVEN
Key uniqueness verification has been completed
Applied to: Key Conflicts Exist?
WHEN
System checks for US-CCN key conflicts
THEN
System either proceeds with commit or initiates conflict resolution
Context: US-CCN key conflicts have been detected
GIVEN
US-CCN key conflicts have been detected
Applied to: Resolve Key Conflicts
WHEN
System resolves key conflicts by regenerating new key sequences
THEN
All key conflicts are resolved and system returns to key generation process
Context: No US-CCN key conflicts exist
GIVEN
No US-CCN key conflicts exist
Applied to: Commit US-CCN Key Changes
WHEN
System commits all US-CCN key changes
THEN
All US-CCN key updates are permanently saved to the database
Context: US-CCN key changes have been committed
GIVEN
US-CCN key changes have been committed
Applied to: Log Key Renumbering Activity
WHEN
System logs key renumbering activity
THEN
Complete audit trail of US-CCN key changes is recorded
Context: Key renumbering activity has been logged
GIVEN
Key renumbering activity has been logged
Applied to: Notify Related Systems of Key Changes
WHEN
System notifies related systems of US-CCN key changes
THEN
All related systems are informed of key changes and can update their references
Context: An error occurs during US-CCN renumbering process
GIVEN
An error occurs during US-CCN renumbering process
Applied to: Handle Renumbering Errors
WHEN
System handles the renumbering error
THEN
Error is logged and renumbering process is terminated with appropriate error status
R-GCX016-cbl-01654 (+10) File: GCX016.cbl Disposition Code Display Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Display':
  • Context - a status array entry exists in s09a:
    For Retrieve Disposition Code from Status Array:
    When the system needs to display disposition code information, then the disposition code value is extracted from the status array entry.
  • Context - a disposition code value has been retrieved from status array:
    For Access DC Table for Code Details:
    When the system needs code description information, then the dc table is accessed using the disposition code as lookup key.
  • Context - a disposition code lookup has been performed against dc table:
    For Code Found in Table?:
    When the system checks if the code exists in the table, then a found or not found status is determined based on table lookup results.
  • Context - a disposition code exists in the dc table:
    For Get Code Description:
    When the system needs the code description, then the description text is retrieved from the dc table entry.
  • Context - a disposition code is not found in the dc table:
    For Use Default Description:
    When the system needs to display code information, then a default description is used instead of table description.
  • Context - a disposition code lookup fails in the dc table:
    For Log Code Not Found Warning:
    When the code is not found in the reference data, then a warning message is logged indicating the missing code.
  • Context - a disposition code value is available:
    For Format Code Number:
    When the system prepares the code for display, then the code number is formatted according to display standards.
  • Context - a disposition code description is available from dc table or default:
    For Format Code Description Text:
    When the system prepares the description for display, then the description text is formatted according to display standards.
  • Context - both formatted code number and description text are available:
    For Combine Code and Description:
    When the system creates the final display string, then the code and description are combined into a single formatted string.
  • Context - a combined code and description string exists:
    For Set Display Format:
    When the system finalizes the display format, then standard display formatting rules are applied to ensure consistent presentation.
  • Context - a fully formatted disposition code display string is ready:
    For Return Formatted Display String:
    When the formatting process is complete, then the formatted display string is returned to the requesting process.
👨‍💻 Technical ACs (Gherkin)
Context: A status array entry exists in S09A
GIVEN
A status array entry exists in S09A
Applied to: Retrieve Disposition Code from Status Array
WHEN
The system needs to display disposition code information
THEN
The disposition code value is extracted from the status array entry
Context: A disposition code value has been retrieved from status array
GIVEN
A disposition code value has been retrieved from status array
Applied to: Access DC Table for Code Details
WHEN
The system needs code description information
THEN
The DC table is accessed using the disposition code as lookup key
Context: A disposition code lookup has been performed against DC table
GIVEN
A disposition code lookup has been performed against DC table
Applied to: Code Found in Table?
WHEN
The system checks if the code exists in the table
THEN
A found or not found status is determined based on table lookup results
Context: A disposition code exists in the DC table
GIVEN
A disposition code exists in the DC table
Applied to: Get Code Description
WHEN
The system needs the code description
THEN
The description text is retrieved from the DC table entry
Context: A disposition code is not found in the DC table
GIVEN
A disposition code is not found in the DC table
Applied to: Use Default Description
WHEN
The system needs to display code information
THEN
A default description is used instead of table description
Context: A disposition code lookup fails in the DC table
GIVEN
A disposition code lookup fails in the DC table
Applied to: Log Code Not Found Warning
WHEN
The code is not found in the reference data
THEN
A warning message is logged indicating the missing code
Context: A disposition code value is available
GIVEN
A disposition code value is available
Applied to: Format Code Number
WHEN
The system prepares the code for display
THEN
The code number is formatted according to display standards
Context: A disposition code description is available from DC table or default
GIVEN
A disposition code description is available from DC table or default
Applied to: Format Code Description Text
WHEN
The system prepares the description for display
THEN
The description text is formatted according to display standards
Context: Both formatted code number and description text are available
GIVEN
Both formatted code number and description text are available
Applied to: Combine Code and Description
WHEN
The system creates the final display string
THEN
The code and description are combined into a single formatted string
Context: A combined code and description string exists
GIVEN
A combined code and description string exists
Applied to: Set Display Format
WHEN
The system finalizes the display format
THEN
Standard display formatting rules are applied to ensure consistent presentation
Context: A fully formatted disposition code display string is ready
GIVEN
A fully formatted disposition code display string is ready
Applied to: Return Formatted Display String
WHEN
The formatting process is complete
THEN
The formatted display string is returned to the requesting process
R-GCX016-cbl-01665 (+10) File: GCX016.cbl Date/Time Stamping Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Date/Time Stamping':
  • Context - a cargo processing transaction is initiated:
    For Capture Current System Date & Capture Current System Time:
    When the system begins processing any segment or transaction, then the current system date is captured and stored for timestamping purposes and the current system time is captured and stored for timestamping purposes.
  • Context - a system date has been captured:
    For Format Date for Display:
    When the date needs to be displayed in reports or user interfaces, then the date is formatted according to standard display requirements.
  • Context - a system time has been captured:
    For Format Time for Display:
    When the time needs to be displayed in reports or user interfaces, then the time is formatted according to standard display requirements.
  • Context - both system date and time have been captured and formatted:
    For Combine Date and Time Stamp:
    When a complete timestamp is required for processing records, then the formatted date and time are combined into a single timestamp.
  • Context - a cargo segment is being processed and a combined timestamp has been created:
    For Add Timestamp to Segment Header:
    When the segment processing begins, then the timestamp is added to the segment header for audit purposes.
  • Context - cargo processing activities are occurring:
    For Add Timestamp to Processing Log:
    When processing events need to be logged, then timestamps are added to the processing log entries.
  • Context - a system processing event is occurring and timestamps have been created:
    For Add Timestamp to Transaction Log:
    When the event qualifies as a system processing event, then the timestamp is added to the transaction log.
  • Context - system processing events are being logged in transaction logs:
    For Add Timestamp to Audit Trail:
    When audit trail records are being created, then timestamps are added to the audit trail entries.
  • Context - timestamps have been captured and formatted:
    For Display Formatted Timestamp in Reports:
    When reports are generated for users, then formatted timestamps are displayed in the reports.
  • Context - formatted timestamps are available for display:
    For Store Timestamp in Message Fields:
    When message processing requires timestamp information, then timestamps are stored in the designated message fields.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing transaction is initiated
GIVEN
A cargo processing transaction is initiated
Applied to: Capture Current System Date & Capture Current System Time
WHEN
The system begins processing any segment or transaction
THEN
The current system date is captured and stored for timestamping purposes AND The current system time is captured and stored for timestamping purposes
Context: A system date has been captured
GIVEN
A system date has been captured
Applied to: Format Date for Display
WHEN
The date needs to be displayed in reports or user interfaces
THEN
The date is formatted according to standard display requirements
Context: A system time has been captured
GIVEN
A system time has been captured
Applied to: Format Time for Display
WHEN
The time needs to be displayed in reports or user interfaces
THEN
The time is formatted according to standard display requirements
Context: Both system date and time have been captured and formatted
GIVEN
Both system date and time have been captured and formatted
Applied to: Combine Date and Time Stamp
WHEN
A complete timestamp is required for processing records
THEN
The formatted date and time are combined into a single timestamp
Context: A cargo segment is being processed AND a combined timestamp has been created
GIVEN
A cargo segment is being processed AND a combined timestamp has been created
Applied to: Add Timestamp to Segment Header
WHEN
The segment processing begins
THEN
The timestamp is added to the segment header for audit purposes
Context: Cargo processing activities are occurring
GIVEN
Cargo processing activities are occurring
Applied to: Add Timestamp to Processing Log
WHEN
Processing events need to be logged
THEN
Timestamps are added to the processing log entries
Context: A system processing event is occurring AND timestamps have been created
GIVEN
A system processing event is occurring AND timestamps have been created
Applied to: Add Timestamp to Transaction Log
WHEN
The event qualifies as a system processing event
THEN
The timestamp is added to the transaction log
Context: System processing events are being logged in transaction logs
GIVEN
System processing events are being logged in transaction logs
Applied to: Add Timestamp to Audit Trail
WHEN
Audit trail records are being created
THEN
Timestamps are added to the audit trail entries
Context: Timestamps have been captured and formatted
GIVEN
Timestamps have been captured and formatted
Applied to: Display Formatted Timestamp in Reports
WHEN
Reports are generated for users
THEN
Formatted timestamps are displayed in the reports
Context: Formatted timestamps are available for display
GIVEN
Formatted timestamps are available for display
Applied to: Store Timestamp in Message Fields
WHEN
Message processing requires timestamp information
THEN
Timestamps are stored in the designated message fields
R-GCX016-cbl-01676 (+12) File: GCX016.cbl Quantity Information Display Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Quantity Information Display':
  • Context - an x4 customs release segment is available for processing:
    For Retrieve Broker Entry Number from X4 Segment:
    When the system needs to display quantity information for broker notification, then the broker entry number is retrieved from the x4-04 field of the segment.
  • Context - a cargo manifest record exists in the system:
    For Get Cargo Quantity from Manifest:
    When quantity mismatch detection is being performed, then the total manifest quantity is retrieved from the cargo record.
  • Context - a cargo status array contains release information:
    For Get Released Quantity from Status Array:
    When quantity verification is required for broker notification, then the released quantity is retrieved from the status array.
  • Context - manifest quantity and released quantity are available:
    For Calculate Quantity Difference:
    When quantity mismatch analysis is performed, then the quantity difference is calculated as manifest quantity minus released quantity.
  • Context - manifest quantity and released quantity have been retrieved and compared:
    For Quantity Mismatch Detected?:
    When the system evaluates quantity consistency, then a mismatch is detected if the manifest quantity does not equal the released quantity.
  • Context - a broker entry number exists and a quantity mismatch has been detected:
    For Format Broker Entry Number for Display:
    When the mismatch report is being prepared, then the broker entry number is formatted according to display standards.
  • Context - a manifest quantity value exists and formatting is required:
    For Format Manifest Quantity for Display:
    When quantity information is being prepared for display, then the manifest quantity is formatted with appropriate decimal places and units.
  • Context - a released quantity value exists and formatting is required:
    For Format Released Quantity for Display:
    When quantity information is being prepared for broker notification, then the released quantity is formatted with appropriate decimal places and units.
  • Context - a quantity difference has been calculated and formatting is required:
    For Format Quantity Difference for Display:
    When mismatch information is being prepared for display, then the quantity difference is formatted with appropriate sign indication and decimal places.
  • Context - all quantity values have been formatted for display:
    For Prepare Mismatch Report Fields:
    When the mismatch report structure is being assembled, then all formatted fields are organized into the appropriate report structure with proper field assignments.
  • Context - mismatch report fields have been prepared:
    For Set Report Display Format:
    When the report layout needs to be established, then the display format is configured with proper headers, alignment, and spacing for broker readability.
  • Context - report display format has been set and all fields are prepared:
    For Generate Quantity Mismatch Message:
    When the final notification message needs to be generated, then a complete mismatch message is generated containing entry number, manifest quantity, released quantity, and difference information.
  • Context - a quantity mismatch message has been generated:
    For Route Message to Broker Notification:
    When the message needs to be delivered to the broker, then the message is routed to the broker notification system for delivery via the appropriate communication channel.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 customs release segment is available for processing
GIVEN
An X4 customs release segment is available for processing
Applied to: Retrieve Broker Entry Number from X4 Segment
WHEN
The system needs to display quantity information for broker notification
THEN
The broker entry number is retrieved from the X4-04 field of the segment
Context: A cargo manifest record exists in the system
GIVEN
A cargo manifest record exists in the system
Applied to: Get Cargo Quantity from Manifest
WHEN
Quantity mismatch detection is being performed
THEN
The total manifest quantity is retrieved from the cargo record
Context: A cargo status array contains release information
GIVEN
A cargo status array contains release information
Applied to: Get Released Quantity from Status Array
WHEN
Quantity verification is required for broker notification
THEN
The released quantity is retrieved from the status array
Context: Manifest quantity and released quantity are available
GIVEN
Manifest quantity and released quantity are available
Applied to: Calculate Quantity Difference
WHEN
Quantity mismatch analysis is performed
THEN
The quantity difference is calculated as manifest quantity minus released quantity
Context: Manifest quantity and released quantity have been retrieved and compared
GIVEN
Manifest quantity and released quantity have been retrieved and compared
Applied to: Quantity Mismatch Detected?
WHEN
The system evaluates quantity consistency
THEN
A mismatch is detected if the manifest quantity does not equal the released quantity
Context: A broker entry number exists and a quantity mismatch has been detected
GIVEN
A broker entry number exists and a quantity mismatch has been detected
Applied to: Format Broker Entry Number for Display
WHEN
The mismatch report is being prepared
THEN
The broker entry number is formatted according to display standards
Context: A manifest quantity value exists and formatting is required
GIVEN
A manifest quantity value exists and formatting is required
Applied to: Format Manifest Quantity for Display
WHEN
Quantity information is being prepared for display
THEN
The manifest quantity is formatted with appropriate decimal places and units
Context: A released quantity value exists and formatting is required
GIVEN
A released quantity value exists and formatting is required
Applied to: Format Released Quantity for Display
WHEN
Quantity information is being prepared for broker notification
THEN
The released quantity is formatted with appropriate decimal places and units
Context: A quantity difference has been calculated and formatting is required
GIVEN
A quantity difference has been calculated and formatting is required
Applied to: Format Quantity Difference for Display
WHEN
Mismatch information is being prepared for display
THEN
The quantity difference is formatted with appropriate sign indication and decimal places
Context: All quantity values have been formatted for display
GIVEN
All quantity values have been formatted for display
Applied to: Prepare Mismatch Report Fields
WHEN
The mismatch report structure is being assembled
THEN
All formatted fields are organized into the appropriate report structure with proper field assignments
Context: Mismatch report fields have been prepared
GIVEN
Mismatch report fields have been prepared
Applied to: Set Report Display Format
WHEN
The report layout needs to be established
THEN
The display format is configured with proper headers, alignment, and spacing for broker readability
Context: Report display format has been set and all fields are prepared
GIVEN
Report display format has been set and all fields are prepared
Applied to: Generate Quantity Mismatch Message
WHEN
The final notification message needs to be generated
THEN
A complete mismatch message is generated containing entry number, manifest quantity, released quantity, and difference information
Context: A quantity mismatch message has been generated
GIVEN
A quantity mismatch message has been generated
Applied to: Route Message to Broker Notification
WHEN
The message needs to be delivered to the broker
THEN
The message is routed to the broker notification system for delivery via the appropriate communication channel
R-GCX016-cbl-01689 (+11) File: GCX016.cbl Release Quantity Logic Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Quantity Logic':
  • Context - a disposition code is being processed for cargo release:
    For Disposition Code Has Quantity Action?:
    When the system evaluates if the disposition code has quantity action requirements, then the system should proceed with quantity processing if action exists, otherwise skip quantity operations.
  • Context - a disposition code requires quantity processing:
    For Get Disposition Code Details from DC Table:
    When the system looks up the disposition code in the dc table, then the system should retrieve the quantity action type and processing parameters for the disposition code.
  • Context - disposition code details have been retrieved from dc table:
    For Quantity Action Type?:
    When the system evaluates the quantity action type, then the system should route to add operation for increase actions or subtract operation for decrease actions.
  • Context - a disposition code specifies an add quantity action:
    For Add Operation - Increase Release Quantity:
    When the system processes the quantity increase, then the system should add the specified quantity to the current release quantity.
  • Context - a disposition code specifies a subtract quantity action:
    For Subtract Operation - Decrease Release Quantity:
    When the system processes the quantity decrease, then the system should subtract the specified quantity from the current release quantity.
  • Context - a subtract operation is being performed on release quantity:
    For Would Result in Negative Quantity?:
    When the calculated result would be less than zero, then the system should prevent negative quantities and set release quantity to zero instead.
  • Context - a quantity subtraction would result in a negative value:
    For Set Release Quantity to Zero:
    When the system applies the zero quantity rule, then the system should set the release quantity to zero to maintain data integrity.
  • Context - a quantity calculation has been performed and validated:
    For Apply Calculated Quantity:
    When the result is within acceptable business ranges, then the system should apply the calculated quantity to the cargo release quantity.
  • Context - release quantity has been updated for a cargo item:
    For Release Quantity Matches Total Quantity?:
    When the system compares release quantity to total cargo quantity, then the system should determine full release if quantities match or partial release if they differ.
  • Context - release quantity equals or exceeds the total cargo quantity:
    For Mark as Full Release:
    When the system assigns release status, then the system should mark the cargo as fully released.
  • Context - release quantity is less than the total cargo quantity:
    For Mark as Partial Release:
    When the system assigns release status, then the system should mark the cargo as partially released.
  • Context - release status and quantities have been determined:
    For Update Cargo Status Array:
    When the system updates the cargo status array, then the system should record the new release quantities and status in the s09a status array.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo release
GIVEN
A disposition code is being processed for cargo release
Applied to: Disposition Code Has Quantity Action?
WHEN
The system evaluates if the disposition code has quantity action requirements
THEN
The system should proceed with quantity processing if action exists, otherwise skip quantity operations
Context: A disposition code requires quantity processing
GIVEN
A disposition code requires quantity processing
Applied to: Get Disposition Code Details from DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The system should retrieve the quantity action type and processing parameters for the disposition code
Context: Disposition code details have been retrieved from DC table
GIVEN
Disposition code details have been retrieved from DC table
Applied to: Quantity Action Type?
WHEN
The system evaluates the quantity action type
THEN
The system should route to add operation for increase actions or subtract operation for decrease actions
Context: A disposition code specifies an add quantity action
GIVEN
A disposition code specifies an add quantity action
Applied to: Add Operation - Increase Release Quantity
WHEN
The system processes the quantity increase
THEN
The system should add the specified quantity to the current release quantity
Context: A disposition code specifies a subtract quantity action
GIVEN
A disposition code specifies a subtract quantity action
Applied to: Subtract Operation - Decrease Release Quantity
WHEN
The system processes the quantity decrease
THEN
The system should subtract the specified quantity from the current release quantity
Context: A subtract operation is being performed on release quantity
GIVEN
A subtract operation is being performed on release quantity
Applied to: Would Result in Negative Quantity?
WHEN
The calculated result would be less than zero
THEN
The system should prevent negative quantities and set release quantity to zero instead
Context: A quantity subtraction would result in a negative value
GIVEN
A quantity subtraction would result in a negative value
Applied to: Set Release Quantity to Zero
WHEN
The system applies the zero quantity rule
THEN
The system should set the release quantity to zero to maintain data integrity
Context: A quantity calculation has been performed and validated
GIVEN
A quantity calculation has been performed and validated
Applied to: Apply Calculated Quantity
WHEN
The result is within acceptable business ranges
THEN
The system should apply the calculated quantity to the cargo release quantity
Context: Release quantity has been updated for a cargo item
GIVEN
Release quantity has been updated for a cargo item
Applied to: Release Quantity Matches Total Quantity?
WHEN
The system compares release quantity to total cargo quantity
THEN
The system should determine full release if quantities match or partial release if they differ
Context: Release quantity equals or exceeds the total cargo quantity
GIVEN
Release quantity equals or exceeds the total cargo quantity
Applied to: Mark as Full Release
WHEN
The system assigns release status
THEN
The system should mark the cargo as fully released
Context: Release quantity is less than the total cargo quantity
GIVEN
Release quantity is less than the total cargo quantity
Applied to: Mark as Partial Release
WHEN
The system assigns release status
THEN
The system should mark the cargo as partially released
Context: Release status and quantities have been determined
GIVEN
Release status and quantities have been determined
Applied to: Update Cargo Status Array
WHEN
The system updates the cargo status array
THEN
The system should record the new release quantities and status in the S09A status array
R-GCX016-cbl-01701 (+21) File: GCX016.cbl Julian Date Conversion Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Julian Date Conversion':
  • Context - a gregorian date is provided for julian conversion:
    For Valid Date Format?:
    When the system checks the date format validity, then the system either proceeds with conversion for valid dates or returns error status for invalid dates and the system should validate the date format and either proceed with conversion or return an error for invalid dates.
  • Context - a valid gregorian date format has been confirmed:
    For Extract Year Component:
    When the system processes the date for julian conversion, then the year component is extracted and prepared for julian calculation and the system should extract the year component from the input date.
  • Context - the year component has been successfully extracted:
    For Extract Month Component:
    When the system continues processing the gregorian date, then the month component is extracted and prepared for day calculation.
  • Context - the year and month components have been successfully extracted:
    For Extract Day Component:
    When the system continues processing the gregorian date, then the day component is extracted and prepared for final julian calculation.
    For Extract Day Component:
    When the system continues processing the date components, then the system should extract the day component from the input date.
  • Context - year, month, and day components have been extracted from the gregorian date:
    For Calculate Days from Year Start:
    When the system performs julian date calculation, then the total days from january 1st to the current date is calculated.
  • Context - the base days from year start have been calculated:
    For Add Month Days to Total:
    When the system processes the month component, then days from complete months are added to the cumulative day total.
  • Context - year start days and month days have been calculated and added:
    For Add Day Component:
    When the system processes the day component, then the day value is added to complete the total days calculation for julian format.
  • Context - the total days from year start have been calculated:
    For Format as Julian Date:
    When the system completes the julian conversion process, then the result is formatted as a proper julian date (yyddd format).
  • Context - julian date formatting has been completed successfully:
    For Return Julian Date Result:
    When the conversion process finishes, then the formatted julian date is returned to the requesting business process.
  • Context - an invalid date format has been detected during validation:
    For Return Error Status & Return Error for Invalid Date:
    When the system cannot proceed with julian conversion, then an error status is returned indicating the date conversion failure and the system should return an error indicating the date format is invalid.
  • Context - the year component has been successfully extracted from the date:
    For Extract Month Component:
    When the system continues processing the date components, then the system should extract the month component from the input date.
  • Context - year, month, and day components have been extracted from the input date:
    For Calculate Days from Year Start:
    When the system begins julian date calculation, then the system should calculate the total days elapsed from january 1st to the beginning of the specified month.
  • Context - the days from year start have been calculated:
    For Add Month Days to Total:
    When the system continues the julian date calculation process, then the system should add the calculated month days to the running total.
  • Context - the month days have been added to the running total:
    For Add Day Component:
    When the system finalizes the julian date calculation, then the system should add the day component to complete the total days calculation.
  • Context - the basic julian date calculation has been completed:
    For Leap Year Check Required?:
    When the system evaluates whether leap year adjustment is necessary, then the system should determine if leap year check is required based on the year and whether the date falls after february 29th in a leap year.
  • Context - the system has determined that leap year adjustment is required:
    For Apply Leap Year Adjustment:
    When the leap year adjustment is applied, then the system should adjust the julian date calculation to account for the extra day in leap years.
  • Context - the julian date calculation is complete with any necessary leap year adjustments:
    For Format Julian Date Output:
    When the system prepares the final output, then the system should format the julian date into the standard business format.
  • Context - the julian date has been successfully calculated and formatted:
    For Return Julian Date for Business Calculations:
    When the conversion process is complete, then the system should return the julian date for use in business date calculations.
👨‍💻 Technical ACs (Gherkin)
Context: A Gregorian date is provided for Julian conversion
GIVEN
A Gregorian date is provided for Julian conversion
Applied to: Valid Date Format?
WHEN
The system checks the date format validity
THEN
The system either proceeds with conversion for valid dates or returns error status for invalid dates AND The system should validate the date format and either proceed with conversion or return an error for invalid dates
Context: A valid Gregorian date format has been confirmed
GIVEN
A valid Gregorian date format has been confirmed
Applied to: Extract Year Component
WHEN
The system processes the date for Julian conversion
THEN
The year component is extracted and prepared for Julian calculation AND The system should extract the year component from the input date
Context: The year component has been successfully extracted
GIVEN
The year component has been successfully extracted
Applied to: Extract Month Component
WHEN
The system continues processing the Gregorian date
THEN
The month component is extracted and prepared for day calculation
Context: The year and month components have been successfully extracted
GIVEN
The year and month components have been successfully extracted
Applied to: Extract Day Component
WHEN
The system continues processing the Gregorian date
THEN
The day component is extracted and prepared for final Julian calculation
Applied to: Extract Day Component
WHEN
The system continues processing the date components
THEN
The system should extract the day component from the input date
Context: Year, month, and day components have been extracted from the Gregorian date
GIVEN
Year, month, and day components have been extracted from the Gregorian date
Applied to: Calculate Days from Year Start
WHEN
The system performs Julian date calculation
THEN
The total days from January 1st to the current date is calculated
Context: The base days from year start have been calculated
GIVEN
The base days from year start have been calculated
Applied to: Add Month Days to Total
WHEN
The system processes the month component
THEN
Days from complete months are added to the cumulative day total
Context: Year start days and month days have been calculated and added
GIVEN
Year start days and month days have been calculated and added
Applied to: Add Day Component
WHEN
The system processes the day component
THEN
The day value is added to complete the total days calculation for Julian format
Context: The total days from year start have been calculated
GIVEN
The total days from year start have been calculated
Applied to: Format as Julian Date
WHEN
The system completes the Julian conversion process
THEN
The result is formatted as a proper Julian date (YYDDD format)
Context: Julian date formatting has been completed successfully
GIVEN
Julian date formatting has been completed successfully
Applied to: Return Julian Date Result
WHEN
The conversion process finishes
THEN
The formatted Julian date is returned to the requesting business process
Context: An invalid date format has been detected during validation
GIVEN
An invalid date format has been detected during validation
Applied to: Return Error Status & Return Error for Invalid Date
WHEN
The system cannot proceed with Julian conversion
THEN
An error status is returned indicating the date conversion failure AND The system should return an error indicating the date format is invalid
Context: The year component has been successfully extracted from the date
GIVEN
The year component has been successfully extracted from the date
Applied to: Extract Month Component
WHEN
The system continues processing the date components
THEN
The system should extract the month component from the input date
Context: Year, month, and day components have been extracted from the input date
GIVEN
Year, month, and day components have been extracted from the input date
Applied to: Calculate Days from Year Start
WHEN
The system begins Julian date calculation
THEN
The system should calculate the total days elapsed from January 1st to the beginning of the specified month
Context: The days from year start have been calculated
GIVEN
The days from year start have been calculated
Applied to: Add Month Days to Total
WHEN
The system continues the Julian date calculation process
THEN
The system should add the calculated month days to the running total
Context: The month days have been added to the running total
GIVEN
The month days have been added to the running total
Applied to: Add Day Component
WHEN
The system finalizes the Julian date calculation
THEN
The system should add the day component to complete the total days calculation
Context: The basic Julian date calculation has been completed
GIVEN
The basic Julian date calculation has been completed
Applied to: Leap Year Check Required?
WHEN
The system evaluates whether leap year adjustment is necessary
THEN
The system should determine if leap year check is required based on the year and whether the date falls after February 29th in a leap year
Context: The system has determined that leap year adjustment is required
GIVEN
The system has determined that leap year adjustment is required
Applied to: Apply Leap Year Adjustment
WHEN
The leap year adjustment is applied
THEN
The system should adjust the Julian date calculation to account for the extra day in leap years
Context: The Julian date calculation is complete with any necessary leap year adjustments
GIVEN
The Julian date calculation is complete with any necessary leap year adjustments
Applied to: Format Julian Date Output
WHEN
The system prepares the final output
THEN
The system should format the Julian date into the standard business format
Context: The Julian date has been successfully calculated and formatted
GIVEN
The Julian date has been successfully calculated and formatted
Applied to: Return Julian Date for Business Calculations
WHEN
The conversion process is complete
THEN
The system should return the Julian date for use in business date calculations
R-GCX016-cbl-01711 (+7) File: GCX016.cbl Machine Date Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Machine Date Processing':
  • Context - a transaction processing session is initiated:
    For Get Current System Date:
    When the system needs to establish the current processing date, then the system retrieves the current machine date from the operating system.
  • Context - a system date has been retrieved from the machine:
    For Validate Date Format:
    When the date format needs to be validated for business processing, then the system checks if the date format matches the required business date structure.
  • Context - a system date has been retrieved and format validated:
    For Date Valid?:
    When the system evaluates the date validity, then if the date is valid, proceed with normal processing, otherwise initiate error handling procedures.
  • Context - a valid system date in external format:
    For Convert to Internal Format:
    When the date needs to be used for internal business processing, then the system converts the date to the required internal format for business operations.
  • Context - a machine date has been converted to internal format:
    For Set Machine Date Fields:
    When business processing requires date context, then the system assigns the converted date to appropriate business date fields.
  • Context - machine date fields have been set for business processing:
    For Update Transaction Timestamp:
    When a transaction requires timestamp recording, then the system updates the transaction timestamp with the current processing date and time.
  • Context - an invalid or corrupted system date has been detected:
    For Handle Date Error:
    When normal date processing cannot proceed, then the system initiates error handling procedures to manage the date processing failure.
  • Context - the machine date is invalid or unavailable:
    For Set Default Date:
    When business processing requires a date value to continue, then the system assigns a predetermined default date to ensure processing continuity.
👨‍💻 Technical ACs (Gherkin)
Context: A transaction processing session is initiated
GIVEN
A transaction processing session is initiated
Applied to: Get Current System Date
WHEN
The system needs to establish the current processing date
THEN
The system retrieves the current machine date from the operating system
Context: A system date has been retrieved from the machine
GIVEN
A system date has been retrieved from the machine
Applied to: Validate Date Format
WHEN
The date format needs to be validated for business processing
THEN
The system checks if the date format matches the required business date structure
Context: A system date has been retrieved and format validated
GIVEN
A system date has been retrieved and format validated
Applied to: Date Valid?
WHEN
The system evaluates the date validity
THEN
If the date is valid, proceed with normal processing, otherwise initiate error handling procedures
Context: A valid system date in external format
GIVEN
A valid system date in external format
Applied to: Convert to Internal Format
WHEN
The date needs to be used for internal business processing
THEN
The system converts the date to the required internal format for business operations
Context: A machine date has been converted to internal format
GIVEN
A machine date has been converted to internal format
Applied to: Set Machine Date Fields
WHEN
Business processing requires date context
THEN
The system assigns the converted date to appropriate business date fields
Context: Machine date fields have been set for business processing
GIVEN
Machine date fields have been set for business processing
Applied to: Update Transaction Timestamp
WHEN
A transaction requires timestamp recording
THEN
The system updates the transaction timestamp with the current processing date and time
Context: An invalid or corrupted system date has been detected
GIVEN
An invalid or corrupted system date has been detected
Applied to: Handle Date Error
WHEN
Normal date processing cannot proceed
THEN
The system initiates error handling procedures to manage the date processing failure
Context: The machine date is invalid or unavailable
GIVEN
The machine date is invalid or unavailable
Applied to: Set Default Date
WHEN
Business processing requires a date value to continue
THEN
The system assigns a predetermined default date to ensure processing continuity
R-GCX016-cbl-01719 (+18) File: GCX016.cbl IMS Queue Reading Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'IMS Queue Reading':
  • Context - the system needs to read messages from ims queues:
    For Initialize MQ Connection Parameters:
    When queue reading process is initiated, then mq connection parameters are initialized with proper values for queue access.
  • Context - mq connection parameters are initialized:
    For Set Queue Name and Options:
    When queue configuration is required, then queue name and processing options are set according to business requirements.
  • Context - queue name and options are properly configured:
    For Open MQ Queue for Reading:
    When queue opening is attempted, then mq queue is opened for reading with appropriate access permissions.
  • Context - queue opening operation has been attempted:
    For Queue Open Successful?:
    When queue open status is evaluated, then if queue opened successfully, proceed to message reading; otherwise handle queue open error.
  • Context - mq queue is successfully opened for reading:
    For Get Message from Queue:
    When message retrieval is requested, then system attempts to get the next message from the queue.
  • Context - message retrieval has been attempted from the queue:
    For Message Available?:
    When message availability is checked, then if message is available, proceed to process message; if no message available, close queue and complete processing.
  • Context - a message is available and retrieved from the queue:
    For Calculate Message Length:
    When message length calculation is performed, then message length is calculated and stored for subsequent processing steps.
  • Context - message length has been calculated:
    For Determine Entry Count:
    When entry count determination is required, then number of entries in the message is calculated based on message structure and length.
  • Context - message length and entry count have been determined:
    For Validate Message Structure:
    When message structure validation is performed, then message structure is validated against expected format requirements.
  • Context - message structure validation has been completed:
    For Message Valid?:
    When message validity is evaluated, then if message is valid, store in array and update counter; if invalid, handle message error and continue to next message.
  • Context - message has passed all validation checks:
    For Store Message in Array:
    When message storage is required, then valid message is stored in the message processing array.
  • Context - valid message has been stored in processing array:
    For Update Message Counter:
    When message counter update is required, then message processing counter is incremented to reflect successful message storage.
  • Context - current message has been processed (stored or error handled):
    For More Messages?:
    When additional message check is performed, then if more messages exist, continue reading from queue; if no more messages, proceed to close queue.
  • Context - all available messages have been processed or no messages are available:
    For Close MQ Queue:
    When queue closure is required, then mq queue is properly closed to release system resources.
  • Context - mq queue has been closed after message processing:
    For Set Processing Complete Flag:
    When processing completion status is required, then processing complete flag is set to indicate successful completion of queue reading.
  • Context - queue opening operation has failed:
    For Handle Queue Open Error:
    When queue open error handling is required, then queue open error is handled and appropriate error logging is initiated.
  • Context - queue open error has been detected:
    For Log Queue Error:
    When error logging is required, then queue error details are logged and processing is terminated.
  • Context - message has failed validation checks:
    For Handle Message Error:
    When message error handling is required, then message error is handled and processing continues with next available message.
  • Context - message error handling has been initiated:
    For Log Message Error:
    When error logging is required, then message error details are logged and processing continues to check for more messages.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to read messages from IMS queues
GIVEN
The system needs to read messages from IMS queues
Applied to: Initialize MQ Connection Parameters
WHEN
Queue reading process is initiated
THEN
MQ connection parameters are initialized with proper values for queue access
Context: MQ connection parameters are initialized
GIVEN
MQ connection parameters are initialized
Applied to: Set Queue Name and Options
WHEN
Queue configuration is required
THEN
Queue name and processing options are set according to business requirements
Context: Queue name and options are properly configured
GIVEN
Queue name and options are properly configured
Applied to: Open MQ Queue for Reading
WHEN
Queue opening is attempted
THEN
MQ queue is opened for reading with appropriate access permissions
Context: Queue opening operation has been attempted
GIVEN
Queue opening operation has been attempted
Applied to: Queue Open Successful?
WHEN
Queue open status is evaluated
THEN
If queue opened successfully, proceed to message reading; otherwise handle queue open error
Context: MQ queue is successfully opened for reading
GIVEN
MQ queue is successfully opened for reading
Applied to: Get Message from Queue
WHEN
Message retrieval is requested
THEN
System attempts to get the next message from the queue
Context: Message retrieval has been attempted from the queue
GIVEN
Message retrieval has been attempted from the queue
Applied to: Message Available?
WHEN
Message availability is checked
THEN
If message is available, proceed to process message; if no message available, close queue and complete processing
Context: A message is available and retrieved from the queue
GIVEN
A message is available and retrieved from the queue
Applied to: Calculate Message Length
WHEN
Message length calculation is performed
THEN
Message length is calculated and stored for subsequent processing steps
Context: Message length has been calculated
GIVEN
Message length has been calculated
Applied to: Determine Entry Count
WHEN
Entry count determination is required
THEN
Number of entries in the message is calculated based on message structure and length
Context: Message length and entry count have been determined
GIVEN
Message length and entry count have been determined
Applied to: Validate Message Structure
WHEN
Message structure validation is performed
THEN
Message structure is validated against expected format requirements
Context: Message structure validation has been completed
GIVEN
Message structure validation has been completed
Applied to: Message Valid?
WHEN
Message validity is evaluated
THEN
If message is valid, store in array and update counter; if invalid, handle message error and continue to next message
Context: Message has passed all validation checks
GIVEN
Message has passed all validation checks
Applied to: Store Message in Array
WHEN
Message storage is required
THEN
Valid message is stored in the message processing array
Context: Valid message has been stored in processing array
GIVEN
Valid message has been stored in processing array
Applied to: Update Message Counter
WHEN
Message counter update is required
THEN
Message processing counter is incremented to reflect successful message storage
Context: Current message has been processed (stored or error handled)
GIVEN
Current message has been processed (stored or error handled)
Applied to: More Messages?
WHEN
Additional message check is performed
THEN
If more messages exist, continue reading from queue; if no more messages, proceed to close queue
Context: All available messages have been processed or no messages are available
GIVEN
All available messages have been processed or no messages are available
Applied to: Close MQ Queue
WHEN
Queue closure is required
THEN
MQ queue is properly closed to release system resources
Context: MQ queue has been closed after message processing
GIVEN
MQ queue has been closed after message processing
Applied to: Set Processing Complete Flag
WHEN
Processing completion status is required
THEN
Processing complete flag is set to indicate successful completion of queue reading
Context: Queue opening operation has failed
GIVEN
Queue opening operation has failed
Applied to: Handle Queue Open Error
WHEN
Queue open error handling is required
THEN
Queue open error is handled and appropriate error logging is initiated
Context: Queue open error has been detected
GIVEN
Queue open error has been detected
Applied to: Log Queue Error
WHEN
Error logging is required
THEN
Queue error details are logged and processing is terminated
Context: Message has failed validation checks
GIVEN
Message has failed validation checks
Applied to: Handle Message Error
WHEN
Message error handling is required
THEN
Message error is handled and processing continues with next available message
Context: Message error handling has been initiated
GIVEN
Message error handling has been initiated
Applied to: Log Message Error
WHEN
Error logging is required
THEN
Message error details are logged and processing continues to check for more messages
R-GCX016-cbl-01738 (+3) File: GCX016.cbl MQ Array Initialization Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MQ Array Initialization':
  • Context - an edi message has been read from mq queue:
    For Calculate Message Length:
    When the system needs to determine message structure for array initialization, then the message length is calculated by subtracting 4 from the total message buffer length.
  • Context - the edi message length has been calculated:
    For Calculate Number of EDI Segment Entries:
    When the system needs to initialize the message array structure, then the number of edi segment entries is calculated by dividing message length by 80.
  • Context - the number of edi segment entries has been calculated:
    For Set Array Entry Count:
    When the message array structure needs to be configured, then the array entry count is set to the calculated number of edi segment entries.
  • Context - the message array structure has been configured with entry count:
    For Validate Array Initialization:
    When the system needs to verify successful initialization, then the array initialization is validated to ensure it is ready for edi segment processing.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI message has been read from MQ queue
GIVEN
An EDI message has been read from MQ queue
Applied to: Calculate Message Length
WHEN
The system needs to determine message structure for array initialization
THEN
The message length is calculated by subtracting 4 from the total message buffer length
Context: The EDI message length has been calculated
GIVEN
The EDI message length has been calculated
Applied to: Calculate Number of EDI Segment Entries
WHEN
The system needs to initialize the message array structure
THEN
The number of EDI segment entries is calculated by dividing message length by 80
Context: The number of EDI segment entries has been calculated
GIVEN
The number of EDI segment entries has been calculated
Applied to: Set Array Entry Count
WHEN
The message array structure needs to be configured
THEN
The array entry count is set to the calculated number of EDI segment entries
Context: The message array structure has been configured with entry count
GIVEN
The message array structure has been configured with entry count
Applied to: Validate Array Initialization
WHEN
The system needs to verify successful initialization
THEN
The array initialization is validated to ensure it is ready for EDI segment processing
R-GCX016-cbl-01742 (+18) File: GCX016.cbl Train Message Processing Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Message Processing':
  • Context - a train message is received for processing:
    For Message Source?:
    When the system evaluates the message source type, then the system identifies whether the message comes from mq queue or direct input source.
  • Context - a train message is identified as coming from mq queue source:
    For Initialize MQ Message Arrays:
    When the system processes the queue-based message, then the system initializes mq message arrays for train and cargo processing.
  • Context - a train message requires processing:
    For Set Train Operation Flags:
    When the system prepares for train operations, then the system sets appropriate train operation flags for the current processing session.
  • Context - train operation flags are configured:
    For Load M10 Manifest Segment:
    When the system processes train manifest data, then the system loads m10 segment with train identification and manifest details.
  • Context - m10 manifest segment is loaded:
    For Load V9 Event Detail Segment:
    When the system processes train event data, then the system loads v9 segment with event details and status change information.
  • Context - v9 event detail segment is loaded with event codes:
    For Train Arrival Message?:
    When the system evaluates the event type in the v9 segment, then the system identifies whether the message indicates a train arrival event (pod or aad codes).
  • Context - a train arrival message is detected:
    For Set Arrival Processing Mode:
    When the system prepares for arrival processing, then the system sets arrival processing mode flags and configures arrival-specific processing parameters.
  • Context - arrival processing mode is activated:
    For Initialize Train Arrival Arrays:
    When the system prepares arrival data structures, then the system initializes train arrival arrays for processing arrival-related cargo and equipment data.
  • Context - the message is not a train arrival message and v9 event detail segment contains event codes:
    For Train Cancellation Message?:
    When the system evaluates the event type for cancellation indicators, then the system identifies whether the message indicates a train cancellation event (coc code).
  • Context - a train cancellation message is detected:
    For Set Cancellation Processing Mode:
    When the system prepares for cancellation processing, then the system sets cancellation processing mode flags and configures cancellation-specific processing parameters.
  • Context - cancellation processing mode is activated:
    For Initialize Cancellation Arrays:
    When the system prepares cancellation data structures, then the system initializes cancellation arrays for processing cancellation-related cargo and equipment data.
  • Context - the message is neither a train arrival nor cancellation message:
    For Set Default Train Processing Mode:
    When the system prepares for standard train processing, then the system sets default train processing mode for standard train operations.
  • Context - default train processing mode is configured:
    For Initialize Standard Train Arrays:
    When the system prepares standard train data structures, then the system initializes standard train arrays for processing general train operations and cargo data.
  • Context - train arrays are initialized for the appropriate processing mode:
    For Validate Message Structure:
    When the system validates the train message structure, then the system checks for required segments, proper formatting, and data completeness in the train message.
  • Context - train message structure validation is completed:
    For Message Valid?:
    When the system evaluates validation results, then the system determines whether the message structure is valid and contains all required data elements.
  • Context - train message structure validation is successful:
    For Set Message Ready Flag:
    When the system confirms message validity, then the system sets message ready flag to indicate the train message is prepared for business processing.
  • Context - message ready flag is set for a valid train message:
    For Log Train Message Initialization:
    When the system completes train message initialization, then the system logs the successful initialization with message details and processing mode information.
  • Context - train message structure validation fails:
    For Generate Error Message:
    When the system detects invalid message structure or missing required data, then the system generates appropriate error message describing the validation failure.
  • Context - error message is generated for invalid train message:
    For Set Error Flag:
    When the system handles validation failure, then the system sets error flag to prevent further business processing of the invalid train message.
👨‍💻 Technical ACs (Gherkin)
Context: A train message is received for processing
GIVEN
A train message is received for processing
Applied to: Message Source?
WHEN
The system evaluates the message source type
THEN
The system identifies whether the message comes from MQ Queue or Direct Input source
Context: A train message is identified as coming from MQ Queue source
GIVEN
A train message is identified as coming from MQ Queue source
Applied to: Initialize MQ Message Arrays
WHEN
The system processes the queue-based message
THEN
The system initializes MQ message arrays for train and cargo processing
Context: A train message requires processing
GIVEN
A train message requires processing
Applied to: Set Train Operation Flags
WHEN
The system prepares for train operations
THEN
The system sets appropriate train operation flags for the current processing session
Context: Train operation flags are configured
GIVEN
Train operation flags are configured
Applied to: Load M10 Manifest Segment
WHEN
The system processes train manifest data
THEN
The system loads M10 segment with train identification and manifest details
Context: M10 manifest segment is loaded
GIVEN
M10 manifest segment is loaded
Applied to: Load V9 Event Detail Segment
WHEN
The system processes train event data
THEN
The system loads V9 segment with event details and status change information
Context: V9 event detail segment is loaded with event codes
GIVEN
V9 event detail segment is loaded with event codes
Applied to: Train Arrival Message?
WHEN
The system evaluates the event type in the V9 segment
THEN
The system identifies whether the message indicates a train arrival event (POD or AAD codes)
Context: A train arrival message is detected
GIVEN
A train arrival message is detected
Applied to: Set Arrival Processing Mode
WHEN
The system prepares for arrival processing
THEN
The system sets arrival processing mode flags and configures arrival-specific processing parameters
Context: Arrival processing mode is activated
GIVEN
Arrival processing mode is activated
Applied to: Initialize Train Arrival Arrays
WHEN
The system prepares arrival data structures
THEN
The system initializes train arrival arrays for processing arrival-related cargo and equipment data
Context: The message is not a train arrival message and V9 event detail segment contains event codes
GIVEN
The message is not a train arrival message and V9 event detail segment contains event codes
Applied to: Train Cancellation Message?
WHEN
The system evaluates the event type for cancellation indicators
THEN
The system identifies whether the message indicates a train cancellation event (COC code)
Context: A train cancellation message is detected
GIVEN
A train cancellation message is detected
Applied to: Set Cancellation Processing Mode
WHEN
The system prepares for cancellation processing
THEN
The system sets cancellation processing mode flags and configures cancellation-specific processing parameters
Context: Cancellation processing mode is activated
GIVEN
Cancellation processing mode is activated
Applied to: Initialize Cancellation Arrays
WHEN
The system prepares cancellation data structures
THEN
The system initializes cancellation arrays for processing cancellation-related cargo and equipment data
Context: The message is neither a train arrival nor cancellation message
GIVEN
The message is neither a train arrival nor cancellation message
Applied to: Set Default Train Processing Mode
WHEN
The system prepares for standard train processing
THEN
The system sets default train processing mode for standard train operations
Context: Default train processing mode is configured
GIVEN
Default train processing mode is configured
Applied to: Initialize Standard Train Arrays
WHEN
The system prepares standard train data structures
THEN
The system initializes standard train arrays for processing general train operations and cargo data
Context: Train arrays are initialized for the appropriate processing mode
GIVEN
Train arrays are initialized for the appropriate processing mode
Applied to: Validate Message Structure
WHEN
The system validates the train message structure
THEN
The system checks for required segments, proper formatting, and data completeness in the train message
Context: Train message structure validation is completed
GIVEN
Train message structure validation is completed
Applied to: Message Valid?
WHEN
The system evaluates validation results
THEN
The system determines whether the message structure is valid and contains all required data elements
Context: Train message structure validation is successful
GIVEN
Train message structure validation is successful
Applied to: Set Message Ready Flag
WHEN
The system confirms message validity
THEN
The system sets message ready flag to indicate the train message is prepared for business processing
Context: Message ready flag is set for a valid train message
GIVEN
Message ready flag is set for a valid train message
Applied to: Log Train Message Initialization
WHEN
The system completes train message initialization
THEN
The system logs the successful initialization with message details and processing mode information
Context: Train message structure validation fails
GIVEN
Train message structure validation fails
Applied to: Generate Error Message
WHEN
The system detects invalid message structure or missing required data
THEN
The system generates appropriate error message describing the validation failure
Context: Error message is generated for invalid train message
GIVEN
Error message is generated for invalid train message
Applied to: Set Error Flag
WHEN
The system handles validation failure
THEN
The system sets error flag to prevent further business processing of the invalid train message
R-GCX016-cbl-01761 (+39) File: GCX016.cbl MQ Connection Management Merged 40 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MQ Connection Management':
  • Context - system needs to establish mq connection:
    For Initialize MQ Connection Parameters:
    When mq connection process is initiated, then connection parameters are initialized with default values.
  • Context - mq connection parameters are initialized:
    For Attempt MQ Connection:
    When system attempts to connect to mq manager, then connection attempt is made and result is evaluated.
  • Context - mq connection attempt has been made:
    For Connection Successful?:
    When connection completion code is evaluated, then if completion code equals mqcc-ok then connection is successful, otherwise connection failed.
    For Connection Successful?:
    When connection result is evaluated, then system determines if connection was successful based on completion code.
  • Context - mq connection attempt failed:
    For Log Connection Error:
    When connection completion code is not mqcc-ok, then connection error is logged with error details.
    For Log Connection Error:
    When logging connection error, then error details are recorded in system log.
  • Context - mq connection has failed:
    For Set Error Status:
    When connection error is logged, then error status flag is set to indicate connection failure.
  • Context - mq connection is successful:
    For Open MQ Queue for Reading:
    When system attempts to open queue for reading, then queue open operation is performed.
  • Context - queue open attempt has been made:
    For Queue Open Successful?:
    When queue open completion code is evaluated, then if completion code equals mqcc-ok then queue open is successful, otherwise queue open failed.
  • Context - mq queue open attempt failed:
    For Log Queue Open Error:
    When queue open completion code is not mqcc-ok, then queue open error is logged with error details.
  • Context - mq queue opening has failed:
    For Set Queue Error Status:
    When queue open error is logged, then queue error status flag is set to indicate queue open failure.
  • Context - mq queue is successfully opened:
    For Validate Queue Availability:
    When system checks queue availability for processing, then queue availability status is determined.
  • Context - queue availability has been validated:
    For Queue Available for Processing?:
    When system evaluates queue processing readiness, then if queue is available then processing can proceed, otherwise handle unavailability.
  • Context - mq queue is available for processing:
    For Set Connection Ready Status:
    When all mq setup operations are successful, then connection ready status is set to indicate mq is operational.
  • Context - mq connection is ready for processing:
    For Log Connection Success:
    When connection ready status is set, then successful connection is logged.
  • Context - mq connection or queue operation has failed:
    For Retry Connection Logic:
    When connection failure is handled, then retry logic is initiated to attempt reconnection.
  • Context - retry logic is active:
    For Retry Attempts Remaining?:
    When system checks remaining retry attempts, then if retry attempts remain then retry connection, otherwise proceed to final failure.
  • Context - all retry attempts have been exhausted:
    For Final Connection Failure:
    When no more retry attempts remain, then final connection failure status is set.
  • Context - final mq connection failure has occurred:
    For Terminate Processing:
    When mq connection is permanently unavailable, then processing is terminated due to mq unavailability.
  • Context - mq connection management process is starting:
    For Initialize MQ Connection Parameters:
    When system initializes connection parameters, then all mq connection parameters are set to default values and connection variables are cleared.
  • Context - mq connection parameters are being configured:
    For Set Queue Manager Name:
    When queue manager name is being set, then queue manager name is assigned to connection configuration.
  • Context - queue manager name has been set:
    For Set Connection Options:
    When connection options are being configured, then connection options are set according to system requirements.
  • Context - all connection parameters and options are configured:
    For Attempt MQ Connection:
    When system attempts mq connection, then connection attempt is made using mq connect operation.
  • Context - mq connection was successful:
    For Log Connection Success:
    When logging connection success, then success message is recorded in system log.
  • Context - mq connection was successful and logged:
    For Set Connection Status Active:
    When setting connection status, then connection status is set to active state.
  • Context - connection status is set to active:
    For Connection Ready for Message Processing:
    When confirming readiness for message processing, then system indicates mq connection is ready for message operations.
  • Context - connection error has been logged:
    For Set Error Code and Message:
    When setting error information, then error code and descriptive message are assigned based on failure reason.
  • Context - mq connection failed and error information is set:
    For Retry Connection?:
    When evaluating retry decision, then system determines if connection should be retried based on error type and retry policy.
  • Context - retry decision is positive:
    For Wait Before Retry:
    When waiting before retry, then system waits for configured retry interval.
  • Context - wait period before retry has completed:
    For Increment Retry Counter:
    When incrementing retry counter, then retry counter is increased by one.
  • Context - retry counter has been incremented:
    For Max Retries Reached?:
    When checking maximum retries, then system determines if retry counter equals or exceeds maximum allowed retries.
  • Context - maximum retries reached or retry decision is negative:
    For Set Connection Failed Status:
    When setting connection failed status, then connection status is set to failed state.
  • Context - connection status is set to failed:
    For Notify System Administrator:
    When notifying system administrator, then administrator notification is sent with connection failure details.
  • Context - administrator has been notified of connection failure:
    For Terminate Processing:
    When terminating processing, then system stops processing and exits with appropriate status.
  • Context - mq connection is ready for message processing:
    For Monitor Connection Health:
    When monitoring connection health, then system checks connection status periodically.
  • Context - connection health monitoring is active:
    For Connection Still Active?:
    When checking if connection is still active, then system determines current connection status.
  • Context - connection is verified as still active:
    For Continue Normal Processing:
    When continuing normal processing, then system proceeds with regular message processing operations.
  • Context - connection is no longer active:
    For Attempt Reconnection:
    When attempting reconnection, then system initiates new connection attempt using existing parameters.
  • Context - message processing is complete or system is shutting down:
    For Close MQ Connection:
    When closing mq connection, then connection is properly closed using mq disconnect operation.
  • Context - mq connection has been closed:
    For Clean Up Resources:
    When cleaning up resources, then all allocated mq resources are released and variables are reset.
👨‍💻 Technical ACs (Gherkin)
Context: System needs to establish MQ connection
GIVEN
System needs to establish MQ connection
Applied to: Initialize MQ Connection Parameters
WHEN
MQ connection process is initiated
THEN
Connection parameters are initialized with default values
Context: MQ connection parameters are initialized
GIVEN
MQ connection parameters are initialized
Applied to: Attempt MQ Connection
WHEN
System attempts to connect to MQ manager
THEN
Connection attempt is made and result is evaluated
Context: MQ connection attempt has been made
GIVEN
MQ connection attempt has been made
Applied to: Connection Successful?
WHEN
Connection completion code is evaluated
THEN
If completion code equals MQCC-OK then connection is successful, otherwise connection failed
Applied to: Connection Successful?
WHEN
connection result is evaluated
THEN
system determines if connection was successful based on completion code
Context: MQ connection attempt failed
GIVEN
MQ connection attempt failed
Applied to: Log Connection Error
WHEN
Connection completion code is not MQCC-OK
THEN
Connection error is logged with error details
Applied to: Log Connection Error
WHEN
logging connection error
THEN
error details are recorded in system log
Context: MQ connection has failed
GIVEN
MQ connection has failed
Applied to: Set Error Status
WHEN
Connection error is logged
THEN
Error status flag is set to indicate connection failure
Context: MQ connection is successful
GIVEN
MQ connection is successful
Applied to: Open MQ Queue for Reading
WHEN
System attempts to open queue for reading
THEN
Queue open operation is performed
Context: Queue open attempt has been made
GIVEN
Queue open attempt has been made
Applied to: Queue Open Successful?
WHEN
Queue open completion code is evaluated
THEN
If completion code equals MQCC-OK then queue open is successful, otherwise queue open failed
Context: MQ queue open attempt failed
GIVEN
MQ queue open attempt failed
Applied to: Log Queue Open Error
WHEN
Queue open completion code is not MQCC-OK
THEN
Queue open error is logged with error details
Context: MQ queue opening has failed
GIVEN
MQ queue opening has failed
Applied to: Set Queue Error Status
WHEN
Queue open error is logged
THEN
Queue error status flag is set to indicate queue open failure
Context: MQ queue is successfully opened
GIVEN
MQ queue is successfully opened
Applied to: Validate Queue Availability
WHEN
System checks queue availability for processing
THEN
Queue availability status is determined
Context: Queue availability has been validated
GIVEN
Queue availability has been validated
Applied to: Queue Available for Processing?
WHEN
System evaluates queue processing readiness
THEN
If queue is available then processing can proceed, otherwise handle unavailability
Context: MQ queue is available for processing
GIVEN
MQ queue is available for processing
Applied to: Set Connection Ready Status
WHEN
All MQ setup operations are successful
THEN
Connection ready status is set to indicate MQ is operational
Context: MQ connection is ready for processing
GIVEN
MQ connection is ready for processing
Applied to: Log Connection Success
WHEN
Connection ready status is set
THEN
Successful connection is logged
Context: MQ connection or queue operation has failed
GIVEN
MQ connection or queue operation has failed
Applied to: Retry Connection Logic
WHEN
Connection failure is handled
THEN
Retry logic is initiated to attempt reconnection
Context: Retry logic is active
GIVEN
Retry logic is active
Applied to: Retry Attempts Remaining?
WHEN
System checks remaining retry attempts
THEN
If retry attempts remain then retry connection, otherwise proceed to final failure
Context: All retry attempts have been exhausted
GIVEN
All retry attempts have been exhausted
Applied to: Final Connection Failure
WHEN
No more retry attempts remain
THEN
Final connection failure status is set
Context: Final MQ connection failure has occurred
GIVEN
Final MQ connection failure has occurred
Applied to: Terminate Processing
WHEN
MQ connection is permanently unavailable
THEN
Processing is terminated due to MQ unavailability
Context: MQ connection management process is starting
GIVEN
MQ connection management process is starting
Applied to: Initialize MQ Connection Parameters
WHEN
system initializes connection parameters
THEN
all MQ connection parameters are set to default values and connection variables are cleared
Context: MQ connection parameters are being configured
GIVEN
MQ connection parameters are being configured
Applied to: Set Queue Manager Name
WHEN
queue manager name is being set
THEN
queue manager name is assigned to connection configuration
Context: queue manager name has been set
GIVEN
queue manager name has been set
Applied to: Set Connection Options
WHEN
connection options are being configured
THEN
connection options are set according to system requirements
Context: all connection parameters and options are configured
GIVEN
all connection parameters and options are configured
Applied to: Attempt MQ Connection
WHEN
system attempts MQ connection
THEN
connection attempt is made using MQ connect operation
Context: MQ connection was successful
GIVEN
MQ connection was successful
Applied to: Log Connection Success
WHEN
logging connection success
THEN
success message is recorded in system log
Context: MQ connection was successful and logged
GIVEN
MQ connection was successful and logged
Applied to: Set Connection Status Active
WHEN
setting connection status
THEN
connection status is set to active state
Context: connection status is set to active
GIVEN
connection status is set to active
Applied to: Connection Ready for Message Processing
WHEN
confirming readiness for message processing
THEN
system indicates MQ connection is ready for message operations
Context: connection error has been logged
GIVEN
connection error has been logged
Applied to: Set Error Code and Message
WHEN
setting error information
THEN
error code and descriptive message are assigned based on failure reason
Context: MQ connection failed and error information is set
GIVEN
MQ connection failed and error information is set
Applied to: Retry Connection?
WHEN
evaluating retry decision
THEN
system determines if connection should be retried based on error type and retry policy
Context: retry decision is positive
GIVEN
retry decision is positive
Applied to: Wait Before Retry
WHEN
waiting before retry
THEN
system waits for configured retry interval
Context: wait period before retry has completed
GIVEN
wait period before retry has completed
Applied to: Increment Retry Counter
WHEN
incrementing retry counter
THEN
retry counter is increased by one
Context: retry counter has been incremented
GIVEN
retry counter has been incremented
Applied to: Max Retries Reached?
WHEN
checking maximum retries
THEN
system determines if retry counter equals or exceeds maximum allowed retries
Context: maximum retries reached or retry decision is negative
GIVEN
maximum retries reached or retry decision is negative
Applied to: Set Connection Failed Status
WHEN
setting connection failed status
THEN
connection status is set to failed state
Context: connection status is set to failed
GIVEN
connection status is set to failed
Applied to: Notify System Administrator
WHEN
notifying system administrator
THEN
administrator notification is sent with connection failure details
Context: administrator has been notified of connection failure
GIVEN
administrator has been notified of connection failure
Applied to: Terminate Processing
WHEN
terminating processing
THEN
system stops processing and exits with appropriate status
Context: MQ connection is ready for message processing
GIVEN
MQ connection is ready for message processing
Applied to: Monitor Connection Health
WHEN
monitoring connection health
THEN
system checks connection status periodically
Context: connection health monitoring is active
GIVEN
connection health monitoring is active
Applied to: Connection Still Active?
WHEN
checking if connection is still active
THEN
system determines current connection status
Context: connection is verified as still active
GIVEN
connection is verified as still active
Applied to: Continue Normal Processing
WHEN
continuing normal processing
THEN
system proceeds with regular message processing operations
Context: connection is no longer active
GIVEN
connection is no longer active
Applied to: Attempt Reconnection
WHEN
attempting reconnection
THEN
system initiates new connection attempt using existing parameters
Context: message processing is complete or system is shutting down
GIVEN
message processing is complete or system is shutting down
Applied to: Close MQ Connection
WHEN
closing MQ connection
THEN
connection is properly closed using MQ disconnect operation
Context: MQ connection has been closed
GIVEN
MQ connection has been closed
Applied to: Clean Up Resources
WHEN
cleaning up resources
THEN
all allocated MQ resources are released and variables are reset
R-GCX016-cbl-01778 (+14) File: GCX016.cbl MQ Queue Operations Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MQ Queue Operations':
  • Context - system needs to process messages from message queue:
    For Establish MQ Connection:
    When mq connection is initiated, then connection is established and ready for queue operations.
  • Context - mq connection attempt has been made:
    For Connection Successful?:
    When connection status is evaluated, then if connection successful, proceed to open queue; if connection failed, handle connection error.
  • Context - mq connection is established successfully:
    For Open MQ Queue for Reading:
    When queue open operation is initiated, then queue is opened for reading messages.
  • Context - queue open operation has been attempted:
    For Queue Open Successful?:
    When queue open status is evaluated, then if queue opened successfully, proceed to get messages; if queue open failed, handle queue open error.
  • Context - message queue is successfully opened:
    For Get Message from Queue:
    When message retrieval is initiated, then message is retrieved from queue for processing.
  • Context - message retrieval attempt has been made:
    For Message Available?:
    When message availability is checked, then if message is available, calculate message length; if no message available, check for more messages.
  • Context - message is available in queue:
    For Calculate Message Length:
    When message length calculation is performed, then message length is determined for proper processing.
  • Context - message length has been calculated:
    For Calculate Entry Count:
    When entry count calculation is performed, then number of message entries is determined for array initialization.
  • Context - entry count has been calculated:
    For Initialize Message Array:
    When message array initialization is performed, then message array is prepared to store message entries.
  • Context - message array is initialized:
    For Process Variable-Length Message:
    When variable-length message processing is performed, then message content is parsed and stored in message array.
  • Context - current message has been processed:
    For More Messages?:
    When additional message availability is checked, then if more messages exist, continue message retrieval; if no more messages, close queue.
  • Context - mq connection attempt has failed:
    For Handle MQ Connection Error:
    When connection error handling is invoked, then connection error is processed and operations are terminated.
  • Context - queue open operation has failed:
    For Handle Queue Open Error:
    When queue open error handling is invoked, then queue open error is processed and operations are terminated.
  • Context - message retrieval operation has failed:
    For Handle Message Retrieval Error:
    When message retrieval error handling is invoked, then message retrieval error is processed and operations are terminated.
  • Context - message processing is complete or error has occurred:
    For Close MQ Queue:
    When queue closure is initiated, then message queue is properly closed.
👨‍💻 Technical ACs (Gherkin)
Context: System needs to process messages from message queue
GIVEN
System needs to process messages from message queue
Applied to: Establish MQ Connection
WHEN
MQ connection is initiated
THEN
Connection is established and ready for queue operations
Context: MQ connection attempt has been made
GIVEN
MQ connection attempt has been made
Applied to: Connection Successful?
WHEN
Connection status is evaluated
THEN
If connection successful, proceed to open queue; if connection failed, handle connection error
Context: MQ connection is established successfully
GIVEN
MQ connection is established successfully
Applied to: Open MQ Queue for Reading
WHEN
Queue open operation is initiated
THEN
Queue is opened for reading messages
Context: Queue open operation has been attempted
GIVEN
Queue open operation has been attempted
Applied to: Queue Open Successful?
WHEN
Queue open status is evaluated
THEN
If queue opened successfully, proceed to get messages; if queue open failed, handle queue open error
Context: Message queue is successfully opened
GIVEN
Message queue is successfully opened
Applied to: Get Message from Queue
WHEN
Message retrieval is initiated
THEN
Message is retrieved from queue for processing
Context: Message retrieval attempt has been made
GIVEN
Message retrieval attempt has been made
Applied to: Message Available?
WHEN
Message availability is checked
THEN
If message is available, calculate message length; if no message available, check for more messages
Context: Message is available in queue
GIVEN
Message is available in queue
Applied to: Calculate Message Length
WHEN
Message length calculation is performed
THEN
Message length is determined for proper processing
Context: Message length has been calculated
GIVEN
Message length has been calculated
Applied to: Calculate Entry Count
WHEN
Entry count calculation is performed
THEN
Number of message entries is determined for array initialization
Context: Entry count has been calculated
GIVEN
Entry count has been calculated
Applied to: Initialize Message Array
WHEN
Message array initialization is performed
THEN
Message array is prepared to store message entries
Context: Message array is initialized
GIVEN
Message array is initialized
Applied to: Process Variable-Length Message
WHEN
Variable-length message processing is performed
THEN
Message content is parsed and stored in message array
Context: Current message has been processed
GIVEN
Current message has been processed
Applied to: More Messages?
WHEN
Additional message availability is checked
THEN
If more messages exist, continue message retrieval; if no more messages, close queue
Context: MQ connection attempt has failed
GIVEN
MQ connection attempt has failed
Applied to: Handle MQ Connection Error
WHEN
Connection error handling is invoked
THEN
Connection error is processed and operations are terminated
Context: Queue open operation has failed
GIVEN
Queue open operation has failed
Applied to: Handle Queue Open Error
WHEN
Queue open error handling is invoked
THEN
Queue open error is processed and operations are terminated
Context: Message retrieval operation has failed
GIVEN
Message retrieval operation has failed
Applied to: Handle Message Retrieval Error
WHEN
Message retrieval error handling is invoked
THEN
Message retrieval error is processed and operations are terminated
Context: Message processing is complete or error has occurred
GIVEN
Message processing is complete or error has occurred
Applied to: Close MQ Queue
WHEN
Queue closure is initiated
THEN
Message queue is properly closed
R-GCX016-cbl-01793 (+18) File: GCX016.cbl Message Array Processing Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Array Processing':
  • Context - a message needs to be processed for edi 350 format:
    For Initialize Message Arrays for EDI 350:
    When the system begins message array initialization, then message arrays are initialized with edi 350 parameters and processing structure is established.
  • Context - a message is received for processing:
    For Calculate Message Length:
    When the system needs to determine message boundaries, then message length is calculated and validated for further processing.
  • Context - a message with known length and structure:
    For Determine Number of EDI Segment Entries:
    When the system processes the message content, then the number of edi segment entries is determined based on message structure and length.
  • Context - a message with calculated length:
    For Message Length Valid?:
    When the system validates message length requirements, then processing continues if length is valid, otherwise error handling is triggered.
  • Context - a valid message with confirmed structure:
    For Calculate Entry Count Based on Structure:
    When the system analyzes message content for entry counting, then entry count is calculated based on message structure parameters and segment boundaries.
  • Context - a message with variable-length content structure:
    For Process Variable-Length Message Content:
    When the system processes the message content, then variable-length content is processed appropriately regardless of actual message size.
  • Context - a message ready for type classification:
    For Train Message Type?:
    When the system evaluates message type indicators, then train-specific processing is initiated if message is train-related, otherwise standard processing applies.
  • Context - a message identified as train-related:
    For Initialize Arrays for Train Operations:
    When the system initializes processing arrays, then arrays are configured with train-specific parameters and processing capabilities.
  • Context - train message arrays are being initialized:
    For Set M10 and V9 Segment Parameters:
    When the system sets up segment-specific parameters, then m10 manifest segment and v9 event segment parameters are properly configured for train operations.
  • Context - a message identified as non-train related:
    For Initialize Arrays for Standard Processing:
    When the system initializes processing arrays, then arrays are configured with standard parameters for general message processing.
  • Context - message array processing is in progress:
    For More Entries to Process?:
    When the system checks for remaining entries, then processing continues if more entries exist, otherwise array processing is completed.
  • Context - more entries are available for processing:
    For Extract Next EDI Segment:
    When the system extracts the next segment, then the next edi segment is retrieved and prepared for validation and processing.
  • Context - an edi segment has been extracted:
    For Validate Segment Structure:
    When the system validates segment structure, then segment is confirmed as valid for processing or marked as invalid for error handling.
  • Context - a segment has undergone structure validation:
    For Segment Valid?:
    When the system evaluates segment validity, then valid segments are queued for processing while invalid segments trigger error logging.
  • Context - a segment has been validated as structurally correct:
    For Add Segment to Processing Queue:
    When the system adds the segment to processing queue, then segment is queued for business processing and made available for subsequent operations.
  • Context - a segment has failed validation checks:
    For Log Invalid Segment Error:
    When the system processes the invalid segment, then error information is logged with segment details and processing continues with next entry.
  • Context - all message entries have been processed:
    For Complete Array Processing:
    When the system completes array processing, then processing results are consolidated and prepared for return to calling process.
  • Context - message array processing has been completed:
    For Return Processed Message Data:
    When the system returns processing results, then processed message data and status information are returned to the calling process.
  • Context - an error condition has occurred during array processing:
    For Handle Array Processing Error:
    When the system handles the error condition, then error information is captured and appropriate error response is returned to calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A message needs to be processed for EDI 350 format
GIVEN
A message needs to be processed for EDI 350 format
Applied to: Initialize Message Arrays for EDI 350
WHEN
The system begins message array initialization
THEN
Message arrays are initialized with EDI 350 parameters and processing structure is established
Context: A message is received for processing
GIVEN
A message is received for processing
Applied to: Calculate Message Length
WHEN
The system needs to determine message boundaries
THEN
Message length is calculated and validated for further processing
Context: A message with known length and structure
GIVEN
A message with known length and structure
Applied to: Determine Number of EDI Segment Entries
WHEN
The system processes the message content
THEN
The number of EDI segment entries is determined based on message structure and length
Context: A message with calculated length
GIVEN
A message with calculated length
Applied to: Message Length Valid?
WHEN
The system validates message length requirements
THEN
Processing continues if length is valid, otherwise error handling is triggered
Context: A valid message with confirmed structure
GIVEN
A valid message with confirmed structure
Applied to: Calculate Entry Count Based on Structure
WHEN
The system analyzes message content for entry counting
THEN
Entry count is calculated based on message structure parameters and segment boundaries
Context: A message with variable-length content structure
GIVEN
A message with variable-length content structure
Applied to: Process Variable-Length Message Content
WHEN
The system processes the message content
THEN
Variable-length content is processed appropriately regardless of actual message size
Context: A message ready for type classification
GIVEN
A message ready for type classification
Applied to: Train Message Type?
WHEN
The system evaluates message type indicators
THEN
Train-specific processing is initiated if message is train-related, otherwise standard processing applies
Context: A message identified as train-related
GIVEN
A message identified as train-related
Applied to: Initialize Arrays for Train Operations
WHEN
The system initializes processing arrays
THEN
Arrays are configured with train-specific parameters and processing capabilities
Context: Train message arrays are being initialized
GIVEN
Train message arrays are being initialized
Applied to: Set M10 and V9 Segment Parameters
WHEN
The system sets up segment-specific parameters
THEN
M10 manifest segment and V9 event segment parameters are properly configured for train operations
Context: A message identified as non-train related
GIVEN
A message identified as non-train related
Applied to: Initialize Arrays for Standard Processing
WHEN
The system initializes processing arrays
THEN
Arrays are configured with standard parameters for general message processing
Context: Message array processing is in progress
GIVEN
Message array processing is in progress
Applied to: More Entries to Process?
WHEN
The system checks for remaining entries
THEN
Processing continues if more entries exist, otherwise array processing is completed
Context: More entries are available for processing
GIVEN
More entries are available for processing
Applied to: Extract Next EDI Segment
WHEN
The system extracts the next segment
THEN
The next EDI segment is retrieved and prepared for validation and processing
Context: An EDI segment has been extracted
GIVEN
An EDI segment has been extracted
Applied to: Validate Segment Structure
WHEN
The system validates segment structure
THEN
Segment is confirmed as valid for processing or marked as invalid for error handling
Context: A segment has undergone structure validation
GIVEN
A segment has undergone structure validation
Applied to: Segment Valid?
WHEN
The system evaluates segment validity
THEN
Valid segments are queued for processing while invalid segments trigger error logging
Context: A segment has been validated as structurally correct
GIVEN
A segment has been validated as structurally correct
Applied to: Add Segment to Processing Queue
WHEN
The system adds the segment to processing queue
THEN
Segment is queued for business processing and made available for subsequent operations
Context: A segment has failed validation checks
GIVEN
A segment has failed validation checks
Applied to: Log Invalid Segment Error
WHEN
The system processes the invalid segment
THEN
Error information is logged with segment details and processing continues with next entry
Context: All message entries have been processed
GIVEN
All message entries have been processed
Applied to: Complete Array Processing
WHEN
The system completes array processing
THEN
Processing results are consolidated and prepared for return to calling process
Context: Message array processing has been completed
GIVEN
Message array processing has been completed
Applied to: Return Processed Message Data
WHEN
The system returns processing results
THEN
Processed message data and status information are returned to the calling process
Context: An error condition has occurred during array processing
GIVEN
An error condition has occurred during array processing
Applied to: Handle Array Processing Error
WHEN
The system handles the error condition
THEN
Error information is captured and appropriate error response is returned to calling process
R-GCX016-cbl-01812 (+14) File: GCX016.cbl GCT0161E Spawning Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'GCT0161E Spawning':
  • Context - a message is available for processing from the message queue:
    For Message Type?:
    When the system evaluates the message type and processing requirements, then the message is classified as multi-manifest, train operations, or standard processing based on message characteristics.
  • Context - a message has been classified for processing:
    For Multi-manifest Processing Required:
    When the message contains lead manifest information with associated follower manifests, then the system initiates multi-manifest processing workflow.
    For Standard Message Processing Required:
    When the message is neither multi-manifest nor train operations type, then the system routes the message to standard processing workflow.
  • Context - a message has been classified as train operations:
    For Train Message Processing Required:
    When the message contains train arrival, cancellation, or status change information, then the system routes the message to train-specific processing workflow.
  • Context - a lead manifest requires multi-manifest processing:
    For Identify Follower Manifests:
    When the system searches for related follower manifests using the lead manifest ccn key, then all associated follower manifests are identified and queued for processing.
  • Context - follower manifests have been identified for processing:
    For Format EDI 350 Message for Each Follower:
    When the system prepares transaction messages for each follower, then each follower manifest gets an edi 350 message with action code '350', disposition code, quantity, and entry number from the x4 segment.
  • Context - a train operations message requires processing:
    For Prepare Train Arrival/Cancellation Message:
    When the system prepares train arrival or cancellation parameters, then train message parameters are formatted with vessel name, event codes, and timing information.
  • Context - a message requires transaction spawning:
    For Initialize Message Array Parameters:
    When the system initializes message array parameters, then message array is populated with message segments, processing flags, and transaction identifiers.
  • Context - message processing parameters have been prepared:
    For Set Transaction Parameters:
    When the system sets transaction parameters for gct0161e spawning, then transaction parameters are configured with message type, processing mode, and target transaction identifier.
  • Context - transaction parameters have been configured:
    For Spawn GCT0161E Transaction:
    When the system attempts to spawn gct0161e transaction, then gct0161e transaction is spawned with the prepared message parameters and processing begins.
  • Context - gct0161e transaction spawning has been attempted:
    For Transaction Successfully Spawned:
    When the transaction spawning completes successfully, then the system confirms successful spawning and continues with next processing step.
    For Error in Transaction Spawning:
    When the transaction spawning fails due to system or resource constraints, then the system captures the error condition and routes to error handling process.
  • Context - a manifest has been successfully processed in multi-manifest mode:
    For More Manifests to Process?:
    When the system checks for additional unprocessed follower manifests, then if more manifests exist, processing continues; otherwise, multi-manifest processing completes.
  • Context - a transaction spawning error has occurred:
    For Log Error and Continue:
    When the system processes the error condition, then the error is logged with appropriate details and processing continues with the next message.
  • Context - current message processing has completed successfully or error has been handled:
    For Continue with Next Message:
    When the system is ready to process the next message, then processing continues with the next available message from the queue.
👨‍💻 Technical ACs (Gherkin)
Context: A message is available for processing from the message queue
GIVEN
A message is available for processing from the message queue
Applied to: Message Type?
WHEN
The system evaluates the message type and processing requirements
THEN
The message is classified as multi-manifest, train operations, or standard processing based on message characteristics
Context: A message has been classified for processing
GIVEN
A message has been classified for processing
Applied to: Multi-manifest Processing Required
WHEN
The message contains lead manifest information with associated follower manifests
THEN
The system initiates multi-manifest processing workflow
Applied to: Standard Message Processing Required
WHEN
The message is neither multi-manifest nor train operations type
THEN
The system routes the message to standard processing workflow
Context: A message has been classified as train operations
GIVEN
A message has been classified as train operations
Applied to: Train Message Processing Required
WHEN
The message contains train arrival, cancellation, or status change information
THEN
The system routes the message to train-specific processing workflow
Context: A lead manifest requires multi-manifest processing
GIVEN
A lead manifest requires multi-manifest processing
Applied to: Identify Follower Manifests
WHEN
The system searches for related follower manifests using the lead manifest CCN key
THEN
All associated follower manifests are identified and queued for processing
Context: Follower manifests have been identified for processing
GIVEN
Follower manifests have been identified for processing
Applied to: Format EDI 350 Message for Each Follower
WHEN
The system prepares transaction messages for each follower
THEN
Each follower manifest gets an EDI 350 message with action code '350', disposition code, quantity, and entry number from the X4 segment
Context: A train operations message requires processing
GIVEN
A train operations message requires processing
Applied to: Prepare Train Arrival/Cancellation Message
WHEN
The system prepares train arrival or cancellation parameters
THEN
Train message parameters are formatted with vessel name, event codes, and timing information
Context: A message requires transaction spawning
GIVEN
A message requires transaction spawning
Applied to: Initialize Message Array Parameters
WHEN
The system initializes message array parameters
THEN
Message array is populated with message segments, processing flags, and transaction identifiers
Context: Message processing parameters have been prepared
GIVEN
Message processing parameters have been prepared
Applied to: Set Transaction Parameters
WHEN
The system sets transaction parameters for GCT0161E spawning
THEN
Transaction parameters are configured with message type, processing mode, and target transaction identifier
Context: Transaction parameters have been configured
GIVEN
Transaction parameters have been configured
Applied to: Spawn GCT0161E Transaction
WHEN
The system attempts to spawn GCT0161E transaction
THEN
GCT0161E transaction is spawned with the prepared message parameters and processing begins
Context: GCT0161E transaction spawning has been attempted
GIVEN
GCT0161E transaction spawning has been attempted
Applied to: Transaction Successfully Spawned
WHEN
The transaction spawning completes successfully
THEN
The system confirms successful spawning and continues with next processing step
Applied to: Error in Transaction Spawning
WHEN
The transaction spawning fails due to system or resource constraints
THEN
The system captures the error condition and routes to error handling process
Context: A manifest has been successfully processed in multi-manifest mode
GIVEN
A manifest has been successfully processed in multi-manifest mode
Applied to: More Manifests to Process?
WHEN
The system checks for additional unprocessed follower manifests
THEN
If more manifests exist, processing continues; otherwise, multi-manifest processing completes
Context: A transaction spawning error has occurred
GIVEN
A transaction spawning error has occurred
Applied to: Log Error and Continue
WHEN
The system processes the error condition
THEN
The error is logged with appropriate details and processing continues with the next message
Context: Current message processing has completed successfully or error has been handled
GIVEN
Current message processing has completed successfully or error has been handled
Applied to: Continue with Next Message
WHEN
The system is ready to process the next message
THEN
Processing continues with the next available message from the queue
R-GCX016-cbl-01827 (+12) File: GCX016.cbl Shiproot Validation Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Shiproot Validation':
  • Context - an edi message is available in the message queue:
    For Receive EDI Shipment Request:
    When the system processes the message queue, then the edi shipment request is received and made available for processing.
  • Context - an edi shipment request has been received:
    For Extract Shipment Root ID from EDI Message:
    When the system processes the edi message content, then the shipment root id is extracted from the message and made available for database lookup.
  • Context - a shipment root id has been extracted from the edi message:
    For Query Shipment Database:
    When the system performs a database lookup, then the system searches for the corresponding shipment root record in the database.
  • Context - a database query has been performed for the shipment root id:
    For Shiproot Record Exists?:
    When the system evaluates the query results, then the system determines if a valid shipment root record exists and proceeds with appropriate validation or rejection flow.
  • Context - a shipment root record exists in the database:
    For Validate Shiproot Status:
    When the system checks the shipment root status, then the system validates that the shiproot is active and eligible for edi processing.
  • Context - the shipment root status has been retrieved from the database:
    For Shiproot Active and Valid?:
    When the system evaluates the status and validation criteria, then the system determines if the shiproot is active and valid, allowing edi processing to continue or triggering rejection.
  • Context - the shipment root record exists and has active, valid status:
    For Allow EDI Processing to Continue:
    When all validation checks pass successfully, then the system allows edi processing to continue with the validated shipment root.
  • Context - edi processing has been authorized to continue:
    For Create U1 Segment with In-Bond Information:
    When the system processes the validated shipment root, then a u1 segment is created with appropriate in-bond information for the shipment.
  • Context - shipment root validation has completed successfully:
    For Log Shiproot Validation Success:
    When the u1 segment has been created, then the system logs the successful validation event with appropriate details.
  • Context - shipment root validation has failed due to non-existent record or invalid status:
    For Reject EDI Processing Request:
    When the system determines the shipment cannot be processed, then the edi processing request is rejected and error handling is initiated.
  • Context - edi processing has been rejected due to validation failure:
    For Generate Shiproot Not Found Error:
    When the shipment root record does not exist or has invalid status, then the system generates a shiproot not found error message with relevant details.
  • Context - a shiproot not found error has been generated:
    For Log Validation Failure:
    When the system processes the validation failure, then the validation failure is logged with error details and shipment information.
  • Context - validation failure has been logged:
    For Send Error Notification:
    When the system completes error processing, then an error notification is sent to the appropriate recipients with failure details.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI message is available in the message queue
GIVEN
An EDI message is available in the message queue
Applied to: Receive EDI Shipment Request
WHEN
The system processes the message queue
THEN
The EDI shipment request is received and made available for processing
Context: An EDI shipment request has been received
GIVEN
An EDI shipment request has been received
Applied to: Extract Shipment Root ID from EDI Message
WHEN
The system processes the EDI message content
THEN
The shipment root ID is extracted from the message and made available for database lookup
Context: A shipment root ID has been extracted from the EDI message
GIVEN
A shipment root ID has been extracted from the EDI message
Applied to: Query Shipment Database
WHEN
The system performs a database lookup
THEN
The system searches for the corresponding shipment root record in the database
Context: A database query has been performed for the shipment root ID
GIVEN
A database query has been performed for the shipment root ID
Applied to: Shiproot Record Exists?
WHEN
The system evaluates the query results
THEN
The system determines if a valid shipment root record exists and proceeds with appropriate validation or rejection flow
Context: A shipment root record exists in the database
GIVEN
A shipment root record exists in the database
Applied to: Validate Shiproot Status
WHEN
The system checks the shipment root status
THEN
The system validates that the shiproot is active and eligible for EDI processing
Context: The shipment root status has been retrieved from the database
GIVEN
The shipment root status has been retrieved from the database
Applied to: Shiproot Active and Valid?
WHEN
The system evaluates the status and validation criteria
THEN
The system determines if the shiproot is active and valid, allowing EDI processing to continue or triggering rejection
Context: The shipment root record exists and has active, valid status
GIVEN
The shipment root record exists and has active, valid status
Applied to: Allow EDI Processing to Continue
WHEN
All validation checks pass successfully
THEN
The system allows EDI processing to continue with the validated shipment root
Context: EDI processing has been authorized to continue
GIVEN
EDI processing has been authorized to continue
Applied to: Create U1 Segment with In-Bond Information
WHEN
The system processes the validated shipment root
THEN
A U1 segment is created with appropriate in-bond information for the shipment
Context: Shipment root validation has completed successfully
GIVEN
Shipment root validation has completed successfully
Applied to: Log Shiproot Validation Success
WHEN
The U1 segment has been created
THEN
The system logs the successful validation event with appropriate details
Context: Shipment root validation has failed due to non-existent record or invalid status
GIVEN
Shipment root validation has failed due to non-existent record or invalid status
Applied to: Reject EDI Processing Request
WHEN
The system determines the shipment cannot be processed
THEN
The EDI processing request is rejected and error handling is initiated
Context: EDI processing has been rejected due to validation failure
GIVEN
EDI processing has been rejected due to validation failure
Applied to: Generate Shiproot Not Found Error
WHEN
The shipment root record does not exist or has invalid status
THEN
The system generates a shiproot not found error message with relevant details
Context: A shiproot not found error has been generated
GIVEN
A shiproot not found error has been generated
Applied to: Log Validation Failure
WHEN
The system processes the validation failure
THEN
The validation failure is logged with error details and shipment information
Context: Validation failure has been logged
GIVEN
Validation failure has been logged
Applied to: Send Error Notification
WHEN
The system completes error processing
THEN
An error notification is sent to the appropriate recipients with failure details
R-GCX016-cbl-01840 (+9) File: GCX016.cbl SHIPMINU Segment Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'SHIPMINU Segment Processing':
  • Context - a shipminu segment requires processing:
    For Verify Shiproot Existence:
    When the system attempts to verify shiproot existence, then the system should validate shiproot record exists and is accessible for processing.
  • Context - a shiproot record has been retrieved for validation:
    For Shiproot Valid?:
    When the system evaluates shiproot validity, then if shiproot is valid, proceed to retrieve in-bond information, otherwise handle shiproot error.
  • Context - a valid shiproot record exists:
    For Retrieve In-Bond Information:
    When the system needs to create u1 segment with in-bond information, then the system should retrieve all required in-bond transportation details from the shipment record.
  • Context - in-bond information contains cprail type codes:
    For Map CPRAIL Type Codes to EDI 309 Values:
    When the system processes type codes for u1 segment creation, then the system should map each cprail type code to its corresponding edi 309 standard value using the type code translation table.
  • Context - mapped edi 309 values are available:
    For Create U1 Segment Structure:
    When the system creates u1 segment structure, then the system should initialize u1 segment with proper field structure and data formatting requirements.
  • Context - u1 segment structure is created and in-bond information is available:
    For Populate In-Bond Details:
    When the system populates in-bond details into u1 segment, then the system should populate all required in-bond fields including mapped type codes, transportation details, and reference information.
  • Context - u1 segment is populated with in-bond details:
    For Insert/Replace U1 Segment in Database:
    When the system stores u1 segment in database, then the system should insert new u1 segment if none exists or replace existing u1 segment with updated information.
  • Context - u1 segment has been successfully stored in database:
    For Update Shipment Record:
    When the system updates the shipment record, then the system should update shipment record status to indicate u1 segment processing completion.
  • Context - u1 segment processing and shipment record update are complete:
    For Log Segment Processing:
    When the system logs segment processing, then the system should create audit log entry documenting successful shipminu segment processing with relevant details.
  • Context - shiproot validation has failed:
    For Handle Shiproot Error:
    When the system handles shiproot error, then the system should log error condition, set appropriate error status, and terminate shipminu processing gracefully.
👨‍💻 Technical ACs (Gherkin)
Context: A SHIPMINU segment requires processing
GIVEN
A SHIPMINU segment requires processing
Applied to: Verify Shiproot Existence
WHEN
The system attempts to verify shiproot existence
THEN
The system should validate shiproot record exists and is accessible for processing
Context: A shiproot record has been retrieved for validation
GIVEN
A shiproot record has been retrieved for validation
Applied to: Shiproot Valid?
WHEN
The system evaluates shiproot validity
THEN
If shiproot is valid, proceed to retrieve in-bond information, otherwise handle shiproot error
Context: A valid shiproot record exists
GIVEN
A valid shiproot record exists
Applied to: Retrieve In-Bond Information
WHEN
The system needs to create U1 segment with in-bond information
THEN
The system should retrieve all required in-bond transportation details from the shipment record
Context: In-bond information contains CPRAIL type codes
GIVEN
In-bond information contains CPRAIL type codes
Applied to: Map CPRAIL Type Codes to EDI 309 Values
WHEN
The system processes type codes for U1 segment creation
THEN
The system should map each CPRAIL type code to its corresponding EDI 309 standard value using the type code translation table
Context: Mapped EDI 309 values are available
GIVEN
Mapped EDI 309 values are available
Applied to: Create U1 Segment Structure
WHEN
The system creates U1 segment structure
THEN
The system should initialize U1 segment with proper field structure and data formatting requirements
Context: U1 segment structure is created and in-bond information is available
GIVEN
U1 segment structure is created and in-bond information is available
Applied to: Populate In-Bond Details
WHEN
The system populates in-bond details into U1 segment
THEN
The system should populate all required in-bond fields including mapped type codes, transportation details, and reference information
Context: U1 segment is populated with in-bond details
GIVEN
U1 segment is populated with in-bond details
Applied to: Insert/Replace U1 Segment in Database
WHEN
The system stores U1 segment in database
THEN
The system should insert new U1 segment if none exists or replace existing U1 segment with updated information
Context: U1 segment has been successfully stored in database
GIVEN
U1 segment has been successfully stored in database
Applied to: Update Shipment Record
WHEN
The system updates the shipment record
THEN
The system should update shipment record status to indicate U1 segment processing completion
Context: U1 segment processing and shipment record update are complete
GIVEN
U1 segment processing and shipment record update are complete
Applied to: Log Segment Processing
WHEN
The system logs segment processing
THEN
The system should create audit log entry documenting successful SHIPMINU segment processing with relevant details
Context: Shiproot validation has failed
GIVEN
Shiproot validation has failed
Applied to: Handle Shiproot Error
WHEN
The system handles shiproot error
THEN
The system should log error condition, set appropriate error status, and terminate SHIPMINU processing gracefully
R-GCX016-cbl-01857 (+9) File: GCX016.cbl Location Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Location Processing':
  • Context - a location processing request is received:
    For Location ID Available?:
    When the system evaluates the location id field, then if location id is available, proceed to ds table lookup, otherwise set default location name.
  • Context - a valid location id is available:
    For Lookup DS Table:
    When the system searches the ds table using the location id, then retrieve station record from gcstbrt ds table for further processing.
  • Context - ds table lookup has been performed:
    For DS Record Found?:
    When the system checks the lookup result, then if ds record is found, extract station name, otherwise attempt ks table lookup.
  • Context - ds table lookup did not find a matching record:
    For Lookup KS Table:
    When the system searches the ks table using the location id, then retrieve location record from gcstbrt ks table as fallback option.
  • Context - ks table lookup has been performed after ds lookup failure:
    For KS Record Found?:
    When the system checks the ks lookup result, then if ks record is found, extract location description, otherwise set default location name.
  • Context - a ds record has been found in the station table:
    For Extract Station Name:
    When the system processes the ds record data, then extract the station name field for location information combination.
  • Context - a ks record has been found in the location table:
    For Extract Location Description:
    When the system processes the ks record data, then extract the location description field for location information combination.
  • Context - either station name from ds table or location description from ks table has been extracted:
    For Combine Location Information:
    When the system processes the extracted location data, then combine the location information into a complete location reference for cargo record update.
  • Context - either no location id is available or both ds and ks table lookups have failed:
    For Set Default Location Name:
    When the system cannot resolve location information from tables, then set a default location name to ensure cargo record has location information.
  • Context - location information has been resolved through table lookups or default assignment:
    For Update Cargo Record with Location Info:
    When the system updates the cargo record, then store the location information in the gccc-cargo-root record for future reference.
👨‍💻 Technical ACs (Gherkin)
Context: A location processing request is received
GIVEN
A location processing request is received
Applied to: Location ID Available?
WHEN
The system evaluates the location ID field
THEN
If location ID is available, proceed to DS table lookup, otherwise set default location name
Context: A valid location ID is available
GIVEN
A valid location ID is available
Applied to: Lookup DS Table
WHEN
The system searches the DS table using the location ID
THEN
Retrieve station record from GCSTBRT DS table for further processing
Context: DS table lookup has been performed
GIVEN
DS table lookup has been performed
Applied to: DS Record Found?
WHEN
The system checks the lookup result
THEN
If DS record is found, extract station name, otherwise attempt KS table lookup
Context: DS table lookup did not find a matching record
GIVEN
DS table lookup did not find a matching record
Applied to: Lookup KS Table
WHEN
The system searches the KS table using the location ID
THEN
Retrieve location record from GCSTBRT KS table as fallback option
Context: KS table lookup has been performed after DS lookup failure
GIVEN
KS table lookup has been performed after DS lookup failure
Applied to: KS Record Found?
WHEN
The system checks the KS lookup result
THEN
If KS record is found, extract location description, otherwise set default location name
Context: A DS record has been found in the station table
GIVEN
A DS record has been found in the station table
Applied to: Extract Station Name
WHEN
The system processes the DS record data
THEN
Extract the station name field for location information combination
Context: A KS record has been found in the location table
GIVEN
A KS record has been found in the location table
Applied to: Extract Location Description
WHEN
The system processes the KS record data
THEN
Extract the location description field for location information combination
Context: Either station name from DS table or location description from KS table has been extracted
GIVEN
Either station name from DS table or location description from KS table has been extracted
Applied to: Combine Location Information
WHEN
The system processes the extracted location data
THEN
Combine the location information into a complete location reference for cargo record update
Context: Either no location ID is available or both DS and KS table lookups have failed
GIVEN
Either no location ID is available or both DS and KS table lookups have failed
Applied to: Set Default Location Name
WHEN
The system cannot resolve location information from tables
THEN
Set a default location name to ensure cargo record has location information
Context: Location information has been resolved through table lookups or default assignment
GIVEN
Location information has been resolved through table lookups or default assignment
Applied to: Update Cargo Record with Location Info
WHEN
The system updates the cargo record
THEN
Store the location information in the GCCC-CARGO-ROOT record for future reference
R-GCX016-cbl-01867 (+11) File: GCX016.cbl N9 Reference Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N9 Reference Processing':
  • Context - a request for n9 reference processing is initiated:
    For Secondary Cargo Records Available?:
    When the system checks for available secondary cargo records in gcsa2rt, then the system proceeds to access secondary records if available, otherwise completes processing without n9 references.
  • Context - secondary cargo records are available:
    For Access GCSA2RT Secondary Records:
    When the system needs to retrieve n9 reference information, then the system accesses gcsa2rt secondary records database.
  • Context - gcsa2rt secondary records are accessed:
    For Search for N9 Reference Segments:
    When the system searches for n9 reference segments within the records, then the system identifies and locates all n9 reference segments present in the secondary records.
  • Context - a search for n9 reference segments has been completed:
    For N9 Segments Found?:
    When the system evaluates the search results, then the system proceeds to extract reference information if n9 segments are found, otherwise completes processing without references.
    For No N9 References Found:
    When no n9 segments are found in the secondary cargo records, then the system completes processing without updating cargo records with reference information.
  • Context - n9 reference segments have been found in secondary cargo records:
    For Extract Reference Information:
    When the system processes the n9 segments, then the system extracts all reference information contained within the n9 segments.
  • Context - reference information has been extracted from n9 segments:
    For Validate Reference Data:
    When the system validates the extracted reference data, then the system verifies that the reference data meets required format and completeness criteria.
  • Context - reference data has been validated:
    For Reference Data Valid?:
    When the system evaluates validation results, then the system proceeds to store valid reference information or handles invalid data error.
  • Context - reference data has been validated as correct:
    For Store Reference Information:
    When the system processes valid reference information, then the system stores the reference information in temporary storage for cargo record updating.
  • Context - valid reference information has been stored:
    For Update Cargo Record with References:
    When the system updates the cargo record, then the system applies all n9 reference information to the appropriate fields in the cargo record.
  • Context - cargo record has been updated with reference information:
    For Log Reference Processing:
    When the system completes reference processing, then the system creates log entries documenting the n9 reference processing activities.
  • Context - reference data has been extracted from n9 segments:
    For Invalid Reference Data Error:
    When the extracted reference data fails validation requirements, then the system handles the invalid data error and completes processing without updating cargo records.
👨‍💻 Technical ACs (Gherkin)
Context: A request for N9 reference processing is initiated
GIVEN
A request for N9 reference processing is initiated
Applied to: Secondary Cargo Records Available?
WHEN
The system checks for available secondary cargo records in GCSA2RT
THEN
The system proceeds to access secondary records if available, otherwise completes processing without N9 references
Context: Secondary cargo records are available
GIVEN
Secondary cargo records are available
Applied to: Access GCSA2RT Secondary Records
WHEN
The system needs to retrieve N9 reference information
THEN
The system accesses GCSA2RT secondary records database
Context: GCSA2RT secondary records are accessed
GIVEN
GCSA2RT secondary records are accessed
Applied to: Search for N9 Reference Segments
WHEN
The system searches for N9 reference segments within the records
THEN
The system identifies and locates all N9 reference segments present in the secondary records
Context: A search for N9 reference segments has been completed
GIVEN
A search for N9 reference segments has been completed
Applied to: N9 Segments Found?
WHEN
The system evaluates the search results
THEN
The system proceeds to extract reference information if N9 segments are found, otherwise completes processing without references
Applied to: No N9 References Found
WHEN
No N9 segments are found in the secondary cargo records
THEN
The system completes processing without updating cargo records with reference information
Context: N9 reference segments have been found in secondary cargo records
GIVEN
N9 reference segments have been found in secondary cargo records
Applied to: Extract Reference Information
WHEN
The system processes the N9 segments
THEN
The system extracts all reference information contained within the N9 segments
Context: Reference information has been extracted from N9 segments
GIVEN
Reference information has been extracted from N9 segments
Applied to: Validate Reference Data
WHEN
The system validates the extracted reference data
THEN
The system verifies that the reference data meets required format and completeness criteria
Context: Reference data has been validated
GIVEN
Reference data has been validated
Applied to: Reference Data Valid?
WHEN
The system evaluates validation results
THEN
The system proceeds to store valid reference information or handles invalid data error
Context: Reference data has been validated as correct
GIVEN
Reference data has been validated as correct
Applied to: Store Reference Information
WHEN
The system processes valid reference information
THEN
The system stores the reference information in temporary storage for cargo record updating
Context: Valid reference information has been stored
GIVEN
Valid reference information has been stored
Applied to: Update Cargo Record with References
WHEN
The system updates the cargo record
THEN
The system applies all N9 reference information to the appropriate fields in the cargo record
Context: Cargo record has been updated with reference information
GIVEN
Cargo record has been updated with reference information
Applied to: Log Reference Processing
WHEN
The system completes reference processing
THEN
The system creates log entries documenting the N9 reference processing activities
Context: Reference data has been extracted from N9 segments
GIVEN
Reference data has been extracted from N9 segments
Applied to: Invalid Reference Data Error
WHEN
The extracted reference data fails validation requirements
THEN
The system handles the invalid data error and completes processing without updating cargo records
R-GCX016-cbl-01879 (+16) File: GCX016.cbl Database I/O Operations Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database I/O Operations':
  • Context - a database i/o operation request is received:
    For Operation Type?:
    When the system evaluates the operation type, then the system routes to insert, replace, or retrieve operation based on the operation type specified.
  • Context - a database operation is being processed:
    For Segment Type?:
    When the system evaluates the segment type, then the system routes to appropriate segment handler for s09 status, cargo root, table data, secondary, shipment, or transmission segments.
  • Context - a database operation involves s09 status segments:
    For Status Segments - S09:
    When the system processes the s09 segment type, then the system accesses the gcsuss09 database for status segment operations.
  • Context - a database operation involves cargo root segments:
    For Cargo Root Segments:
    When the system processes the cargo root segment type, then the system accesses the gccc-cargo-root database for cargo segment operations.
  • Context - a database operation involves table segments:
    For Table Segments - GCSTBRT:
    When the system processes the gcstbrt segment type, then the system accesses the gcstbrt database for table segment operations.
  • Context - a database operation involves secondary segments:
    For Secondary Segments - GCSA2RT:
    When the system processes the gcsa2rt segment type, then the system accesses the gcsa2rt database for secondary segment operations.
  • Context - a database operation involves u1 shipment segments:
    For Shipment Segments - U1:
    When the system processes the u1 segment type, then the system accesses the appropriate database for shipment segment operations.
  • Context - a database operation involves transmission segments:
    For Transmission Segments - A9RT/A9DP:
    When the system processes a9rt or a9dp segment types, then the system accesses the a9rt/a9dp database for transmission segment operations.
  • Context - a database operation requires a segment key:
    For Key Valid?:
    When the system validates the segment key, then the system proceeds with database operation if key is valid, otherwise handles database error.
  • Context - a database operation has been executed:
    For Operation Successful?:
    When the system checks the operation result, then the system updates working storage and logs operation if successful, otherwise handles database error.
  • Context - an insert operation is being performed:
    For Initialize New Segment:
    When the system initializes a new segment, then the system sets default values and prepares segment data before executing database call.
  • Context - a new segment is being initialized for insert:
    For Set Default Values:
    When the system sets default values, then the system prepares segment data with appropriate default values before database insertion.
  • Context - a replace operation is being performed:
    For Replace Existing Segment:
    When the system replaces an existing segment, then the system executes the database call to update the existing segment.
  • Context - a retrieve operation is being performed:
    For Fetch Segment by Key:
    When the system fetches a segment by key, then the system loads the segment into working storage and validates retrieved data.
  • Context - data has been retrieved from the database:
    For Validate Retrieved Data:
    When the system validates the retrieved data, then the system updates working storage if data is valid.
  • Context - a database operation has failed or segment key is invalid:
    For Handle Database Error:
    When the system handles the database error, then the system logs error details and returns error status.
  • Context - a database operation has completed successfully and working storage is updated:
    For Log Operation:
    When the system logs the operation, then the system returns success status.
👨‍💻 Technical ACs (Gherkin)
Context: A database I/O operation request is received
GIVEN
A database I/O operation request is received
Applied to: Operation Type?
WHEN
The system evaluates the operation type
THEN
The system routes to insert, replace, or retrieve operation based on the operation type specified
Context: A database operation is being processed
GIVEN
A database operation is being processed
Applied to: Segment Type?
WHEN
The system evaluates the segment type
THEN
The system routes to appropriate segment handler for S09 Status, Cargo Root, Table Data, Secondary, Shipment, or Transmission segments
Context: A database operation involves S09 status segments
GIVEN
A database operation involves S09 status segments
Applied to: Status Segments - S09
WHEN
The system processes the S09 segment type
THEN
The system accesses the GCSUSS09 database for status segment operations
Context: A database operation involves cargo root segments
GIVEN
A database operation involves cargo root segments
Applied to: Cargo Root Segments
WHEN
The system processes the cargo root segment type
THEN
The system accesses the GCCC-CARGO-ROOT database for cargo segment operations
Context: A database operation involves table segments
GIVEN
A database operation involves table segments
Applied to: Table Segments - GCSTBRT
WHEN
The system processes the GCSTBRT segment type
THEN
The system accesses the GCSTBRT database for table segment operations
Context: A database operation involves secondary segments
GIVEN
A database operation involves secondary segments
Applied to: Secondary Segments - GCSA2RT
WHEN
The system processes the GCSA2RT segment type
THEN
The system accesses the GCSA2RT database for secondary segment operations
Context: A database operation involves U1 shipment segments
GIVEN
A database operation involves U1 shipment segments
Applied to: Shipment Segments - U1
WHEN
The system processes the U1 segment type
THEN
The system accesses the appropriate database for shipment segment operations
Context: A database operation involves transmission segments
GIVEN
A database operation involves transmission segments
Applied to: Transmission Segments - A9RT/A9DP
WHEN
The system processes A9RT or A9DP segment types
THEN
The system accesses the A9RT/A9DP database for transmission segment operations
Context: A database operation requires a segment key
GIVEN
A database operation requires a segment key
Applied to: Key Valid?
WHEN
The system validates the segment key
THEN
The system proceeds with database operation if key is valid, otherwise handles database error
Context: A database operation has been executed
GIVEN
A database operation has been executed
Applied to: Operation Successful?
WHEN
The system checks the operation result
THEN
The system updates working storage and logs operation if successful, otherwise handles database error
Context: An insert operation is being performed
GIVEN
An insert operation is being performed
Applied to: Initialize New Segment
WHEN
The system initializes a new segment
THEN
The system sets default values and prepares segment data before executing database call
Context: A new segment is being initialized for insert
GIVEN
A new segment is being initialized for insert
Applied to: Set Default Values
WHEN
The system sets default values
THEN
The system prepares segment data with appropriate default values before database insertion
Context: A replace operation is being performed
GIVEN
A replace operation is being performed
Applied to: Replace Existing Segment
WHEN
The system replaces an existing segment
THEN
The system executes the database call to update the existing segment
Context: A retrieve operation is being performed
GIVEN
A retrieve operation is being performed
Applied to: Fetch Segment by Key
WHEN
The system fetches a segment by key
THEN
The system loads the segment into working storage and validates retrieved data
Context: Data has been retrieved from the database
GIVEN
Data has been retrieved from the database
Applied to: Validate Retrieved Data
WHEN
The system validates the retrieved data
THEN
The system updates working storage if data is valid
Context: A database operation has failed or segment key is invalid
GIVEN
A database operation has failed or segment key is invalid
Applied to: Handle Database Error
WHEN
The system handles the database error
THEN
The system logs error details and returns error status
Context: A database operation has completed successfully and working storage is updated
GIVEN
A database operation has completed successfully and working storage is updated
Applied to: Log Operation
WHEN
The system logs the operation
THEN
The system returns success status
R-GCX016-cbl-01896 (+4) File: GCX016.cbl Canadian Cargo Database Access Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Cargo Database Access':
  • Context - a us cargo equipment id is provided for canadian cargo lookup:
    For Search Canadian Cargo Database:
    When the system searches the canadian cargo database using the equipment id, then the system retrieves matching canadian cargo records if they exist.
  • Context - canadian cargo records are found in the database:
    For Validate Canadian Record Status:
    When the system checks the record status and deletion flags, then only non-deleted and valid status records are accepted for processing.
  • Context - canadian cargo records are retrieved from the database:
    For Record Valid for Processing?:
    When the system evaluates record deletion status and bond creation flags, then deleted records and new bond created records are filtered out from processing.
  • Context - valid canadian cargo records are found and us cargo equipment id is available:
    For Establish Cross-Border Link:
    When the system matches equipment ids between us and canadian systems, then a cross-border coordination link is established between the cargo records.
  • Context - cross-border cargo coordination is performed:
    For Log Cross-Border Coordination:
    When canadian cargo information is retrieved and linked with us cargo, then the coordination activity is logged with cargo details and timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo equipment ID is provided for Canadian cargo lookup
GIVEN
A US cargo equipment ID is provided for Canadian cargo lookup
Applied to: Search Canadian Cargo Database
WHEN
The system searches the Canadian cargo database using the equipment ID
THEN
The system retrieves matching Canadian cargo records if they exist
Context: Canadian cargo records are found in the database
GIVEN
Canadian cargo records are found in the database
Applied to: Validate Canadian Record Status
WHEN
The system checks the record status and deletion flags
THEN
Only non-deleted and valid status records are accepted for processing
Context: Canadian cargo records are retrieved from the database
GIVEN
Canadian cargo records are retrieved from the database
Applied to: Record Valid for Processing?
WHEN
The system evaluates record deletion status and bond creation flags
THEN
Deleted records and new bond created records are filtered out from processing
Context: Valid Canadian cargo records are found and US cargo equipment ID is available
GIVEN
Valid Canadian cargo records are found and US cargo equipment ID is available
Applied to: Establish Cross-Border Link
WHEN
The system matches equipment IDs between US and Canadian systems
THEN
A cross-border coordination link is established between the cargo records
Context: Cross-border cargo coordination is performed
GIVEN
Cross-border cargo coordination is performed
Applied to: Log Cross-Border Coordination
WHEN
Canadian cargo information is retrieved and linked with US cargo
THEN
The coordination activity is logged with cargo details and timestamp
R-GCX016-cbl-01901 (+12) File: GCX016.cbl Car ID Matching for Canadian Cargo Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car ID Matching for Canadian Cargo':
  • Context - a us cargo record exists with equipment information:
    For Extract Equipment ID from US Cargo Record:
    When the system processes the cargo record for canadian matching, then the equipment id is extracted and made available for canadian system lookup.
  • Context - an equipment id has been extracted from us cargo record:
    For Format Equipment ID for Canadian System Lookup:
    When the system prepares to search canadian cargo database, then the equipment id is formatted according to canadian system requirements.
  • Context - a formatted equipment id is available for lookup:
    For Search Canadian Cargo Database by Equipment ID:
    When the system searches the canadian cargo database, then canadian cargo records matching the equipment id are retrieved.
  • Context - a search has been performed in the canadian cargo database:
    For Canadian Cargo Found?:
    When the system evaluates the search results, then the system determines if canadian cargo records were found or not found.
  • Context - canadian cargo records have been found for the equipment id:
    For Validate Canadian Cargo Record Status:
    When the system validates the record status, then the system determines if the canadian record is valid for processing.
  • Context - canadian cargo record status has been validated:
    For Canadian Record Valid?:
    When the system evaluates the validation results, then the system determines if the record is valid or invalid/deleted.
  • Context - a valid canadian cargo record exists for the equipment id:
    For Match US and Canadian Cargo Records:
    When the system processes the matching logic, then us and canadian cargo records are matched and linked.
  • Context - us and canadian cargo records have been successfully matched:
    For Store Cross-Reference Information:
    When the system stores the match information, then cross-reference data is saved for cross-border coordination.
  • Context - cross-reference information has been stored successfully:
    For Log Successful Match for Cross-Border Coordination:
    When the system completes the matching process, then a successful match is logged for cross-border coordination tracking.
  • Context - no canadian cargo records were found for the equipment id:
    For Log No Canadian Match Found:
    When the system processes the no-match condition, then the absence of canadian match is logged for tracking purposes.
  • Context - canadian cargo record exists but has invalid or deleted status:
    For Mark Canadian Record as Invalid/Deleted:
    When the system processes the invalid record, then the canadian record is marked as invalid/deleted and excluded from matching.
  • Context - no canadian cargo match is found or canadian record is invalid:
    For Continue Processing Without Canadian Match:
    When the system continues with cargo processing, then processing continues without canadian cross-reference information.
  • Context - successful match has been logged for cross-border coordination:
    For Continue with Cross-Border Processing:
    When the system continues processing, then cross-border processing proceeds with linked cargo 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 Record
WHEN
The system processes the cargo record for Canadian matching
THEN
The equipment ID is extracted and made available for Canadian system lookup
Context: An equipment ID has been extracted from US cargo record
GIVEN
An equipment ID has been extracted from US cargo record
Applied to: Format Equipment ID for Canadian System Lookup
WHEN
The system prepares to search Canadian cargo database
THEN
The equipment ID is formatted according to Canadian system requirements
Context: A formatted equipment ID is available for lookup
GIVEN
A formatted equipment ID is available for lookup
Applied to: Search Canadian Cargo Database by Equipment ID
WHEN
The system searches the Canadian cargo database
THEN
Canadian cargo records matching the equipment ID are retrieved
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 Found?
WHEN
The system evaluates the search results
THEN
The system determines if Canadian cargo records were 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 Record Status
WHEN
The system validates the record status
THEN
The system determines if the Canadian record is valid for processing
Context: Canadian cargo record status has been validated
GIVEN
Canadian cargo record status has been validated
Applied to: Canadian Record Valid?
WHEN
The system evaluates the validation results
THEN
The system determines if the record is valid or invalid/deleted
Context: A valid Canadian cargo record exists for the equipment ID
GIVEN
A valid Canadian cargo record exists for the equipment ID
Applied to: Match US and Canadian Cargo Records
WHEN
The system processes the matching logic
THEN
US and Canadian cargo records are matched and linked
Context: US and Canadian cargo records have been successfully matched
GIVEN
US and Canadian cargo records have been successfully matched
Applied to: Store Cross-Reference Information
WHEN
The system stores the match information
THEN
Cross-reference data is saved for cross-border coordination
Context: Cross-reference information has been stored successfully
GIVEN
Cross-reference information has been stored successfully
Applied to: Log Successful Match for Cross-Border Coordination
WHEN
The system completes the matching process
THEN
A successful match is logged for cross-border coordination tracking
Context: No Canadian cargo records were found for the equipment ID
GIVEN
No Canadian cargo records were found for the equipment ID
Applied to: Log No Canadian Match Found
WHEN
The system processes the no-match condition
THEN
The absence of Canadian match is logged for tracking purposes
Context: Canadian cargo record exists but has invalid or deleted status
GIVEN
Canadian cargo record exists but has invalid or deleted status
Applied to: Mark Canadian Record as Invalid/Deleted
WHEN
The system processes the invalid record
THEN
The Canadian record is marked as invalid/deleted and excluded from matching
Context: No Canadian cargo match is found or Canadian record is invalid
GIVEN
No Canadian cargo match is found or Canadian record is invalid
Applied to: Continue Processing Without Canadian Match
WHEN
The system continues with cargo processing
THEN
Processing continues without Canadian cross-reference information
Context: Successful match has been logged for cross-border coordination
GIVEN
Successful match has been logged for cross-border coordination
Applied to: Continue with Cross-Border Processing
WHEN
The system continues processing
THEN
Cross-border processing proceeds with linked cargo information
R-GCX016-cbl-01914 (+5) File: GCX016.cbl Canadian Status Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Status Validation':
  • Context - a canadian cargo record retrieval operation is performed:
    For Record Exists?:
    When the system attempts to access the canadian cargo record, then the system determines if the record exists and either proceeds to status validation or excludes the record from processing.
  • Context - a canadian cargo record exists in the system:
    For Record Deleted?:
    When the record's deletion status is evaluated, then if the record is marked as deleted, it is excluded from processing, otherwise status validation continues.
  • Context - a canadian cargo record exists and is not deleted:
    For Record Unusable?:
    When the record's usability status is evaluated, then if the record is marked as unusable, it is excluded from processing, otherwise the record is marked as valid for processing.
  • Context - a canadian cargo record exists, is not deleted, and is not unusable:
    For Mark Record as Valid for Processing:
    When all validation checks are completed successfully, then the record is marked as valid and available for subsequent business processing operations.
  • Context - a canadian cargo record fails one or more validation checks (non-existent, deleted, or unusable):
    For Exclude Record from Processing:
    When the validation failure is detected, then the record is excluded from processing and the exclusion reason is logged.
  • Context - a canadian cargo record has been excluded from processing:
    For Log Exclusion Reason:
    When the exclusion decision is made, then the system logs the specific reason for exclusion (non-existent, deleted, or unusable status).
👨‍💻 Technical ACs (Gherkin)
Context: A Canadian cargo record retrieval operation is performed
GIVEN
A Canadian cargo record retrieval operation is performed
Applied to: Record Exists?
WHEN
The system attempts to access the Canadian cargo record
THEN
The system determines if the record exists and either proceeds to status validation or excludes the record from processing
Context: A Canadian cargo record exists in the system
GIVEN
A Canadian cargo record exists in the system
Applied to: Record Deleted?
WHEN
The record's deletion status is evaluated
THEN
If the record is marked as deleted, it is excluded from processing, otherwise status validation continues
Context: A Canadian cargo record exists and is not deleted
GIVEN
A Canadian cargo record exists and is not deleted
Applied to: Record Unusable?
WHEN
The record's usability status is evaluated
THEN
If the record is marked as unusable, it is excluded from processing, otherwise the record is marked as valid for processing
Context: A Canadian cargo record exists, is not deleted, and is not unusable
GIVEN
A Canadian cargo record exists, is not deleted, and is not unusable
Applied to: Mark Record as Valid for Processing
WHEN
All validation checks are completed successfully
THEN
The record is marked as valid and available for subsequent business processing operations
Context: A Canadian cargo record fails one or more validation checks (non-existent, deleted, or unusable)
GIVEN
A Canadian cargo record fails one or more validation checks (non-existent, deleted, or unusable)
Applied to: Exclude Record from Processing
WHEN
The validation failure is detected
THEN
The record is excluded from processing and the exclusion reason is logged
Context: A Canadian cargo record has been excluded from processing
GIVEN
A Canadian cargo record has been excluded from processing
Applied to: Log Exclusion Reason
WHEN
The exclusion decision is made
THEN
The system logs the specific reason for exclusion (non-existent, deleted, or unusable status)
R-GCX016-cbl-01920 (+7) File: GCX016.cbl Cross Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cross':
  • Context - us cargo has been released and cargo status has been updated to a release state:
    For Canadian Coordination Required?:
    When the system evaluates cargo for canadian coordination requirements, then canadian coordination is required if cargo status indicates manual release processing is needed.
  • Context - canadian coordination is required for released us cargo and equipment id is available:
    For Search for Matching Canadian Manifests:
    When the system searches for matching canadian manifest records, then system queries canadian cargo records using equipment id as the primary search key.
  • Context - canadian manifest search has been initiated with equipment id:
    For Match by Equipment ID:
    When the system performs equipment id matching, then system looks up canadian waybill records using the equipment id from the us cargo record.
  • Context - equipment id lookup has been performed against canadian cargo records:
    For Canadian Manifest Found?:
    When the system checks for canadian manifest existence, then canadian manifest is found if matching records exist and are not marked as deleted.
  • Context - canadian manifest records have been found for the equipment id:
    For Canadian Record Valid?:
    When the system validates canadian record status, then canadian record is valid if it is not deleted and not marked as new bond created record.
  • Context - valid canadian manifest records have been identified for released us cargo:
    For Create Cross-border Log Message:
    When the system creates cross-border log message, then system generates log message containing cargo release details, equipment information, and cross-border coordination status.
  • Context - cross-border log message has been created for valid canadian records:
    For Update Canadian System Notification:
    When the system updates canadian system notification, then system calls gcx105 logging system to record cargo release information for canadian coordination.
  • Context - canadian system notification has been successfully updated:
    For Generate Audit Trail:
    When the system generates audit trail, then system creates complete audit record of cross-border coordination process including timestamps, cargo details, and processing results.
👨‍💻 Technical ACs (Gherkin)
Context: US cargo has been released and cargo status has been updated to a release state
GIVEN
US cargo has been released and cargo status has been updated to a release state
Applied to: Canadian Coordination Required?
WHEN
the system evaluates cargo for Canadian coordination requirements
THEN
Canadian coordination is required if cargo status indicates manual release processing is needed
Context: Canadian coordination is required for released US cargo and equipment ID is available
GIVEN
Canadian coordination is required for released US cargo and equipment ID is available
Applied to: Search for Matching Canadian Manifests
WHEN
the system searches for matching Canadian manifest records
THEN
system queries Canadian cargo records using equipment ID as the primary search key
Context: Canadian manifest search has been initiated with equipment ID
GIVEN
Canadian manifest search has been initiated with equipment ID
Applied to: Match by Equipment ID
WHEN
the system performs equipment ID matching
THEN
system looks up Canadian waybill records using the equipment ID from the US cargo record
Context: equipment ID lookup has been performed against Canadian cargo records
GIVEN
equipment ID lookup has been performed against Canadian cargo records
Applied to: Canadian Manifest Found?
WHEN
the system checks for Canadian manifest existence
THEN
Canadian manifest is found if matching records exist and are not marked as deleted
Context: Canadian manifest records have been found for the equipment ID
GIVEN
Canadian manifest records have been found for the equipment ID
Applied to: Canadian Record Valid?
WHEN
the system validates Canadian record status
THEN
Canadian record is valid if it is not deleted and not marked as new bond created record
Context: valid Canadian manifest records have been identified for released US cargo
GIVEN
valid Canadian manifest records have been identified for released US cargo
Applied to: Create Cross-border Log Message
WHEN
the system creates cross-border log message
THEN
system generates log message containing cargo release details, equipment information, and cross-border coordination status
Context: cross-border log message has been created for valid Canadian records
GIVEN
cross-border log message has been created for valid Canadian records
Applied to: Update Canadian System Notification
WHEN
the system updates Canadian system notification
THEN
system calls GCX105 logging system to record cargo release information for Canadian coordination
Context: Canadian system notification has been successfully updated
GIVEN
Canadian system notification has been successfully updated
Applied to: Generate Audit Trail
WHEN
the system generates audit trail
THEN
system creates complete audit record of cross-border coordination process including timestamps, cargo details, and processing results
R-GCX016-cbl-01928 (+8) File: GCX016.cbl System Time Management Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'System Time Management':
  • Context - a business transaction requires timestamping:
    For Capture Current System Date:
    When the system needs to capture the current date, then the system date is retrieved and stored for transaction processing.
  • Context - a business transaction requires precise timing:
    For Capture Current System Time:
    When the system needs to capture the current time, then the system time is retrieved and stored for transaction processing.
  • Context - a system date has been captured:
    For Convert Date to Julian Format:
    When the date needs to be converted to julian format, then the date is converted to julian format for standardized processing.
  • Context - a date conversion to julian format has been attempted:
    For Date Conversion Successful?:
    When the system checks if the conversion was successful, then if conversion is successful, proceed with timestamp formatting, otherwise handle the conversion error.
  • Context - system date and time have been successfully captured and date converted to julian format:
    For Format Timestamp for Transaction:
    When a formatted timestamp is required for transaction processing, then the date and time are formatted into a standardized timestamp for business use.
  • Context - a formatted timestamp is available:
    For Apply Timestamp to Business Transaction:
    When a business transaction is being processed, then the timestamp is applied to the transaction for tracking and audit trail purposes.
  • Context - a business transaction has been timestamped:
    For Store Timestamp in Transaction Log:
    When the transaction needs to be logged for audit purposes, then the timestamp is stored in the transaction log for compliance and tracking.
  • Context - a date conversion to julian format has failed:
    For Handle Date Conversion Error:
    When the system detects the conversion error, then the error is handled appropriately to allow transaction processing to continue.
  • Context - date and time processing has completed either successfully or with error handling:
    For Timestamp Ready for Use:
    When the system needs to confirm timestamp availability, then the timestamp is marked as ready for use in business transactions.
👨‍💻 Technical ACs (Gherkin)
Context: A business transaction requires timestamping
GIVEN
A business transaction requires timestamping
Applied to: Capture Current System Date
WHEN
The system needs to capture the current date
THEN
The system date is retrieved and stored for transaction processing
Context: A business transaction requires precise timing
GIVEN
A business transaction requires precise timing
Applied to: Capture Current System Time
WHEN
The system needs to capture the current time
THEN
The system time is retrieved and stored for transaction processing
Context: A system date has been captured
GIVEN
A system date has been captured
Applied to: Convert Date to Julian Format
WHEN
The date needs to be converted to Julian format
THEN
The date is converted to Julian format for standardized processing
Context: A date conversion to Julian format has been attempted
GIVEN
A date conversion to Julian format has been attempted
Applied to: Date Conversion Successful?
WHEN
The system checks if the conversion was successful
THEN
If conversion is successful, proceed with timestamp formatting, otherwise handle the conversion error
Context: System date and time have been successfully captured and date converted to Julian format
GIVEN
System date and time have been successfully captured and date converted to Julian format
Applied to: Format Timestamp for Transaction
WHEN
A formatted timestamp is required for transaction processing
THEN
The date and time are formatted into a standardized timestamp for business use
Context: A formatted timestamp is available
GIVEN
A formatted timestamp is available
Applied to: Apply Timestamp to Business Transaction
WHEN
A business transaction is being processed
THEN
The timestamp is applied to the transaction for tracking and audit trail purposes
Context: A business transaction has been timestamped
GIVEN
A business transaction has been timestamped
Applied to: Store Timestamp in Transaction Log
WHEN
The transaction needs to be logged for audit purposes
THEN
The timestamp is stored in the transaction log for compliance and tracking
Context: A date conversion to Julian format has failed
GIVEN
A date conversion to Julian format has failed
Applied to: Handle Date Conversion Error
WHEN
The system detects the conversion error
THEN
The error is handled appropriately to allow transaction processing to continue
Context: Date and time processing has completed either successfully or with error handling
GIVEN
Date and time processing has completed either successfully or with error handling
Applied to: Timestamp Ready for Use
WHEN
The system needs to confirm timestamp availability
THEN
The timestamp is marked as ready for use in business transactions
R-GCX016-cbl-01937 (+9) File: GCX016.cbl Broker Name Lookup for KCSM Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Name Lookup for KCSM':
  • Context - a cargo processing request is being handled:
    For KCSM Processing Required?:
    When the system evaluates whether kcsm processing is needed, then the system should proceed to broker lookup if kcsm processing is required, otherwise continue with standard processing.
  • Context - kcsm processing is required:
    For Access Broker Tables:
    When the system needs to lookup broker information, then the system should access the gcstbrt broker tables to retrieve broker data.
  • Context - broker tables are accessible:
    For Retrieve Broker Information:
    When the system performs broker lookup, then the system should retrieve broker information from bk table (broker master) and b1 table (broker details).
  • Context - a broker lookup has been performed:
    For Broker Found?:
    When the system checks the lookup results, then the system should determine if broker information was found and proceed accordingly.
    For Log Broker Not Found Error:
    When no broker information is found in the lookup tables, then the system should log a broker not found error for tracking purposes.
  • Context - broker information has been found in the lookup tables:
    For Extract Broker Short Name:
    When the system processes the broker data, then the system should extract the broker short name for kcsm processing.
  • Context - broker short name has been extracted:
    For Format Broker Data for KCSM:
    When the system prepares data for kcsm processing, then the system should format the broker data according to kcsm specifications.
  • Context - broker data has been formatted for kcsm:
    For Store Broker Information:
    When the system needs to preserve broker information, then the system should store the broker information for use in kcsm processing.
  • Context - broker lookup has failed and error has been logged:
    For Use Default Broker Information:
    When the system needs to continue processing, then the system should use default broker information to allow processing to continue.
  • Context - broker information is available (either found or default):
    For Continue KCSM Processing:
    When all broker lookup processing is complete, then the system should continue with the main kcsm processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing request is being handled
GIVEN
A cargo processing request is being handled
Applied to: KCSM Processing Required?
WHEN
The system evaluates whether KCSM processing is needed
THEN
The system should proceed to broker lookup if KCSM processing is required, otherwise continue with standard processing
Context: KCSM processing is required
GIVEN
KCSM processing is required
Applied to: Access Broker Tables
WHEN
The system needs to lookup broker information
THEN
The system should access the GCSTBRT broker tables to retrieve broker data
Context: Broker tables are accessible
GIVEN
Broker tables are accessible
Applied to: Retrieve Broker Information
WHEN
The system performs broker lookup
THEN
The system should retrieve broker information from BK Table (Broker Master) and B1 Table (Broker Details)
Context: A broker lookup has been performed
GIVEN
A broker lookup has been performed
Applied to: Broker Found?
WHEN
The system checks the lookup results
THEN
The system should determine if broker information was found and proceed accordingly
Applied to: Log Broker Not Found Error
WHEN
No broker information is found in the lookup tables
THEN
The system should log a broker not found error for tracking purposes
Context: Broker information has been found in the lookup tables
GIVEN
Broker information has been found in the lookup tables
Applied to: Extract Broker Short Name
WHEN
The system processes the broker data
THEN
The system should extract the broker short name for KCSM processing
Context: Broker short name has been extracted
GIVEN
Broker short name has been extracted
Applied to: Format Broker Data for KCSM
WHEN
The system prepares data for KCSM processing
THEN
The system should format the broker data according to KCSM specifications
Context: Broker data has been formatted for KCSM
GIVEN
Broker data has been formatted for KCSM
Applied to: Store Broker Information
WHEN
The system needs to preserve broker information
THEN
The system should store the broker information for use in KCSM processing
Context: Broker lookup has failed and error has been logged
GIVEN
Broker lookup has failed and error has been logged
Applied to: Use Default Broker Information
WHEN
The system needs to continue processing
THEN
The system should use default broker information to allow processing to continue
Context: Broker information is available (either found or default)
GIVEN
Broker information is available (either found or default)
Applied to: Continue KCSM Processing
WHEN
All broker lookup processing is complete
THEN
The system should continue with the main KCSM processing workflow
R-GCX016-cbl-01947 (+14) File: GCX016.cbl Transmission Root Segment Creation Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transmission Root Segment Creation':
  • Context - a new edi transmission needs to be created:
    For Initialize Transmission Control Parameters:
    When the system begins transmission root segment creation process, then all transmission control parameters are initialized to default values and prepared for message processing.
  • Context - transmission control parameters are initialized:
    For Set EDI Message Tracking Information:
    When the system sets up edi message tracking, then message tracking information is established with unique identifiers and control data.
  • Context - edi message tracking information is set:
    For Assign Transmission Sequence Number:
    When the system assigns transmission sequence number, then a unique sequential number is assigned to identify this specific transmission.
  • Context - transmission sequence number is assigned:
    For Set Message Type and Format:
    When the system sets message type and format, then message type and format are defined according to edi standards and business requirements.
  • Context - message type and format are set:
    For Establish Sender/Receiver Information:
    When the system establishes sender and receiver information, then valid sender and receiver identifiers are set for message routing and delivery.
  • Context - sender and receiver information is established:
    For Set Transmission Date and Time:
    When the system sets transmission date and time, then current system date and time are recorded as transmission timestamp.
  • Context - all transmission control data is prepared including date, time, sender, receiver, and sequence information:
    For Create A9RT Transmission Root Segment:
    When the system creates a9rt transmission root segment, then a9rt segment is created with complete transmission control information ready for database storage.
  • Context - a9rt transmission root segment is created:
    For Validate Transmission Control Data:
    When the system validates transmission control data, then all required fields are validated for completeness, format, and business rule compliance.
  • Context - transmission control data validation is successful:
    For Store Root Segment to Database:
    When the system stores root segment to database, then a9rt transmission root segment is successfully stored in the database with all control information.
  • Context - root segment is successfully stored to database:
    For Update Transmission Status:
    When the system updates transmission status, then transmission status is updated to indicate successful root segment creation and storage.
  • Context - transmission status is updated successfully:
    For Log Transmission Creation:
    When the system logs transmission creation, then transmission creation event is logged with relevant details for audit and monitoring purposes.
  • Context - transmission creation is logged successfully:
    For Return Success Status:
    When the system returns success status, then success status is returned to calling process indicating successful transmission root segment creation.
  • Context - transmission control data validation fails:
    For Handle Validation Error:
    When the system handles validation error, then validation error is processed and appropriate error handling procedures are initiated.
  • Context - validation error is handled:
    For Log Error Information:
    When the system logs error information, then detailed error information is logged including validation failure reasons and relevant data.
  • Context - error information is logged:
    For Return Error Status:
    When the system returns error status, then error status is returned to calling process indicating failed transmission root segment creation with error details.
👨‍💻 Technical ACs (Gherkin)
Context: A new EDI transmission needs to be created
GIVEN
A new EDI transmission needs to be created
Applied to: Initialize Transmission Control Parameters
WHEN
The system begins transmission root segment creation process
THEN
All transmission control parameters are initialized to default values and prepared for message processing
Context: Transmission control parameters are initialized
GIVEN
Transmission control parameters are initialized
Applied to: Set EDI Message Tracking Information
WHEN
The system sets up EDI message tracking
THEN
Message tracking information is established with unique identifiers and control data
Context: EDI message tracking information is set
GIVEN
EDI message tracking information is set
Applied to: Assign Transmission Sequence Number
WHEN
The system assigns transmission sequence number
THEN
A unique sequential number is assigned to identify this specific transmission
Context: Transmission sequence number is assigned
GIVEN
Transmission sequence number is assigned
Applied to: Set Message Type and Format
WHEN
The system sets message type and format
THEN
Message type and format are defined according to EDI standards and business requirements
Context: Message type and format are set
GIVEN
Message type and format are set
Applied to: Establish Sender/Receiver Information
WHEN
The system establishes sender and receiver information
THEN
Valid sender and receiver identifiers are set for message routing and delivery
Context: Sender and receiver information is established
GIVEN
Sender and receiver information is established
Applied to: Set Transmission Date and Time
WHEN
The system sets transmission date and time
THEN
Current system date and time are recorded as transmission timestamp
Context: All transmission control data is prepared including date, time, sender, receiver, and sequence information
GIVEN
All transmission control data is prepared including date, time, sender, receiver, and sequence information
Applied to: Create A9RT Transmission Root Segment
WHEN
The system creates A9RT transmission root segment
THEN
A9RT segment is created with complete transmission control information ready for database storage
Context: A9RT transmission root segment is created
GIVEN
A9RT transmission root segment is created
Applied to: Validate Transmission Control Data
WHEN
The system validates transmission control data
THEN
All required fields are validated for completeness, format, and business rule compliance
Context: Transmission control data validation is successful
GIVEN
Transmission control data validation is successful
Applied to: Store Root Segment to Database
WHEN
The system stores root segment to database
THEN
A9RT transmission root segment is successfully stored in the database with all control information
Context: Root segment is successfully stored to database
GIVEN
Root segment is successfully stored to database
Applied to: Update Transmission Status
WHEN
The system updates transmission status
THEN
Transmission status is updated to indicate successful root segment creation and storage
Context: Transmission status is updated successfully
GIVEN
Transmission status is updated successfully
Applied to: Log Transmission Creation
WHEN
The system logs transmission creation
THEN
Transmission creation event is logged with relevant details for audit and monitoring purposes
Context: Transmission creation is logged successfully
GIVEN
Transmission creation is logged successfully
Applied to: Return Success Status
WHEN
The system returns success status
THEN
Success status is returned to calling process indicating successful transmission root segment creation
Context: Transmission control data validation fails
GIVEN
Transmission control data validation fails
Applied to: Handle Validation Error
WHEN
The system handles validation error
THEN
Validation error is processed and appropriate error handling procedures are initiated
Context: Validation error is handled
GIVEN
Validation error is handled
Applied to: Log Error Information
WHEN
The system logs error information
THEN
Detailed error information is logged including validation failure reasons and relevant data
Context: Error information is logged
GIVEN
Error information is logged
Applied to: Return Error Status
WHEN
The system returns error status
THEN
Error status is returned to calling process indicating failed transmission root segment creation with error details
R-GCX016-cbl-01962 (+15) File: GCX016.cbl Transmission Dependent Segment Creation Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transmission Dependent Segment Creation':
  • Context - a transmission dependent segment creation process is initiated:
    For Initialize Dependent Segment Structure:
    When the system begins creating dependent segments, then the dependent segment structure must be initialized with default values and cleared of any previous data.
  • Context - a dependent segment structure is initialized:
    For Set Transmission Control Information:
    When transmission control information needs to be established, then the system must copy transmission control data including interchange control numbers and functional group identifiers to the dependent segment.
  • Context - transmission control information is set and edi 350 message data is available:
    For Copy EDI 350 Message Data:
    When the system processes edi 350 message content, then all relevant edi 350 message data must be copied to the dependent segment maintaining data integrity and format.
  • Context - edi 350 message data is copied to the segment:
    For Format Segment Header Information:
    When segment header formatting is required, then the system must format segment header with proper segment identifier, element separator, and component separator according to edi standards.
  • Context - segment header information is formatted:
    For Set Dependent Segment Key:
    When a dependent segment key needs to be established, then the system must generate and assign a unique key combining transmission control information and segment identifiers.
  • Context - a dependent segment key is established:
    For Set Segment Sequence Number:
    When segment sequence numbering is required, then the system must assign sequential numbers to dependent segments starting from 1 and incrementing for each additional segment.
  • Context - segment sequence number is set:
    For Copy Message Content to Segment:
    When message content needs to be stored in the segment, then the system must copy the complete message content including all data elements and segments to the dependent segment structure.
  • Context - message content is copied to the segment:
    For Set Segment Length Information:
    When segment length calculation is required, then the system must calculate and store the actual length of the message content in the segment length field.
  • Context - segment length information is set:
    For Validate Segment Structure:
    When segment structure validation is performed, then the system must verify that all required fields are populated, segment length is valid, and structure conforms to edi standards.
  • Context - segment structure validation is successful:
    For Write Dependent Segment to A9DP:
    When the dependent segment is ready for storage, then the system must write the dependent segment to the a9dp database with all populated fields and proper key structure.
  • Context - a dependent segment is successfully written to a9dp:
    For Update Transmission Control Counters:
    When transmission control counter update is required, then the system must increment the segment count and update transmission control counters to reflect the new segment.
  • Context - transmission control counters are updated:
    For Increment Segment Sequence:
    When preparation for next segment is required, then the system must increment the segment sequence number by 1 to ensure proper ordering of subsequent segments.
  • Context - segment sequence is incremented and more edi data may exist:
    For More EDI Data to Process?:
    When the system checks for additional edi data to process, then if more edi data exists, the system must return to copy edi 350 message data step, otherwise proceed to completion.
  • Context - segment structure validation fails:
    For Handle Validation Error:
    When a validation error is detected, then the system must handle the validation error by setting appropriate error flags and preparing error information for logging.
  • Context - a validation error is handled:
    For Log Error Information:
    When error logging is required, then the system must log detailed error information including segment data, validation failure reason, and transmission context.
  • Context - all edi data is processed or an error is logged:
    For Complete Dependent Segment Creation:
    When the dependent segment creation process reaches completion, then the system must complete the process by setting final status indicators and returning control to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A transmission dependent segment creation process is initiated
GIVEN
A transmission dependent segment creation process is initiated
Applied to: Initialize Dependent Segment Structure
WHEN
The system begins creating dependent segments
THEN
The dependent segment structure must be initialized with default values and cleared of any previous data
Context: A dependent segment structure is initialized
GIVEN
A dependent segment structure is initialized
Applied to: Set Transmission Control Information
WHEN
Transmission control information needs to be established
THEN
The system must copy transmission control data including interchange control numbers and functional group identifiers to the dependent segment
Context: Transmission control information is set and EDI 350 message data is available
GIVEN
Transmission control information is set and EDI 350 message data is available
Applied to: Copy EDI 350 Message Data
WHEN
The system processes EDI 350 message content
THEN
All relevant EDI 350 message data must be copied to the dependent segment maintaining data integrity and format
Context: EDI 350 message data is copied to the segment
GIVEN
EDI 350 message data is copied to the segment
Applied to: Format Segment Header Information
WHEN
Segment header formatting is required
THEN
The system must format segment header with proper segment identifier, element separator, and component separator according to EDI standards
Context: Segment header information is formatted
GIVEN
Segment header information is formatted
Applied to: Set Dependent Segment Key
WHEN
A dependent segment key needs to be established
THEN
The system must generate and assign a unique key combining transmission control information and segment identifiers
Context: A dependent segment key is established
GIVEN
A dependent segment key is established
Applied to: Set Segment Sequence Number
WHEN
Segment sequence numbering is required
THEN
The system must assign sequential numbers to dependent segments starting from 1 and incrementing for each additional segment
Context: Segment sequence number is set
GIVEN
Segment sequence number is set
Applied to: Copy Message Content to Segment
WHEN
Message content needs to be stored in the segment
THEN
The system must copy the complete message content including all data elements and segments to the dependent segment structure
Context: Message content is copied to the segment
GIVEN
Message content is copied to the segment
Applied to: Set Segment Length Information
WHEN
Segment length calculation is required
THEN
The system must calculate and store the actual length of the message content in the segment length field
Context: Segment length information is set
GIVEN
Segment length information is set
Applied to: Validate Segment Structure
WHEN
Segment structure validation is performed
THEN
The system must verify that all required fields are populated, segment length is valid, and structure conforms to EDI standards
Context: Segment structure validation is successful
GIVEN
Segment structure validation is successful
Applied to: Write Dependent Segment to A9DP
WHEN
The dependent segment is ready for storage
THEN
The system must write the dependent segment to the A9DP database with all populated fields and proper key structure
Context: A dependent segment is successfully written to A9DP
GIVEN
A dependent segment is successfully written to A9DP
Applied to: Update Transmission Control Counters
WHEN
Transmission control counter update is required
THEN
The system must increment the segment count and update transmission control counters to reflect the new segment
Context: Transmission control counters are updated
GIVEN
Transmission control counters are updated
Applied to: Increment Segment Sequence
WHEN
Preparation for next segment is required
THEN
The system must increment the segment sequence number by 1 to ensure proper ordering of subsequent segments
Context: Segment sequence is incremented and more EDI data may exist
GIVEN
Segment sequence is incremented and more EDI data may exist
Applied to: More EDI Data to Process?
WHEN
The system checks for additional EDI data to process
THEN
If more EDI data exists, the system must return to copy EDI 350 message data step, otherwise proceed to completion
Context: Segment structure validation fails
GIVEN
Segment structure validation fails
Applied to: Handle Validation Error
WHEN
A validation error is detected
THEN
The system must handle the validation error by setting appropriate error flags and preparing error information for logging
Context: A validation error is handled
GIVEN
A validation error is handled
Applied to: Log Error Information
WHEN
Error logging is required
THEN
The system must log detailed error information including segment data, validation failure reason, and transmission context
Context: All EDI data is processed or an error is logged
GIVEN
All EDI data is processed or an error is logged
Applied to: Complete Dependent Segment Creation
WHEN
The dependent segment creation process reaches completion
THEN
The system must complete the process by setting final status indicators and returning control to the calling process
R-GCX016-cbl-01978 (+14) File: GCX016.cbl EDI Transaction Spawning for KCSM Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI Transaction Spawning for KCSM':
  • Context - a disposition code is being processed for cargo release:
    For Check Disposition Code for KCSM:
    When the system evaluates if kcsm edi transmission is required for the disposition code, then the system should determine whether to proceed with kcsm edi transaction spawning or skip kcsm processing.
  • Context - kcsm edi transmission is required and broker identification is available:
    For Retrieve KCSM Broker Information:
    When the system needs to retrieve broker details for edi message formatting, then the system should fetch broker information from gcstbrt broker tables and make it available for transmission setup.
  • Context - kcsm broker information has been retrieved successfully:
    For Create Transmission Root Segment:
    When the system needs to establish the edi message structure foundation, then the system should create an a9rt transmission root segment with proper identification and control parameters.
  • Context - a transmission root segment has been created for the edi message:
    For Set Transmission Control Parameters:
    When the system needs to configure transmission control settings, then the system should set appropriate transmission control parameters including message type, sequence numbers, and processing flags.
  • Context - transmission control parameters have been established:
    For Create Dependent Segments with EDI Data:
    When the system needs to populate edi message content with cargo and disposition data, then the system should create a9dp dependent segments containing formatted edi data including cargo details, disposition codes, and transaction information.
  • Context - n7 equipment segments are available and dependent segments are being created:
    For Format Equipment Details from N7 Segments:
    When the system needs to include equipment details in the edi transmission, then the system should extract and format equipment information from n7 segments including car numbers, equipment types, and related identifiers.
  • Context - all edi segments have been created and equipment details have been formatted:
    For Build Complete EDI 350 Message Copy:
    When the system needs to create the final edi message structure, then the system should build a complete edi 350 message copy containing all root segments, dependent segments, and formatted data ready for transmission.
  • Context - a complete edi 350 message has been assembled:
    For Set KCSM Transmission Parameters:
    When the system needs to configure kcsm-specific transmission settings, then the system should set kcsm transmission parameters using aecwrktb work table including destination routing, priority settings, and integration flags.
  • Context - kcsm transmission parameters have been configured and edi message is ready:
    For Spawn GCT1091E Transaction:
    When the system needs to initiate the actual edi transmission process, then the system should spawn gct1091e transaction with the prepared edi message and transmission parameters.
  • Context - gct1091e transaction spawn has been attempted:
    For Transaction Spawn Successful?:
    When the system needs to verify the spawn operation result, then the system should check the spawn status and determine whether to proceed with successful processing or handle spawn errors.
  • Context - gct1091e transaction spawn was successful:
    For Log Transmission Details:
    When the system needs to record transmission activity, then the system should log transmission details including message identifiers, timestamps, broker information, and processing status.
  • Context - transmission details have been logged successfully:
    For Queue EDI Message for KCSM:
    When the system needs to queue the message for kcsm delivery, then the system should place the edi message in the appropriate queue for kcsm system processing with proper routing and priority.
  • Context - edi message has been queued for kcsm successfully:
    For Update Transaction Status:
    When the system needs to update processing status, then the system should update transaction status to indicate successful kcsm edi integration completion.
  • Context - gct1091e transaction spawn has failed:
    For Handle Spawn Error:
    When the system encounters a spawn error condition, then the system should initiate error handling procedures to manage the failed spawn operation.
  • Context - a transaction spawn error is being handled:
    For Log Error Details:
    When the system needs to record error information, then the system should log detailed error information including error codes, failure reasons, message content, and system state for troubleshooting purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo release
GIVEN
A disposition code is being processed for cargo release
Applied to: Check Disposition Code for KCSM
WHEN
The system evaluates if KCSM EDI transmission is required for the disposition code
THEN
The system should determine whether to proceed with KCSM EDI transaction spawning or skip KCSM processing
Context: KCSM EDI transmission is required and broker identification is available
GIVEN
KCSM EDI transmission is required and broker identification is available
Applied to: Retrieve KCSM Broker Information
WHEN
The system needs to retrieve broker details for EDI message formatting
THEN
The system should fetch broker information from GCSTBRT broker tables and make it available for transmission setup
Context: KCSM broker information has been retrieved successfully
GIVEN
KCSM broker information has been retrieved successfully
Applied to: Create Transmission Root Segment
WHEN
The system needs to establish the EDI message structure foundation
THEN
The system should create an A9RT transmission root segment with proper identification and control parameters
Context: A transmission root segment has been created for the EDI message
GIVEN
A transmission root segment has been created for the EDI message
Applied to: Set Transmission Control Parameters
WHEN
The system needs to configure transmission control settings
THEN
The system should set appropriate transmission control parameters including message type, sequence numbers, and processing flags
Context: Transmission control parameters have been established
GIVEN
Transmission control parameters have been established
Applied to: Create Dependent Segments with EDI Data
WHEN
The system needs to populate EDI message content with cargo and disposition data
THEN
The system should create A9DP dependent segments containing formatted EDI data including cargo details, disposition codes, and transaction information
Context: N7 equipment segments are available and dependent segments are being created
GIVEN
N7 equipment segments are available and dependent segments are being created
Applied to: Format Equipment Details from N7 Segments
WHEN
The system needs to include equipment details in the EDI transmission
THEN
The system should extract and format equipment information from N7 segments including car numbers, equipment types, and related identifiers
Context: All EDI segments have been created and equipment details have been formatted
GIVEN
All EDI segments have been created and equipment details have been formatted
Applied to: Build Complete EDI 350 Message Copy
WHEN
The system needs to create the final EDI message structure
THEN
The system should build a complete EDI 350 message copy containing all root segments, dependent segments, and formatted data ready for transmission
Context: A complete EDI 350 message has been assembled
GIVEN
A complete EDI 350 message has been assembled
Applied to: Set KCSM Transmission Parameters
WHEN
The system needs to configure KCSM-specific transmission settings
THEN
The system should set KCSM transmission parameters using AECWRKTB work table including destination routing, priority settings, and integration flags
Context: KCSM transmission parameters have been configured and EDI message is ready
GIVEN
KCSM transmission parameters have been configured and EDI message is ready
Applied to: Spawn GCT1091E Transaction
WHEN
The system needs to initiate the actual EDI transmission process
THEN
The system should spawn GCT1091E transaction with the prepared EDI message and transmission parameters
Context: GCT1091E transaction spawn has been attempted
GIVEN
GCT1091E transaction spawn has been attempted
Applied to: Transaction Spawn Successful?
WHEN
The system needs to verify the spawn operation result
THEN
The system should check the spawn status and determine whether to proceed with successful processing or handle spawn errors
Context: GCT1091E transaction spawn was successful
GIVEN
GCT1091E transaction spawn was successful
Applied to: Log Transmission Details
WHEN
The system needs to record transmission activity
THEN
The system should log transmission details including message identifiers, timestamps, broker information, and processing status
Context: Transmission details have been logged successfully
GIVEN
Transmission details have been logged successfully
Applied to: Queue EDI Message for KCSM
WHEN
The system needs to queue the message for KCSM delivery
THEN
The system should place the EDI message in the appropriate queue for KCSM system processing with proper routing and priority
Context: EDI message has been queued for KCSM successfully
GIVEN
EDI message has been queued for KCSM successfully
Applied to: Update Transaction Status
WHEN
The system needs to update processing status
THEN
The system should update transaction status to indicate successful KCSM EDI integration completion
Context: GCT1091E transaction spawn has failed
GIVEN
GCT1091E transaction spawn has failed
Applied to: Handle Spawn Error
WHEN
The system encounters a spawn error condition
THEN
The system should initiate error handling procedures to manage the failed spawn operation
Context: A transaction spawn error is being handled
GIVEN
A transaction spawn error is being handled
Applied to: Log Error Details
WHEN
The system needs to record error information
THEN
The system should log detailed error information including error codes, failure reasons, message content, and system state for troubleshooting purposes
R-GCX016-cbl-01993 (+13) File: GCX016.cbl Message Queue Management for KCSM Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Queue Management for KCSM':
  • Context - a disposition code is provided for kcsm processing:
    For Validate KCSM Disposition Code:
    When the system validates the disposition code against aecwrktb configuration table, then the disposition code must be found in the kcsm authorized codes list to proceed with message queuing.
  • Context - an edi 350 message exists with multiple segments:
    For Copy EDI 350 Message Segments:
    When the system prepares the message for kcsm transmission, then all message segments must be copied to the transmission buffer maintaining segment structure and data integrity.
  • Context - a9rt transmission segment data is available:
    For Create Transmission Root Segment:
    When the system creates the transmission root segment, then the root segment must be formatted with proper transmission identifiers and control information from a9rt data.
  • Context - a9dp dependent segment data is available:
    For Create Transmission Dependent Segments:
    When the system creates transmission dependent segments, then all dependent segments must be created with proper sequencing and data from a9dp segments.
  • Context - root and dependent segments are created:
    For Format EDI Message for KCSM:
    When the system formats the edi message for kcsm, then the message must be formatted according to kcsm edi standards with proper segment delimiters and structure.
  • Context - a formatted edi message is ready for transmission:
    For Prepare Message Queue Entry:
    When the system prepares the message queue entry, then the queue entry must include message data, transmission parameters, and routing information.
  • Context - a message queue entry is prepared:
    For Call WRITMSGL to Queue Message:
    When the system calls writmsgl to queue the message, then writmsgl must be invoked with the prepared message data and queue parameters.
  • Context - writmsgl has been called to queue a message:
    For Queue Operation Successful?:
    When the system checks the queue operation result, then if the operation is successful, proceed to logging; if failed, initiate error handling.
  • Context - a message has been successfully queued:
    For Log Transmission Parameters:
    When the system logs transmission parameters, then transmission details including message id, timestamp, and routing information must be logged.
  • Context - transmission parameters have been logged:
    For Update Transmission Status:
    When the system updates transmission status, then the status must be updated to indicate successful queuing and readiness for transmission.
  • Context - a message queuing operation has failed:
    For Handle Queue Error:
    When the system handles the queue error, then error details must be captured and retry logic must be initiated.
  • Context - a queue error has been handled:
    For Retry Queue Operation:
    When the system retries the queue operation, then the same message must be resubmitted to the queue with identical parameters.
  • Context - a queue operation has been retried:
    For Retry Successful?:
    When the system checks the retry operation result, then if retry is successful, proceed to logging; if retry fails, log the failure and continue processing.
  • Context - a queue retry operation has failed:
    For Log Queue Failure:
    When the system logs the queue failure, then failure details including error codes, message data, and retry attempts must be logged for troubleshooting.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is provided for KCSM processing
GIVEN
A disposition code is provided for KCSM processing
Applied to: Validate KCSM Disposition Code
WHEN
The system validates the disposition code against AECWRKTB configuration table
THEN
The disposition code must be found in the KCSM authorized codes list to proceed with message queuing
Context: An EDI 350 message exists with multiple segments
GIVEN
An EDI 350 message exists with multiple segments
Applied to: Copy EDI 350 Message Segments
WHEN
The system prepares the message for KCSM transmission
THEN
All message segments must be copied to the transmission buffer maintaining segment structure and data integrity
Context: A9RT transmission segment data is available
GIVEN
A9RT transmission segment data is available
Applied to: Create Transmission Root Segment
WHEN
The system creates the transmission root segment
THEN
The root segment must be formatted with proper transmission identifiers and control information from A9RT data
Context: A9DP dependent segment data is available
GIVEN
A9DP dependent segment data is available
Applied to: Create Transmission Dependent Segments
WHEN
The system creates transmission dependent segments
THEN
All dependent segments must be created with proper sequencing and data from A9DP segments
Context: Root and dependent segments are created
GIVEN
Root and dependent segments are created
Applied to: Format EDI Message for KCSM
WHEN
The system formats the EDI message for KCSM
THEN
The message must be formatted according to KCSM EDI standards with proper segment delimiters and structure
Context: A formatted EDI message is ready for transmission
GIVEN
A formatted EDI message is ready for transmission
Applied to: Prepare Message Queue Entry
WHEN
The system prepares the message queue entry
THEN
The queue entry must include message data, transmission parameters, and routing information
Context: A message queue entry is prepared
GIVEN
A message queue entry is prepared
Applied to: Call WRITMSGL to Queue Message
WHEN
The system calls WRITMSGL to queue the message
THEN
WRITMSGL must be invoked with the prepared message data and queue parameters
Context: WRITMSGL has been called to queue a message
GIVEN
WRITMSGL has been called to queue a message
Applied to: Queue Operation Successful?
WHEN
The system checks the queue operation result
THEN
If the operation is successful, proceed to logging; if failed, initiate error handling
Context: A message has been successfully queued
GIVEN
A message has been successfully queued
Applied to: Log Transmission Parameters
WHEN
The system logs transmission parameters
THEN
Transmission details including message ID, timestamp, and routing information must be logged
Context: Transmission parameters have been logged
GIVEN
Transmission parameters have been logged
Applied to: Update Transmission Status
WHEN
The system updates transmission status
THEN
The status must be updated to indicate successful queuing and readiness for transmission
Context: A message queuing operation has failed
GIVEN
A message queuing operation has failed
Applied to: Handle Queue Error
WHEN
The system handles the queue error
THEN
Error details must be captured and retry logic must be initiated
Context: A queue error has been handled
GIVEN
A queue error has been handled
Applied to: Retry Queue Operation
WHEN
The system retries the queue operation
THEN
The same message must be resubmitted to the queue with identical parameters
Context: A queue operation has been retried
GIVEN
A queue operation has been retried
Applied to: Retry Successful?
WHEN
The system checks the retry operation result
THEN
If retry is successful, proceed to logging; if retry fails, log the failure and continue processing
Context: A queue retry operation has failed
GIVEN
A queue retry operation has failed
Applied to: Log Queue Failure
WHEN
The system logs the queue failure
THEN
Failure details including error codes, message data, and retry attempts must be logged for troubleshooting
R-GCX016-cbl-02007 (+13) File: GCX016.cbl Transaction Logging for KCSM Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transaction Logging for KCSM':
  • Context - a cargo processing transaction is being executed:
    For KCSM Processing Required?:
    When the system evaluates if kcsm logging is needed, then kcsm processing is required if broker is configured for kcsm transmission and message type requires logging.
  • Context - kcsm processing is required for a transaction:
    For Retrieve KCSM Broker Information:
    When the system needs broker information for transmission setup, then broker kcsm configuration data is retrieved from broker master records.
  • Context - kcsm broker information has been retrieved:
    For Create Transmission Root Segment:
    When a transmission root segment needs to be created, then a9rt transmission root segment is created with transmission id, broker id, and timestamp.
  • Context - a transmission root segment has been created:
    For Log Transmission Parameters:
    When transmission parameters need to be logged, then transmission parameters including broker configuration, message type, and processing flags are recorded in a9rt segment.
  • Context - transmission parameters have been logged:
    For Create Transmission Dependent Segment:
    When detailed transmission information needs to be stored, then a9dp transmission dependent segment is created with message details and cargo information.
  • Context - a transmission dependent segment has been created:
    For Log EDI Message Details:
    When edi message details need to be logged, then message content, structure, and cargo details are recorded in a9dp segment.
  • Context - edi message details have been logged:
    For Prepare GCT1091E Transaction:
    When kcsm transmission transaction needs to be prepared, then gct1091e transaction is prepared with transmission segments, broker information, and message data.
  • Context - gct1091e transaction has been prepared:
    For Log Transaction Spawn Parameters:
    When transaction spawn parameters need to be logged, then spawn parameters including transaction id, broker id, and message parameters are recorded in aecwrktb work table.
  • Context - transaction spawn parameters have been logged:
    For Execute KCSM Transaction Spawn:
    When kcsm transaction needs to be executed, then gct1091e transaction is spawned to process kcsm transmission.
  • Context - kcsm transaction has been executed:
    For Transaction Successful?:
    When transaction completion status needs to be evaluated, then transaction is successful if return code indicates normal completion without errors.
  • Context - kcsm transaction completed successfully:
    For Log Success Status:
    When success status needs to be logged, then success status and completion timestamp are recorded in transmission records.
  • Context - kcsm transaction failed to complete successfully:
    For Log Error Status and Details:
    When error status and details need to be logged, then error status, error codes, and failure details are recorded in transmission records.
  • Context - transaction completion status has been logged:
    For Update Transmission Status:
    When transmission status needs to be updated, then overall transmission status is updated to reflect success or failure in a9rt and a9dp segments.
  • Context - transmission status has been updated:
    For Log Final Transmission Status:
    When final transmission status needs to be logged, then final status, completion timestamp, and summary information are recorded for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing transaction is being executed
GIVEN
A cargo processing transaction is being executed
Applied to: KCSM Processing Required?
WHEN
The system evaluates if KCSM logging is needed
THEN
KCSM processing is required if broker is configured for KCSM transmission and message type requires logging
Context: KCSM processing is required for a transaction
GIVEN
KCSM processing is required for a transaction
Applied to: Retrieve KCSM Broker Information
WHEN
The system needs broker information for transmission setup
THEN
Broker KCSM configuration data is retrieved from broker master records
Context: KCSM broker information has been retrieved
GIVEN
KCSM broker information has been retrieved
Applied to: Create Transmission Root Segment
WHEN
A transmission root segment needs to be created
THEN
A9RT transmission root segment is created with transmission ID, broker ID, and timestamp
Context: A transmission root segment has been created
GIVEN
A transmission root segment has been created
Applied to: Log Transmission Parameters
WHEN
Transmission parameters need to be logged
THEN
Transmission parameters including broker configuration, message type, and processing flags are recorded in A9RT segment
Context: Transmission parameters have been logged
GIVEN
Transmission parameters have been logged
Applied to: Create Transmission Dependent Segment
WHEN
Detailed transmission information needs to be stored
THEN
A9DP transmission dependent segment is created with message details and cargo information
Context: A transmission dependent segment has been created
GIVEN
A transmission dependent segment has been created
Applied to: Log EDI Message Details
WHEN
EDI message details need to be logged
THEN
Message content, structure, and cargo details are recorded in A9DP segment
Context: EDI message details have been logged
GIVEN
EDI message details have been logged
Applied to: Prepare GCT1091E Transaction
WHEN
KCSM transmission transaction needs to be prepared
THEN
GCT1091E transaction is prepared with transmission segments, broker information, and message data
Context: GCT1091E transaction has been prepared
GIVEN
GCT1091E transaction has been prepared
Applied to: Log Transaction Spawn Parameters
WHEN
Transaction spawn parameters need to be logged
THEN
Spawn parameters including transaction ID, broker ID, and message parameters are recorded in AECWRKTB work table
Context: Transaction spawn parameters have been logged
GIVEN
Transaction spawn parameters have been logged
Applied to: Execute KCSM Transaction Spawn
WHEN
KCSM transaction needs to be executed
THEN
GCT1091E transaction is spawned to process KCSM transmission
Context: KCSM transaction has been executed
GIVEN
KCSM transaction has been executed
Applied to: Transaction Successful?
WHEN
Transaction completion status needs to be evaluated
THEN
Transaction is successful if return code indicates normal completion without errors
Context: KCSM transaction completed successfully
GIVEN
KCSM transaction completed successfully
Applied to: Log Success Status
WHEN
Success status needs to be logged
THEN
Success status and completion timestamp are recorded in transmission records
Context: KCSM transaction failed to complete successfully
GIVEN
KCSM transaction failed to complete successfully
Applied to: Log Error Status and Details
WHEN
Error status and details need to be logged
THEN
Error status, error codes, and failure details are recorded in transmission records
Context: Transaction completion status has been logged
GIVEN
Transaction completion status has been logged
Applied to: Update Transmission Status
WHEN
Transmission status needs to be updated
THEN
Overall transmission status is updated to reflect success or failure in A9RT and A9DP segments
Context: Transmission status has been updated
GIVEN
Transmission status has been updated
Applied to: Log Final Transmission Status
WHEN
Final transmission status needs to be logged
THEN
Final status, completion timestamp, and summary information are recorded for audit trail
R-GCX016-cbl-02021 File: GCX016.cbl Database Transaction Control
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database Transaction Control':
  • Context - the system requires database transaction control for ims database transaction purging cleanup operations:
    For Database Transaction Control - Manage IMS database transaction purging for cleanup operations:
    When business process 162 is referenced or called, then the system indicates that no source code is available for this functionality in the provided program summary.
👨‍💻 Technical ACs (Gherkin)
Context: The system requires database transaction control for IMS database transaction purging cleanup operations
GIVEN
The system requires database transaction control for IMS database transaction purging cleanup operations
Applied to: Database Transaction Control - Manage IMS database transaction purging for cleanup operations
WHEN
Business process 162 is referenced or called
THEN
The system indicates that no source code is available for this functionality in the provided program summary
R-GCX016-cbl-02022 (+14) File: GCX016.cbl Train Equipment Hold Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Equipment Hold Processing':
  • Context - an hmi train hold disposition code has been processed:
    For VID Segments Available?:
    When the system checks for available vid segments in the message, then if vid segments are available, proceed to read vid segments, otherwise complete equipment hold processing.
  • Context - vid segments are available for processing:
    For Read Next VID Segment:
    When the system processes vid segments sequentially, then read the next vid segment from the message queue.
  • Context - a vid segment has been read from the message:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment content, then extract the equipment id information from the vid segment data.
  • Context - equipment id has been extracted from the vid segment:
    For Format Equipment ID using GCCCARFM:
    When the system needs to format the equipment id for validation, then call gcccarfm to format the equipment id into standard format.
  • Context - equipment id has been formatted using gcccarfm:
    For Equipment ID Valid?:
    When the system validates the equipment id, then if equipment id is valid, proceed to hold the equipment, otherwise skip this equipment and continue to next vid segment.
  • Context - equipment id has been validated as valid:
    For Hold Specific Equipment on Train:
    When the system processes the equipment hold request, then apply hold status to the specific equipment on the train.
  • Context - specific equipment has been successfully held on the train:
    For Increment Held Equipment Counter:
    When the system updates hold statistics, then increment the held equipment counter by one.
  • Context - equipment has been held and counter has been incremented:
    For Log Equipment Hold Action:
    When the system completes the hold action, then log the equipment hold action with equipment id and timestamp.
  • Context - current vid segment has been processed (either held or skipped):
    For More VID Segments?:
    When the system checks for remaining vid segments, then if more vid segments exist, continue processing next segment, otherwise proceed to update train hold status.
  • Context - equipment id has been validated and found invalid:
    For Skip Invalid Equipment ID:
    When the system encounters an invalid equipment id, then skip hold processing for this equipment and continue to check for more vid segments.
  • Context - all vid segments have been processed:
    For Update Train Hold Status:
    When the system finalizes equipment hold processing, then update the train hold status based on the number of equipment units held.
  • Context - train hold status has been updated with held equipment count:
    For All Equipment Held?:
    When the system evaluates the completeness of equipment holds, then if all equipment on train is held, set complete train hold status, otherwise set partial train hold status.
  • Context - all equipment on the train has been successfully held:
    For Set Complete Train Hold Status:
    When the system sets the final train hold status, then set the train status to complete hold.
  • Context - only some equipment on the train has been held (not all equipment):
    For Set Partial Train Hold Status:
    When the system sets the final train hold status, then set the train status to partial hold.
  • Context - train hold status has been set (either complete or partial hold):
    For Equipment Hold Processing Complete:
    When the system finalizes equipment hold processing, then complete the equipment hold processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: An HMI train hold disposition code has been processed
GIVEN
An HMI train hold disposition code has been processed
Applied to: VID Segments Available?
WHEN
The system checks for available VID segments in the message
THEN
If VID segments are available, proceed to read VID segments, otherwise complete equipment hold processing
Context: VID segments are available for processing
GIVEN
VID segments are available for processing
Applied to: Read Next VID Segment
WHEN
The system processes VID segments sequentially
THEN
Read the next VID segment from the message queue
Context: A VID segment has been read from the message
GIVEN
A VID segment has been read from the message
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment content
THEN
Extract the equipment ID information from the VID segment data
Context: Equipment ID has been extracted from the VID segment
GIVEN
Equipment ID has been extracted from the VID segment
Applied to: Format Equipment ID using GCCCARFM
WHEN
The system needs to format the equipment ID for validation
THEN
Call GCCCARFM to format the equipment ID into standard format
Context: Equipment ID has been formatted using GCCCARFM
GIVEN
Equipment ID has been formatted using GCCCARFM
Applied to: Equipment ID Valid?
WHEN
The system validates the equipment ID
THEN
If equipment ID is valid, proceed to hold the equipment, otherwise skip this equipment and continue to next VID segment
Context: Equipment ID has been validated as valid
GIVEN
Equipment ID has been validated as valid
Applied to: Hold Specific Equipment on Train
WHEN
The system processes the equipment hold request
THEN
Apply hold status to the specific equipment on the train
Context: Specific equipment has been successfully held on the train
GIVEN
Specific equipment has been successfully held on the train
Applied to: Increment Held Equipment Counter
WHEN
The system updates hold statistics
THEN
Increment the held equipment counter by one
Context: Equipment has been held and counter has been incremented
GIVEN
Equipment has been held and counter has been incremented
Applied to: Log Equipment Hold Action
WHEN
The system completes the hold action
THEN
Log the equipment hold action with equipment ID and timestamp
Context: Current VID segment has been processed (either held or skipped)
GIVEN
Current VID segment has been processed (either held or skipped)
Applied to: More VID Segments?
WHEN
The system checks for remaining VID segments
THEN
If more VID segments exist, continue processing next segment, otherwise proceed to update train hold status
Context: Equipment ID has been validated and found invalid
GIVEN
Equipment ID has been validated and found invalid
Applied to: Skip Invalid Equipment ID
WHEN
The system encounters an invalid equipment ID
THEN
Skip hold processing for this equipment and continue to check for more VID segments
Context: All VID segments have been processed
GIVEN
All VID segments have been processed
Applied to: Update Train Hold Status
WHEN
The system finalizes equipment hold processing
THEN
Update the train hold status based on the number of equipment units held
Context: Train hold status has been updated with held equipment count
GIVEN
Train hold status has been updated with held equipment count
Applied to: All Equipment Held?
WHEN
The system evaluates the completeness of equipment holds
THEN
If all equipment on train is held, set complete train hold status, otherwise set partial train hold status
Context: All equipment on the train has been successfully held
GIVEN
All equipment on the train has been successfully held
Applied to: Set Complete Train Hold Status
WHEN
The system sets the final train hold status
THEN
Set the train status to complete hold
Context: Only some equipment on the train has been held (not all equipment)
GIVEN
Only some equipment on the train has been held (not all equipment)
Applied to: Set Partial Train Hold Status
WHEN
The system sets the final train hold status
THEN
Set the train status to partial hold
Context: Train hold status has been set (either complete or partial hold)
GIVEN
Train hold status has been set (either complete or partial hold)
Applied to: Equipment Hold Processing Complete
WHEN
The system finalizes equipment hold processing
THEN
Complete the equipment hold processing workflow
R-GCX016-cbl-02037 (+16) File: GCX016.cbl Train Equipment Release Processing Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Equipment Release Processing':
  • Context - a message contains hre disposition code followed by vid segments:
    For VID Segment Following HRE Code Detected:
    When the system processes the message segments in sequence, then vid segments following hre codes are identified for equipment release processing.
  • Context - a vid segment contains equipment identification data:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment, then equipment id is extracted from the vid segment for further processing.
  • Context - an equipment id has been extracted from vid segment:
    For Format Equipment ID using GCCCARFM:
    When the system needs to format the equipment id, then gcccarfm utility is called to format the equipment id to standard format.
  • Context - an equipment id has been formatted:
    For Equipment ID Valid?:
    When the system validates the equipment id, then equipment id is accepted if valid or rejected if invalid with appropriate error logging.
  • Context - a valid equipment id exists:
    For Get Train Record from GCWTL-TRAIN-LIST:
    When the system needs to process equipment release, then train record is retrieved from gcwtl-train-list database.
  • Context - a train record lookup has been performed:
    For Train Found?:
    When the system checks the lookup result, then processing continues if train is found or error is logged if train is not found.
  • Context - a train record exists and equipment id is valid:
    For Search for Equipment in Train's Held Equipment List:
    When the system searches for equipment in the train's held equipment list, then equipment is located in the held list or not found status is determined.
  • Context - equipment search in held list has been completed:
    For Equipment Found in Held List?:
    When the system checks if equipment was found in held list, then equipment release proceeds if found or error is logged if not found in held list.
  • Context - equipment is found in the train's held equipment list:
    For Remove Equipment from Held Equipment List:
    When equipment release is authorized, then equipment is removed from the held equipment list.
  • Context - equipment has been removed from held equipment list:
    For Decrement Train's Held Equipment Count:
    When the system updates train statistics, then train's held equipment count is decremented by one.
  • Context - equipment has been released and count has been decremented:
    For Any Equipment Still Held on Train?:
    When the system checks remaining held equipment count, then train status is determined based on whether any equipment remains held.
  • Context - no equipment remains held on the train:
    For Update Train Status to Released:
    When the system updates train status, then train status is updated to released.
  • Context - train record has been modified with equipment release information:
    For Update Train Record in Database:
    When the system commits changes, then train record is updated in the database with current status and equipment information.
  • Context - equipment has been successfully released from hold:
    For Log Equipment Release Action:
    When the system completes the release process, then equipment release action is logged with relevant details for audit purposes.
  • Context - equipment id formatting fails:
    For Log Equipment ID Format Error:
    When the system encounters invalid equipment id format, then equipment id format error is logged and processing continues with next vid segment.
  • Context - train record lookup fails:
    For Log Train Not Found Error:
    When the system cannot find the train in the database, then train not found error is logged and processing continues with next vid segment.
  • Context - equipment search in held list returns no results:
    For Log Equipment Not Found in Held List:
    When the system cannot locate equipment in held list, then equipment not found in held list error is logged and processing continues with next vid segment.
👨‍💻 Technical ACs (Gherkin)
Context: A message contains HRE disposition code followed by VID segments
GIVEN
A message contains HRE disposition code followed by VID segments
Applied to: VID Segment Following HRE Code Detected
WHEN
The system processes the message segments in sequence
THEN
VID segments following HRE codes are identified for equipment release 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
Equipment ID is extracted from the VID segment for further processing
Context: An equipment ID has been extracted from VID segment
GIVEN
An equipment ID has been extracted from VID segment
Applied to: Format Equipment ID using GCCCARFM
WHEN
The system needs to format the equipment ID
THEN
GCCCARFM utility is called to format the equipment ID to standard format
Context: An equipment ID has been formatted
GIVEN
An equipment ID has been formatted
Applied to: Equipment ID Valid?
WHEN
The system validates the equipment ID
THEN
Equipment ID is accepted if valid or rejected if invalid with appropriate error logging
Context: A valid equipment ID exists
GIVEN
A valid equipment ID exists
Applied to: Get Train Record from GCWTL-TRAIN-LIST
WHEN
The system needs to process equipment release
THEN
Train record is retrieved from GCWTL-TRAIN-LIST database
Context: A train record lookup has been performed
GIVEN
A train record lookup has been performed
Applied to: Train Found?
WHEN
The system checks the lookup result
THEN
Processing continues if train is found or error is logged if train is not found
Context: A train record exists and equipment ID is valid
GIVEN
A train record exists and equipment ID is valid
Applied to: Search for Equipment in Train's Held Equipment List
WHEN
The system searches for equipment in the train's held equipment list
THEN
Equipment is located in the held list or not found status is determined
Context: Equipment search in held list has been completed
GIVEN
Equipment search in held list has been completed
Applied to: Equipment Found in Held List?
WHEN
The system checks if equipment was found in held list
THEN
Equipment release proceeds if found or error is logged if not found in held list
Context: Equipment is found in the train's held equipment list
GIVEN
Equipment is found in the train's held equipment list
Applied to: Remove Equipment from Held Equipment List
WHEN
Equipment release is authorized
THEN
Equipment is removed from the held equipment list
Context: Equipment has been removed from held equipment list
GIVEN
Equipment has been removed from held equipment list
Applied to: Decrement Train's Held Equipment Count
WHEN
The system updates train statistics
THEN
Train's held equipment count is decremented by one
Context: Equipment has been released and count has been decremented
GIVEN
Equipment has been released and count has been decremented
Applied to: Any Equipment Still Held on Train?
WHEN
The system checks remaining held equipment count
THEN
Train status is determined based on whether any equipment remains held
Context: No equipment remains held on the train
GIVEN
No equipment remains held on the train
Applied to: Update Train Status to Released
WHEN
The system updates train status
THEN
Train status is updated to released
Context: Train record has been modified with equipment release information
GIVEN
Train record has been modified with equipment release information
Applied to: Update Train Record in Database
WHEN
The system commits changes
THEN
Train record is updated in the database with current status and equipment information
Context: Equipment has been successfully released from hold
GIVEN
Equipment has been successfully released from hold
Applied to: Log Equipment Release Action
WHEN
The system completes the release process
THEN
Equipment release action is logged with relevant details for audit purposes
Context: Equipment ID formatting fails
GIVEN
Equipment ID formatting fails
Applied to: Log Equipment ID Format Error
WHEN
The system encounters invalid equipment ID format
THEN
Equipment ID format error is logged and processing continues with next VID segment
Context: Train record lookup fails
GIVEN
Train record lookup fails
Applied to: Log Train Not Found Error
WHEN
The system cannot find the train in the database
THEN
Train not found error is logged and processing continues with next VID segment
Context: Equipment search in held list returns no results
GIVEN
Equipment search in held list returns no results
Applied to: Log Equipment Not Found in Held List
WHEN
The system cannot locate equipment in held list
THEN
Equipment not found in held list error is logged and processing continues with next VID segment
R-GCX016-cbl-02054 (+15) File: GCX016.cbl Train Equipment Seizure Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Equipment Seizure Processing':
  • Context - a sei disposition code has been processed for a train:
    For VID Segment Available?:
    When the system checks for vid segments in the message, then if vid segments are present, proceed to extract equipment information, otherwise complete seizure processing without equipment-specific actions.
  • Context - a vid segment is available in the message:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment, then extract the equipment id from the vid segment data for validation and seizure processing.
  • 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 verify the equipment id conforms to standard format requirements for train equipment identification.
  • Context - an equipment id has been validated for format compliance:
    For Equipment ID Valid?:
    When the system evaluates the validation results, then if the equipment id is valid, proceed with seizure marking, otherwise skip the invalid equipment and log an error.
  • Context - a valid equipment id has been identified for seizure:
    For Mark Equipment as Seized:
    When the system processes the seizure action, then mark the equipment as seized and update its status in the system.
  • Context - equipment has been marked as seized:
    For Update Equipment Seizure Status:
    When the system updates equipment records, then update the equipment seizure status in the database with current seizure information.
  • Context - equipment seizure status has been updated:
    For Increment Train Seized Equipment Count:
    When the system processes the seizure count, then increment the train's seized equipment counter by one.
  • Context - one vid segment has been processed for equipment seizure:
    For Check if More VID Segments:
    When the system checks for additional vid segments, then determine if more vid segments are available for processing additional equipment seizures.
  • Context - the system has checked for additional vid segments:
    For More VID Segments?:
    When the system evaluates vid segment availability, then if more vid segments exist, continue processing them, otherwise proceed to update overall train seizure status.
  • Context - all vid segments have been processed for equipment seizure:
    For Update Train Seizure Status:
    When the system updates train seizure status, then update the train's overall seizure status based on the number of equipment items seized.
  • Context - train seizure status has been updated with seized equipment count:
    For All Equipment Seized?:
    When the system evaluates total seizure coverage, then if all equipment on the train is seized, set train as fully seized, otherwise set as partially seized.
  • Context - all equipment on the train has been seized:
    For Set Train as Fully Seized:
    When the system sets the train seizure status, then set the train status to fully seized indicating complete seizure of all equipment.
  • Context - some but not all equipment on the train has been seized:
    For Set Train as Partially Seized:
    When the system sets the train seizure status, then set the train status to partially seized indicating incomplete seizure of equipment.
  • Context - equipment has been successfully seized and status updated:
    For Log Equipment Seizure Action:
    When the system performs logging operations, then log the equipment seizure action with equipment id, seizure timestamp, and related details.
  • Context - an equipment id has failed validation checks:
    For Skip Invalid Equipment ID:
    When the system processes the invalid equipment id, then skip seizure processing for the invalid equipment id and continue with next vid segment.
  • Context - an invalid equipment id has been skipped:
    For Log Equipment ID Error:
    When the system performs error logging, then log the equipment id error with details about the validation failure and continue processing.
👨‍💻 Technical ACs (Gherkin)
Context: A SEI disposition code has been processed for a train
GIVEN
A SEI disposition code has been processed for a train
Applied to: VID Segment Available?
WHEN
The system checks for VID segments in the message
THEN
If VID segments are present, proceed to extract equipment information, otherwise complete seizure processing without equipment-specific actions
Context: A VID segment is available in the message
GIVEN
A VID segment is available in the message
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment
THEN
Extract the equipment ID from the VID segment data for validation and seizure processing
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
Verify the equipment ID conforms to standard format requirements for train equipment identification
Context: An equipment ID has been validated for format compliance
GIVEN
An equipment ID has been validated for format compliance
Applied to: Equipment ID Valid?
WHEN
The system evaluates the validation results
THEN
If the equipment ID is valid, proceed with seizure marking, otherwise skip the invalid equipment and log an error
Context: A valid equipment ID has been identified for seizure
GIVEN
A valid equipment ID has been identified for seizure
Applied to: Mark Equipment as Seized
WHEN
The system processes the seizure action
THEN
Mark the equipment as seized and update its status in the system
Context: Equipment has been marked as seized
GIVEN
Equipment has been marked as seized
Applied to: Update Equipment Seizure Status
WHEN
The system updates equipment records
THEN
Update the equipment seizure status in the database with current seizure information
Context: Equipment seizure status has been updated
GIVEN
Equipment seizure status has been updated
Applied to: Increment Train Seized Equipment Count
WHEN
The system processes the seizure count
THEN
Increment the train's seized equipment counter by one
Context: One VID segment has been processed for equipment seizure
GIVEN
One VID segment has been processed for equipment seizure
Applied to: Check if More VID Segments
WHEN
The system checks for additional VID segments
THEN
Determine if more VID segments are available for processing additional equipment seizures
Context: The system has checked for additional VID segments
GIVEN
The system has checked for additional VID segments
Applied to: More VID Segments?
WHEN
The system evaluates VID segment availability
THEN
If more VID segments exist, continue processing them, otherwise proceed to update overall train seizure status
Context: All VID segments have been processed for equipment seizure
GIVEN
All VID segments have been processed for equipment seizure
Applied to: Update Train Seizure Status
WHEN
The system updates train seizure status
THEN
Update the train's overall seizure status based on the number of equipment items seized
Context: Train seizure status has been updated with seized equipment count
GIVEN
Train seizure status has been updated with seized equipment count
Applied to: All Equipment Seized?
WHEN
The system evaluates total seizure coverage
THEN
If all equipment on the train is seized, set train as fully seized, otherwise set as partially seized
Context: All equipment on the train has been seized
GIVEN
All equipment on the train has been seized
Applied to: Set Train as Fully Seized
WHEN
The system sets the train seizure status
THEN
Set the train status to fully seized indicating complete seizure of all equipment
Context: Some but not all equipment on the train has been seized
GIVEN
Some but not all equipment on the train has been seized
Applied to: Set Train as Partially Seized
WHEN
The system sets the train seizure status
THEN
Set the train status to partially seized indicating incomplete seizure of equipment
Context: Equipment has been successfully seized and status updated
GIVEN
Equipment has been successfully seized and status updated
Applied to: Log Equipment Seizure Action
WHEN
The system performs logging operations
THEN
Log the equipment seizure action with equipment ID, seizure timestamp, and related details
Context: An equipment ID has failed validation checks
GIVEN
An equipment ID has failed validation checks
Applied to: Skip Invalid Equipment ID
WHEN
The system processes the invalid equipment ID
THEN
Skip seizure processing for the invalid equipment ID and continue with next VID segment
Context: An invalid equipment ID has been skipped
GIVEN
An invalid equipment ID has been skipped
Applied to: Log Equipment ID Error
WHEN
The system performs error logging
THEN
Log the equipment ID error with details about the validation failure and continue processing
R-GCX016-cbl-02070 (+9) File: GCX016.cbl Train Equipment Seizure Release Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Equipment Seizure Release Processing':
  • Context - a ser disposition code has been processed for a train:
    For VID Segments Available?:
    When the system checks for available vid segments to process equipment seizure release, then if vid segments are available, proceed to process equipment seizure release, otherwise complete the seizure release process.
  • Context - a vid segment is available for processing:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment, then extract the equipment id from the vid segment data.
  • Context - an equipment id has been extracted from a vid segment:
    For Equipment ID Valid?:
    When the system validates the equipment id format, then if the equipment id format is valid, proceed to find equipment in seized list, otherwise skip this invalid equipment id.
  • Context - a valid equipment id has been extracted from vid segment:
    For Equipment Found in Seized List?:
    When the system searches for the equipment in the train's seized equipment list, then if equipment is found in the seized list, proceed to release it from seizure, otherwise no action is required as equipment is not currently seized.
  • Context - equipment is found in the train's seized equipment list:
    For Remove Equipment from Seized Status:
    When the system processes the seizure release, then remove the equipment from seized status and update the equipment seizure flag to released.
  • Context - equipment has been successfully removed from seized status:
    For Decrement Train Seized Equipment Count:
    When the system updates train seizure statistics, then decrement the train's total seized equipment count by one.
  • Context - one vid segment has been processed for equipment seizure release:
    For More VID Segments?:
    When the system checks for additional vid segments, then if more vid segments exist, continue processing the next vid segment, otherwise proceed to check train overall seizure status.
  • Context - all vid segments have been processed for equipment seizure release:
    For Any Equipment Still Seized?:
    When the system evaluates the train's overall seizure status, then if any equipment is still seized, keep train in seized status, otherwise release train from seizure status.
  • Context - train's overall seizure status has been determined:
    For Update Train Seizure Status in Database:
    When the system updates the database, then update the train seizure status in the database to reflect current seizure state.
  • Context - equipment seizure release processing has been completed:
    For Log Equipment Seizure Release Activity:
    When the system performs activity logging, then log all equipment seizure release activities including equipment ids, timestamps, and status changes.
👨‍💻 Technical ACs (Gherkin)
Context: A SER disposition code has been processed for a train
GIVEN
A SER disposition code has been processed for a train
Applied to: VID Segments Available?
WHEN
The system checks for available VID segments to process equipment seizure release
THEN
If VID segments are available, proceed to process equipment seizure release, otherwise complete the seizure release process
Context: A VID segment is available for processing
GIVEN
A VID segment is available for processing
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment
THEN
Extract the equipment ID 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: Equipment ID Valid?
WHEN
The system validates the equipment ID format
THEN
If the equipment ID format is valid, proceed to find equipment in seized list, otherwise skip this invalid equipment ID
Context: A valid equipment ID has been extracted from VID segment
GIVEN
A valid equipment ID has been extracted from VID segment
Applied to: Equipment Found in Seized List?
WHEN
The system searches for the equipment in the train's seized equipment list
THEN
If equipment is found in the seized list, proceed to release it from seizure, otherwise no action is required as equipment is not currently seized
Context: Equipment is found in the train's seized equipment list
GIVEN
Equipment is found in the train's seized equipment list
Applied to: Remove Equipment from Seized Status
WHEN
The system processes the seizure release
THEN
Remove the equipment from seized status and update the equipment seizure flag to released
Context: Equipment has been successfully removed from seized status
GIVEN
Equipment has been successfully removed from seized status
Applied to: Decrement Train Seized Equipment Count
WHEN
The system updates train seizure statistics
THEN
Decrement the train's total seized equipment count by one
Context: One VID segment has been processed for equipment seizure release
GIVEN
One VID segment has been processed for equipment seizure release
Applied to: More VID Segments?
WHEN
The system checks for additional VID segments
THEN
If more VID segments exist, continue processing the next VID segment, otherwise proceed to check train overall seizure status
Context: All VID segments have been processed for equipment seizure release
GIVEN
All VID segments have been processed for equipment seizure release
Applied to: Any Equipment Still Seized?
WHEN
The system evaluates the train's overall seizure status
THEN
If any equipment is still seized, keep train in seized status, otherwise release train from seizure status
Context: Train's overall seizure status has been determined
GIVEN
Train's overall seizure status has been determined
Applied to: Update Train Seizure Status in Database
WHEN
The system updates the database
THEN
Update the train seizure status in the database to reflect current seizure state
Context: Equipment seizure release processing has been completed
GIVEN
Equipment seizure release processing has been completed
Applied to: Log Equipment Seizure Release Activity
WHEN
The system performs activity logging
THEN
Log all equipment seizure release activities including equipment IDs, timestamps, and status changes
R-GCX016-cbl-02080 (+14) File: GCX016.cbl Equipment Hold Count Management Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Hold Count Management':
  • Context - a vid segment is received after an hmi event code and the disposition code is hmi:
    For HMI - Hold Equipment:
    When the system processes the hmi disposition code for equipment hold, then the equipment is added to the hold list and the held equipment counter is incremented and the train status is set to held.
  • Context - a vid segment is received after an hre event code and the disposition code is hre:
    For HRE - Release Equipment:
    When the system processes the hre disposition code for equipment release, then the equipment is removed from the hold list and the held equipment counter is decremented.
  • Context - a vid segment contains equipment information:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment for equipment hold or release, then the equipment id is extracted from the vid segment data.
  • Context - an equipment id has been extracted from a vid segment:
    For Format Equipment ID Using GCCCARFM:
    When the system needs to format the equipment id for processing, then the gcccarfm program is called to format the equipment id.
  • Context - an equipment id has been formatted using gcccarfm:
    For Equipment ID Valid?:
    When the system validates the equipment id, then if the equipment id is valid then continue with hold/release processing else skip the invalid equipment.
  • Context - equipment id is valid and disposition code is hmi:
    For Add Equipment to Hold List:
    When the system processes the equipment hold request, then the equipment is added to the train's equipment hold list.
  • Context - equipment has been added to the hold list:
    For Increment Held Equipment Counter:
    When the system updates the held equipment count, then the held equipment counter is incremented by one.
  • Context - equipment id is valid and disposition code is hre:
    For Remove Equipment from Hold List:
    When the system processes the equipment release request, then the equipment is removed from the train's equipment hold list.
  • Context - equipment has been removed from the hold list:
    For Decrement Held Equipment Counter:
    When the system updates the held equipment count, then the held equipment counter is decremented by one.
  • Context - the held equipment counter has been updated:
    For Any Equipment Still Held?:
    When the system determines the train's overall hold status, then if any equipment is still held then set train status to held else set train status to released.
  • Context - equipment has been added to hold list or equipment still remains on hold list after release processing:
    For Set Train Status: HELD:
    When the system updates the train status, then the train status is set to held.
  • Context - no equipment remains on the hold list after release processing:
    For Set Train Status: RELEASED:
    When the system updates the train status, then the train status is set to released.
  • Context - the train status has been determined as held or released:
    For Update Train Hold Status in Database:
    When the system updates the database, then the train hold status is updated in the gcwtl-train-list database and the train status database.
  • Context - equipment hold or release processing has been completed:
    For Log Equipment Hold/Release Action:
    When the system logs the action, then the equipment hold or release action is logged with equipment id and action type.
  • Context - equipment id validation fails:
    For Skip Invalid Equipment:
    When the system encounters invalid equipment, then the invalid equipment is skipped and processing continues with the next vid segment.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment is received after an HMI event code AND the disposition code is HMI
GIVEN
A VID segment is received after an HMI event code AND the disposition code is HMI
Applied to: HMI - Hold Equipment
WHEN
The system processes the HMI disposition code for equipment hold
THEN
The equipment is added to the hold list AND the held equipment counter is incremented AND the train status is set to HELD
Context: A VID segment is received after an HRE event code AND the disposition code is HRE
GIVEN
A VID segment is received after an HRE event code AND the disposition code is HRE
Applied to: HRE - Release Equipment
WHEN
The system processes the HRE disposition code for equipment release
THEN
The equipment is removed from the hold list AND the held equipment counter is decremented
Context: A VID segment contains equipment information
GIVEN
A VID segment contains equipment information
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment for equipment hold or release
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: Format Equipment ID Using GCCCARFM
WHEN
The system needs to format the equipment ID for processing
THEN
The GCCCARFM program is called to format the equipment ID
Context: An equipment ID has been formatted using GCCCARFM
GIVEN
An equipment ID has been formatted using GCCCARFM
Applied to: Equipment ID Valid?
WHEN
The system validates the equipment ID
THEN
IF the equipment ID is valid THEN continue with hold/release processing ELSE skip the invalid equipment
Context: Equipment ID is valid AND disposition code is HMI
GIVEN
Equipment ID is valid AND disposition code is HMI
Applied to: Add Equipment to Hold List
WHEN
The system processes the equipment hold request
THEN
The equipment is added to the train's equipment hold list
Context: Equipment has been added to the hold list
GIVEN
Equipment has been added to the hold list
Applied to: Increment Held Equipment Counter
WHEN
The system updates the held equipment count
THEN
The held equipment counter is incremented by one
Context: Equipment ID is valid AND disposition code is HRE
GIVEN
Equipment ID is valid AND disposition code is HRE
Applied to: Remove Equipment from Hold List
WHEN
The system processes the equipment release request
THEN
The equipment is removed from the train's equipment hold list
Context: Equipment has been removed from the hold list
GIVEN
Equipment has been removed from the hold list
Applied to: Decrement Held Equipment Counter
WHEN
The system updates the held equipment count
THEN
The held equipment counter is decremented by one
Context: The held equipment counter has been updated
GIVEN
The held equipment counter has been updated
Applied to: Any Equipment Still Held?
WHEN
The system determines the train's overall hold status
THEN
IF any equipment is still held THEN set train status to HELD ELSE set train status to RELEASED
Context: Equipment has been added to hold list OR equipment still remains on hold list after release processing
GIVEN
Equipment has been added to hold list OR equipment still remains on hold list after release processing
Applied to: Set Train Status: HELD
WHEN
The system updates the train status
THEN
The train status is set to HELD
Context: No equipment remains on the hold list after release processing
GIVEN
No equipment remains on the hold list after release processing
Applied to: Set Train Status: RELEASED
WHEN
The system updates the train status
THEN
The train status is set to RELEASED
Context: The train status has been determined as HELD or RELEASED
GIVEN
The train status has been determined as HELD or RELEASED
Applied to: Update Train Hold Status in Database
WHEN
The system updates the database
THEN
The train hold status is updated in the GCWTL-TRAIN-LIST database AND the train status database
Context: Equipment hold or release processing has been completed
GIVEN
Equipment hold or release processing has been completed
Applied to: Log Equipment Hold/Release Action
WHEN
The system logs the action
THEN
The equipment hold or release action is logged with equipment ID and action type
Context: Equipment ID validation fails
GIVEN
Equipment ID validation fails
Applied to: Skip Invalid Equipment
WHEN
The system encounters invalid equipment
THEN
The invalid equipment is skipped AND processing continues with the next VID segment
R-GCX016-cbl-02095 (+19) File: GCX016.cbl Equipment Seizure Count Management Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Seizure Count Management':
  • Context - a vid segment is received with sei disposition code:
    For VID Segment with SEI Disposition Code Received:
    When the system processes the vid segment, then the equipment id is extracted from the vid segment and seizure processing is initiated.
  • Context - a vid segment contains equipment information:
    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 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 has been validated for format:
    For Equipment ID Valid?:
    When the system checks equipment id validity, then if equipment id is valid, proceed with seizure processing, otherwise generate error for invalid equipment id.
  • Context - equipment id is valid for seizure processing:
    For Mark Equipment as Seized:
    When the system processes sei disposition code, then the equipment is marked as seized in the system.
  • Context - equipment has been marked as seized:
    For Increment Train Seized Equipment Count:
    When the system updates train seizure statistics, then the train seized equipment count is incremented by one.
  • Context - train seized equipment count has been incremented:
    For Update Train Seizure Status:
    When the system evaluates train seizure status, then the train seizure status is updated based on seized equipment count.
  • Context - train seizure status has been updated:
    For All Equipment on Train Seized?:
    When the system checks if all equipment on train is seized, then if all equipment is seized, set train to fully seized status, otherwise set to partially seized status.
  • Context - all equipment on the train has been seized:
    For Set Train Status to Fully Seized:
    When the system updates train status, then the train status is set to fully seized.
  • Context - some equipment on the train has been seized but not all equipment:
    For Set Train Status to Partially Seized:
    When the system updates train status, then the train status is set to partially seized.
  • Context - a vid segment is received with ser disposition code:
    For VID Segment with SER Disposition Code Received:
    When the system processes the vid segment, then the equipment id is extracted from the vid segment and seizure release processing is initiated.
  • Context - an equipment id has been validated for format during release processing:
    For Equipment ID Valid?:
    When the system checks equipment id validity for release, then if equipment id is valid, proceed with seizure release processing, otherwise generate error for invalid equipment id.
  • Context - equipment id is valid for seizure release processing:
    For Remove Seizure Status from Equipment:
    When the system processes ser disposition code, then the seizure status is removed from the equipment in the system.
  • Context - equipment seizure status has been removed:
    For Decrement Train Seized Equipment Count:
    When the system updates train seizure statistics, then the train seized equipment count is decremented by one.
  • Context - train seized equipment count has been decremented:
    For Update Train Seizure Status:
    When the system evaluates train seizure status, then the train seizure status is updated based on remaining seized equipment count.
  • Context - train seizure status has been updated after equipment release:
    For Any Equipment Still Seized?:
    When the system checks if any equipment on train is still seized, then if any equipment remains seized, set train to partially seized status, otherwise set to not seized status.
  • Context - no equipment on the train remains seized:
    For Set Train Status to Not Seized:
    When the system updates train status after release, then the train status is set to not seized.
  • Context - equipment has been marked as seized and train status updated:
    For Log Equipment Seizure Action:
    When the system completes seizure processing, then the equipment seizure action is logged in the system.
  • Context - equipment seizure has been released and train status updated:
    For Log Equipment Seizure Release Action:
    When the system completes seizure release processing, then the equipment seizure release action is logged in the system.
  • Context - equipment id format validation has failed:
    For Error: Invalid Equipment ID:
    When the system encounters invalid equipment id, then an error is generated for invalid equipment id and processing stops.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment is received with SEI disposition code
GIVEN
A VID segment is received with SEI disposition code
Applied to: VID Segment with SEI Disposition Code Received
WHEN
The system processes the VID segment
THEN
The equipment ID is extracted from the VID segment and seizure processing is initiated
Context: A VID segment contains equipment information
GIVEN
A VID segment contains equipment information
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: 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 has been validated for format
GIVEN
An equipment ID has been validated for format
Applied to: Equipment ID Valid?
WHEN
The system checks equipment ID validity
THEN
If equipment ID is valid, proceed with seizure processing, otherwise generate error for invalid equipment ID
Context: Equipment ID is valid for seizure processing
GIVEN
Equipment ID is valid for seizure processing
Applied to: Mark Equipment as Seized
WHEN
The system processes SEI disposition code
THEN
The equipment is marked as seized in the system
Context: Equipment has been marked as seized
GIVEN
Equipment has been marked as seized
Applied to: Increment Train Seized Equipment Count
WHEN
The system updates train seizure statistics
THEN
The train seized equipment count is incremented by one
Context: Train seized equipment count has been incremented
GIVEN
Train seized equipment count has been incremented
Applied to: Update Train Seizure Status
WHEN
The system evaluates train seizure status
THEN
The train seizure status is updated based on seized equipment count
Context: Train seizure status has been updated
GIVEN
Train seizure status has been updated
Applied to: All Equipment on Train Seized?
WHEN
The system checks if all equipment on train is seized
THEN
If all equipment is seized, set train to fully seized status, otherwise set to partially seized status
Context: All equipment on the train has been seized
GIVEN
All equipment on the train has been seized
Applied to: Set Train Status to Fully Seized
WHEN
The system updates train status
THEN
The train status is set to fully seized
Context: Some equipment on the train has been seized but not all equipment
GIVEN
Some equipment on the train has been seized but not all equipment
Applied to: Set Train Status to Partially Seized
WHEN
The system updates train status
THEN
The train status is set to partially seized
Context: A VID segment is received with SER disposition code
GIVEN
A VID segment is received with SER disposition code
Applied to: VID Segment with SER Disposition Code Received
WHEN
The system processes the VID segment
THEN
The equipment ID is extracted from the VID segment and seizure release processing is initiated
Context: An equipment ID has been validated for format during release processing
GIVEN
An equipment ID has been validated for format during release processing
Applied to: Equipment ID Valid?
WHEN
The system checks equipment ID validity for release
THEN
If equipment ID is valid, proceed with seizure release processing, otherwise generate error for invalid equipment ID
Context: Equipment ID is valid for seizure release processing
GIVEN
Equipment ID is valid for seizure release processing
Applied to: Remove Seizure Status from Equipment
WHEN
The system processes SER disposition code
THEN
The seizure status is removed from the equipment in the system
Context: Equipment seizure status has been removed
GIVEN
Equipment seizure status has been removed
Applied to: Decrement Train Seized Equipment Count
WHEN
The system updates train seizure statistics
THEN
The train seized equipment count is decremented by one
Context: Train seized equipment count has been decremented
GIVEN
Train seized equipment count has been decremented
Applied to: Update Train Seizure Status
WHEN
The system evaluates train seizure status
THEN
The train seizure status is updated based on remaining seized equipment count
Context: Train seizure status has been updated after equipment release
GIVEN
Train seizure status has been updated after equipment release
Applied to: Any Equipment Still Seized?
WHEN
The system checks if any equipment on train is still seized
THEN
If any equipment remains seized, set train to partially seized status, otherwise set to not seized status
Context: No equipment on the train remains seized
GIVEN
No equipment on the train remains seized
Applied to: Set Train Status to Not Seized
WHEN
The system updates train status after release
THEN
The train status is set to not seized
Context: Equipment has been marked as seized and train status updated
GIVEN
Equipment has been marked as seized and train status updated
Applied to: Log Equipment Seizure Action
WHEN
The system completes seizure processing
THEN
The equipment seizure action is logged in the system
Context: Equipment seizure has been released and train status updated
GIVEN
Equipment seizure has been released and train status updated
Applied to: Log Equipment Seizure Release Action
WHEN
The system completes seizure release processing
THEN
The equipment seizure release action is logged in the system
Context: Equipment ID format validation has failed
GIVEN
Equipment ID format validation has failed
Applied to: Error: Invalid Equipment ID
WHEN
The system encounters invalid equipment ID
THEN
An error is generated for invalid equipment ID and processing stops
R-GCX016-cbl-02115 (+14) File: GCX016.cbl Train Pre Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Pre':
  • Context - a train processing request is received with train information:
    For Is Train Export Manifest?:
    When the system evaluates the train type and manifest designation, then the system identifies whether the train is an export manifest train and proceeds with appropriate processing path.
  • Context - an export manifest train is being processed:
    For Is Port Configured for Export Processing?:
    When the system checks the destination port configuration in the port tables, then the system determines if the port is authorized and configured for export processing.
  • Context - an m10 segment containing train manifest information is received:
    For Validate Train Information from M10 Segment:
    When the system processes the m10 segment data, then the system validates train name, route, and other essential train information for completeness and accuracy.
  • Context - train information has been validated from the m10 segment:
    For Check Train Existence in GCWTL-TRAIN-LIST:
    When the system searches the gcwtl-train-list table using the train identifier, then the system confirms whether the train exists in the master train registry.
  • Context - the system has searched for the train in gcwtl-train-list:
    For Train Found?:
    When the search results are evaluated, then if train is found, proceed with pre-arrival processing; if not found, generate error message.
  • Context - an export manifest train has been found in the master train list:
    For Set Pre-arrival Status:
    When the system processes the train for pre-arrival, then the system sets the train status to pre-arrival state for export processing.
  • Context - a train has been assigned pre-arrival status:
    For Update Train Status to Pre-arrived:
    When the system updates the train status record, then the train status is changed to 'pre-arrived' in the train status records.
  • Context - a p4 segment containing port information is available:
    For Process Port Information from P4 Segment:
    When the system processes the p4 segment data, then the system extracts port codes, locations, and routing information for export processing.
  • Context - port information has been extracted from the p4 segment:
    For Validate Export Port Configuration:
    When the system checks the port configuration in gcstbrt port tables, then the system validates that the port is configured with proper export processing capabilities.
  • Context - port configuration has been validated against export requirements:
    For Port Valid for Export?:
    When the system evaluates the port's export processing capabilities, then if port is valid for export, continue with export pre-arrival processing; otherwise skip processing.
  • Context - a train is at a port that is valid for export processing:
    For Set Export Pre-arrival Flag:
    When the system processes the export pre-arrival requirements, then the system sets the export pre-arrival flag to indicate the train is ready for export processing.
  • Context - the export pre-arrival flag has been set for a train:
    For Log Pre-arrival Status Change:
    When the system completes the status change process, then the system creates a log entry documenting the pre-arrival status change with timestamp and train details.
  • Context - a train has been successfully set to pre-arrival status and logged:
    For Prepare for Arrival Processing:
    When the system prepares for the next processing phase, then the system sets up the train record with necessary flags and data for arrival processing.
  • Context - a train search in gcwtl-train-list returns no results:
    For Send Train Not Found Error:
    When the system processes the train not found condition, then the system generates and sends an error message indicating the train was not found in the system.
  • Context - a train is either not an export manifest train or the port is not configured for export processing:
    For Skip Pre-arrival Processing:
    When the system evaluates the processing requirements, then the system skips pre-arrival processing and proceeds to completion.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request is received with train information
GIVEN
A train processing request is received with train information
Applied to: Is Train Export Manifest?
WHEN
The system evaluates the train type and manifest designation
THEN
The system identifies whether the train is an export manifest train and proceeds with appropriate processing path
Context: An export manifest train is being processed
GIVEN
An export manifest train is being processed
Applied to: Is Port Configured for Export Processing?
WHEN
The system checks the destination port configuration in the port tables
THEN
The system determines if the port is authorized and configured for export processing
Context: An M10 segment containing train manifest information is received
GIVEN
An M10 segment containing train manifest information is received
Applied to: Validate Train Information from M10 Segment
WHEN
The system processes the M10 segment data
THEN
The system validates train name, route, and other essential train information for completeness and accuracy
Context: Train information has been validated from the M10 segment
GIVEN
Train information has been validated from the M10 segment
Applied to: Check Train Existence in GCWTL-TRAIN-LIST
WHEN
The system searches the GCWTL-TRAIN-LIST table using the train identifier
THEN
The system confirms whether the train exists in the master train registry
Context: The system has searched for the train in GCWTL-TRAIN-LIST
GIVEN
The system has searched for the train in GCWTL-TRAIN-LIST
Applied to: Train Found?
WHEN
The search results are evaluated
THEN
If train is found, proceed with pre-arrival processing; if not found, generate error message
Context: An export manifest train has been found in the master train list
GIVEN
An export manifest train has been found in the master train list
Applied to: Set Pre-arrival Status
WHEN
The system processes the train for pre-arrival
THEN
The system sets the train status to pre-arrival state for export processing
Context: A train has been assigned pre-arrival status
GIVEN
A train has been assigned pre-arrival status
Applied to: Update Train Status to Pre-arrived
WHEN
The system updates the train status record
THEN
The train status is changed to 'Pre-arrived' in the train status records
Context: A P4 segment containing port information is available
GIVEN
A P4 segment containing port information is available
Applied to: Process Port Information from P4 Segment
WHEN
The system processes the P4 segment data
THEN
The system extracts port codes, locations, and routing information for export processing
Context: Port information has been extracted from the P4 segment
GIVEN
Port information has been extracted from the P4 segment
Applied to: Validate Export Port Configuration
WHEN
The system checks the port configuration in GCSTBRT port tables
THEN
The system validates that the port is configured with proper export processing capabilities
Context: Port configuration has been validated against export requirements
GIVEN
Port configuration has been validated against export requirements
Applied to: Port Valid for Export?
WHEN
The system evaluates the port's export processing capabilities
THEN
If port is valid for export, continue with export pre-arrival processing; otherwise skip processing
Context: A train is at a port that is valid for export processing
GIVEN
A train is at a port that is valid for export processing
Applied to: Set Export Pre-arrival Flag
WHEN
The system processes the export pre-arrival requirements
THEN
The system sets the export pre-arrival flag to indicate the train is ready for export processing
Context: The export pre-arrival flag has been set for a train
GIVEN
The export pre-arrival flag has been set for a train
Applied to: Log Pre-arrival Status Change
WHEN
The system completes the status change process
THEN
The system creates a log entry documenting the pre-arrival status change with timestamp and train details
Context: A train has been successfully set to pre-arrival status and logged
GIVEN
A train has been successfully set to pre-arrival status and logged
Applied to: Prepare for Arrival Processing
WHEN
The system prepares for the next processing phase
THEN
The system sets up the train record with necessary flags and data for arrival processing
Context: A train search in GCWTL-TRAIN-LIST returns no results
GIVEN
A train search in GCWTL-TRAIN-LIST returns no results
Applied to: Send Train Not Found Error
WHEN
The system processes the train not found condition
THEN
The system generates and sends an error message indicating the train was not found in the system
Context: A train is either not an export manifest train or the port is not configured for export processing
GIVEN
A train is either not an export manifest train or the port is not configured for export processing
Applied to: Skip Pre-arrival Processing
WHEN
The system evaluates the processing requirements
THEN
The system skips pre-arrival processing and proceeds to completion
R-GCX016-cbl-02130 (+7) File: GCX016.cbl Export Manifest Port Validation Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Manifest Port Validation':
  • Context - a train arrival event has been received with m10 manifest segment data:
    For Extract Train Arrival Port from M10 Segment:
    When the system processes the m10 segment to extract port information, then the train arrival port code is extracted and made available for port configuration lookup.
  • Context - a train arrival port code has been extracted from the m10 segment:
    For Lookup Port Configuration in System Tables:
    When the system looks up the port configuration in gcstbrt port configuration tables, then the port configuration settings are retrieved and made available for export processing determination.
  • Context - port configuration settings have been retrieved from system tables:
    For Is Port Configured for Export Manifest Processing?:
    When the system evaluates the port configuration for export manifest processing capability, then the system determines if the port is configured for export manifest processing (yes) or standard import processing (no).
  • Context - the port is determined to be configured for export manifest processing:
    For Set Export Manifest Processing Flag:
    When the system processes an export-enabled port, then the export manifest processing flag is set to enable export-specific business rules.
  • Context - the export manifest processing flag has been set for an export-configured port:
    For Apply Export Manifest Business Rules:
    When the system applies export manifest business rules, then export-specific processing logic is executed including special validation and status handling.
  • Context - export manifest business rules have been applied for an export-configured port:
    For Set Pre-arrival Status for Export Trains:
    When the system sets the train status for export processing, then the train is assigned pre-arrival status appropriate for export manifest processing.
  • Context - the port is determined to not be configured for export manifest processing:
    For Continue with Standard Import Processing:
    When the system processes a standard import port, then standard import processing logic is applied without export-specific rules.
  • Context - the port configuration decision has been made (either export or import processing):
    For Log Port Configuration Decision:
    When the system completes the port configuration evaluation, then the port configuration decision is logged with relevant port and processing type information.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival event has been received with M10 manifest segment data
GIVEN
A train arrival event has been received with M10 manifest segment data
Applied to: Extract Train Arrival Port from M10 Segment
WHEN
The system processes the M10 segment to extract port information
THEN
The train arrival port code is extracted and made available for port configuration lookup
Context: A train arrival port code has been extracted from the M10 segment
GIVEN
A train arrival port code has been extracted from the M10 segment
Applied to: Lookup Port Configuration in System Tables
WHEN
The system looks up the port configuration in GCSTBRT port configuration tables
THEN
The port configuration settings are retrieved and made available for export processing determination
Context: Port configuration settings have been retrieved from system tables
GIVEN
Port configuration settings have been retrieved from system tables
Applied to: Is Port Configured for Export Manifest Processing?
WHEN
The system evaluates the port configuration for export manifest processing capability
THEN
The system determines if the port is configured for export manifest processing (Yes) or standard import processing (No)
Context: The port is determined to be configured for export manifest processing
GIVEN
The port is determined to be configured for export manifest processing
Applied to: Set Export Manifest Processing Flag
WHEN
The system processes an export-enabled port
THEN
The export manifest processing flag is set to enable export-specific business rules
Context: The export manifest processing flag has been set for an export-configured port
GIVEN
The export manifest processing flag has been set for an export-configured port
Applied to: Apply Export Manifest Business Rules
WHEN
The system applies export manifest business rules
THEN
Export-specific processing logic is executed including special validation and status handling
Context: Export manifest business rules have been applied for an export-configured port
GIVEN
Export manifest business rules have been applied for an export-configured port
Applied to: Set Pre-arrival Status for Export Trains
WHEN
The system sets the train status for export processing
THEN
The train is assigned pre-arrival status appropriate for export manifest processing
Context: The port is determined to not be configured for export manifest processing
GIVEN
The port is determined to not be configured for export manifest processing
Applied to: Continue with Standard Import Processing
WHEN
The system processes a standard import port
THEN
Standard import processing logic is applied without export-specific rules
Context: The port configuration decision has been made (either export or import processing)
GIVEN
The port configuration decision has been made (either export or import processing)
Applied to: Log Port Configuration Decision
WHEN
The system completes the port configuration evaluation
THEN
The port configuration decision is logged with relevant port and processing type information
R-GCX016-cbl-02138 (+12) File: GCX016.cbl Import Manifest Train Arrival Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Import Manifest Train Arrival':
  • Context - a v9 segment is received with pod or aad disposition code for train arrival:
    For Validate Train Exists in System:
    When the system validates the train name against the train list, then if train is not found in gcwtl-train-list, generate train not found error and route to operations.
  • Context - train information has been successfully retrieved from the system:
    For Is Import Manifest?:
    When the system checks the manifest type, then if manifest is import type, continue with import arrival processing, otherwise skip arrival processing.
  • Context - an import manifest requires arrival processing:
    For Port Configured for Import Manifests?:
    When the system checks port configuration for import processing capability, then if port is not configured for import manifests, generate port configuration error and route to system administrator.
  • Context - train exists in system and port is configured for import processing:
    For Update Train Status to Arrived:
    When the arrival processing begins, then update the train status to arrived in the system.
  • Context - train status has been updated to arrived:
    For Set Train Arrival Date and Time:
    When the system processes the arrival timestamp, then set the train arrival date and time from the v9 segment or system timestamp.
  • Context - equipment on the arriving train has existing hold status:
    For Maintain Equipment Hold Status:
    When the system processes equipment during train arrival, then maintain the existing equipment hold status and do not automatically release holds.
  • Context - train arrival status has been updated and auto-unlock is configured:
    For Remove Train Lock Status:
    When the system evaluates auto-unlock requirements, then remove the train lock status to allow normal operations.
  • Context - train arrival processing is complete and train lock has been removed if required:
    For Generate AEI Arrival Notification:
    When the system prepares external notifications, then generate aei arrival notification message for transmission to external systems.
  • Context - aei arrival notification has been generated:
    For Update Cargo Arrival Status for All Cargo on Train:
    When the system processes cargo on the train, then update the arrival status for all cargo records associated with the train.
  • Context - cargo arrival status has been updated for all cargo on train:
    For Set Border Arrival Date for In-Bond Cargo:
    When the system identifies in-bond cargo on the train, then set the border arrival date for all in-bond cargo to the train arrival date.
  • Context - border arrival date has been set for in-bond cargo:
    For Update Destination Arrival for Final Destination Cargo:
    When the system identifies cargo at final destination on the train, then update the destination arrival status for cargo reaching final destination.
  • Context - all cargo arrival statuses have been updated:
    For Log Train Arrival Transaction:
    When the system completes arrival processing, then log the train arrival transaction with all relevant details for audit trail.
  • Context - train arrival transaction has been logged:
    For Send Arrival Confirmation Message:
    When the system prepares confirmation notifications, then send arrival confirmation message to appropriate stakeholders and systems.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 segment is received with POD or AAD disposition code for train arrival
GIVEN
A V9 segment is received with POD or AAD disposition code for train arrival
Applied to: Validate Train Exists in System
WHEN
The system validates the train name against the train list
THEN
If train is not found in GCWTL-TRAIN-LIST, generate train not found error and route to operations
Context: Train information has been successfully retrieved from the system
GIVEN
Train information has been successfully retrieved from the system
Applied to: Is Import Manifest?
WHEN
The system checks the manifest type
THEN
If manifest is import type, continue with import arrival processing, otherwise skip arrival processing
Context: An import manifest requires arrival processing
GIVEN
An import manifest requires arrival processing
Applied to: Port Configured for Import Manifests?
WHEN
The system checks port configuration for import processing capability
THEN
If port is not configured for import manifests, generate port configuration error and route to system administrator
Context: Train exists in system and port is configured for import processing
GIVEN
Train exists in system and port is configured for import processing
Applied to: Update Train Status to Arrived
WHEN
The arrival processing begins
THEN
Update the train status to arrived in the system
Context: Train status has been updated to arrived
GIVEN
Train status has been updated to arrived
Applied to: Set Train Arrival Date and Time
WHEN
The system processes the arrival timestamp
THEN
Set the train arrival date and time from the V9 segment or system timestamp
Context: Equipment on the arriving train has existing hold status
GIVEN
Equipment on the arriving train has existing hold status
Applied to: Maintain Equipment Hold Status
WHEN
The system processes equipment during train arrival
THEN
Maintain the existing equipment hold status and do not automatically release holds
Context: Train arrival status has been updated and auto-unlock is configured
GIVEN
Train arrival status has been updated and auto-unlock is configured
Applied to: Remove Train Lock Status
WHEN
The system evaluates auto-unlock requirements
THEN
Remove the train lock status to allow normal operations
Context: Train arrival processing is complete and train lock has been removed if required
GIVEN
Train arrival processing is complete and train lock has been removed if required
Applied to: Generate AEI Arrival Notification
WHEN
The system prepares external notifications
THEN
Generate AEI arrival notification message for transmission to external systems
Context: AEI arrival notification has been generated
GIVEN
AEI arrival notification has been generated
Applied to: Update Cargo Arrival Status for All Cargo on Train
WHEN
The system processes cargo on the train
THEN
Update the arrival status for all cargo records associated with the train
Context: Cargo arrival status has been updated for all cargo on train
GIVEN
Cargo arrival status has been updated for all cargo on train
Applied to: Set Border Arrival Date for In-Bond Cargo
WHEN
The system identifies in-bond cargo on the train
THEN
Set the border arrival date for all in-bond cargo to the train arrival date
Context: Border arrival date has been set for in-bond cargo
GIVEN
Border arrival date has been set for in-bond cargo
Applied to: Update Destination Arrival for Final Destination Cargo
WHEN
The system identifies cargo at final destination on the train
THEN
Update the destination arrival status for cargo reaching final destination
Context: All cargo arrival statuses have been updated
GIVEN
All cargo arrival statuses have been updated
Applied to: Log Train Arrival Transaction
WHEN
The system completes arrival processing
THEN
Log the train arrival transaction with all relevant details for audit trail
Context: Train arrival transaction has been logged
GIVEN
Train arrival transaction has been logged
Applied to: Send Arrival Confirmation Message
WHEN
The system prepares confirmation notifications
THEN
Send arrival confirmation message to appropriate stakeholders and systems
R-GCX016-cbl-02151 (+8) File: GCX016.cbl AEI Train Arrival Notification Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AEI Train Arrival Notification':
  • Context - a v9 event segment is received for train arrival processing:
    For Disposition Code?:
    When the system evaluates the disposition code in the v9 segment, then the system identifies pod (port of discharge) or aad (arrived at destination) codes as valid train arrival events and routes to appropriate processing.
  • Context - a train arrival event (pod or aad) is being processed:
    For Train Found?:
    When the system validates the train name against the train list database, then if the train exists, proceed with equipment processing; if not found, generate train not found error and terminate aei processing.
    For Send Train Not Found Error:
    When the train validation fails because the train is not found in the train list database, then the system generates a train not found error message and terminates aei processing for this arrival event.
  • Context - a valid train has been confirmed as arrived (pod or aad):
    For Get Train Equipment List:
    When the system processes the train for aei notification generation, then the system retrieves the complete equipment list associated with the train from the equipment records database.
  • Context - a train's equipment list has been retrieved and train arrival is confirmed:
    For Generate AEI Equipment Notification:
    When the system processes each individual equipment/car on the train, then the system generates an aei notification including car id, equipment details, arrival date and time for each piece of equipment.
  • Context - aei notifications have been generated for all equipment on the train:
    For Update Train Status to Arrived:
    When the system completes individual equipment notification processing, then the system updates the train status to 'arrived' with the corresponding arrival date and time.
  • Context - aei notifications have been generated with complete equipment details and arrival information:
    For Send AEI Notification to Systems:
    When the system is ready to distribute the notifications, then the system sends the aei notifications to designated external aei systems for equipment tracking and monitoring.
  • Context - aei notifications have been successfully transmitted to external systems:
    For Log AEI Notification Activity:
    When the system completes the notification transmission process, then the system logs the aei notification activity including train id, equipment details, notification timestamp, and transmission status.
  • Context - the system is processing equipment on an arrived train for aei notifications:
    For More Equipment?:
    When the system completes processing for one piece of equipment, then if more equipment exists on the train, continue processing the next equipment; if no more equipment, complete the aei train arrival process.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 event segment is received for train arrival processing
GIVEN
A V9 event segment is received for train arrival processing
Applied to: Disposition Code?
WHEN
The system evaluates the disposition code in the V9 segment
THEN
The system identifies POD (Port of Discharge) or AAD (Arrived at Destination) codes as valid train arrival events and routes to appropriate processing
Context: A train arrival event (POD or AAD) is being processed
GIVEN
A train arrival event (POD or AAD) is being processed
Applied to: Train Found?
WHEN
The system validates the train name against the train list database
THEN
If the train exists, proceed with equipment processing; if not found, generate train not found error and terminate AEI processing
Applied to: Send Train Not Found Error
WHEN
The train validation fails because the train is not found in the train list database
THEN
The system generates a train not found error message and terminates AEI processing for this arrival event
Context: A valid train has been confirmed as arrived (POD or AAD)
GIVEN
A valid train has been confirmed as arrived (POD or AAD)
Applied to: Get Train Equipment List
WHEN
The system processes the train for AEI notification generation
THEN
The system retrieves the complete equipment list associated with the train from the equipment records database
Context: A train's equipment list has been retrieved and train arrival is confirmed
GIVEN
A train's equipment list has been retrieved and train arrival is confirmed
Applied to: Generate AEI Equipment Notification
WHEN
The system processes each individual equipment/car on the train
THEN
The system generates an AEI notification including car ID, equipment details, arrival date and time for each piece of equipment
Context: AEI notifications have been generated for all equipment on the train
GIVEN
AEI notifications have been generated for all equipment on the train
Applied to: Update Train Status to Arrived
WHEN
The system completes individual equipment notification processing
THEN
The system updates the train status to 'Arrived' with the corresponding arrival date and time
Context: AEI notifications have been generated with complete equipment details and arrival information
GIVEN
AEI notifications have been generated with complete equipment details and arrival information
Applied to: Send AEI Notification to Systems
WHEN
The system is ready to distribute the notifications
THEN
The system sends the AEI notifications to designated external AEI systems for equipment tracking and monitoring
Context: AEI notifications have been successfully transmitted to external systems
GIVEN
AEI notifications have been successfully transmitted to external systems
Applied to: Log AEI Notification Activity
WHEN
The system completes the notification transmission process
THEN
The system logs the AEI notification activity including train ID, equipment details, notification timestamp, and transmission status
Context: The system is processing equipment on an arrived train for AEI notifications
GIVEN
The system is processing equipment on an arrived train for AEI notifications
Applied to: More Equipment?
WHEN
The system completes processing for one piece of equipment
THEN
If more equipment exists on the train, continue processing the next equipment; if no more equipment, complete the AEI train arrival process
R-GCX016-cbl-02160 (+14) File: GCX016.cbl Train Unlock on Arrival Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Unlock on Arrival':
  • Context - a v9 event segment is received in the message queue:
    For Train Arrival Event Detected:
    When the system processes the v9 segment for event details, then the train arrival event is identified and flagged for processing.
  • Context - a v9 event segment contains a disposition code:
    For Check Disposition Code:
    When the disposition code is evaluated for arrival processing, then the system determines if it is pod (proof of delivery) or aad (arrival at destination) event.
  • Context - a v9 segment has disposition code 'pod':
    For POD - Proof of Delivery:
    When the pod event is processed, then the system initiates train arrival processing workflow.
  • Context - a v9 segment has disposition code 'aad':
    For AAD - Arrival at Destination:
    When the aad event is processed, then the system initiates train arrival processing workflow.
  • Context - a train arrival event is being processed with a vessel name:
    For Validate Train Exists in System:
    When the system validates the train existence, then the system checks the train list to confirm the train is registered in the system.
  • Context - train existence validation has been performed:
    For Train Found?:
    When the validation result is evaluated, then if train is found, proceed with arrival processing; if not found, generate error.
  • Context - a valid train has been found in the system for arrival processing:
    For Update Train Status to Arrived:
    When the train status is updated, then the train status is set to 'arrived' and arrival timestamp is recorded.
  • Context - a train has arrived and status has been updated to arrived:
    For Check Current Train Lock Status:
    When the system checks the current lock status of the train, then the system retrieves the current lock status from train records.
  • Context - train lock status has been retrieved:
    For Train Currently Locked?:
    When the lock status is evaluated, then if train is locked, proceed with automatic unlock; if not locked, skip unlock process.
  • Context - a train has arrived at destination and is currently in locked status:
    For Automatically Unlock Train:
    When the automatic unlock process is triggered, then the system removes the lock restriction from the train.
  • Context - a train has been automatically unlocked upon arrival:
    For Update Train Lock Status to Unlocked:
    When the lock status is updated in the system, then the train lock status is set to 'unlocked' and timestamp is recorded.
    For Log Train Unlock Action:
    When the unlock action is logged, then the system records the unlock event with timestamp, train id, and reason code.
  • Context - a train has successfully arrived and any required unlock processing is complete:
    For Send Arrival Notification:
    When arrival notifications are sent, then the system sends arrival messages to relevant stakeholders and systems.
  • Context - a train arrival event references a train that does not exist in the system:
    For Generate Train Not Found Error:
    When train validation fails, then the system generates a 'train not found' error with relevant train identifier.
  • Context - a train not found error has been generated:
    For Send Error Notification:
    When error notifications are sent, then the system sends error messages to relevant stakeholders with details about the failed train lookup.
👨‍💻 Technical ACs (Gherkin)
Context: A V9 event segment is received in the message queue
GIVEN
A V9 event segment is received in the message queue
Applied to: Train Arrival Event Detected
WHEN
The system processes the V9 segment for event details
THEN
The train arrival event is identified and flagged for processing
Context: A V9 event segment contains a disposition code
GIVEN
A V9 event segment contains a disposition code
Applied to: Check Disposition Code
WHEN
The disposition code is evaluated for arrival processing
THEN
The system determines if it is POD (Proof of Delivery) or AAD (Arrival at Destination) event
Context: A V9 segment has disposition code 'POD'
GIVEN
A V9 segment has disposition code 'POD'
Applied to: POD - Proof of Delivery
WHEN
The POD event is processed
THEN
The system initiates train arrival processing workflow
Context: A V9 segment has disposition code 'AAD'
GIVEN
A V9 segment has disposition code 'AAD'
Applied to: AAD - Arrival at Destination
WHEN
The AAD event is processed
THEN
The system initiates train arrival processing workflow
Context: A train arrival event is being processed with a vessel name
GIVEN
A train arrival event is being processed with a vessel name
Applied to: Validate Train Exists in System
WHEN
The system validates the train existence
THEN
The system checks the train list to confirm the train is registered in the system
Context: Train existence validation has been performed
GIVEN
Train existence validation has been performed
Applied to: Train Found?
WHEN
The validation result is evaluated
THEN
If train is found, proceed with arrival processing; if not found, generate error
Context: A valid train has been found in the system for arrival processing
GIVEN
A valid train has been found in the system for arrival processing
Applied to: Update Train Status to Arrived
WHEN
The train status is updated
THEN
The train status is set to 'Arrived' and arrival timestamp is recorded
Context: A train has arrived and status has been updated to arrived
GIVEN
A train has arrived and status has been updated to arrived
Applied to: Check Current Train Lock Status
WHEN
The system checks the current lock status of the train
THEN
The system retrieves the current lock status from train records
Context: Train lock status has been retrieved
GIVEN
Train lock status has been retrieved
Applied to: Train Currently Locked?
WHEN
The lock status is evaluated
THEN
If train is locked, proceed with automatic unlock; if not locked, skip unlock process
Context: A train has arrived at destination and is currently in locked status
GIVEN
A train has arrived at destination and is currently in locked status
Applied to: Automatically Unlock Train
WHEN
The automatic unlock process is triggered
THEN
The system removes the lock restriction from the train
Context: A train has been automatically unlocked upon arrival
GIVEN
A train has been automatically unlocked upon arrival
Applied to: Update Train Lock Status to Unlocked
WHEN
The lock status is updated in the system
THEN
The train lock status is set to 'Unlocked' and timestamp is recorded
Applied to: Log Train Unlock Action
WHEN
The unlock action is logged
THEN
The system records the unlock event with timestamp, train ID, and reason code
Context: A train has successfully arrived and any required unlock processing is complete
GIVEN
A train has successfully arrived and any required unlock processing is complete
Applied to: Send Arrival Notification
WHEN
Arrival notifications are sent
THEN
The system sends arrival messages to relevant stakeholders and systems
Context: A train arrival event references a train that does not exist in the system
GIVEN
A train arrival event references a train that does not exist in the system
Applied to: Generate Train Not Found Error
WHEN
Train validation fails
THEN
The system generates a 'Train Not Found' error with relevant train identifier
Context: A train not found error has been generated
GIVEN
A train not found error has been generated
Applied to: Send Error Notification
WHEN
Error notifications are sent
THEN
The system sends error messages to relevant stakeholders with details about the failed train lookup
R-GCX016-cbl-02175 (+6) File: GCX016.cbl KCSM Disposition Code Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Disposition Code Processing':
  • Context - an x4 segment with disposition code is received:
    For Is Port = Laredo?:
    When the system checks the port location in the message, then if port equals 'laredo', proceed to kcsm disposition code lookup, otherwise skip kcsm processing.
  • Context - port location is laredo and disposition code is present:
    For BBFA0: Search AECWRKTB Table:
    When system searches aecwrktb table for the disposition code, then return found or not found status for the disposition code in kcsm table.
  • Context - aecwrktb table lookup has been performed for the disposition code:
    For Disposition Code Found in KCSM Table?:
    When the disposition code lookup result is evaluated, then if disposition code is found in kcsm table, proceed to create transmission file, otherwise skip kcsm processing.
  • Context - disposition code is found in kcsm table and requires kcsm processing:
    For BBFB0: Copy EDI 350 to Transmission File:
    When system initiates transmission file creation process, then copy the complete edi 350 message content to the transmission file.
  • Context - edi 350 message has been copied to transmission file:
    For Create Transmission Root Segment A9RT:
    When system creates transmission control structures, then generate a9rt transmission root segment with appropriate control information.
  • Context - a9rt transmission root segment has been created:
    For Create Transmission Dependent Segment A9DP:
    When system creates dependent transmission segments, then generate a9dp transmission dependent segment with edi message content.
  • Context - transmission segments a9rt and a9dp have been successfully created:
    For Set KCSM Processing Flag:
    When system completes kcsm transmission file preparation, then set kcsm processing flag to indicate successful kcsm integration completion.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment with disposition code is received
GIVEN
An X4 segment with disposition code is received
Applied to: Is Port = Laredo?
WHEN
The system checks the port location in the message
THEN
If port equals 'Laredo', proceed to KCSM disposition code lookup, otherwise skip KCSM processing
Context: Port location is Laredo and disposition code is present
GIVEN
Port location is Laredo and disposition code is present
Applied to: BBFA0: Search AECWRKTB Table
WHEN
System searches AECWRKTB table for the disposition code
THEN
Return found or not found status for the disposition code in KCSM table
Context: AECWRKTB table lookup has been performed for the disposition code
GIVEN
AECWRKTB table lookup has been performed for the disposition code
Applied to: Disposition Code Found in KCSM Table?
WHEN
The disposition code lookup result is evaluated
THEN
If disposition code is found in KCSM table, proceed to create transmission file, otherwise skip KCSM processing
Context: Disposition code is found in KCSM table and requires KCSM processing
GIVEN
Disposition code is found in KCSM table and requires KCSM processing
Applied to: BBFB0: Copy EDI 350 to Transmission File
WHEN
System initiates transmission file creation process
THEN
Copy the complete EDI 350 message content to the transmission file
Context: EDI 350 message has been copied to transmission file
GIVEN
EDI 350 message has been copied to transmission file
Applied to: Create Transmission Root Segment A9RT
WHEN
System creates transmission control structures
THEN
Generate A9RT transmission root segment with appropriate control information
Context: A9RT transmission root segment has been created
GIVEN
A9RT transmission root segment has been created
Applied to: Create Transmission Dependent Segment A9DP
WHEN
System creates dependent transmission segments
THEN
Generate A9DP transmission dependent segment with EDI message content
Context: Transmission segments A9RT and A9DP have been successfully created
GIVEN
Transmission segments A9RT and A9DP have been successfully created
Applied to: Set KCSM Processing Flag
WHEN
System completes KCSM transmission file preparation
THEN
Set KCSM processing flag to indicate successful KCSM integration completion
R-GCX016-cbl-02182 (+19) File: GCX016.cbl EDI 350 Message Copying for KCSM Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI 350 Message Copying for KCSM':
  • Context - an edi 350 message with a disposition code is received for processing:
    For Check Disposition Code for KCSM Processing:
    When the system checks if the disposition code requires kcsm transmission, then the system validates the disposition code against the kcsm configuration table to determine processing requirements.
  • Context - a disposition code needs to be validated for kcsm processing:
    For Validate Disposition Code in KCSM Table:
    When the system performs a lookup in the aecwrktb kcsm configuration table, then the system determines if the disposition code is configured for kcsm transmission.
  • Context - the disposition code has been validated against the kcsm configuration table:
    For Code Configured for KCSM?:
    When the system evaluates if the code is configured for kcsm processing, then if configured, proceed with kcsm message copying; if not configured, skip kcsm processing.
  • Context - the disposition code is not configured for kcsm processing in the configuration table:
    For Skip KCSM Processing:
    When the system determines kcsm processing is not required, then the system skips all kcsm message copying activities and continues with normal processing.
  • Context - the disposition code is configured for kcsm processing:
    For Initialize EDI Message Copy Process:
    When the system begins the kcsm message copying process, then the system initializes all necessary structures and variables for edi message duplication.
  • Context - the kcsm message copy process has been initialized:
    For Copy Original EDI 350 Message Structure:
    When the system begins copying the original edi 350 message, then the system creates an exact structural copy of the original message for kcsm processing.
  • Context - the edi message structure has been copied:
    For Create Transmission Root Segment:
    When the system creates the transmission control structure, then the system generates a transmission root segment using a9rt data for kcsm message identification and control.
  • Context - the transmission root segment has been created:
    For Create Transmission Dependent Segments:
    When the system creates dependent transmission segments, then the system generates transmission dependent segments using a9dp data for proper kcsm message structure.
  • Context - the transmission segments have been created:
    For Copy ST Transaction Header:
    When the system copies edi transaction segments, then the system copies the st transaction header segment maintaining all original data for kcsm transmission.
  • Context - the st transaction header has been copied:
    For Copy M10 Manifest Information:
    When the system copies manifest data segments, then the system copies the m10 manifest information segment preserving all manifest details for kcsm transmission.
  • Context - the m10 manifest information has been copied:
    For Copy P4 Port Information:
    When the system copies port data segments, then the system copies the p4 port information segment maintaining all port details for kcsm transmission.
  • Context - the p4 port information has been copied:
    For Copy V9 Event Details:
    When the system copies event data segments, then the system copies the v9 event details segment preserving all event information for kcsm transmission.
  • Context - the v9 event details have been copied:
    For Copy X4 Customs Release Information:
    When the system copies customs release data segments, then the system copies the x4 customs release information segment maintaining all customs data for kcsm transmission.
  • Context - the x4 customs release information has been copied:
    For Copy N7 Equipment Details:
    When the system copies equipment data segments, then the system copies the n7 equipment details segment preserving all equipment information for kcsm transmission.
  • Context - the n7 equipment details have been copied:
    For Copy K1 Remarks:
    When the system copies remarks data segments, then the system copies the k1 remarks segment maintaining all remark information for kcsm transmission.
  • Context - the k1 remarks have been copied:
    For Copy SE Transaction Trailer:
    When the system copies transaction trailer segments, then the system copies the se transaction trailer segment completing the edi message structure for kcsm transmission.
  • Context - all edi segments have been copied to the kcsm message structure:
    For Format Message for KCSM Transmission:
    When the system formats the message for kcsm transmission, then the system applies kcsm-specific formatting rules and transmission standards to the copied message.
  • Context - the edi message has been formatted for kcsm transmission:
    For Queue Message for KCSM System:
    When the system queues the message for kcsm delivery, then the system places the formatted message in the kcsm transmission queue for delivery to the kcsm system.
  • Context - the message has been queued for kcsm transmission:
    For Log KCSM Transmission Details:
    When the system logs the transmission activity, then the system records kcsm transmission details including message identification, timestamp, and disposition code for audit tracking.
  • Context - the kcsm transmission has been logged:
    For Complete KCSM Message Copy:
    When the system completes the kcsm message copying process, then the system finalizes all kcsm processing activities and returns control to the main edi 350 message processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message with a disposition code is received for processing
GIVEN
An EDI 350 message with a disposition code is received for processing
Applied to: Check Disposition Code for KCSM Processing
WHEN
The system checks if the disposition code requires KCSM transmission
THEN
The system validates the disposition code against the KCSM configuration table to determine processing requirements
Context: A disposition code needs to be validated for KCSM processing
GIVEN
A disposition code needs to be validated for KCSM processing
Applied to: Validate Disposition Code in KCSM Table
WHEN
The system performs a lookup in the AECWRKTB KCSM configuration table
THEN
The system determines if the disposition code is configured for KCSM transmission
Context: The disposition code has been validated against the KCSM configuration table
GIVEN
The disposition code has been validated against the KCSM configuration table
Applied to: Code Configured for KCSM?
WHEN
The system evaluates if the code is configured for KCSM processing
THEN
If configured, proceed with KCSM message copying; if not configured, skip KCSM processing
Context: The disposition code is not configured for KCSM processing in the configuration table
GIVEN
The disposition code is not configured for KCSM processing in the configuration table
Applied to: Skip KCSM Processing
WHEN
The system determines KCSM processing is not required
THEN
The system skips all KCSM message copying activities and continues with normal processing
Context: The disposition code is configured for KCSM processing
GIVEN
The disposition code is configured for KCSM processing
Applied to: Initialize EDI Message Copy Process
WHEN
The system begins the KCSM message copying process
THEN
The system initializes all necessary structures and variables for EDI message duplication
Context: The KCSM message copy process has been initialized
GIVEN
The KCSM message copy process has been initialized
Applied to: Copy Original EDI 350 Message Structure
WHEN
The system begins copying the original EDI 350 message
THEN
The system creates an exact structural copy of the original message for KCSM processing
Context: The EDI message structure has been copied
GIVEN
The EDI message structure has been copied
Applied to: Create Transmission Root Segment
WHEN
The system creates the transmission control structure
THEN
The system generates a transmission root segment using A9RT data for KCSM message identification and control
Context: The transmission root segment has been created
GIVEN
The transmission root segment has been created
Applied to: Create Transmission Dependent Segments
WHEN
The system creates dependent transmission segments
THEN
The system generates transmission dependent segments using A9DP data for proper KCSM message structure
Context: The transmission segments have been created
GIVEN
The transmission segments have been created
Applied to: Copy ST Transaction Header
WHEN
The system copies EDI transaction segments
THEN
The system copies the ST transaction header segment maintaining all original data for KCSM transmission
Context: The ST transaction header has been copied
GIVEN
The ST transaction header has been copied
Applied to: Copy M10 Manifest Information
WHEN
The system copies manifest data segments
THEN
The system copies the M10 manifest information segment preserving all manifest details for KCSM transmission
Context: The M10 manifest information has been copied
GIVEN
The M10 manifest information has been copied
Applied to: Copy P4 Port Information
WHEN
The system copies port data segments
THEN
The system copies the P4 port information segment maintaining all port details for KCSM transmission
Context: The P4 port information has been copied
GIVEN
The P4 port information has been copied
Applied to: Copy V9 Event Details
WHEN
The system copies event data segments
THEN
The system copies the V9 event details segment preserving all event information for KCSM transmission
Context: The V9 event details have been copied
GIVEN
The V9 event details have been copied
Applied to: Copy X4 Customs Release Information
WHEN
The system copies customs release data segments
THEN
The system copies the X4 customs release information segment maintaining all customs data for KCSM transmission
Context: The X4 customs release information has been copied
GIVEN
The X4 customs release information has been copied
Applied to: Copy N7 Equipment Details
WHEN
The system copies equipment data segments
THEN
The system copies the N7 equipment details segment preserving all equipment information for KCSM transmission
Context: The N7 equipment details have been copied
GIVEN
The N7 equipment details have been copied
Applied to: Copy K1 Remarks
WHEN
The system copies remarks data segments
THEN
The system copies the K1 remarks segment maintaining all remark information for KCSM transmission
Context: The K1 remarks have been copied
GIVEN
The K1 remarks have been copied
Applied to: Copy SE Transaction Trailer
WHEN
The system copies transaction trailer segments
THEN
The system copies the SE transaction trailer segment completing the EDI message structure for KCSM transmission
Context: All EDI segments have been copied to the KCSM message structure
GIVEN
All EDI segments have been copied to the KCSM message structure
Applied to: Format Message for KCSM Transmission
WHEN
The system formats the message for KCSM transmission
THEN
The system applies KCSM-specific formatting rules and transmission standards to the copied message
Context: The EDI message has been formatted for KCSM transmission
GIVEN
The EDI message has been formatted for KCSM transmission
Applied to: Queue Message for KCSM System
WHEN
The system queues the message for KCSM delivery
THEN
The system places the formatted message in the KCSM transmission queue for delivery to the KCSM system
Context: The message has been queued for KCSM transmission
GIVEN
The message has been queued for KCSM transmission
Applied to: Log KCSM Transmission Details
WHEN
The system logs the transmission activity
THEN
The system records KCSM transmission details including message identification, timestamp, and disposition code for audit tracking
Context: The KCSM transmission has been logged
GIVEN
The KCSM transmission has been logged
Applied to: Complete KCSM Message Copy
WHEN
The system completes the KCSM message copying process
THEN
The system finalizes all KCSM processing activities and returns control to the main EDI 350 message processing workflow
R-GCX016-cbl-02202 (+3) File: GCX016.cbl KCSM Disposition Code Database Lookup Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Disposition Code Database Lookup':
  • Context - an x4 segment contains a disposition code and port information:
    For Search database for disposition codes configured for KCSM processing:
    When the port is laredo and the disposition code exists in the aecwrktb database table, then set kcsm processing flag to yes and continue with edi message processing.
  • Context - an x4 segment contains port information:
    For Check if Port is Laredo:
    When the port is not laredo, then set kcsm processing flag to no and continue with edi message processing.
  • Context - the port is laredo and a disposition code from x4 segment:
    For Look for Disposition Code Match:
    When the disposition code is not found in the aecwrktb database table, then set kcsm processing flag to no and continue with edi message processing.
  • Context - the port is laredo and a disposition code needs validation:
    For Search AECWRKTB Database Table:
    When system searches the aecwrktb database table for the disposition code, then return found or not found status for the disposition code lookup.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment contains a disposition code and port information
GIVEN
An X4 segment contains a disposition code and port information
Applied to: Search database for disposition codes configured for KCSM processing
WHEN
The port is Laredo AND the disposition code exists in the AECWRKTB database table
THEN
Set KCSM processing flag to Yes and continue with EDI message processing
Context: An X4 segment contains port information
GIVEN
An X4 segment contains port information
Applied to: Check if Port is Laredo
WHEN
The port is not Laredo
THEN
Set KCSM processing flag to No and continue with EDI message processing
Context: The port is Laredo AND a disposition code from X4 segment
GIVEN
The port is Laredo AND a disposition code from X4 segment
Applied to: Look for Disposition Code Match
WHEN
The disposition code is not found in the AECWRKTB database table
THEN
Set KCSM processing flag to No and continue with EDI message processing
Context: The port is Laredo AND a disposition code needs validation
GIVEN
The port is Laredo AND a disposition code needs validation
Applied to: Search AECWRKTB Database Table
WHEN
System searches the AECWRKTB database table for the disposition code
THEN
Return found or not found status for the disposition code lookup
R-GCX016-cbl-02206 (+15) File: GCX016.cbl KCSM Transmission File Creation Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Transmission File Creation':
  • Context - a disposition code is being processed for customs release:
    For Disposition Code Requires KCSM?:
    When the system evaluates the disposition code configuration, then the system determines whether kcsm transmission processing is required for this disposition code.
  • Context - a disposition code needs to be processed:
    For Retrieve Disposition Code from DC Table:
    When the system looks up the disposition code in the dc table, then the system retrieves disposition code details including kcsm processing requirements and merlin message configuration.
  • Context - a disposition code requires kcsm processing:
    For Check KCSM Configuration at Laredo Port:
    When the system checks the port configuration for kcsm integration, then the system validates that kcsm processing is enabled and configured for the laredo port.
  • Context - disposition code and port configuration have been validated:
    For KCSM Processing Required?:
    When the system evaluates all kcsm processing requirements, then the system decides whether to proceed with kcsm transmission file creation or skip processing.
  • Context - kcsm processing is required for the disposition code:
    For Create Transmission Root Segment A9RT:
    When the system creates the transmission file structure, then the system creates an a9rt root segment with transmission control information and unique identifiers.
  • Context - a transmission root segment a9rt has been created:
    For Set Transmission Control Information:
    When the system sets up transmission control parameters, then the system assigns transmission sequence numbers, control codes, and identification information for kcsm processing.
  • Context - transmission control information has been established:
    For Initialize Transmission Parameters:
    When the system initializes transmission parameters, then the system sets up edi message parameters, transmission dates, and processing configuration for kcsm integration.
  • Context - transmission parameters have been initialized:
    For Copy EDI 350 Message Segments:
    When the system processes the original edi 350 message, then the system copies relevant message segments including x4, n7, and other required segments to the kcsm transmission structure.
  • Context - edi 350 message segments have been copied:
    For Create Transmission Dependent Segment A9DP:
    When the system creates transmission dependent segments, then the system creates a9dp segments containing the copied edi segment data with proper sequencing and linkage to the root segment.
  • Context - transmission dependent segments a9dp have been created:
    For Store EDI Segment Data:
    When the system stores edi segment data, then the system stores each edi segment with proper sequence numbers and maintains data integrity for kcsm processing.
  • Context - edi segment data has been stored in transmission segments:
    For Set Transmission File Properties:
    When the system sets transmission file properties, then the system configures file status, creation timestamps, processing indicators, and other metadata required for kcsm integration.
  • Context - transmission file properties have been configured:
    For Write Transmission Segments to Database:
    When the system writes transmission segments to the database, then the system stores the a9rt root segment and all a9dp dependent segments to the database with proper relationships and indexing.
  • Context - transmission segments have been written to the database:
    For Prepare KCSM Integration Message:
    When the system prepares kcsm integration message, then the system creates notification message containing transmission file identifiers and processing instructions for kcsm system.
  • Context - kcsm integration message has been prepared:
    For Queue Message for KCSM System:
    When the system queues the message for kcsm system, then the system places the message in the appropriate queue for kcsm system processing with proper priority and routing.
  • Context - message has been queued for kcsm system:
    For Log Transmission Details:
    When the system logs transmission details, then the system records transmission file creation details including timestamps, segment counts, and processing status for audit trail.
  • Context - a disposition code is being evaluated for kcsm processing:
    For Skip KCSM Processing:
    When the disposition code does not require kcsm processing or kcsm is not configured for the port, then the system bypasses kcsm transmission file creation and continues with normal customs release processing.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for customs release
GIVEN
A disposition code is being processed for customs release
Applied to: Disposition Code Requires KCSM?
WHEN
The system evaluates the disposition code configuration
THEN
The system determines whether KCSM transmission processing is required for this disposition code
Context: A disposition code needs to be processed
GIVEN
A disposition code needs to be processed
Applied to: Retrieve Disposition Code from DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The system retrieves disposition code details including KCSM processing requirements and Merlin message configuration
Context: A disposition code requires KCSM processing
GIVEN
A disposition code requires KCSM processing
Applied to: Check KCSM Configuration at Laredo Port
WHEN
The system checks the port configuration for KCSM integration
THEN
The system validates that KCSM processing is enabled and configured for the Laredo port
Context: Disposition code and port configuration have been validated
GIVEN
Disposition code and port configuration have been validated
Applied to: KCSM Processing Required?
WHEN
The system evaluates all KCSM processing requirements
THEN
The system decides whether to proceed with KCSM transmission file creation or skip processing
Context: KCSM processing is required for the disposition code
GIVEN
KCSM processing is required for the disposition code
Applied to: Create Transmission Root Segment A9RT
WHEN
The system creates the transmission file structure
THEN
The system creates an A9RT root segment with transmission control information and unique identifiers
Context: A transmission root segment A9RT has been created
GIVEN
A transmission root segment A9RT has been created
Applied to: Set Transmission Control Information
WHEN
The system sets up transmission control parameters
THEN
The system assigns transmission sequence numbers, control codes, and identification information for KCSM processing
Context: Transmission control information has been established
GIVEN
Transmission control information has been established
Applied to: Initialize Transmission Parameters
WHEN
The system initializes transmission parameters
THEN
The system sets up EDI message parameters, transmission dates, and processing configuration for KCSM integration
Context: Transmission parameters have been initialized
GIVEN
Transmission parameters have been initialized
Applied to: Copy EDI 350 Message Segments
WHEN
The system processes the original EDI 350 message
THEN
The system copies relevant message segments including X4, N7, and other required segments to the KCSM transmission structure
Context: EDI 350 message segments have been copied
GIVEN
EDI 350 message segments have been copied
Applied to: Create Transmission Dependent Segment A9DP
WHEN
The system creates transmission dependent segments
THEN
The system creates A9DP segments containing the copied EDI segment data with proper sequencing and linkage to the root segment
Context: Transmission dependent segments A9DP have been created
GIVEN
Transmission dependent segments A9DP have been created
Applied to: Store EDI Segment Data
WHEN
The system stores EDI segment data
THEN
The system stores each EDI segment with proper sequence numbers and maintains data integrity for KCSM processing
Context: EDI segment data has been stored in transmission segments
GIVEN
EDI segment data has been stored in transmission segments
Applied to: Set Transmission File Properties
WHEN
The system sets transmission file properties
THEN
The system configures file status, creation timestamps, processing indicators, and other metadata required for KCSM integration
Context: Transmission file properties have been configured
GIVEN
Transmission file properties have been configured
Applied to: Write Transmission Segments to Database
WHEN
The system writes transmission segments to the database
THEN
The system stores the A9RT root segment and all A9DP dependent segments to the database with proper relationships and indexing
Context: Transmission segments have been written to the database
GIVEN
Transmission segments have been written to the database
Applied to: Prepare KCSM Integration Message
WHEN
The system prepares KCSM integration message
THEN
The system creates notification message containing transmission file identifiers and processing instructions for KCSM system
Context: KCSM integration message has been prepared
GIVEN
KCSM integration message has been prepared
Applied to: Queue Message for KCSM System
WHEN
The system queues the message for KCSM system
THEN
The system places the message in the appropriate queue for KCSM system processing with proper priority and routing
Context: Message has been queued for KCSM system
GIVEN
Message has been queued for KCSM system
Applied to: Log Transmission Details
WHEN
The system logs transmission details
THEN
The system records transmission file creation details including timestamps, segment counts, and processing status for audit trail
Context: A disposition code is being evaluated for KCSM processing
GIVEN
A disposition code is being evaluated for KCSM processing
Applied to: Skip KCSM Processing
WHEN
The disposition code does not require KCSM processing OR KCSM is not configured for the port
THEN
The system bypasses KCSM transmission file creation and continues with normal customs release processing
R-GCX016-cbl-02222 (+9) File: GCX016.cbl K1 Remarks Processing for Train Operations Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'K1 Remarks Processing for Train Operations':
  • Context - a k1 segment is received for train operations:
    For Train Context Available?:
    When the system checks for available train context, then processing continues if train context exists, otherwise an error is logged.
    For Log Error - No Train Context:
    When no train context is available, then an error is logged indicating missing train context.
  • Context - a valid k1 segment with train context available:
    For Extract K1 Free-form Comment Text:
    When the system processes the k1 segment, then the free-form comment text is extracted from the k1 segment.
  • Context - k1 free-form comment text has been extracted:
    For Validate Comment Length and Format:
    When the system validates the comment, then the comment is checked for proper length and format constraints.
  • Context - k1 comment has been validated for length and format:
    For Comment Valid?:
    When the system evaluates comment validity, then processing continues if valid, otherwise the segment is skipped.
  • Context - a valid k1 comment has been validated:
    For Associate Comment with Train ID:
    When the system processes the comment for train operations, then the comment is associated with the current train id.
  • Context - k1 comment has been associated with train id:
    For Log K1 Remark with Train Information:
    When the system logs the remark, then the k1 remark is logged with complete train information.
  • Context - k1 remark has been logged with train information:
    For Store Train-level Comment in System:
    When the system stores the comment, then the comment is stored as a train-level remark in the system.
  • Context - train-level comment has been stored in the system:
    For Generate Audit Trail Entry:
    When the system completes the storage process, then an audit trail entry is generated for the k1 train remark.
  • Context - a k1 comment has failed validation checks:
    For Skip Invalid K1 Segment:
    When the system determines the comment is invalid, then the invalid k1 segment is skipped and processing continues.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 segment is received for train operations
GIVEN
A K1 segment is received for train operations
Applied to: Train Context Available?
WHEN
The system checks for available train context
THEN
Processing continues if train context exists, otherwise an error is logged
Applied to: Log Error - No Train Context
WHEN
No train context is available
THEN
An error is logged indicating missing train context
Context: A valid K1 segment with train context available
GIVEN
A valid K1 segment with train context available
Applied to: Extract K1 Free-form Comment Text
WHEN
The system processes the K1 segment
THEN
The free-form comment text is extracted from the K1 segment
Context: K1 free-form comment text has been extracted
GIVEN
K1 free-form comment text has been extracted
Applied to: Validate Comment Length and Format
WHEN
The system validates the comment
THEN
The comment is checked for proper length and format constraints
Context: K1 comment has been validated for length and format
GIVEN
K1 comment has been validated for length and format
Applied to: Comment Valid?
WHEN
The system evaluates comment validity
THEN
Processing continues if valid, otherwise the segment is skipped
Context: A valid K1 comment has been validated
GIVEN
A valid K1 comment has been validated
Applied to: Associate Comment with Train ID
WHEN
The system processes the comment for train operations
THEN
The comment is associated with the current train ID
Context: K1 comment has been associated with train ID
GIVEN
K1 comment has been associated with train ID
Applied to: Log K1 Remark with Train Information
WHEN
The system logs the remark
THEN
The K1 remark is logged with complete train information
Context: K1 remark has been logged with train information
GIVEN
K1 remark has been logged with train information
Applied to: Store Train-level Comment in System
WHEN
The system stores the comment
THEN
The comment is stored as a train-level remark in the system
Context: Train-level comment has been stored in the system
GIVEN
Train-level comment has been stored in the system
Applied to: Generate Audit Trail Entry
WHEN
The system completes the storage process
THEN
An audit trail entry is generated for the K1 train remark
Context: A K1 comment has failed validation checks
GIVEN
A K1 comment has failed validation checks
Applied to: Skip Invalid K1 Segment
WHEN
The system determines the comment is invalid
THEN
The invalid K1 segment is skipped and processing continues
R-GCX016-cbl-02232 (+9) File: GCX016.cbl K1 Remarks Processing for Cargo Operations Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'K1 Remarks Processing for Cargo Operations':
  • Context - a k1 remarks segment is received in the message queue:
    For Is K1 Associated with X4 Segment?:
    When the system checks if the k1 segment is associated with an x4 customs release segment, then the k1 segment is processed for cargo remarks if associated with x4, otherwise it is skipped as non-cargo related.
  • Context - a k1 remarks segment associated with an x4 segment:
    For K1 Format Valid?:
    When the system validates the k1 segment format and structure, then the k1 segment is accepted for comment extraction if format is valid, otherwise it is rejected with invalid format error.
  • Context - a valid k1 remarks segment associated with an x4 segment:
    For Extract Free-form Comment Text:
    When the system extracts the free-form comment text from the k1 segment, then the comment text is extracted and prepared for storage in the cargo record.
  • Context - a free-form comment extracted from a k1 segment for an x4 segment:
    For Comment Count < 4?:
    When the system checks if the current comment count is less than 4 for the x4 segment, then the comment is accepted for storage if count is less than 4, otherwise it is rejected with maximum comments exceeded error.
  • Context - a valid comment extracted from k1 segment with comment count less than 4:
    For Store Comment in Cargo Record:
    When the system stores the comment in the cargo record, then the comment is successfully stored in the cargo record and associated with the x4 segment.
  • Context - a comment has been successfully stored in the cargo record:
    For Increment Comment Counter:
    When the system increments the comment counter for the x4 segment, then the comment counter is increased by 1 to reflect the new comment count.
  • Context - a k1 segment has been processed for an x4 segment:
    For More K1 Segments?:
    When the system checks if there are more k1 segments to process, then processing continues with the next k1 segment if available, otherwise proceeds to associate all comments with the x4 segment.
  • Context - all k1 segments for an x4 segment have been processed:
    For Associate Comments with X4 Segment:
    When the system associates the collected comments with the x4 segment, then all comments are linked to the x4 segment for cargo record updates.
  • Context - comments have been associated with an x4 segment:
    For Update Cargo Record with Remarks:
    When the system updates the cargo record with the remarks, then the cargo record is updated with all k1 remarks for future reference and processing.
  • Context - k1 segment processing has completed (successfully or with errors):
    For Log K1 Processing Complete:
    When the system logs the completion of k1 processing, then a log entry is created indicating the completion status of k1 remarks processing.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 remarks segment is received in the message queue
GIVEN
A K1 remarks segment is received in the message queue
Applied to: Is K1 Associated with X4 Segment?
WHEN
The system checks if the K1 segment is associated with an X4 customs release segment
THEN
The K1 segment is processed for cargo remarks if associated with X4, otherwise it is skipped as non-cargo related
Context: A K1 remarks segment associated with an X4 segment
GIVEN
A K1 remarks segment associated with an X4 segment
Applied to: K1 Format Valid?
WHEN
The system validates the K1 segment format and structure
THEN
The K1 segment is accepted for comment extraction if format is valid, otherwise it is rejected with invalid format error
Context: A valid K1 remarks segment associated with an X4 segment
GIVEN
A valid K1 remarks segment associated with an X4 segment
Applied to: Extract Free-form Comment Text
WHEN
The system extracts the free-form comment text from the K1 segment
THEN
The comment text is extracted and prepared for storage in the cargo record
Context: A free-form comment extracted from a K1 segment for an X4 segment
GIVEN
A free-form comment extracted from a K1 segment for an X4 segment
Applied to: Comment Count < 4?
WHEN
The system checks if the current comment count is less than 4 for the X4 segment
THEN
The comment is accepted for storage if count is less than 4, otherwise it is rejected with maximum comments exceeded error
Context: A valid comment extracted from K1 segment with comment count less than 4
GIVEN
A valid comment extracted from K1 segment with comment count less than 4
Applied to: Store Comment in Cargo Record
WHEN
The system stores the comment in the cargo record
THEN
The comment is successfully stored in the cargo record and associated with the X4 segment
Context: A comment has been successfully stored in the cargo record
GIVEN
A comment has been successfully stored in the cargo record
Applied to: Increment Comment Counter
WHEN
The system increments the comment counter for the X4 segment
THEN
The comment counter is increased by 1 to reflect the new comment count
Context: A K1 segment has been processed for an X4 segment
GIVEN
A K1 segment has been processed for an X4 segment
Applied to: More K1 Segments?
WHEN
The system checks if there are more K1 segments to process
THEN
Processing continues with the next K1 segment if available, otherwise proceeds to associate all comments with the X4 segment
Context: All K1 segments for an X4 segment have been processed
GIVEN
All K1 segments for an X4 segment have been processed
Applied to: Associate Comments with X4 Segment
WHEN
The system associates the collected comments with the X4 segment
THEN
All comments are linked to the X4 segment for cargo record updates
Context: Comments have been associated with an X4 segment
GIVEN
Comments have been associated with an X4 segment
Applied to: Update Cargo Record with Remarks
WHEN
The system updates the cargo record with the remarks
THEN
The cargo record is updated with all K1 remarks for future reference and processing
Context: K1 segment processing has completed (successfully or with errors)
GIVEN
K1 segment processing has completed (successfully or with errors)
Applied to: Log K1 Processing Complete
WHEN
The system logs the completion of K1 processing
THEN
A log entry is created indicating the completion status of K1 remarks processing
R-GCX016-cbl-02242 (+4) File: GCX016.cbl KCSM Disposition Code Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Disposition Code Validation':
  • Context - an x4 segment is received with a disposition code and the system has access to port configuration and kcsm configuration table:
    For Check if disposition codes are configured for KCSM system processing at Laredo port:
    When the system processes the x4 segment disposition code, then the system extracts the disposition code, checks if the current port is laredo, searches the kcsm configuration table for the disposition code, and sets kcsm integration flag if found, otherwise continues with standard processing.
  • Context - the system has extracted a disposition code from an x4 segment and needs to determine processing requirements:
    For Is Port = Laredo?:
    When the system checks the current port location, then if the port equals laredo, the system proceeds to kcsm configuration validation, otherwise it skips kcsm integration and continues with standard processing.
  • Context - the port location is laredo and a disposition code has been extracted from the x4 segment:
    For Search for Disposition Code in KCSM Table:
    When the system accesses the kcsm configuration table and searches for the disposition code, then the system returns whether the disposition code is found in the kcsm configuration table.
  • Context - the disposition code is found in the kcsm configuration table and the port is laredo:
    For Set KCSM Integration Flag:
    When the system confirms kcsm processing is required, then the system marks the cargo for kcsm processing and sets the kcsm integration flag to enable downstream kcsm system integration.
  • Context - the kcsm validation process has completed either with kcsm integration enabled or standard processing continuation:
    For Log KCSM Validation Result:
    When the system completes the kcsm validation workflow, then the system logs the kcsm validation result indicating whether kcsm integration was enabled or standard processing was selected.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is received with a disposition code and the system has access to port configuration and KCSM configuration table
GIVEN
An X4 segment is received with a disposition code and the system has access to port configuration and KCSM configuration table
Applied to: Check if disposition codes are configured for KCSM system processing at Laredo port
WHEN
The system processes the X4 segment disposition code
THEN
The system extracts the disposition code, checks if the current port is Laredo, searches the KCSM configuration table for the disposition code, and sets KCSM integration flag if found, otherwise continues with standard processing
Context: The system has extracted a disposition code from an X4 segment and needs to determine processing requirements
GIVEN
The system has extracted a disposition code from an X4 segment and needs to determine processing requirements
Applied to: Is Port = Laredo?
WHEN
The system checks the current port location
THEN
If the port equals Laredo, the system proceeds to KCSM configuration validation, otherwise it skips KCSM integration and continues with standard processing
Context: The port location is Laredo and a disposition code has been extracted from the X4 segment
GIVEN
The port location is Laredo and a disposition code has been extracted from the X4 segment
Applied to: Search for Disposition Code in KCSM Table
WHEN
The system accesses the KCSM configuration table and searches for the disposition code
THEN
The system returns whether the disposition code is found in the KCSM configuration table
Context: The disposition code is found in the KCSM configuration table and the port is Laredo
GIVEN
The disposition code is found in the KCSM configuration table and the port is Laredo
Applied to: Set KCSM Integration Flag
WHEN
The system confirms KCSM processing is required
THEN
The system marks the cargo for KCSM processing and sets the KCSM integration flag to enable downstream KCSM system integration
Context: The KCSM validation process has completed either with KCSM integration enabled or standard processing continuation
GIVEN
The KCSM validation process has completed either with KCSM integration enabled or standard processing continuation
Applied to: Log KCSM Validation Result
WHEN
The system completes the KCSM validation workflow
THEN
The system logs the KCSM validation result indicating whether KCSM integration was enabled or standard processing was selected
R-GCX016-cbl-02247 (+11) File: GCX016.cbl KCSM EDI Message Transmission Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM EDI Message Transmission':
  • Context - an x4 segment with a disposition code is received:
    For Check Disposition Code in AECWRKTB Table:
    When the system checks the disposition code configuration in aecwrktb table, then the system determines if the disposition code is configured for kcsm transmission.
  • Context - a disposition code is configured for kcsm transmission:
    For Port is Laredo?:
    When the system validates the port location, then kcsm processing continues only if the port is laredo, otherwise processing is skipped.
  • Context - the disposition code is configured for kcsm and the port is laredo:
    For Copy EDI 350 Message to Transmission File:
    When the system processes the edi message for transmission, then the edi 350 message data is copied to the transmission file.
  • Context - edi 350 message data has been copied to transmission file:
    For Create Transmission Root Segment A9RT:
    When the system creates transmission control structures, then an a9rt transmission root segment is created with appropriate control information.
  • Context - a9rt transmission root segment has been created:
    For Set Transmission Control Information:
    When the system configures transmission parameters, then transmission control information including identifiers and parameters are set.
  • Context - transmission control information has been set:
    For Create Transmission Dependent Segment A9DP:
    When the system creates dependent data structures, then an a9dp transmission dependent segment is created to contain edi segment data.
  • Context - a9dp transmission dependent segment has been created:
    For Copy EDI Segment Data to A9DP:
    When the system populates the segment with message data, then edi segment data is copied into the a9dp segment for transmission.
  • Context - edi segment data has been copied to a9dp segment:
    For Lookup KCSM Broker Information:
    When the system requires broker information for transmission, then kcsm broker information is retrieved from gcstbrt broker tables.
  • Context - kcsm broker information has been retrieved:
    For Set Transmission Parameters:
    When the system configures transmission settings, then transmission parameters are set according to kcsm processing requirements.
  • Context - transmission parameters have been configured:
    For Spawn GCT1091E Transaction for KCSM:
    When the system initiates kcsm processing transaction, then gct1091e transaction is spawned for kcsm message transmission.
  • Context - gct1091e transaction has been spawned:
    For Queue Message for KCSM Transmission:
    When the system queues the message for transmission, then the message is queued for kcsm transmission processing.
  • Context - message has been queued for kcsm transmission:
    For Log Transmission Details:
    When the system completes transmission setup, then transmission details are logged for audit and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment with a disposition code is received
GIVEN
An X4 segment with a disposition code is received
Applied to: Check Disposition Code in AECWRKTB Table
WHEN
The system checks the disposition code configuration in AECWRKTB table
THEN
The system determines if the disposition code is configured for KCSM transmission
Context: A disposition code is configured for KCSM transmission
GIVEN
A disposition code is configured for KCSM transmission
Applied to: Port is Laredo?
WHEN
The system validates the port location
THEN
KCSM processing continues only if the port is Laredo, otherwise processing is skipped
Context: The disposition code is configured for KCSM and the port is Laredo
GIVEN
The disposition code is configured for KCSM and the port is Laredo
Applied to: Copy EDI 350 Message to Transmission File
WHEN
The system processes the EDI message for transmission
THEN
The EDI 350 message data is copied to the transmission file
Context: EDI 350 message data has been copied to transmission file
GIVEN
EDI 350 message data has been copied to transmission file
Applied to: Create Transmission Root Segment A9RT
WHEN
The system creates transmission control structures
THEN
An A9RT transmission root segment is created with appropriate control information
Context: A9RT transmission root segment has been created
GIVEN
A9RT transmission root segment has been created
Applied to: Set Transmission Control Information
WHEN
The system configures transmission parameters
THEN
Transmission control information including identifiers and parameters are set
Context: Transmission control information has been set
GIVEN
Transmission control information has been set
Applied to: Create Transmission Dependent Segment A9DP
WHEN
The system creates dependent data structures
THEN
An A9DP transmission dependent segment is created to contain EDI segment data
Context: A9DP transmission dependent segment has been created
GIVEN
A9DP transmission dependent segment has been created
Applied to: Copy EDI Segment Data to A9DP
WHEN
The system populates the segment with message data
THEN
EDI segment data is copied into the A9DP segment for transmission
Context: EDI segment data has been copied to A9DP segment
GIVEN
EDI segment data has been copied to A9DP segment
Applied to: Lookup KCSM Broker Information
WHEN
The system requires broker information for transmission
THEN
KCSM broker information is retrieved from GCSTBRT broker tables
Context: KCSM broker information has been retrieved
GIVEN
KCSM broker information has been retrieved
Applied to: Set Transmission Parameters
WHEN
The system configures transmission settings
THEN
Transmission parameters are set according to KCSM processing requirements
Context: Transmission parameters have been configured
GIVEN
Transmission parameters have been configured
Applied to: Spawn GCT1091E Transaction for KCSM
WHEN
The system initiates KCSM processing transaction
THEN
GCT1091E transaction is spawned for KCSM message transmission
Context: GCT1091E transaction has been spawned
GIVEN
GCT1091E transaction has been spawned
Applied to: Queue Message for KCSM Transmission
WHEN
The system queues the message for transmission
THEN
The message is queued for KCSM transmission processing
Context: Message has been queued for KCSM transmission
GIVEN
Message has been queued for KCSM transmission
Applied to: Log Transmission Details
WHEN
The system completes transmission setup
THEN
Transmission details are logged for audit and tracking purposes
R-GCX016-cbl-02259 (+13) File: GCX016.cbl KCSM Transmission Root Segment Creation Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Transmission Root Segment Creation':
  • Context - a new kcsm transmission is being created:
    For Initialize Transmission Parameters:
    When the system begins transmission root segment creation process, then all transmission parameters are initialized to default values and system is ready for parameter setting.
  • Context - transmission parameters are initialized:
    For Set KCSM System Identifier:
    When the system sets the kcsm system identifier, then the transmission is tagged with the correct kcsm system identifier for message processing.
  • Context - kcsm system identifier is set:
    For Generate Transmission Control Number:
    When the system generates a transmission control number, then a unique transmission control number is created and assigned to the transmission.
  • Context - transmission control number is generated:
    For Create A9RT Root Segment:
    When the system creates the a9rt root segment, then a properly formatted a9rt root segment is created with all required fields.
  • Context - a9rt root segment is created:
    For Set Transmission Date/Time:
    When the system sets transmission date and time, then current system date and time are recorded in the transmission segment.
  • Context - transmission date and time are set:
    For Set Source System Information:
    When the system configures source system information, then source system identifier and related information are properly set in the transmission segment.
  • Context - source system information is configured:
    For Set Destination System Information:
    When the system configures destination system information, then destination system identifier and routing information are properly set in the transmission segment.
  • Context - destination system information is configured:
    For Set Message Type and Version:
    When the system sets message type and version, then correct message type and version identifiers are assigned to the transmission.
  • Context - message type and version are set:
    For Validate Transmission Parameters:
    When the system validates transmission parameters, then all required transmission parameters are verified for completeness and correctness.
  • Context - transmission parameters validation is successful:
    For Store Root Segment to Database:
    When the system stores the root segment to database, then the a9rt transmission segment is successfully stored in the aecwrktb database table.
  • Context - root segment is stored to database successfully:
    For Log Transmission Creation:
    When the system logs transmission creation, then transmission creation event is recorded in system logs with relevant details.
  • Context - transmission creation is logged successfully:
    For Return Success Status:
    When the system completes the transmission creation process, then success status is returned to the calling process.
  • Context - transmission parameters validation fails:
    For Log Validation Error:
    When the system encounters validation errors, then validation error details are logged for troubleshooting and audit purposes.
  • Context - validation errors are logged:
    For Return Error Status:
    When the system cannot create valid transmission root segment, then error status is returned to the calling process indicating transmission creation failure.
👨‍💻 Technical ACs (Gherkin)
Context: A new KCSM transmission is being created
GIVEN
A new KCSM transmission is being created
Applied to: Initialize Transmission Parameters
WHEN
The system begins transmission root segment creation process
THEN
All transmission parameters are initialized to default values and system is ready for parameter setting
Context: Transmission parameters are initialized
GIVEN
Transmission parameters are initialized
Applied to: Set KCSM System Identifier
WHEN
The system sets the KCSM system identifier
THEN
The transmission is tagged with the correct KCSM system identifier for message processing
Context: KCSM system identifier is set
GIVEN
KCSM system identifier is set
Applied to: Generate Transmission Control Number
WHEN
The system generates a transmission control number
THEN
A unique transmission control number is created and assigned to the transmission
Context: Transmission control number is generated
GIVEN
Transmission control number is generated
Applied to: Create A9RT Root Segment
WHEN
The system creates the A9RT root segment
THEN
A properly formatted A9RT root segment is created with all required fields
Context: A9RT root segment is created
GIVEN
A9RT root segment is created
Applied to: Set Transmission Date/Time
WHEN
The system sets transmission date and time
THEN
Current system date and time are recorded in the transmission segment
Context: Transmission date and time are set
GIVEN
Transmission date and time are set
Applied to: Set Source System Information
WHEN
The system configures source system information
THEN
Source system identifier and related information are properly set in the transmission segment
Context: Source system information is configured
GIVEN
Source system information is configured
Applied to: Set Destination System Information
WHEN
The system configures destination system information
THEN
Destination system identifier and routing information are properly set in the transmission segment
Context: Destination system information is configured
GIVEN
Destination system information is configured
Applied to: Set Message Type and Version
WHEN
The system sets message type and version
THEN
Correct message type and version identifiers are assigned to the transmission
Context: Message type and version are set
GIVEN
Message type and version are set
Applied to: Validate Transmission Parameters
WHEN
The system validates transmission parameters
THEN
All required transmission parameters are verified for completeness and correctness
Context: Transmission parameters validation is successful
GIVEN
Transmission parameters validation is successful
Applied to: Store Root Segment to Database
WHEN
The system stores the root segment to database
THEN
The A9RT transmission segment is successfully stored in the AECWRKTB database table
Context: Root segment is stored to database successfully
GIVEN
Root segment is stored to database successfully
Applied to: Log Transmission Creation
WHEN
The system logs transmission creation
THEN
Transmission creation event is recorded in system logs with relevant details
Context: Transmission creation is logged successfully
GIVEN
Transmission creation is logged successfully
Applied to: Return Success Status
WHEN
The system completes the transmission creation process
THEN
Success status is returned to the calling process
Context: Transmission parameters validation fails
GIVEN
Transmission parameters validation fails
Applied to: Log Validation Error
WHEN
The system encounters validation errors
THEN
Validation error details are logged for troubleshooting and audit purposes
Context: Validation errors are logged
GIVEN
Validation errors are logged
Applied to: Return Error Status
WHEN
The system cannot create valid transmission root segment
THEN
Error status is returned to the calling process indicating transmission creation failure
R-GCX016-cbl-02273 (+16) File: GCX016.cbl KCSM Transmission Dependent Segment Creation Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Transmission Dependent Segment Creation':
  • Context - a message queue contains edi 350 messages for processing:
    For Retrieve EDI 350 Message Data:
    When the system initiates kcsm transmission dependent segment creation, then the system retrieves edi 350 message data from the message queue and loads it into the message array for processing.
  • Context - edi 350 message data has been retrieved:
    For Initialize Dependent Segment Structure:
    When the system begins creating dependent segments, then the system initializes the a9dp dependent segment structure with default values and prepares it for data population.
  • Context - edi 350 message contains st segment data:
    For Extract Transaction Set Header ST:
    When the system processes message segments sequentially, then the system extracts st segment information and sets header found flag for subsequent processing.
  • Context - edi 350 message contains m10 segment with manifest information:
    For Extract Manifest Information M10:
    When the system encounters m10 segment during processing, then the system extracts manifest information, validates train name, and performs train lookup if vessel name does not start with 'train'.
  • Context - edi 350 message contains p4 segment with port information:
    For Extract Port Information P4:
    When the system encounters p4 segment during processing, then the system extracts port information and processes it for customs release procedures.
  • Context - edi 350 message contains v9 segment with event codes:
    For Extract Event Details V9:
    When the system encounters v9 segment during processing, then the system evaluates event codes (hmi, hre, pod, aad, rc, oca, coc, lck, ulc, sei, ser) and applies corresponding train or cargo status changes.
  • Context - edi 350 message contains n7 segment with equipment information:
    For Extract Equipment Information N7:
    When the system encounters n7 segment during processing, then the system extracts equipment details, updates car id information in cargo records, and handles multiple n7 segments per message.
  • Context - edi 350 message contains x4 segment with customs release information:
    For Extract Customs Release Information X4:
    When the system encounters x4 segment during processing, then the system validates disposition codes, determines processing type (by bond, by car/waybill, or individual), and processes cargo status changes based on disposition code rules.
  • Context - edi 350 message contains k1 segment with remarks:
    For Extract Remarks K1:
    When the system encounters k1 segment during processing, then the system extracts remarks information, processes broker data, and includes remarks in merlin messages when applicable.
  • Context - edi segment data has been extracted from all applicable segments:
    For Format Dependent Segment Data:
    When the system prepares to create dependent segments, then the system formats the extracted data according to a9dp dependent segment specifications and ensures proper data structure.
  • Context - dependent segment data has been formatted:
    For Set Segment Length and Type:
    When the system creates the dependent segment structure, then the system calculates and sets the segment length based on data content and assigns the appropriate segment type identifier.
  • Context - segment length and type have been configured:
    For Create A9DP Dependent Segment:
    When the system finalizes dependent segment creation, then the system creates the a9dp dependent segment structure with all formatted edi data and proper segment identifiers.
  • Context - a9dp dependent segment has been created:
    For Link to Transmission Root Segment:
    When the system establishes segment relationships, then the system links the dependent segment to the corresponding a9rt transmission root segment to maintain proper hierarchical structure.
  • Context - dependent segment has been linked to transmission root segment:
    For Store Dependent Segment in Database:
    When the system persists segment data, then the system stores the a9dp dependent segment in the database with proper key relationships and data integrity.
  • Context - one edi segment has been processed and stored:
    For More EDI Segments?:
    When the system checks for additional segments in the message array, then if more edi segments exist, the system continues processing from segment extraction; otherwise, it proceeds to validation.
  • Context - all edi segments have been processed and stored:
    For Validate Segment Creation:
    When the system performs final validation, then the system verifies that all required dependent segments have been created with proper data integrity and linkages.
  • Context - dependent segment creation has been validated successfully:
    For Update Transmission Status:
    When the system finalizes the transmission process, then the system updates the transmission status to indicate successful completion of dependent segment creation for kcsm transmission.
👨‍💻 Technical ACs (Gherkin)
Context: A message queue contains EDI 350 messages for processing
GIVEN
A message queue contains EDI 350 messages for processing
Applied to: Retrieve EDI 350 Message Data
WHEN
The system initiates KCSM transmission dependent segment creation
THEN
The system retrieves EDI 350 message data from the message queue and loads it into the message array for processing
Context: EDI 350 message data has been retrieved
GIVEN
EDI 350 message data has been retrieved
Applied to: Initialize Dependent Segment Structure
WHEN
The system begins creating dependent segments
THEN
The system initializes the A9DP dependent segment structure with default values and prepares it for data population
Context: EDI 350 message contains ST segment data
GIVEN
EDI 350 message contains ST segment data
Applied to: Extract Transaction Set Header ST
WHEN
The system processes message segments sequentially
THEN
The system extracts ST segment information and sets header found flag for subsequent processing
Context: EDI 350 message contains M10 segment with manifest information
GIVEN
EDI 350 message contains M10 segment with manifest information
Applied to: Extract Manifest Information M10
WHEN
The system encounters M10 segment during processing
THEN
The system extracts manifest information, validates train name, and performs train lookup if vessel name does not start with 'TRAIN'
Context: EDI 350 message contains P4 segment with port information
GIVEN
EDI 350 message contains P4 segment with port information
Applied to: Extract Port Information P4
WHEN
The system encounters P4 segment during processing
THEN
The system extracts port information and processes it for customs release procedures
Context: EDI 350 message contains V9 segment with event codes
GIVEN
EDI 350 message contains V9 segment with event codes
Applied to: Extract Event Details V9
WHEN
The system encounters V9 segment during processing
THEN
The system evaluates event codes (HMI, HRE, POD, AAD, RC, OCA, COC, LCK, ULC, SEI, SER) and applies corresponding train or cargo status changes
Context: EDI 350 message contains N7 segment with equipment information
GIVEN
EDI 350 message contains N7 segment with equipment information
Applied to: Extract Equipment Information N7
WHEN
The system encounters N7 segment during processing
THEN
The system extracts equipment details, updates car ID information in cargo records, and handles multiple N7 segments per message
Context: EDI 350 message contains X4 segment with customs release information
GIVEN
EDI 350 message contains X4 segment with customs release information
Applied to: Extract Customs Release Information X4
WHEN
The system encounters X4 segment during processing
THEN
The system validates disposition codes, determines processing type (by bond, by car/waybill, or individual), and processes cargo status changes based on disposition code rules
Context: EDI 350 message contains K1 segment with remarks
GIVEN
EDI 350 message contains K1 segment with remarks
Applied to: Extract Remarks K1
WHEN
The system encounters K1 segment during processing
THEN
The system extracts remarks information, processes broker data, and includes remarks in Merlin messages when applicable
Context: EDI segment data has been extracted from all applicable segments
GIVEN
EDI segment data has been extracted from all applicable segments
Applied to: Format Dependent Segment Data
WHEN
The system prepares to create dependent segments
THEN
The system formats the extracted data according to A9DP dependent segment specifications and ensures proper data structure
Context: Dependent segment data has been formatted
GIVEN
Dependent segment data has been formatted
Applied to: Set Segment Length and Type
WHEN
The system creates the dependent segment structure
THEN
The system calculates and sets the segment length based on data content and assigns the appropriate segment type identifier
Context: Segment length and type have been configured
GIVEN
Segment length and type have been configured
Applied to: Create A9DP Dependent Segment
WHEN
The system finalizes dependent segment creation
THEN
The system creates the A9DP dependent segment structure with all formatted EDI data and proper segment identifiers
Context: A9DP dependent segment has been created
GIVEN
A9DP dependent segment has been created
Applied to: Link to Transmission Root Segment
WHEN
The system establishes segment relationships
THEN
The system links the dependent segment to the corresponding A9RT transmission root segment to maintain proper hierarchical structure
Context: Dependent segment has been linked to transmission root segment
GIVEN
Dependent segment has been linked to transmission root segment
Applied to: Store Dependent Segment in Database
WHEN
The system persists segment data
THEN
The system stores the A9DP dependent segment in the database with proper key relationships and data integrity
Context: One EDI segment has been processed and stored
GIVEN
One EDI segment has been processed and stored
Applied to: More EDI Segments?
WHEN
The system checks for additional segments in the message array
THEN
If more EDI segments exist, the system continues processing from segment extraction; otherwise, it proceeds to validation
Context: All EDI segments have been processed and stored
GIVEN
All EDI segments have been processed and stored
Applied to: Validate Segment Creation
WHEN
The system performs final validation
THEN
The system verifies that all required dependent segments have been created with proper data integrity and linkages
Context: Dependent segment creation has been validated successfully
GIVEN
Dependent segment creation has been validated successfully
Applied to: Update Transmission Status
WHEN
The system finalizes the transmission process
THEN
The system updates the transmission status to indicate successful completion of dependent segment creation for KCSM transmission
R-GCX016-cbl-02290 (+13) File: GCX016.cbl Equipment Information Processing for KCSM Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Information Processing for KCSM':
  • Context - an n7 equipment segment is received in the message:
    For Extract Equipment ID from N7 Segment:
    When the system processes the n7 segment, then equipment id information is extracted from the n7 segment data.
  • Context - equipment id has been extracted from n7 segment:
    For Format Equipment ID using GCCCARFM Utility:
    When the system needs to format the equipment id, then gcccarfm utility is called to standardize the equipment id format.
  • Context - equipment id has been formatted using gcccarfm utility:
    For Equipment ID Valid?:
    When the system validates the equipment id, then equipment id is confirmed as valid or invalid based on business validation rules.
    For Equipment ID Validation Error:
    When equipment id validation fails, then system handles validation error and proceeds to equipment processing completion.
  • Context - equipment id has been validated as valid:
    For Update Car ID Information in Cargo Records:
    When the system processes cargo records associated with the equipment, then car id information is updated in the relevant cargo records.
  • Context - equipment id information has been processed and cargo records updated:
    For KCSM Processing Required?:
    When the system evaluates kcsm transmission requirements, then system determines whether kcsm processing is required for this equipment.
  • Context - kcsm processing has been determined as required:
    For Check Disposition Code for KCSM Integration:
    When the system checks the disposition code associated with the equipment, then disposition code is evaluated to determine specific kcsm integration actions.
  • Context - disposition code indicates kcsm integration is required:
    For Extract Equipment Details for KCSM:
    When the system extracts equipment details, then all necessary equipment information is extracted for kcsm transmission.
  • Context - equipment details have been extracted for kcsm processing:
    For Include N7 Segment in EDI 350 Message Copy:
    When the system creates edi 350 message copy, then n7 segment information is included in the edi 350 message copy.
  • Context - n7 segment has been included in edi 350 message copy:
    For Add Equipment Information to Transmission File:
    When the system processes transmission file updates, then equipment information is added to the kcsm transmission file.
  • Context - equipment information has been added to transmission file:
    For Create Transmission Dependent Segment with Equipment Data:
    When the system creates transmission dependent segments, then dependent segments are created with equipment data for kcsm transmission.
  • Context - transmission dependent segments have been created with equipment data:
    For Queue Equipment Data for KCSM Transmission:
    When the system queues data for kcsm transmission, then equipment data is queued for transmission to kcsm system.
  • Context - equipment data has been queued for kcsm transmission:
    For Log Equipment Processing for KCSM:
    When the system completes equipment processing, then equipment processing activities are logged for kcsm audit trail.
  • Context - kcsm processing requirement check has been completed:
    For Skip KCSM Processing:
    When kcsm processing is determined as not required, then system skips kcsm processing and proceeds to completion.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 equipment segment is received in the message
GIVEN
An N7 equipment segment is received in the message
Applied to: Extract Equipment ID from N7 Segment
WHEN
The system processes the N7 segment
THEN
Equipment ID information is extracted from the N7 segment data
Context: Equipment ID has been extracted from N7 segment
GIVEN
Equipment ID has been extracted from N7 segment
Applied to: Format Equipment ID using GCCCARFM Utility
WHEN
The system needs to format the equipment ID
THEN
GCCCARFM utility is called to standardize the equipment ID format
Context: Equipment ID has been formatted using GCCCARFM utility
GIVEN
Equipment ID has been formatted using GCCCARFM utility
Applied to: Equipment ID Valid?
WHEN
The system validates the equipment ID
THEN
Equipment ID is confirmed as valid or invalid based on business validation rules
Applied to: Equipment ID Validation Error
WHEN
Equipment ID validation fails
THEN
System handles validation error and proceeds to equipment processing completion
Context: Equipment ID has been validated as valid
GIVEN
Equipment ID has been validated as valid
Applied to: Update Car ID Information in Cargo Records
WHEN
The system processes cargo records associated with the equipment
THEN
Car ID information is updated in the relevant cargo records
Context: Equipment ID information has been processed and cargo records updated
GIVEN
Equipment ID information has been processed and cargo records updated
Applied to: KCSM Processing Required?
WHEN
The system evaluates KCSM transmission requirements
THEN
System determines whether KCSM processing is required for this equipment
Context: KCSM processing has been determined as required
GIVEN
KCSM processing has been determined as required
Applied to: Check Disposition Code for KCSM Integration
WHEN
The system checks the disposition code associated with the equipment
THEN
Disposition code is evaluated to determine specific KCSM integration actions
Context: Disposition code indicates KCSM integration is required
GIVEN
Disposition code indicates KCSM integration is required
Applied to: Extract Equipment Details for KCSM
WHEN
The system extracts equipment details
THEN
All necessary equipment information is extracted for KCSM transmission
Context: Equipment details have been extracted for KCSM processing
GIVEN
Equipment details have been extracted for KCSM processing
Applied to: Include N7 Segment in EDI 350 Message Copy
WHEN
The system creates EDI 350 message copy
THEN
N7 segment information is included in the EDI 350 message copy
Context: N7 segment has been included in EDI 350 message copy
GIVEN
N7 segment has been included in EDI 350 message copy
Applied to: Add Equipment Information to Transmission File
WHEN
The system processes transmission file updates
THEN
Equipment information is added to the KCSM transmission file
Context: Equipment information has been added to transmission file
GIVEN
Equipment information has been added to transmission file
Applied to: Create Transmission Dependent Segment with Equipment Data
WHEN
The system creates transmission dependent segments
THEN
Dependent segments are created with equipment data for KCSM transmission
Context: Transmission dependent segments have been created with equipment data
GIVEN
Transmission dependent segments have been created with equipment data
Applied to: Queue Equipment Data for KCSM Transmission
WHEN
The system queues data for KCSM transmission
THEN
Equipment data is queued for transmission to KCSM system
Context: Equipment data has been queued for KCSM transmission
GIVEN
Equipment data has been queued for KCSM transmission
Applied to: Log Equipment Processing for KCSM
WHEN
The system completes equipment processing
THEN
Equipment processing activities are logged for KCSM audit trail
Context: KCSM processing requirement check has been completed
GIVEN
KCSM processing requirement check has been completed
Applied to: Skip KCSM Processing
WHEN
KCSM processing is determined as not required
THEN
System skips KCSM processing and proceeds to completion
R-GCX016-cbl-02304 (+32) File: GCX016.cbl Cargo Processing by Bond Number Merged 33 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Processing by Bond Number':
  • Context - an x4 customs release segment is being processed:
    For Extract Bond Control Number from X4 Segment:
    When the system needs to process cargo by bond number, then the bond control number is extracted from the x4 segment and stored for cargo lookup operations.
    For Extract Bond Control Number from X4 Segment:
    When the system processes the x4 segment for bond number information, then the bond control number is extracted from the x4 segment and made available for cargo grouping operations.
  • Context - a bond control number has been extracted from the x4 segment:
    For Validate Bond Number Format:
    When the system validates the bond number format, then the bond number must be non-blank and meet format requirements to proceed with processing.
    For Validate Bond Number Format:
    When the system validates the bond number format against customs requirements, then processing continues to cargo search if format is valid, otherwise bond number error processing is triggered.
  • Context - a valid bond control number has been identified:
    For Set Bond Processing Flag:
    When the system prepares for bond-based processing, then the bond processing flag is set to enable group processing mode.
  • Context - bond processing mode has been activated:
    For Initialize Cargo Counter:
    When the system begins processing cargo records for a bond, then the cargo counter is initialized to zero to track processing progress.
  • Context - a valid bond control number is available for processing:
    For Fetch First Cargo Record by Bond Number:
    When the system searches for cargo records associated with the bond, then the first cargo record matching the bond number is retrieved from the gccc-cargo-root database.
  • Context - a database search for cargo records by bond number has been executed:
    For Cargo Found?:
    When the system evaluates the search results, then if cargo records are found, processing continues; if no cargo records exist, bond processing is completed.
  • Context - a cargo record has been found for the current bond number:
    For Load Cargo Record Details:
    When the system prepares to process the cargo record, then all cargo record details and associated status segments are loaded into working storage.
  • Context - a cargo record has been loaded for processing within a bond group:
    For Process Current Cargo Record:
    When the system processes the individual cargo record, then the cargo record is processed according to the disposition code rules and business logic.
  • Context - a cargo record is being processed and a disposition code is available 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 customs rules and the appropriate action is determined for the cargo.
  • 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 updated in the gcsuss09 status segments and the cargo record is saved to the database.
  • Context - a cargo record has been successfully processed within a bond group:
    For Increment Cargo Counter:
    When the system updates processing statistics, then the cargo counter is incremented by one to reflect the completed processing.
  • Context - a cargo record has been processed and more records may exist for the same bond:
    For Fetch Next Cargo Record with Same Bond:
    When the system searches for the next cargo record with the same bond number, then the next cargo record matching the bond number is retrieved from the database if it exists.
  • Context - the system has attempted to retrieve the next cargo record for a bond number:
    For More Cargo Records?:
    When the system evaluates if more cargo records exist, then if more cargo records exist, processing continues with the next record; if no more records exist, bond processing moves to completion.
  • Context - all cargo records for a bond number have been processed:
    For Log Bond Processing Summary:
    When the system completes bond processing, then a summary log entry is created showing the bond number, cargo count processed, and processing results.
  • Context - bond processing has been completed and summary logged:
    For Generate Bond Processing Report:
    When the system generates processing reports, then a detailed bond processing report is created containing all cargo records processed and their final status.
  • Context - all cargo records for a bond have been processed and reports generated:
    For Complete Bond Processing:
    When the system completes bond processing, then bond processing is marked as complete and system resources are cleaned up.
  • Context - bond number validation has failed:
    For Log Bond Validation Error:
    When the system handles the validation error, then an error log entry is created documenting the invalid bond number and validation failure reason.
  • Context - a bond validation error has been logged:
    For Generate Error Message:
    When the system generates error notifications, then an error message is created indicating bond number validation failure and appropriate corrective actions.
  • Context - bond number validation has failed and error messages have been generated:
    For Skip Bond Processing:
    When the system determines next processing steps, then bond processing is skipped and the system continues with other available processing options.
  • Context - an x4 segment has been processed for bond number extraction:
    For Bond Number Present?:
    When the system checks for the presence of a bond control number, then processing continues to bond validation if bond number exists, otherwise bond number error processing is triggered.
  • Context - a valid bond control number has been extracted and validated:
    For Search All Cargo Records with Same Bond Number:
    When the system searches the cargo database using the bond control number as the key, then all cargo records with matching bond numbers are retrieved for disposition code processing.
  • Context - a search has been performed for cargo records with a specific bond number:
    For Cargo Records Found?:
    When the system evaluates the search results, then processing continues to cargo processing if records are found, otherwise no cargo found message is generated.
  • Context - cargo records with matching bond numbers have been found:
    For Process Each Cargo Record with Bond Number:
    When the system processes each cargo record individually, then each cargo record is prepared for disposition code application and status updates.
  • Context - cargo records with matching bond numbers are being processed and a disposition code exists in the x4 segment:
    For Apply Disposition Code to All Bond Cargo:
    When the system applies the disposition code to each cargo record in the bond group, then all cargo records in the bond group receive the same disposition code treatment for consistent processing.
  • Context - disposition codes have been applied to all cargo records in a bond group:
    For Update Status Arrays for All Bond Cargo:
    When the system updates the status arrays for each cargo record, then all cargo records in the bond group have their status arrays updated to reflect the new disposition code status.
  • Context - disposition codes have been applied and status arrays updated for bond cargo:
    For Validate Disposition Code Against Bond Cargo:
    When the system validates the disposition code against each cargo record's current status and characteristics, then the disposition code application is confirmed as valid for each cargo record or validation errors are identified.
  • Context - a cargo record in the bond group has been processed:
    For More Cargo Records?:
    When the system checks if more cargo records in the bond group need processing, then processing continues with the next cargo record if more exist, otherwise proceeds to message generation.
  • Context - all cargo records in the bond group have been processed:
    For Generate Bond Processing Messages:
    When the system generates processing messages for the bond operation, then messages are created documenting the disposition code application results for all cargo in the bond group.
  • Context - bond processing messages have been generated:
    For Log Bond Processing Results:
    When the system logs the bond processing results, then all bond processing activities and results are recorded in the system logs for audit trail purposes.
  • Context - bond number validation has failed or no bond number is present:
    For Generate Bond Number Error Message:
    When the system generates an error message for the bond number issue, then an appropriate error message is created indicating the specific bond number validation failure.
  • Context - a search for cargo records by bond number has returned no results:
    For Generate No Cargo Found Message:
    When the system generates a no cargo found message, then a message is created indicating that no cargo records exist for the specified bond number.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 customs release segment is being processed
GIVEN
An X4 customs release segment is being processed
Applied to: Extract Bond Control Number from X4 Segment
WHEN
The system needs to process cargo by bond number
THEN
The bond control number is extracted from the X4 segment and stored for cargo lookup operations
Applied to: Extract Bond Control Number from X4 Segment
WHEN
The system processes the X4 segment for bond number information
THEN
The bond control number is extracted from the X4 segment and made available for cargo grouping operations
Context: A bond control number has been extracted from the X4 segment
GIVEN
A bond control number has been extracted from the X4 segment
Applied to: Validate Bond Number Format
WHEN
The system validates the bond number format
THEN
The bond number must be non-blank and meet format requirements to proceed with processing
Applied to: Validate Bond Number Format
WHEN
The system validates the bond number format against customs requirements
THEN
Processing continues to cargo search if format is valid, otherwise bond number error processing is triggered
Context: A valid bond control number has been identified
GIVEN
A valid bond control number has been identified
Applied to: Set Bond Processing Flag
WHEN
The system prepares for bond-based processing
THEN
The bond processing flag is set to enable group processing mode
Context: Bond processing mode has been activated
GIVEN
Bond processing mode has been activated
Applied to: Initialize Cargo Counter
WHEN
The system begins processing cargo records for a bond
THEN
The cargo counter is initialized to zero to track processing progress
Context: A valid bond control number is available for processing
GIVEN
A valid bond control number is available for processing
Applied to: Fetch First Cargo Record by Bond Number
WHEN
The system searches for cargo records associated with the bond
THEN
The first cargo record matching the bond number is retrieved from the GCCC-CARGO-ROOT database
Context: A database search for cargo records by bond number has been executed
GIVEN
A database search for cargo records by bond number has been executed
Applied to: Cargo Found?
WHEN
The system evaluates the search results
THEN
If cargo records are found, processing continues; if no cargo records exist, bond processing is completed
Context: A cargo record has been found for the current bond number
GIVEN
A cargo record has been found for the current bond number
Applied to: Load Cargo Record Details
WHEN
The system prepares to process the cargo record
THEN
All cargo record details and associated status segments are loaded into working storage
Context: A cargo record has been loaded for processing within a bond group
GIVEN
A cargo record has been loaded for processing within a bond group
Applied to: Process Current Cargo Record
WHEN
The system processes the individual cargo record
THEN
The cargo record is processed according to the disposition code rules and business logic
Context: A cargo record is being processed and a disposition code is available from the X4 segment
GIVEN
A cargo record is being processed and a disposition code is available 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 customs rules and the appropriate action is determined for the cargo
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 updated in the GCSUSS09 status segments and the cargo record is saved to the database
Context: A cargo record has been successfully processed within a bond group
GIVEN
A cargo record has been successfully processed within a bond group
Applied to: Increment Cargo Counter
WHEN
The system updates processing statistics
THEN
The cargo counter is incremented by one to reflect the completed processing
Context: A cargo record has been processed and more records may exist for the same bond
GIVEN
A cargo record has been processed and more records may exist for the same bond
Applied to: Fetch Next Cargo Record with Same Bond
WHEN
The system searches for the next cargo record with the same bond number
THEN
The next cargo record matching the bond number is retrieved from the database if it exists
Context: The system has attempted to retrieve the next cargo record for a bond number
GIVEN
The system has attempted to retrieve the next cargo record for a bond number
Applied to: More Cargo Records?
WHEN
The system evaluates if more cargo records exist
THEN
If more cargo records exist, processing continues with the next record; if no more records exist, bond processing moves to completion
Context: All cargo records for a bond number have been processed
GIVEN
All cargo records for a bond number have been processed
Applied to: Log Bond Processing Summary
WHEN
The system completes bond processing
THEN
A summary log entry is created showing the bond number, cargo count processed, and processing results
Context: Bond processing has been completed and summary logged
GIVEN
Bond processing has been completed and summary logged
Applied to: Generate Bond Processing Report
WHEN
The system generates processing reports
THEN
A detailed bond processing report is created containing all cargo records processed and their final status
Context: All cargo records for a bond have been processed and reports generated
GIVEN
All cargo records for a bond have been processed and reports generated
Applied to: Complete Bond Processing
WHEN
The system completes bond processing
THEN
Bond processing is marked as complete and system resources are cleaned up
Context: Bond number validation has failed
GIVEN
Bond number validation has failed
Applied to: Log Bond Validation Error
WHEN
The system handles the validation error
THEN
An error log entry is created documenting the invalid bond number and validation failure reason
Context: A bond validation error has been logged
GIVEN
A bond validation error has been logged
Applied to: Generate Error Message
WHEN
The system generates error notifications
THEN
An error message is created indicating bond number validation failure and appropriate corrective actions
Context: Bond number validation has failed and error messages have been generated
GIVEN
Bond number validation has failed and error messages have been generated
Applied to: Skip Bond Processing
WHEN
The system determines next processing steps
THEN
Bond processing is skipped and the system continues with other available processing options
Context: An X4 segment has been processed for bond number extraction
GIVEN
An X4 segment has been processed for bond number extraction
Applied to: Bond Number Present?
WHEN
The system checks for the presence of a bond control number
THEN
Processing continues to bond validation if bond number exists, otherwise bond number error processing is triggered
Context: A valid bond control number has been extracted and validated
GIVEN
A valid bond control number has been extracted and validated
Applied to: Search All Cargo Records with Same Bond Number
WHEN
The system searches the cargo database using the bond control number as the key
THEN
All cargo records with matching bond numbers are retrieved for disposition code processing
Context: A search has been performed for cargo records with a specific bond number
GIVEN
A search has been performed for cargo records with a specific bond number
Applied to: Cargo Records Found?
WHEN
The system evaluates the search results
THEN
Processing continues to cargo processing if records are found, otherwise no cargo found message is generated
Context: Cargo records with matching bond numbers have been found
GIVEN
Cargo records with matching bond numbers have been found
Applied to: Process Each Cargo Record with Bond Number
WHEN
The system processes each cargo record individually
THEN
Each cargo record is prepared for disposition code application and status updates
Context: Cargo records with matching bond numbers are being processed and a disposition code exists in the X4 segment
GIVEN
Cargo records with matching bond numbers are being processed and a disposition code exists in the X4 segment
Applied to: Apply Disposition Code to All Bond Cargo
WHEN
The system applies the disposition code to each cargo record in the bond group
THEN
All cargo records in the bond group receive the same disposition code treatment for consistent processing
Context: Disposition codes have been applied to all cargo records in a bond group
GIVEN
Disposition codes have been applied to all cargo records in a bond group
Applied to: Update Status Arrays for All Bond Cargo
WHEN
The system updates the status arrays for each cargo record
THEN
All cargo records in the bond group have their status arrays updated to reflect the new disposition code status
Context: Disposition codes have been applied and status arrays updated for bond cargo
GIVEN
Disposition codes have been applied and status arrays updated for bond cargo
Applied to: Validate Disposition Code Against Bond Cargo
WHEN
The system validates the disposition code against each cargo record's current status and characteristics
THEN
The disposition code application is confirmed as valid for each cargo record or validation errors are identified
Context: A cargo record in the bond group has been processed
GIVEN
A cargo record in the bond group has been processed
Applied to: More Cargo Records?
WHEN
The system checks if more cargo records in the bond group need processing
THEN
Processing continues with the next cargo record if more exist, otherwise proceeds to message generation
Context: All cargo records in the bond group have been processed
GIVEN
All cargo records in the bond group have been processed
Applied to: Generate Bond Processing Messages
WHEN
The system generates processing messages for the bond operation
THEN
Messages are created documenting the disposition code application results for all cargo in the bond group
Context: Bond processing messages have been generated
GIVEN
Bond processing messages have been generated
Applied to: Log Bond Processing Results
WHEN
The system logs the bond processing results
THEN
All bond processing activities and results are recorded in the system logs for audit trail purposes
Context: Bond number validation has failed or no bond number is present
GIVEN
Bond number validation has failed or no bond number is present
Applied to: Generate Bond Number Error Message
WHEN
The system generates an error message for the bond number issue
THEN
An appropriate error message is created indicating the specific bond number validation failure
Context: A search for cargo records by bond number has returned no results
GIVEN
A search for cargo records by bond number has returned no results
Applied to: Generate No Cargo Found Message
WHEN
The system generates a no cargo found message
THEN
A message is created indicating that no cargo records exist for the specified bond number
R-GCX016-cbl-02323 (+37) File: GCX016.cbl Cargo Processing by Car and Waybill Merged 38 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Processing by Car and Waybill':
  • Context - a cargo processing request by car and waybill combination is initiated:
    For Car ID Available?:
    When the system checks for car id availability in the n7 segment data, then if car id is not available, log 'no car id available' and proceed to alternative cargo retrieval method.
  • Context - car id is available for cargo processing:
    For Waybill Number Available?:
    When the system checks for waybill number availability in the x4 segment data, then if waybill number is not available, log 'no waybill available' and proceed to alternative cargo retrieval method.
  • Context - car id is available from n7 segment:
    For Validate Car ID Format:
    When the system validates the car id format for proper structure and length, then car id must meet required format specifications to proceed with cargo search.
  • Context - waybill number is available from x4 segment:
    For Validate Waybill Number Format:
    When the system validates the waybill number format for proper structure and length, then waybill number must meet required format specifications to proceed with cargo search.
  • Context - valid car id and waybill number are available:
    For Search Cargo by Car ID and Waybill Combination:
    When the system performs cargo database search using car id and waybill combination, then system retrieves all cargo records matching the exact car id and waybill number combination.
    For Build Car-Waybill Key:
    When the system needs to search for cargo records by car and waybill, then a composite key is built combining the car id and waybill number for database search operations.
  • Context - cargo search by car id and waybill has been executed:
    For Cargo Records Found?:
    When the system evaluates the search results, then if no cargo records are found, log 'no cargo found for car/waybill' and proceed to alternative cargo retrieval method.
  • Context - cargo records exist for the specified car id and waybill combination:
    For Retrieve All Matching Cargo Records:
    When the system retrieves matching cargo records from the database, then all cargo records matching the car id and waybill combination are loaded for individual processing.
  • Context - multiple cargo records are retrieved for a car and waybill combination:
    For Process Each Cargo Record:
    When the system iterates through each cargo record, then each cargo record is processed individually with the same disposition code and processing parameters.
  • Context - a cargo record is being processed:
    For Update Cargo Status Information:
    When the system applies disposition codes and business rules to the cargo, then cargo status information is updated to reflect the current processing state and any status changes.
  • Context - cargo records are being processed with a specific disposition code:
    For Apply Disposition Codes to Cargo:
    When the system applies the disposition code to each cargo record, then the disposition code is processed according to its type (hold, release, status info) and applied to the cargo's status array.
  • Context - disposition codes are applied to cargo records in a car and waybill group:
    For Calculate Release Quantities:
    When the system processes quantity-affecting disposition codes, then release quantities are calculated by adding or subtracting quantities based on disposition code action, ensuring quantities do not go below zero.
  • Context - cargo records have been processed with updated status and quantities:
    For Update Cargo Database Records:
    When the system commits changes to the cargo database, then all cargo records in the car and waybill group are updated in the database with new status, quantities, and processing timestamps.
  • Context - cargo records in a car and waybill group have been successfully processed:
    For Generate Processing Messages:
    When the system generates processing messages, then appropriate messages are generated including merlin notifications, broker notifications, and status change messages for the entire car and waybill group.
  • Context - car and waybill processing cannot proceed due to missing car id, missing waybill, or no cargo found:
    For Try Alternative Cargo Retrieval Method:
    When the system invokes alternative cargo retrieval methods, then system attempts to process cargo using individual cargo processing method or by bond number method as alternatives.
  • Context - an n7 equipment segment is available in the message:
    For Extract Car ID from N7 Segment:
    When the system processes the n7 segment for car identification, then the car initial and car number are extracted and combined to form the complete car id.
  • Context - an x4 customs release segment contains waybill information:
    For Extract Waybill Number from X4 Segment:
    When the system processes the x4 segment for waybill identification, then the waybill number is extracted from the x4 segment data.
  • Context - car initial and car number have been extracted from n7 segment:
    For Format Equipment ID using GCCCARFM:
    When the system needs to format the equipment id for database operations, then the gcccarfm formatting routine is called to standardize the equipment id format.
  • Context - car id and waybill number have been extracted from message segments:
    For Car ID and Waybill Valid?:
    When the system validates the car-waybill combination, then processing continues if both values are valid, otherwise error handling is triggered.
  • Context - a car-waybill composite key has been constructed:
    For Search Cargo Database by Car-Waybill Index:
    When the system searches the cargo database using the car-waybill index, then all cargo records matching the car-waybill combination are identified.
  • Context - a database search has been performed using car-waybill key:
    For Cargo Records Found?:
    When the system evaluates the search results, then if cargo records are found, processing continues with record retrieval, otherwise error handling is initiated.
  • Context - cargo records exist for the car-waybill combination:
    For Retrieve All Matching Cargo Records:
    When the system retrieves matching cargo records, then all cargo records associated with the car-waybill combination are loaded for processing.
  • Context - cargo records have been retrieved from the database:
    For Validate Cargo Record Status:
    When the system validates each cargo record status, then only cargo records with valid processing status are included in subsequent operations.
  • Context - valid cargo records have been retrieved and validated:
    For Multiple Records Found?:
    When the system counts the number of valid cargo records, then if multiple records exist, batch processing is initiated, otherwise single record processing is performed.
  • Context - multiple valid cargo records exist for the car-waybill combination:
    For Process Each Cargo Record Individually:
    When the system processes the cargo records, then each cargo record is processed individually with the same disposition code and business rules applied.
  • Context - only one valid cargo record exists for the car-waybill combination:
    For Apply Disposition Code to Single Record:
    When the system applies the disposition code, then the disposition code from the x4 segment is applied to the single cargo record.
  • Context - disposition codes have been applied to cargo records:
    For Update Cargo Status Arrays:
    When the system updates cargo status information, then cargo status arrays are updated with new disposition codes, release quantities, and status flags.
  • Context - cargo records have been processed for the current car-waybill combination:
    For Check for Related Equipment:
    When the system checks for related equipment, then any additional cars or equipment associated with the cargo are identified for potential processing.
  • Context - current car processing is complete and related equipment has been checked:
    For Process All Cars in Consist?:
    When the system evaluates whether additional cars need processing, then if additional cars require processing, the system moves to the next car, otherwise it proceeds to release validation.
  • Context - additional cars in the consist require processing:
    For Move to Next Car in Consist:
    When the system moves to the next car, then processing continues with the next car id extraction and cargo record processing.
  • Context - all cars in the consist have been processed:
    For Validate Release Eligibility Across All Cars:
    When the system validates release eligibility across all cars, then release eligibility is confirmed for all cargo records before proceeding with release message generation.
  • Context - all cargo records have been validated for release eligibility:
    For Generate Multi-Cargo Release Messages:
    When the system generates release messages, then appropriate release messages are created for all eligible cargo records in the car-waybill group.
  • Context - release messages have been generated for eligible cargo:
    For Update All Related Cargo Records:
    When the system updates cargo records, then all related cargo records are updated with final status, disposition codes, and processing timestamps.
  • Context - all cargo records have been updated with final status:
    For Complete Car-Waybill Processing:
    When the system completes car-waybill processing, then processing is marked as complete and the system prepares for result logging.
  • Context - car-waybill processing has been completed:
    For Log Processing Results:
    When the system logs processing results, then processing statistics, success counts, error counts, and audit information are recorded in system logs.
  • Context - no cargo records exist for the car-waybill combination:
    For Handle Cargo Not Found Error:
    When the system handles the cargo not found condition, then error messages are generated and the system may create new cargo records or foreign bill records as appropriate.
  • Context - cargo not found error has been triggered and foreign bill creation is required:
    For Create Foreign Bill Record:
    When the system creates a foreign bill record, then a new foreign bill record is created with car-waybill information for subsequent processing.
  • Context - a foreign bill record has been created or new cargo initialization is required:
    For Initialize New Cargo with Car-Waybill Data:
    When the system initializes new cargo with car-waybill data, then new cargo records are created and populated with available car id, waybill number, and disposition code information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing request by car and waybill combination is initiated
GIVEN
A cargo processing request by car and waybill combination is initiated
Applied to: Car ID Available?
WHEN
The system checks for car ID availability in the N7 segment data
THEN
If car ID is not available, log 'No Car ID Available' and proceed to alternative cargo retrieval method
Context: Car ID is available for cargo processing
GIVEN
Car ID is available for cargo processing
Applied to: Waybill Number Available?
WHEN
The system checks for waybill number availability in the X4 segment data
THEN
If waybill number is not available, log 'No Waybill Available' and proceed to alternative cargo retrieval method
Context: Car ID is available from N7 segment
GIVEN
Car ID is available from N7 segment
Applied to: Validate Car ID Format
WHEN
The system validates the car ID format for proper structure and length
THEN
Car ID must meet required format specifications to proceed with cargo search
Context: Waybill number is available from X4 segment
GIVEN
Waybill number is available from X4 segment
Applied to: Validate Waybill Number Format
WHEN
The system validates the waybill number format for proper structure and length
THEN
Waybill number must meet required format specifications to proceed with cargo search
Context: Valid car ID and waybill number are available
GIVEN
Valid car ID and waybill number are available
Applied to: Search Cargo by Car ID and Waybill Combination
WHEN
The system performs cargo database search using car ID and waybill combination
THEN
System retrieves all cargo records matching the exact car ID and waybill number combination
Applied to: Build Car-Waybill Key
WHEN
The system needs to search for cargo records by car and waybill
THEN
A composite key is built combining the car ID and waybill number for database search operations
Context: Cargo search by car ID and waybill has been executed
GIVEN
Cargo search by car ID and waybill has been executed
Applied to: Cargo Records Found?
WHEN
The system evaluates the search results
THEN
If no cargo records are found, log 'No Cargo Found for Car/Waybill' and proceed to alternative cargo retrieval method
Context: Cargo records exist for the specified car ID and waybill combination
GIVEN
Cargo records exist for the specified car ID and waybill combination
Applied to: Retrieve All Matching Cargo Records
WHEN
The system retrieves matching cargo records from the database
THEN
All cargo records matching the car ID and waybill combination are loaded for individual processing
Context: Multiple cargo records are retrieved for a car and waybill combination
GIVEN
Multiple cargo records are retrieved for a car and waybill combination
Applied to: Process Each Cargo Record
WHEN
The system iterates through each cargo record
THEN
Each cargo record is processed individually with the same disposition code and processing parameters
Context: A cargo record is being processed
GIVEN
A cargo record is being processed
Applied to: Update Cargo Status Information
WHEN
The system applies disposition codes and business rules to the cargo
THEN
Cargo status information is updated to reflect the current processing state and any status changes
Context: Cargo records are being processed with a specific disposition code
GIVEN
Cargo records are being processed with a specific disposition code
Applied to: Apply Disposition Codes to Cargo
WHEN
The system applies the disposition code to each cargo record
THEN
The disposition code is processed according to its type (hold, release, status info) and applied to the cargo's status array
Context: Disposition codes are applied to cargo records in a car and waybill group
GIVEN
Disposition codes are applied to cargo records in a car and waybill group
Applied to: Calculate Release Quantities
WHEN
The system processes quantity-affecting disposition codes
THEN
Release quantities are calculated by adding or subtracting quantities based on disposition code action, ensuring quantities do not go below zero
Context: Cargo records have been processed with updated status and quantities
GIVEN
Cargo records have been processed with updated status and quantities
Applied to: Update Cargo Database Records
WHEN
The system commits changes to the cargo database
THEN
All cargo records in the car and waybill group are updated in the database with new status, quantities, and processing timestamps
Context: Cargo records in a car and waybill group have been successfully processed
GIVEN
Cargo records in a car and waybill group have been successfully processed
Applied to: Generate Processing Messages
WHEN
The system generates processing messages
THEN
Appropriate messages are generated including Merlin notifications, broker notifications, and status change messages for the entire car and waybill group
Context: Car and waybill processing cannot proceed due to missing car ID, missing waybill, or no cargo found
GIVEN
Car and waybill processing cannot proceed due to missing car ID, missing waybill, or no cargo found
Applied to: Try Alternative Cargo Retrieval Method
WHEN
The system invokes alternative cargo retrieval methods
THEN
System attempts to process cargo using individual cargo processing method or by bond number method as alternatives
Context: An N7 equipment segment is available in the message
GIVEN
An N7 equipment segment is available in the message
Applied to: Extract Car ID from N7 Segment
WHEN
The system processes the N7 segment for car identification
THEN
The car initial and car number are extracted and combined to form the complete car ID
Context: An X4 customs release segment contains waybill information
GIVEN
An X4 customs release segment contains waybill information
Applied to: Extract Waybill Number from X4 Segment
WHEN
The system processes the X4 segment for waybill identification
THEN
The waybill number is extracted from the X4 segment data
Context: Car initial and car number have been extracted from N7 segment
GIVEN
Car initial and car number have been extracted from N7 segment
Applied to: Format Equipment ID using GCCCARFM
WHEN
The system needs to format the equipment ID for database operations
THEN
The GCCCARFM formatting routine is called to standardize the equipment ID format
Context: Car ID and waybill number have been extracted from message segments
GIVEN
Car ID and waybill number have been extracted from message segments
Applied to: Car ID and Waybill Valid?
WHEN
The system validates the car-waybill combination
THEN
Processing continues if both values are valid, otherwise error handling is triggered
Context: A car-waybill composite key has been constructed
GIVEN
A car-waybill composite key has been constructed
Applied to: Search Cargo Database by Car-Waybill Index
WHEN
The system searches the cargo database using the car-waybill index
THEN
All cargo records matching the car-waybill combination are identified
Context: A database search has been performed using car-waybill key
GIVEN
A database search has been performed using car-waybill key
Applied to: Cargo Records Found?
WHEN
The system evaluates the search results
THEN
If cargo records are found, processing continues with record retrieval, otherwise error handling is initiated
Context: Cargo records exist for the car-waybill combination
GIVEN
Cargo records exist for the car-waybill combination
Applied to: Retrieve All Matching Cargo Records
WHEN
The system retrieves matching cargo records
THEN
All cargo records associated with the car-waybill combination are loaded for processing
Context: Cargo records have been retrieved from the database
GIVEN
Cargo records have been retrieved from the database
Applied to: Validate Cargo Record Status
WHEN
The system validates each cargo record status
THEN
Only cargo records with valid processing status are included in subsequent operations
Context: Valid cargo records have been retrieved and validated
GIVEN
Valid cargo records have been retrieved and validated
Applied to: Multiple Records Found?
WHEN
The system counts the number of valid cargo records
THEN
If multiple records exist, batch processing is initiated, otherwise single record processing is performed
Context: Multiple valid cargo records exist for the car-waybill combination
GIVEN
Multiple valid cargo records exist for the car-waybill combination
Applied to: Process Each Cargo Record Individually
WHEN
The system processes the cargo records
THEN
Each cargo record is processed individually with the same disposition code and business rules applied
Context: Only one valid cargo record exists for the car-waybill combination
GIVEN
Only one valid cargo record exists for the car-waybill combination
Applied to: Apply Disposition Code to Single Record
WHEN
The system applies the disposition code
THEN
The disposition code from the X4 segment is applied to the single cargo record
Context: Disposition codes have been applied to cargo records
GIVEN
Disposition codes have been applied to cargo records
Applied to: Update Cargo Status Arrays
WHEN
The system updates cargo status information
THEN
Cargo status arrays are updated with new disposition codes, release quantities, and status flags
Context: Cargo records have been processed for the current car-waybill combination
GIVEN
Cargo records have been processed for the current car-waybill combination
Applied to: Check for Related Equipment
WHEN
The system checks for related equipment
THEN
Any additional cars or equipment associated with the cargo are identified for potential processing
Context: Current car processing is complete and related equipment has been checked
GIVEN
Current car processing is complete and related equipment has been checked
Applied to: Process All Cars in Consist?
WHEN
The system evaluates whether additional cars need processing
THEN
If additional cars require processing, the system moves to the next car, otherwise it proceeds to release validation
Context: Additional cars in the consist require processing
GIVEN
Additional cars in the consist require processing
Applied to: Move to Next Car in Consist
WHEN
The system moves to the next car
THEN
Processing continues with the next car ID extraction and cargo record processing
Context: All cars in the consist have been processed
GIVEN
All cars in the consist have been processed
Applied to: Validate Release Eligibility Across All Cars
WHEN
The system validates release eligibility across all cars
THEN
Release eligibility is confirmed for all cargo records before proceeding with release message generation
Context: All cargo records have been validated for release eligibility
GIVEN
All cargo records have been validated for release eligibility
Applied to: Generate Multi-Cargo Release Messages
WHEN
The system generates release messages
THEN
Appropriate release messages are created for all eligible cargo records in the car-waybill group
Context: Release messages have been generated for eligible cargo
GIVEN
Release messages have been generated for eligible cargo
Applied to: Update All Related Cargo Records
WHEN
The system updates cargo records
THEN
All related cargo records are updated with final status, disposition codes, and processing timestamps
Context: All cargo records have been updated with final status
GIVEN
All cargo records have been updated with final status
Applied to: Complete Car-Waybill Processing
WHEN
The system completes car-waybill processing
THEN
Processing is marked as complete and the system prepares for result logging
Context: Car-waybill processing has been completed
GIVEN
Car-waybill processing has been completed
Applied to: Log Processing Results
WHEN
The system logs processing results
THEN
Processing statistics, success counts, error counts, and audit information are recorded in system logs
Context: No cargo records exist for the car-waybill combination
GIVEN
No cargo records exist for the car-waybill combination
Applied to: Handle Cargo Not Found Error
WHEN
The system handles the cargo not found condition
THEN
Error messages are generated and the system may create new cargo records or foreign bill records as appropriate
Context: Cargo not found error has been triggered and foreign bill creation is required
GIVEN
Cargo not found error has been triggered and foreign bill creation is required
Applied to: Create Foreign Bill Record
WHEN
The system creates a foreign bill record
THEN
A new foreign bill record is created with car-waybill information for subsequent processing
Context: A foreign bill record has been created or new cargo initialization is required
GIVEN
A foreign bill record has been created or new cargo initialization is required
Applied to: Initialize New Cargo with Car-Waybill Data
WHEN
The system initializes new cargo with car-waybill data
THEN
New cargo records are created and populated with available car ID, waybill number, and disposition code information
R-GCX016-cbl-02337 (+8) File: GCX016.cbl Bond Number Validation for Cargo Processing Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Number Validation for Cargo Processing':
  • Context - an x4 segment is received for cargo processing:
    For Bond Number Present?:
    When the system checks for bond control number presence in the x4 segment, then if bond control number is empty or spaces, log bond validation error and skip bond-based processing, otherwise proceed to bond format validation.
  • Context - a bond control number is present in the x4 segment:
    For Valid Bond Format?:
    When the system validates the bond number format against system requirements, then if bond format is invalid, log invalid bond format error and skip bond-based processing, otherwise proceed to search cargo records by bond number.
  • Context - a valid bond control number format is confirmed:
    For Cargo Records Found with Bond?:
    When the system searches cargo records using the bond control number as search criteria, then if no cargo records are found with the bond number, generate bond not found message and skip bond-based processing, otherwise proceed to validate bond number against system tables.
  • Context - cargo records are found with the bond control number:
    For Bond Number Exists in System?:
    When the system validates the bond number against authorized bond system tables, then if bond number does not exist in system tables, log bond validation error and skip bond-based processing, otherwise mark bond as valid for processing.
  • Context - bond number exists in system tables and cargo records are found:
    For Mark Bond as Valid for Processing:
    When the system completes bond validation successfully, then mark bond as valid for processing and proceed to bond-based cargo processing.
  • Context - bond validation fails due to missing bond number or bond not found in system:
    For Log Bond Validation Error:
    When the system encounters bond validation failure, then log bond validation error with appropriate error details and skip bond-based processing.
  • Context - no cargo records are found with the provided bond control number:
    For Generate Bond Not Found Message:
    When the system completes cargo record search with no results, then generate bond not found message and skip bond-based processing.
  • Context - bond control number is present but format validation fails:
    For Log Invalid Bond Format Error:
    When the system validates bond number format, then log invalid bond format error and skip bond-based processing.
  • Context - bond number is validated and marked as valid for processing:
    For Proceed to Bond-based Cargo Processing:
    When the system completes bond validation successfully, then proceed to bond-based cargo processing for all cargo records with the same bond control number.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is received for cargo processing
GIVEN
An X4 segment is received for cargo processing
Applied to: Bond Number Present?
WHEN
The system checks for bond control number presence in the X4 segment
THEN
If bond control number is empty or spaces, log bond validation error and skip bond-based processing, otherwise proceed to bond format validation
Context: A bond control number is present in the X4 segment
GIVEN
A bond control number is present in the X4 segment
Applied to: Valid Bond Format?
WHEN
The system validates the bond number format against system requirements
THEN
If bond format is invalid, log invalid bond format error and skip bond-based processing, otherwise proceed to search cargo records by bond number
Context: A valid bond control number format is confirmed
GIVEN
A valid bond control number format is confirmed
Applied to: Cargo Records Found with Bond?
WHEN
The system searches cargo records using the bond control number as search criteria
THEN
If no cargo records are found with the bond number, generate bond not found message and skip bond-based processing, otherwise proceed to validate bond number against system tables
Context: Cargo records are found with the bond control number
GIVEN
Cargo records are found with the bond control number
Applied to: Bond Number Exists in System?
WHEN
The system validates the bond number against authorized bond system tables
THEN
If bond number does not exist in system tables, log bond validation error and skip bond-based processing, otherwise mark bond as valid for processing
Context: Bond number exists in system tables and cargo records are found
GIVEN
Bond number exists in system tables and cargo records are found
Applied to: Mark Bond as Valid for Processing
WHEN
The system completes bond validation successfully
THEN
Mark bond as valid for processing and proceed to bond-based cargo processing
Context: Bond validation fails due to missing bond number or bond not found in system
GIVEN
Bond validation fails due to missing bond number or bond not found in system
Applied to: Log Bond Validation Error
WHEN
The system encounters bond validation failure
THEN
Log bond validation error with appropriate error details and skip bond-based processing
Context: No cargo records are found with the provided bond control number
GIVEN
No cargo records are found with the provided bond control number
Applied to: Generate Bond Not Found Message
WHEN
The system completes cargo record search with no results
THEN
Generate bond not found message and skip bond-based processing
Context: Bond control number is present but format validation fails
GIVEN
Bond control number is present but format validation fails
Applied to: Log Invalid Bond Format Error
WHEN
The system validates bond number format
THEN
Log invalid bond format error and skip bond-based processing
Context: Bond number is validated and marked as valid for processing
GIVEN
Bond number is validated and marked as valid for processing
Applied to: Proceed to Bond-based Cargo Processing
WHEN
The system completes bond validation successfully
THEN
Proceed to bond-based cargo processing for all cargo records with the same bond control number
R-GCX016-cbl-02346 (+14) File: GCX016.cbl Car and Waybill Validation for Cargo Processing Merged 15 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car and Waybill Validation for Cargo Processing':
  • Context - a car id is received from n7 segment:
    For Format Car ID using GCCCARFM Utility:
    When the system formats the car id using gcccarfm utility, then the car id is standardized to proper format for validation.
  • Context - a car id has been formatted using gcccarfm utility:
    For Car ID Valid Format?:
    When the system checks if the car id format is valid, then the system proceeds to waybill extraction if valid, or logs format error if invalid.
  • Context - car id format is valid:
    For Extract Waybill Number from Entry:
    When the system extracts waybill number from x4 segment entry, then the waybill number is available for presence validation.
  • Context - waybill number has been extracted from entry:
    For Waybill Number Present?:
    When the system checks if waybill number is present, then the system proceeds to car id length validation if present, or logs missing waybill error if absent.
  • Context - waybill number is present:
    For Car ID Length Valid?:
    When the system validates car id length and characters, then the system proceeds to standards check if length is valid, or logs invalid length error if not valid.
  • Context - car id length is valid:
    For Car ID Meets Standards?:
    When the system checks car id against system standards, then the system proceeds to waybill format validation if standards are met, or logs standards error if not met.
  • Context - car id meets system standards:
    For Waybill Format Valid?:
    When the system validates waybill number format, then the system sets validation success flag if format is valid, or logs format error if invalid.
  • Context - waybill format is valid:
    For Set Validation Success Flag:
    When the system sets validation success flag, then the system proceeds to cargo processing by car and waybill.
  • Context - car id format is invalid:
    For Log Car ID Format Error:
    When the system logs car id format error, then the system sets validation failure flag and skips cargo processing.
  • Context - waybill number is not present:
    For Log Missing Waybill Error:
    When the system logs missing waybill error, then the system sets validation failure flag and skips cargo processing.
  • Context - car id length is invalid:
    For Log Invalid Car ID Length Error:
    When the system logs invalid car id length error, then the system sets validation failure flag and skips cargo processing.
  • Context - car id does not meet system standards:
    For Log Car ID Standards Error:
    When the system logs car id standards error, then the system sets validation failure flag and skips cargo processing.
  • Context - waybill format is invalid:
    For Log Waybill Format Error:
    When the system logs waybill format error, then the system sets validation failure flag and skips cargo processing.
  • Context - any validation error has been logged:
    For Set Validation Failure Flag:
    When the system sets validation failure flag, then the system skips cargo processing.
  • Context - validation failure flag is set:
    For Skip Cargo Processing:
    When the system encounters validation failure, then the system skips cargo processing and does not proceed with car and waybill operations.
👨‍💻 Technical ACs (Gherkin)
Context: A car ID is received from N7 segment
GIVEN
A car ID is received from N7 segment
Applied to: Format Car ID using GCCCARFM Utility
WHEN
The system formats the car ID using GCCCARFM utility
THEN
The car ID is standardized to proper format for validation
Context: A car ID has been formatted using GCCCARFM utility
GIVEN
A car ID has been formatted using GCCCARFM utility
Applied to: Car ID Valid Format?
WHEN
The system checks if the car ID format is valid
THEN
The system proceeds to waybill extraction if valid, or logs format error if invalid
Context: Car ID format is valid
GIVEN
Car ID format is valid
Applied to: Extract Waybill Number from Entry
WHEN
The system extracts waybill number from X4 segment entry
THEN
The waybill number is available for presence validation
Context: Waybill number has been extracted from entry
GIVEN
Waybill number has been extracted from entry
Applied to: Waybill Number Present?
WHEN
The system checks if waybill number is present
THEN
The system proceeds to car ID length validation if present, or logs missing waybill error if absent
Context: Waybill number is present
GIVEN
Waybill number is present
Applied to: Car ID Length Valid?
WHEN
The system validates car ID length and characters
THEN
The system proceeds to standards check if length is valid, or logs invalid length error if not valid
Context: Car ID length is valid
GIVEN
Car ID length is valid
Applied to: Car ID Meets Standards?
WHEN
The system checks car ID against system standards
THEN
The system proceeds to waybill format validation if standards are met, or logs standards error if not met
Context: Car ID meets system standards
GIVEN
Car ID meets system standards
Applied to: Waybill Format Valid?
WHEN
The system validates waybill number format
THEN
The system sets validation success flag if format is valid, or logs format error if invalid
Context: Waybill format is valid
GIVEN
Waybill format is valid
Applied to: Set Validation Success Flag
WHEN
The system sets validation success flag
THEN
The system proceeds to cargo processing by car and waybill
Context: Car ID format is invalid
GIVEN
Car ID format is invalid
Applied to: Log Car ID Format Error
WHEN
The system logs car ID format error
THEN
The system sets validation failure flag and skips cargo processing
Context: Waybill number is not present
GIVEN
Waybill number is not present
Applied to: Log Missing Waybill Error
WHEN
The system logs missing waybill error
THEN
The system sets validation failure flag and skips cargo processing
Context: Car ID length is invalid
GIVEN
Car ID length is invalid
Applied to: Log Invalid Car ID Length Error
WHEN
The system logs invalid car ID length error
THEN
The system sets validation failure flag and skips cargo processing
Context: Car ID does not meet system standards
GIVEN
Car ID does not meet system standards
Applied to: Log Car ID Standards Error
WHEN
The system logs car ID standards error
THEN
The system sets validation failure flag and skips cargo processing
Context: Waybill format is invalid
GIVEN
Waybill format is invalid
Applied to: Log Waybill Format Error
WHEN
The system logs waybill format error
THEN
The system sets validation failure flag and skips cargo processing
Context: Any validation error has been logged
GIVEN
Any validation error has been logged
Applied to: Set Validation Failure Flag
WHEN
The system sets validation failure flag
THEN
The system skips cargo processing
Context: Validation failure flag is set
GIVEN
Validation failure flag is set
Applied to: Skip Cargo Processing
WHEN
The system encounters validation failure
THEN
The system skips cargo processing and does not proceed with car and waybill operations
R-GCX016-cbl-02361 (+7) File: GCX016.cbl Equipment ID Formatting and Validation Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment ID Formatting and Validation':
  • Context - an equipment identifier is received from n7 segment:
    For Call GCCCARFM Utility:
    When the system calls gcccarfm utility to validate the equipment id format, then the system determines if the equipment id format is valid or invalid.
  • Context - an equipment identifier has passed initial format validation:
    For Standardize Equipment ID Format:
    When the system processes the equipment id through standardization, then the equipment id is converted to standard format for further processing.
  • Context - an equipment identifier has been standardized:
    For Validate Equipment ID Structure:
    When the system validates the equipment id structure, then the system determines if the structure validation passes or fails.
  • Context - an equipment identifier has passed both format and structure validation:
    For Update Cargo Record with Formatted Car ID:
    When the system updates the cargo record, then the cargo record is updated with the formatted car id.
  • Context - a cargo record has been updated with formatted car id:
    For Set Equipment ID in Working Storage:
    When the system sets the equipment id in working storage, then the equipment id is available for further processing operations.
  • Context - an equipment identifier fails format validation:
    For Log Format Error:
    When the system encounters a format error, then the system logs the format error and uses the original equipment id.
  • Context - an equipment identifier fails structure validation:
    For Log Validation Warning:
    When the system encounters a validation failure, then the system logs a validation warning and uses the original equipment id.
  • Context - equipment identifier formatting or validation has failed:
    For Use Original Equipment ID:
    When the system needs to continue processing, then the system uses the original equipment id and continues processing.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment identifier is received from N7 segment
GIVEN
An equipment identifier is received from N7 segment
Applied to: Call GCCCARFM Utility
WHEN
The system calls GCCCARFM utility to validate the equipment ID format
THEN
The system determines if the equipment ID format is valid or invalid
Context: An equipment identifier has passed initial format validation
GIVEN
An equipment identifier has passed initial format validation
Applied to: Standardize Equipment ID Format
WHEN
The system processes the equipment ID through standardization
THEN
The equipment ID is converted to standard format for further processing
Context: An equipment identifier has been standardized
GIVEN
An equipment identifier has been standardized
Applied to: Validate Equipment ID Structure
WHEN
The system validates the equipment ID structure
THEN
The system determines if the structure validation passes or fails
Context: An equipment identifier has passed both format and structure validation
GIVEN
An equipment identifier has passed both format and structure validation
Applied to: Update Cargo Record with Formatted Car ID
WHEN
The system updates the cargo record
THEN
The cargo record is updated with the formatted car ID
Context: A cargo record has been updated with formatted car ID
GIVEN
A cargo record has been updated with formatted car ID
Applied to: Set Equipment ID in Working Storage
WHEN
The system sets the equipment ID in working storage
THEN
The equipment ID is available for further processing operations
Context: An equipment identifier fails format validation
GIVEN
An equipment identifier fails format validation
Applied to: Log Format Error
WHEN
The system encounters a format error
THEN
The system logs the format error and uses the original equipment ID
Context: An equipment identifier fails structure validation
GIVEN
An equipment identifier fails structure validation
Applied to: Log Validation Warning
WHEN
The system encounters a validation failure
THEN
The system logs a validation warning and uses the original equipment ID
Context: Equipment identifier formatting or validation has failed
GIVEN
Equipment identifier formatting or validation has failed
Applied to: Use Original Equipment ID
WHEN
The system needs to continue processing
THEN
The system uses the original equipment ID and continues processing
R-GCX016-cbl-02369 (+12) File: GCX016.cbl Cargo Fetching by Car Index Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Fetching by Car Index':
  • Context - equipment information contains car identification data:
    For Extract Car ID from Equipment Information:
    When system needs to search for cargo using car id, then car id is extracted from equipment information and formatted using gcccarfm utility for standardized format.
  • Context - car id has been extracted and formatted from equipment information:
    For Car ID Valid?:
    When system validates the car id for search operations, then if car id is invalid, mark cargo as not found and log the search attempt, otherwise proceed with car index search.
  • Context - car id has been validated as valid:
    For Build Car ID Index Key:
    When system prepares to search cargo database using car id, then car id index key is constructed with proper format for database query.
  • Context - car id index key has been constructed:
    For Call GCCUSIO with Car Index:
    When system searches for cargo using the car id index, then gccusio is called with car index parameters to retrieve matching cargo records.
  • Context - database search by car id has been completed:
    For Cargo Found by Car ID?:
    When system evaluates search results, then if cargo is found, proceed to validate cargo record status, otherwise attempt broader search without us-ccn.
  • Context - cargo record has been found using car id search:
    For Validate Cargo Record Status:
    When system validates the cargo record, then cargo record status and attributes are checked against business validation criteria.
  • Context - cargo record status has been validated:
    For Cargo Record Valid?:
    When system evaluates validation results, then if cargo record is valid, return found cargo record, otherwise try broader search without us-ccn.
  • Context - initial car id search failed to find valid cargo or cargo record validation failed:
    For Try Broader Search Without US-CCN:
    When system attempts broader search strategy, then search parameters are expanded to exclude us-ccn restrictions for wider cargo matching.
  • Context - broader search without us-ccn has been initiated:
    For Search All Cargo with Matching Car ID:
    When system performs comprehensive car id search, then all cargo records matching the car id are retrieved regardless of us-ccn or other restrictive criteria.
  • Context - comprehensive car id search has been completed:
    For Any Matching Cargo?:
    When system evaluates search results, then if matching cargo is found, select best match based on criteria, otherwise mark as cargo not found.
  • Context - multiple cargo records match the car id:
    For Select Best Match Based on Criteria:
    When system selects the best match, then business criteria are applied to determine the most appropriate cargo record for processing.
  • Context - all car id search methods have failed to locate valid cargo or car id is invalid:
    For Mark as Cargo Not Found:
    When system processes cargo not found condition, then cargo status is marked as not found for appropriate business handling.
  • Context - car id search process has completed regardless of success or failure:
    For Log Car ID Search Attempt:
    When system logs the search attempt, then search attempt details are recorded including car id used and search outcome.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment information contains car identification data
GIVEN
Equipment information contains car identification data
Applied to: Extract Car ID from Equipment Information
WHEN
System needs to search for cargo using car ID
THEN
Car ID is extracted from equipment information and formatted using GCCCARFM utility for standardized format
Context: Car ID has been extracted and formatted from equipment information
GIVEN
Car ID has been extracted and formatted from equipment information
Applied to: Car ID Valid?
WHEN
System validates the car ID for search operations
THEN
If car ID is invalid, mark cargo as not found and log the search attempt, otherwise proceed with car index search
Context: Car ID has been validated as valid
GIVEN
Car ID has been validated as valid
Applied to: Build Car ID Index Key
WHEN
System prepares to search cargo database using car ID
THEN
Car ID index key is constructed with proper format for database query
Context: Car ID index key has been constructed
GIVEN
Car ID index key has been constructed
Applied to: Call GCCUSIO with Car Index
WHEN
System searches for cargo using the car ID index
THEN
GCCUSIO is called with car index parameters to retrieve matching cargo records
Context: Database search by car ID has been completed
GIVEN
Database search by car ID has been completed
Applied to: Cargo Found by Car ID?
WHEN
System evaluates search results
THEN
If cargo is found, proceed to validate cargo record status, otherwise attempt broader search without US-CCN
Context: Cargo record has been found using car ID search
GIVEN
Cargo record has been found using car ID search
Applied to: Validate Cargo Record Status
WHEN
System validates the cargo record
THEN
Cargo record status and attributes are checked against business validation criteria
Context: Cargo record status has been validated
GIVEN
Cargo record status has been validated
Applied to: Cargo Record Valid?
WHEN
System evaluates validation results
THEN
If cargo record is valid, return found cargo record, otherwise try broader search without US-CCN
Context: Initial car ID search failed to find valid cargo OR cargo record validation failed
GIVEN
Initial car ID search failed to find valid cargo OR cargo record validation failed
Applied to: Try Broader Search Without US-CCN
WHEN
System attempts broader search strategy
THEN
Search parameters are expanded to exclude US-CCN restrictions for wider cargo matching
Context: Broader search without US-CCN has been initiated
GIVEN
Broader search without US-CCN has been initiated
Applied to: Search All Cargo with Matching Car ID
WHEN
System performs comprehensive car ID search
THEN
All cargo records matching the car ID are retrieved regardless of US-CCN or other restrictive criteria
Context: Comprehensive car ID search has been completed
GIVEN
Comprehensive car ID search has been completed
Applied to: Any Matching Cargo?
WHEN
System evaluates search results
THEN
If matching cargo is found, select best match based on criteria, otherwise mark as cargo not found
Context: Multiple cargo records match the car ID
GIVEN
Multiple cargo records match the car ID
Applied to: Select Best Match Based on Criteria
WHEN
System selects the best match
THEN
Business criteria are applied to determine the most appropriate cargo record for processing
Context: All car ID search methods have failed to locate valid cargo OR car ID is invalid
GIVEN
All car ID search methods have failed to locate valid cargo OR car ID is invalid
Applied to: Mark as Cargo Not Found
WHEN
System processes cargo not found condition
THEN
Cargo status is marked as not found for appropriate business handling
Context: Car ID search process has completed regardless of success or failure
GIVEN
Car ID search process has completed regardless of success or failure
Applied to: Log Car ID Search Attempt
WHEN
System logs the search attempt
THEN
Search attempt details are recorded including car ID used and search outcome
R-GCX016-cbl-02382 (+7) File: GCX016.cbl Detour and Special Manifest Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Detour and Special Manifest Processing':
  • Context - a lead manifest is being processed and the lead manifest ccn matches the saved ccn:
    For Retrieve Follower Manifests:
    When the system processes multi-cargo records, then the system spawns gct0161e for each follower cargo record and sets follower end-of-database flag when no more records exist.
  • Context - a follower manifest is being prepared for processing:
    For Process Each Follower Manifest:
    When the system prepares the message for cargo processing, then the system sets special action code to '350' and copies disposition code, quantity, and entry number from x4 segment.
  • Context - cargo has been released and canadian manifest records exist for the same waybill:
    For Coordinate Cross-Border Requirements:
    When the system processes canadian manifest coordination, then the system searches for canadian manifest records by waybill and logs cargo release information to gcx105 system and filters out deleted records and new bond created records.
  • Context - a manifest is detected for special processing:
    For Manifest Type Check:
    When the system evaluates the manifest type, then the system identifies the manifest as either a detour manifest requiring lead manifest identification or a special manifest requiring direct special processing.
  • Context - a detour manifest is being processed:
    For Identify Lead Manifest:
    When the system identifies the lead manifest, then the system uses the manifest ccn to determine lead status and establishes the relationship for follower manifest processing.
  • Context - follower manifests have been retrieved for a lead manifest:
    For Validate Manifest Relationships:
    When the system validates manifest relationships, then the system verifies that follower manifest ccns are properly linked to the lead manifest ccn and ensures data integrity across the manifest group.
  • Context - a canadian manifest is involved in processing:
    For Map US Port to Canadian Port:
    When the system performs port mapping, then the system uses gcstbrt table to map us port codes to canadian port codes and establishes proper cross-border routing.
  • Context - special or detour processing has been completed:
    For Update Cargo Records:
    When the system updates cargo records, then the system updates cargo status to reflect special processing and maintains audit trail of changes and ensures data consistency across related cargo records.
👨‍💻 Technical ACs (Gherkin)
Context: A lead manifest is being processed AND the lead manifest CCN matches the saved CCN
GIVEN
A lead manifest is being processed AND the lead manifest CCN matches the saved CCN
Applied to: Retrieve Follower Manifests
WHEN
The system processes multi-cargo records
THEN
The system spawns GCT0161E for each follower cargo record AND sets follower end-of-database flag when no more records exist
Context: A follower manifest is being prepared for processing
GIVEN
A follower manifest is being prepared for processing
Applied to: Process Each Follower Manifest
WHEN
The system prepares the message for cargo processing
THEN
The system sets special action code to '350' AND copies disposition code, quantity, and entry number from X4 segment
Context: Cargo has been released AND Canadian manifest records exist for the same waybill
GIVEN
Cargo has been released AND Canadian manifest records exist for the same waybill
Applied to: Coordinate Cross-Border Requirements
WHEN
The system processes Canadian manifest coordination
THEN
The system searches for Canadian manifest records by waybill AND logs cargo release information to GCX105 system AND filters out deleted records and new bond created records
Context: A manifest is detected for special processing
GIVEN
A manifest is detected for special processing
Applied to: Manifest Type Check
WHEN
The system evaluates the manifest type
THEN
The system identifies the manifest as either a detour manifest requiring lead manifest identification OR a special manifest requiring direct special processing
Context: A detour manifest is being processed
GIVEN
A detour manifest is being processed
Applied to: Identify Lead Manifest
WHEN
The system identifies the lead manifest
THEN
The system uses the manifest CCN to determine lead status AND establishes the relationship for follower manifest processing
Context: Follower manifests have been retrieved for a lead manifest
GIVEN
Follower manifests have been retrieved for a lead manifest
Applied to: Validate Manifest Relationships
WHEN
The system validates manifest relationships
THEN
The system verifies that follower manifest CCNs are properly linked to the lead manifest CCN AND ensures data integrity across the manifest group
Context: A Canadian manifest is involved in processing
GIVEN
A Canadian manifest is involved in processing
Applied to: Map US Port to Canadian Port
WHEN
The system performs port mapping
THEN
The system uses GCSTBRT table to map US port codes to Canadian port codes AND establishes proper cross-border routing
Context: Special or detour processing has been completed
GIVEN
Special or detour processing has been completed
Applied to: Update Cargo Records
WHEN
The system updates cargo records
THEN
The system updates cargo status to reflect special processing AND maintains audit trail of changes AND ensures data consistency across related cargo records
R-GCX016-cbl-02390 (+7) File: GCX016.cbl Disposition Code 95 Bond Clearing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code 95 Bond Clearing':
  • Context - an x4 segment is received with a disposition code:
    For Validate Disposition Code 95:
    When the disposition code is evaluated for bond clearing eligibility, then the system validates the code is '95' and proceeds with bond clearing or rejects invalid codes.
    For Error: Invalid Disposition Code:
    When the disposition code is not '95' or is improperly formatted, then an error is generated and the transaction continues with standard processing without bond clearing.
  • Context - a valid disposition code 95 has been confirmed:
    For Retrieve Current Cargo Record:
    When the system needs to access cargo data for bond clearing, then the current cargo record is retrieved using the ccn key from the x4 segment.
  • Context - a cargo record has been retrieved for disposition code 95 processing:
    For Clear Bond Control Number:
    When bond clearing operations are initiated, then the bond control number field is cleared from the cargo record.
  • Context - the bond control number has been cleared from the cargo record:
    For Clear Broker Entry Number:
    When continuing with disposition code 95 bond clearing process, then the broker entry number field is cleared from the cargo record.
  • Context - bond control number and broker entry number have been cleared:
    For Clear Related Bond Data Fields:
    When finalizing the bond clearing operation for disposition code 95, then all related bond data fields including bond dates and references are cleared from the cargo record.
  • Context - all bond-related fields have been cleared from the cargo record:
    For Update Cargo Record Status:
    When completing the disposition code 95 processing, then the cargo record status is updated to reflect the bond clearing action.
  • Context - the cargo record has been updated with cleared bond information:
    For Log Bond Clearing Action:
    When finalizing the disposition code 95 transaction, then a log entry is created documenting the bond clearing action with timestamp and cargo details.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is received with a disposition code
GIVEN
An X4 segment is received with a disposition code
Applied to: Validate Disposition Code 95
WHEN
The disposition code is evaluated for bond clearing eligibility
THEN
The system validates the code is '95' and proceeds with bond clearing or rejects invalid codes
Applied to: Error: Invalid Disposition Code
WHEN
The disposition code is not '95' or is improperly formatted
THEN
An error is generated and the transaction continues with standard processing without bond clearing
Context: A valid disposition code 95 has been confirmed
GIVEN
A valid disposition code 95 has been confirmed
Applied to: Retrieve Current Cargo Record
WHEN
The system needs to access cargo data for bond clearing
THEN
The current cargo record is retrieved using the CCN key from the X4 segment
Context: A cargo record has been retrieved for disposition code 95 processing
GIVEN
A cargo record has been retrieved for disposition code 95 processing
Applied to: Clear Bond Control Number
WHEN
Bond clearing operations are initiated
THEN
The bond control number field is cleared from the cargo record
Context: The bond control number has been cleared from the cargo record
GIVEN
The bond control number has been cleared from the cargo record
Applied to: Clear Broker Entry Number
WHEN
Continuing with disposition code 95 bond clearing process
THEN
The broker entry number field is cleared from the cargo record
Context: Bond control number and broker entry number have been cleared
GIVEN
Bond control number and broker entry number have been cleared
Applied to: Clear Related Bond Data Fields
WHEN
Finalizing the bond clearing operation for disposition code 95
THEN
All related bond data fields including bond dates and references are cleared from the cargo record
Context: All bond-related fields have been cleared from the cargo record
GIVEN
All bond-related fields have been cleared from the cargo record
Applied to: Update Cargo Record Status
WHEN
Completing the disposition code 95 processing
THEN
The cargo record status is updated to reflect the bond clearing action
Context: The cargo record has been updated with cleared bond information
GIVEN
The cargo record has been updated with cleared bond information
Applied to: Log Bond Clearing Action
WHEN
Finalizing the disposition code 95 transaction
THEN
A log entry is created documenting the bond clearing action with timestamp and cargo details
R-GCX016-cbl-02408 (+8) File: GCX016.cbl Border Entry Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Border Entry Processing':
  • Context - a cargo entry is being processed:
    For Entry Type Code = '00'?:
    When the entry type code equals '00', then the system identifies this as a border entry requiring special processing.
    For Process as Regular Entry:
    When the entry type code is not equal to '00', then the cargo is processed through the regular entry processing path without border-specific modifications.
  • Context - a cargo entry has entry type code '00':
    For Identify as Border Entry:
    When the system processes the entry type, then the cargo is classified as a border entry.
  • Context - a cargo entry is classified as border entry with type code '00':
    For Clear Bond Control Number & Clear Broker Entry Number & Clear Related Bond Data & Set Border Entry Flag:
    When the system processes the border entry, then the bond control number field is cleared to spaces and the broker entry number field is cleared to spaces and all related bond data fields including bond number, bond type, and bond status are cleared and the border entry flag is set to indicate border processing mode.
  • Context - a cargo entry has been processed as border entry with cleared bond data and set border flag:
    For Update Cargo Record with Border Status:
    When the system updates the cargo record, then the cargo record is updated with border entry status and all border processing indicators.
  • Context - a cargo entry has been processed as border entry with updated status:
    For Log Border Entry Processing:
    When the system completes border entry processing, then the border entry processing is logged with entry details and processing timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo entry is being processed
GIVEN
A cargo entry is being processed
Applied to: Entry Type Code = '00'?
WHEN
The entry type code equals '00'
THEN
The system identifies this as a border entry requiring special processing
Applied to: Process as Regular Entry
WHEN
The entry type code is not equal to '00'
THEN
The cargo is processed through the regular entry processing path without border-specific modifications
Context: A cargo entry has entry type code '00'
GIVEN
A cargo entry has entry type code '00'
Applied to: Identify as Border Entry
WHEN
The system processes the entry type
THEN
The cargo is classified as a border entry
Context: A cargo entry is classified as border entry with type code '00'
GIVEN
A cargo entry is classified as border entry with type code '00'
Applied to: Clear Bond Control Number & Clear Broker Entry Number & Clear Related Bond Data & Set Border Entry Flag
WHEN
The system processes the border entry
THEN
The bond control number field is cleared to spaces AND The broker entry number field is cleared to spaces AND All related bond data fields including bond number, bond type, and bond status are cleared AND The border entry flag is set to indicate border processing mode
Context: A cargo entry has been processed as border entry with cleared bond data and set border flag
GIVEN
A cargo entry has been processed as border entry with cleared bond data and set border flag
Applied to: Update Cargo Record with Border Status
WHEN
The system updates the cargo record
THEN
The cargo record is updated with border entry status and all border processing indicators
Context: A cargo entry has been processed as border entry with updated status
GIVEN
A cargo entry has been processed as border entry with updated status
Applied to: Log Border Entry Processing
WHEN
The system completes border entry processing
THEN
The border entry processing is logged with entry details and processing timestamp
R-GCX016-cbl-02425 (+13) File: GCX016.cbl Canadian Border Location Mapping Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Border Location Mapping':
  • Context - a cargo record is being processed:
    For Cross-Border Shipment Detected:
    When the system evaluates the shipment for cross-border requirements, then the system detects if cross-border processing is needed and initiates port mapping workflow.
  • Context - a cross-border shipment has been detected:
    For US Port Code Present?:
    When the system checks for us port code in the cargo record, then the system either proceeds with port code extraction if present or completes mapping process if absent.
  • Context - a us port code is present in the cargo record:
    For Extract US Port Code from Cargo Record:
    When the system extracts the port code information, then the us port code is retrieved and prepared for ds table lookup.
  • Context - a us port code has been extracted from the cargo record:
    For Access DS Table for Port Mapping:
    When the system accesses the ds table for port mapping lookup, then the ds table is queried using the us port code as the search key.
  • Context - the ds table has been accessed with a us port code:
    For Canadian Port Found in DS Table?:
    When the system searches for a matching canadian port entry, then the system either retrieves the canadian port name if found or uses default port name if not found.
  • Context - a canadian port entry exists in the ds table for the us port code:
    For Retrieve Canadian Port Name:
    When the system retrieves the canadian port information, then the canadian port name is extracted from the ds table record.
  • Context - no canadian port entry exists in the ds table for the us port code:
    For Use Default Canadian Port Name:
    When the system cannot find a matching port mapping, then the system assigns a default canadian port name for the shipment.
  • Context - no canadian port mapping was found for the us port code:
    For Log Mapping Error:
    When the system uses a default canadian port name, then the system logs a port mapping error for audit and troubleshooting purposes.
  • Context - a canadian port name has been determined (either from ds table or default):
    For Update Cargo Record with Canadian Port Name:
    When the system updates the cargo record, then the cargo record is updated with the canadian port name information.
  • Context - the cargo record has been updated with canadian port information:
    For Set Cross-Border Flag:
    When the system sets processing flags, then the cross-border flag is set to indicate special cross-border processing requirements.
  • Context - the cross-border flag has been set for the shipment:
    For Log Port Mapping for Audit Trail:
    When the system creates audit trail entries, then the port mapping operation is logged with source port, destination port, and mapping status.
  • Context - one port mapping operation has been completed:
    For Additional Port Codes?:
    When the system checks for additional port codes to process, then the system either processes the next port code if available or completes the mapping process.
  • Context - additional port codes exist in the cargo record:
    For Process Next Port Code:
    When the system processes the next port code, then the system returns to port code extraction for the next us port code.
  • Context - all port codes have been processed or no port codes exist:
    For Port Mapping Complete:
    When the port mapping workflow reaches completion, then the system finalizes the port mapping process and the cargo record is ready for further processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed
GIVEN
A cargo record is being processed
Applied to: Cross-Border Shipment Detected
WHEN
The system evaluates the shipment for cross-border requirements
THEN
The system detects if cross-border processing is needed and initiates port mapping workflow
Context: A cross-border shipment has been detected
GIVEN
A cross-border shipment has been detected
Applied to: US Port Code Present?
WHEN
The system checks for US port code in the cargo record
THEN
The system either proceeds with port code extraction if present or completes mapping process if absent
Context: A US port code is present in the cargo record
GIVEN
A US port code is present in the cargo record
Applied to: Extract US Port Code from Cargo Record
WHEN
The system extracts the port code information
THEN
The US port code is retrieved and prepared for DS table lookup
Context: A US port code has been extracted from the cargo record
GIVEN
A US port code has been extracted from the cargo record
Applied to: Access DS Table for Port Mapping
WHEN
The system accesses the DS table for port mapping lookup
THEN
The DS table is queried using the US port code as the search key
Context: The DS table has been accessed with a US port code
GIVEN
The DS table has been accessed with a US port code
Applied to: Canadian Port Found in DS Table?
WHEN
The system searches for a matching Canadian port entry
THEN
The system either retrieves the Canadian port name if found or uses default port name if not found
Context: A Canadian port entry exists in the DS table for the US port code
GIVEN
A Canadian port entry exists in the DS table for the US port code
Applied to: Retrieve Canadian Port Name
WHEN
The system retrieves the Canadian port information
THEN
The Canadian port name is extracted from the DS table record
Context: No Canadian port entry exists in the DS table for the US port code
GIVEN
No Canadian port entry exists in the DS table for the US port code
Applied to: Use Default Canadian Port Name
WHEN
The system cannot find a matching port mapping
THEN
The system assigns a default Canadian port name for the shipment
Context: No Canadian port mapping was found for the US port code
GIVEN
No Canadian port mapping was found for the US port code
Applied to: Log Mapping Error
WHEN
The system uses a default Canadian port name
THEN
The system logs a port mapping error for audit and troubleshooting purposes
Context: A Canadian port name has been determined (either from DS table or default)
GIVEN
A Canadian port name has been determined (either from DS table or default)
Applied to: Update Cargo Record with Canadian Port Name
WHEN
The system updates the cargo record
THEN
The cargo record is updated with the Canadian port name information
Context: The cargo record has been updated with Canadian port information
GIVEN
The cargo record has been updated with Canadian port information
Applied to: Set Cross-Border Flag
WHEN
The system sets processing flags
THEN
The cross-border flag is set to indicate special cross-border processing requirements
Context: The cross-border flag has been set for the shipment
GIVEN
The cross-border flag has been set for the shipment
Applied to: Log Port Mapping for Audit Trail
WHEN
The system creates audit trail entries
THEN
The port mapping operation is logged with source port, destination port, and mapping status
Context: One port mapping operation has been completed
GIVEN
One port mapping operation has been completed
Applied to: Additional Port Codes?
WHEN
The system checks for additional port codes to process
THEN
The system either processes the next port code if available or completes the mapping process
Context: Additional port codes exist in the cargo record
GIVEN
Additional port codes exist in the cargo record
Applied to: Process Next Port Code
WHEN
The system processes the next port code
THEN
The system returns to port code extraction for the next US port code
Context: All port codes have been processed or no port codes exist
GIVEN
All port codes have been processed or no port codes exist
Applied to: Port Mapping Complete
WHEN
The port mapping workflow reaches completion
THEN
The system finalizes the port mapping process and the cargo record is ready for further processing
R-GCX016-cbl-02439 (+11) File: GCX016.cbl FDA Reference Number Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FDA Reference Number Processing':
  • Context - an n9 segment is received with reference qualifier and reference number data:
    For FDA Reference Qualifier?:
    When the system processes the n9 segment qualifier code, then the system determines if the qualifier indicates an fda-related reference number.
  • Context - an n9 segment has been identified as containing fda reference information:
    For Extract FDA Reference Number:
    When the system processes the n9 reference number field, then the fda reference number is extracted and prepared for validation.
  • Context - an fda reference number has been extracted from an n9 segment:
    For Valid FDA Format?:
    When the system validates the reference number format, then the system determines if the reference number meets fda formatting requirements.
  • Context - an fda reference number has been validated as properly formatted:
    For Store FDA Reference in Cargo Record:
    When the system updates the cargo record, then the fda reference number is stored in the cargo record for future compliance processing.
  • Context - fda reference information has been stored in the primary cargo record:
    For Link to Secondary Cargo Records:
    When secondary cargo records exist for the same shipment, then the fda reference information is linked to all related secondary cargo records.
  • Context - fda reference information has been processed and linked to cargo records:
    For A1/A3 Disposition Code Present?:
    When the system evaluates disposition codes associated with the cargo, then the system determines if a1 or a3 disposition codes are present requiring fda compliance actions.
  • Context - a1 or a3 disposition codes are present with fda reference information:
    For Process FDA Compliance Requirements:
    When the system processes fda compliance requirements, then special fda compliance processing is initiated including notifications and status updates.
  • Context - fda compliance requirements have been processed:
    For Update FDA Status in Status Array:
    When the system updates the cargo status array, then fda-related status codes are added to the gcsuss09 status segments.
  • Context - fda status has been updated in the status array:
    For Generate FDA Hold if Required:
    When fda compliance requirements indicate a hold is necessary, then an fda hold is generated and applied to the cargo preventing release.
  • Context - fda reference processing has been completed:
    For Log FDA Reference Processing:
    When the system performs logging operations, then all fda reference processing activities are logged including reference numbers, status changes, and compliance actions.
  • Context - an n9 segment is received with a reference qualifier:
    For Skip Non-FDA Reference:
    When the qualifier does not indicate fda-related reference information, then the system skips fda processing and continues to the next n9 segment.
  • Context - an error occurs during fda reference processing:
    For FDA Processing Error:
    When the system encounters invalid fda reference formats or processing failures, then the error is logged and processing continues to the next n9 segment without stopping the entire transaction.
👨‍💻 Technical ACs (Gherkin)
Context: An N9 segment is received with reference qualifier and reference number data
GIVEN
An N9 segment is received with reference qualifier and reference number data
Applied to: FDA Reference Qualifier?
WHEN
The system processes the N9 segment qualifier code
THEN
The system determines if the qualifier indicates an FDA-related reference number
Context: An N9 segment has been identified as containing FDA reference information
GIVEN
An N9 segment has been identified as containing FDA reference information
Applied to: Extract FDA Reference Number
WHEN
The system processes the N9 reference number field
THEN
The FDA reference number is extracted and prepared for validation
Context: An FDA reference number has been extracted from an N9 segment
GIVEN
An FDA reference number has been extracted from an N9 segment
Applied to: Valid FDA Format?
WHEN
The system validates the reference number format
THEN
The system determines if the reference number meets FDA formatting requirements
Context: An FDA reference number has been validated as properly formatted
GIVEN
An FDA reference number has been validated as properly formatted
Applied to: Store FDA Reference in Cargo Record
WHEN
The system updates the cargo record
THEN
The FDA reference number is stored in the cargo record for future compliance processing
Context: FDA reference information has been stored in the primary cargo record
GIVEN
FDA reference information has been stored in the primary cargo record
Applied to: Link to Secondary Cargo Records
WHEN
Secondary cargo records exist for the same shipment
THEN
The FDA reference information is linked to all related secondary cargo records
Context: FDA reference information has been processed and linked to cargo records
GIVEN
FDA reference information has been processed and linked to cargo records
Applied to: A1/A3 Disposition Code Present?
WHEN
The system evaluates disposition codes associated with the cargo
THEN
The system determines if A1 or A3 disposition codes are present requiring FDA compliance actions
Context: A1 or A3 disposition codes are present with FDA reference information
GIVEN
A1 or A3 disposition codes are present with FDA reference information
Applied to: Process FDA Compliance Requirements
WHEN
The system processes FDA compliance requirements
THEN
Special FDA compliance processing is initiated including notifications and status updates
Context: FDA compliance requirements have been processed
GIVEN
FDA compliance requirements have been processed
Applied to: Update FDA Status in Status Array
WHEN
The system updates the cargo status array
THEN
FDA-related status codes are added to the GCSUSS09 status segments
Context: FDA status has been updated in the status array
GIVEN
FDA status has been updated in the status array
Applied to: Generate FDA Hold if Required
WHEN
FDA compliance requirements indicate a hold is necessary
THEN
An FDA hold is generated and applied to the cargo preventing release
Context: FDA reference processing has been completed
GIVEN
FDA reference processing has been completed
Applied to: Log FDA Reference Processing
WHEN
The system performs logging operations
THEN
All FDA reference processing activities are logged including reference numbers, status changes, and compliance actions
Context: An N9 segment is received with a reference qualifier
GIVEN
An N9 segment is received with a reference qualifier
Applied to: Skip Non-FDA Reference
WHEN
The qualifier does not indicate FDA-related reference information
THEN
The system skips FDA processing and continues to the next N9 segment
Context: An error occurs during FDA reference processing
GIVEN
An error occurs during FDA reference processing
Applied to: FDA Processing Error
WHEN
The system encounters invalid FDA reference formats or processing failures
THEN
The error is logged and processing continues to the next N9 segment without stopping the entire transaction
R-GCX016-cbl-02489 (+7) File: GCX016.cbl Equipment ID Formatting and Standardization Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment ID Formatting and Standardization':
  • Context - an n7 equipment segment is received with equipment data:
    For Extract Equipment ID from N7-01:
    When the system processes the n7 segment, then the equipment id is extracted from the n7-01 field for further processing.
  • Context - an equipment id has been extracted from the n7 segment:
    For Call GCCCARFM Utility for Formatting:
    When the system needs to format the equipment id, then the gcccarfm utility is called to format and validate the equipment identifier.
  • Context - an equipment id has been processed through the gcccarfm formatting utility:
    For Equipment ID Valid?:
    When the system checks the validity of the formatted equipment id, then the equipment id is determined to be either valid or invalid based on formatting standards.
  • Context - an equipment id has been validated as correct:
    For Standardize Equipment Format:
    When the system standardizes the equipment format, then the equipment id is formatted according to standard specifications for consistent processing.
  • Context - an equipment id has been standardized and validated:
    For Update Cargo Record with Car ID:
    When the system updates the cargo record, then the cargo record is updated with the standardized car id information from the n7 segment.
  • Context - a cargo record has been successfully updated with equipment information:
    For Log Equipment Information:
    When the system completes equipment processing, then equipment information is logged for audit and tracking purposes.
  • Context - an equipment id has failed validation checks:
    For Generate Equipment ID Error:
    When the system determines the equipment id is invalid, then an equipment id error is generated and the equipment update is skipped.
  • Context - an equipment id error has been generated due to invalid equipment data:
    For Skip Equipment Update:
    When the system processes the error condition, then the equipment update is skipped and processing continues without updating cargo records.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 equipment segment is received with equipment data
GIVEN
An N7 equipment segment is received with equipment data
Applied to: Extract Equipment ID from N7-01
WHEN
The system processes the N7 segment
THEN
The equipment ID is extracted from the N7-01 field for further processing
Context: An equipment ID has been extracted from the N7 segment
GIVEN
An equipment ID has been extracted from the N7 segment
Applied to: Call GCCCARFM Utility for Formatting
WHEN
The system needs to format the equipment ID
THEN
The GCCCARFM utility is called to format and validate the equipment identifier
Context: An equipment ID has been processed through the GCCCARFM formatting utility
GIVEN
An equipment ID has been processed through the GCCCARFM formatting utility
Applied to: Equipment ID Valid?
WHEN
The system checks the validity of the formatted equipment ID
THEN
The equipment ID is determined to be either valid or invalid based on formatting standards
Context: An equipment ID has been validated as correct
GIVEN
An equipment ID has been validated as correct
Applied to: Standardize Equipment Format
WHEN
The system standardizes the equipment format
THEN
The equipment ID is formatted according to standard specifications for consistent processing
Context: An equipment ID has been standardized and validated
GIVEN
An equipment ID has been standardized and validated
Applied to: Update Cargo Record with Car ID
WHEN
The system updates the cargo record
THEN
The cargo record is updated with the standardized car ID information from the N7 segment
Context: A cargo record has been successfully updated with equipment information
GIVEN
A cargo record has been successfully updated with equipment information
Applied to: Log Equipment Information
WHEN
The system completes equipment processing
THEN
Equipment information is logged for audit and tracking purposes
Context: An equipment ID has failed validation checks
GIVEN
An equipment ID has failed validation checks
Applied to: Generate Equipment ID Error
WHEN
The system determines the equipment ID is invalid
THEN
An equipment ID error is generated and the equipment update is skipped
Context: An equipment ID error has been generated due to invalid equipment data
GIVEN
An equipment ID error has been generated due to invalid equipment data
Applied to: Skip Equipment Update
WHEN
The system processes the error condition
THEN
The equipment update is skipped and processing continues without updating cargo records
R-GCX016-cbl-02505 (+7) File: GCX016.cbl Cargo Status Array Management Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Array Management':
  • Context - a cargo record that does not have existing s09 status segments:
    For Status Array Initialization:
    When the system needs to create status tracking for the cargo, then an empty s09a status array is created and initialized with default values.
  • Context - a cargo record with existing s09 status segments in the database:
    For Status Array Population:
    When the system needs to load current status information, then all s09 segments are fetched from gcsuss09 ims segment and loaded into the status array.
  • Context - s09 segments containing disposition codes, status flags, and quantity information:
    For Status Array Population:
    When the system processes the fetched s09 segments, then each disposition code is loaded into the s09a array with its status flags, quantities, and location information.
  • Context - a new disposition code to be added to the status array:
    For Disposition Code Duplicate Prevention:
    When the system checks if the disposition code already exists in the array, then if the code already exists, skip adding it; if not, add the new code to the array.
  • Context - a new disposition code that does not exist in the current status array:
    For Disposition Code Duplicate Prevention:
    When the system adds the disposition code to the array, then the code is added with its properties including status flags, location information, and quantity actions.
  • Context - a status array that is approaching or at maximum capacity:
    For Status Array Overflow Protection:
    When the system attempts to add additional disposition codes, then the system prevents array overflow and maintains data integrity by rejecting additional entries.
  • Context - a populated s09a status array with disposition codes and status information:
    For Status Array Persistence:
    When the system needs to persist the status information to the database, then the array data is moved to s09 segments with proper sequencing and key structure.
  • Context - s09 segments containing updated status information from the status array:
    For Status Array Persistence:
    When the system persists the changes to the database, then the cargo records in gccc-cargo-root ims segment are updated with the new status information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record that does not have existing S09 status segments
GIVEN
A cargo record that does not have existing S09 status segments
Applied to: Status Array Initialization
WHEN
The system needs to create status tracking for the cargo
THEN
An empty S09A status array is created and initialized with default values
Context: A cargo record with existing S09 status segments in the database
GIVEN
A cargo record with existing S09 status segments in the database
Applied to: Status Array Population
WHEN
The system needs to load current status information
THEN
All S09 segments are fetched from GCSUSS09 IMS segment and loaded into the status array
Context: S09 segments containing disposition codes, status flags, and quantity information
GIVEN
S09 segments containing disposition codes, status flags, and quantity information
Applied to: Status Array Population
WHEN
The system processes the fetched S09 segments
THEN
Each disposition code is loaded into the S09A array with its status flags, quantities, and location information
Context: A new disposition code to be added to the status array
GIVEN
A new disposition code to be added to the status array
Applied to: Disposition Code Duplicate Prevention
WHEN
The system checks if the disposition code already exists in the array
THEN
If the code already exists, skip adding it; if not, add the new code to the array
Context: A new disposition code that does not exist in the current status array
GIVEN
A new disposition code that does not exist in the current status array
Applied to: Disposition Code Duplicate Prevention
WHEN
The system adds the disposition code to the array
THEN
The code is added with its properties including status flags, location information, and quantity actions
Context: A status array that is approaching or at maximum capacity
GIVEN
A status array that is approaching or at maximum capacity
Applied to: Status Array Overflow Protection
WHEN
The system attempts to add additional disposition codes
THEN
The system prevents array overflow and maintains data integrity by rejecting additional entries
Context: A populated S09A status array with disposition codes and status information
GIVEN
A populated S09A status array with disposition codes and status information
Applied to: Status Array Persistence
WHEN
The system needs to persist the status information to the database
THEN
The array data is moved to S09 segments with proper sequencing and key structure
Context: S09 segments containing updated status information from the status array
GIVEN
S09 segments containing updated status information from the status array
Applied to: Status Array Persistence
WHEN
The system persists the changes to the database
THEN
The cargo records in GCCC-CARGO-ROOT IMS segment are updated with the new status information
R-GCX016-cbl-02513 (+15) File: GCX016.cbl Cargo Record Retrieval by Car Index Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Record Retrieval by Car Index':
  • Context - an n7 equipment segment contains car identification data:
    For Extract Car ID from Equipment Information:
    When the system needs to extract car id for cargo lookup, then the car initial and car number are extracted from the n7 segment and combined to form the complete car id.
  • Context - car initial and car number have been extracted from equipment data:
    For Format Car ID Using GCCCARFM Utility:
    When the system needs to format the car id for database lookup, then the gcccarfm utility is called to format the car id into standardized format.
  • Context - a car id has been formatted using the gcccarfm utility:
    For Car ID Valid?:
    When the system validates the car id for lookup operations, then the car id is considered valid if it is not spaces and meets format requirements, otherwise the lookup process terminates.
  • Context - a valid car id has been confirmed:
    For Build Car Index Search Key:
    When the system needs to search cargo records by car index, then the car index search key is built using the car id as the primary search criterion.
  • Context - a car index search key has been constructed:
    For Search Cargo Database by Car Index:
    When the system searches the cargo database by car index, then the system queries the gccc-cargo-root database using the car id index to find matching cargo records.
  • Context - a car index search has been performed on the cargo database:
    For Cargo Found by Car ID?:
    When the system evaluates the search results, then if cargo records are found, proceed with validation; if no cargo records are found, attempt broader search methods.
  • Context - cargo records have been found using car id index search:
    For Validate Cargo Record Status:
    When the system validates the cargo record status, then only cargo records that are not deleted and have valid processing status are considered acceptable for further operations.
  • Context - a cargo record has been found and its status validated:
    For Cargo Record Valid?:
    When the system checks cargo record validity, then if the cargo record is valid, return it for processing; if invalid, attempt partial us-ccn key matching.
  • Context - the exact car id match did not yield a valid cargo record:
    For Attempt Partial US-CCN Key Matching:
    When the system attempts partial us-ccn key matching, then the system searches for cargo records using partial us-ccn key components combined with car id information.
  • Context - partial us-ccn key matching has been attempted:
    For Partial Match Found?:
    When the system evaluates the partial match results, then if a partial match is found, return the matched cargo record; if no partial match is found, attempt broader search without us-ccn.
  • Context - both exact car id match and partial us-ccn matching have failed:
    For Try Broader Search Without US-CCN:
    When the system performs broader search without us-ccn constraints, then the system searches cargo database using only car id criteria to find any associated cargo records.
  • Context - a broader search without us-ccn has been performed:
    For Alternative Match Found?:
    When the system evaluates the alternative match results, then if an alternative match is found, return the matched cargo record; if no match is found, log search results and return no cargo found status.
  • Context - all car id search methods have been exhausted without finding valid cargo:
    For Log Car ID Search Results:
    When the system logs the search results, then the search attempts and results are recorded for audit purposes before returning no cargo found status.
  • Context - all car id search methods have failed to locate valid cargo records:
    For Return No Cargo Found Status:
    When the system completes the search process, then a no cargo found status is returned to indicate that cargo lookup by car id was unsuccessful.
  • Context - a valid cargo record has been found through any of the car id search methods:
    For Return Matched Cargo Record:
    When the system completes the successful search, then the matched cargo record is returned with appropriate status for continued processing.
  • Context - a valid cargo record has been successfully returned from car id search:
    For Proceed with Found Cargo:
    When the system proceeds with cargo processing, then the found cargo record is used for subsequent business operations and status updates.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 equipment segment contains car identification data
GIVEN
An N7 equipment segment contains car identification data
Applied to: Extract Car ID from Equipment Information
WHEN
The system needs to extract car ID for cargo lookup
THEN
The car initial and car number are extracted from the N7 segment and combined to form the complete car ID
Context: Car initial and car number have been extracted from equipment data
GIVEN
Car initial and car number have been extracted from equipment data
Applied to: Format Car ID Using GCCCARFM Utility
WHEN
The system needs to format the car ID for database lookup
THEN
The GCCCARFM utility is called to format the car ID into standardized format
Context: A car ID has been formatted using the GCCCARFM utility
GIVEN
A car ID has been formatted using the GCCCARFM utility
Applied to: Car ID Valid?
WHEN
The system validates the car ID for lookup operations
THEN
The car ID is considered valid if it is not spaces and meets format requirements, otherwise the lookup process terminates
Context: A valid car ID has been confirmed
GIVEN
A valid car ID has been confirmed
Applied to: Build Car Index Search Key
WHEN
The system needs to search cargo records by car index
THEN
The car index search key is built using the car ID as the primary search criterion
Context: A car index search key has been constructed
GIVEN
A car index search key has been constructed
Applied to: Search Cargo Database by Car Index
WHEN
The system searches the cargo database by car index
THEN
The system queries the GCCC-CARGO-ROOT database using the car ID index to find matching cargo records
Context: A car index search has been performed on the cargo database
GIVEN
A car index search has been performed on the cargo database
Applied to: Cargo Found by Car ID?
WHEN
The system evaluates the search results
THEN
If cargo records are found, proceed with validation; if no cargo records are found, attempt broader search methods
Context: Cargo records have been found using car ID index search
GIVEN
Cargo records have been found using car ID index search
Applied to: Validate Cargo Record Status
WHEN
The system validates the cargo record status
THEN
Only cargo records that are not deleted and have valid processing status are considered acceptable for further operations
Context: A cargo record has been found and its status validated
GIVEN
A cargo record has been found and its status validated
Applied to: Cargo Record Valid?
WHEN
The system checks cargo record validity
THEN
If the cargo record is valid, return it for processing; if invalid, attempt partial US-CCN key matching
Context: The exact car ID match did not yield a valid cargo record
GIVEN
The exact car ID match did not yield a valid cargo record
Applied to: Attempt Partial US-CCN Key Matching
WHEN
The system attempts partial US-CCN key matching
THEN
The system searches for cargo records using partial US-CCN key components combined with car ID information
Context: Partial US-CCN key matching has been attempted
GIVEN
Partial US-CCN key matching has been attempted
Applied to: Partial Match Found?
WHEN
The system evaluates the partial match results
THEN
If a partial match is found, return the matched cargo record; if no partial match is found, attempt broader search without US-CCN
Context: Both exact car ID match and partial US-CCN matching have failed
GIVEN
Both exact car ID match and partial US-CCN matching have failed
Applied to: Try Broader Search Without US-CCN
WHEN
The system performs broader search without US-CCN constraints
THEN
The system searches cargo database using only car ID criteria to find any associated cargo records
Context: A broader search without US-CCN has been performed
GIVEN
A broader search without US-CCN has been performed
Applied to: Alternative Match Found?
WHEN
The system evaluates the alternative match results
THEN
If an alternative match is found, return the matched cargo record; if no match is found, log search results and return no cargo found status
Context: All car ID search methods have been exhausted without finding valid cargo
GIVEN
All car ID search methods have been exhausted without finding valid cargo
Applied to: Log Car ID Search Results
WHEN
The system logs the search results
THEN
The search attempts and results are recorded for audit purposes before returning no cargo found status
Context: All car ID search methods have failed to locate valid cargo records
GIVEN
All car ID search methods have failed to locate valid cargo records
Applied to: Return No Cargo Found Status
WHEN
The system completes the search process
THEN
A no cargo found status is returned to indicate that cargo lookup by car ID was unsuccessful
Context: A valid cargo record has been found through any of the car ID search methods
GIVEN
A valid cargo record has been found through any of the car ID search methods
Applied to: Return Matched Cargo Record
WHEN
The system completes the successful search
THEN
The matched cargo record is returned with appropriate status for continued processing
Context: A valid cargo record has been successfully returned from car ID search
GIVEN
A valid cargo record has been successfully returned from car ID search
Applied to: Proceed with Found Cargo
WHEN
The system proceeds with cargo processing
THEN
The found cargo record is used for subsequent business operations and status updates
R-GCX016-cbl-02529 (+19) File: GCX016.cbl Foreign Bill Creation Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Foreign Bill Creation':
  • Context - a foreign bill does not exist in the system:
    For Initialize New Cargo Record:
    When the system needs to create a new cargo record, then initialize a new cargo record structure and clear all fields to default values.
  • Context - a new cargo record is being created:
    For Set Default CPRS/USCS Status:
    When the cargo type is cprs, then set cargo status to 'error' with description 'error'.
    For Set Default CPRS/USCS Status:
    When the cargo type is not cprs, then set cargo status to 'sent' with description 'sent'.
  • Context - a new cargo record is being processed:
    For Set Default Broker Information:
    When the current cargo status is blank or equals 'ack-r', then set the acknowledgment status to default value 'ack' or 'ack-r'.
  • Context - a new cargo record with disposition codes '1j', '69', or '55':
    For Check Entry Type Code:
    When the entry type code is '61', '62', '63', or '69', then process as master in-bond entry requiring special customs handling.
  • Context - a master in-bond cargo entry:
    For Map Transport Type Codes:
    When the entry type code is '61', then set transport classification to immediate transport.
    For Map Transport Type Codes:
    When the entry type code is '62', then set transport classification to transport for export.
    For Map Transport Type Codes:
    When the entry type code is '63', then set transport classification to immediate export.
    For Map Transport Type Codes:
    When the entry type code is '69', then set transport classification to us-canada-us movement.
  • Context - a new cargo entry:
    For Process Border Entry Type Code 00:
    When the entry type code is '00', then process as default border entry with standard customs handling.
  • Context - a border entry with type code '00':
    For Clear Bond Information:
    When processing the cargo record, then clear all bond-related fields and information.
  • Context - a cargo record with an entry number:
    For Build M10 Manifest Information:
    When the entry number starts with 'v', then place the entry number in the entry number field, otherwise place it in the in-bond control number field.
  • Context - a new cargo record being created:
    For Set SCAC Code:
    When manifest information contains scac code, then set the cargo scac code from the manifest scac information.
    For Set Transport Type:
    When manifest information contains transport type, then set the cargo transport type from the manifest transport information.
    For Set Country Code:
    When manifest information contains country code, then set the cargo country code from the manifest country information.
    For Set Vessel/Flight Information:
    When manifest information contains vessel or flight details, then set the cargo vessel/flight information from the manifest transportation details.
    For Set Quantity Information:
    When manifest information contains quantity details, then set the cargo quantity information from the manifest quantity data.
    For Set Manifest Type Code:
    When processing manifest information, then set the manifest type code based on the manifest classification.
    For Set Condition Response Code:
    When processing cargo conditions, then set the condition response code based on cargo processing requirements.
  • Context - a fully populated new cargo record:
    For Store New Cargo Record:
    When all required information has been set, then insert the new cargo record into the system database.
👨‍💻 Technical ACs (Gherkin)
Context: A foreign bill does not exist in the system
GIVEN
A foreign bill does not exist in the system
Applied to: Initialize New Cargo Record
WHEN
The system needs to create a new cargo record
THEN
Initialize a new cargo record structure and clear all fields to default values
Context: A new cargo record is being created
GIVEN
A new cargo record is being created
Applied to: Set Default CPRS/USCS Status
WHEN
The cargo type is CPRS
THEN
Set cargo status to 'ERROR' with description 'ERROR'
Applied to: Set Default CPRS/USCS Status
WHEN
The cargo type is not CPRS
THEN
Set cargo status to 'SENT' with description 'SENT'
Context: A new cargo record is being processed
GIVEN
A new cargo record is being processed
Applied to: Set Default Broker Information
WHEN
The current cargo status is blank or equals 'ACK-R'
THEN
Set the acknowledgment status to default value 'ACK' or 'ACK-R'
Context: A new cargo record with disposition codes '1J', '69', or '55'
GIVEN
A new cargo record with disposition codes '1J', '69', or '55'
Applied to: Check Entry Type Code
WHEN
The entry type code is '61', '62', '63', or '69'
THEN
Process as master in-bond entry requiring special customs handling
Context: A master in-bond cargo entry
GIVEN
A master in-bond cargo entry
Applied to: Map Transport Type Codes
WHEN
The entry type code is '61'
THEN
Set transport classification to immediate transport
Applied to: Map Transport Type Codes
WHEN
The entry type code is '62'
THEN
Set transport classification to transport for export
Applied to: Map Transport Type Codes
WHEN
The entry type code is '63'
THEN
Set transport classification to immediate export
Applied to: Map Transport Type Codes
WHEN
The entry type code is '69'
THEN
Set transport classification to US-Canada-US movement
Context: A new cargo entry
GIVEN
A new cargo entry
Applied to: Process Border Entry Type Code 00
WHEN
The entry type code is '00'
THEN
Process as default border entry with standard customs handling
Context: A border entry with type code '00'
GIVEN
A border entry with type code '00'
Applied to: Clear Bond Information
WHEN
Processing the cargo record
THEN
Clear all bond-related fields and information
Context: A cargo record with an entry number
GIVEN
A cargo record with an entry number
Applied to: Build M10 Manifest Information
WHEN
The entry number starts with 'V'
THEN
Place the entry number in the entry number field, otherwise place it in the in-bond control number field
Context: A new cargo record being created
GIVEN
A new cargo record being created
Applied to: Set SCAC Code
WHEN
Manifest information contains SCAC code
THEN
Set the cargo SCAC code from the manifest SCAC information
Applied to: Set Transport Type
WHEN
Manifest information contains transport type
THEN
Set the cargo transport type from the manifest transport information
Applied to: Set Country Code
WHEN
Manifest information contains country code
THEN
Set the cargo country code from the manifest country information
Applied to: Set Vessel/Flight Information
WHEN
Manifest information contains vessel or flight details
THEN
Set the cargo vessel/flight information from the manifest transportation details
Applied to: Set Quantity Information
WHEN
Manifest information contains quantity details
THEN
Set the cargo quantity information from the manifest quantity data
Applied to: Set Manifest Type Code
WHEN
Processing manifest information
THEN
Set the manifest type code based on the manifest classification
Applied to: Set Condition Response Code
WHEN
Processing cargo conditions
THEN
Set the condition response code based on cargo processing requirements
Context: A fully populated new cargo record
GIVEN
A fully populated new cargo record
Applied to: Store New Cargo Record
WHEN
All required information has been set
THEN
Insert the new cargo record into the system database
R-GCX016-cbl-02549 (+7) File: GCX016.cbl Car ID Partial Matching Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car ID Partial Matching':
  • Context - a car id is received for cargo matching:
    For Format Car ID using GCCCARFM Utility:
    When the system formats the car id using gcccarfm utility, then the car id format is validated and standardized for subsequent matching operations.
  • Context - a formatted car id and complete us-ccn key are available:
    For Attempt Exact Match with Full US-CCN Key:
    When the system searches for cargo using exact match criteria, then if an exact match is found, the corresponding cargo record is returned.
  • Context - no exact match was found using full us-ccn key:
    For Attempt Partial Match without US-CCN Constraints:
    When the system performs partial matching without us-ccn constraints, then the system searches cargo database using car id index with relaxed criteria.
  • Context - partial matching is required due to exact match failure:
    For Search Cargo Database by Car ID Index:
    When the system searches the cargo database using car id index, then potential cargo matches are identified based on car id indexing.
  • Context - a partial match has been found in the cargo database:
    For Validate Matched Cargo Record:
    When the system validates the matched cargo record, then if the cargo record is valid, it is accepted as a match, otherwise it is rejected.
  • Context - no valid cargo match was found using either exact or partial matching:
    For Log Car ID Match Failure:
    When the system logs the car id match failure, then the failure is recorded with relevant details for audit trail.
  • Context - a car id fails format validation:
    For Log Invalid Car ID Format Error:
    When the system encounters an invalid car id format, then the invalid format error is logged for data quality monitoring.
  • Context - all matching attempts have failed or car id format is invalid:
    For Return No Match Found Status:
    When the system completes the matching process without finding valid cargo, then a no match found status is returned to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A car ID is received for cargo matching
GIVEN
A car ID is received for cargo matching
Applied to: Format Car ID using GCCCARFM Utility
WHEN
The system formats the car ID using GCCCARFM utility
THEN
The car ID format is validated and standardized for subsequent matching operations
Context: A formatted car ID and complete US-CCN key are available
GIVEN
A formatted car ID and complete US-CCN key are available
Applied to: Attempt Exact Match with Full US-CCN Key
WHEN
The system searches for cargo using exact match criteria
THEN
If an exact match is found, the corresponding cargo record is returned
Context: No exact match was found using full US-CCN key
GIVEN
No exact match was found using full US-CCN key
Applied to: Attempt Partial Match without US-CCN Constraints
WHEN
The system performs partial matching without US-CCN constraints
THEN
The system searches cargo database using car ID index with relaxed criteria
Context: Partial matching is required due to exact match failure
GIVEN
Partial matching is required due to exact match failure
Applied to: Search Cargo Database by Car ID Index
WHEN
The system searches the cargo database using car ID index
THEN
Potential cargo matches are identified based on car ID indexing
Context: A partial match has been found in the cargo database
GIVEN
A partial match has been found in the cargo database
Applied to: Validate Matched Cargo Record
WHEN
The system validates the matched cargo record
THEN
If the cargo record is valid, it is accepted as a match, otherwise it is rejected
Context: No valid cargo match was found using either exact or partial matching
GIVEN
No valid cargo match was found using either exact or partial matching
Applied to: Log Car ID Match Failure
WHEN
The system logs the car ID match failure
THEN
The failure is recorded with relevant details for audit trail
Context: A car ID fails format validation
GIVEN
A car ID fails format validation
Applied to: Log Invalid Car ID Format Error
WHEN
The system encounters an invalid car ID format
THEN
The invalid format error is logged for data quality monitoring
Context: All matching attempts have failed or car ID format is invalid
GIVEN
All matching attempts have failed or car ID format is invalid
Applied to: Return No Match Found Status
WHEN
The system completes the matching process without finding valid cargo
THEN
A no match found status is returned to the calling process
R-GCX016-cbl-02572 (+10) File: GCX016.cbl Cargo Information Logging with Disposition Codes Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Information Logging with Disposition Codes':
  • Context - a cargo processing transaction is being executed:
    For Prepare Log Message with Cargo Details:
    When the system needs to log cargo information for audit purposes, then the system shall prepare a log message containing cargo id, current status, processing context, and transaction details.
    For Add Transaction Audit Trail Data:
    When the system needs to create complete audit trail information, then the system shall add transaction type, source system, processing context, and related audit trail data to the log message.
  • Context - a cargo processing transaction involves disposition code changes:
    For Include Disposition Code Information:
    When the system is preparing audit log information, then the system shall include the disposition code, its description, and the associated processing action in the log message.
  • Context - cargo processing involves quantity or status changes:
    For Add Cargo Quantities and Status:
    When the system is creating an audit log entry, then the system shall include total quantities, released quantities, current cargo status, and any status changes in the log message.
  • Context - a cargo processing transaction is being logged:
    For Format Processing Timestamps:
    When the system needs to record timing information, then the system shall format and include current processing timestamp, transaction start time, and any relevant date/time information in the log message.
  • Context - a user is performing cargo processing operations:
    For Include Security Information:
    When the system is creating audit log entries, then the system shall include user identification, security context, and authorization level information in the log message.
  • Context - a complete log message has been prepared with all required information:
    For Set Log Message Parameters:
    When the system is ready to transmit the log message, then the system shall set appropriate message parameters including priority level, destination queue, and formatting options.
  • Context - a log message is prepared with all required parameters and cargo processing information:
    For Spawn GCT1051E Logging Transaction:
    When the system needs to record the audit log entry, then the system shall spawn gct1051e logging transaction excluding disposition codes 54 and 55 from logging.
  • Context - the gct1051e logging transaction has been invoked:
    For Logging Successful?:
    When the logging transaction completes execution, then the system shall verify if logging was successful and branch to appropriate processing path based on the result.
  • Context - the gct1051e logging transaction completed successfully:
    For Update Audit Trail:
    When the system receives successful completion confirmation, then the system shall update internal audit trail records and continue with normal processing flow.
  • Context - the gct1051e logging transaction failed to complete successfully:
    For Log Error Message:
    When the system receives failure notification, then the system shall record error information about the logging failure and continue processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing transaction is being executed
GIVEN
A cargo processing transaction is being executed
Applied to: Prepare Log Message with Cargo Details
WHEN
The system needs to log cargo information for audit purposes
THEN
The system shall prepare a log message containing cargo ID, current status, processing context, and transaction details
Applied to: Add Transaction Audit Trail Data
WHEN
The system needs to create complete audit trail information
THEN
The system shall add transaction type, source system, processing context, and related audit trail data to the log message
Context: A cargo processing transaction involves disposition code changes
GIVEN
A cargo processing transaction involves disposition code changes
Applied to: Include Disposition Code Information
WHEN
The system is preparing audit log information
THEN
The system shall include the disposition code, its description, and the associated processing action in the log message
Context: Cargo processing involves quantity or status changes
GIVEN
Cargo processing involves quantity or status changes
Applied to: Add Cargo Quantities and Status
WHEN
The system is creating an audit log entry
THEN
The system shall include total quantities, released quantities, current cargo status, and any status changes in the log message
Context: A cargo processing transaction is being logged
GIVEN
A cargo processing transaction is being logged
Applied to: Format Processing Timestamps
WHEN
The system needs to record timing information
THEN
The system shall format and include current processing timestamp, transaction start time, and any relevant date/time information in the log message
Context: A user is performing cargo processing operations
GIVEN
A user is performing cargo processing operations
Applied to: Include Security Information
WHEN
The system is creating audit log entries
THEN
The system shall include user identification, security context, and authorization level information in the log message
Context: A complete log message has been prepared with all required information
GIVEN
A complete log message has been prepared with all required information
Applied to: Set Log Message Parameters
WHEN
The system is ready to transmit the log message
THEN
The system shall set appropriate message parameters including priority level, destination queue, and formatting options
Context: A log message is prepared with all required parameters and cargo processing information
GIVEN
A log message is prepared with all required parameters and cargo processing information
Applied to: Spawn GCT1051E Logging Transaction
WHEN
The system needs to record the audit log entry
THEN
The system shall spawn GCT1051E logging transaction excluding disposition codes 54 and 55 from logging
Context: The GCT1051E logging transaction has been invoked
GIVEN
The GCT1051E logging transaction has been invoked
Applied to: Logging Successful?
WHEN
The logging transaction completes execution
THEN
The system shall verify if logging was successful and branch to appropriate processing path based on the result
Context: The GCT1051E logging transaction completed successfully
GIVEN
The GCT1051E logging transaction completed successfully
Applied to: Update Audit Trail
WHEN
The system receives successful completion confirmation
THEN
The system shall update internal audit trail records and continue with normal processing flow
Context: The GCT1051E logging transaction failed to complete successfully
GIVEN
The GCT1051E logging transaction failed to complete successfully
Applied to: Log Error Message
WHEN
The system receives failure notification
THEN
The system shall record error information about the logging failure and continue processing
R-GCX016-cbl-02583 (+13) File: GCX016.cbl K1 Remarks Logging for Cargo Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'K1 Remarks Logging for Cargo':
  • Context - a k1 segment is received for processing:
    For K1 Segment Type?:
    When the system evaluates the segment context and operational scope, then the k1 segment is classified as either train-level processing or cargo-level processing based on the current processing context.
  • Context - a k1 segment has been classified for processing:
    For Extract Free-Form Comment Text:
    When the system processes the k1 segment content, then the free-form comment text is extracted from the k1 segment data fields.
  • Context - free-form comment text has been extracted from k1 segment:
    For Validate Comment Length:
    When the system validates the comment text length, then the comment is accepted if it meets length requirements or rejected if it exceeds maximum allowed length.
  • Context - a k1 comment has undergone length validation:
    For Comment Valid?:
    When the system evaluates comment validity based on length and content criteria, then the comment is marked as valid for storage or invalid for rejection.
  • Context - a k1 comment has been validated as acceptable:
    For Store K1 Comment in Array:
    When the system processes the valid comment for storage, then the k1 comment is stored in the comment array for later association with cargo records.
  • 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 processing continues with next k1 segment if more exist, or proceeds to comment count validation if no more segments.
  • Context - all k1 segments have been processed and stored in array:
    For Check K1 Comment Count:
    When the system counts the total number of k1 comments collected, then the comment count is evaluated against maximum allowed limit of 4 comments per cargo.
  • Context - k1 comment count has been determined:
    For Count ≤ 4?:
    When the system evaluates if comment count is less than or equal to 4, then comments are accepted for cargo association if count is 4 or less, or processing completes if limit exceeded.
  • Context - k1 comments have passed count validation (≤ 4):
    For Add K1 Comment to Cargo Record:
    When the system processes comments for cargo association, then k1 comments are added to the cargo record for inclusion in disposition code processing.
  • Context - k1 comments have been added to cargo record:
    For Log K1 Remarks with Cargo Information:
    When the system processes cargo with associated k1 remarks, then k1 remarks are logged with cargo identification information for audit trail.
  • Context - k1 remarks have been logged with cargo information:
    For Associate K1 with Disposition Code:
    When the system processes disposition codes for the cargo, then k1 remarks are associated with the relevant disposition code for customs release processing.
  • Context - k1 remarks have been associated with disposition code:
    For Update Cargo Processing Log:
    When the system completes k1 processing for cargo, then cargo processing log is updated to record k1 remarks inclusion in disposition code processing.
  • Context - a k1 comment has failed validation criteria:
    For Reject Invalid Comment:
    When the system processes the invalid comment, then the k1 comment is rejected and excluded from cargo processing.
  • Context - a k1 comment has been rejected due to validation failure:
    For Log Error Message:
    When the system processes the rejection, then an error message is logged documenting the k1 comment validation failure for audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 segment is received for processing
GIVEN
A K1 segment is received for processing
Applied to: K1 Segment Type?
WHEN
The system evaluates the segment context and operational scope
THEN
The K1 segment is classified as either train-level processing or cargo-level processing based on the current processing context
Context: A K1 segment has been classified for processing
GIVEN
A K1 segment has been classified for processing
Applied to: Extract Free-Form Comment Text
WHEN
The system processes the K1 segment content
THEN
The free-form comment text is extracted from the K1 segment data fields
Context: Free-form comment text has been extracted from K1 segment
GIVEN
Free-form comment text has been extracted from K1 segment
Applied to: Validate Comment Length
WHEN
The system validates the comment text length
THEN
The comment is accepted if it meets length requirements or rejected if it exceeds maximum allowed length
Context: A K1 comment has undergone length validation
GIVEN
A K1 comment has undergone length validation
Applied to: Comment Valid?
WHEN
The system evaluates comment validity based on length and content criteria
THEN
The comment is marked as valid for storage or invalid for rejection
Context: A K1 comment has been validated as acceptable
GIVEN
A K1 comment has been validated as acceptable
Applied to: Store K1 Comment in Array
WHEN
The system processes the valid comment for storage
THEN
The K1 comment is stored in the comment array for later association with cargo records
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
Processing continues with next K1 segment if more exist, or proceeds to comment count validation if no more segments
Context: All K1 segments have been processed and stored in array
GIVEN
All K1 segments have been processed and stored in array
Applied to: Check K1 Comment Count
WHEN
The system counts the total number of K1 comments collected
THEN
The comment count is evaluated against maximum allowed limit of 4 comments per cargo
Context: K1 comment count has been determined
GIVEN
K1 comment count has been determined
Applied to: Count ≤ 4?
WHEN
The system evaluates if comment count is less than or equal to 4
THEN
Comments are accepted for cargo association if count is 4 or less, or processing completes if limit exceeded
Context: K1 comments have passed count validation (≤ 4)
GIVEN
K1 comments have passed count validation (≤ 4)
Applied to: Add K1 Comment to Cargo Record
WHEN
The system processes comments for cargo association
THEN
K1 comments are added to the cargo record for inclusion in disposition code processing
Context: K1 comments have been added to cargo record
GIVEN
K1 comments have been added to cargo record
Applied to: Log K1 Remarks with Cargo Information
WHEN
The system processes cargo with associated K1 remarks
THEN
K1 remarks are logged with cargo identification information for audit trail
Context: K1 remarks have been logged with cargo information
GIVEN
K1 remarks have been logged with cargo information
Applied to: Associate K1 with Disposition Code
WHEN
The system processes disposition codes for the cargo
THEN
K1 remarks are associated with the relevant disposition code for customs release processing
Context: K1 remarks have been associated with disposition code
GIVEN
K1 remarks have been associated with disposition code
Applied to: Update Cargo Processing Log
WHEN
The system completes K1 processing for cargo
THEN
Cargo processing log is updated to record K1 remarks inclusion in disposition code processing
Context: A K1 comment has failed validation criteria
GIVEN
A K1 comment has failed validation criteria
Applied to: Reject Invalid Comment
WHEN
The system processes the invalid comment
THEN
The K1 comment is rejected and excluded from cargo processing
Context: A K1 comment has been rejected due to validation failure
GIVEN
A K1 comment has been rejected due to validation failure
Applied to: Log Error Message
WHEN
The system processes the rejection
THEN
An error message is logged documenting the K1 comment validation failure for audit purposes
R-GCX016-cbl-02597 (+9) File: GCX016.cbl CPRS Cargo Not Found Error Handling Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CPRS Cargo Not Found Error Handling':
  • Context - a cargo lookup has failed and cargo record information is available:
    For Is this CPRS Cargo?:
    When the system evaluates the cargo type to determine if it is cprs cargo, then the system routes to cprs-specific error handling if cargo is cprs type, otherwise skips specialized error processing.
  • Context - a cprs cargo record lookup has failed:
    For Generate CPRS Cargo Not Found Error Message:
    When the system needs to generate an error notification, then the system creates a cprs-specific 'cargo not found' error message and increments the error counter.
  • Context - a cprs cargo not found error needs to be reported:
    For Format Error Message with Cargo Details:
    When the system formats the error message content, then the system creates message format 'uscs *error** dc:' + disposition code + ccn key + '*notfound*'.
  • Context - a cprs error message is being formatted:
    For Include Car ID and Waybill Information:
    When car id and waybill information is available from the cargo record, then the system includes the car identification and waybill number in the error message content.
  • Context - a cprs cargo not found error is being formatted:
    For Add Disposition Code Information:
    When a disposition code was being processed for the missing cargo, then the system includes the disposition code in the error message to identify what customs action was attempted.
  • Context - a cprs cargo not found error message has been formatted:
    For Set Error Message Type:
    When the system needs to classify the message for routing, then the system sets the message type as 'error' to ensure proper handling and routing.
  • Context - a cprs error message has been classified as error type:
    For Route Error Message to Multiple Destinations:
    When the system routes the error message, then the system sends the message to both 'in' destination and 'userr' destination for comprehensive error notification.
  • Context - a cprs error message has been routed to destinations:
    For Log Error for Audit Trail:
    When the system completes error processing, then the system logs the error occurrence for audit trail and sets the cargo not found flag for downstream processing.
  • Context - cprs error processing has been completed or skipped:
    For Continue Processing Next Cargo:
    When the system finishes error handling for current cargo, then the system continues processing the next cargo record in the queue.
  • Context - a cargo lookup has failed:
    For Skip Error Generation:
    When the cargo is determined to be non-cprs cargo type, then the system skips cprs-specific error message generation and continues with standard processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo lookup has failed and cargo record information is available
GIVEN
A cargo lookup has failed and cargo record information is available
Applied to: Is this CPRS Cargo?
WHEN
The system evaluates the cargo type to determine if it is CPRS cargo
THEN
The system routes to CPRS-specific error handling if cargo is CPRS type, otherwise skips specialized error processing
Context: A CPRS cargo record lookup has failed
GIVEN
A CPRS cargo record lookup has failed
Applied to: Generate CPRS Cargo Not Found Error Message
WHEN
The system needs to generate an error notification
THEN
The system creates a CPRS-specific 'cargo not found' error message and increments the error counter
Context: A CPRS cargo not found error needs to be reported
GIVEN
A CPRS cargo not found error needs to be reported
Applied to: Format Error Message with Cargo Details
WHEN
The system formats the error message content
THEN
The system creates message format 'USCS *ERROR** DC:' + disposition code + CCN key + '*NotFound*'
Context: A CPRS error message is being formatted
GIVEN
A CPRS error message is being formatted
Applied to: Include Car ID and Waybill Information
WHEN
Car ID and waybill information is available from the cargo record
THEN
The system includes the car identification and waybill number in the error message content
Context: A CPRS cargo not found error is being formatted
GIVEN
A CPRS cargo not found error is being formatted
Applied to: Add Disposition Code Information
WHEN
A disposition code was being processed for the missing cargo
THEN
The system includes the disposition code in the error message to identify what customs action was attempted
Context: A CPRS cargo not found error message has been formatted
GIVEN
A CPRS cargo not found error message has been formatted
Applied to: Set Error Message Type
WHEN
The system needs to classify the message for routing
THEN
The system sets the message type as 'ERROR' to ensure proper handling and routing
Context: A CPRS error message has been classified as error type
GIVEN
A CPRS error message has been classified as error type
Applied to: Route Error Message to Multiple Destinations
WHEN
The system routes the error message
THEN
The system sends the message to both 'IN' destination and 'USERR' destination for comprehensive error notification
Context: A CPRS error message has been routed to destinations
GIVEN
A CPRS error message has been routed to destinations
Applied to: Log Error for Audit Trail
WHEN
The system completes error processing
THEN
The system logs the error occurrence for audit trail and sets the cargo not found flag for downstream processing
Context: CPRS error processing has been completed or skipped
GIVEN
CPRS error processing has been completed or skipped
Applied to: Continue Processing Next Cargo
WHEN
The system finishes error handling for current cargo
THEN
The system continues processing the next cargo record in the queue
Context: A cargo lookup has failed
GIVEN
A cargo lookup has failed
Applied to: Skip Error Generation
WHEN
The cargo is determined to be non-CPRS cargo type
THEN
The system skips CPRS-specific error message generation and continues with standard processing
R-GCX016-cbl-02607 (+5) File: GCX016.cbl Train Not Arrived Warning Generation Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Not Arrived Warning Generation':
  • Context - a train processing request is received with train identification information:
    For Check Train Status in System:
    When the system checks the train status in the uscs database, then the system determines if the train is properly arrived or not arrived and sets appropriate processing flags.
  • Context - a train is found to be not arrived in the uscs system:
    For Generate Train Not Arrived Warning Message:
    When the system needs to generate a warning notification, then the system creates a warning message stating 're-arrive train or contact uscs' with train identification details.
  • Context - a train not arrived warning needs to be generated:
    For Format Warning with Train Details:
    When the system formats the warning message, then the message includes train vessel name, manifest information, and disposition code details in a structured format.
  • Context - a formatted train not arrived warning message is ready for distribution:
    For Route Warning to Operations Team:
    When the system routes the warning message, then the message is sent through the merlin system to operational teams and logged for tracking purposes.
  • Context - a train not arrived warning has been generated and routed:
    For Continue Processing with Warning Flag:
    When the system continues with cargo processing operations, then processing continues with appropriate warning flags set to indicate the train arrival issue.
  • Context - a train is found to be properly arrived in the uscs system:
    For Normal Train Processing:
    When the system processes the train request, then normal cargo processing operations proceed without generating warning messages.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request is received with train identification information
GIVEN
A train processing request is received with train identification information
Applied to: Check Train Status in System
WHEN
The system checks the train status in the USCS database
THEN
The system determines if the train is properly arrived or not arrived and sets appropriate processing flags
Context: A train is found to be not arrived in the USCS system
GIVEN
A train is found to be not arrived in the USCS system
Applied to: Generate Train Not Arrived Warning Message
WHEN
The system needs to generate a warning notification
THEN
The system creates a warning message stating 'Re-arrive train or contact USCS' with train identification details
Context: A train not arrived warning needs to be generated
GIVEN
A train not arrived warning needs to be generated
Applied to: Format Warning with Train Details
WHEN
The system formats the warning message
THEN
The message includes train vessel name, manifest information, and disposition code details in a structured format
Context: A formatted train not arrived warning message is ready for distribution
GIVEN
A formatted train not arrived warning message is ready for distribution
Applied to: Route Warning to Operations Team
WHEN
The system routes the warning message
THEN
The message is sent through the Merlin system to operational teams and logged for tracking purposes
Context: A train not arrived warning has been generated and routed
GIVEN
A train not arrived warning has been generated and routed
Applied to: Continue Processing with Warning Flag
WHEN
The system continues with cargo processing operations
THEN
Processing continues with appropriate warning flags set to indicate the train arrival issue
Context: A train is found to be properly arrived in the USCS system
GIVEN
A train is found to be properly arrived in the USCS system
Applied to: Normal Train Processing
WHEN
The system processes the train request
THEN
Normal cargo processing operations proceed without generating warning messages
R-GCX016-cbl-02613 (+14) File: GCX016.cbl Train Arrival Cancellation Warning Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Arrival Cancellation Warning':
  • Context - a train arrival cancellation request is received with event code 'coc':
    For Train Arrival Cancellation Request Received:
    When the system processes the v9 segment with cancellation event code, then the system initiates train arrival cancellation processing workflow.
  • Context - a train arrival cancellation request is being processed:
    For Is Train Found in System?:
    When the system searches for the train using the vessel name from the manifest, then the system determines if the train exists and sets appropriate processing flags.
  • Context - a train exists in the system for the cancellation request:
    For Retrieve Train Information:
    When the system retrieves train information using the vessel name, then the system loads train details including current status and arrival information.
  • Context - train information has been retrieved from the system:
    For Check Current Train Status:
    When the system examines the train's current operational status, then the system determines the train's arrival status for cancellation processing.
  • Context - the train's current status has been assessed:
    For Is Train Currently Arrived?:
    When the system checks if the train status indicates arrival has occurred, then the system determines whether cancellation processing should proceed or complete.
  • Context - a train is currently in arrived status and cancellation is requested:
    For Generate Cancellation Warning Message:
    When the system processes the cancellation for an arrived train, then the system generates a cancellation warning message with appropriate details.
  • Context - a cancellation warning message needs to be generated:
    For Format Warning with Train Details:
    When the system formats the warning message, then the message includes train identification, arrival details, and cancellation context.
  • Context - a warning message is being formatted for train arrival cancellation:
    For Include Cancellation Reason Code:
    When the system includes the cancellation reason code, then the message contains the specific reason code that triggered the cancellation.
  • Context - a cancellation warning message is being prepared:
    For Add CBP Reference Information:
    When the system adds cbp reference information, then the message includes instructions to contact cbp and relevant reference numbers.
  • Context - a complete cancellation warning message has been prepared:
    For Route Warning to Operations Team:
    When the system routes the warning to the operations team, then the operations team receives notification of the train arrival cancellation.
  • Context - the operations team has been notified of the cancellation:
    For Send Notification to Manifest Control:
    When the system sends notification to manifest control, then manifest control receives details of the cancelled train arrival for processing.
  • Context - all notifications have been sent for the train arrival cancellation:
    For Update Train Status to Cancelled:
    When the system updates the train status, then the train status is changed to cancelled and arrival information is cleared.
  • Context - the train status has been updated to cancelled:
    For Log Cancellation Event:
    When the system logs the cancellation event, then a complete audit record is created with cancellation details, timestamp, and reason code.
  • Context - a train arrival cancellation request is received for a non-existent train:
    For Generate Error Message - Train Not Found:
    When the system cannot locate the train in the database, then an error message is generated indicating the train was not found.
  • Context - an error has been generated for a train not found condition:
    For Route Error to System Administrator:
    When the system routes the error message, then the system administrator receives the error for investigation and resolution.
👨‍💻 Technical ACs (Gherkin)
Context: A train arrival cancellation request is received with event code 'COC'
GIVEN
A train arrival cancellation request is received with event code 'COC'
Applied to: Train Arrival Cancellation Request Received
WHEN
The system processes the V9 segment with cancellation event code
THEN
The system initiates train arrival cancellation processing workflow
Context: A train arrival cancellation request is being processed
GIVEN
A train arrival cancellation request is being processed
Applied to: Is Train Found in System?
WHEN
The system searches for the train using the vessel name from the manifest
THEN
The system determines if the train exists and sets appropriate processing flags
Context: A train exists in the system for the cancellation request
GIVEN
A train exists in the system for the cancellation request
Applied to: Retrieve Train Information
WHEN
The system retrieves train information using the vessel name
THEN
The system loads train details including current status and arrival information
Context: Train information has been retrieved from the system
GIVEN
Train information has been retrieved from the system
Applied to: Check Current Train Status
WHEN
The system examines the train's current operational status
THEN
The system determines the train's arrival status for cancellation processing
Context: The train's current status has been assessed
GIVEN
The train's current status has been assessed
Applied to: Is Train Currently Arrived?
WHEN
The system checks if the train status indicates arrival has occurred
THEN
The system determines whether cancellation processing should proceed or complete
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: Generate Cancellation Warning Message
WHEN
The system processes the cancellation for an arrived train
THEN
The system generates a cancellation warning message with appropriate details
Context: A cancellation warning message needs to be generated
GIVEN
A cancellation warning message needs to be generated
Applied to: Format Warning with Train Details
WHEN
The system formats the warning message
THEN
The message includes train identification, arrival details, and cancellation context
Context: A warning message is being formatted for train arrival cancellation
GIVEN
A warning message is being formatted for train arrival cancellation
Applied to: Include Cancellation Reason Code
WHEN
The system includes the cancellation reason code
THEN
The message contains the specific reason code that triggered the cancellation
Context: A cancellation warning message is being prepared
GIVEN
A cancellation warning message is being prepared
Applied to: Add CBP Reference Information
WHEN
The system adds CBP reference information
THEN
The message includes instructions to contact CBP and relevant reference numbers
Context: A complete cancellation warning message has been prepared
GIVEN
A complete cancellation warning message has been prepared
Applied to: Route Warning to Operations Team
WHEN
The system routes the warning to the operations team
THEN
The operations team receives notification of the train arrival cancellation
Context: The operations team has been notified of the cancellation
GIVEN
The operations team has been notified of the cancellation
Applied to: Send Notification to Manifest Control
WHEN
The system sends notification to manifest control
THEN
Manifest control receives details of the cancelled train arrival for processing
Context: All notifications have been sent for the train arrival cancellation
GIVEN
All notifications have been sent for the train arrival cancellation
Applied to: Update Train Status to Cancelled
WHEN
The system updates the train status
THEN
The train status is changed to cancelled and arrival information is cleared
Context: The train status has been updated to cancelled
GIVEN
The train status has been updated to cancelled
Applied to: Log Cancellation Event
WHEN
The system logs the cancellation event
THEN
A complete audit record is created with cancellation details, timestamp, and reason code
Context: A train arrival cancellation request is received for a non-existent train
GIVEN
A train arrival cancellation request is received for a non-existent train
Applied to: Generate Error Message - Train Not Found
WHEN
The system cannot locate the train in the database
THEN
An error message is generated indicating the train was not found
Context: An error has been generated for a train not found condition
GIVEN
An error has been generated for a train not found condition
Applied to: Route Error to System Administrator
WHEN
The system routes the error message
THEN
The system administrator receives the error for investigation and resolution
R-GCX016-cbl-02628 (+8) File: GCX016.cbl Cargo Status Array Creation Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Array Creation':
  • Context - a cargo record is identified for status array creation:
    For Does Cargo Have Existing S09 Status Segments?:
    When the system checks for existing s09 status segments for the cargo, then the system identifies whether status segments exist or need to be created.
  • Context - a cargo record has existing s09 status segments in the database:
    For Retrieve Existing S09 Segments from Database:
    When the system needs to work with cargo status information, then the system retrieves all existing s09 status segments for the cargo record.
  • Context - a cargo record does not have existing s09 status segments:
    For Initialize Empty Status Array Structure:
    When the system needs to create status tracking for the cargo, then the system initializes an empty status array structure.
  • Context - a new status array is being created for a cargo record:
    For Set Array Counter to Zero:
    When the system initializes the array structure, then the array counter is set to zero to indicate no status entries exist.
  • Context - a status array structure needs to be created:
    For Allocate S09A Status Array Memory:
    When the system allocates memory for status tracking, then s09a status array memory is allocated with proper structure.
  • Context - a new status array has been allocated:
    For Set Default Array Parameters:
    When the system configures the array for use, then default array parameters are set according to system standards.
  • Context - a status array has been created and configured:
    For Mark Array as New/Empty:
    When the system needs to track the array state, then the array is marked as new and empty for proper processing.
  • Context - a status array has been created and marked as new:
    For Prepare Array for Disposition Code Processing:
    When the system prepares for disposition code processing, then the array is configured to accept and process disposition codes.
  • Context - a status array has been created and prepared for disposition code processing:
    For Status Array Ready for Use:
    When the system completes array initialization, then the status array is ready for use in cargo status operations.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is identified for status array creation
GIVEN
A cargo record is identified for status array creation
Applied to: Does Cargo Have Existing S09 Status Segments?
WHEN
The system checks for existing S09 status segments for the cargo
THEN
The system identifies whether status segments exist or need to be created
Context: A cargo record has existing S09 status segments in the database
GIVEN
A cargo record has existing S09 status segments in the database
Applied to: Retrieve Existing S09 Segments from Database
WHEN
The system needs to work with cargo status information
THEN
The system retrieves all existing S09 status segments for the cargo record
Context: A cargo record does not have existing S09 status segments
GIVEN
A cargo record does not have existing S09 status segments
Applied to: Initialize Empty Status Array Structure
WHEN
The system needs to create status tracking for the cargo
THEN
The system initializes an empty status array structure
Context: A new status array is being created for a cargo record
GIVEN
A new status array is being created for a cargo record
Applied to: Set Array Counter to Zero
WHEN
The system initializes the array structure
THEN
The array counter is set to zero to indicate no status entries exist
Context: A status array structure needs to be created
GIVEN
A status array structure needs to be created
Applied to: Allocate S09A Status Array Memory
WHEN
The system allocates memory for status tracking
THEN
S09A status array memory is allocated with proper structure
Context: A new status array has been allocated
GIVEN
A new status array has been allocated
Applied to: Set Default Array Parameters
WHEN
The system configures the array for use
THEN
Default array parameters are set according to system standards
Context: A status array has been created and configured
GIVEN
A status array has been created and configured
Applied to: Mark Array as New/Empty
WHEN
The system needs to track the array state
THEN
The array is marked as new and empty for proper processing
Context: A status array has been created and marked as new
GIVEN
A status array has been created and marked as new
Applied to: Prepare Array for Disposition Code Processing
WHEN
The system prepares for disposition code processing
THEN
The array is configured to accept and process disposition codes
Context: A status array has been created and prepared for disposition code processing
GIVEN
A status array has been created and prepared for disposition code processing
Applied to: Status Array Ready for Use
WHEN
The system completes array initialization
THEN
The status array is ready for use in cargo status operations
R-GCX016-cbl-02637 (+17) File: GCX016.cbl Cargo Status Array Replacement Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Array Replacement':
  • Context - a cargo status array (s09a-array) exists for processing:
    For Status Array Has Data?:
    When the system checks if the status array has any data elements, then if the array is empty or has no valid entries, skip processing and complete the operation, otherwise proceed with status array processing.
  • Context - the status array contains valid data elements to process:
    For Initialize S09 Segment Counter:
    When beginning the status array replacement process, then set the s09 segment counter to zero to start tracking segment creation.
  • Context - a status array with multiple elements exists:
    For More Array Elements?:
    When processing status array elements sequentially, then continue processing if more array elements exist, otherwise proceed to update the cargo root record.
  • Context - a valid status array element with disposition information:
    For Build S09 Segment from Array Element:
    When building an s09 segment from the array element, then initialize a new s09 segment structure with the cargo ccn key and appropriate sequence number.
  • Context - a status array element contains a disposition code:
    For Set Disposition Code:
    When building the s09 segment, then copy the disposition code from the array element to the s09 segment disposition code field.
  • Context - a status array element contains entry number information:
    For Set Entry Number:
    When building the s09 segment, then copy the entry number from the array element to the s09 segment entry number field.
  • Context - a status array element contains quantity information:
    For Set Quantity Information:
    When building the s09 segment, then copy the quantity values from the array element to the s09 segment quantity fields.
  • Context - a status array element contains release status information:
    For Set Release Status Flag:
    When building the s09 segment, then copy the release status flag from the array element to the s09 segment release flag field.
  • Context - a status array element contains location information:
    For Set Location Information:
    When building the s09 segment, then copy the location data from the array element to the s09 segment location fields.
  • Context - a status array element contains date and time information:
    For Set Date/Time Stamps:
    When building the s09 segment, then copy the date and time stamps from the array element to the s09 segment date/time fields.
  • Context - a complete s09 segment has been constructed from status array data:
    For Insert S09 Segment to Database:
    When inserting the s09 segment into the database, then write the s09 segment to the gcsuss09 status segments database.
  • Context - an s09 segment has been successfully created and inserted:
    For Increment Segment Counter:
    When tracking the number of segments created, then increment the segment counter by one to reflect the new segment.
  • Context - the current status array element has been processed:
    For Move to Next Array Element:
    When continuing array processing, then move the array pointer to the next element for subsequent processing.
  • Context - all status array elements have been processed and s09 segments created:
    For Update Cargo Root with New Status Count:
    When updating the cargo root record, then set the status segment count in the cargo root to match the number of s09 segments created.
  • Context - the cargo root record has been updated with new status information:
    For Replace Cargo Record in Database:
    When replacing the cargo record in the database, then update the existing cargo record in the gcsusrt cargo root database with the modified data.
  • Context - a cargo record replacement operation has been attempted:
    For Database Update Successful?:
    When checking the database update result, then if the update was successful, proceed to logging, otherwise handle the database error.
  • Context - the cargo record and s09 segments have been successfully updated in the database:
    For Log Status Array Update:
    When completing the status array replacement process, then create a log entry documenting the successful status array update operation.
  • Context - a database update operation has failed:
    For Handle Database Error:
    When processing the database error, then execute appropriate error handling procedures and complete the operation with error status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status array (S09A-ARRAY) exists for processing
GIVEN
A cargo status array (S09A-ARRAY) exists for processing
Applied to: Status Array Has Data?
WHEN
The system checks if the status array has any data elements
THEN
If the array is empty or has no valid entries, skip processing and complete the operation, otherwise proceed with status array processing
Context: The status array contains valid data elements to process
GIVEN
The status array contains valid data elements to process
Applied to: Initialize S09 Segment Counter
WHEN
Beginning the status array replacement process
THEN
Set the S09 segment counter to zero to start tracking segment creation
Context: A status array with multiple elements exists
GIVEN
A status array with multiple elements exists
Applied to: More Array Elements?
WHEN
Processing status array elements sequentially
THEN
Continue processing if more array elements exist, otherwise proceed to update the cargo root record
Context: A valid status array element with disposition information
GIVEN
A valid status array element with disposition information
Applied to: Build S09 Segment from Array Element
WHEN
Building an S09 segment from the array element
THEN
Initialize a new S09 segment structure with the cargo CCN key and appropriate sequence number
Context: A status array element contains a disposition code
GIVEN
A status array element contains a disposition code
Applied to: Set Disposition Code
WHEN
Building the S09 segment
THEN
Copy the disposition code from the array element to the S09 segment disposition code field
Context: A status array element contains entry number information
GIVEN
A status array element contains entry number information
Applied to: Set Entry Number
WHEN
Building the S09 segment
THEN
Copy the entry number from the array element to the S09 segment entry number field
Context: A status array element contains quantity information
GIVEN
A status array element contains quantity information
Applied to: Set Quantity Information
WHEN
Building the S09 segment
THEN
Copy the quantity values from the array element to the S09 segment quantity fields
Context: A status array element contains release status information
GIVEN
A status array element contains release status information
Applied to: Set Release Status Flag
WHEN
Building the S09 segment
THEN
Copy the release status flag from the array element to the S09 segment release flag field
Context: A status array element contains location information
GIVEN
A status array element contains location information
Applied to: Set Location Information
WHEN
Building the S09 segment
THEN
Copy the location data from the array element to the S09 segment location fields
Context: A status array element contains date and time information
GIVEN
A status array element contains date and time information
Applied to: Set Date/Time Stamps
WHEN
Building the S09 segment
THEN
Copy the date and time stamps from the array element to the S09 segment date/time fields
Context: A complete S09 segment has been constructed from status array data
GIVEN
A complete S09 segment has been constructed from status array data
Applied to: Insert S09 Segment to Database
WHEN
Inserting the S09 segment into the database
THEN
Write the S09 segment to the GCSUSS09 status segments database
Context: An S09 segment has been successfully created and inserted
GIVEN
An S09 segment has been successfully created and inserted
Applied to: Increment Segment Counter
WHEN
Tracking the number of segments created
THEN
Increment the segment counter by one to reflect the new segment
Context: The current status array element has been processed
GIVEN
The current status array element has been processed
Applied to: Move to Next Array Element
WHEN
Continuing array processing
THEN
Move the array pointer to the next element for subsequent processing
Context: All status array elements have been processed and S09 segments created
GIVEN
All status array elements have been processed and S09 segments created
Applied to: Update Cargo Root with New Status Count
WHEN
Updating the cargo root record
THEN
Set the status segment count in the cargo root to match the number of S09 segments created
Context: The cargo root record has been updated with new status information
GIVEN
The cargo root record has been updated with new status information
Applied to: Replace Cargo Record in Database
WHEN
Replacing the cargo record in the database
THEN
Update the existing cargo record in the GCSUSRT cargo root database with the modified data
Context: A cargo record replacement operation has been attempted
GIVEN
A cargo record replacement operation has been attempted
Applied to: Database Update Successful?
WHEN
Checking the database update result
THEN
If the update was successful, proceed to logging, otherwise handle the database error
Context: The cargo record and S09 segments have been successfully updated in the database
GIVEN
The cargo record and S09 segments have been successfully updated in the database
Applied to: Log Status Array Update
WHEN
Completing the status array replacement process
THEN
Create a log entry documenting the successful status array update operation
Context: A database update operation has failed
GIVEN
A database update operation has failed
Applied to: Handle Database Error
WHEN
Processing the database error
THEN
Execute appropriate error handling procedures and complete the operation with error status
R-GCX016-cbl-02672 (+7) File: GCX016.cbl Status Array Initialization Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Initialization':
  • Context - a cargo record has been identified for processing:
    For S09 Status Segments Exist?:
    When the system checks for existing s09 status segments associated with the cargo record, then the system identifies whether s09 segments exist and routes processing accordingly.
  • Context - s09 status segments exist for the cargo record in the database:
    For Fetch Existing S09 Segments from Database:
    When the system needs to load existing status information, then the system fetches all s09 segments associated with the cargo record from gcsuss09 ims segment.
  • Context - no s09 status segments exist for the cargo record:
    For Initialize Empty S09A Status Array:
    When the system needs to create a new status array for processing, then the system initializes an empty s09a status array structure.
  • Context - an empty s09a status array has been initialized:
    For Set Array Element Count to Zero:
    When the system sets up the array structure properties, then the array element count is set to zero to reflect no existing status entries.
  • Context - the status array element count has been set to zero:
    For Allocate Array Memory Structure:
    When the system prepares the array for status processing operations, then the system allocates the required memory structure for the status array.
  • Context - the status array memory structure has been allocated:
    For Set Default Array Properties:
    When the system configures the array for cargo status operations, then the system sets default properties and characteristics for the status array.
  • Context - the status array has been initialized with default properties:
    For Mark Array as Newly Created:
    When the system needs to track the origin of the status array, then the system marks the array as newly created for processing identification.
  • Context - the status array has been either fetched from existing segments or newly initialized:
    For Status Array Ready for Processing:
    When all array setup operations have been completed, then the status array is ready for cargo status processing operations.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has been identified for processing
GIVEN
A cargo record has been identified for processing
Applied to: S09 Status Segments Exist?
WHEN
The system checks for existing S09 status segments associated with the cargo record
THEN
The system identifies whether S09 segments exist and routes processing accordingly
Context: S09 status segments exist for the cargo record in the database
GIVEN
S09 status segments exist for the cargo record in the database
Applied to: Fetch Existing S09 Segments from Database
WHEN
The system needs to load existing status information
THEN
The system fetches all S09 segments associated with the cargo record from GCSUSS09 IMS segment
Context: No S09 status segments exist for the cargo record
GIVEN
No S09 status segments exist for the cargo record
Applied to: Initialize Empty S09A Status Array
WHEN
The system needs to create a new status array for processing
THEN
The system initializes an empty S09A status array structure
Context: An empty S09A status array has been initialized
GIVEN
An empty S09A status array has been initialized
Applied to: Set Array Element Count to Zero
WHEN
The system sets up the array structure properties
THEN
The array element count is set to zero to reflect no existing status entries
Context: The status array element count has been set to zero
GIVEN
The status array element count has been set to zero
Applied to: Allocate Array Memory Structure
WHEN
The system prepares the array for status processing operations
THEN
The system allocates the required memory structure for the status array
Context: The status array memory structure has been allocated
GIVEN
The status array memory structure has been allocated
Applied to: Set Default Array Properties
WHEN
The system configures the array for cargo status operations
THEN
The system sets default properties and characteristics for the status array
Context: The status array has been initialized with default properties
GIVEN
The status array has been initialized with default properties
Applied to: Mark Array as Newly Created
WHEN
The system needs to track the origin of the status array
THEN
The system marks the array as newly created for processing identification
Context: The status array has been either fetched from existing segments or newly initialized
GIVEN
The status array has been either fetched from existing segments or newly initialized
Applied to: Status Array Ready for Processing
WHEN
All array setup operations have been completed
THEN
The status array is ready for cargo status processing operations
R-GCX016-cbl-02680 (+10) File: GCX016.cbl Status Array Population Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Population':
  • Context - a cargo record requires status information to be loaded:
    For Initialize S09A Array Counter to Zero:
    When the status array population process begins, then the s09a array counter is set to zero to start fresh population.
  • Context - a cargo record exists in the system with potential status segments:
    For Call GCCUSIO to Get First S09 Status Segment:
    When the system needs to load status information, then the system calls gccusio to retrieve the first s09 status segment for the cargo.
  • Context - a request has been made to retrieve an s09 status segment:
    For S09 Segment Found?:
    When the database call completes, then the system determines if a valid s09 segment was found and proceeds accordingly.
  • Context - a valid s09 status segment has been retrieved from the database:
    For Extract Status Information from S09 Segment:
    When the segment needs to be processed, then the system extracts status info code, entry number, quantity, released flag, location code, and status description from the segment.
  • Context - status information has been extracted from an s09 segment:
    For Populate S09A Array Element with: - Status Info Code - Entry Number - Quantity - Released Flag - Location Code - Status Description:
    When the array element needs to be populated, then the system stores the status info code, entry number, quantity, released flag, location code, and status description in the current s09a array element.
  • Context - an s09a array element has been successfully populated with status information:
    For Increment Array Counter:
    When the element population is complete, then the system increments the array counter by one to point to the next available array position.
  • Context - the array counter has been incremented after populating an element:
    For Array Counter < Maximum Limit?:
    When the system needs to determine if more elements can be added, then the system checks if the array counter is less than the maximum limit and determines the next action.
  • Context - the array has capacity for more elements and previous segments have been processed:
    For Call GCCUSIO to Get Next S09 Status Segment:
    When additional status segments need to be retrieved, then the system calls gccusio to get the next s09 status segment for the same cargo.
  • Context - all available s09 segments have been processed or no segments were found:
    For Set Total Array Count:
    When the status array population process is complete, then the system sets the total array count to reflect the number of elements populated.
  • Context - the array counter has reached or exceeded the maximum allowed limit:
    For Array Overflow - Log Warning:
    When additional s09 segments are available but cannot be processed, then the system logs a warning about array overflow and stops further population.
  • Context - all available s09 segments have been processed or array limits have been reached:
    For Status Array Population Complete:
    When the population process concludes, then the system marks the status array population as complete and the array is ready for use.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires status information to be loaded
GIVEN
A cargo record requires status information to be loaded
Applied to: Initialize S09A Array Counter to Zero
WHEN
The status array population process begins
THEN
The S09A array counter is set to zero to start fresh population
Context: A cargo record exists in the system with potential status segments
GIVEN
A cargo record exists in the system with potential status segments
Applied to: Call GCCUSIO to Get First S09 Status Segment
WHEN
The system needs to load status information
THEN
The system calls GCCUSIO to retrieve the first S09 status segment for the cargo
Context: A request has been made to retrieve an S09 status segment
GIVEN
A request has been made to retrieve an S09 status segment
Applied to: S09 Segment Found?
WHEN
The database call completes
THEN
The system determines if a valid S09 segment was found and proceeds accordingly
Context: A valid S09 status segment has been retrieved from the database
GIVEN
A valid S09 status segment has been retrieved from the database
Applied to: Extract Status Information from S09 Segment
WHEN
The segment needs to be processed
THEN
The system extracts status info code, entry number, quantity, released flag, location code, and status description from the segment
Context: Status information has been extracted from an S09 segment
GIVEN
Status information has been extracted from an S09 segment
Applied to: Populate S09A Array Element with: - Status Info Code - Entry Number - Quantity - Released Flag - Location Code - Status Description
WHEN
The array element needs to be populated
THEN
The system stores the status info code, entry number, quantity, released flag, location code, and status description in the current S09A array element
Context: An S09A array element has been successfully populated with status information
GIVEN
An S09A array element has been successfully populated with status information
Applied to: Increment Array Counter
WHEN
The element population is complete
THEN
The system increments the array counter by one to point to the next available array position
Context: The array counter has been incremented after populating an element
GIVEN
The array counter has been incremented after populating an element
Applied to: Array Counter < Maximum Limit?
WHEN
The system needs to determine if more elements can be added
THEN
The system checks if the array counter is less than the maximum limit and determines the next action
Context: The array has capacity for more elements and previous segments have been processed
GIVEN
The array has capacity for more elements and previous segments have been processed
Applied to: Call GCCUSIO to Get Next S09 Status Segment
WHEN
Additional status segments need to be retrieved
THEN
The system calls GCCUSIO to get the next S09 status segment for the same cargo
Context: All available S09 segments have been processed or no segments were found
GIVEN
All available S09 segments have been processed or no segments were found
Applied to: Set Total Array Count
WHEN
The status array population process is complete
THEN
The system sets the total array count to reflect the number of elements populated
Context: The array counter has reached or exceeded the maximum allowed limit
GIVEN
The array counter has reached or exceeded the maximum allowed limit
Applied to: Array Overflow - Log Warning
WHEN
Additional S09 segments are available but cannot be processed
THEN
The system logs a warning about array overflow and stops further population
Context: All available S09 segments have been processed or array limits have been reached
GIVEN
All available S09 segments have been processed or array limits have been reached
Applied to: Status Array Population Complete
WHEN
The population process concludes
THEN
The system marks the status array population as complete and the array is ready for use
R-GCX016-cbl-02691 (+11) File: GCX016.cbl Status Array Persistence Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Persistence':
  • Context - status array processing has been completed:
    For Status Array Modified?:
    When the system checks if any modifications were made to the status array, then if modifications exist, proceed with database update preparation, otherwise skip to next processing step.
  • Context - status array has been modified during processing:
    For Prepare S09 Segment Update:
    When the system prepares to update the s09 segment, then initialize s09 segment structure and prepare for data movement from status array.
  • Context - s09 segment update has been prepared:
    For Move S09A Array Data to Database Format:
    When the system moves data from s09a array to database format, then convert all status entries from array format to s09 segment structure maintaining proper sequence and occurrence numbers.
  • Context - status array data has been moved to database format:
    For Calculate Number of Status Entries:
    When the system calculates the number of status entries, then count all non-blank status entries in the array and set the total count for database operations.
  • Context - number of status entries has been calculated:
    For Status Entries Exist?:
    When the system checks if status entries exist, then if status entries exist, proceed with s09 segment replacement, otherwise proceed directly to cargo record update.
  • Context - status entries exist and have been formatted for database storage:
    For Replace GCSUSS09 Segment with Updated Status:
    When the system replaces the gcsuss09 segment, then update the database with new status information maintaining proper key structure and sequence numbers.
  • Context - s09 segment has been updated or no status entries exist:
    For Update Cargo Root Record Status Flags:
    When the system updates cargo root record status flags, then set appropriate status flags in the cargo root record based on the final status array analysis.
  • Context - cargo root record status flags have been updated:
    For Replace GCSUSRT Cargo Record:
    When the system replaces the gcsusrt cargo record, then update the database cargo record with all modified fields including status, quantities, and processing flags.
  • Context - cargo record replacement has been attempted:
    For Database Update Successful?:
    When the system checks if the database update was successful, then if successful, proceed to log changes, otherwise handle database error and retry operation.
  • Context - database update has been successful:
    For Log Status Array Changes:
    When the system logs status array changes, then record all status modifications, timestamps, and processing details in the audit log.
  • Context - database update has failed:
    For Handle Database Error:
    When the system handles the database error, then log error details, determine if retry is appropriate, and implement error recovery procedures.
  • Context - database error has been handled:
    For Retry Database Operation:
    When the system retries the database operation, then attempt the database update again with appropriate retry logic and error handling.
👨‍💻 Technical ACs (Gherkin)
Context: Status array processing has been completed
GIVEN
Status array processing has been completed
Applied to: Status Array Modified?
WHEN
The system checks if any modifications were made to the status array
THEN
If modifications exist, proceed with database update preparation, otherwise skip to next processing step
Context: Status array has been modified during processing
GIVEN
Status array has been modified during processing
Applied to: Prepare S09 Segment Update
WHEN
The system prepares to update the S09 segment
THEN
Initialize S09 segment structure and prepare for data movement from status array
Context: S09 segment update has been prepared
GIVEN
S09 segment update has been prepared
Applied to: Move S09A Array Data to Database Format
WHEN
The system moves data from S09A array to database format
THEN
Convert all status entries from array format to S09 segment structure maintaining proper sequence and occurrence numbers
Context: Status array data has been moved to database format
GIVEN
Status array data has been moved to database format
Applied to: Calculate Number of Status Entries
WHEN
The system calculates the number of status entries
THEN
Count all non-blank status entries in the array and set the total count for database operations
Context: Number of status entries has been calculated
GIVEN
Number of status entries has been calculated
Applied to: Status Entries Exist?
WHEN
The system checks if status entries exist
THEN
If status entries exist, proceed with S09 segment replacement, otherwise proceed directly to cargo record update
Context: Status entries exist and have been formatted for database storage
GIVEN
Status entries exist and have been formatted for database storage
Applied to: Replace GCSUSS09 Segment with Updated Status
WHEN
The system replaces the GCSUSS09 segment
THEN
Update the database with new status information maintaining proper key structure and sequence numbers
Context: S09 segment has been updated or no status entries exist
GIVEN
S09 segment has been updated or no status entries exist
Applied to: Update Cargo Root Record Status Flags
WHEN
The system updates cargo root record status flags
THEN
Set appropriate status flags in the cargo root record based on the final status array analysis
Context: Cargo root record status flags have been updated
GIVEN
Cargo root record status flags have been updated
Applied to: Replace GCSUSRT Cargo Record
WHEN
The system replaces the GCSUSRT cargo record
THEN
Update the database cargo record with all modified fields including status, quantities, and processing flags
Context: Cargo record replacement has been attempted
GIVEN
Cargo record replacement has been attempted
Applied to: Database Update Successful?
WHEN
The system checks if the database update was successful
THEN
If successful, proceed to log changes, otherwise handle database error and retry operation
Context: Database update has been successful
GIVEN
Database update has been successful
Applied to: Log Status Array Changes
WHEN
The system logs status array changes
THEN
Record all status modifications, timestamps, and processing details in the audit log
Context: Database update has failed
GIVEN
Database update has failed
Applied to: Handle Database Error
WHEN
The system handles the database error
THEN
Log error details, determine if retry is appropriate, and implement error recovery procedures
Context: Database error has been handled
GIVEN
Database error has been handled
Applied to: Retry Database Operation
WHEN
The system retries the database operation
THEN
Attempt the database update again with appropriate retry logic and error handling
R-GCX016-cbl-02716 (+10) File: GCX016.cbl Counterpart Disposition Code Removal Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Counterpart Disposition Code Removal':
  • Context - a new disposition code is received for processing:
    For Check Disposition Code Table for Counterpart Info:
    When the system checks the disposition code table for counterpart information, then the system identifies if the disposition code has a counterpart code defined.
  • Context - the disposition code table has been checked for counterpart information:
    For Has Counterpart Code?:
    When the system evaluates if a counterpart code exists for the current disposition code, then the system either proceeds to search for counterpart codes in the status array or continues with normal processing.
  • Context - a counterpart code exists for the current disposition code:
    For Search Status Array for Counterpart Codes:
    When the system searches through all entries in the cargo status array, then the system identifies all occurrences of the counterpart disposition code in the array.
  • Context - the status array has been searched for counterpart codes:
    For Counterpart Found in Array?:
    When the system evaluates the search results, then the system either proceeds to validate matching criteria or continues without counterpart removal.
  • Context - a counterpart code has been found in the status array:
    For Status Info Match?:
    When the system compares the status information flags of the counterpart code with the removal criteria, then the system either removes the counterpart code immediately or checks additional matching criteria.
  • Context - the status information flags do not match for counterpart removal:
    For Entry Number Match?:
    When the system compares the entry numbers of the counterpart code with the removal criteria, then the system either removes the counterpart code or checks quantity matching criteria.
  • Context - the entry numbers do not match for counterpart removal:
    For Quantity Match?:
    When the system compares the quantities of the counterpart code with the removal criteria, then the system either removes the counterpart code or checks special code pattern matching.
  • Context - the quantities do not match for counterpart removal:
    For Special Code Pattern Match?:
    When the system evaluates special code patterns or business rules for the counterpart code, then the system either removes the counterpart code or determines no removal is needed.
  • Context - a counterpart code has been validated for removal based on matching criteria:
    For Remove Counterpart Code from Array:
    When the system removes the counterpart code from the status array, then the counterpart code entry is marked for deletion from the array.
  • Context - counterpart codes have been removed from the status array:
    For Compact Array Elements:
    When the system compacts the array to eliminate empty positions, then all remaining status entries are moved to fill gaps and maintain array integrity.
  • Context - the status array has been compacted after counterpart code removal:
    For Update Array Count:
    When the system recalculates the number of active entries in the array, then the array count is updated to reflect the current number of valid status entries.
👨‍💻 Technical ACs (Gherkin)
Context: A new disposition code is received for processing
GIVEN
A new disposition code is received for processing
Applied to: Check Disposition Code Table for Counterpart Info
WHEN
The system checks the disposition code table for counterpart information
THEN
The system identifies if the disposition code has a counterpart code defined
Context: The disposition code table has been checked for counterpart information
GIVEN
The disposition code table has been checked for counterpart information
Applied to: Has Counterpart Code?
WHEN
The system evaluates if a counterpart code exists for the current disposition code
THEN
The system either proceeds to search for counterpart codes in the status array or continues with normal processing
Context: A counterpart code exists for the current disposition code
GIVEN
A counterpart code exists for the current disposition code
Applied to: Search Status Array for Counterpart Codes
WHEN
The system searches through all entries in the cargo status array
THEN
The system identifies all occurrences of the counterpart disposition code in the array
Context: The status array has been searched for counterpart codes
GIVEN
The status array has been searched for counterpart codes
Applied to: Counterpart Found in Array?
WHEN
The system evaluates the search results
THEN
The system either proceeds to validate matching criteria or continues without counterpart removal
Context: A counterpart code has been found in the status array
GIVEN
A counterpart code has been found in the status array
Applied to: Status Info Match?
WHEN
The system compares the status information flags of the counterpart code with the removal criteria
THEN
The system either removes the counterpart code immediately or checks additional matching criteria
Context: The status information flags do not match for counterpart removal
GIVEN
The status information flags do not match for counterpart removal
Applied to: Entry Number Match?
WHEN
The system compares the entry numbers of the counterpart code with the removal criteria
THEN
The system either removes the counterpart code or checks quantity matching criteria
Context: The entry numbers do not match for counterpart removal
GIVEN
The entry numbers do not match for counterpart removal
Applied to: Quantity Match?
WHEN
The system compares the quantities of the counterpart code with the removal criteria
THEN
The system either removes the counterpart code or checks special code pattern matching
Context: The quantities do not match for counterpart removal
GIVEN
The quantities do not match for counterpart removal
Applied to: Special Code Pattern Match?
WHEN
The system evaluates special code patterns or business rules for the counterpart code
THEN
The system either removes the counterpart code or determines no removal is needed
Context: A counterpart code has been validated for removal based on matching criteria
GIVEN
A counterpart code has been validated for removal based on matching criteria
Applied to: Remove Counterpart Code from Array
WHEN
The system removes the counterpart code from the status array
THEN
The counterpart code entry is marked for deletion from the array
Context: Counterpart codes have been removed from the status array
GIVEN
Counterpart codes have been removed from the status array
Applied to: Compact Array Elements
WHEN
The system compacts the array to eliminate empty positions
THEN
All remaining status entries are moved to fill gaps and maintain array integrity
Context: The status array has been compacted after counterpart code removal
GIVEN
The status array has been compacted after counterpart code removal
Applied to: Update Array Count
WHEN
The system recalculates the number of active entries in the array
THEN
The array count is updated to reflect the current number of valid status entries
R-GCX016-cbl-02727 (+14) File: GCX016.cbl Status Information Code Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Information Code Processing':
  • Context - a disposition code is being processed for cargo status update:
    For Status Information Code Processing Start:
    When the system initiates status information code processing, then the system should begin evaluating the disposition code type and prepare for status array updates.
  • Context - a disposition code has been received for processing:
    For Check Disposition Code Type:
    When the system checks the disposition code type against the dc table, then the system should determine if the code is a valid status information code and proceed accordingly.
  • Context - a disposition code needs to be processed:
    For Retrieve DC Table Information:
    When the system retrieves information from the gcstbrt dc table, then the system should obtain the disposition code details including status information flags and processing instructions.
  • Context - disposition code details have been retrieved from the dc table:
    For Is Status Info Code?:
    When the system evaluates whether the code is a status information type, then the system should identify status information codes and route them for appropriate processing while skipping non-status codes.
  • Context - a status information code is being processed:
    For Has Counterpart Removal?:
    When the system checks if counterpart codes exist in the status array that should be removed, then the system should identify any counterpart codes that conflict with the new status information and remove them first.
    For Preserve Original Cargo Quantities:
    When the system processes the status update, then the system should maintain all original cargo quantities unchanged as status information codes are informational only.
  • Context - counterpart codes exist in the status array that conflict with the new status information code:
    For Remove Counterpart Codes First:
    When the system removes counterpart codes from the s09a status array, then the system should successfully remove all conflicting counterpart codes and prepare the array for the new status information.
  • Context - a status information code is ready to be added to the status array:
    For Check for Duplicate in Status Array:
    When the system searches the s09a status array for existing instances of the same code, then the system should identify if the status code already exists and prevent duplicate entries.
  • Context - the system has checked for duplicate status codes in the array:
    For Already Exists?:
    When a duplicate status information code is found, then the system should skip processing to avoid duplicate entries and continue to the next code.
  • Context - a status information code already exists in the cargo status array:
    For Skip Processing - No Duplicate Entry:
    When the system determines that duplicate processing should be skipped, then the system should bypass the addition process and continue to the next disposition code processing.
  • Context - a status information code does not exist in the cargo status array:
    For Add Status Info Code to Array:
    When the system adds the new status information code to the s09a array, then the system should successfully insert the status code with appropriate sequence and occurrence numbers.
  • Context - a status information code has been added to the status array:
    For Set Status Information Flag:
    When the system sets the status information flag, then the system should mark the cargo record as having received status information updates.
  • Context - a status information code needs to be recorded in the status array:
    For Update Status Array Element:
    When the system updates the s09a status array element, then the system should populate the array element with the disposition code, sequence number, and occurrence details.
  • Context - a status information code has been successfully added to the cargo status array:
    For Log Status Information Update:
    When the system logs the status information update, then the system should record the status change with timestamp and disposition code details for audit purposes.
  • Context - status information code processing has been completed:
    For Continue to Next Code Processing:
    When the system continues to the next disposition code in the sequence, then the system should move to the next code processing step and maintain the processing flow.
👨‍💻 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: Status Information Code Processing Start
WHEN
The system initiates status information code processing
THEN
The system should begin evaluating the disposition code type and prepare for status array updates
Context: A disposition code has been received for processing
GIVEN
A disposition code has been received for processing
Applied to: Check Disposition Code Type
WHEN
The system checks the disposition code type against the DC table
THEN
The system should determine if the code is a valid status information code and proceed accordingly
Context: A disposition code needs to be processed
GIVEN
A disposition code needs to be processed
Applied to: Retrieve DC Table Information
WHEN
The system retrieves information from the GCSTBRT DC table
THEN
The system should obtain the disposition code details including status information flags and processing instructions
Context: Disposition code details have been retrieved from the DC table
GIVEN
Disposition code details have been retrieved from the DC table
Applied to: Is Status Info Code?
WHEN
The system evaluates whether the code is a status information type
THEN
The system should identify status information codes and route them for appropriate processing while skipping non-status codes
Context: A status information code is being processed
GIVEN
A status information code is being processed
Applied to: Has Counterpart Removal?
WHEN
The system checks if counterpart codes exist in the status array that should be removed
THEN
The system should identify any counterpart codes that conflict with the new status information and remove them first
Applied to: Preserve Original Cargo Quantities
WHEN
The system processes the status update
THEN
The system should maintain all original cargo quantities unchanged as status information codes are informational only
Context: Counterpart codes exist in the status array that conflict with the new status information code
GIVEN
Counterpart codes exist in the status array that conflict with the new status information code
Applied to: Remove Counterpart Codes First
WHEN
The system removes counterpart codes from the S09A status array
THEN
The system should successfully remove all conflicting counterpart codes and prepare the array for the new status information
Context: A status information code is ready to be added to the status array
GIVEN
A status information code is ready to be added to the status array
Applied to: Check for Duplicate in Status Array
WHEN
The system searches the S09A status array for existing instances of the same code
THEN
The system should identify if the status code already exists and prevent duplicate entries
Context: The system has checked for duplicate status codes in the array
GIVEN
The system has checked for duplicate status codes in the array
Applied to: Already Exists?
WHEN
A duplicate status information code is found
THEN
The system should skip processing to avoid duplicate entries and continue to the next code
Context: A status information code already exists in the cargo status array
GIVEN
A status information code already exists in the cargo status array
Applied to: Skip Processing - No Duplicate Entry
WHEN
The system determines that duplicate processing should be skipped
THEN
The system should bypass the addition process and continue to the next disposition code processing
Context: A status information code does not exist in the cargo status array
GIVEN
A status information code does not exist in the cargo status array
Applied to: Add Status Info Code to Array
WHEN
The system adds the new status information code to the S09A array
THEN
The system should successfully insert the status code with appropriate sequence and occurrence numbers
Context: A status information code has been added to the status array
GIVEN
A status information code has been added to the status array
Applied to: Set Status Information Flag
WHEN
The system sets the status information flag
THEN
The system should mark the cargo record as having received status information updates
Context: A status information code needs to be recorded in the status array
GIVEN
A status information code needs to be recorded in the status array
Applied to: Update Status Array Element
WHEN
The system updates the S09A status array element
THEN
The system should populate the array element with the disposition code, sequence number, and occurrence details
Context: A status information code has been successfully added to the cargo status array
GIVEN
A status information code has been successfully added to the cargo status array
Applied to: Log Status Information Update
WHEN
The system logs the status information update
THEN
The system should record the status change with timestamp and disposition code details for audit purposes
Context: Status information code processing has been completed
GIVEN
Status information code processing has been completed
Applied to: Continue to Next Code Processing
WHEN
The system continues to the next disposition code in the sequence
THEN
The system should move to the next code processing step and maintain the processing flow
R-GCX016-cbl-02742 (+7) File: GCX016.cbl Disposition Code Duplicate Prevention Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Duplicate Prevention':
  • Context - a new disposition code needs to be added to the s09a status array and the array contains existing disposition code entries:
    For Search Array for Existing Code:
    When the system searches the status array for an existing entry that matches the new disposition code and entry number and quantity, then if an exact match is found then skip processing the duplicate code and log the duplicate prevention action else add the new disposition code to the array and update the array element count.
  • Context - a disposition code from the status array element and a new disposition code to be added:
    For Check Disposition Code Match:
    When the system compares the disposition code values, then if the disposition codes match then proceed to check entry number match else continue searching the next array element.
  • Context - an entry number from the status array element and an entry number from the new disposition code:
    For Check Entry Number Match:
    When the system compares the entry number values after disposition code match is confirmed, then if the entry numbers match then proceed to check quantity match else continue searching for duplicates in remaining array elements.
  • Context - a quantity value from the status array element and a quantity value from the new disposition code:
    For Check Quantity Match:
    When the system compares the quantity values after both disposition code and entry number matches are confirmed, then if the quantities match then mark as exact duplicate found else continue processing as non-duplicate entry.
  • Context - an exact duplicate disposition code entry is found in the status array with matching disposition code and entry number and quantity:
    For Skip Processing - Duplicate Exists:
    When the duplicate validation process confirms all three values match an existing array entry, then skip adding the disposition code to the array and proceed to log the duplicate prevention action.
  • Context - a new disposition code that does not match any existing entries in the status array:
    For Add New Disposition Code to Array:
    When the duplicate validation process confirms no exact match exists, then add the new disposition code entry to the next available position in the status array.
  • Context - a new disposition code entry has been successfully added to the status array:
    For Update Array Element Count:
    When the array modification is complete, then increment the array element count by one to reflect the new entry.
  • Context - a duplicate disposition code entry was detected and prevented from being added to the status array:
    For Log Duplicate Prevention Action:
    When the duplicate prevention process is completed, then create a log entry documenting the duplicate prevention action for audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A new disposition code needs to be added to the S09A status array AND the array contains existing disposition code entries
GIVEN
A new disposition code needs to be added to the S09A status array AND the array contains existing disposition code entries
Applied to: Search Array for Existing Code
WHEN
The system searches the status array for an existing entry that matches the new disposition code AND entry number AND quantity
THEN
IF an exact match is found THEN skip processing the duplicate code AND log the duplicate prevention action ELSE add the new disposition code to the array AND update the array element count
Context: A disposition code from the status array element AND a new disposition code to be added
GIVEN
A disposition code from the status array element AND a new disposition code to be added
Applied to: Check Disposition Code Match
WHEN
The system compares the disposition code values
THEN
IF the disposition codes match THEN proceed to check entry number match ELSE continue searching the next array element
Context: An entry number from the status array element AND an entry number from the new disposition code
GIVEN
An entry number from the status array element AND an entry number from the new disposition code
Applied to: Check Entry Number Match
WHEN
The system compares the entry number values after disposition code match is confirmed
THEN
IF the entry numbers match THEN proceed to check quantity match ELSE continue searching for duplicates in remaining array elements
Context: A quantity value from the status array element AND a quantity value from the new disposition code
GIVEN
A quantity value from the status array element AND a quantity value from the new disposition code
Applied to: Check Quantity Match
WHEN
The system compares the quantity values after both disposition code and entry number matches are confirmed
THEN
IF the quantities match THEN mark as exact duplicate found ELSE continue processing as non-duplicate entry
Context: An exact duplicate disposition code entry is found in the status array with matching disposition code AND entry number AND quantity
GIVEN
An exact duplicate disposition code entry is found in the status array with matching disposition code AND entry number AND quantity
Applied to: Skip Processing - Duplicate Exists
WHEN
The duplicate validation process confirms all three values match an existing array entry
THEN
Skip adding the disposition code to the array AND proceed to log the duplicate prevention action
Context: A new disposition code that does not match any existing entries in the status array
GIVEN
A new disposition code that does not match any existing entries in the status array
Applied to: Add New Disposition Code to Array
WHEN
The duplicate validation process confirms no exact match exists
THEN
Add the new disposition code entry to the next available position in the status array
Context: A new disposition code entry has been successfully added to the status array
GIVEN
A new disposition code entry has been successfully added to the status array
Applied to: Update Array Element Count
WHEN
The array modification is complete
THEN
Increment the array element count by one to reflect the new entry
Context: A duplicate disposition code entry was detected and prevented from being added to the status array
GIVEN
A duplicate disposition code entry was detected and prevented from being added to the status array
Applied to: Log Duplicate Prevention Action
WHEN
The duplicate prevention process is completed
THEN
Create a log entry documenting the duplicate prevention action for audit purposes
R-GCX016-cbl-02750 (+12) File: GCX016.cbl Release Code with Removal Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Code with Removal Processing':
  • 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 and retrieves its processing attributes.
  • Context - a disposition code has been found in the dc table:
    For Is Release Code with Removal?:
    When the system evaluates the code type and actions, then the system identifies if this is a release code with removal processing type.
    For Skip Processing - Not Release with Removal:
    When the code is not a release code with removal type, then the system skips release with removal processing and continues to next processing step.
  • Context - a release code with removal type has been identified:
    For Search Status Array for Counterpart Codes:
    When the system searches the status array for counterpart codes, then the system identifies all matching counterpart codes that exist in the current status.
  • Context - counterpart codes have been found in the status array:
    For Remove Matching Counterpart Codes from Array:
    When the system processes the removal of counterpart codes, then all matching counterpart codes are removed from the status array.
  • Context - counterpart codes have been removed from the status array:
    For Compact Status Array After Removal:
    When the system compacts the array structure, then the status array is reorganized without empty positions and maintains proper sequencing.
  • Context - counterpart codes have been removed and the array has been compacted:
    For Add New Release Status Code to Array:
    When the system adds the new release status code, then the release disposition code is added to the status array with appropriate sequencing.
  • Context - a release status code has been added to the array:
    For Set Released Flag in Status Element:
    When the system sets the release flag in the status element, then the status element is marked as released for cargo processing.
  • Context - a release status code has been added and location information is available:
    For Include Location Information if Available:
    When the system processes location information inclusion, then location details are included in the release status element.
  • Context - a release status code has been processed with location information:
    For Set Quantity Action if Required:
    When the system determines if quantity action is required, then quantity action flags are set if the release code impacts cargo release quantities.
  • Context - all release code processing has been completed:
    For Update Status Array in Memory:
    When the system updates the status array in memory, then all changes to the status array are committed and available for further processing.
  • Context - status array has been updated in memory:
    For Log Disposition Code Processing:
    When the system logs the disposition code processing, then processing details are recorded for audit trail and system tracking.
  • Context - a disposition code has been submitted for processing:
    For Generate Error - Code Not Found:
    When the disposition code is not found in the dc table, then an error is generated indicating the code is not valid for processing.
👨‍💻 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 and retrieves its processing attributes
Context: A disposition code has been found in the DC table
GIVEN
A disposition code has been found in the DC table
Applied to: Is Release Code with Removal?
WHEN
The system evaluates the code type and actions
THEN
The system identifies if this is a release code with removal processing type
Applied to: Skip Processing - Not Release with Removal
WHEN
The code is not a release code with removal type
THEN
The system skips release with removal processing and continues to next processing step
Context: A release code with removal type has been identified
GIVEN
A release code with removal type has been identified
Applied to: Search Status Array for Counterpart Codes
WHEN
The system searches the status array for counterpart codes
THEN
The system identifies all matching counterpart codes that exist in the current status
Context: Counterpart codes have been found in the status array
GIVEN
Counterpart codes have been found in the status array
Applied to: Remove Matching Counterpart Codes from Array
WHEN
The system processes the removal of counterpart codes
THEN
All matching counterpart codes are removed from the status array
Context: Counterpart codes have been removed from the status array
GIVEN
Counterpart codes have been removed from the status array
Applied to: Compact Status Array After Removal
WHEN
The system compacts the array structure
THEN
The status array is reorganized without empty positions and maintains proper sequencing
Context: Counterpart codes have been removed and the array has been compacted
GIVEN
Counterpart codes have been removed and the array has been compacted
Applied to: Add New Release Status Code to Array
WHEN
The system adds the new release status code
THEN
The release disposition code is added to the status array with appropriate sequencing
Context: A release status code has been added to the array
GIVEN
A release status code has been added to the array
Applied to: Set Released Flag in Status Element
WHEN
The system sets the release flag in the status element
THEN
The status element is marked as released for cargo processing
Context: A release status code has been added and location information is available
GIVEN
A release status code has been added and location information is available
Applied to: Include Location Information if Available
WHEN
The system processes location information inclusion
THEN
Location details are included in the release status element
Context: A release status code has been processed with location information
GIVEN
A release status code has been processed with location information
Applied to: Set Quantity Action if Required
WHEN
The system determines if quantity action is required
THEN
Quantity action flags are set if the release code impacts cargo release quantities
Context: All release code processing has been completed
GIVEN
All release code processing has been completed
Applied to: Update Status Array in Memory
WHEN
The system updates the status array in memory
THEN
All changes to the status array are committed and available for further processing
Context: Status array has been updated in memory
GIVEN
Status array has been updated in memory
Applied to: Log Disposition Code Processing
WHEN
The system logs the disposition code processing
THEN
Processing details are recorded for audit trail and system tracking
Context: A disposition code has been submitted for processing
GIVEN
A disposition code has been submitted for processing
Applied to: Generate Error - Code Not Found
WHEN
The disposition code is not found in the DC table
THEN
An error is generated indicating the code is not valid for processing
R-GCX016-cbl-02763 (+6) File: GCX016.cbl Information Code with Removal Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Information Code with Removal Processing':
  • Context - a disposition code is received for processing:
    For Information Code with Removal Processing Start:
    When the disposition code is classified as an information code with removal type, then the system should identify it as requiring information code with removal processing.
  • Context - an information code with removal processing is being executed and a status array exists for the cargo:
    For Search Status Array for Counterpart Codes:
    When the system searches for counterpart codes in the status array, then all matching counterpart codes should be identified and flagged for removal.
  • Context - counterpart codes have been removed from the status array:
    For Compact Status Array Elements:
    When the array contains gaps where codes were removed, then the system should compact the array by moving remaining elements to fill gaps and maintain sequential order.
  • Context - counterpart codes have been processed and the status array has been compacted:
    For Add New Informational Status Code:
    When adding the new informational status code to the array, then the system should insert the information code with appropriate status information flag set.
  • Context - a new informational status code is being added to the cargo status array:
    For Check for Existing Information Code:
    When the same information code already exists in the status array, then the system should skip adding the duplicate entry and maintain the existing code.
  • Context - an informational disposition code is being added to the status array:
    For Set Status Information Flag:
    When the code is inserted into the array, then the system should set the status information flag to indicate this is informational only and not an actionable status.
  • Context - an informational status code has been successfully added to the cargo status array:
    For Update Cargo Status Flags:
    When the processing is complete, then the system should update the cargo status flags to reflect the current state including the new informational status.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received for processing
GIVEN
A disposition code is received for processing
Applied to: Information Code with Removal Processing Start
WHEN
The disposition code is classified as an information code with removal type
THEN
The system should identify it as requiring information code with removal processing
Context: An information code with removal processing is being executed AND a status array exists for the cargo
GIVEN
An information code with removal processing is being executed AND a status array exists for the cargo
Applied to: Search Status Array for Counterpart Codes
WHEN
The system searches for counterpart codes in the status array
THEN
All matching counterpart codes should be identified and flagged for removal
Context: Counterpart codes have been removed from the status array
GIVEN
Counterpart codes have been removed from the status array
Applied to: Compact Status Array Elements
WHEN
The array contains gaps where codes were removed
THEN
The system should compact the array by moving remaining elements to fill gaps and maintain sequential order
Context: Counterpart codes have been processed AND the status array has been compacted
GIVEN
Counterpart codes have been processed AND the status array has been compacted
Applied to: Add New Informational Status Code
WHEN
Adding the new informational status code to the array
THEN
The system should insert the information code with appropriate status information flag set
Context: A new informational status code is being added to the cargo status array
GIVEN
A new informational status code is being added to the cargo status array
Applied to: Check for Existing Information Code
WHEN
The same information code already exists in the status array
THEN
The system should skip adding the duplicate entry and maintain the existing code
Context: An informational disposition code is being added to the status array
GIVEN
An informational disposition code is being added to the status array
Applied to: Set Status Information Flag
WHEN
The code is inserted into the array
THEN
The system should set the status information flag to indicate this is informational only and not an actionable status
Context: An informational status code has been successfully added to the cargo status array
GIVEN
An informational status code has been successfully added to the cargo status array
Applied to: Update Cargo Status Flags
WHEN
The processing is complete
THEN
The system should update the cargo status flags to reflect the current state including the new informational status
R-GCX016-cbl-02796 (+10) File: GCX016.cbl Cargo Hold Status Determination Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Hold Status Determination':
  • Context - a cargo record exists with s09a status array containing disposition codes:
    For Analyze S09A Status Array:
    When the system processes the status array to determine hold conditions, then all disposition codes in the array are evaluated and hold/release flags are set based on code analysis.
  • Context - a hold disposition code is found in the cargo status array:
    For Identify Hold Location Code:
    When the system evaluates the disposition code to determine hold location, then the hold location is identified as either border hold or destination hold based on the specific disposition code.
  • Context - a border hold disposition code is identified in the status array:
    For Set Border Hold Status:
    When the system processes the border hold code, then the cargo border hold flag is set to true and border hold status is established.
  • Context - a destination hold disposition code is identified in the status array:
    For Set Destination Hold Status:
    When the system processes the destination hold code, then the cargo destination hold flag is set to true and destination hold status is established.
  • Context - both border hold and destination hold disposition codes are found in the status array:
    For Set Combined Hold Status:
    When the system processes multiple hold locations, then both border hold and destination hold flags are set to true indicating cargo is held at multiple locations.
  • Context - both hold and release disposition codes exist for the same cargo in the status array:
    For Evaluate Release vs Hold Priority:
    When the system evaluates the priority between conflicting hold and release codes, then the release code overrides the hold code and the cargo hold status is cleared if release has higher priority.
  • Context - a release disposition code has higher priority than an existing hold code:
    For Clear Hold Status:
    When the system processes the release override condition, then all hold flags are set to false and the cargo hold status is cleared.
  • Context - a hold disposition code has higher priority than a release code:
    For Maintain Hold Status:
    When the system processes the hold priority condition, then the existing hold flags remain unchanged and hold status is maintained.
  • Context - an fda-specific hold disposition code is found in the status array:
    For Set FDA Destination Hold:
    When the system processes the fda hold code, then the fda destination hold flag is set to true and fda hold status is established at destination.
  • Context - all disposition codes have been processed and hold/release flags have been evaluated:
    For Determine Final Hold Location:
    When the system determines the final hold status classification, then the cargo is classified as either no hold, border hold only, destination hold only, or combined hold at both locations.
  • Context - the final hold status has been determined for the cargo:
    For Update Cargo Hold Flags:
    When the system updates the cargo record with hold information, then all relevant hold flags are updated in the cargo record and the hold location status is persisted.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with S09A status array containing disposition codes
GIVEN
A cargo record exists with S09A status array containing disposition codes
Applied to: Analyze S09A Status Array
WHEN
The system processes the status array to determine hold conditions
THEN
All disposition codes in the array are evaluated and hold/release flags are set based on code analysis
Context: A hold disposition code is found in the cargo status array
GIVEN
A hold disposition code is found in the cargo status array
Applied to: Identify Hold Location Code
WHEN
The system evaluates the disposition code to determine hold location
THEN
The hold location is identified as either border hold or destination hold based on the specific disposition code
Context: A border hold disposition code is identified in the status array
GIVEN
A border hold disposition code is identified in the status array
Applied to: Set Border Hold Status
WHEN
The system processes the border hold code
THEN
The cargo border hold flag is set to true and border hold status is established
Context: A destination hold disposition code is identified in the status array
GIVEN
A destination hold disposition code is identified in the status array
Applied to: Set Destination Hold Status
WHEN
The system processes the destination hold code
THEN
The cargo destination hold flag is set to true and destination hold status is established
Context: Both border hold and destination hold disposition codes are found in the status array
GIVEN
Both border hold and destination hold disposition codes are found in the status array
Applied to: Set Combined Hold Status
WHEN
The system processes multiple hold locations
THEN
Both border hold and destination hold flags are set to true indicating cargo is held at multiple locations
Context: Both hold and release disposition codes exist for the same cargo in the status array
GIVEN
Both hold and release disposition codes exist for the same cargo in the status array
Applied to: Evaluate Release vs Hold Priority
WHEN
The system evaluates the priority between conflicting hold and release codes
THEN
The release code overrides the hold code and the cargo hold status is cleared if release has higher priority
Context: A release disposition code has higher priority than an existing hold code
GIVEN
A release disposition code has higher priority than an existing hold code
Applied to: Clear Hold Status
WHEN
The system processes the release override condition
THEN
All hold flags are set to false and the cargo hold status is cleared
Context: A hold disposition code has higher priority than a release code
GIVEN
A hold disposition code has higher priority than a release code
Applied to: Maintain Hold Status
WHEN
The system processes the hold priority condition
THEN
The existing hold flags remain unchanged and hold status is maintained
Context: An FDA-specific hold disposition code is found in the status array
GIVEN
An FDA-specific hold disposition code is found in the status array
Applied to: Set FDA Destination Hold
WHEN
The system processes the FDA hold code
THEN
The FDA destination hold flag is set to true and FDA hold status is established at destination
Context: All disposition codes have been processed and hold/release flags have been evaluated
GIVEN
All disposition codes have been processed and hold/release flags have been evaluated
Applied to: Determine Final Hold Location
WHEN
The system determines the final hold status classification
THEN
The cargo is classified as either no hold, border hold only, destination hold only, or combined hold at both locations
Context: The final hold status has been determined for the cargo
GIVEN
The final hold status has been determined for the cargo
Applied to: Update Cargo Hold Flags
WHEN
The system updates the cargo record with hold information
THEN
All relevant hold flags are updated in the cargo record and the hold location status is persisted
R-GCX016-cbl-02807 (+14) File: GCX016.cbl Release Quantity Calculation Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Quantity Calculation':
  • Context - a cargo record exists with current release quantity and a disposition code is being processed:
    For Start Release Quantity Calculation:
    When the disposition code contains quantity action instructions, then the system initiates release quantity calculation process.
  • Context - a disposition code is being processed for cargo release:
    For Disposition Code Has Quantity Action?:
    When the system checks if the disposition code has quantity action defined, then if quantity action exists, proceed with quantity calculation, otherwise skip quantity processing.
  • Context - a cargo record with existing release quantity information:
    For Get Current Release Quantity:
    When quantity action processing is required, then the system retrieves the current release quantity from the cargo status array.
  • Context - a disposition code with quantity action instructions:
    For Get Disposition Code Quantity:
    When the system needs to perform quantity calculations, then the system extracts the quantity value from the disposition code message.
  • Context - a disposition code with quantity action and extracted quantity value:
    For Quantity Action Type?:
    When the system evaluates the quantity action type, then the system determines if the action is add_quantity or subtract_quantity.
  • Context - current release quantity and disposition code quantity with add_quantity action:
    For Add Quantity to Release Amount:
    When the quantity action type is determined to be addition, then the system adds the disposition code quantity to the current release quantity.
  • Context - current release quantity and disposition code quantity with subtract_quantity action:
    For Subtract Quantity from Release Amount:
    When the quantity action type is determined to be subtraction, then the system subtracts the disposition code quantity from the current release quantity.
  • Context - a subtraction operation has been performed on release quantity:
    For Result Would Be Negative?:
    When the result of the subtraction would be negative, then the system identifies that the result would be negative and requires correction.
  • Context - a quantity calculation that would result in a negative release quantity:
    For Set Release Quantity to Zero:
    When the system detects the negative result condition, then the system sets the release quantity to zero to prevent negative values.
  • Context - a calculated release quantity that is valid and non-negative:
    For Update Release Quantity:
    When the quantity calculation is complete and validated, then the system updates the release quantity with the calculated value.
  • Context - an updated release quantity and total cargo quantity:
    For Validate Against Total Cargo Quantity:
    When the release quantity has been calculated and updated, then the system validates the release quantity against the total cargo quantity.
  • Context - a calculated release quantity and total cargo quantity:
    For Release Quantity > Total Quantity?:
    When the system compares release quantity to total quantity, then if release quantity is greater than total quantity, the system identifies this as an excessive release condition.
  • Context - a release quantity that exceeds the total cargo quantity:
    For Cap Release Quantity at Total:
    When the system detects excessive release quantity condition, then the system caps the release quantity to equal the total cargo quantity.
  • Context - a final validated release quantity that complies with all business rules:
    For Store Updated Release Quantity in Status Array:
    When all quantity validations and calculations are complete, then the system stores the updated release quantity in the cargo status array.
  • Context - all release quantity calculations and validations are complete:
    For End Release Quantity Calculation:
    When the release quantity has been successfully stored in the status array, then the system completes the release quantity calculation process.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with current release quantity and a disposition code is being processed
GIVEN
A cargo record exists with current release quantity and a disposition code is being processed
Applied to: Start Release Quantity Calculation
WHEN
The disposition code contains quantity action instructions
THEN
The system initiates release quantity calculation process
Context: A disposition code is being processed for cargo release
GIVEN
A disposition code is being processed for cargo release
Applied to: Disposition Code Has Quantity Action?
WHEN
The system checks if the disposition code has quantity action defined
THEN
If quantity action exists, proceed with quantity calculation, otherwise skip quantity processing
Context: A cargo record with existing release quantity information
GIVEN
A cargo record with existing release quantity information
Applied to: Get Current Release Quantity
WHEN
Quantity action processing is required
THEN
The system retrieves the current release quantity from the cargo status array
Context: A disposition code with quantity action instructions
GIVEN
A disposition code with quantity action instructions
Applied to: Get Disposition Code Quantity
WHEN
The system needs to perform quantity calculations
THEN
The system extracts the quantity value from the disposition code message
Context: A disposition code with quantity action and extracted quantity value
GIVEN
A disposition code with quantity action and extracted quantity value
Applied to: Quantity Action Type?
WHEN
The system evaluates the quantity action type
THEN
The system determines if the action is ADD_QUANTITY or SUBTRACT_QUANTITY
Context: Current release quantity and disposition code quantity with ADD_QUANTITY action
GIVEN
Current release quantity and disposition code quantity with ADD_QUANTITY action
Applied to: Add Quantity to Release Amount
WHEN
The quantity action type is determined to be addition
THEN
The system adds the disposition code quantity to the current release quantity
Context: Current release quantity and disposition code quantity with SUBTRACT_QUANTITY action
GIVEN
Current release quantity and disposition code quantity with SUBTRACT_QUANTITY action
Applied to: Subtract Quantity from Release Amount
WHEN
The quantity action type is determined to be subtraction
THEN
The system subtracts the disposition code quantity from the current release quantity
Context: A subtraction operation has been performed on release quantity
GIVEN
A subtraction operation has been performed on release quantity
Applied to: Result Would Be Negative?
WHEN
The result of the subtraction would be negative
THEN
The system identifies that the result would be negative and requires correction
Context: A quantity calculation that would result in a negative release quantity
GIVEN
A quantity calculation that would result in a negative release quantity
Applied to: Set Release Quantity to Zero
WHEN
The system detects the negative result condition
THEN
The system sets the release quantity to zero to prevent negative values
Context: A calculated release quantity that is valid and non-negative
GIVEN
A calculated release quantity that is valid and non-negative
Applied to: Update Release Quantity
WHEN
The quantity calculation is complete and validated
THEN
The system updates the release quantity with the calculated value
Context: An updated release quantity and total cargo quantity
GIVEN
An updated release quantity and total cargo quantity
Applied to: Validate Against Total Cargo Quantity
WHEN
The release quantity has been calculated and updated
THEN
The system validates the release quantity against the total cargo quantity
Context: A calculated release quantity and total cargo quantity
GIVEN
A calculated release quantity and total cargo quantity
Applied to: Release Quantity > Total Quantity?
WHEN
The system compares release quantity to total quantity
THEN
If release quantity is greater than total quantity, the system identifies this as an excessive release condition
Context: A release quantity that exceeds the total cargo quantity
GIVEN
A release quantity that exceeds the total cargo quantity
Applied to: Cap Release Quantity at Total
WHEN
The system detects excessive release quantity condition
THEN
The system caps the release quantity to equal the total cargo quantity
Context: A final validated release quantity that complies with all business rules
GIVEN
A final validated release quantity that complies with all business rules
Applied to: Store Updated Release Quantity in Status Array
WHEN
All quantity validations and calculations are complete
THEN
The system stores the updated release quantity in the cargo status array
Context: All release quantity calculations and validations are complete
GIVEN
All release quantity calculations and validations are complete
Applied to: End Release Quantity Calculation
WHEN
The release quantity has been successfully stored in the status array
THEN
The system completes the release quantity calculation process
R-GCX016-cbl-02822 (+13) File: GCX016.cbl Hold Location Identification Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hold Location Identification':
  • Context - a cargo record with s09a status array containing disposition codes:
    For Border Hold Detected?:
    When the system analyzes the status array for border hold indicators, then the system sets border hold flag to true if border hold disposition codes are found in the array.
    For Destination Hold Detected?:
    When the system analyzes the status array for destination hold indicators, then the system sets destination hold flag to true if destination hold disposition codes are found in the array.
  • Context - a cargo record with border hold flag and destination hold flag both evaluated:
    For Both Border and Destination Holds?:
    When both border hold flag and destination hold flag are set to true, then the system sets hold location to 'both' indicating cargo is held at both border and destination.
  • Context - a cargo record with border hold detected and no destination hold:
    For Set Hold Location = Border:
    When the border hold flag is true and destination hold flag is false, then the system sets hold location to 'border'.
  • Context - a cargo record with destination hold detected and no border hold:
    For Set Hold Location = Destination:
    When the destination hold flag is true and border hold flag is false, then the system sets hold location to 'destination'.
  • Context - a cargo record with both border and destination holds detected:
    For Set Hold Location = Both:
    When both border hold flag and destination hold flag are true, then the system sets hold location to 'both'.
  • Context - a cargo record with current location information available:
    For Cargo at Border?:
    When the system checks the cargo's current physical location, then the system returns true if cargo is currently at border location, false otherwise.
  • Context - a cargo record with current location information available and cargo not at border:
    For Cargo at Destination?:
    When the system checks the cargo's current physical location, then the system returns true if cargo is currently at destination location, false otherwise.
  • Context - a cargo record with holds detected and cargo currently at border location:
    For Priority: Border Hold Message:
    When the cargo is physically at border and has hold conditions, then the system assigns priority to border hold message processing.
  • Context - a cargo record with holds detected and cargo currently at destination location:
    For Priority: Destination Hold Message:
    When the cargo is physically at destination and has hold conditions, then the system assigns priority to destination hold message processing.
  • Context - a cargo record with hold location determined as 'border':
    For Route to Border Processing:
    When the hold location equals 'border', then the system routes the hold message to border processing workflow.
  • Context - a cargo record with hold location determined as 'destination':
    For Route to Destination Processing:
    When the hold location equals 'destination', then the system routes the hold message to destination processing workflow.
  • Context - a cargo record with hold location determined as 'both':
    For Route to Both Border and Destination:
    When the hold location equals 'both', then the system routes the hold message to both border and destination processing workflows.
  • Context - a cargo record with determined hold location and routing decisions made:
    For Generate Hold Message with Location Details:
    When the system generates the hold message, then the system creates a hold message containing specific location details, disposition codes, and routing information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with S09A status array containing disposition codes
GIVEN
A cargo record with S09A status array containing disposition codes
Applied to: Border Hold Detected?
WHEN
The system analyzes the status array for border hold indicators
THEN
The system sets border hold flag to true if border hold disposition codes are found in the array
Applied to: Destination Hold Detected?
WHEN
The system analyzes the status array for destination hold indicators
THEN
The system sets destination hold flag to true if destination hold disposition codes are found in the array
Context: A cargo record with border hold flag and destination hold flag both evaluated
GIVEN
A cargo record with border hold flag and destination hold flag both evaluated
Applied to: Both Border and Destination Holds?
WHEN
Both border hold flag and destination hold flag are set to true
THEN
The system sets hold location to 'Both' indicating cargo is held at both border and destination
Context: A cargo record with border hold detected and no destination hold
GIVEN
A cargo record with border hold detected and no destination hold
Applied to: Set Hold Location = Border
WHEN
The border hold flag is true and destination hold flag is false
THEN
The system sets hold location to 'Border'
Context: A cargo record with destination hold detected and no border hold
GIVEN
A cargo record with destination hold detected and no border hold
Applied to: Set Hold Location = Destination
WHEN
The destination hold flag is true and border hold flag is false
THEN
The system sets hold location to 'Destination'
Context: A cargo record with both border and destination holds detected
GIVEN
A cargo record with both border and destination holds detected
Applied to: Set Hold Location = Both
WHEN
Both border hold flag and destination hold flag are true
THEN
The system sets hold location to 'Both'
Context: A cargo record with current location information available
GIVEN
A cargo record with current location information available
Applied to: Cargo at Border?
WHEN
The system checks the cargo's current physical location
THEN
The system returns true if cargo is currently at border location, false otherwise
Context: A cargo record with current location information available and cargo not at border
GIVEN
A cargo record with current location information available and cargo not at border
Applied to: Cargo at Destination?
WHEN
The system checks the cargo's current physical location
THEN
The system returns true if cargo is currently at destination location, false otherwise
Context: A cargo record with holds detected and cargo currently at border location
GIVEN
A cargo record with holds detected and cargo currently at border location
Applied to: Priority: Border Hold Message
WHEN
The cargo is physically at border and has hold conditions
THEN
The system assigns priority to border hold message processing
Context: A cargo record with holds detected and cargo currently at destination location
GIVEN
A cargo record with holds detected and cargo currently at destination location
Applied to: Priority: Destination Hold Message
WHEN
The cargo is physically at destination and has hold conditions
THEN
The system assigns priority to destination hold message processing
Context: A cargo record with hold location determined as 'Border'
GIVEN
A cargo record with hold location determined as 'Border'
Applied to: Route to Border Processing
WHEN
The hold location equals 'Border'
THEN
The system routes the hold message to border processing workflow
Context: A cargo record with hold location determined as 'Destination'
GIVEN
A cargo record with hold location determined as 'Destination'
Applied to: Route to Destination Processing
WHEN
The hold location equals 'Destination'
THEN
The system routes the hold message to destination processing workflow
Context: A cargo record with hold location determined as 'Both'
GIVEN
A cargo record with hold location determined as 'Both'
Applied to: Route to Both Border and Destination
WHEN
The hold location equals 'Both'
THEN
The system routes the hold message to both border and destination processing workflows
Context: A cargo record with determined hold location and routing decisions made
GIVEN
A cargo record with determined hold location and routing decisions made
Applied to: Generate Hold Message with Location Details
WHEN
The system generates the hold message
THEN
The system creates a hold message containing specific location details, disposition codes, and routing information
R-GCX016-cbl-02836 (+5) File: GCX016.cbl Disposition Code Error Handling Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Error Handling':
  • Context - a disposition code is extracted from x4 segment:
    For Lookup Disposition Code in DC Table:
    When the system looks up the disposition code in the dc table, then the system retrieves disposition code details and sets found flag if code exists in table.
  • Context - a disposition code lookup has been performed against the dc table:
    For Disposition Code Found in System Tables?:
    When the disposition code is not found in the system tables, then the system sets error flag indicating code not found and prepares for error handling.
  • Context - a disposition code has been found in the dc table:
    For Proceed with Valid Disposition Code:
    When the system validates the disposition code successfully, then the system retrieves counterpart code information and processing instructions for normal processing flow.
  • Context - a disposition code is not found in the dc table:
    For Generate Error Message for Invalid Code:
    When the system needs to report the invalid code error, then the system generates an error message containing the invalid disposition code details.
  • Context - an invalid disposition code error has been detected and message generated:
    For Log Disposition Code Error Details:
    When the system needs to record the error for audit purposes, then the system logs the disposition code error details including the invalid code and context information.
  • Context - a disposition code error has been logged and flagged:
    For Continue Processing with Error Status:
    When the system needs to continue with the overall processing workflow, then the system continues processing while maintaining the error status for downstream handling.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is extracted from X4 segment
GIVEN
A disposition code is extracted from X4 segment
Applied to: Lookup Disposition Code in DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The system retrieves disposition code details and sets found flag if code exists in table
Context: A disposition code lookup has been performed against the DC table
GIVEN
A disposition code lookup has been performed against the DC table
Applied to: Disposition Code Found in System Tables?
WHEN
The disposition code is not found in the system tables
THEN
The system sets error flag indicating code not found and prepares for error handling
Context: A disposition code has been found in the DC table
GIVEN
A disposition code has been found in the DC table
Applied to: Proceed with Valid Disposition Code
WHEN
The system validates the disposition code successfully
THEN
The system retrieves counterpart code information and processing instructions for normal processing flow
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 Error Message for Invalid Code
WHEN
The system needs to report the invalid code error
THEN
The system generates an error message containing the invalid disposition code details
Context: An invalid disposition code error has been detected and message generated
GIVEN
An invalid disposition code error has been detected and message generated
Applied to: Log Disposition Code Error Details
WHEN
The system needs to record the error for audit purposes
THEN
The system logs the disposition code error details including the invalid code and context information
Context: A disposition code error has been logged and flagged
GIVEN
A disposition code error has been logged and flagged
Applied to: Continue Processing with Error Status
WHEN
The system needs to continue with the overall processing workflow
THEN
The system continues processing while maintaining the error status for downstream handling
R-GCX016-cbl-02842 (+10) File: GCX016.cbl Status Array Overflow Protection Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Overflow Protection':
  • Context - a new disposition code needs to be added to the status array:
    For Check Current Array Count:
    When the system checks the current array count, then the current number of status entries in the array is determined and validated.
  • Context - the current array count has been determined:
    For Array Count < Maximum Limit?:
    When the array count is compared against the maximum allowed limit, then if array count is less than maximum limit, proceed to space calculation, otherwise trigger overflow protection.
  • Context - the array count is below maximum limit:
    For Calculate Available Space:
    When the system calculates available space for new disposition code entry, then the remaining capacity is determined based on maximum limit minus current count.
  • Context - available space has been calculated:
    For Space Available for New Code?:
    When the system checks if space is available for the new disposition code, then if space is available, proceed to add code, otherwise trigger overflow warning.
  • Context - space is available in the status array:
    For Add Disposition Code to Array:
    When a new disposition code is added to the array, then the disposition code is stored in the next available array position.
  • Context - a disposition code has been successfully added to the array:
    For Update Array Count:
    When the array count is updated, then the count is incremented by one to reflect the new entry.
  • Context - the status array has reached maximum capacity or insufficient space exists:
    For Log Array Overflow Warning:
    When an overflow condition is detected, then a warning message is logged indicating array overflow condition.
  • Context - array overflow warning has been logged:
    For Skip Adding New Code:
    When the system attempts to add a new disposition code, then the addition operation is skipped to prevent array corruption.
  • Context - new code addition has been skipped due to overflow:
    For Generate Error Message:
    When an error message is generated, then the message indicates that disposition code could not be added due to array capacity limits.
  • Context - an error message has been generated for array overflow:
    For Set Overflow Flag:
    When the overflow flag is set, then the flag indicates that subsequent processing should handle overflow condition.
  • Context - overflow flag has been set and new code addition was skipped:
    For Continue with Existing Codes:
    When processing continues, then the system proceeds using only the existing disposition codes in the array.
👨‍💻 Technical ACs (Gherkin)
Context: A new disposition code needs to be added to the status array
GIVEN
A new disposition code needs to be added to the status array
Applied to: Check Current Array Count
WHEN
The system checks the current array count
THEN
The current number of status entries in the array is determined and validated
Context: The current array count has been determined
GIVEN
The current array count has been determined
Applied to: Array Count < Maximum Limit?
WHEN
The array count is compared against the maximum allowed limit
THEN
If array count is less than maximum limit, proceed to space calculation, otherwise trigger overflow protection
Context: The array count is below maximum limit
GIVEN
The array count is below maximum limit
Applied to: Calculate Available Space
WHEN
The system calculates available space for new disposition code entry
THEN
The remaining capacity is determined based on maximum limit minus current count
Context: Available space has been calculated
GIVEN
Available space has been calculated
Applied to: Space Available for New Code?
WHEN
The system checks if space is available for the new disposition code
THEN
If space is available, proceed to add code, otherwise trigger overflow warning
Context: Space is available in the status array
GIVEN
Space is available in the status array
Applied to: Add Disposition Code to Array
WHEN
A new disposition code is added to the array
THEN
The disposition code is stored in the next available array position
Context: A disposition code has been successfully added to the array
GIVEN
A disposition code has been successfully added to the array
Applied to: Update Array Count
WHEN
The array count is updated
THEN
The count is incremented by one to reflect the new entry
Context: The status array has reached maximum capacity or insufficient space exists
GIVEN
The status array has reached maximum capacity or insufficient space exists
Applied to: Log Array Overflow Warning
WHEN
An overflow condition is detected
THEN
A warning message is logged indicating array overflow condition
Context: Array overflow warning has been logged
GIVEN
Array overflow warning has been logged
Applied to: Skip Adding New Code
WHEN
The system attempts to add a new disposition code
THEN
The addition operation is skipped to prevent array corruption
Context: New code addition has been skipped due to overflow
GIVEN
New code addition has been skipped due to overflow
Applied to: Generate Error Message
WHEN
An error message is generated
THEN
The message indicates that disposition code could not be added due to array capacity limits
Context: An error message has been generated for array overflow
GIVEN
An error message has been generated for array overflow
Applied to: Set Overflow Flag
WHEN
The overflow flag is set
THEN
The flag indicates that subsequent processing should handle overflow condition
Context: Overflow flag has been set and new code addition was skipped
GIVEN
Overflow flag has been set and new code addition was skipped
Applied to: Continue with Existing Codes
WHEN
Processing continues
THEN
The system proceeds using only the existing disposition codes in the array
R-GCX016-cbl-02853 (+6) File: GCX016.cbl Disposition Code Duplicate Detection Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Duplicate Detection':
  • Context - a new disposition code needs to be processed for cargo:
    For Status Array Empty?:
    When the system accesses the current status array s09a, then if the status array is empty, skip duplicate detection and proceed directly to add the new code.
  • Context - a disposition code to be processed and a populated status array:
    For Code Already Exists?:
    When the system iterates through each element in the status array, then compare the incoming disposition code with each existing code in the array to determine if it already exists.
  • Context - a disposition code that already exists in the status array:
    For Entry Numbers Match?:
    When the system finds a matching disposition code, then compare the entry numbers between the incoming code and existing code to verify they match.
  • Context - a disposition code and entry number that match an existing array element:
    For Quantities Match?:
    When the system has confirmed disposition code and entry number matches, then compare the quantities between the incoming code and existing code to determine if this is a complete duplicate.
  • Context - a disposition code that completely matches an existing array element (code, entry number, and quantity):
    For Skip Processing - Prevent Duplicate:
    When the system has confirmed all matching criteria are met, then skip processing of the disposition code to prevent duplicate entries and maintain data integrity.
  • Context - a disposition code that does not exist in the status array or does not completely match existing entries:
    For Add New Code to Array:
    When the system has completed duplicate detection without finding a complete match, then add the new disposition code with its associated entry number and quantity to the status array.
  • Context - a new disposition code has been added to the status array:
    For Update Status Array:
    When the system has successfully added the new code, then update the status array structure and maintain proper indexing for future processing.
👨‍💻 Technical ACs (Gherkin)
Context: A new disposition code needs to be processed for cargo
GIVEN
A new disposition code needs to be processed for cargo
Applied to: Status Array Empty?
WHEN
The system accesses the current status array S09A
THEN
If the status array is empty, skip duplicate detection and proceed directly to add the new code
Context: A disposition code to be processed and a populated status array
GIVEN
A disposition code to be processed and a populated status array
Applied to: Code Already Exists?
WHEN
The system iterates through each element in the status array
THEN
Compare the incoming disposition code with each existing code in the array to determine if it already exists
Context: A disposition code that already exists in the status array
GIVEN
A disposition code that already exists in the status array
Applied to: Entry Numbers Match?
WHEN
The system finds a matching disposition code
THEN
Compare the entry numbers between the incoming code and existing code to verify they match
Context: A disposition code and entry number that match an existing array element
GIVEN
A disposition code and entry number that match an existing array element
Applied to: Quantities Match?
WHEN
The system has confirmed disposition code and entry number matches
THEN
Compare the quantities between the incoming code and existing code to determine if this is a complete duplicate
Context: A disposition code that completely matches an existing array element (code, entry number, and quantity)
GIVEN
A disposition code that completely matches an existing array element (code, entry number, and quantity)
Applied to: Skip Processing - Prevent Duplicate
WHEN
The system has confirmed all matching criteria are met
THEN
Skip processing of the disposition code to prevent duplicate entries and maintain data integrity
Context: A disposition code that does not exist in the status array or does not completely match existing entries
GIVEN
A disposition code that does not exist in the status array or does not completely match existing entries
Applied to: Add New Code to Array
WHEN
The system has completed duplicate detection without finding a complete match
THEN
Add the new disposition code with its associated entry number and quantity to the status array
Context: A new disposition code has been added to the status array
GIVEN
A new disposition code has been added to the status array
Applied to: Update Status Array
WHEN
The system has successfully added the new code
THEN
Update the status array structure and maintain proper indexing for future processing
R-GCX016-cbl-02860 (+8) File: GCX016.cbl Counterpart Code Processing with Quantity Matching Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Counterpart Code Processing with Quantity Matching':
  • Context - a disposition code is being processed for counterpart removal:
    For Get Counterpart Code from DC Table:
    When the system looks up the counterpart code in the dc table, then if counterpart code exists in dc table, proceed with counterpart processing, otherwise skip counterpart removal.
  • Context - a valid counterpart code exists from the dc table:
    For Search Status Array for Matching Codes:
    When the system searches the status array for matching disposition codes, then if matching codes are found in the status array, proceed with match validation, otherwise no action is required.
  • Context - a counterpart code match is found in the status array:
    For Check Entry Number Match:
    When the system compares entry numbers between current disposition and counterpart code, then if entry numbers match, proceed to quantity validation, otherwise check status info match.
  • Context - entry numbers match between current disposition and counterpart code:
    For Check Quantity Match:
    When the system compares quantities between current disposition and counterpart code, then if quantities match, remove the counterpart code from array, otherwise check status info match.
  • Context - either entry numbers don't match or quantities don't match between current disposition and counterpart code:
    For Check Status Info Match:
    When the system compares status info between current disposition and counterpart code, then if status info matches, remove the counterpart code from array, otherwise continue searching for more matches.
  • Context - a counterpart code meets removal criteria (matching entry number and quantity, or matching status info):
    For Remove Counterpart Code from Array:
    When the system removes the counterpart code from the status array, then the counterpart code is deleted from the array and array elements are compacted.
  • Context - a counterpart code has been removed from the status array:
    For Compact Array Elements:
    When the system compacts the array elements, then all remaining array elements are shifted to eliminate gaps and maintain array integrity.
  • Context - a counterpart code has been processed (either removed or skipped):
    For Continue Search for More Matches:
    When the system checks if more elements exist in the status array, then if more elements exist, continue searching for additional counterpart matches, otherwise update array element count.
  • Context - all counterpart code processing is complete for the status array:
    For Update Array Element Count:
    When the system updates the array element count, then the array element count reflects the current number of valid elements after removals.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for counterpart removal
GIVEN
A disposition code is being processed for counterpart removal
Applied to: Get Counterpart Code from DC Table
WHEN
The system looks up the counterpart code in the DC table
THEN
If counterpart code exists in DC table, proceed with counterpart processing, otherwise skip counterpart removal
Context: A valid counterpart code exists from the DC table
GIVEN
A valid counterpart code exists from the DC table
Applied to: Search Status Array for Matching Codes
WHEN
The system searches the status array for matching disposition codes
THEN
If matching codes are found in the status array, proceed with match validation, otherwise no action is required
Context: A counterpart code match is found in the status array
GIVEN
A counterpart code match is found in the status array
Applied to: Check Entry Number Match
WHEN
The system compares entry numbers between current disposition and counterpart code
THEN
If entry numbers match, proceed to quantity validation, otherwise check status info match
Context: Entry numbers match between current disposition and counterpart code
GIVEN
Entry numbers match between current disposition and counterpart code
Applied to: Check Quantity Match
WHEN
The system compares quantities between current disposition and counterpart code
THEN
If quantities match, remove the counterpart code from array, otherwise check status info match
Context: Either entry numbers don't match or quantities don't match between current disposition and counterpart code
GIVEN
Either entry numbers don't match or quantities don't match between current disposition and counterpart code
Applied to: Check Status Info Match
WHEN
The system compares status info between current disposition and counterpart code
THEN
If status info matches, remove the counterpart code from array, otherwise continue searching for more matches
Context: A counterpart code meets removal criteria (matching entry number and quantity, or matching status info)
GIVEN
A counterpart code meets removal criteria (matching entry number and quantity, or matching status info)
Applied to: Remove Counterpart Code from Array
WHEN
The system removes the counterpart code from the status array
THEN
The counterpart code is deleted from the array and array elements are compacted
Context: A counterpart code has been removed from the status array
GIVEN
A counterpart code has been removed from the status array
Applied to: Compact Array Elements
WHEN
The system compacts the array elements
THEN
All remaining array elements are shifted to eliminate gaps and maintain array integrity
Context: A counterpart code has been processed (either removed or skipped)
GIVEN
A counterpart code has been processed (either removed or skipped)
Applied to: Continue Search for More Matches
WHEN
The system checks if more elements exist in the status array
THEN
If more elements exist, continue searching for additional counterpart matches, otherwise update array element count
Context: All counterpart code processing is complete for the status array
GIVEN
All counterpart code processing is complete for the status array
Applied to: Update Array Element Count
WHEN
The system updates the array element count
THEN
The array element count reflects the current number of valid elements after removals
R-GCX016-cbl-02869 (+14) File: GCX016.cbl ARL Auto Release Array Re Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ARL Auto Release Array Re':
  • Context - an arl auto release request is received with a disposition code:
    For Validate ARL Disposition Code:
    When the system validates the disposition code against the dc disposition code table, then if the code is found and marked as arl type, continue processing, otherwise skip auto release processing.
  • Context - a valid arl disposition code has been validated:
    For Access Current Cargo Status Array S09A:
    When the system needs to access current cargo status information, then retrieve the s09a status array from gcsuss09 segments for the cargo record.
  • Context - the current cargo status array s09a has been accessed:
    For Preserve Current Array State:
    When the system prepares to re-evaluate the array for auto release, then create a backup copy of the current array state to preserve original status information.
  • Context - the current array state has been preserved:
    For Re-analyze Existing Disposition Codes:
    When the system re-analyzes existing disposition codes in the s09a array, then evaluate each existing disposition code for hold, release, and status conditions without inserting new arl codes.
  • Context - existing disposition codes have been re-analyzed:
    For Evaluate Hold Status at Border:
    When the system evaluates hold status at border location, then if any border hold codes are found in the status array, mark cargo as held at border and prevent auto release.
  • Context - border hold status has been evaluated:
    For Evaluate Hold Status at Destination:
    When the system evaluates hold status at destination location, then if any destination hold codes are found in the status array, mark cargo as held at destination and prevent auto release.
  • Context - hold status at both border and destination has been evaluated:
    For Check PTT Permit to Transfer Status:
    When the system checks for ptt permit to transfer status, then if cargo has valid ptt status and meets quantity thresholds, allow auto release consideration, otherwise maintain current status.
  • Context - ptt status has been validated:
    For Validate Release Quantities:
    When the system validates release quantities against total cargo quantities, then if released quantity is less than total quantity, maintain partial release status, if equal or greater, allow full release consideration.
  • Context - all individual release conditions have been evaluated (holds, ptt, quantities):
    For All Release Conditions Met?:
    When the system determines overall auto release eligibility, then if no holds exist and ptt status is valid and quantities are appropriate, approve auto release, otherwise deny auto release.
  • Context - all release conditions have been met for auto release:
    For Set Auto Release Flag:
    When the system sets the auto release flag, then mark cargo as eligible for auto release and set appropriate processing flags for downstream systems.
  • Context - auto release flag has been set:
    For Update Cargo Status Flags:
    When the system updates cargo status flags, then update release status, hold status, and processing flags to reflect auto release approval without modifying the disposition code array.
  • Context - cargo status flags have been updated for auto release:
    For Trigger Release Processing:
    When the system triggers release processing, then initiate standard cargo release procedures including broker notifications and system updates.
  • Context - release processing has been triggered:
    For Log Auto Release Decision:
    When the system logs the auto release decision, then record auto release approval with timestamp, conditions evaluated, and decision rationale in system logs.
  • Context - auto release conditions are not met (holds exist, ptt invalid, or quantity issues):
    For Maintain Current Hold Status:
    When the system maintains current hold status, then preserve existing hold conditions and status array without modification, preventing auto release.
  • Context - auto release has been denied due to unmet conditions:
    For Log Auto Release Denial:
    When the system logs the auto release denial, then record auto release denial with timestamp, specific blocking conditions (holds, ptt, quantities), and maintain audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: An ARL auto release request is received with a disposition code
GIVEN
An ARL auto release request is received with a disposition code
Applied to: Validate ARL Disposition Code
WHEN
The system validates the disposition code against the DC disposition code table
THEN
If the code is found and marked as ARL type, continue processing, otherwise skip auto release processing
Context: A valid ARL disposition code has been validated
GIVEN
A valid ARL disposition code has been validated
Applied to: Access Current Cargo Status Array S09A
WHEN
The system needs to access current cargo status information
THEN
Retrieve the S09A status array from GCSUSS09 segments for the cargo record
Context: The current cargo status array S09A has been accessed
GIVEN
The current cargo status array S09A has been accessed
Applied to: Preserve Current Array State
WHEN
The system prepares to re-evaluate the array for auto release
THEN
Create a backup copy of the current array state to preserve original status information
Context: The current array state has been preserved
GIVEN
The current array state has been preserved
Applied to: Re-analyze Existing Disposition Codes
WHEN
The system re-analyzes existing disposition codes in the S09A array
THEN
Evaluate each existing disposition code for hold, release, and status conditions without inserting new ARL codes
Context: Existing disposition codes have been re-analyzed
GIVEN
Existing disposition codes have been re-analyzed
Applied to: Evaluate Hold Status at Border
WHEN
The system evaluates hold status at border location
THEN
If any border hold codes are found in the status array, mark cargo as held at border and prevent auto release
Context: Border hold status has been evaluated
GIVEN
Border hold status has been evaluated
Applied to: Evaluate Hold Status at Destination
WHEN
The system evaluates hold status at destination location
THEN
If any destination hold codes are found in the status array, mark cargo as held at destination and prevent auto release
Context: Hold status at both border and destination has been evaluated
GIVEN
Hold status at both border and destination has been evaluated
Applied to: Check PTT Permit to Transfer Status
WHEN
The system checks for PTT permit to transfer status
THEN
If cargo has valid PTT status and meets quantity thresholds, allow auto release consideration, otherwise maintain current status
Context: PTT status has been validated
GIVEN
PTT status has been validated
Applied to: Validate Release Quantities
WHEN
The system validates release quantities against total cargo quantities
THEN
If released quantity is less than total quantity, maintain partial release status, if equal or greater, allow full release consideration
Context: All individual release conditions have been evaluated (holds, PTT, quantities)
GIVEN
All individual release conditions have been evaluated (holds, PTT, quantities)
Applied to: All Release Conditions Met?
WHEN
The system determines overall auto release eligibility
THEN
If no holds exist AND PTT status is valid AND quantities are appropriate, approve auto release, otherwise deny auto release
Context: All release conditions have been met for auto release
GIVEN
All release conditions have been met for auto release
Applied to: Set Auto Release Flag
WHEN
The system sets the auto release flag
THEN
Mark cargo as eligible for auto release and set appropriate processing flags for downstream systems
Context: Auto release flag has been set
GIVEN
Auto release flag has been set
Applied to: Update Cargo Status Flags
WHEN
The system updates cargo status flags
THEN
Update release status, hold status, and processing flags to reflect auto release approval without modifying the disposition code array
Context: Cargo status flags have been updated for auto release
GIVEN
Cargo status flags have been updated for auto release
Applied to: Trigger Release Processing
WHEN
The system triggers release processing
THEN
Initiate standard cargo release procedures including broker notifications and system updates
Context: Release processing has been triggered
GIVEN
Release processing has been triggered
Applied to: Log Auto Release Decision
WHEN
The system logs the auto release decision
THEN
Record auto release approval with timestamp, conditions evaluated, and decision rationale in system logs
Context: Auto release conditions are not met (holds exist, PTT invalid, or quantity issues)
GIVEN
Auto release conditions are not met (holds exist, PTT invalid, or quantity issues)
Applied to: Maintain Current Hold Status
WHEN
The system maintains current hold status
THEN
Preserve existing hold conditions and status array without modification, preventing auto release
Context: Auto release has been denied due to unmet conditions
GIVEN
Auto release has been denied due to unmet conditions
Applied to: Log Auto Release Denial
WHEN
The system logs the auto release denial
THEN
Record auto release denial with timestamp, specific blocking conditions (holds, PTT, quantities), and maintain audit trail
R-GCX016-cbl-02884 (+13) File: GCX016.cbl Manual Release Processing for CPRS Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manual Release Processing for CPRS':
  • Context - a manual release request is received for cargo:
    For Is Cargo CPRS?:
    When the system checks the cargo type in the cargo record, then if cargo type is cprs, processing continues; otherwise, the request is rejected with appropriate error message.
  • Context - a cprs cargo manual release request with mrl disposition code:
    For Validate MRL Disposition Code:
    When the system validates the disposition code against the dc table, then if mrl code is found and valid, processing continues; otherwise, an error is generated.
  • Context - a validated cprs cargo with mrl disposition code:
    For Check Current Cargo Status:
    When the system reads the current cargo status from cargo records and status segments, then the current status is retrieved and made available for hold status evaluation.
  • Context - cprs cargo with current status information available:
    For Cargo Currently Held?:
    When the system evaluates if cargo has any active hold conditions (border hold, destination hold, fda hold, or other hold types), then if cargo is held, manual release processing continues; if not held, the request is rejected.
  • Context - cprs cargo that is currently held and approved for manual release:
    For Clear Destination Index:
    When the system processes the manual release, then the destination index field is cleared to remove destination routing constraints.
  • Context - cprs cargo with cleared destination index ready for release:
    For Update Cargo Status to Released:
    When the system updates the cargo status, then cargo status is changed to released, hold flags are cleared, and release quantities are updated appropriately.
  • Context - cprs cargo that has been updated to released status:
    For Process Canadian Manifest Coordination:
    When the system searches for corresponding canadian manifest records using waybill information, then canadian manifest coordination is initiated to maintain cross-border cargo visibility.
  • Context - released cprs cargo requiring canadian manifest coordination:
    For Canadian Manifest Found?:
    When the system searches canadian manifest records by waybill and equipment information, then if canadian manifest records are found, special logging is generated; otherwise, standard processing continues.
  • Context - released cprs cargo with corresponding canadian manifest records found:
    For Generate Canadian Log Message:
    When the system processes the canadian manifest coordination, then a specialized log message is generated to gcx105 system documenting the cross-border cargo release.
  • Context - cprs cargo processed for manual release with or without canadian manifest coordination:
    For Update Status Array without New Code:
    When the system updates the status array, then the status array is updated to reflect the release without adding mrl as a new disposition code entry.
  • Context - cprs cargo with updated status array after manual release processing:
    For Generate Special CPRS Logging:
    When the system generates audit logs, then special cprs manual release logging is created with cargo details, release information, and processing timestamps.
  • Context - cprs cargo with completed manual release processing and audit logging:
    For Send Manual Release Notification:
    When the system sends notifications, then manual release notifications are sent to configured recipients with cargo details and release confirmation.
  • Context - a manual release request for cargo that is not cprs type:
    For Reject - Not CPRS Cargo:
    When the system validates the cargo type, then the request is rejected with an error message indicating manual release is only available for cprs cargo.
  • Context - cprs cargo with valid mrl disposition code but no active hold status:
    For Reject - Cargo Not Held:
    When the system evaluates the hold status, then the request is rejected with an error message indicating cargo must be held to qualify for manual release.
👨‍💻 Technical ACs (Gherkin)
Context: A manual release request is received for cargo
GIVEN
A manual release request is received for cargo
Applied to: Is Cargo CPRS?
WHEN
The system checks the cargo type in the cargo record
THEN
If cargo type is CPRS, processing continues; otherwise, the request is rejected with appropriate error message
Context: A CPRS cargo manual release request with MRL disposition code
GIVEN
A CPRS cargo manual release request with MRL disposition code
Applied to: Validate MRL Disposition Code
WHEN
The system validates the disposition code against the DC table
THEN
If MRL code is found and valid, processing continues; otherwise, an error is generated
Context: A validated CPRS cargo with MRL disposition code
GIVEN
A validated CPRS cargo with MRL disposition code
Applied to: Check Current Cargo Status
WHEN
The system reads the current cargo status from cargo records and status segments
THEN
The current status is retrieved and made available for hold status evaluation
Context: CPRS cargo with current status information available
GIVEN
CPRS cargo with current status information available
Applied to: Cargo Currently Held?
WHEN
The system evaluates if cargo has any active hold conditions (border hold, destination hold, FDA hold, or other hold types)
THEN
If cargo is held, manual release processing continues; if not held, the request is rejected
Context: CPRS cargo that is currently held and approved for manual release
GIVEN
CPRS cargo that is currently held and approved for manual release
Applied to: Clear Destination Index
WHEN
The system processes the manual release
THEN
The destination index field is cleared to remove destination routing constraints
Context: CPRS cargo with cleared destination index ready for release
GIVEN
CPRS cargo with cleared destination index ready for release
Applied to: Update Cargo Status to Released
WHEN
The system updates the cargo status
THEN
Cargo status is changed to released, hold flags are cleared, and release quantities are updated appropriately
Context: CPRS cargo that has been updated to released status
GIVEN
CPRS cargo that has been updated to released status
Applied to: Process Canadian Manifest Coordination
WHEN
The system searches for corresponding Canadian manifest records using waybill information
THEN
Canadian manifest coordination is initiated to maintain cross-border cargo visibility
Context: Released CPRS cargo requiring Canadian manifest coordination
GIVEN
Released CPRS cargo requiring Canadian manifest coordination
Applied to: Canadian Manifest Found?
WHEN
The system searches Canadian manifest records by waybill and equipment information
THEN
If Canadian manifest records are found, special logging is generated; otherwise, standard processing continues
Context: Released CPRS cargo with corresponding Canadian manifest records found
GIVEN
Released CPRS cargo with corresponding Canadian manifest records found
Applied to: Generate Canadian Log Message
WHEN
The system processes the Canadian manifest coordination
THEN
A specialized log message is generated to GCX105 system documenting the cross-border cargo release
Context: CPRS cargo processed for manual release with or without Canadian manifest coordination
GIVEN
CPRS cargo processed for manual release with or without Canadian manifest coordination
Applied to: Update Status Array without New Code
WHEN
The system updates the status array
THEN
The status array is updated to reflect the release without adding MRL as a new disposition code entry
Context: CPRS cargo with updated status array after manual release processing
GIVEN
CPRS cargo with updated status array after manual release processing
Applied to: Generate Special CPRS Logging
WHEN
The system generates audit logs
THEN
Special CPRS manual release logging is created with cargo details, release information, and processing timestamps
Context: CPRS cargo with completed manual release processing and audit logging
GIVEN
CPRS cargo with completed manual release processing and audit logging
Applied to: Send Manual Release Notification
WHEN
The system sends notifications
THEN
Manual release notifications are sent to configured recipients with cargo details and release confirmation
Context: A manual release request for cargo that is not CPRS type
GIVEN
A manual release request for cargo that is not CPRS type
Applied to: Reject - Not CPRS Cargo
WHEN
The system validates the cargo type
THEN
The request is rejected with an error message indicating manual release is only available for CPRS cargo
Context: CPRS cargo with valid MRL disposition code but no active hold status
GIVEN
CPRS cargo with valid MRL disposition code but no active hold status
Applied to: Reject - Cargo Not Held
WHEN
The system evaluates the hold status
THEN
The request is rejected with an error message indicating cargo must be held to qualify for manual release
R-GCX016-cbl-02898 (+8) File: GCX016.cbl Disposition Code Removal Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Removal Processing':
  • Context - a disposition code needs to be removed from the cargo status array and the s09a status array contains existing disposition codes:
    For Remove Code from Array:
    When the system searches for matching codes in the array and finds a code that matches the entry number and matches the quantity and matches the status information, then the system marks the code for removal and removes the code from the array and compacts the remaining array elements.
  • Context - disposition codes have been removed from the status array:
    For Update Array Element Count:
    When the array compaction is complete, then the system updates the array element count to reflect the current number of active status entries.
  • Context - a disposition code removal request is being processed:
    For Identify Counterpart Codes:
    When the system needs to identify related codes for removal, then the system identifies counterpart codes based on the disposition code table configuration.
  • Context - a disposition code is found in the status array and entry number matching is required:
    For Matches Entry Number?:
    When the system compares the entry numbers, then the code is eligible for removal if the entry numbers match or no entry number validation is required.
  • Context - a disposition code is found in the status array and quantity matching is required:
    For Matches Quantity?:
    When the system compares the quantities, then the code is eligible for removal if the quantities match or no quantity validation is required.
  • Context - a disposition code is found in the status array and status information matching is required:
    For Matches Status Info?:
    When the system compares the status information, then the code is eligible for removal if the status information matches or no status information validation is required.
  • Context - disposition codes have been removed from the status array and the array has been compacted:
    For Replace S09 Segments in Database:
    When the system needs to persist the changes, then the system replaces the s09 segments in the database with the updated status array information.
  • Context - disposition codes have been removed from the status array and the database has been updated:
    For Update Cargo Record Status:
    When the cargo record needs to reflect the status changes, then the system updates the cargo record status based on the remaining disposition codes in the status array.
  • Context - disposition codes have been successfully removed from the cargo status:
    For Log Removal Activity:
    When the removal processing is complete, then the system logs the removal activity including the codes removed and the cargo identifier and the timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code needs to be removed from the cargo status array AND the S09A status array contains existing disposition codes
GIVEN
A disposition code needs to be removed from the cargo status array AND the S09A status array contains existing disposition codes
Applied to: Remove Code from Array
WHEN
The system searches for matching codes in the array AND finds a code that matches the entry number AND matches the quantity AND matches the status information
THEN
The system marks the code for removal AND removes the code from the array AND compacts the remaining array elements
Context: Disposition codes have been removed from the status array
GIVEN
Disposition codes have been removed from the status array
Applied to: Update Array Element Count
WHEN
The array compaction is complete
THEN
The system updates the array element count to reflect the current number of active status entries
Context: A disposition code removal request is being processed
GIVEN
A disposition code removal request is being processed
Applied to: Identify Counterpart Codes
WHEN
The system needs to identify related codes for removal
THEN
The system identifies counterpart codes based on the disposition code table configuration
Context: A disposition code is found in the status array AND entry number matching is required
GIVEN
A disposition code is found in the status array AND entry number matching is required
Applied to: Matches Entry Number?
WHEN
The system compares the entry numbers
THEN
The code is eligible for removal IF the entry numbers match OR no entry number validation is required
Context: A disposition code is found in the status array AND quantity matching is required
GIVEN
A disposition code is found in the status array AND quantity matching is required
Applied to: Matches Quantity?
WHEN
The system compares the quantities
THEN
The code is eligible for removal IF the quantities match OR no quantity validation is required
Context: A disposition code is found in the status array AND status information matching is required
GIVEN
A disposition code is found in the status array AND status information matching is required
Applied to: Matches Status Info?
WHEN
The system compares the status information
THEN
The code is eligible for removal IF the status information matches OR no status information validation is required
Context: Disposition codes have been removed from the status array AND the array has been compacted
GIVEN
Disposition codes have been removed from the status array AND the array has been compacted
Applied to: Replace S09 Segments in Database
WHEN
The system needs to persist the changes
THEN
The system replaces the S09 segments in the database with the updated status array information
Context: Disposition codes have been removed from the status array AND the database has been updated
GIVEN
Disposition codes have been removed from the status array AND the database has been updated
Applied to: Update Cargo Record Status
WHEN
The cargo record needs to reflect the status changes
THEN
The system updates the cargo record status based on the remaining disposition codes in the status array
Context: Disposition codes have been successfully removed from the cargo status
GIVEN
Disposition codes have been successfully removed from the cargo status
Applied to: Log Removal Activity
WHEN
The removal processing is complete
THEN
The system logs the removal activity including the codes removed AND the cargo identifier AND the timestamp
R-GCX016-cbl-02907 (+12) File: GCX016.cbl Release Code with Counterpart Removal Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Code with Counterpart Removal':
  • Context - a disposition code is being processed for cargo release:
    For Disposition Code Has Counterpart Removal?:
    When the system evaluates the disposition code configuration, then the system identifies whether counterpart removal is required based on the disposition code type.
  • Context - a disposition code requires counterpart removal and the cargo has an existing status array:
    For Search Status Array for Counterpart Codes:
    When the system searches through all status entries in the array, then the system identifies all counterpart codes that match the removal criteria for the current disposition code.
  • Context - the system has searched the status array for counterpart codes:
    For Counterpart Code Found?:
    When the search process completes, then the system determines whether any counterpart codes were found that require removal.
  • Context - counterpart disposition codes have been found in the status array:
    For Remove Counterpart Code from Array:
    When the system processes the removal request, then the system removes the counterpart codes from the status array and marks the positions for compaction.
  • Context - counterpart codes have been removed from the status array creating gaps:
    For Compact Status Array:
    When the system performs array compaction, then the system shifts remaining status entries to fill gaps and maintains proper array structure.
  • Context - one or more counterpart codes have been processed for removal:
    For More Counterpart Codes?:
    When the system checks for remaining counterpart codes in the array, then the system determines whether additional counterpart codes exist that need to be removed.
  • Context - counterpart codes have been removed or no counterpart removal was required:
    For Add Release Status Code:
    When the system adds the release status code, then the system inserts the new disposition code into the next available position in the status array.
  • Context - a release disposition code has been added to the status array:
    For Release Affects Quantities?:
    When the system evaluates the quantity impact configuration for the disposition code, then the system determines whether release quantities should be updated based on the disposition code type.
    For Set Released Flag in Status Array:
    When the system sets the release flags, then the system marks the status entry with released flag and any additional release indicators required by the disposition code.
  • Context - a release disposition code affects quantities and quantity information is available:
    For Update Release Quantities:
    When the system processes the quantity update, then the system adds or subtracts the specified quantity from the current release quantity ensuring the result is not negative.
  • Context - a release status has been added with release flags set:
    For Mark Location Information:
    When location information is available for the release, then the system records the location code and related geographic information in the status entry.
  • Context - a disposition code does not require counterpart removal:
    For Skip Counterpart Removal:
    When the system processes the release request, then the system proceeds directly to adding the release status code without searching for or removing counterpart codes.
  • Context - all required status array modifications have been completed:
    For Status Array Updated Successfully:
    When the system finalizes the update process, then the system confirms successful completion and the status array reflects the new release status with any counterpart codes removed.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo release
GIVEN
A disposition code is being processed for cargo release
Applied to: Disposition Code Has Counterpart Removal?
WHEN
The system evaluates the disposition code configuration
THEN
The system identifies whether counterpart removal is required based on the disposition code type
Context: A disposition code requires counterpart removal and the cargo has an existing status array
GIVEN
A disposition code requires counterpart removal and the cargo has an existing status array
Applied to: Search Status Array for Counterpart Codes
WHEN
The system searches through all status entries in the array
THEN
The system identifies all counterpart codes that match the removal criteria for the current disposition code
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 Code Found?
WHEN
The search process completes
THEN
The system determines whether any counterpart codes were found that require removal
Context: Counterpart disposition codes have been found in the status array
GIVEN
Counterpart disposition codes have been found in the status array
Applied to: Remove Counterpart Code from Array
WHEN
The system processes the removal request
THEN
The system removes the counterpart codes from the status array and marks the positions for compaction
Context: Counterpart codes have been removed from the status array creating gaps
GIVEN
Counterpart codes have been removed from the status array creating gaps
Applied to: Compact Status Array
WHEN
The system performs array compaction
THEN
The system shifts remaining status entries to fill gaps and maintains proper array structure
Context: One or more counterpart codes have been processed for removal
GIVEN
One or more counterpart codes have been processed for removal
Applied to: More Counterpart Codes?
WHEN
The system checks for remaining counterpart codes in the array
THEN
The system determines whether additional counterpart codes exist that need to be removed
Context: Counterpart codes have been removed or no counterpart removal was required
GIVEN
Counterpart codes have been removed or no counterpart removal was required
Applied to: Add Release Status Code
WHEN
The system adds the release status code
THEN
The system inserts the new disposition code into the next available position in the status array
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: Release Affects Quantities?
WHEN
The system evaluates the quantity impact configuration for the disposition code
THEN
The system determines whether release quantities should be updated based on the disposition code type
Applied to: Set Released Flag in Status Array
WHEN
The system sets the release flags
THEN
The system marks the status entry with released flag and any additional release indicators required by the disposition code
Context: A release disposition code affects quantities and quantity information is available
GIVEN
A release disposition code affects quantities and quantity information is available
Applied to: Update Release Quantities
WHEN
The system processes the quantity update
THEN
The system adds or subtracts the specified quantity from the current release quantity ensuring the result is not negative
Context: A release status has been added with release flags set
GIVEN
A release status has been added with release flags set
Applied to: Mark Location Information
WHEN
Location information is available for the release
THEN
The system records the location code and related geographic information in the status entry
Context: A disposition code does not require counterpart removal
GIVEN
A disposition code does not require counterpart removal
Applied to: Skip Counterpart Removal
WHEN
The system processes the release request
THEN
The system proceeds directly to adding the release status code without searching for or removing counterpart codes
Context: All required status array modifications have been completed
GIVEN
All required status array modifications have been completed
Applied to: Status Array Updated Successfully
WHEN
The system finalizes the update process
THEN
The system confirms successful completion and the status array reflects the new release status with any counterpart codes removed
R-GCX016-cbl-02920 (+7) File: GCX016.cbl Information Code with Counterpart Removal Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Information Code with Counterpart Removal':
  • Context - a disposition code is received for processing:
    For Check Disposition Code Type:
    When the system checks the disposition code type in the dc table, then the system identifies if it is an information code with removal flag set.
  • Context - an information code with removal flag is being processed and a status array exists for the cargo:
    For Search Status Array for Counterpart Codes:
    When the system searches for counterpart codes in the status array using the disposition code's counterpart definition, then the system identifies all matching counterpart codes that need to be removed.
  • Context - counterpart codes are found in the status array and an information code with removal flag is being processed:
    For Remove Matching Counterpart Codes:
    When the system removes all matching counterpart codes from the status array, then the conflicting disposition codes are eliminated from the cargo status.
  • Context - counterpart codes have been removed from the status array creating gaps:
    For Compact Status Array:
    When the system compacts the array by moving remaining entries to fill the gaps, then the status array maintains proper sequence without empty slots and preserves data integrity.
  • Context - counterpart codes have been removed and the status array has been compacted:
    For Add New Informational Status Code:
    When the system adds the new information disposition code to the status array, then the new informational status is recorded in the cargo status history.
  • Context - an information disposition code has been added to the status array:
    For Set Information Status Flag:
    When the system sets the information status flag for the new entry, then the disposition code is marked as informational and will not affect cargo quantities or release processing.
  • Context - an information disposition code is being processed:
    For Preserve Cargo Quantities:
    When the system updates the cargo status with the information code, then the cargo release quantities and total quantities remain unchanged as information codes are for status tracking only.
  • Context - counterpart codes have been removed and an information code has been added to the cargo status:
    For Log Status Change Information:
    When the system logs the status change activity, then the audit trail captures both the removal of counterpart codes and addition of the information code with timestamps and user information.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received for processing
GIVEN
A disposition code is received for processing
Applied to: Check Disposition Code Type
WHEN
The system checks the disposition code type in the DC table
THEN
The system identifies if it is an information code with removal flag set
Context: An information code with removal flag is being processed AND a status array exists for the cargo
GIVEN
An information code with removal flag is being processed AND a status array exists for the cargo
Applied to: Search Status Array for Counterpart Codes
WHEN
The system searches for counterpart codes in the status array using the disposition code's counterpart definition
THEN
The system identifies all matching counterpart codes that need to be removed
Context: Counterpart codes are found in the status array AND an information code with removal flag is being processed
GIVEN
Counterpart codes are found in the status array AND an information code with removal flag is being processed
Applied to: Remove Matching Counterpart Codes
WHEN
The system removes all matching counterpart codes from the status array
THEN
The conflicting disposition codes are eliminated from the cargo status
Context: Counterpart codes have been removed from the status array creating gaps
GIVEN
Counterpart codes have been removed from the status array creating gaps
Applied to: Compact Status Array
WHEN
The system compacts the array by moving remaining entries to fill the gaps
THEN
The status array maintains proper sequence without empty slots and preserves data integrity
Context: Counterpart codes have been removed and the status array has been compacted
GIVEN
Counterpart codes have been removed and the status array has been compacted
Applied to: Add New Informational Status Code
WHEN
The system adds the new information disposition code to the status array
THEN
The new informational status is recorded in the cargo status history
Context: An information disposition code has been added to the status array
GIVEN
An information disposition code has been added to the status array
Applied to: Set Information Status Flag
WHEN
The system sets the information status flag for the new entry
THEN
The disposition code is marked as informational and will not affect cargo quantities or release processing
Context: An information disposition code is being processed
GIVEN
An information disposition code is being processed
Applied to: Preserve Cargo Quantities
WHEN
The system updates the cargo status with the information code
THEN
The cargo release quantities and total quantities remain unchanged as information codes are for status tracking only
Context: Counterpart codes have been removed AND an information code has been added to the cargo status
GIVEN
Counterpart codes have been removed AND an information code has been added to the cargo status
Applied to: Log Status Change Information
WHEN
The system logs the status change activity
THEN
The audit trail captures both the removal of counterpart codes and addition of the information code with timestamps and user information
R-GCX016-cbl-02928 (+9) File: GCX016.cbl Status Array Overflow Management Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Overflow Management':
  • Context - a status array processing request is received and the system needs to add a new disposition code:
    For Check Current Array Size:
    When the system checks the current array size against processing requirements, then the current array size is determined and made available for capacity validation.
  • Context - the system is processing status array operations:
    For Get Maximum Array Limit:
    When a capacity check is required for the status array, then the maximum allowable array limit is retrieved and used for validation.
  • Context - the current array size and maximum array limit are known:
    For Array Size < Maximum?:
    When the system evaluates if there is capacity for additional status entries, then if current array size is less than maximum limit, allow new code addition, otherwise prevent array overflow.
  • Context - the status array has capacity available (current size is less than maximum limit):
    For Allow New Code Addition:
    When a new disposition code needs to be added to the array, then the system allows the disposition code to be processed and added to the status array.
  • Context - the status array has reached its maximum capacity (current size equals or exceeds maximum limit):
    For Prevent Array Overflow:
    When a request is made to add a new disposition code, then the system prevents the addition to avoid array overflow conditions.
  • Context - an array overflow condition has been prevented:
    For Log Overflow Warning:
    When the system needs to notify operators of the capacity issue, then a warning message is logged indicating the status array overflow condition.
  • Context - an array overflow warning has been logged:
    For Return Error Status:
    When the system needs to respond to the original processing request, then an error status is returned indicating the processing could not be completed due to capacity constraints.
  • Context - new code addition has been authorized and array capacity is available:
    For Process Disposition Code:
    When the disposition code processing is executed, then the disposition code is processed according to business rules and cargo status is updated appropriately.
  • Context - a disposition code has been successfully processed and added to the status array:
    For Update Array Counter:
    When the array counter needs to be updated, then the array counter is incremented to reflect the new entry count.
  • Context - an error status has been returned due to array overflow conditions:
    For Reject Code Addition:
    When the disposition code addition request is finalized, then the code addition is rejected and no changes are made to the status array.
👨‍💻 Technical ACs (Gherkin)
Context: A status array processing request is received and the system needs to add a new disposition code
GIVEN
A status array processing request is received and the system needs to add a new disposition code
Applied to: Check Current Array Size
WHEN
The system checks the current array size against processing requirements
THEN
The current array size is determined and made available for capacity validation
Context: The system is processing status array operations
GIVEN
The system is processing status array operations
Applied to: Get Maximum Array Limit
WHEN
A capacity check is required for the status array
THEN
The maximum allowable array limit is retrieved and used for validation
Context: The current array size and maximum array limit are known
GIVEN
The current array size and maximum array limit are known
Applied to: Array Size < Maximum?
WHEN
The system evaluates if there is capacity for additional status entries
THEN
If current array size is less than maximum limit, allow new code addition, otherwise prevent array overflow
Context: The status array has capacity available (current size is less than maximum limit)
GIVEN
The status array has capacity available (current size is less than maximum limit)
Applied to: Allow New Code Addition
WHEN
A new disposition code needs to be added to the array
THEN
The system allows the disposition code to be processed and added to the status array
Context: The status array has reached its maximum capacity (current size equals or exceeds maximum limit)
GIVEN
The status array has reached its maximum capacity (current size equals or exceeds maximum limit)
Applied to: Prevent Array Overflow
WHEN
A request is made to add a new disposition code
THEN
The system prevents the addition to avoid array overflow conditions
Context: An array overflow condition has been prevented
GIVEN
An array overflow condition has been prevented
Applied to: Log Overflow Warning
WHEN
The system needs to notify operators of the capacity issue
THEN
A warning message is logged indicating the status array overflow condition
Context: An array overflow warning has been logged
GIVEN
An array overflow warning has been logged
Applied to: Return Error Status
WHEN
The system needs to respond to the original processing request
THEN
An error status is returned indicating the processing could not be completed due to capacity constraints
Context: New code addition has been authorized and array capacity is available
GIVEN
New code addition has been authorized and array capacity is available
Applied to: Process Disposition Code
WHEN
The disposition code processing is executed
THEN
The disposition code is processed according to business rules and cargo status is updated appropriately
Context: A disposition code has been successfully processed and added to the status array
GIVEN
A disposition code has been successfully processed and added to the status array
Applied to: Update Array Counter
WHEN
The array counter needs to be updated
THEN
The array counter is incremented to reflect the new entry count
Context: An error status has been returned due to array overflow conditions
GIVEN
An error status has been returned due to array overflow conditions
Applied to: Reject Code Addition
WHEN
The disposition code addition request is finalized
THEN
The code addition is rejected and no changes are made to the status array
R-GCX016-cbl-02938 (+5) File: GCX016.cbl Quantity Action Processing for Release Codes Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Quantity Action Processing for Release Codes':
  • Context - a disposition code with quantity action 'a' (add) and a quantity value from x4-05 edi segment:
    For Add Quantity to Release Amount:
    When the system processes the quantity action for cargo release, then the system adds the x4-05 quantity to the current cargo release quantity.
  • Context - a disposition code with quantity action 's' (subtract) and a quantity value from x4-05 edi segment:
    For Subtract Quantity from Release Amount:
    When the system processes the quantity action for cargo release, then the system subtracts the x4-05 quantity from the current cargo release quantity.
  • Context - a disposition code with quantity action that is neither 'a' (add) nor 's' (subtract):
    For No Quantity Change Required:
    When the system processes the quantity action for cargo release, then the system does not modify the current cargo release quantity.
  • Context - a calculated cargo release quantity that is less than zero:
    For Set Quantity to Zero:
    When the system validates the quantity calculation result, then the system sets the cargo release quantity to zero to prevent negative values.
  • Context - a processed quantity action that modified cargo release quantities:
    For Log Quantity Action in Message:
    When the system completes the quantity update processing, then the system logs the quantity action details in the processing message for audit trail.
  • Context - a completed quantity action with updated release quantities:
    For Format Quantity Action Display:
    When the system prepares user notification messages, then the system formats the quantity action details for clear display showing before and after quantities.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code with quantity action 'A' (ADD) and a quantity value from X4-05 EDI segment
GIVEN
A disposition code with quantity action 'A' (ADD) and a quantity value from X4-05 EDI segment
Applied to: Add Quantity to Release Amount
WHEN
The system processes the quantity action for cargo release
THEN
The system adds the X4-05 quantity to the current cargo release quantity
Context: A disposition code with quantity action 'S' (SUBTRACT) and a quantity value from X4-05 EDI segment
GIVEN
A disposition code with quantity action 'S' (SUBTRACT) and a quantity value from X4-05 EDI segment
Applied to: Subtract Quantity from Release Amount
WHEN
The system processes the quantity action for cargo release
THEN
The system subtracts the X4-05 quantity from the current cargo release quantity
Context: A disposition code with quantity action that is neither 'A' (ADD) nor 'S' (SUBTRACT)
GIVEN
A disposition code with quantity action that is neither 'A' (ADD) nor 'S' (SUBTRACT)
Applied to: No Quantity Change Required
WHEN
The system processes the quantity action for cargo release
THEN
The system does not modify the current cargo release quantity
Context: A calculated cargo release quantity that is less than zero
GIVEN
A calculated cargo release quantity that is less than zero
Applied to: Set Quantity to Zero
WHEN
The system validates the quantity calculation result
THEN
The system sets the cargo release quantity to zero to prevent negative values
Context: A processed quantity action that modified cargo release quantities
GIVEN
A processed quantity action that modified cargo release quantities
Applied to: Log Quantity Action in Message
WHEN
The system completes the quantity update processing
THEN
The system logs the quantity action details in the processing message for audit trail
Context: A completed quantity action with updated release quantities
GIVEN
A completed quantity action with updated release quantities
Applied to: Format Quantity Action Display
WHEN
The system prepares user notification messages
THEN
The system formats the quantity action details for clear display showing before and after quantities
R-GCX016-cbl-02944 (+16) File: GCX016.cbl Hold Cargo Message Generation with Location Details Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hold Cargo Message Generation with Location Details':
  • Context - a cargo record requires hold message generation:
    For Hold Message Generation Required:
    When the system determines that hold cargo messaging is needed, then the hold message generation process is initiated.
  • Context - a cargo record with populated s09a status array exists:
    For Analyze Cargo Status Array:
    When the system analyzes the status array for hold flags and location indicators, then hold status flags and location requirements are identified from the array.
  • Context - cargo status array has been analyzed for hold conditions:
    For Cargo Hold Location?:
    When the system evaluates hold location flags in the status array, then the system identifies hold location as border, destination, or both locations.
  • Context - cargo status indicates border hold condition:
    For Determine Border Hold:
    When the system processes border hold requirements, then border hold processing is initiated and border location details are prepared.
  • Context - cargo status indicates destination hold condition:
    For Determine Destination Hold:
    When the system processes destination hold requirements, then destination hold processing is initiated and destination location details are prepared.
  • Context - border hold processing is required:
    For Get Border Location Details:
    When the system needs border location information for message formatting, then border station details and location information are retrieved from location tables.
  • Context - destination hold processing is required:
    For Get Destination Location Details:
    When the system needs destination location information for message formatting, then destination station details and location information are retrieved from location tables.
  • Context - location details have been retrieved for border or destination holds:
    For Format Hold Message with Location:
    When the system formats the hold message with location information, then hold message is formatted with appropriate location details and station information.
  • Context - hold message formatting is in progress:
    For Include Disposition Code Details:
    When the system adds disposition code details to the message, then disposition code and its description are included in the hold message.
  • Context - hold message with disposition code details exists:
    For Add Cargo Information:
    When the system adds cargo information to the message, then car id, waybill number, and cargo identifiers are included in the hold message.
  • Context - hold message with cargo information exists:
    For Add Quantity Information:
    When the system adds quantity information to the message, then total quantities and affected quantities are included in the hold message.
  • Context - hold message has been formatted with all required information:
    For Message Type Required?:
    When the system determines the specific message type needed, then message type is identified as border hold, destination hold, or combined hold message.
  • Context - message type is determined as border hold:
    For Generate Border Hold Message:
    When the system generates the border hold message, then border-specific hold message is created with border location details.
  • Context - message type is determined as destination hold:
    For Generate Destination Hold Message:
    When the system generates the destination hold message, then destination-specific hold message is created with destination location details.
  • Context - hold message has been generated (border or destination):
    For Route Message to Appropriate Users:
    When the system routes the message to appropriate recipients, then hold message is sent to relevant users, brokers, and notification systems.
  • Context - hold message has been routed to appropriate users:
    For Log Hold Message Details:
    When the system logs the hold message details, then hold message information is recorded in system logs with timestamp and recipient details.
  • Context - hold message has been generated, routed, and logged:
    For Hold Message Generation Complete:
    When the hold message generation process completes, then system returns successful completion status and control to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires hold message generation
GIVEN
A cargo record requires hold message generation
Applied to: Hold Message Generation Required
WHEN
The system determines that hold cargo messaging is needed
THEN
The hold message generation process is initiated
Context: A cargo record with populated S09A status array exists
GIVEN
A cargo record with populated S09A status array exists
Applied to: Analyze Cargo Status Array
WHEN
The system analyzes the status array for hold flags and location indicators
THEN
Hold status flags and location requirements are identified from the array
Context: Cargo status array has been analyzed for hold conditions
GIVEN
Cargo status array has been analyzed for hold conditions
Applied to: Cargo Hold Location?
WHEN
The system evaluates hold location flags in the status array
THEN
The system identifies hold location as border, destination, or both locations
Context: Cargo status indicates border hold condition
GIVEN
Cargo status indicates border hold condition
Applied to: Determine Border Hold
WHEN
The system processes border hold requirements
THEN
Border hold processing is initiated and border location details are prepared
Context: Cargo status indicates destination hold condition
GIVEN
Cargo status indicates destination hold condition
Applied to: Determine Destination Hold
WHEN
The system processes destination hold requirements
THEN
Destination hold processing is initiated and destination location details are prepared
Context: Border hold processing is required
GIVEN
Border hold processing is required
Applied to: Get Border Location Details
WHEN
The system needs border location information for message formatting
THEN
Border station details and location information are retrieved from location tables
Context: Destination hold processing is required
GIVEN
Destination hold processing is required
Applied to: Get Destination Location Details
WHEN
The system needs destination location information for message formatting
THEN
Destination station details and location information are retrieved from location tables
Context: Location details have been retrieved for border or destination holds
GIVEN
Location details have been retrieved for border or destination holds
Applied to: Format Hold Message with Location
WHEN
The system formats the hold message with location information
THEN
Hold message is formatted with appropriate location details and station information
Context: Hold message formatting is in progress
GIVEN
Hold message formatting is in progress
Applied to: Include Disposition Code Details
WHEN
The system adds disposition code details to the message
THEN
Disposition code and its description are included in the hold message
Context: Hold message with disposition code details exists
GIVEN
Hold message with disposition code details exists
Applied to: Add Cargo Information
WHEN
The system adds cargo information to the message
THEN
Car ID, waybill number, and cargo identifiers are included in the hold message
Context: Hold message with cargo information exists
GIVEN
Hold message with cargo information exists
Applied to: Add Quantity Information
WHEN
The system adds quantity information to the message
THEN
Total quantities and affected quantities are included in the hold message
Context: Hold message has been formatted with all required information
GIVEN
Hold message has been formatted with all required information
Applied to: Message Type Required?
WHEN
The system determines the specific message type needed
THEN
Message type is identified as border hold, destination hold, or combined hold message
Context: Message type is determined as border hold
GIVEN
Message type is determined as border hold
Applied to: Generate Border Hold Message
WHEN
The system generates the border hold message
THEN
Border-specific hold message is created with border location details
Context: Message type is determined as destination hold
GIVEN
Message type is determined as destination hold
Applied to: Generate Destination Hold Message
WHEN
The system generates the destination hold message
THEN
Destination-specific hold message is created with destination location details
Context: Hold message has been generated (border or destination)
GIVEN
Hold message has been generated (border or destination)
Applied to: Route Message to Appropriate Users
WHEN
The system routes the message to appropriate recipients
THEN
Hold message is sent to relevant users, brokers, and notification systems
Context: Hold message has been routed to appropriate users
GIVEN
Hold message has been routed to appropriate users
Applied to: Log Hold Message Details
WHEN
The system logs the hold message details
THEN
Hold message information is recorded in system logs with timestamp and recipient details
Context: Hold message has been generated, routed, and logged
GIVEN
Hold message has been generated, routed, and logged
Applied to: Hold Message Generation Complete
WHEN
The hold message generation process completes
THEN
System returns successful completion status and control to the calling process
R-GCX016-cbl-02961 (+39) File: GCX016.cbl Cargo Status Transition Analysis Merged 40 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Transition Analysis':
  • Context - a cargo status transition analysis is starting:
    For Initialize Status Flags:
    When the system begins status array analysis, then all status flags (hold, release, ptt, proceed, arrival, export, fda hold) are set to false and quantity counters are reset to zero.
  • Context - the s09a status array contains cargo status entries:
    For Scan S09A Status Array:
    When the system performs status transition analysis, then each array element is examined sequentially for status code analysis.
  • Context - an s09a array element is being examined:
    For Status Code Found?:
    When the system checks for status code presence, then if status code is not spaces and not low-values, proceed with analysis, otherwise skip to next element.
  • Context - a valid status code exists in the array element:
    For Analyze Disposition Code Type:
    When the system analyzes the disposition code, then the code is categorized as hold, release, ptt, proceed, arrival, export, or fda hold type.
  • Context - a disposition code is being analyzed:
    For Hold Code?:
    When the system checks if the code indicates a hold status, then if the code represents a hold condition, set hold status flag to true.
    For Release Code?:
    When the system checks if the code indicates a release status, then if the code represents a release condition, proceed with release processing.
    For PTT Code?:
    When the system checks if the code indicates ptt status, then if the code represents ptt condition, proceed with ptt processing.
    For Proceed Code?:
    When the system checks if the code indicates proceed status, then if the code represents proceed condition, proceed with proceed processing.
    For Arrival Code?:
    When the system checks if the code indicates arrival status, then if the code represents arrival condition, proceed with arrival processing.
    For Export Code?:
    When the system checks if the code indicates export status, then if the code represents export condition, proceed with export processing.
    For FDA Hold Code?:
    When the system checks if the code indicates fda hold status, then if the code represents fda hold condition, proceed with fda hold processing.
  • Context - a hold disposition code has been identified:
    For Set Hold Status Flag:
    When the system processes the hold code, then the hold status flag is set to true and hold processing continues.
  • Context - a hold status code has been identified:
    For Border or Destination Hold?:
    When the system determines the hold location, then the hold is classified as either border hold or destination hold based on the specific code value.
  • Context - a hold code has been classified as a border hold:
    For Set Border Hold Flag:
    When the system processes the border hold classification, then the border hold flag is set to true.
  • Context - a hold code has been classified as a destination hold:
    For Set Destination Hold Flag:
    When the system processes the destination hold classification, then the destination hold flag is set to true.
  • Context - a release disposition code has been identified:
    For Set Release Status Flag:
    When the system processes the release code, then the release status flag is set to true.
  • Context - a release status code with associated quantity exists:
    For Calculate Released Quantity:
    When the system processes the release quantity, then the released quantity is added to the total released quantity counter.
  • Context - a ptt disposition code has been identified:
    For Set PTT Flag:
    When the system processes the ptt code, then the ptt flag is set to true.
  • Context - a ptt status code with associated quantity exists:
    For Validate PTT Quantity:
    When the system validates ptt quantity requirements, then the ptt quantity is verified against business rules and thresholds.
  • Context - a proceed disposition code has been identified:
    For Set Proceed Flag:
    When the system processes the proceed code, then the proceed flag is set to true.
  • Context - a proceed status code has been processed:
    For Set Border Arrival Date:
    When the system sets border arrival information, then the border arrival date is recorded from the status code date information.
  • Context - an arrival disposition code has been identified:
    For Set Arrival Flag:
    When the system processes the arrival code, then the arrival flag is set to true.
  • Context - an export disposition code has been identified:
    For Set Export Flag:
    When the system processes the export code, then the export flag is set to true.
  • Context - an fda hold disposition code has been identified:
    For Set FDA Hold Flag at Destination:
    When the system processes the fda hold code, then the fda hold flag is set to true for destination location.
  • Context - current array element processing is complete:
    For Continue Array Scan:
    When the system continues array scanning, then processing moves to the next array element for analysis.
  • Context - current array element has been processed:
    For More Array Elements?:
    When the system checks for remaining elements, then if more elements exist, continue scanning, otherwise proceed to final status determination.
  • Context - all status array elements have been analyzed and flags are set:
    For Determine Final Cargo State:
    When the system determines final cargo state, then the cargo state is determined based on the combination of status flags and business rules.
  • Context - final cargo state analysis is complete:
    For Manual Release Required?:
    When the system checks for manual release requirements, then if manual release conditions are met, set manual release flag to true.
  • Context - manual release conditions have been identified:
    For Set Manual Release Flag:
    When the system processes manual release requirements, then the manual release flag is set to true.
  • Context - release quantities and total quantities are available:
    For Partial Release? & Full Release?:
    When the system compares released quantity to total quantity, then if released quantity is less than total quantity, partial release status is identified and if released quantity equals or exceeds total quantity, full release status is identified.
  • Context - partial release status has been identified:
    For Set Hold on Piece Count Status:
    When the system processes partial release conditions, then hold on piece count status is set to indicate remaining quantity is held.
  • Context - full release status has been confirmed:
    For Clear Destination Index:
    When the system processes full release conditions, then the destination index is cleared to reflect released status.
  • Context - cargo status transition analysis is complete:
    For Unrelease Detected?:
    When the system checks for unrelease conditions, then if previous release status has been removed, unrelease condition is detected.
  • Context - unrelease condition has been detected:
    For Set Unrelease Notification Flag:
    When the system processes unrelease conditions, then the unrelease notification flag is set to trigger appropriate notifications.
  • Context - hold status flags have been set during analysis:
    For Determine Hold Location:
    When the system determines hold location, then hold location is classified as border, destination, or both based on the active hold flags.
  • Context - cargo status analysis is nearing completion:
    For Age Calculation Required?:
    When the system checks age calculation requirements, then if business rules require age calculation, proceed with julian date calculation.
  • Context - age calculation is required and cargo dates are available:
    For Calculate Cargo Age using Julian Date:
    When the system calculates cargo age, then cargo age is computed using julian date conversion and current date comparison.
  • Context - all status analysis and calculations are complete:
    For Set Final Status Flags:
    When the system sets final status flags, then all relevant status flags are set to reflect the final cargo state.
  • Context - all status analysis steps have been completed:
    For Status Transition Analysis Complete:
    When the system finalizes status transition analysis, then the analysis is marked complete and results are available for further processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status transition analysis is starting
GIVEN
A cargo status transition analysis is starting
Applied to: Initialize Status Flags
WHEN
The system begins status array analysis
THEN
All status flags (hold, release, PTT, proceed, arrival, export, FDA hold) are set to false and quantity counters are reset to zero
Context: The S09A status array contains cargo status entries
GIVEN
The S09A status array contains cargo status entries
Applied to: Scan S09A Status Array
WHEN
The system performs status transition analysis
THEN
Each array element is examined sequentially for status code analysis
Context: An S09A array element is being examined
GIVEN
An S09A array element is being examined
Applied to: Status Code Found?
WHEN
The system checks for status code presence
THEN
If status code is not spaces and not low-values, proceed with analysis, otherwise skip to next element
Context: A valid status code exists in the array element
GIVEN
A valid status code exists in the array element
Applied to: Analyze Disposition Code Type
WHEN
The system analyzes the disposition code
THEN
The code is categorized as hold, release, PTT, proceed, arrival, export, or FDA hold type
Context: A disposition code is being analyzed
GIVEN
A disposition code is being analyzed
Applied to: Hold Code?
WHEN
The system checks if the code indicates a hold status
THEN
If the code represents a hold condition, set hold status flag to true
Applied to: Release Code?
WHEN
The system checks if the code indicates a release status
THEN
If the code represents a release condition, proceed with release processing
Applied to: PTT Code?
WHEN
The system checks if the code indicates PTT status
THEN
If the code represents PTT condition, proceed with PTT processing
Applied to: Proceed Code?
WHEN
The system checks if the code indicates proceed status
THEN
If the code represents proceed condition, proceed with proceed processing
Applied to: Arrival Code?
WHEN
The system checks if the code indicates arrival status
THEN
If the code represents arrival condition, proceed with arrival processing
Applied to: Export Code?
WHEN
The system checks if the code indicates export status
THEN
If the code represents export condition, proceed with export processing
Applied to: FDA Hold Code?
WHEN
The system checks if the code indicates FDA hold status
THEN
If the code represents FDA hold condition, proceed with FDA hold processing
Context: A hold disposition code has been identified
GIVEN
A hold disposition code has been identified
Applied to: Set Hold Status Flag
WHEN
The system processes the hold code
THEN
The hold status flag is set to true and hold processing continues
Context: A hold status code has been identified
GIVEN
A hold status code has been identified
Applied to: Border or Destination Hold?
WHEN
The system determines the hold location
THEN
The hold is classified as either border hold or destination hold based on the specific code value
Context: A hold code has been classified as a border hold
GIVEN
A hold code has been classified as a border hold
Applied to: Set Border Hold Flag
WHEN
The system processes the border hold classification
THEN
The border hold flag is set to true
Context: A hold code has been classified as a destination hold
GIVEN
A hold code has been classified as a destination hold
Applied to: Set Destination Hold Flag
WHEN
The system processes the destination hold classification
THEN
The destination hold flag is set to true
Context: A release disposition code has been identified
GIVEN
A release disposition code has been identified
Applied to: Set Release Status Flag
WHEN
The system processes the release code
THEN
The release status flag is set to true
Context: A release status code with associated quantity exists
GIVEN
A release status code with associated quantity exists
Applied to: Calculate Released Quantity
WHEN
The system processes the release quantity
THEN
The released quantity is added to the total released quantity counter
Context: A PTT disposition code has been identified
GIVEN
A PTT disposition code has been identified
Applied to: Set PTT Flag
WHEN
The system processes the PTT code
THEN
The PTT flag is set to true
Context: A PTT status code with associated quantity exists
GIVEN
A PTT status code with associated quantity exists
Applied to: Validate PTT Quantity
WHEN
The system validates PTT quantity requirements
THEN
The PTT quantity is verified against business rules and thresholds
Context: A proceed disposition code has been identified
GIVEN
A proceed disposition code has been identified
Applied to: Set Proceed Flag
WHEN
The system processes the proceed code
THEN
The proceed flag is set to true
Context: A proceed status code has been processed
GIVEN
A proceed status code has been processed
Applied to: Set Border Arrival Date
WHEN
The system sets border arrival information
THEN
The border arrival date is recorded from the status code date information
Context: An arrival disposition code has been identified
GIVEN
An arrival disposition code has been identified
Applied to: Set Arrival Flag
WHEN
The system processes the arrival code
THEN
The arrival flag is set to true
Context: An export disposition code has been identified
GIVEN
An export disposition code has been identified
Applied to: Set Export Flag
WHEN
The system processes the export code
THEN
The export flag is set to true
Context: An FDA hold disposition code has been identified
GIVEN
An FDA hold disposition code has been identified
Applied to: Set FDA Hold Flag at Destination
WHEN
The system processes the FDA hold code
THEN
The FDA hold flag is set to true for destination location
Context: Current array element processing is complete
GIVEN
Current array element processing is complete
Applied to: Continue Array Scan
WHEN
The system continues array scanning
THEN
Processing moves to the next array element for analysis
Context: Current array element has been processed
GIVEN
Current array element has been processed
Applied to: More Array Elements?
WHEN
The system checks for remaining elements
THEN
If more elements exist, continue scanning, otherwise proceed to final status determination
Context: All status array elements have been analyzed and flags are set
GIVEN
All status array elements have been analyzed and flags are set
Applied to: Determine Final Cargo State
WHEN
The system determines final cargo state
THEN
The cargo state is determined based on the combination of status flags and business rules
Context: Final cargo state analysis is complete
GIVEN
Final cargo state analysis is complete
Applied to: Manual Release Required?
WHEN
The system checks for manual release requirements
THEN
If manual release conditions are met, set manual release flag to true
Context: Manual release conditions have been identified
GIVEN
Manual release conditions have been identified
Applied to: Set Manual Release Flag
WHEN
The system processes manual release requirements
THEN
The manual release flag is set to true
Context: Release quantities and total quantities are available
GIVEN
Release quantities and total quantities are available
Applied to: Partial Release? & Full Release?
WHEN
The system compares released quantity to total quantity
THEN
If released quantity is less than total quantity, partial release status is identified AND If released quantity equals or exceeds total quantity, full release status is identified
Context: Partial release status has been identified
GIVEN
Partial release status has been identified
Applied to: Set Hold on Piece Count Status
WHEN
The system processes partial release conditions
THEN
Hold on piece count status is set to indicate remaining quantity is held
Context: Full release status has been confirmed
GIVEN
Full release status has been confirmed
Applied to: Clear Destination Index
WHEN
The system processes full release conditions
THEN
The destination index is cleared to reflect released status
Context: Cargo status transition analysis is complete
GIVEN
Cargo status transition analysis is complete
Applied to: Unrelease Detected?
WHEN
The system checks for unrelease conditions
THEN
If previous release status has been removed, unrelease condition is detected
Context: Unrelease condition has been detected
GIVEN
Unrelease condition has been detected
Applied to: Set Unrelease Notification Flag
WHEN
The system processes unrelease conditions
THEN
The unrelease notification flag is set to trigger appropriate notifications
Context: Hold status flags have been set during analysis
GIVEN
Hold status flags have been set during analysis
Applied to: Determine Hold Location
WHEN
The system determines hold location
THEN
Hold location is classified as border, destination, or both based on the active hold flags
Context: Cargo status analysis is nearing completion
GIVEN
Cargo status analysis is nearing completion
Applied to: Age Calculation Required?
WHEN
The system checks age calculation requirements
THEN
If business rules require age calculation, proceed with Julian date calculation
Context: Age calculation is required and cargo dates are available
GIVEN
Age calculation is required and cargo dates are available
Applied to: Calculate Cargo Age using Julian Date
WHEN
The system calculates cargo age
THEN
Cargo age is computed using Julian date conversion and current date comparison
Context: All status analysis and calculations are complete
GIVEN
All status analysis and calculations are complete
Applied to: Set Final Status Flags
WHEN
The system sets final status flags
THEN
All relevant status flags are set to reflect the final cargo state
Context: All status analysis steps have been completed
GIVEN
All status analysis steps have been completed
Applied to: Status Transition Analysis Complete
WHEN
The system finalizes status transition analysis
THEN
The analysis is marked complete and results are available for further processing
R-GCX016-cbl-03001 (+13) File: GCX016.cbl Complex Cargo Status Logic Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Complex Cargo Status Logic Processing':
  • Context - a cargo record is being processed for status determination:
    For Clear Destination Index:
    When the manual release flag is set to true, then the system clears the destination index and initiates canadian manifest coordination processing.
  • Context - a cargo record is being evaluated for status assignment:
    For Set FDA Hold Status with Code 66:
    When fda hold flag is present at destination location, then the system sets cargo status to fda hold with status code 66.
  • Context - a cargo record has existing ptt status:
    For Save Current PTT Status:
    When complex status logic processing is initiated, then the system saves and preserves the current ptt status for continued processing.
  • Context - a cargo record with total quantity and released quantity values:
    For Set Hold on Piece Counts Status:
    When the released quantity is less than the total quantity, then the system sets hold status on piece counts for the unreleased portion.
  • Context - a cargo record with released quantity equal to total quantity:
    For Process Full Release:
    When full release conditions are met, then the system processes full release and clears the destination index.
  • Context - a cargo record being evaluated for proceed status:
    For Set Proceed Status:
    When proceed status flag is present in the cargo evaluation, then the system sets proceed status and updates the border arrival date.
  • Context - a cargo record with hold status present:
    For Set Border Hold Status:
    When the hold location is determined to be at the border, then the system assigns border hold status to the cargo.
    For Set Destination Hold Status:
    When the hold location is determined to be at the destination (not border), then the system assigns destination hold status to the cargo.
  • Context - a cargo record being processed for arrival status:
    For Set Arrival Status:
    When arrival status flag is present in the evaluation, then the system sets arrival status and clears the destination index.
  • Context - a cargo record being evaluated for export status:
    For Set Export Status:
    When export status flag is present in the cargo evaluation, then the system sets export status and clears the destination index.
  • Context - a cargo record with cancel release status detected:
    For Process Unrelease Scenario:
    When unrelease scenario processing is required, then the system processes the unrelease scenario and generates unrelease notifications.
  • Context - a cargo record requiring age calculation:
    For Calculate Cargo Age using Julian Date:
    When age calculation is required for cargo processing, then the system calculates cargo age using julian date conversion methods.
  • Context - a cargo record that has completed age calculation:
    For Re-establish Destination Index:
    When destination index re-establishment is required, then the system re-establishes the destination index for the cargo record.
  • Context - a cargo record that has undergone status changes:
    For Update Cargo Record in Database:
    When status changes have been made to the cargo record, then the system updates the cargo record in the database with the new status information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for status determination
GIVEN
A cargo record is being processed for status determination
Applied to: Clear Destination Index
WHEN
The manual release flag is set to true
THEN
The system clears the destination index and initiates Canadian manifest coordination processing
Context: A cargo record is being evaluated for status assignment
GIVEN
A cargo record is being evaluated for status assignment
Applied to: Set FDA Hold Status with Code 66
WHEN
FDA hold flag is present at destination location
THEN
The system sets cargo status to FDA hold with status code 66
Context: A cargo record has existing PTT status
GIVEN
A cargo record has existing PTT status
Applied to: Save Current PTT Status
WHEN
Complex status logic processing is initiated
THEN
The system saves and preserves the current PTT status for continued processing
Context: A cargo record with total quantity and released quantity values
GIVEN
A cargo record with total quantity and released quantity values
Applied to: Set Hold on Piece Counts Status
WHEN
The released quantity is less than the total quantity
THEN
The system sets hold status on piece counts for the unreleased portion
Context: A cargo record with released quantity equal to total quantity
GIVEN
A cargo record with released quantity equal to total quantity
Applied to: Process Full Release
WHEN
Full release conditions are met
THEN
The system processes full release and clears the destination index
Context: A cargo record being evaluated for proceed status
GIVEN
A cargo record being evaluated for proceed status
Applied to: Set Proceed Status
WHEN
Proceed status flag is present in the cargo evaluation
THEN
The system sets proceed status and updates the border arrival date
Context: A cargo record with hold status present
GIVEN
A cargo record with hold status present
Applied to: Set Border Hold Status
WHEN
The hold location is determined to be at the border
THEN
The system assigns border hold status to the cargo
Applied to: Set Destination Hold Status
WHEN
The hold location is determined to be at the destination (not border)
THEN
The system assigns destination hold status to the cargo
Context: A cargo record being processed for arrival status
GIVEN
A cargo record being processed for arrival status
Applied to: Set Arrival Status
WHEN
Arrival status flag is present in the evaluation
THEN
The system sets arrival status and clears the destination index
Context: A cargo record being evaluated for export status
GIVEN
A cargo record being evaluated for export status
Applied to: Set Export Status
WHEN
Export status flag is present in the cargo evaluation
THEN
The system sets export status and clears the destination index
Context: A cargo record with cancel release status detected
GIVEN
A cargo record with cancel release status detected
Applied to: Process Unrelease Scenario
WHEN
Unrelease scenario processing is required
THEN
The system processes the unrelease scenario and generates unrelease notifications
Context: A cargo record requiring age calculation
GIVEN
A cargo record requiring age calculation
Applied to: Calculate Cargo Age using Julian Date
WHEN
Age calculation is required for cargo processing
THEN
The system calculates cargo age using Julian date conversion methods
Context: A cargo record that has completed age calculation
GIVEN
A cargo record that has completed age calculation
Applied to: Re-establish Destination Index
WHEN
Destination index re-establishment is required
THEN
The system re-establishes the destination index for the cargo record
Context: A cargo record that has undergone status changes
GIVEN
A cargo record that has undergone status changes
Applied to: Update Cargo Record in Database
WHEN
Status changes have been made to the cargo record
THEN
The system updates the cargo record in the database with the new status information
R-GCX016-cbl-03015 (+15) File: GCX016.cbl PTT Status Preservation Logic Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PTT Status Preservation Logic':
  • Context - a cargo record is being processed for status updates:
    For Check Current Cargo Status:
    When the system checks the current cargo status, then the system identifies whether ptt status is present and requires preservation.
  • Context - a cargo record with current status information:
    For PTT Status Present?:
    When the system evaluates if ptt status is present in the cargo status, then the system sets a flag indicating ptt status presence and proceeds to either save ptt status or continue with normal processing.
  • Context - a cargo record with existing ptt status:
    For Save Current PTT Status:
    When the system needs to process new disposition codes that might affect ptt status, then the system saves the current ptt status information to temporary storage for potential restoration.
  • Context - a cargo record with ptt status and associated quantity information:
    For Store PTT Quantity Information:
    When the system prepares to process disposition codes that may affect quantities, then the system stores ptt quantity information including release quantities and quantity thresholds for later validation.
  • Context - a cargo record with saved ptt status information and new disposition codes to process:
    For Process New Disposition Codes:
    When the system processes the new disposition codes, then the system applies the disposition codes and updates the cargo status array while preserving the ability to restore ptt status.
  • Context - a cargo record with processed disposition codes and updated status array:
    For Analyze Status Array Changes:
    When the system analyzes the changes made to the status array, then the system determines whether the ptt status is still valid based on the new status conditions.
  • Context - a cargo record with processed disposition codes and analyzed status changes:
    For PTT Still Valid?:
    When the system evaluates whether ptt status remains valid after the changes, then the system decides to either continue with ptt status validation or clear ptt status based on validity conditions.
  • Context - a cargo record with valid ptt status after disposition code processing:
    For Quantity Validation Required?:
    When the system evaluates if quantity validation is needed for ptt status maintenance, then the system either proceeds with quantity validation or directly restores ptt status based on validation requirements.
  • Context - a cargo record requiring ptt quantity validation with stored quantity information:
    For Validate PTT Quantities:
    When the system validates ptt quantities against current cargo quantities and thresholds, then the system determines if quantities match the ptt requirements for status maintenance.
  • Context - a cargo record with validated ptt quantities:
    For Quantities Match?:
    When the system compares current quantities with ptt requirements, then the system decides to either maintain ptt status, adjust ptt for partial release, or proceed with standard ptt restoration.
  • Context - a cargo record with validated quantities that match ptt requirements:
    For Maintain PTT Status:
    When the system determines ptt status should be maintained without changes, then the system preserves the current ptt status and proceeds with restoration process.
  • Context - a cargo record with quantities that don't fully match ptt requirements due to partial releases:
    For Adjust PTT for Partial Release:
    When the system determines ptt status should be adjusted rather than cleared, then the system modifies ptt quantities and status to reflect partial release conditions while maintaining ptt designation.
  • Context - a cargo record with saved ptt status information and completed validation process:
    For Restore Saved PTT Status:
    When the system restores the ptt status to the cargo record, then the system applies the saved or adjusted ptt status information to the current cargo status.
  • Context - a cargo record with restored ptt status:
    For Update PTT Quantity:
    When the system updates ptt quantity information, then the system applies the final ptt quantity values including any adjustments made during the preservation process.
  • Context - a cargo record where ptt status is determined to be invalid after disposition code processing:
    For Clear PTT Status:
    When the system clears ptt status from the cargo record, then the system removes all ptt-related status information and quantities from the cargo record.
  • Context - a cargo record with completed ptt status preservation processing:
    For Update Cargo Record:
    When the system updates the cargo record with final status information, then the system commits the final cargo status including ptt status preservation results to the cargo record.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for status updates
GIVEN
A cargo record is being processed for status updates
Applied to: Check Current Cargo Status
WHEN
The system checks the current cargo status
THEN
The system identifies whether PTT status is present and requires preservation
Context: A cargo record with current status information
GIVEN
A cargo record with current status information
Applied to: PTT Status Present?
WHEN
The system evaluates if PTT status is present in the cargo status
THEN
The system sets a flag indicating PTT status presence and proceeds to either save PTT status or continue with normal processing
Context: A cargo record with existing PTT status
GIVEN
A cargo record with existing PTT status
Applied to: Save Current PTT Status
WHEN
The system needs to process new disposition codes that might affect PTT status
THEN
The system saves the current PTT status information to temporary storage for potential restoration
Context: A cargo record with PTT status and associated quantity information
GIVEN
A cargo record with PTT status and associated quantity information
Applied to: Store PTT Quantity Information
WHEN
The system prepares to process disposition codes that may affect quantities
THEN
The system stores PTT quantity information including release quantities and quantity thresholds for later validation
Context: A cargo record with saved PTT status information and new disposition codes to process
GIVEN
A cargo record with saved PTT status information and new disposition codes to process
Applied to: Process New Disposition Codes
WHEN
The system processes the new disposition codes
THEN
The system applies the disposition codes and updates the cargo status array while preserving the ability to restore PTT status
Context: A cargo record with processed disposition codes and updated status array
GIVEN
A cargo record with processed disposition codes and updated status array
Applied to: Analyze Status Array Changes
WHEN
The system analyzes the changes made to the status array
THEN
The system determines whether the PTT status is still valid based on the new status conditions
Context: A cargo record with processed disposition codes and analyzed status changes
GIVEN
A cargo record with processed disposition codes and analyzed status changes
Applied to: PTT Still Valid?
WHEN
The system evaluates whether PTT status remains valid after the changes
THEN
The system decides to either continue with PTT status validation or clear PTT status based on validity conditions
Context: A cargo record with valid PTT status after disposition code processing
GIVEN
A cargo record with valid PTT status after disposition code processing
Applied to: Quantity Validation Required?
WHEN
The system evaluates if quantity validation is needed for PTT status maintenance
THEN
The system either proceeds with quantity validation or directly restores PTT status based on validation requirements
Context: A cargo record requiring PTT quantity validation with stored quantity information
GIVEN
A cargo record requiring PTT quantity validation with stored quantity information
Applied to: Validate PTT Quantities
WHEN
The system validates PTT quantities against current cargo quantities and thresholds
THEN
The system determines if quantities match the PTT requirements for status maintenance
Context: A cargo record with validated PTT quantities
GIVEN
A cargo record with validated PTT quantities
Applied to: Quantities Match?
WHEN
The system compares current quantities with PTT requirements
THEN
The system decides to either maintain PTT status, adjust PTT for partial release, or proceed with standard PTT restoration
Context: A cargo record with validated quantities that match PTT requirements
GIVEN
A cargo record with validated quantities that match PTT requirements
Applied to: Maintain PTT Status
WHEN
The system determines PTT status should be maintained without changes
THEN
The system preserves the current PTT status and proceeds with restoration process
Context: A cargo record with quantities that don't fully match PTT requirements due to partial releases
GIVEN
A cargo record with quantities that don't fully match PTT requirements due to partial releases
Applied to: Adjust PTT for Partial Release
WHEN
The system determines PTT status should be adjusted rather than cleared
THEN
The system modifies PTT quantities and status to reflect partial release conditions while maintaining PTT designation
Context: A cargo record with saved PTT status information and completed validation process
GIVEN
A cargo record with saved PTT status information and completed validation process
Applied to: Restore Saved PTT Status
WHEN
The system restores the PTT status to the cargo record
THEN
The system applies the saved or adjusted PTT status information to the current cargo status
Context: A cargo record with restored PTT status
GIVEN
A cargo record with restored PTT status
Applied to: Update PTT Quantity
WHEN
The system updates PTT quantity information
THEN
The system applies the final PTT quantity values including any adjustments made during the preservation process
Context: A cargo record where PTT status is determined to be invalid after disposition code processing
GIVEN
A cargo record where PTT status is determined to be invalid after disposition code processing
Applied to: Clear PTT Status
WHEN
The system clears PTT status from the cargo record
THEN
The system removes all PTT-related status information and quantities from the cargo record
Context: A cargo record with completed PTT status preservation processing
GIVEN
A cargo record with completed PTT status preservation processing
Applied to: Update Cargo Record
WHEN
The system updates the cargo record with final status information
THEN
The system commits the final cargo status including PTT status preservation results to the cargo record
R-GCX016-cbl-03031 (+12) File: GCX016.cbl Partial Release Status Management Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Partial Release Status Management':
  • Context - a cargo record exists with total quantity and released quantity values:
    For Check Released Quantity vs Total Quantity:
    When the system compares released quantity against total quantity, then the system identifies if cargo requires partial release processing when released quantity is less than total quantity.
  • Context - cargo has been identified as partially released with released quantity less than total quantity:
    For Calculate Remaining Quantity:
    When the system calculates remaining quantity, then the remaining quantity equals total quantity minus released quantity.
  • Context - cargo has remaining unreleased quantity after partial release:
    For Set Hold on Piece Counts Status:
    When the system processes partial release status, then the system sets hold on piece counts status (holdpcs) to indicate partial hold condition.
  • Context - cargo has been determined to be in partial release state with hold on piece counts:
    For Update Cargo Status to Partial Release:
    When the system updates cargo status, then the cargo status is set to partial release with appropriate status description.
  • Context - cargo has existing ptt status and is being processed for partial release:
    For Preserve PTT Status if Exists:
    When the system updates cargo status for partial release, then the existing ptt status is preserved and not overwritten by partial release processing.
  • Context - cargo is in partial release state with calculated remaining quantities:
    For Update Status Array with Partial Release Flag:
    When the system updates the status array, then the status array includes partial release flags, hold indicators, and quantity information.
  • Context - cargo is in partial release state requiring hold location assignment:
    For Set Hold Location - Border or Destination:
    When the system determines hold location, then the hold location is set to either border or destination based on cargo routing and processing requirements.
  • Context - cargo is being processed for partial release with determined hold location:
    For Destination Index Required?:
    When the system evaluates destination index requirements, then the system determines whether to maintain or clear destination index based on cargo status and routing needs.
  • Context - cargo in partial release state requires continued destination processing:
    For Maintain Destination Index:
    When the system processes destination index requirements, then the destination index is maintained to ensure proper routing and processing continuation.
  • Context - cargo in partial release state requires border-only processing:
    For Clear Destination Index:
    When the system processes destination index requirements, then the destination index is cleared to prevent destination processing.
  • Context - all partial release processing has been completed with status determinations:
    For Update Cargo Record with Partial Status:
    When the system updates the cargo record, then the cargo record is updated with partial release status, quantities, hold information, and destination index settings.
  • Context - cargo record has been updated with partial release status:
    For Generate Partial Release Notification:
    When the system generates notifications, then appropriate notifications are sent to brokers, customs, and other stakeholders regarding partial release and remaining holds.
  • Context - partial release processing has been completed with notifications sent:
    For Log Partial Release Transaction:
    When the system logs the transaction, then transaction log entries are created with partial release details, quantities, status changes, and processing timestamps.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with total quantity and released quantity values
GIVEN
A cargo record exists with total quantity and released quantity values
Applied to: Check Released Quantity vs Total Quantity
WHEN
The system compares released quantity against total quantity
THEN
The system identifies if cargo requires partial release processing when released quantity is less than total quantity
Context: Cargo has been identified as partially released with released quantity less than total quantity
GIVEN
Cargo has been identified as partially released with released quantity less than total quantity
Applied to: Calculate Remaining Quantity
WHEN
The system calculates remaining quantity
THEN
The remaining quantity equals total quantity minus released quantity
Context: Cargo has remaining unreleased quantity after partial release
GIVEN
Cargo has remaining unreleased quantity after partial release
Applied to: Set Hold on Piece Counts Status
WHEN
The system processes partial release status
THEN
The system sets hold on piece counts status (HOLDPCS) to indicate partial hold condition
Context: Cargo has been determined to be in partial release state with hold on piece counts
GIVEN
Cargo has been determined to be in partial release state with hold on piece counts
Applied to: Update Cargo Status to Partial Release
WHEN
The system updates cargo status
THEN
The cargo status is set to partial release with appropriate status description
Context: Cargo has existing PTT status and is being processed for partial release
GIVEN
Cargo has existing PTT status and is being processed for partial release
Applied to: Preserve PTT Status if Exists
WHEN
The system updates cargo status for partial release
THEN
The existing PTT status is preserved and not overwritten by partial release processing
Context: Cargo is in partial release state with calculated remaining quantities
GIVEN
Cargo is in partial release state with calculated remaining quantities
Applied to: Update Status Array with Partial Release Flag
WHEN
The system updates the status array
THEN
The status array includes partial release flags, hold indicators, and quantity information
Context: Cargo is in partial release state requiring hold location assignment
GIVEN
Cargo is in partial release state requiring hold location assignment
Applied to: Set Hold Location - Border or Destination
WHEN
The system determines hold location
THEN
The hold location is set to either border or destination based on cargo routing and processing requirements
Context: Cargo is being processed for partial release with determined hold location
GIVEN
Cargo is being processed for partial release with determined hold location
Applied to: Destination Index Required?
WHEN
The system evaluates destination index requirements
THEN
The system determines whether to maintain or clear destination index based on cargo status and routing needs
Context: Cargo in partial release state requires continued destination processing
GIVEN
Cargo in partial release state requires continued destination processing
Applied to: Maintain Destination Index
WHEN
The system processes destination index requirements
THEN
The destination index is maintained to ensure proper routing and processing continuation
Context: Cargo in partial release state requires border-only processing
GIVEN
Cargo in partial release state requires border-only processing
Applied to: Clear Destination Index
WHEN
The system processes destination index requirements
THEN
The destination index is cleared to prevent destination processing
Context: All partial release processing has been completed with status determinations
GIVEN
All partial release processing has been completed with status determinations
Applied to: Update Cargo Record with Partial Status
WHEN
The system updates the cargo record
THEN
The cargo record is updated with partial release status, quantities, hold information, and destination index settings
Context: Cargo record has been updated with partial release status
GIVEN
Cargo record has been updated with partial release status
Applied to: Generate Partial Release Notification
WHEN
The system generates notifications
THEN
Appropriate notifications are sent to brokers, customs, and other stakeholders regarding partial release and remaining holds
Context: Partial release processing has been completed with notifications sent
GIVEN
Partial release processing has been completed with notifications sent
Applied to: Log Partial Release Transaction
WHEN
The system logs the transaction
THEN
Transaction log entries are created with partial release details, quantities, status changes, and processing timestamps
R-GCX016-cbl-03044 (+17) File: GCX016.cbl Cargo Unrelease Processing Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Unrelease Processing':
  • Context - a cargo record exists in the system with historical release status:
    For Previously Released Cargo Detected:
    When the system processes a new disposition code message for this cargo, then the system detects that this cargo was previously released and flags it for unrelease processing.
  • Context - a cargo record has a populated status array with current disposition codes:
    For Check Current Status Array:
    When the system analyzes the status array for release and hold conditions, then the system identifies current status flags including release quantities, hold statuses, and disposition codes.
  • Context - a disposition code is received in an x4 segment message:
    For Analyze Disposition Codes:
    When the system looks up the disposition code in the dc table to determine its action type, then the system identifies whether the code requires removal of release status, addition of hold status, or other status changes.
  • Context - a disposition code has been analyzed and its action type determined:
    For Unrelease Condition Found?:
    When the disposition code action type is 'dc remove+release', 'dc removal', or adds a hold status to previously released cargo, then the system determines that unrelease processing is required and proceeds with status change logic.
  • Context - cargo currently has release status flags set and release quantities greater than zero:
    For Detect Status Change from Released to Unreleased:
    When a disposition code will remove release status or add hold conditions that override the release, then the system detects this as an unrelease condition and prepares to update the cargo status accordingly.
  • Context - cargo is about to be unreleased and current status needs to be preserved:
    For Save Current Cargo Status:
    When the system saves the current cargo status description and release quantities, then the previous status information is stored for comparison and logging purposes.
  • Context - an unrelease disposition code needs to be added to the cargo status array:
    For Update Status Array with Unrelease Code:
    When the system processes the disposition code and determines its placement in the status array, then the new disposition code is added to the status array with appropriate sequence and occurrence numbers.
  • Context - cargo has existing release status flags and release quantities set:
    For Remove Release Status Flags:
    When an unrelease disposition code requires removal of release status, then the system clears release flags, resets release quantities, and removes release-related status codes from the array.
  • Context - cargo is being unreleased and may require hold status to be applied:
    For Restore Hold Status if Applicable:
    When the disposition code indicates a hold condition or the cargo's previous state included hold requirements, then the system applies the appropriate hold status based on the cargo's location and disposition requirements.
  • Context - cargo requires hold status as part of unrelease processing:
    For Border or Destination Hold?:
    When the system evaluates the cargo's current location, destination, and disposition code requirements, then the system determines whether to apply border hold, destination hold, or both based on the cargo's routing and customs requirements.
  • Context - unreleased cargo requires border hold status:
    For Set Border Hold Status:
    When the cargo is at or destined for border processing location, then the system sets border hold status flags and updates the cargo status to reflect border hold conditions.
  • Context - unreleased cargo requires destination hold status:
    For Set Destination Hold Status:
    When the cargo is at or destined for destination processing location, then the system sets destination hold status flags and updates the cargo status to reflect destination hold conditions.
  • Context - cargo is being unreleased and had destination information cleared during previous release:
    For Re-establish Destination Index:
    When the cargo requires destination hold or routing information to be restored, then the system re-establishes the destination index and routing information from the cargo's sd segment data.
  • Context - cargo has been successfully unreleased and status updated:
    For Generate Unrelease Notification Message:
    When the system prepares notification messages for the unrelease action, then the system generates merlin messages containing cargo details, unrelease reason, and new status information for distribution to appropriate users.
  • Context - cargo status has been changed to unreleased with updated status array and flags:
    For Update Cargo Record in Database:
    When the system commits the cargo record changes to the database, then the cargo record is updated with new status, status description, hold flags, and cleared release quantities.
  • Context - cargo has been unreleased and database updated successfully:
    For Call Integration Services for Status Change:
    When the cargo requires notification to external systems for equipment or container processing, then the system calls gcciis integration services to notify external systems of the status change from released to unreleased.
  • Context - cargo unrelease processing has been completed successfully:
    For Log Unrelease Transaction:
    When the system logs the transaction details for audit purposes, then the system calls gct1051e to log the unrelease transaction with cargo details, disposition codes, and status changes.
  • Context - unrelease notification message has been generated:
    For Route Unrelease Message to Appropriate Users:
    When the system determines the appropriate recipients based on cargo location and broker information, then the system routes the unrelease message to station-specific merlin ids, broker notification systems, and error handling destinations as appropriate.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with historical release status
GIVEN
A cargo record exists in the system with historical release status
Applied to: Previously Released Cargo Detected
WHEN
The system processes a new disposition code message for this cargo
THEN
The system detects that this cargo was previously released and flags it for unrelease processing
Context: A cargo record has a populated status array with current disposition codes
GIVEN
A cargo record has a populated status array with current disposition codes
Applied to: Check Current Status Array
WHEN
The system analyzes the status array for release and hold conditions
THEN
The system identifies current status flags including release quantities, hold statuses, and disposition codes
Context: A disposition code is received in an X4 segment message
GIVEN
A disposition code is received in an X4 segment message
Applied to: Analyze Disposition Codes
WHEN
The system looks up the disposition code in the DC table to determine its action type
THEN
The system identifies whether the code requires removal of release status, addition of hold status, or other status changes
Context: A disposition code has been analyzed and its action type determined
GIVEN
A disposition code has been analyzed and its action type determined
Applied to: Unrelease Condition Found?
WHEN
The disposition code action type is 'DC Remove+Release', 'DC Removal', or adds a hold status to previously released cargo
THEN
The system determines that unrelease processing is required and proceeds with status change logic
Context: Cargo currently has release status flags set and release quantities greater than zero
GIVEN
Cargo currently has release status flags set and release quantities greater than zero
Applied to: Detect Status Change from Released to Unreleased
WHEN
A disposition code will remove release status or add hold conditions that override the release
THEN
The system detects this as an unrelease condition and prepares to update the cargo status accordingly
Context: Cargo is about to be unreleased and current status needs to be preserved
GIVEN
Cargo is about to be unreleased and current status needs to be preserved
Applied to: Save Current Cargo Status
WHEN
The system saves the current cargo status description and release quantities
THEN
The previous status information is stored for comparison and logging purposes
Context: An unrelease disposition code needs to be added to the cargo status array
GIVEN
An unrelease disposition code needs to be added to the cargo status array
Applied to: Update Status Array with Unrelease Code
WHEN
The system processes the disposition code and determines its placement in the status array
THEN
The new disposition code is added to the status array with appropriate sequence and occurrence numbers
Context: Cargo has existing release status flags and release quantities set
GIVEN
Cargo has existing release status flags and release quantities set
Applied to: Remove Release Status Flags
WHEN
An unrelease disposition code requires removal of release status
THEN
The system clears release flags, resets release quantities, and removes release-related status codes from the array
Context: Cargo is being unreleased and may require hold status to be applied
GIVEN
Cargo is being unreleased and may require hold status to be applied
Applied to: Restore Hold Status if Applicable
WHEN
The disposition code indicates a hold condition or the cargo's previous state included hold requirements
THEN
The system applies the appropriate hold status based on the cargo's location and disposition requirements
Context: Cargo requires hold status as part of unrelease processing
GIVEN
Cargo requires hold status as part of unrelease processing
Applied to: Border or Destination Hold?
WHEN
The system evaluates the cargo's current location, destination, and disposition code requirements
THEN
The system determines whether to apply border hold, destination hold, or both based on the cargo's routing and customs requirements
Context: Unreleased cargo requires border hold status
GIVEN
Unreleased cargo requires border hold status
Applied to: Set Border Hold Status
WHEN
The cargo is at or destined for border processing location
THEN
The system sets border hold status flags and updates the cargo status to reflect border hold conditions
Context: Unreleased cargo requires destination hold status
GIVEN
Unreleased cargo requires destination hold status
Applied to: Set Destination Hold Status
WHEN
The cargo is at or destined for destination processing location
THEN
The system sets destination hold status flags and updates the cargo status to reflect destination hold conditions
Context: Cargo is being unreleased and had destination information cleared during previous release
GIVEN
Cargo is being unreleased and had destination information cleared during previous release
Applied to: Re-establish Destination Index
WHEN
The cargo requires destination hold or routing information to be restored
THEN
The system re-establishes the destination index and routing information from the cargo's SD segment data
Context: Cargo has been successfully unreleased and status updated
GIVEN
Cargo has been successfully unreleased and status updated
Applied to: Generate Unrelease Notification Message
WHEN
The system prepares notification messages for the unrelease action
THEN
The system generates Merlin messages containing cargo details, unrelease reason, and new status information for distribution to appropriate users
Context: Cargo status has been changed to unreleased with updated status array and flags
GIVEN
Cargo status has been changed to unreleased with updated status array and flags
Applied to: Update Cargo Record in Database
WHEN
The system commits the cargo record changes to the database
THEN
The cargo record is updated with new status, status description, hold flags, and cleared release quantities
Context: Cargo has been unreleased and database updated successfully
GIVEN
Cargo has been unreleased and database updated successfully
Applied to: Call Integration Services for Status Change
WHEN
The cargo requires notification to external systems for equipment or container processing
THEN
The system calls GCCIIS integration services to notify external systems of the status change from released to unreleased
Context: Cargo unrelease processing has been completed successfully
GIVEN
Cargo unrelease processing has been completed successfully
Applied to: Log Unrelease Transaction
WHEN
The system logs the transaction details for audit purposes
THEN
The system calls GCT1051E to log the unrelease transaction with cargo details, disposition codes, and status changes
Context: Unrelease notification message has been generated
GIVEN
Unrelease notification message has been generated
Applied to: Route Unrelease Message to Appropriate Users
WHEN
The system determines the appropriate recipients based on cargo location and broker information
THEN
The system routes the unrelease message to station-specific Merlin IDs, broker notification systems, and error handling destinations as appropriate
R-GCX016-cbl-03062 (+16) File: GCX016.cbl Canadian Manifest Cross Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Manifest Cross':
  • Context - a us cargo record exists in the system:
    For US Cargo Released?:
    When the system checks the cargo release status for cross-border coordination, then the system should proceed with canadian manifest processing only if the us cargo is in released status, otherwise skip cross-border coordination.
  • Context - a us cargo record is confirmed as released:
    For Get Equipment ID from US Cargo:
    When the system needs to identify the associated equipment for canadian manifest lookup, then the system should extract the equipment id from the us cargo record for cross-reference matching.
  • Context - an equipment id has been extracted from the us cargo record:
    For Search Canadian Cargo Database:
    When the system searches for corresponding canadian cargo records, then the system should query the canadian cargo database using the equipment id as the search key.
  • Context - canadian cargo database search has been initiated with equipment id:
    For Match by Equipment ID:
    When the system attempts to match records between us and canadian systems, then the system should identify matching records where the equipment id corresponds between us and canadian cargo.
  • Context - equipment id matching has been performed against canadian cargo database:
    For Canadian Cargo Found?:
    When the system evaluates the search results, then the system should determine if one or more canadian cargo records were found and proceed accordingly or skip cross-border coordination if no matches exist.
  • Context - canadian cargo records have been found for the equipment id:
    For Multiple Canadian Records?:
    When the system evaluates the number of matching records, then the system should process each canadian record individually if multiple records exist, or proceed with single record processing if only one record is found.
  • Context - multiple canadian cargo records have been identified for the same equipment id:
    For Process Each Canadian Record:
    When the system processes cross-border coordination, then the system should iterate through each canadian record and apply validation and coordination logic to each record separately.
  • Context - canadian cargo records have been identified for processing:
    For Validate Canadian Record Status:
    When the system validates record eligibility for cross-border coordination, then the system should verify that canadian records are in valid status and exclude any records that are deleted or in unusable status.
  • Context - canadian cargo records are being validated for cross-border coordination:
    For Exclude Deleted Records:
    When the system encounters records marked as deleted, then the system should exclude deleted records from further processing and continue with remaining valid records.
  • Context - canadian cargo records are being validated after deleted record exclusion:
    For Exclude Unusable Records:
    When the system encounters records in unusable status, then the system should exclude unusable records from cross-border coordination processing.
  • Context - canadian cargo record has passed deleted and unusable status checks:
    For Record Valid?:
    When the system performs final validity assessment, then the system should determine if the record is valid for cross-border coordination and proceed with coordination if valid, or skip to no match processing if invalid.
  • Context - a valid canadian cargo record has been identified for cross-border coordination:
    For Create Cross-Border Log Message:
    When the system creates audit documentation, then the system should generate a cross-border log message documenting the coordination between us and canadian cargo records.
  • Context - cross-border log message has been created for valid canadian cargo:
    For Update Canadian CCN Status:
    When the system updates canadian cargo status, then the system should update the canadian ccn status to reflect the cross-border coordination with us cargo release.
  • Context - canadian ccn status has been updated for cross-border coordination:
    For Coordinate Release Status:
    When the system coordinates release status between systems, then the system should ensure release status consistency between us and canadian cargo records for the same equipment.
  • Context - release status coordination has been completed between us and canadian systems:
    For Generate Audit Trail:
    When the system generates audit documentation, then the system should create a complete audit trail documenting all cross-border coordination activities for compliance and tracking purposes.
  • Context - equipment id search in canadian cargo database yields no results or all records are invalid:
    For No Canadian Match Found:
    When the system determines no valid canadian matches exist, then the system should proceed to skip cross-border coordination and complete processing without canadian cargo updates.
  • Context - us cargo is not in released status or no valid canadian cargo matches are found:
    For Skip Cross-Border Coordination:
    When the system determines cross-border coordination is not applicable, then the system should skip all cross-border coordination activities and proceed to completion.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo record exists in the system
GIVEN
A US cargo record exists in the system
Applied to: US Cargo Released?
WHEN
The system checks the cargo release status for cross-border coordination
THEN
The system should proceed with Canadian manifest processing only if the US cargo is in released status, otherwise skip cross-border coordination
Context: A US cargo record is confirmed as released
GIVEN
A US cargo record is confirmed as released
Applied to: Get Equipment ID from US Cargo
WHEN
The system needs to identify the associated equipment for Canadian manifest lookup
THEN
The system should extract the equipment ID from the US cargo record for cross-reference matching
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
WHEN
The system searches for corresponding Canadian cargo records
THEN
The system should query the Canadian cargo database using the equipment ID as the search key
Context: Canadian cargo database search has been initiated with equipment ID
GIVEN
Canadian cargo database search has been initiated with equipment ID
Applied to: Match by Equipment ID
WHEN
The system attempts to match records between US and Canadian systems
THEN
The system should identify matching records where the equipment ID corresponds between US and Canadian cargo
Context: Equipment ID matching has been performed against Canadian cargo database
GIVEN
Equipment ID matching has been performed against Canadian cargo database
Applied to: Canadian Cargo Found?
WHEN
The system evaluates the search results
THEN
The system should determine if one or more Canadian cargo records were found and proceed accordingly or skip cross-border coordination if no matches exist
Context: Canadian cargo records have been found for the equipment ID
GIVEN
Canadian cargo records have been found for the equipment ID
Applied to: Multiple Canadian Records?
WHEN
The system evaluates the number of matching records
THEN
The system should process each Canadian record individually if multiple records exist, or proceed with single record processing if only one record is found
Context: Multiple Canadian cargo records have been identified for the same equipment ID
GIVEN
Multiple Canadian cargo records have been identified for the same equipment ID
Applied to: Process Each Canadian Record
WHEN
The system processes cross-border coordination
THEN
The system should iterate through each Canadian record and apply validation and coordination logic to each record separately
Context: Canadian cargo records have been identified for processing
GIVEN
Canadian cargo records have been identified for processing
Applied to: Validate Canadian Record Status
WHEN
The system validates record eligibility for cross-border coordination
THEN
The system should verify that Canadian records are in valid status and exclude any records that are deleted or in unusable status
Context: Canadian cargo records are being validated for cross-border coordination
GIVEN
Canadian cargo records are being validated for cross-border coordination
Applied to: Exclude Deleted Records
WHEN
The system encounters records marked as deleted
THEN
The system should exclude deleted records from further processing and continue with remaining valid records
Context: Canadian cargo records are being validated after deleted record exclusion
GIVEN
Canadian cargo records are being validated after deleted record exclusion
Applied to: Exclude Unusable Records
WHEN
The system encounters records in unusable status
THEN
The system should exclude unusable records from cross-border coordination processing
Context: Canadian cargo record has passed deleted and unusable status checks
GIVEN
Canadian cargo record has passed deleted and unusable status checks
Applied to: Record Valid?
WHEN
The system performs final validity assessment
THEN
The system should determine if the record is valid for cross-border coordination and proceed with coordination if valid, or skip to no match processing if invalid
Context: A valid Canadian cargo record has been identified for cross-border coordination
GIVEN
A valid Canadian cargo record has been identified for cross-border coordination
Applied to: Create Cross-Border Log Message
WHEN
The system creates audit documentation
THEN
The system should generate a cross-border log message documenting the coordination between US and Canadian cargo records
Context: Cross-border log message has been created for valid Canadian cargo
GIVEN
Cross-border log message has been created for valid Canadian cargo
Applied to: Update Canadian CCN Status
WHEN
The system updates Canadian cargo status
THEN
The system should update the Canadian CCN status to reflect the cross-border coordination with US cargo release
Context: Canadian CCN status has been updated for cross-border coordination
GIVEN
Canadian CCN status has been updated for cross-border coordination
Applied to: Coordinate Release Status
WHEN
The system coordinates release status between systems
THEN
The system should ensure release status consistency between US and Canadian cargo records for the same equipment
Context: Release status coordination has been completed between US and Canadian systems
GIVEN
Release status coordination has been completed between US and Canadian systems
Applied to: Generate Audit Trail
WHEN
The system generates audit documentation
THEN
The system should create a complete audit trail documenting all cross-border coordination activities for compliance and tracking purposes
Context: Equipment ID search in Canadian cargo database yields no results or all records are invalid
GIVEN
Equipment ID search in Canadian cargo database yields no results or all records are invalid
Applied to: No Canadian Match Found
WHEN
The system determines no valid Canadian matches exist
THEN
The system should proceed to skip cross-border coordination and complete processing without Canadian cargo updates
Context: US cargo is not in released status or no valid Canadian cargo matches are found
GIVEN
US cargo is not in released status or no valid Canadian cargo matches are found
Applied to: Skip Cross-Border Coordination
WHEN
The system determines cross-border coordination is not applicable
THEN
The system should skip all cross-border coordination activities and proceed to completion
R-GCX016-cbl-03079 (+20) File: GCX016.cbl Destination Index Re Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Index Re':
  • Context - a cargo record has an existing destination index and a cargo status change has been detected:
    For Clear Existing Destination Index:
    When the system processes the status change, then the existing destination index is cleared to prepare for re-establishment.
  • Context - a cargo status change has occurred:
    For Re-establishment Required?:
    When the system evaluates the status change type (arrival, export, bond change, or release), then the system determines if destination index re-establishment is required based on business rules for each status change type.
  • Context - destination index re-establishment is required and cargo status information is available:
    For Calculate New Index Parameters:
    When the system calculates new index parameters, then new destination index parameters are calculated based on current cargo status, location, and bond information.
  • Context - new destination index parameters are being calculated and border arrival information is available:
    For Set Border Arrival Date:
    When the system sets the border arrival date, then the border arrival date is established based on current cargo arrival status and timing information.
  • Context - new destination index parameters are being calculated and export status information is available:
    For Set Export Status:
    When the system sets the export status, then the export status is established based on current cargo export conditions and requirements.
  • Context - new destination index parameters are being calculated and bond information is available:
    For Update Bond Dates:
    When the system updates bond dates, then bond dates are updated based on current bond status and regulatory requirements.
  • Context - all destination index parameters have been calculated and validated:
    For Create New RT076 Destination Index:
    When the system creates the new rt076 destination index, then a new rt076 destination index record is created with the calculated parameters.
  • Context - a new rt076 destination index creation has been attempted:
    For Index Creation Successful?:
    When the system validates the creation result, then the system confirms whether the destination index was successfully created or if an error occurred.
  • Context - a new destination index has been successfully created:
    For Update Cargo Record with New Index:
    When the system updates the cargo record, then the cargo record is updated to reference the new destination index.
  • Context - a destination index has been re-established and cargo record has been updated:
    For Log Index Re-establishment:
    When the system logs the activity, then the destination index re-establishment activity is logged with relevant cargo and index information.
  • Context - destination index creation has failed:
    For Handle Index Creation Error:
    When the system handles the creation error, then the error is processed appropriately and the system continues with error handling procedures.
  • Context - a cargo status change has occurred and destination index re-establishment is not required:
    For Skip Index Re-establishment:
    When the system evaluates re-establishment requirements, then the destination index re-establishment process is skipped and processing continues.
  • Context - a cargo record exists with current destination index information:
    For Clear Existing Destination Index:
    When the cargo status has changed requiring destination index re-establishment, then the system clears the existing destination index from the cargo record.
  • Context - a cargo record is being processed for arrival status and the cargo has arrival processing requirements:
    For Set Arrival Date at Destination:
    When the system processes arrival status for the cargo, then the system sets the arrival date at destination based on the current processing date.
  • Context - a cargo record is being processed for export status and the cargo requires export processing:
    For Set Export Status Flag:
    When the system processes export status for the cargo, then the system sets the export status flag to indicate export processing is required.
  • Context - a cargo record has bond processing requirements and the bond information has changed:
    For Update Bond Start Date:
    When the system processes bond changes for the cargo, then the system updates the bond start date based on the new bond processing requirements.
  • Context - a cargo record requires destination index re-establishment and the index parameters have been calculated:
    For Re-establish RT076 Destination Index:
    When the system processes the destination index re-establishment, then the system calls b585-set-rt076-dest-index to re-establish the destination index with updated parameters.
  • Context - a cargo record has been processed for status changes and destination index has been re-established:
    For Cross-Border Coordination Needed?:
    When the system evaluates cross-border coordination requirements, then the system determines if canadian manifest coordination is needed based on cargo release status and processing type.
  • Context - cross-border coordination is required for a cargo record and the cargo has been released:
    For Find Matching Canadian Manifests:
    When the system searches for canadian manifest coordination, then the system calls b583-process-cdn-mfst to find and process matching canadian manifest records by waybill.
  • Context - matching canadian manifest records have been found and cross-border coordination is active:
    For Generate Canadian Log Messages:
    When the system processes canadian manifest coordination, then the system generates log messages to gcx105 system with cargo release information for canadian coordination.
  • Context - destination index has been re-established and any required cross-border coordination has been completed:
    For Update Cargo Record with New Index:
    When the system finalizes the cargo record update, then the system updates the cargo record with the new destination index information and any coordination results.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has an existing destination index AND a cargo status change has been detected
GIVEN
A cargo record has an existing destination index AND a cargo status change has been detected
Applied to: Clear Existing Destination Index
WHEN
The system processes the status change
THEN
The existing destination index is cleared to prepare for re-establishment
Context: A cargo status change has occurred
GIVEN
A cargo status change has occurred
Applied to: Re-establishment Required?
WHEN
The system evaluates the status change type (arrival, export, bond change, or release)
THEN
The system determines if destination index re-establishment is required based on business rules for each status change type
Context: Destination index re-establishment is required AND cargo status information is available
GIVEN
Destination index re-establishment is required AND cargo status information is available
Applied to: Calculate New Index Parameters
WHEN
The system calculates new index parameters
THEN
New destination index parameters are calculated based on current cargo status, location, and bond information
Context: New destination index parameters are being calculated AND border arrival information is available
GIVEN
New destination index parameters are being calculated AND border arrival information is available
Applied to: Set Border Arrival Date
WHEN
The system sets the border arrival date
THEN
The border arrival date is established based on current cargo arrival status and timing information
Context: New destination index parameters are being calculated AND export status information is available
GIVEN
New destination index parameters are being calculated AND export status information is available
Applied to: Set Export Status
WHEN
The system sets the export status
THEN
The export status is established based on current cargo export conditions and requirements
Context: New destination index parameters are being calculated AND bond information is available
GIVEN
New destination index parameters are being calculated AND bond information is available
Applied to: Update Bond Dates
WHEN
The system updates bond dates
THEN
Bond dates are updated based on current bond status and regulatory requirements
Context: All destination index parameters have been calculated AND validated
GIVEN
All destination index parameters have been calculated AND validated
Applied to: Create New RT076 Destination Index
WHEN
The system creates the new RT076 destination index
THEN
A new RT076 destination index record is created with the calculated parameters
Context: A new RT076 destination index creation has been attempted
GIVEN
A new RT076 destination index creation has been attempted
Applied to: Index Creation Successful?
WHEN
The system validates the creation result
THEN
The system confirms whether the destination index was successfully created or if an error occurred
Context: A new destination index has been successfully created
GIVEN
A new destination index has been successfully created
Applied to: Update Cargo Record with New Index
WHEN
The system updates the cargo record
THEN
The cargo record is updated to reference the new destination index
Context: A destination index has been re-established AND cargo record has been updated
GIVEN
A destination index has been re-established AND cargo record has been updated
Applied to: Log Index Re-establishment
WHEN
The system logs the activity
THEN
The destination index re-establishment activity is logged with relevant cargo and index information
Context: Destination index creation has failed
GIVEN
Destination index creation has failed
Applied to: Handle Index Creation Error
WHEN
The system handles the creation error
THEN
The error is processed appropriately and the system continues with error handling procedures
Context: A cargo status change has occurred AND destination index re-establishment is not required
GIVEN
A cargo status change has occurred AND destination index re-establishment is not required
Applied to: Skip Index Re-establishment
WHEN
The system evaluates re-establishment requirements
THEN
The destination index re-establishment process is skipped and processing continues
Context: A cargo record exists with current destination index information
GIVEN
A cargo record exists with current destination index information
Applied to: Clear Existing Destination Index
WHEN
The cargo status has changed requiring destination index re-establishment
THEN
The system clears the existing destination index from the cargo record
Context: A cargo record is being processed for arrival status AND the cargo has arrival processing requirements
GIVEN
A cargo record is being processed for arrival status AND the cargo has arrival processing requirements
Applied to: Set Arrival Date at Destination
WHEN
The system processes arrival status for the cargo
THEN
The system sets the arrival date at destination based on the current processing date
Context: A cargo record is being processed for export status AND the cargo requires export processing
GIVEN
A cargo record is being processed for export status AND the cargo requires export processing
Applied to: Set Export Status Flag
WHEN
The system processes export status for the cargo
THEN
The system sets the export status flag to indicate export processing is required
Context: A cargo record has bond processing requirements AND the bond information has changed
GIVEN
A cargo record has bond processing requirements AND the bond information has changed
Applied to: Update Bond Start Date
WHEN
The system processes bond changes for the cargo
THEN
The system updates the bond start date based on the new bond processing requirements
Context: A cargo record requires destination index re-establishment AND the index parameters have been calculated
GIVEN
A cargo record requires destination index re-establishment AND the index parameters have been calculated
Applied to: Re-establish RT076 Destination Index
WHEN
The system processes the destination index re-establishment
THEN
The system calls B585-SET-RT076-DEST-INDEX to re-establish the destination index with updated parameters
Context: A cargo record has been processed for status changes AND destination index has been re-established
GIVEN
A cargo record has been processed for status changes AND destination index has been re-established
Applied to: Cross-Border Coordination Needed?
WHEN
The system evaluates cross-border coordination requirements
THEN
The system determines if Canadian manifest coordination is needed based on cargo release status and processing type
Context: Cross-border coordination is required for a cargo record AND the cargo has been released
GIVEN
Cross-border coordination is required for a cargo record AND the cargo has been released
Applied to: Find Matching Canadian Manifests
WHEN
The system searches for Canadian manifest coordination
THEN
The system calls B583-PROCESS-CDN-MFST to find and process matching Canadian manifest records by waybill
Context: Matching Canadian manifest records have been found AND cross-border coordination is active
GIVEN
Matching Canadian manifest records have been found AND cross-border coordination is active
Applied to: Generate Canadian Log Messages
WHEN
The system processes Canadian manifest coordination
THEN
The system generates log messages to GCX105 system with cargo release information for Canadian coordination
Context: Destination index has been re-established AND any required cross-border coordination has been completed
GIVEN
Destination index has been re-established AND any required cross-border coordination has been completed
Applied to: Update Cargo Record with New Index
WHEN
The system finalizes the cargo record update
THEN
The system updates the cargo record with the new destination index information and any coordination results
R-GCX016-cbl-03091 (+13) File: GCX016.cbl Status Array Counterpart Logic Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Counterpart Logic':
  • Context - a disposition code is being processed:
    For Get Counterpart Code from DC Table:
    When the system looks up the disposition code in the dc table, then the counterpart code is retrieved from the dc table if it exists.
  • Context - a counterpart code lookup has been performed:
    For Counterpart Code Exists?:
    When the system checks if a counterpart code was found, then processing continues with counterpart removal if code exists, otherwise no counterpart processing is performed.
  • Context - a counterpart code exists and status array contains disposition codes:
    For Search Status Array for Matching Codes:
    When the system iterates through each element in the status array, then each status array element is evaluated against the counterpart code for potential matching.
  • Context - a status array element is being evaluated against a counterpart code:
    For Match Found?:
    When the system compares the disposition codes, then a match is identified if the codes are identical, triggering further matching criteria validation.
  • Context - a potential counterpart code match has been found in the status array:
    For Check Matching Criteria:
    When the system evaluates additional matching criteria including status info, entry number, quantity, and special code patterns, then the counterpart code is marked for removal only if all applicable matching criteria are satisfied.
  • Context - a counterpart code match candidate exists in the status array:
    For Status Info Match?:
    When the system compares status information codes between the counterpart and array element, then the match is confirmed if status info codes are identical, otherwise additional criteria are evaluated.
  • Context - status info codes do not match for a counterpart code candidate:
    For Entry Number Match?:
    When the system compares entry numbers between the counterpart and array element, then the match is confirmed if entry numbers are identical, otherwise quantity matching is evaluated.
  • Context - entry numbers do not match for a counterpart code candidate:
    For Quantity Match?:
    When the system compares quantities between the counterpart and array element, then the match is confirmed if quantities are identical, otherwise special code pattern matching is evaluated.
  • Context - standard matching criteria (status info, entry number, quantity) do not match for a counterpart code candidate:
    For Special Code Pattern Match?:
    When the system evaluates special code patterns and business-specific matching rules, then the match is confirmed if special pattern criteria are satisfied, otherwise the element is not removed.
  • Context - a counterpart code match has been confirmed based on matching criteria:
    For Remove Counterpart Code from Array:
    When the system processes the removal of the counterpart code, then the matched element is marked for removal from the status array.
  • Context - one or more counterpart codes have been removed from the status array:
    For Compact Array Elements:
    When the system compacts the array structure, then all remaining elements are shifted up to eliminate empty positions and maintain array integrity.
  • Context - the status array has been compacted after counterpart code removal:
    For Update Array Count:
    When the system updates the array metadata, then the total element count is decremented to reflect the number of removed counterpart codes.
  • Context - an array element has been processed for counterpart matching:
    For Continue to Next Array Element:
    When the system moves to the next element in the status array, then processing continues with the next array element until all elements have been evaluated.
  • Context - a disposition code has been looked up in the dc table:
    For No Counterpart Processing Needed:
    When no counterpart code exists for the disposition code, then counterpart processing is bypassed and the system proceeds to complete processing.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed
GIVEN
A disposition code is being processed
Applied to: Get Counterpart Code from DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The counterpart code is retrieved from the DC table if it exists
Context: A counterpart code lookup has been performed
GIVEN
A counterpart code lookup has been performed
Applied to: Counterpart Code Exists?
WHEN
The system checks if a counterpart code was found
THEN
Processing continues with counterpart removal if code exists, otherwise no counterpart processing is performed
Context: A counterpart code exists and status array contains disposition codes
GIVEN
A counterpart code exists and status array contains disposition codes
Applied to: Search Status Array for Matching Codes
WHEN
The system iterates through each element in the status array
THEN
Each status array element is evaluated against the counterpart code for potential matching
Context: A status array element is being evaluated against a counterpart code
GIVEN
A status array element is being evaluated against a counterpart code
Applied to: Match Found?
WHEN
The system compares the disposition codes
THEN
A match is identified if the codes are identical, triggering further matching criteria validation
Context: A potential counterpart code match has been found in the status array
GIVEN
A potential counterpart code match has been found in the status array
Applied to: Check Matching Criteria
WHEN
The system evaluates additional matching criteria including status info, entry number, quantity, and special code patterns
THEN
The counterpart code is marked for removal only if all applicable matching criteria are satisfied
Context: A counterpart code match candidate exists in the status array
GIVEN
A counterpart code match candidate exists in the status array
Applied to: Status Info Match?
WHEN
The system compares status information codes between the counterpart and array element
THEN
The match is confirmed if status info codes are identical, otherwise additional criteria are evaluated
Context: Status info codes do not match for a counterpart code candidate
GIVEN
Status info codes do not match for a counterpart code candidate
Applied to: Entry Number Match?
WHEN
The system compares entry numbers between the counterpart and array element
THEN
The match is confirmed if entry numbers are identical, otherwise quantity matching is evaluated
Context: Entry numbers do not match for a counterpart code candidate
GIVEN
Entry numbers do not match for a counterpart code candidate
Applied to: Quantity Match?
WHEN
The system compares quantities between the counterpart and array element
THEN
The match is confirmed if quantities are identical, otherwise special code pattern matching is evaluated
Context: Standard matching criteria (status info, entry number, quantity) do not match for a counterpart code candidate
GIVEN
Standard matching criteria (status info, entry number, quantity) do not match for a counterpart code candidate
Applied to: Special Code Pattern Match?
WHEN
The system evaluates special code patterns and business-specific matching rules
THEN
The match is confirmed if special pattern criteria are satisfied, otherwise the element is not removed
Context: A counterpart code match has been confirmed based on matching criteria
GIVEN
A counterpart code match has been confirmed based on matching criteria
Applied to: Remove Counterpart Code from Array
WHEN
The system processes the removal of the counterpart code
THEN
The matched element is marked for removal from the status array
Context: One or more counterpart codes have been removed from the status array
GIVEN
One or more counterpart codes have been removed from the status array
Applied to: Compact Array Elements
WHEN
The system compacts the array structure
THEN
All remaining elements are shifted up to eliminate empty positions and maintain array integrity
Context: The status array has been compacted after counterpart code removal
GIVEN
The status array has been compacted after counterpart code removal
Applied to: Update Array Count
WHEN
The system updates the array metadata
THEN
The total element count is decremented to reflect the number of removed counterpart codes
Context: An array element has been processed for counterpart matching
GIVEN
An array element has been processed for counterpart matching
Applied to: Continue to Next Array Element
WHEN
The system moves to the next element in the status array
THEN
Processing continues with the next array element until all elements have been evaluated
Context: A disposition code has been looked up in the DC table
GIVEN
A disposition code has been looked up in the DC table
Applied to: No Counterpart Processing Needed
WHEN
No counterpart code exists for the disposition code
THEN
Counterpart processing is bypassed and the system proceeds to complete processing
R-GCX016-cbl-03105 (+28) File: GCX016.cbl FDA Hold Status Processing Merged 29 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FDA Hold Status Processing':
  • Context - a cargo record exists in the system:
    For FDA Hold Status Processing Start:
    When fda hold status processing is initiated, then the system begins evaluation of fda hold requirements.
  • Context - fda hold status processing has been initiated:
    For Cargo Status Analysis Complete?:
    When the system checks if cargo status analysis is complete, then the system either proceeds with fda hold conditions check or continues with standard processing and if analysis is complete, proceed to fda hold conditions check, otherwise continue with other status processing.
  • Context - cargo status analysis is complete:
    For Check for FDA Hold Conditions:
    When the system checks for fda hold conditions, then the system identifies whether fda regulatory hold requirements exist for the cargo.
    For Check FDA Hold Conditions:
    When the system evaluates fda hold conditions, then the system determines if fda hold is required at destination.
  • Context - fda hold conditions have been checked:
    For FDA Hold Required at Destination?:
    When the system evaluates if fda hold is required at destination, then the system either sets fda hold status code or continues with standard processing.
  • Context - fda hold is required at destination:
    For Set FDA Hold Status Code:
    When the system sets fda hold status code, then the cargo is assigned the fda-specific hold status code and the appropriate fda-specific status code is assigned to the cargo.
  • Context - fda hold status code has been set:
    For Update Cargo Status to FDA Hold:
    When the system updates cargo status to fda hold, then the cargo status is changed to fda hold status.
    For Set Destination Location Flag:
    When the system sets destination location flag, then the destination location flag is updated to reflect fda hold location.
  • Context - cargo status has been updated to fda hold:
    For Set Destination Hold Location:
    When the system sets destination hold location, then the hold location is designated as the destination location.
  • Context - destination hold location has been set:
    For Apply FDA-Specific Status Description:
    When the system applies fda-specific status description, then the cargo record contains fda-specific status description indicating regulatory hold.
  • Context - fda-specific status description has been applied:
    For Preserve Current Release Quantities:
    When the system preserves current release quantities, then existing release quantities remain unchanged during fda hold application.
  • Context - current release quantities have been preserved:
    For Update Status Array with FDA Code:
    When the system updates status array with fda code, then the status array contains the fda hold code entry.
  • Context - status array has been updated with fda code:
    For Set Hold Location as Destination:
    When the system sets hold location as destination, then the hold location field is set to destination location.
  • Context - hold location has been set as destination:
    For Generate FDA Hold Notification:
    When the system generates fda hold notification, then a notification is created to inform stakeholders about the fda hold.
    For Update Cargo Status Array:
    When the system updates cargo status array, then the cargo status array is updated with fda hold status information.
  • Context - fda hold notification has been generated:
    For Update Cargo Record with FDA Status:
    When the system updates cargo record with fda status, then the cargo record in the database reflects fda hold status and related information.
  • Context - cargo record has been updated with fda status or standard processing has been completed:
    For FDA Hold Processing Complete:
    When fda hold processing reaches completion, then all fda hold processing activities are finalized and the system is ready for next operations.
  • Context - cargo status analysis is not complete or fda hold is not required at destination:
    For Continue with Standard Processing:
    When the system continues with standard processing, then normal cargo processing workflow proceeds without fda hold restrictions.
  • Context - fda hold conditions have been evaluated:
    For FDA Hold Required at Destination?:
    When the system determines if fda hold is required at destination, then if fda hold is required, set fda hold status code, otherwise continue with other status processing.
  • Context - destination location flag has been set:
    For Update Status Description:
    When the system updates status description, then the status description is updated with fda hold information.
  • Context - status description has been updated:
    For Status Code Validation:
    When the system validates the status code, then if status code is valid, apply fda-specific status code, otherwise continue with other status processing.
  • Context - status code validation is successful:
    For Apply FDA-Specific Status Code:
    When the system applies fda-specific status code, then the fda-specific status code is applied to the cargo.
  • Context - fda-specific status code has been applied:
    For Set Hold Location as Destination:
    When the system sets hold location as destination, then the hold location is designated as destination.
  • Context - cargo status array has been updated:
    For Log FDA Hold Action:
    When the system logs fda hold action, then the fda hold action is recorded in the system logs.
  • Context - fda hold action has been logged:
    For FDA Hold Status Set Complete:
    When the system completes fda hold status processing, then fda hold status processing is marked as complete.
  • Context - fda hold status processing is complete or not required:
    For Continue with Other Status Processing:
    When the system continues with other status processing, then other cargo status processing continues normally.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: FDA Hold Status Processing Start
WHEN
FDA hold status processing is initiated
THEN
The system begins evaluation of FDA hold requirements
Context: FDA hold status processing has been initiated
GIVEN
FDA hold status processing has been initiated
Applied to: Cargo Status Analysis Complete?
WHEN
The system checks if cargo status analysis is complete
THEN
The system either proceeds with FDA hold conditions check or continues with standard processing AND If analysis is complete, proceed to FDA hold conditions check, otherwise continue with other status processing
Context: Cargo status analysis is complete
GIVEN
Cargo status analysis is complete
Applied to: Check for FDA Hold Conditions
WHEN
The system checks for FDA hold conditions
THEN
The system identifies whether FDA regulatory hold requirements exist for the cargo
Applied to: Check FDA Hold Conditions
WHEN
The system evaluates FDA hold conditions
THEN
The system determines if FDA hold is required at destination
Context: FDA hold conditions have been checked
GIVEN
FDA hold conditions have been checked
Applied to: FDA Hold Required at Destination?
WHEN
The system evaluates if FDA hold is required at destination
THEN
The system either sets FDA hold status code or continues with standard processing
Context: FDA hold is required at destination
GIVEN
FDA hold is required at destination
Applied to: Set FDA Hold Status Code
WHEN
The system sets FDA hold status code
THEN
The cargo is assigned the FDA-specific hold status code AND The appropriate FDA-specific status code is assigned to the cargo
Context: FDA hold status code has been set
GIVEN
FDA hold status code has been set
Applied to: Update Cargo Status to FDA Hold
WHEN
The system updates cargo status to FDA hold
THEN
The cargo status is changed to FDA hold status
Applied to: Set Destination Location Flag
WHEN
The system sets destination location flag
THEN
The destination location flag is updated to reflect FDA hold location
Context: Cargo status has been updated to FDA hold
GIVEN
Cargo status has been updated to FDA hold
Applied to: Set Destination Hold Location
WHEN
The system sets destination hold location
THEN
The hold location is designated as the destination location
Context: Destination hold location has been set
GIVEN
Destination hold location has been set
Applied to: Apply FDA-Specific Status Description
WHEN
The system applies FDA-specific status description
THEN
The cargo record contains FDA-specific status description indicating regulatory hold
Context: FDA-specific status description has been applied
GIVEN
FDA-specific status description has been applied
Applied to: Preserve Current Release Quantities
WHEN
The system preserves current release quantities
THEN
Existing release quantities remain unchanged during FDA hold application
Context: Current release quantities have been preserved
GIVEN
Current release quantities have been preserved
Applied to: Update Status Array with FDA Code
WHEN
The system updates status array with FDA code
THEN
The status array contains the FDA hold code entry
Context: Status array has been updated with FDA code
GIVEN
Status array has been updated with FDA code
Applied to: Set Hold Location as Destination
WHEN
The system sets hold location as destination
THEN
The hold location field is set to destination location
Context: Hold location has been set as destination
GIVEN
Hold location has been set as destination
Applied to: Generate FDA Hold Notification
WHEN
The system generates FDA hold notification
THEN
A notification is created to inform stakeholders about the FDA hold
Applied to: Update Cargo Status Array
WHEN
The system updates cargo status array
THEN
The cargo status array is updated with FDA hold status information
Context: FDA hold notification has been generated
GIVEN
FDA hold notification has been generated
Applied to: Update Cargo Record with FDA Status
WHEN
The system updates cargo record with FDA status
THEN
The cargo record in the database reflects FDA hold status and related information
Context: Cargo record has been updated with FDA status OR standard processing has been completed
GIVEN
Cargo record has been updated with FDA status OR standard processing has been completed
Applied to: FDA Hold Processing Complete
WHEN
FDA hold processing reaches completion
THEN
All FDA hold processing activities are finalized and the system is ready for next operations
Context: Cargo status analysis is not complete OR FDA hold is not required at destination
GIVEN
Cargo status analysis is not complete OR FDA hold is not required at destination
Applied to: Continue with Standard Processing
WHEN
The system continues with standard processing
THEN
Normal cargo processing workflow proceeds without FDA hold restrictions
Context: FDA hold conditions have been evaluated
GIVEN
FDA hold conditions have been evaluated
Applied to: FDA Hold Required at Destination?
WHEN
The system determines if FDA hold is required at destination
THEN
If FDA hold is required, set FDA hold status code, otherwise continue with other status processing
Context: Destination location flag has been set
GIVEN
Destination location flag has been set
Applied to: Update Status Description
WHEN
The system updates status description
THEN
The status description is updated with FDA hold information
Context: Status description has been updated
GIVEN
Status description has been updated
Applied to: Status Code Validation
WHEN
The system validates the status code
THEN
If status code is valid, apply FDA-specific status code, otherwise continue with other status processing
Context: Status code validation is successful
GIVEN
Status code validation is successful
Applied to: Apply FDA-Specific Status Code
WHEN
The system applies FDA-specific status code
THEN
The FDA-specific status code is applied to the cargo
Context: FDA-specific status code has been applied
GIVEN
FDA-specific status code has been applied
Applied to: Set Hold Location as Destination
WHEN
The system sets hold location as destination
THEN
The hold location is designated as destination
Context: Cargo status array has been updated
GIVEN
Cargo status array has been updated
Applied to: Log FDA Hold Action
WHEN
The system logs FDA hold action
THEN
The FDA hold action is recorded in the system logs
Context: FDA hold action has been logged
GIVEN
FDA hold action has been logged
Applied to: FDA Hold Status Set Complete
WHEN
The system completes FDA hold status processing
THEN
FDA hold status processing is marked as complete
Context: FDA hold status processing is complete or not required
GIVEN
FDA hold status processing is complete or not required
Applied to: Continue with Other Status Processing
WHEN
The system continues with other status processing
THEN
Other cargo status processing continues normally
R-GCX016-cbl-03120 (+8) File: GCX016.cbl Proceed Status with Border Date Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Proceed Status with Border Date Processing':
  • Context - a cargo record has completed status analysis and status array contains various status flags:
    For Proceed Flag Set in Status Array?:
    When the system checks the proceed flag in the s09a status array, then if proceed flag is set to true, continue with proceed status processing, otherwise skip proceed processing and continue with next status processing step.
  • Context - proceed flag is set in status array and cargo record exists with current status information:
    For Cargo Currently Held?:
    When the system evaluates the current cargo status from gccc-cargo-root record, then if cargo is currently held (has any hold status flags active), proceed with setting proceed status flag, otherwise skip proceed processing.
  • Context - cargo is currently held and proceed flag is set in status array:
    For Set Proceed Status Flag:
    When the system processes proceed status assignment, then set the proceed status flag to active in the cargo processing variables.
  • Context - proceed status flag has been set and border arrival date update is required:
    For Border Date Available?:
    When the system checks for availability of border date in the message or cargo data, then if border date is available and valid, use the provided border date, otherwise use current system date as border arrival date.
  • Context - proceed status processing is active and no border date is available in message data:
    For Use Current System Date:
    When the system needs to update border arrival date, then assign current system date as the border arrival date for the cargo record.
  • Context - proceed status processing is active and border date is available in message data:
    For Use Provided Border Date:
    When the system updates border arrival date, then use the provided border date from the message as the border arrival date for the cargo record.
  • Context - border arrival date has been updated and proceed status is being applied:
    For Clear Hold Status Flags:
    When the system processes hold status flag clearing, then clear all active hold status flags in the cargo status array and processing variables.
  • Context - hold status flags have been cleared and proceed status flag is set with updated border arrival date:
    For Update Cargo Record Status:
    When the system updates the cargo record status, then update gccc-cargo-root record with proceed status, cleared hold flags, and updated border arrival date.
  • Context - cargo record status has been updated with proceed status and cleared hold flags:
    For Log Proceed Status Change:
    When the system completes proceed status processing, then log the proceed status change with cargo identifier, previous status, new status, and timestamp for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has completed status analysis and status array contains various status flags
GIVEN
A cargo record has completed status analysis and status array contains various status flags
Applied to: Proceed Flag Set in Status Array?
WHEN
The system checks the proceed flag in the S09A status array
THEN
If proceed flag is set to true, continue with proceed status processing, otherwise skip proceed processing and continue with next status processing step
Context: Proceed flag is set in status array and cargo record exists with current status information
GIVEN
Proceed flag is set in status array and cargo record exists with current status information
Applied to: Cargo Currently Held?
WHEN
The system evaluates the current cargo status from GCCC-CARGO-ROOT record
THEN
If cargo is currently held (has any hold status flags active), proceed with setting proceed status flag, otherwise skip proceed processing
Context: Cargo is currently held and proceed flag is set in status array
GIVEN
Cargo is currently held and proceed flag is set in status array
Applied to: Set Proceed Status Flag
WHEN
The system processes proceed status assignment
THEN
Set the proceed status flag to active in the cargo processing variables
Context: Proceed status flag has been set and border arrival date update is required
GIVEN
Proceed status flag has been set and border arrival date update is required
Applied to: Border Date Available?
WHEN
The system checks for availability of border date in the message or cargo data
THEN
If border date is available and valid, use the provided border date, otherwise use current system date as border arrival date
Context: Proceed status processing is active and no border date is available in message data
GIVEN
Proceed status processing is active and no border date is available in message data
Applied to: Use Current System Date
WHEN
The system needs to update border arrival date
THEN
Assign current system date as the border arrival date for the cargo record
Context: Proceed status processing is active and border date is available in message data
GIVEN
Proceed status processing is active and border date is available in message data
Applied to: Use Provided Border Date
WHEN
The system updates border arrival date
THEN
Use the provided border date from the message as the border arrival date for the cargo record
Context: Border arrival date has been updated and proceed status is being applied
GIVEN
Border arrival date has been updated and proceed status is being applied
Applied to: Clear Hold Status Flags
WHEN
The system processes hold status flag clearing
THEN
Clear all active hold status flags in the cargo status array and processing variables
Context: Hold status flags have been cleared and proceed status flag is set with updated border arrival date
GIVEN
Hold status flags have been cleared and proceed status flag is set with updated border arrival date
Applied to: Update Cargo Record Status
WHEN
The system updates the cargo record status
THEN
Update GCCC-CARGO-ROOT record with proceed status, cleared hold flags, and updated border arrival date
Context: Cargo record status has been updated with proceed status and cleared hold flags
GIVEN
Cargo record status has been updated with proceed status and cleared hold flags
Applied to: Log Proceed Status Change
WHEN
The system completes proceed status processing
THEN
Log the proceed status change with cargo identifier, previous status, new status, and timestamp for audit trail
R-GCX016-cbl-03129 (+8) File: GCX016.cbl Export Status with Index Clearing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Status with Index Clearing':
  • Context - a cargo record has completed status analysis:
    For Export Flag Set?:
    When the system checks the export flag status, then if export flag is set, proceed to cargo status verification; otherwise skip export processing and continue to next step.
  • Context - cargo has been flagged for export processing:
    For Check Current Cargo Status:
    When the system evaluates the current cargo status, then the system determines whether cargo is currently at destination location for proper export handling.
  • Context - cargo status has been checked and export flag is active:
    For Cargo Currently at Destination?:
    When the system evaluates cargo location against destination, then if cargo is at destination, proceed with export status setting; otherwise skip export processing.
  • Context - cargo is confirmed to be at destination location and flagged for export:
    For Set Export Status Flag:
    When the system processes export status assignment, then the export status flag is set for the cargo record.
  • Context - cargo has been assigned export status flag:
    For Clear Destination Index RT076:
    When the system processes destination index cleanup, then the rt076 destination index is cleared from the cargo record.
  • Context - cargo export status has been set and destination index cleared:
    For Update Cargo Export Date:
    When the system updates cargo export information, then the current date is assigned as the cargo export date.
  • Context - cargo export date has been updated:
    For Remove Destination Location Code:
    When the system processes location code cleanup, then the destination location code is removed from the cargo record.
  • Context - destination location code has been removed from cargo:
    For Set Export Processing Complete Flag:
    When the system finalizes export processing, then the export processing complete flag is set for the cargo record.
  • Context - export processing complete flag has been set:
    For Log Export Status Change:
    When the system performs audit logging, then an export status change entry is logged with cargo details and timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has completed status analysis
GIVEN
A cargo record has completed status analysis
Applied to: Export Flag Set?
WHEN
The system checks the export flag status
THEN
If export flag is set, proceed to cargo status verification; otherwise skip export processing and continue to next step
Context: Cargo has been flagged for export processing
GIVEN
Cargo has been flagged for export processing
Applied to: Check Current Cargo Status
WHEN
The system evaluates the current cargo status
THEN
The system determines whether cargo is currently at destination location for proper export handling
Context: Cargo status has been checked and export flag is active
GIVEN
Cargo status has been checked and export flag is active
Applied to: Cargo Currently at Destination?
WHEN
The system evaluates cargo location against destination
THEN
If cargo is at destination, proceed with export status setting; otherwise skip export processing
Context: Cargo is confirmed to be at destination location and flagged for export
GIVEN
Cargo is confirmed to be at destination location and flagged for export
Applied to: Set Export Status Flag
WHEN
The system processes export status assignment
THEN
The export status flag is set for the cargo record
Context: Cargo has been assigned export status flag
GIVEN
Cargo has been assigned export status flag
Applied to: Clear Destination Index RT076
WHEN
The system processes destination index cleanup
THEN
The RT076 destination index is cleared from the cargo record
Context: Cargo export status has been set and destination index cleared
GIVEN
Cargo export status has been set and destination index cleared
Applied to: Update Cargo Export Date
WHEN
The system updates cargo export information
THEN
The current date is assigned as the cargo export date
Context: Cargo export date has been updated
GIVEN
Cargo export date has been updated
Applied to: Remove Destination Location Code
WHEN
The system processes location code cleanup
THEN
The destination location code is removed from the cargo record
Context: Destination location code has been removed from cargo
GIVEN
Destination location code has been removed from cargo
Applied to: Set Export Processing Complete Flag
WHEN
The system finalizes export processing
THEN
The export processing complete flag is set for the cargo record
Context: Export processing complete flag has been set
GIVEN
Export processing complete flag has been set
Applied to: Log Export Status Change
WHEN
The system performs audit logging
THEN
An export status change entry is logged with cargo details and timestamp
R-GCX016-cbl-03138 (+13) File: GCX016.cbl Arrival Cancellation Status Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Arrival Cancellation Status Processing':
  • Context - an arrival cancellation request is received for a cargo record:
    For Check Current Cargo Status:
    When the system checks the current cargo status, then the system verifies the cargo record exists and has a valid status for cancellation processing.
  • Context - a cargo record with current status information:
    For Validate Arrival Status Exists:
    When the system validates arrival status exists for cancellation, then the system confirms arrival status is present or returns invalid arrival status error if no arrival status exists.
  • Context - a cargo record requiring arrival cancellation with arrival status validated:
    For Previous Bond Date Available?:
    When the system checks for previous bond date availability, then the system returns yes if previous bond start date exists or returns no if no previous bond date is available.
  • Context - a cargo record with confirmed previous bond date availability:
    For Retrieve Previous Bond Start Date:
    When the system retrieves previous bond start date from bond date history, then the system successfully retrieves and loads the previous bond start date for restoration.
  • Context - a cargo record with validated arrival status and retrieved previous bond date:
    For Clear Current Arrival Status:
    When the system clears current arrival status, then the system removes arrival status flags and arrival-related information from the cargo record.
  • Context - a cargo record with cleared arrival status and retrieved previous bond start date:
    For Restore Previous Bond Date:
    When the system restores previous bond date, then the system updates the cargo record with the previous bond start date information.
  • Context - a cargo record with restored previous bond date:
    For Update Cargo Record Status:
    When the system updates cargo record status, then the system saves the updated cargo record with cancelled arrival status and restored bond information.
  • Context - a cargo record with updated status after arrival cancellation:
    For Clear Destination Index if Required:
    When the system evaluates if destination index should be cleared, then the system clears destination index if cargo status requires it or leaves destination index unchanged if not required.
  • Context - a cargo record with processed arrival cancellation and updated status:
    For Generate Arrival Cancellation Message:
    When the system generates arrival cancellation message, then the system creates a formatted arrival cancellation message with cargo details and cancellation information.
  • Context - a cargo record with generated arrival cancellation message:
    For Update Status Array with Cancellation Code:
    When the system updates status array with cancellation code, then the system adds the arrival cancellation disposition code to the cargo status array.
  • Context - a cargo record with updated status array containing cancellation code:
    For Log Cancellation Transaction:
    When the system logs cancellation transaction, then the system creates audit log entry with cancellation details, timestamps, and cargo information.
  • Context - a cargo record with logged cancellation transaction:
    For Send Notification to Customs:
    When the system sends notification to customs, then the system transmits arrival cancellation notification to appropriate customs systems and authorities.
  • Context - a cargo record requiring arrival cancellation:
    For Error: No Previous Bond Date:
    When no previous bond date is available for restoration, then the system generates error condition indicating no previous bond date available and completes cancellation process without bond date restoration.
  • Context - a cargo record with arrival cancellation request:
    For Error: Invalid Arrival Status:
    When the cargo does not have valid arrival status for cancellation, then the system generates error condition indicating invalid arrival status and completes cancellation process without status changes.
👨‍💻 Technical ACs (Gherkin)
Context: An arrival cancellation request is received for a cargo record
GIVEN
An arrival cancellation request is received for a cargo record
Applied to: Check Current Cargo Status
WHEN
The system checks the current cargo status
THEN
The system verifies the cargo record exists and has a valid status for cancellation processing
Context: A cargo record with current status information
GIVEN
A cargo record with current status information
Applied to: Validate Arrival Status Exists
WHEN
The system validates arrival status exists for cancellation
THEN
The system confirms arrival status is present OR returns invalid arrival status error if no arrival status exists
Context: A cargo record requiring arrival cancellation with arrival status validated
GIVEN
A cargo record requiring arrival cancellation with arrival status validated
Applied to: Previous Bond Date Available?
WHEN
The system checks for previous bond date availability
THEN
The system returns YES if previous bond start date exists OR returns NO if no previous bond date is available
Context: A cargo record with confirmed previous bond date availability
GIVEN
A cargo record with confirmed previous bond date availability
Applied to: Retrieve Previous Bond Start Date
WHEN
The system retrieves previous bond start date from bond date history
THEN
The system successfully retrieves and loads the previous bond start date for restoration
Context: A cargo record with validated arrival status and retrieved previous bond date
GIVEN
A cargo record with validated arrival status and retrieved previous bond date
Applied to: Clear Current Arrival Status
WHEN
The system clears current arrival status
THEN
The system removes arrival status flags and arrival-related information from the cargo record
Context: A cargo record with cleared arrival status and retrieved previous bond start date
GIVEN
A cargo record with cleared arrival status and retrieved previous bond start date
Applied to: Restore Previous Bond Date
WHEN
The system restores previous bond date
THEN
The system updates the cargo record with the previous bond start date information
Context: A cargo record with restored previous bond date
GIVEN
A cargo record with restored previous bond date
Applied to: Update Cargo Record Status
WHEN
The system updates cargo record status
THEN
The system saves the updated cargo record with cancelled arrival status and restored bond information
Context: A cargo record with updated status after arrival cancellation
GIVEN
A cargo record with updated status after arrival cancellation
Applied to: Clear Destination Index if Required
WHEN
The system evaluates if destination index should be cleared
THEN
The system clears destination index if cargo status requires it OR leaves destination index unchanged if not required
Context: A cargo record with processed arrival cancellation and updated status
GIVEN
A cargo record with processed arrival cancellation and updated status
Applied to: Generate Arrival Cancellation Message
WHEN
The system generates arrival cancellation message
THEN
The system creates a formatted arrival cancellation message with cargo details and cancellation information
Context: A cargo record with generated arrival cancellation message
GIVEN
A cargo record with generated arrival cancellation message
Applied to: Update Status Array with Cancellation Code
WHEN
The system updates status array with cancellation code
THEN
The system adds the arrival cancellation disposition code to the cargo status array
Context: A cargo record with updated status array containing cancellation code
GIVEN
A cargo record with updated status array containing cancellation code
Applied to: Log Cancellation Transaction
WHEN
The system logs cancellation transaction
THEN
The system creates audit log entry with cancellation details, timestamps, and cargo information
Context: A cargo record with logged cancellation transaction
GIVEN
A cargo record with logged cancellation transaction
Applied to: Send Notification to Customs
WHEN
The system sends notification to customs
THEN
The system transmits arrival cancellation notification to appropriate customs systems and authorities
Context: A cargo record requiring arrival cancellation
GIVEN
A cargo record requiring arrival cancellation
Applied to: Error: No Previous Bond Date
WHEN
No previous bond date is available for restoration
THEN
The system generates error condition indicating no previous bond date available and completes cancellation process without bond date restoration
Context: A cargo record with arrival cancellation request
GIVEN
A cargo record with arrival cancellation request
Applied to: Error: Invalid Arrival Status
WHEN
The cargo does not have valid arrival status for cancellation
THEN
The system generates error condition indicating invalid arrival status and completes cancellation process without status changes
R-GCX016-cbl-03152 (+11) File: GCX016.cbl Export Cancellation Status Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Cancellation Status Processing':
  • Context - an export cancellation request is received for cargo:
    For Validate Export Status Exists:
    When the system checks the current cargo status for export indicators, then the system validates that export status exists and is valid for cancellation processing.
  • Context - cargo has a valid export status that needs to be cancelled:
    For Clear Export Status Flag:
    When export cancellation processing begins, then the system clears the export status flag from the cargo record.
  • Context - export status has been cleared from cargo:
    For Restore Previous Bond Date:
    When the system processes bond date restoration, then the previous bond date is restored to re-establish the cargo's bond timeline.
  • Context - bond date has been restored for cargo:
    For Calculate Cargo Age from Bond Start Date:
    When the system calculates cargo age from the bond start date to current date, then a valid age calculation is produced for destination index determination.
  • Context - cargo age has been calculated from bond start date:
    For Age Calculation Valid?:
    When the system validates the age calculation result, then the age calculation is confirmed as valid and within business rules or flagged as invalid.
  • Context - cargo age calculation is valid:
    For Re-establish Destination Index RT076:
    When the system processes destination index re-establishment, then the rt076 destination index is re-established with the calculated age information.
  • Context - destination index rt076 is being re-established:
    For Set Destination Index with Age:
    When the system sets the destination index with calculated age, then the destination index is updated with the age-based information for proper cargo tracking.
  • Context - destination index has been set with age information:
    For Update Cargo Record Status:
    When the system updates the cargo record, then the cargo status is updated to reflect the export cancellation and restored bond status.
  • Context - cargo record status has been updated for export cancellation:
    For Generate Export Cancellation Message:
    When the system generates export cancellation message, then a notification message is created documenting the export cancellation and status change.
  • Context - export cancellation message has been generated:
    For Log Status Change for Audit:
    When the system logs the status change, then an audit trail entry is created documenting the export cancellation, previous status, and new status.
  • Context - an export cancellation request is received:
    For Error: Invalid Export Status:
    When the cargo does not have a valid export status for cancellation, then the system generates an error indicating invalid export status and terminates cancellation processing.
  • Context - bond date has been restored for export cancellation:
    For Error: Age Calculation Failed:
    When the cargo age calculation from bond start date fails or produces invalid results, then the system generates an error indicating age calculation failure and terminates destination index processing.
👨‍💻 Technical ACs (Gherkin)
Context: An export cancellation request is received for cargo
GIVEN
An export cancellation request is received for cargo
Applied to: Validate Export Status Exists
WHEN
The system checks the current cargo status for export indicators
THEN
The system validates that export status exists and is valid for cancellation processing
Context: Cargo has a valid export status that needs to be cancelled
GIVEN
Cargo has a valid export status that needs to be cancelled
Applied to: Clear Export Status Flag
WHEN
Export cancellation processing begins
THEN
The system clears the export status flag from the cargo record
Context: Export status has been cleared from cargo
GIVEN
Export status has been cleared from cargo
Applied to: Restore Previous Bond Date
WHEN
The system processes bond date restoration
THEN
The previous bond date is restored to re-establish the cargo's bond timeline
Context: Bond date has been restored for cargo
GIVEN
Bond date has been restored for cargo
Applied to: Calculate Cargo Age from Bond Start Date
WHEN
The system calculates cargo age from the bond start date to current date
THEN
A valid age calculation is produced for destination index determination
Context: Cargo age has been calculated from bond start date
GIVEN
Cargo age has been calculated from bond start date
Applied to: Age Calculation Valid?
WHEN
The system validates the age calculation result
THEN
The age calculation is confirmed as valid and within business rules or flagged as invalid
Context: Cargo age calculation is valid
GIVEN
Cargo age calculation is valid
Applied to: Re-establish Destination Index RT076
WHEN
The system processes destination index re-establishment
THEN
The RT076 destination index is re-established with the calculated age information
Context: Destination index RT076 is being re-established
GIVEN
Destination index RT076 is being re-established
Applied to: Set Destination Index with Age
WHEN
The system sets the destination index with calculated age
THEN
The destination index is updated with the age-based information for proper cargo tracking
Context: Destination index has been set with age information
GIVEN
Destination index has been set with age information
Applied to: Update Cargo Record Status
WHEN
The system updates the cargo record
THEN
The cargo status is updated to reflect the export cancellation and restored bond status
Context: Cargo record status has been updated for export cancellation
GIVEN
Cargo record status has been updated for export cancellation
Applied to: Generate Export Cancellation Message
WHEN
The system generates export cancellation message
THEN
A notification message is created documenting the export cancellation and status change
Context: Export cancellation message has been generated
GIVEN
Export cancellation message has been generated
Applied to: Log Status Change for Audit
WHEN
The system logs the status change
THEN
An audit trail entry is created documenting the export cancellation, previous status, and new status
Context: An export cancellation request is received
GIVEN
An export cancellation request is received
Applied to: Error: Invalid Export Status
WHEN
The cargo does not have a valid export status for cancellation
THEN
The system generates an error indicating invalid export status and terminates cancellation processing
Context: Bond date has been restored for export cancellation
GIVEN
Bond date has been restored for export cancellation
Applied to: Error: Age Calculation Failed
WHEN
The cargo age calculation from bond start date fails or produces invalid results
THEN
The system generates an error indicating age calculation failure and terminates destination index processing
R-GCX016-cbl-03164 (+9) File: GCX016.cbl Status Array Element Removal Logic Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Element Removal Logic':
  • Context - a status array contains multiple elements and a specific element needs to be removed:
    For Element Found in Array?:
    When the system searches through the array to find matching elements, then the system identifies whether the target element exists in the array and marks its position for removal.
  • Context - an element has been found in the status array:
    For Identify Element Position:
    When the system needs to track the element's location, then the system records the array index position of the found element.
  • Context - an element position has been identified in the status array:
    For Mark Element for Removal:
    When the element needs to be removed from the array, then the system marks the element for removal while preserving array structure temporarily.
  • Context - the system is processing elements in the status array for removal:
    For More Elements to Check?:
    When an element has been processed, then the system checks if there are more elements remaining to be evaluated and continues processing if elements remain.
  • Context - elements have been marked for removal from the status array:
    For Shift Remaining Elements Up:
    When array compaction is required, then the system shifts all remaining elements upward to eliminate gaps and maintain array continuity.
  • Context - elements have been removed from the status array:
    For Decrement Array Counter:
    When array counter needs to be updated, then the system decrements the array counter by the number of elements removed.
  • Context - array elements have been shifted and counter updated:
    For Clear Empty Array Positions:
    When empty positions exist at the end of the array, then the system clears all unused array positions to initialize them to empty state.
  • Context - array compaction operations are in progress:
    For Array Compaction Complete?:
    When the system needs to verify completion, then the system checks if all elements have been properly shifted and all empty positions cleared.
  • Context - array compaction has been completed successfully:
    For Update Array Status:
    When final status update is required, then the system updates array metadata and status indicators to reflect the current state.
  • Context - a request to remove elements from the status array has been made:
    For No Elements Found to Remove:
    When no matching elements are found in the array, then the system completes the operation without making changes and indicates no elements were removed.
👨‍💻 Technical ACs (Gherkin)
Context: A status array contains multiple elements and a specific element needs to be removed
GIVEN
A status array contains multiple elements and a specific element needs to be removed
Applied to: Element Found in Array?
WHEN
The system searches through the array to find matching elements
THEN
The system identifies whether the target element exists in the array and marks its position for removal
Context: An element has been found in the status array
GIVEN
An element has been found in the status array
Applied to: Identify Element Position
WHEN
The system needs to track the element's location
THEN
The system records the array index position of the found element
Context: An element position has been identified in the status array
GIVEN
An element position has been identified in the status array
Applied to: Mark Element for Removal
WHEN
The element needs to be removed from the array
THEN
The system marks the element for removal while preserving array structure temporarily
Context: The system is processing elements in the status array for removal
GIVEN
The system is processing elements in the status array for removal
Applied to: More Elements to Check?
WHEN
An element has been processed
THEN
The system checks if there are more elements remaining to be evaluated and continues processing if elements remain
Context: Elements have been marked for removal from the status array
GIVEN
Elements have been marked for removal from the status array
Applied to: Shift Remaining Elements Up
WHEN
Array compaction is required
THEN
The system shifts all remaining elements upward to eliminate gaps and maintain array continuity
Context: Elements have been removed from the status array
GIVEN
Elements have been removed from the status array
Applied to: Decrement Array Counter
WHEN
Array counter needs to be updated
THEN
The system decrements the array counter by the number of elements removed
Context: Array elements have been shifted and counter updated
GIVEN
Array elements have been shifted and counter updated
Applied to: Clear Empty Array Positions
WHEN
Empty positions exist at the end of the array
THEN
The system clears all unused array positions to initialize them to empty state
Context: Array compaction operations are in progress
GIVEN
Array compaction operations are in progress
Applied to: Array Compaction Complete?
WHEN
The system needs to verify completion
THEN
The system checks if all elements have been properly shifted and all empty positions cleared
Context: Array compaction has been completed successfully
GIVEN
Array compaction has been completed successfully
Applied to: Update Array Status
WHEN
Final status update is required
THEN
The system updates array metadata and status indicators to reflect the current state
Context: A request to remove elements from the status array has been made
GIVEN
A request to remove elements from the status array has been made
Applied to: No Elements Found to Remove
WHEN
No matching elements are found in the array
THEN
The system completes the operation without making changes and indicates no elements were removed
R-GCX016-cbl-03174 (+9) File: GCX016.cbl Release Status Flag Management Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Status Flag Management':
  • Context - a status array element is being processed:
    For Release Code Processing:
    When the disposition code type is a release code, then the released flag must be set to 'y' in the status array element.
    For Hold Code Processing:
    When the disposition code type is a hold code, then the released flag must be set to 'n' in the status array element.
    For Information Code Processing:
    When the disposition code type is an information code, then the existing released flag value must be preserved without change.
  • Context - a disposition code is being processed for a status array element:
    For Released Flag Required?:
    When the system evaluates if a released flag is required, then if required, set released flag to 'y', otherwise preserve existing flag value.
  • Context - a new disposition code is being added to the status array:
    For Remove Counterpart Codes:
    When counterpart code removal is required, then all existing counterpart codes must be removed from the status array before adding the new code.
  • Context - a disposition code with quantity impact is being processed:
    For Process Release Quantities:
    When quantity action is required, then the system must process and update the release quantities for the cargo.
  • Context - a status array element has been processed with flag changes:
    For Validate Flag Consistency:
    When flag validation is performed, then all flags must be in a consistent and valid state, otherwise an error condition is raised.
  • Context - flag validation has passed for a status array element:
    For Update Status Array Element:
    When the status array element is ready for update, then the element must be updated with new flag values and disposition code information.
  • Context - a status array element has been successfully updated:
    For Log Flag Change:
    When flag changes have been applied, then all flag changes must be logged with appropriate audit information.
  • Context - flag validation is performed on a status array element:
    For Error - Invalid Flag State:
    When the validation fails due to invalid flag state, then an error condition must be raised and appropriate error handling must be invoked.
👨‍💻 Technical ACs (Gherkin)
Context: A status array element is being processed
GIVEN
A status array element is being processed
Applied to: Release Code Processing
WHEN
The disposition code type is a release code
THEN
The released flag must be set to 'Y' in the status array element
Applied to: Hold Code Processing
WHEN
The disposition code type is a hold code
THEN
The released flag must be set to 'N' in the status array element
Applied to: Information Code Processing
WHEN
The disposition code type is an information code
THEN
The existing released flag value must be preserved without change
Context: A disposition code is being processed for a status array element
GIVEN
A disposition code is being processed for a status array element
Applied to: Released Flag Required?
WHEN
The system evaluates if a released flag is required
THEN
If required, set released flag to 'Y', otherwise preserve existing flag value
Context: A new disposition code is being added to the status array
GIVEN
A new disposition code is being added to the status array
Applied to: Remove Counterpart Codes
WHEN
Counterpart code removal is required
THEN
All existing counterpart codes must be removed from the status array before adding the new code
Context: A disposition code with quantity impact is being processed
GIVEN
A disposition code with quantity impact is being processed
Applied to: Process Release Quantities
WHEN
Quantity action is required
THEN
The system must process and update the release quantities for the cargo
Context: A status array element has been processed with flag changes
GIVEN
A status array element has been processed with flag changes
Applied to: Validate Flag Consistency
WHEN
Flag validation is performed
THEN
All flags must be in a consistent and valid state, otherwise an error condition is raised
Context: Flag validation has passed for a status array element
GIVEN
Flag validation has passed for a status array element
Applied to: Update Status Array Element
WHEN
The status array element is ready for update
THEN
The element must be updated with new flag values and disposition code information
Context: A status array element has been successfully updated
GIVEN
A status array element has been successfully updated
Applied to: Log Flag Change
WHEN
Flag changes have been applied
THEN
All flag changes must be logged with appropriate audit information
Context: Flag validation is performed on a status array element
GIVEN
Flag validation is performed on a status array element
Applied to: Error - Invalid Flag State
WHEN
The validation fails due to invalid flag state
THEN
An error condition must be raised and appropriate error handling must be invoked
R-GCX016-cbl-03184 (+12) File: GCX016.cbl Status Information Message Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Information Message Processing':
  • Context - a disposition code is being processed in the cargo system:
    For Check DC-STATUS-INFO Flag:
    When the system evaluates the disposition code type against the dc-status-info flag, then the system determines if the code should be processed as status information only.
  • Context - a disposition code has been identified as potentially status information type:
    For Is Status Info Code?:
    When the system checks if the code meets status information criteria, then the system either proceeds with status information processing or routes to alternative processing.
  • Context - a status information code is ready to be added to the cargo status array:
    For Check for Duplicate in S09A Array:
    When the system searches the s09a array for existing identical status information entries, then the system identifies whether the status information already exists to prevent duplication.
  • Context - the system has checked for duplicate status information in the s09a array:
    For Already Exists?:
    When the duplicate check result indicates whether the status information already exists, then the system either skips processing to prevent duplication or proceeds with adding the new status information.
  • Context - a status information code already exists in the s09a array:
    For Skip Processing - Prevent Duplicate:
    When the system attempts to add the same status information again, then the system skips the processing to prevent duplicate entries and continues to the next disposition code.
  • Context - a valid status information code does not exist in the s09a array:
    For Add Status Info to S09A Array:
    When the system processes the status information for addition, then the system adds the status information to the next available position in the s09a array.
  • Context - a status information entry is being added to the s09a array:
    For Set Status Information Fields:
    When the system sets the status information fields, then the system populates the disposition code, description, and informational flags for the status entry.
  • Context - a status information entry is being populated in the s09a array:
    For Set DC-STATUS-INFO-CD:
    When the system sets the dc-status-info-cd field, then the system assigns the current disposition code value to the status information code field.
    For Set DC-STATUS-INFO-DESC:
    When the system sets the dc-status-info-desc field, then the system assigns the disposition code description to the status information description field.
  • Context - a status information entry is being configured in the s09a array:
    For Mark as Informational Only:
    When the system marks the entry as informational only, then the system sets the appropriate flag to indicate this status does not trigger cargo actions.
  • Context - a status information code is being processed:
    For Do Not Affect Quantities:
    When the system evaluates quantity impact requirements, then the system ensures the status information does not modify cargo release quantities or total quantities.
  • Context - a status information entry has been successfully added to the s09a array:
    For Update Array Element Count:
    When the system updates the array management counters, then the system increments the array element count to reflect the new entry.
  • Context - a status information entry has been successfully added to the cargo status array:
    For Log Status Information Added:
    When the system performs logging operations, then the system creates an audit log entry documenting the status information addition with relevant details.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed in the cargo system
GIVEN
A disposition code is being processed in the cargo system
Applied to: Check DC-STATUS-INFO Flag
WHEN
The system evaluates the disposition code type against the DC-STATUS-INFO flag
THEN
The system determines if the code should be processed as status information only
Context: A disposition code has been identified as potentially status information type
GIVEN
A disposition code has been identified as potentially status information type
Applied to: Is Status Info Code?
WHEN
The system checks if the code meets status information criteria
THEN
The system either proceeds with status information processing or routes to alternative processing
Context: A status information code is ready to be added to the cargo status array
GIVEN
A status information code is ready to be added to the cargo status array
Applied to: Check for Duplicate in S09A Array
WHEN
The system searches the S09A array for existing identical status information entries
THEN
The system identifies whether the status information already exists to prevent duplication
Context: The system has checked for duplicate status information in the S09A array
GIVEN
The system has checked for duplicate status information in the S09A array
Applied to: Already Exists?
WHEN
The duplicate check result indicates whether the status information already exists
THEN
The system either skips processing to prevent duplication or proceeds with adding the new status information
Context: A status information code already exists in the S09A array
GIVEN
A status information code already exists in the S09A array
Applied to: Skip Processing - Prevent Duplicate
WHEN
The system attempts to add the same status information again
THEN
The system skips the processing to prevent duplicate entries and continues to the next disposition code
Context: A valid status information code does not exist in the S09A array
GIVEN
A valid status information code does not exist in the S09A array
Applied to: Add Status Info to S09A Array
WHEN
The system processes the status information for addition
THEN
The system adds the status information to the next available position in the S09A array
Context: A status information entry is being added to the S09A array
GIVEN
A status information entry is being added to the S09A array
Applied to: Set Status Information Fields
WHEN
The system sets the status information fields
THEN
The system populates the disposition code, description, and informational flags for the status entry
Context: A status information entry is being populated in the S09A array
GIVEN
A status information entry is being populated in the S09A array
Applied to: Set DC-STATUS-INFO-CD
WHEN
The system sets the DC-STATUS-INFO-CD field
THEN
The system assigns the current disposition code value to the status information code field
Applied to: Set DC-STATUS-INFO-DESC
WHEN
The system sets the DC-STATUS-INFO-DESC field
THEN
The system assigns the disposition code description to the status information description field
Context: A status information entry is being configured in the S09A array
GIVEN
A status information entry is being configured in the S09A array
Applied to: Mark as Informational Only
WHEN
The system marks the entry as informational only
THEN
The system sets the appropriate flag to indicate this status does not trigger cargo actions
Context: A status information code is being processed
GIVEN
A status information code is being processed
Applied to: Do Not Affect Quantities
WHEN
The system evaluates quantity impact requirements
THEN
The system ensures the status information does not modify cargo release quantities or total quantities
Context: A status information entry has been successfully added to the S09A array
GIVEN
A status information entry has been successfully added to the S09A array
Applied to: Update Array Element Count
WHEN
The system updates the array management counters
THEN
The system increments the array element count to reflect the new entry
Context: A status information entry has been successfully added to the cargo status array
GIVEN
A status information entry has been successfully added to the cargo status array
Applied to: Log Status Information Added
WHEN
The system performs logging operations
THEN
The system creates an audit log entry documenting the status information addition with relevant details
R-GCX016-cbl-03197 (+7) File: GCX016.cbl Cargo Hold Location Determination Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Hold Location Determination':
  • Context - a cargo record with populated s09a status array containing disposition codes:
    For Border Hold Code Found?:
    When the system scans through all status entries in the array for border hold codes, then the border hold flag is set to true if any border hold disposition codes are found, otherwise it remains false.
    For Destination Hold Code Found?:
    When the system scans through all status entries in the array for destination hold codes, then the destination hold flag is set to true if any destination hold disposition codes are found, otherwise it remains false.
  • Context - a cargo record with border hold flag and destination hold flag both evaluated:
    For Both Border and Destination Holds?:
    When both border hold flag and destination hold flag are set to true, then the cargo hold status is set to indicate holds at both border and destination locations.
  • Context - a cargo record with border hold flag set to true and destination hold flag set to false:
    For Only Border Hold?:
    When the system evaluates hold location flags and finds only border hold is active, then the cargo hold status is set to border hold only.
  • Context - a cargo record with destination hold flag set to true and border hold flag set to false:
    For Only Destination Hold?:
    When the system evaluates hold location flags and finds only destination hold is active, then the cargo hold status is set to destination hold only.
  • Context - a cargo record with destination hold status and fda-related disposition codes in the status array:
    For FDA Hold at Destination?:
    When the system checks for fda hold codes (a3 disposition codes) in the destination hold context, then the fda destination hold flag is set if fda hold codes are present at destination.
  • Context - a cargo record with both border hold flag and destination hold flag set to false:
    For Set No Hold Status:
    When the system evaluates hold location flags and finds no active holds, then the cargo hold status is set to indicate no holds are active.
  • Context - a cargo record with s09a status array containing multiple disposition code entries:
    For Analyze S09A Status Array:
    When the system processes each status entry to identify hold codes and their associated locations, then hold flags are populated based on the disposition codes found and their location indicators.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with populated S09A status array containing disposition codes
GIVEN
A cargo record with populated S09A status array containing disposition codes
Applied to: Border Hold Code Found?
WHEN
The system scans through all status entries in the array for border hold codes
THEN
The border hold flag is set to true if any border hold disposition codes are found, otherwise it remains false
Applied to: Destination Hold Code Found?
WHEN
The system scans through all status entries in the array for destination hold codes
THEN
The destination hold flag is set to true if any destination hold disposition codes are found, otherwise it remains false
Context: A cargo record with border hold flag and destination hold flag both evaluated
GIVEN
A cargo record with border hold flag and destination hold flag both evaluated
Applied to: Both Border and Destination Holds?
WHEN
Both border hold flag and destination hold flag are set to true
THEN
The cargo hold status is set to indicate holds at both border and destination locations
Context: A cargo record with border hold flag set to true and destination hold flag set to false
GIVEN
A cargo record with border hold flag set to true and destination hold flag set to false
Applied to: Only Border Hold?
WHEN
The system evaluates hold location flags and finds only border hold is active
THEN
The cargo hold status is set to border hold only
Context: A cargo record with destination hold flag set to true and border hold flag set to false
GIVEN
A cargo record with destination hold flag set to true and border hold flag set to false
Applied to: Only Destination Hold?
WHEN
The system evaluates hold location flags and finds only destination hold is active
THEN
The cargo hold status is set to destination hold only
Context: A cargo record with destination hold status and FDA-related disposition codes in the status array
GIVEN
A cargo record with destination hold status and FDA-related disposition codes in the status array
Applied to: FDA Hold at Destination?
WHEN
The system checks for FDA hold codes (A3 disposition codes) in the destination hold context
THEN
The FDA destination hold flag is set if FDA hold codes are present at destination
Context: A cargo record with both border hold flag and destination hold flag set to false
GIVEN
A cargo record with both border hold flag and destination hold flag set to false
Applied to: Set No Hold Status
WHEN
The system evaluates hold location flags and finds no active holds
THEN
The cargo hold status is set to indicate no holds are active
Context: A cargo record with S09A status array containing multiple disposition code entries
GIVEN
A cargo record with S09A status array containing multiple disposition code entries
Applied to: Analyze S09A Status Array
WHEN
The system processes each status entry to identify hold codes and their associated locations
THEN
Hold flags are populated based on the disposition codes found and their location indicators
R-GCX016-cbl-03205 (+9) File: GCX016.cbl Cargo Status Transition Management Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Transition Management':
  • Context - a cargo record is being processed for status transition:
    For Manual Release Required?:
    When the cargo has a manual release flag set (ws-mrl-found is true), then the system clears the destination index and processes canadian manifest coordination.
  • Context - a cargo record is being evaluated for status assignment:
    For FDA Hold at Destination?:
    When the cargo has destination hold conditions and a3 disposition codes are present, then the system sets fda hold status with specific fda codes.
  • Context - a cargo record is being processed for status determination:
    For PTT Status Required?:
    When the cargo meets ptt quantity requirements and has appropriate disposition codes, then the system validates ptt quantity requirements and saves/restores ptt status accordingly.
  • Context - a cargo record with release quantity information:
    For Partial Release Scenario?:
    When the released quantity is less than the total cargo quantity, then the system sets hold on piece counts status to indicate partial release.
    For Full Release Conditions Met?:
    When the released quantity is greater than or equal to the total cargo quantity, then the system clears the destination index and processes full release.
  • Context - a cargo record that was previously in released status:
    For Cargo Previously Released but Now Unreleased?:
    When the cargo status changes from released to unreleased state, then the system generates unrelease notifications and detects status change requirements.
  • Context - a cargo record being processed for status transition:
    For Arrival Status Required?:
    When the cargo requires arrival status based on location and movement conditions, then the system sets arrival status and updates the border arrival date.
  • Context - a cargo record being evaluated for export processing:
    For Export Status Required?:
    When the cargo meets export status requirements based on disposition codes and location, then the system sets export status and clears the destination index.
  • Context - a cargo record with hold requirements:
    For Hold Location Determination Required?:
    When the system needs to determine the appropriate hold location, then the system determines border versus destination hold and sets appropriate hold status.
  • Context - a cargo record requiring destination index updates:
    For Destination Index Re-establishment Required?:
    When the cargo status transition requires destination index re-establishment, then the system calculates cargo age using julian dates, re-establishes rt076 destination index, and updates bond date management.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for status transition
GIVEN
A cargo record is being processed for status transition
Applied to: Manual Release Required?
WHEN
The cargo has a manual release flag set (WS-MRL-FOUND is true)
THEN
The system clears the destination index and processes Canadian manifest coordination
Context: A cargo record is being evaluated for status assignment
GIVEN
A cargo record is being evaluated for status assignment
Applied to: FDA Hold at Destination?
WHEN
The cargo has destination hold conditions AND A3 disposition codes are present
THEN
The system sets FDA hold status with specific FDA codes
Context: A cargo record is being processed for status determination
GIVEN
A cargo record is being processed for status determination
Applied to: PTT Status Required?
WHEN
The cargo meets PTT quantity requirements AND has appropriate disposition codes
THEN
The system validates PTT quantity requirements and saves/restores PTT status accordingly
Context: A cargo record with release quantity information
GIVEN
A cargo record with release quantity information
Applied to: Partial Release Scenario?
WHEN
The released quantity is less than the total cargo quantity
THEN
The system sets hold on piece counts status to indicate partial release
Applied to: Full Release Conditions Met?
WHEN
The released quantity is greater than or equal to the total cargo quantity
THEN
The system clears the destination index and processes full release
Context: A cargo record that was previously in released status
GIVEN
A cargo record that was previously in released status
Applied to: Cargo Previously Released but Now Unreleased?
WHEN
The cargo status changes from released to unreleased state
THEN
The system generates unrelease notifications and detects status change requirements
Context: A cargo record being processed for status transition
GIVEN
A cargo record being processed for status transition
Applied to: Arrival Status Required?
WHEN
The cargo requires arrival status based on location and movement conditions
THEN
The system sets arrival status and updates the border arrival date
Context: A cargo record being evaluated for export processing
GIVEN
A cargo record being evaluated for export processing
Applied to: Export Status Required?
WHEN
The cargo meets export status requirements based on disposition codes and location
THEN
The system sets export status and clears the destination index
Context: A cargo record with hold requirements
GIVEN
A cargo record with hold requirements
Applied to: Hold Location Determination Required?
WHEN
The system needs to determine the appropriate hold location
THEN
The system determines border versus destination hold and sets appropriate hold status
Context: A cargo record requiring destination index updates
GIVEN
A cargo record requiring destination index updates
Applied to: Destination Index Re-establishment Required?
WHEN
The cargo status transition requires destination index re-establishment
THEN
The system calculates cargo age using Julian dates, re-establishes RT076 destination index, and updates bond date management
R-GCX016-cbl-03258 (+9) File: GCX016.cbl Partial Release Hold Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Partial Release Hold Processing':
  • Context - cargo status analysis is complete and release quantities are available:
    For Compare Released Qty vs Total Qty:
    When the system compares released quantity with total quantity, then the comparison result determines whether partial release processing is required.
  • Context - released quantity and total quantity values are available for comparison:
    For Released Qty < Total Qty?:
    When the released quantity is less than the total quantity, then the system identifies this as a partial release scenario requiring hold processing.
  • Context - released quantity is confirmed to be less than total quantity:
    For Identify Partial Release Scenario:
    When the system processes the partial release condition, then the cargo is identified as a partial release scenario requiring special hold status.
  • Context - cargo has been identified as a partial release scenario:
    For Set Hold on Piece Counts Status:
    When the system sets the cargo status, then the cargo status is set to hold on piece counts to indicate partial release condition.
  • Context - hold on piece counts status has been determined for partial release cargo:
    For Update Cargo Status Array:
    When the system updates the cargo status array, then the status array is updated with the partial release hold information.
  • Context - cargo status array has been updated with partial release hold status:
    For Log Partial Release Information:
    When the system logs the partial release information, then partial release details including quantities and hold status are recorded in the system log.
  • Context - cargo has partial release hold status and logging is complete:
    For Maintain Destination Index:
    When the system maintains destination routing information, then the destination index is preserved to ensure proper cargo routing despite partial hold status.
  • Context - destination index is maintained and partial release hold status is confirmed:
    For Generate Hold Message with Piece Count Details:
    When the system generates a hold message, then a hold message is created with specific piece count details indicating the partial release quantities.
  • Context - hold message with piece count details has been generated:
    For Update Cargo Record with Partial Hold Status:
    When the system updates the cargo record, then the cargo record is updated with partial hold status and all associated partial release information.
  • Context - released quantity and total quantity have been compared:
    For Full Release Processing Path:
    When the released quantity is greater than or equal to the total quantity, then the cargo follows the full release processing path without partial hold restrictions.
👨‍💻 Technical ACs (Gherkin)
Context: Cargo status analysis is complete and release quantities are available
GIVEN
Cargo status analysis is complete and release quantities are available
Applied to: Compare Released Qty vs Total Qty
WHEN
The system compares released quantity with total quantity
THEN
The comparison result determines whether partial release processing is required
Context: Released quantity and total quantity values are available for comparison
GIVEN
Released quantity and total quantity values are available for comparison
Applied to: Released Qty < Total Qty?
WHEN
The released quantity is less than the total quantity
THEN
The system identifies this as a partial release scenario requiring hold processing
Context: Released quantity is confirmed to be less than total quantity
GIVEN
Released quantity is confirmed to be less than total quantity
Applied to: Identify Partial Release Scenario
WHEN
The system processes the partial release condition
THEN
The cargo is identified as a partial release scenario requiring special hold status
Context: Cargo has been identified as a partial release scenario
GIVEN
Cargo has been identified as a partial release scenario
Applied to: Set Hold on Piece Counts Status
WHEN
The system sets the cargo status
THEN
The cargo status is set to hold on piece counts to indicate partial release condition
Context: Hold on piece counts status has been determined for partial release cargo
GIVEN
Hold on piece counts status has been determined for partial release cargo
Applied to: Update Cargo Status Array
WHEN
The system updates the cargo status array
THEN
The status array is updated with the partial release hold information
Context: Cargo status array has been updated with partial release hold status
GIVEN
Cargo status array has been updated with partial release hold status
Applied to: Log Partial Release Information
WHEN
The system logs the partial release information
THEN
Partial release details including quantities and hold status are recorded in the system log
Context: Cargo has partial release hold status and logging is complete
GIVEN
Cargo has partial release hold status and logging is complete
Applied to: Maintain Destination Index
WHEN
The system maintains destination routing information
THEN
The destination index is preserved to ensure proper cargo routing despite partial hold status
Context: Destination index is maintained and partial release hold status is confirmed
GIVEN
Destination index is maintained and partial release hold status is confirmed
Applied to: Generate Hold Message with Piece Count Details
WHEN
The system generates a hold message
THEN
A hold message is created with specific piece count details indicating the partial release quantities
Context: Hold message with piece count details has been generated
GIVEN
Hold message with piece count details has been generated
Applied to: Update Cargo Record with Partial Hold Status
WHEN
The system updates the cargo record
THEN
The cargo record is updated with partial hold status and all associated partial release information
Context: Released quantity and total quantity have been compared
GIVEN
Released quantity and total quantity have been compared
Applied to: Full Release Processing Path
WHEN
The released quantity is greater than or equal to the total quantity
THEN
The cargo follows the full release processing path without partial hold restrictions
R-GCX016-cbl-03268 (+13) File: GCX016.cbl Full Release Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Full Release Processing':
  • Context - a cargo record with total quantity and released quantity values:
    For Check Released Quantity vs Total Quantity:
    When the system evaluates release eligibility, then if released quantity equals or exceeds total quantity, cargo is eligible for full release, otherwise process as partial release.
  • Context - cargo that has been determined eligible for full release:
    For Set Released Status Flag:
    When the system processes the full release, then the released status flag is set to indicate full release status.
  • Context - cargo that has achieved full release status:
    For Clear Destination Index RT076:
    When the system processes the destination index update, then the rt076 destination index is cleared to remove routing restrictions.
  • Context - cargo that has been fully released:
    For Canadian Manifest Coordination Required?:
    When the system evaluates canadian manifest coordination requirements, then if cargo requires canadian manifest coordination, proceed to find matching manifests, otherwise proceed directly to status update.
  • Context - fully released cargo that requires canadian manifest coordination:
    For Find Matching Canadian Manifests:
    When the system searches for matching canadian manifests, then all corresponding canadian manifest records are identified and retrieved.
  • Context - matching canadian manifest records for released cargo:
    For Generate Canadian Release Log Messages:
    When the system processes canadian manifest coordination, then release log messages are generated for canadian manifest tracking.
  • Context - cargo that has completed full release processing:
    For Update Cargo Status to Released:
    When the system updates the cargo status, then the cargo status is set to released state.
  • Context - cargo that has been updated to released status:
    For Set Release Date:
    When the system processes the release date assignment, then the current date and time is recorded as the release date.
  • Context - cargo that has been set to released status with release date:
    For Clear Hold Status Flags:
    When the system processes hold status flag updates, then all hold status flags are cleared to remove cargo restrictions.
  • Context - cargo with updated release status, release date, and cleared hold flags:
    For Update Cargo Record in Database:
    When the system saves the cargo record, then all cargo release changes are persisted to the database.
  • Context - cargo that has been successfully updated in the database as released:
    For Generate Release Notification Messages:
    When the system processes release notifications, then release notification messages are generated for relevant stakeholders.
  • Context - cargo with generated release notification messages:
    For Call Integration Services for Release:
    When the system calls integration services, then external integration services are invoked to complete the release processing workflow.
  • Context - cargo where released quantity does not match total quantity:
    For Partial Release Scenario?:
    When the system evaluates release processing type, then if cargo qualifies for partial release processing, route to partial release workflow, otherwise continue with full release.
  • Context - cargo that has been identified for partial release processing:
    For Process as Partial Release Instead:
    When the system redirects to partial release workflow, then cargo is processed through the partial release workflow instead of full release.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with total quantity and released quantity values
GIVEN
A cargo record with total quantity and released quantity values
Applied to: Check Released Quantity vs Total Quantity
WHEN
The system evaluates release eligibility
THEN
If released quantity equals or exceeds total quantity, cargo is eligible for full release, otherwise process as partial release
Context: Cargo that has been determined eligible for full release
GIVEN
Cargo that has been determined eligible for full release
Applied to: Set Released Status Flag
WHEN
The system processes the full release
THEN
The released status flag is set to indicate full release status
Context: Cargo that has achieved full release status
GIVEN
Cargo that has achieved full release status
Applied to: Clear Destination Index RT076
WHEN
The system processes the destination index update
THEN
The RT076 destination index is cleared to remove routing restrictions
Context: Cargo that has been fully released
GIVEN
Cargo that has been fully released
Applied to: Canadian Manifest Coordination Required?
WHEN
The system evaluates Canadian manifest coordination requirements
THEN
If cargo requires Canadian manifest coordination, proceed to find matching manifests, otherwise proceed directly to status update
Context: Fully released cargo that requires Canadian manifest coordination
GIVEN
Fully released cargo that requires Canadian manifest coordination
Applied to: Find Matching Canadian Manifests
WHEN
The system searches for matching Canadian manifests
THEN
All corresponding Canadian manifest records are identified and retrieved
Context: Matching Canadian manifest records for released cargo
GIVEN
Matching Canadian manifest records for released cargo
Applied to: Generate Canadian Release Log Messages
WHEN
The system processes Canadian manifest coordination
THEN
Release log messages are generated for Canadian manifest tracking
Context: Cargo that has completed full release processing
GIVEN
Cargo that has completed full release processing
Applied to: Update Cargo Status to Released
WHEN
The system updates the cargo status
THEN
The cargo status is set to released state
Context: Cargo that has been updated to released status
GIVEN
Cargo that has been updated to released status
Applied to: Set Release Date
WHEN
The system processes the release date assignment
THEN
The current date and time is recorded as the release date
Context: Cargo that has been set to released status with release date
GIVEN
Cargo that has been set to released status with release date
Applied to: Clear Hold Status Flags
WHEN
The system processes hold status flag updates
THEN
All hold status flags are cleared to remove cargo restrictions
Context: Cargo with updated release status, release date, and cleared hold flags
GIVEN
Cargo with updated release status, release date, and cleared hold flags
Applied to: Update Cargo Record in Database
WHEN
The system saves the cargo record
THEN
All cargo release changes are persisted to the database
Context: Cargo that has been successfully updated in the database as released
GIVEN
Cargo that has been successfully updated in the database as released
Applied to: Generate Release Notification Messages
WHEN
The system processes release notifications
THEN
Release notification messages are generated for relevant stakeholders
Context: Cargo with generated release notification messages
GIVEN
Cargo with generated release notification messages
Applied to: Call Integration Services for Release
WHEN
The system calls integration services
THEN
External integration services are invoked to complete the release processing workflow
Context: Cargo where released quantity does not match total quantity
GIVEN
Cargo where released quantity does not match total quantity
Applied to: Partial Release Scenario?
WHEN
The system evaluates release processing type
THEN
If cargo qualifies for partial release processing, route to partial release workflow, otherwise continue with full release
Context: Cargo that has been identified for partial release processing
GIVEN
Cargo that has been identified for partial release processing
Applied to: Process as Partial Release Instead
WHEN
The system redirects to partial release workflow
THEN
Cargo is processed through the partial release workflow instead of full release
R-GCX016-cbl-03282 (+11) File: GCX016.cbl Cargo Unrelease Detection and Notification Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Unrelease Detection and Notification':
  • Context - a cargo record exists with status history in the s09a status array:
    For Check Previous Release Status:
    When the system analyzes the status array for previous release indicators, then the system identifies if cargo was previously released based on status codes and release quantities.
  • Context - current disposition codes are available from the x4 segment:
    For Analyze Current Disposition Codes:
    When the system processes disposition codes against the dc table, then the system determines if current codes indicate an unrelease action.
  • Context - cargo has previous release status and current disposition codes are processed:
    For Previously Released Cargo Now Unreleased?:
    When the system compares release quantities and status flags between previous and current state, then the system sets unrelease detection flag if cargo was released but is now unreleased.
  • Context - cargo unrelease condition has been detected:
    For Set Unrelease Status Flag:
    When the system processes the unrelease detection result, then the system sets the unrelease status flag to trigger notification processing.
  • Context - cargo unrelease has been detected and broker information exists in cargo record:
    For Determine Notification Recipients:
    When the system retrieves broker details and payer of freight information, then the system identifies all parties requiring unrelease notification based on cargo ownership and broker relationships.
  • Context - cargo unrelease detected and notification recipients identified:
    For Generate Unrelease Notification Message:
    When the system formats the unrelease notification message, then the system creates message with cargo details, disposition codes, and unrelease information.
  • Context - unrelease notification message is prepared and broker recipients are identified:
    For Route Message to Brokers:
    When the system routes the message to brokers, then the system sends notification via merlin messaging system to broker destinations.
  • Context - unrelease notification message is prepared and payer of freight is identified and payer of freight is different from broker:
    For Route Message to Payer of Freight:
    When the system routes the message to payer of freight, then the system sends notification via appropriate messaging channel to payer of freight.
  • Context - cargo unrelease has been processed and notifications have been sent:
    For Log Unrelease Event:
    When the system logs the unrelease event, then the system creates audit record with cargo ccn, unrelease details, timestamp, and notification recipients.
  • Context - cargo unrelease event has been logged:
    For Update Cargo Status Records:
    When the system updates cargo status records, then the system modifies cargo status, updates s09 segments, and sets appropriate status descriptions.
  • Context - cargo status records have been updated for unrelease:
    For Clear Previous Release Quantities:
    When the system processes release quantity adjustments, then the system clears or reduces release quantities to reflect unreleased status.
  • Context - cargo release quantities have been cleared and cargo requires hold status:
    For Restore Hold Status if Required:
    When the system determines appropriate hold status based on disposition codes, then the system sets border hold, destination hold, or other appropriate hold status based on cargo location and disposition.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with status history in the S09A status array
GIVEN
A cargo record exists with status history in the S09A status array
Applied to: Check Previous Release Status
WHEN
The system analyzes the status array for previous release indicators
THEN
The system identifies if cargo was previously released based on status codes and release quantities
Context: Current disposition codes are available from the X4 segment
GIVEN
Current disposition codes are available from the X4 segment
Applied to: Analyze Current Disposition Codes
WHEN
The system processes disposition codes against the DC table
THEN
The system determines if current codes indicate an unrelease action
Context: Cargo has previous release status AND current disposition codes are processed
GIVEN
Cargo has previous release status AND current disposition codes are processed
Applied to: Previously Released Cargo Now Unreleased?
WHEN
The system compares release quantities and status flags between previous and current state
THEN
The system sets unrelease detection flag if cargo was released but is now unreleased
Context: Cargo unrelease condition has been detected
GIVEN
Cargo unrelease condition has been detected
Applied to: Set Unrelease Status Flag
WHEN
The system processes the unrelease detection result
THEN
The system sets the unrelease status flag to trigger notification processing
Context: Cargo unrelease has been detected AND broker information exists in cargo record
GIVEN
Cargo unrelease has been detected AND broker information exists in cargo record
Applied to: Determine Notification Recipients
WHEN
The system retrieves broker details and payer of freight information
THEN
The system identifies all parties requiring unrelease notification based on cargo ownership and broker relationships
Context: Cargo unrelease detected AND notification recipients identified
GIVEN
Cargo unrelease detected AND notification recipients identified
Applied to: Generate Unrelease Notification Message
WHEN
The system formats the unrelease notification message
THEN
The system creates message with cargo details, disposition codes, and unrelease information
Context: Unrelease notification message is prepared AND broker recipients are identified
GIVEN
Unrelease notification message is prepared AND broker recipients are identified
Applied to: Route Message to Brokers
WHEN
The system routes the message to brokers
THEN
The system sends notification via Merlin messaging system to broker destinations
Context: Unrelease notification message is prepared AND payer of freight is identified AND payer of freight is different from broker
GIVEN
Unrelease notification message is prepared AND payer of freight is identified AND payer of freight is different from broker
Applied to: Route Message to Payer of Freight
WHEN
The system routes the message to payer of freight
THEN
The system sends notification via appropriate messaging channel to payer of freight
Context: Cargo unrelease has been processed AND notifications have been sent
GIVEN
Cargo unrelease has been processed AND notifications have been sent
Applied to: Log Unrelease Event
WHEN
The system logs the unrelease event
THEN
The system creates audit record with cargo CCN, unrelease details, timestamp, and notification recipients
Context: Cargo unrelease event has been logged
GIVEN
Cargo unrelease event has been logged
Applied to: Update Cargo Status Records
WHEN
The system updates cargo status records
THEN
The system modifies cargo status, updates S09 segments, and sets appropriate status descriptions
Context: Cargo status records have been updated for unrelease
GIVEN
Cargo status records have been updated for unrelease
Applied to: Clear Previous Release Quantities
WHEN
The system processes release quantity adjustments
THEN
The system clears or reduces release quantities to reflect unreleased status
Context: Cargo release quantities have been cleared AND cargo requires hold status
GIVEN
Cargo release quantities have been cleared AND cargo requires hold status
Applied to: Restore Hold Status if Required
WHEN
The system determines appropriate hold status based on disposition codes
THEN
The system sets border hold, destination hold, or other appropriate hold status based on cargo location and disposition
R-GCX016-cbl-03303 (+11) File: GCX016.cbl Age Calculation for Cargo Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Age Calculation for Cargo':
  • Context - the system is processing cargo age calculation:
    For Get Current System Date:
    When the age calculation process is initiated, then the current system date is retrieved and stored for comparison with bond start date.
  • Context - a cargo record exists with bond information:
    For Retrieve Cargo Bond Start Date:
    When age calculation is requested for the cargo, then the bond start date is retrieved from the cargo record.
  • Context - a cargo record is being processed for age calculation:
    For Bond Start Date Available?:
    When the bond start date field is evaluated, then if bond start date is present and valid, proceed with julian conversion, otherwise use default age value.
  • Context - a valid bond start date exists in the cargo record:
    For Convert Bond Start Date to Julian Format:
    When age calculation requires julian date format, then the bond start date is converted to julian format using date conversion utilities.
  • Context - the current system date has been retrieved:
    For Convert Current Date to Julian Format:
    When age calculation requires julian date format for comparison, then the current date is converted to julian format using date conversion utilities.
  • Context - both current date and bond start date are in julian format:
    For Calculate Age in Days:
    When age calculation is performed, then age in days equals current julian date minus bond start julian date.
  • Context - an age calculation has been performed:
    For Age Calculation Valid?:
    When the calculated age value is evaluated, then if age is valid and within business parameters, use calculated value, otherwise log error and use default.
  • Context - a valid cargo age has been calculated:
    For Set Cargo Age for Destination Indexing:
    When the age value needs to be stored for destination processing, then the calculated age is assigned to the cargo record for rt076 destination index processing.
  • Context - cargo age has been calculated and validated:
    For Update Cargo Record with Age Information:
    When the cargo record needs to be updated with age information, then the cargo record is updated with the calculated age value.
  • Context - cargo age has been calculated and stored in the cargo record:
    For Use Age for RT076 Destination Index Processing:
    When rt076 destination index processing is required, then the cargo age is used as input for destination index determination and routing decisions.
  • Context - bond start date is missing or invalid in the cargo record:
    For Set Default Age Value:
    When age calculation cannot be performed with actual dates, then a default age value is assigned to allow processing to continue.
  • Context - age calculation has failed due to invalid data or calculation error:
    For Log Age Calculation Error:
    When error handling is required, then error information is logged and default age processing is initiated.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing cargo age calculation
GIVEN
The system is processing cargo age calculation
Applied to: Get Current System Date
WHEN
The age calculation process is initiated
THEN
The current system date is retrieved and stored for comparison with bond start date
Context: A cargo record exists with bond information
GIVEN
A cargo record exists with bond information
Applied to: Retrieve Cargo Bond Start Date
WHEN
Age calculation is requested for the cargo
THEN
The bond start date is retrieved from the cargo record
Context: A cargo record is being processed for age calculation
GIVEN
A cargo record is being processed for age calculation
Applied to: Bond Start Date Available?
WHEN
The bond start date field is evaluated
THEN
If bond start date is present and valid, proceed with Julian conversion, otherwise use default age value
Context: A valid bond start date exists in the cargo record
GIVEN
A valid bond start date exists in the cargo record
Applied to: Convert Bond Start Date to Julian Format
WHEN
Age calculation requires Julian date format
THEN
The bond start date is converted to Julian format using date conversion utilities
Context: The current system date has been retrieved
GIVEN
The current system date has been retrieved
Applied to: Convert Current Date to Julian Format
WHEN
Age calculation requires Julian date format for comparison
THEN
The current date is converted to Julian format using date conversion utilities
Context: Both current date and bond start date are in Julian format
GIVEN
Both current date and bond start date are in Julian format
Applied to: Calculate Age in Days
WHEN
Age calculation is performed
THEN
Age in days equals current Julian date minus bond start Julian date
Context: An age calculation has been performed
GIVEN
An age calculation has been performed
Applied to: Age Calculation Valid?
WHEN
The calculated age value is evaluated
THEN
If age is valid and within business parameters, use calculated value, otherwise log error and use default
Context: A valid cargo age has been calculated
GIVEN
A valid cargo age has been calculated
Applied to: Set Cargo Age for Destination Indexing
WHEN
The age value needs to be stored for destination processing
THEN
The calculated age is assigned to the cargo record for RT076 destination index processing
Context: Cargo age has been calculated and validated
GIVEN
Cargo age has been calculated and validated
Applied to: Update Cargo Record with Age Information
WHEN
The cargo record needs to be updated with age information
THEN
The cargo record is updated with the calculated age value
Context: Cargo age has been calculated and stored in the cargo record
GIVEN
Cargo age has been calculated and stored in the cargo record
Applied to: Use Age for RT076 Destination Index Processing
WHEN
RT076 destination index processing is required
THEN
The cargo age is used as input for destination index determination and routing decisions
Context: Bond start date is missing or invalid in the cargo record
GIVEN
Bond start date is missing or invalid in the cargo record
Applied to: Set Default Age Value
WHEN
Age calculation cannot be performed with actual dates
THEN
A default age value is assigned to allow processing to continue
Context: Age calculation has failed due to invalid data or calculation error
GIVEN
Age calculation has failed due to invalid data or calculation error
Applied to: Log Age Calculation Error
WHEN
Error handling is required
THEN
Error information is logged and default age processing is initiated
R-GCX016-cbl-03315 (+13) File: GCX016.cbl Cargo Record Integration Service Calls Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Record Integration Service Calls':
  • Context - a cargo record exists with current status and previous status information:
    For Cargo Status Changed?:
    When the system compares current cargo status with previous cargo status, then integration service processing continues if status has changed, otherwise processing ends.
  • Context - a cargo record with equipment type information from gcsuss05:
    For Valid Container Type?:
    When the system checks if equipment type is container or trailer, then integration processing continues for valid container/trailer types, otherwise processing ends.
  • Context - a cargo record with internal status code:
    For Map Internal Status to Integration Service Status:
    When the system maps internal status to integration service status format, then integration service status is set based on internal status mapping rules.
  • Context - a cargo record with mapped integration service status:
    For Hold Status?:
    When the system checks if status indicates cargo is held, then hold notification preparation is triggered if cargo is in hold status.
  • Context - a cargo record with mapped integration service status that is not in hold status:
    For Release Status?:
    When the system checks if status indicates cargo is released, then release notification preparation is triggered if cargo is in release status.
  • Context - a cargo record with mapped integration service status that is neither hold nor release:
    For Status Change?:
    When the system checks if any status change occurred, then status change notification preparation is triggered if status change is detected.
  • Context - a cargo record identified as having hold status:
    For Prepare Hold Notification:
    When the system prepares hold notification with cargo identification and status details, then hold notification message is formatted for gcciis integration service call.
  • Context - a cargo record identified as having release status:
    For Prepare Release Notification:
    When the system prepares release notification with cargo identification and status details, then release notification message is formatted for gcciis integration service call.
  • Context - a cargo record identified as having general status change:
    For Prepare Status Change Notification:
    When the system prepares status change notification with cargo identification and new status details, then status change notification message is formatted for gcciis integration service call.
  • Context - a prepared notification message for hold, release, or status change:
    For Call GCCIIS Integration Service:
    When the system calls gcciis integration service with the notification message, then integration service processes the notification and returns success or failure status.
  • Context - a completed gcciis integration service call with return status:
    For Integration Call Successful?:
    When the system checks the integration service call return status, then success logging is triggered if call succeeded, error logging if call failed.
  • Context - a successful gcciis integration service call:
    For Log Integration Success:
    When the system logs the successful integration service call, then success information is recorded with cargo identification and timestamp.
  • Context - a failed gcciis integration service call:
    For Log Integration Error:
    When the system logs the failed integration service call, then error information is recorded with cargo identification, error details, and timestamp.
  • Context - a completed gcciis integration service call with success or failure status:
    For Update Cargo Record with Integration Status:
    When the system updates the cargo record with integration call results, then cargo record reflects integration service call status and timestamp for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with current status and previous status information
GIVEN
A cargo record exists with current status and previous status information
Applied to: Cargo Status Changed?
WHEN
The system compares current cargo status with previous cargo status
THEN
Integration service processing continues if status has changed, otherwise processing ends
Context: A cargo record with equipment type information from GCSUSS05
GIVEN
A cargo record with equipment type information from GCSUSS05
Applied to: Valid Container Type?
WHEN
The system checks if equipment type is container or trailer
THEN
Integration processing continues for valid container/trailer types, otherwise processing ends
Context: A cargo record with internal status code
GIVEN
A cargo record with internal status code
Applied to: Map Internal Status to Integration Service Status
WHEN
The system maps internal status to integration service status format
THEN
Integration service status is set based on internal status mapping rules
Context: A cargo record with mapped integration service status
GIVEN
A cargo record with mapped integration service status
Applied to: Hold Status?
WHEN
The system checks if status indicates cargo is held
THEN
Hold notification preparation is triggered if cargo is in hold status
Context: A cargo record with mapped integration service status that is not in hold status
GIVEN
A cargo record with mapped integration service status that is not in hold status
Applied to: Release Status?
WHEN
The system checks if status indicates cargo is released
THEN
Release notification preparation is triggered if cargo is in release status
Context: A cargo record with mapped integration service status that is neither hold nor release
GIVEN
A cargo record with mapped integration service status that is neither hold nor release
Applied to: Status Change?
WHEN
The system checks if any status change occurred
THEN
Status change notification preparation is triggered if status change is detected
Context: A cargo record identified as having hold status
GIVEN
A cargo record identified as having hold status
Applied to: Prepare Hold Notification
WHEN
The system prepares hold notification with cargo identification and status details
THEN
Hold notification message is formatted for GCCIIS integration service call
Context: A cargo record identified as having release status
GIVEN
A cargo record identified as having release status
Applied to: Prepare Release Notification
WHEN
The system prepares release notification with cargo identification and status details
THEN
Release notification message is formatted for GCCIIS integration service call
Context: A cargo record identified as having general status change
GIVEN
A cargo record identified as having general status change
Applied to: Prepare Status Change Notification
WHEN
The system prepares status change notification with cargo identification and new status details
THEN
Status change notification message is formatted for GCCIIS integration service call
Context: A prepared notification message for hold, release, or status change
GIVEN
A prepared notification message for hold, release, or status change
Applied to: Call GCCIIS Integration Service
WHEN
The system calls GCCIIS integration service with the notification message
THEN
Integration service processes the notification and returns success or failure status
Context: A completed GCCIIS integration service call with return status
GIVEN
A completed GCCIIS integration service call with return status
Applied to: Integration Call Successful?
WHEN
The system checks the integration service call return status
THEN
Success logging is triggered if call succeeded, error logging if call failed
Context: A successful GCCIIS integration service call
GIVEN
A successful GCCIIS integration service call
Applied to: Log Integration Success
WHEN
The system logs the successful integration service call
THEN
Success information is recorded with cargo identification and timestamp
Context: A failed GCCIIS integration service call
GIVEN
A failed GCCIIS integration service call
Applied to: Log Integration Error
WHEN
The system logs the failed integration service call
THEN
Error information is recorded with cargo identification, error details, and timestamp
Context: A completed GCCIIS integration service call with success or failure status
GIVEN
A completed GCCIIS integration service call with success or failure status
Applied to: Update Cargo Record with Integration Status
WHEN
The system updates the cargo record with integration call results
THEN
Cargo record reflects integration service call status and timestamp for audit trail
R-GCX016-cbl-03340 (+18) File: GCX016.cbl Release Message Generation with Cargo Details Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Message Generation with Cargo Details':
  • Context - a cargo record exists in the system with a specific release status:
    For Cargo Release Status?:
    When the system evaluates the cargo release status for message generation, then the system proceeds with message generation only if cargo is in released status, otherwise terminates the process.
  • Context - a cargo record has associated car identification information from n7 segments:
    For Format Car ID Information:
    When the system formats car id information for release message, then the system combines car initial and car number into properly formatted car identification string for message display.
  • Context - a cargo record contains waybill number and transportation document details:
    For Format Waybill Information:
    When the system formats waybill information for release message, then the system includes formatted waybill number and associated transportation details in the message content.
  • Context - a cargo record has us-ccn key and current status information:
    For Format US-CCN Status:
    When the system formats us-ccn status for release message, then the system includes formatted us-ccn number and current status description in the message.
  • Context - a cargo processing transaction contains disposition code from x4 segment:
    For Format Disposition Code Details:
    When the system formats disposition code details for release message, then the system includes disposition code value and corresponding description text in the formatted message.
  • Context - cargo processing has occurred with specific date and time stamps:
    For Include Processing Timestamps:
    When the system includes processing timestamps in release message, then the system adds formatted date and time information showing when cargo processing events occurred.
  • Context - a cargo record contains total quantity and current released quantity values:
    For Add Quantity Information:
    When the system adds quantity information to release message, then the system includes both total cargo quantity and current released quantity amounts in the message content.
  • Context - a cargo record has associated broker information and customs entry numbers:
    For Include Broker Entry Numbers:
    When the system includes broker entry numbers in release message, then the system adds broker identification and related customs entry numbers to the message content.
  • Context - a message processing transaction may contain k1 comment segments:
    For K1 Comments Available?:
    When the system checks for k1 comment availability, then the system determines if k1 comment segments exist and are available for inclusion in the release message.
  • Context - k1 comment segments are available for inclusion in release message:
    For Include Up to 4 K1 Comment Segments:
    When the system includes k1 comment segments in the message, then the system adds up to four k1 comment segments to the release message content, respecting the maximum limit.
  • Context - a release message is being generated for cargo with broker and bond information:
    For Broker Bond Message?:
    When the system determines if this is a broker bond message, then the system identifies whether special broker bond message formatting rules should be applied.
  • Context - a release message has been identified as a broker bond message type:
    For Apply Special Broker Bond Formatting:
    When the system applies special broker bond formatting, then the system formats the message using broker bond specific layout rules and includes required bond-related information.
  • Context - a cargo transaction involves quantity changes through disposition code processing:
    For Format Quantity Action Details:
    When the system formats quantity action details, then the system includes formatted information showing whether quantities are being added to or subtracted from release amounts.
  • Context - a cargo record has associated equipment type information:
    For Container Type Valid?:
    When the system validates container type for message inclusion, then the system determines if the container type is valid for equipment information inclusion in the release message.
  • Context - container type validation has passed and equipment information is available:
    For Include Equipment Type Information:
    When the system includes equipment type information in release message, then the system adds equipment type details including container or trailer specifications to the message content.
  • Context - a cargo record has internal status codes that need to be displayed in release messages:
    For Map Internal Status to Description:
    When the system maps internal status to description, then the system converts internal status codes to corresponding user-friendly description text for message readability.
  • Context - all individual message components have been formatted and prepared:
    For Format Complete Release Message:
    When the system formats the complete release message, then the system assembles all components into a properly structured, complete release message ready for transmission.
  • Context - a complete release message has been formatted and user routing configuration exists:
    For Route Message to Configured Users:
    When the system routes the message to configured users, then the system sends the release message to all appropriate recipients based on message type and configured routing rules.
  • Context - a release message has been successfully generated and routed:
    For Log Message Generation Activity:
    When the system logs message generation activity, then the system records message generation details including timestamp, message type, and routing information for audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with a specific release status
GIVEN
A cargo record exists in the system with a specific release status
Applied to: Cargo Release Status?
WHEN
The system evaluates the cargo release status for message generation
THEN
The system proceeds with message generation only if cargo is in released status, otherwise terminates the process
Context: A cargo record has associated car identification information from N7 segments
GIVEN
A cargo record has associated car identification information from N7 segments
Applied to: Format Car ID Information
WHEN
The system formats car ID information for release message
THEN
The system combines car initial and car number into properly formatted car identification string for message display
Context: A cargo record contains waybill number and transportation document details
GIVEN
A cargo record contains waybill number and transportation document details
Applied to: Format Waybill Information
WHEN
The system formats waybill information for release message
THEN
The system includes formatted waybill number and associated transportation details in the message content
Context: A cargo record has US-CCN key and current status information
GIVEN
A cargo record has US-CCN key and current status information
Applied to: Format US-CCN Status
WHEN
The system formats US-CCN status for release message
THEN
The system includes formatted US-CCN number and current status description in the message
Context: A cargo processing transaction contains disposition code from X4 segment
GIVEN
A cargo processing transaction contains disposition code from X4 segment
Applied to: Format Disposition Code Details
WHEN
The system formats disposition code details for release message
THEN
The system includes disposition code value and corresponding description text in the formatted message
Context: Cargo processing has occurred with specific date and time stamps
GIVEN
Cargo processing has occurred with specific date and time stamps
Applied to: Include Processing Timestamps
WHEN
The system includes processing timestamps in release message
THEN
The system adds formatted date and time information showing when cargo processing events occurred
Context: A cargo record contains total quantity and current released quantity values
GIVEN
A cargo record contains total quantity and current released quantity values
Applied to: Add Quantity Information
WHEN
The system adds quantity information to release message
THEN
The system includes both total cargo quantity and current released quantity amounts in the message content
Context: A cargo record has associated broker information and customs entry numbers
GIVEN
A cargo record has associated broker information and customs entry numbers
Applied to: Include Broker Entry Numbers
WHEN
The system includes broker entry numbers in release message
THEN
The system adds broker identification and related customs entry numbers to the message content
Context: A message processing transaction may contain K1 comment segments
GIVEN
A message processing transaction may contain K1 comment segments
Applied to: K1 Comments Available?
WHEN
The system checks for K1 comment availability
THEN
The system determines if K1 comment segments exist and are available for inclusion in the release message
Context: K1 comment segments are available for inclusion in release message
GIVEN
K1 comment segments are available for inclusion in release message
Applied to: Include Up to 4 K1 Comment Segments
WHEN
The system includes K1 comment segments in the message
THEN
The system adds up to four K1 comment segments to the release message content, respecting the maximum limit
Context: A release message is being generated for cargo with broker and bond information
GIVEN
A release message is being generated for cargo with broker and bond information
Applied to: Broker Bond Message?
WHEN
The system determines if this is a broker bond message
THEN
The system identifies whether special broker bond message formatting rules should be applied
Context: A release message has been identified as a broker bond message type
GIVEN
A release message has been identified as a broker bond message type
Applied to: Apply Special Broker Bond Formatting
WHEN
The system applies special broker bond formatting
THEN
The system formats the message using broker bond specific layout rules and includes required bond-related information
Context: A cargo transaction involves quantity changes through disposition code processing
GIVEN
A cargo transaction involves quantity changes through disposition code processing
Applied to: Format Quantity Action Details
WHEN
The system formats quantity action details
THEN
The system includes formatted information showing whether quantities are being added to or subtracted from release amounts
Context: A cargo record has associated equipment type information
GIVEN
A cargo record has associated equipment type information
Applied to: Container Type Valid?
WHEN
The system validates container type for message inclusion
THEN
The system determines if the container type is valid for equipment information inclusion in the release message
Context: Container type validation has passed and equipment information is available
GIVEN
Container type validation has passed and equipment information is available
Applied to: Include Equipment Type Information
WHEN
The system includes equipment type information in release message
THEN
The system adds equipment type details including container or trailer specifications to the message content
Context: A cargo record has internal status codes that need to be displayed in release messages
GIVEN
A cargo record has internal status codes that need to be displayed in release messages
Applied to: Map Internal Status to Description
WHEN
The system maps internal status to description
THEN
The system converts internal status codes to corresponding user-friendly description text for message readability
Context: All individual message components have been formatted and prepared
GIVEN
All individual message components have been formatted and prepared
Applied to: Format Complete Release Message
WHEN
The system formats the complete release message
THEN
The system assembles all components into a properly structured, complete release message ready for transmission
Context: A complete release message has been formatted and user routing configuration exists
GIVEN
A complete release message has been formatted and user routing configuration exists
Applied to: Route Message to Configured Users
WHEN
The system routes the message to configured users
THEN
The system sends the release message to all appropriate recipients based on message type and configured routing rules
Context: A release message has been successfully generated and routed
GIVEN
A release message has been successfully generated and routed
Applied to: Log Message Generation Activity
WHEN
The system logs message generation activity
THEN
The system records message generation details including timestamp, message type, and routing information for audit purposes
R-GCX016-cbl-03359 (+16) File: GCX016.cbl Export Message Generation with Cancellation Support Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Message Generation with Cancellation Support':
  • Context - an export message generation request is received:
    For Export Operation Type?:
    When the system evaluates the export operation type flag, then the system routes to either standard export processing or export cancellation processing based on the flag value.
  • Context - a cargo record with container type information is being processed for export:
    For Container Type Valid?:
    When the system checks if the container type is valid for export operations, then the system either proceeds with message generation for valid container types or handles invalid container type scenarios.
  • Context - a standard export operation is being processed:
    For Set Export Message Type:
    When the system needs to set the message type for export processing, then the system assigns the export message type flag to indicate standard export processing.
  • Context - an export cancellation operation is being processed:
    For Set Export Cancellation Message Type:
    When the system needs to set the message type for cancellation processing, then the system assigns the export cancellation message type flag to indicate cancellation processing.
  • Context - a standard export message type has been set:
    For Prepare Export Message Content:
    When the system prepares the export message content, then the system formats the message with export-specific information and cargo details.
  • Context - an export cancellation message type has been set:
    For Prepare Cancellation Message Content:
    When the system prepares the cancellation message content, then the system formats the message with cancellation-specific information and reason codes.
  • Context - an export message is being prepared:
    For Include Cargo Details:
    When the system includes cargo details in the message, then the system adds cargo identification, quantities, and export-related information to the message content.
  • Context - an export cancellation message is being prepared:
    For Include Cancellation Reason:
    When the system includes cancellation reason information, then the system adds the cancellation reason code and description to the message content.
  • Context - export message content has been prepared with cargo details:
    For Format USCS Export Message:
    When the system formats the message for uscs transmission, then the system creates a properly formatted uscs export message with all required fields and structure.
  • Context - cancellation message content has been prepared with reason information:
    For Format USCS Cancellation Message:
    When the system formats the cancellation message for uscs transmission, then the system creates a properly formatted uscs cancellation message with all required fields and structure.
  • Context - a uscs export message has been formatted:
    For Route to USEXP Basket:
    When the system routes the message for transmission, then the system sends the export message to the usexp basket for delivery to uscs systems.
  • Context - a uscs cancellation message has been formatted:
    For Route to Cancellation Recipients:
    When the system routes the cancellation message for transmission, then the system sends the cancellation message to designated cancellation recipients for processing.
  • Context - an export message has been routed to usexp basket:
    For Log Export Operation:
    When the system logs the export operation, then the system records the export operation details including cargo information and timestamp for audit purposes.
  • Context - a cancellation message has been routed to recipients:
    For Log Cancellation Operation:
    When the system logs the cancellation operation, then the system records the cancellation operation details including reason and timestamp for audit purposes.
  • Context - an export operation has been logged successfully:
    For Update Cargo Export Status:
    When the system updates the cargo export status, then the system sets the cargo status to exported and updates relevant export flags and timestamps.
  • Context - a cancellation operation has been logged successfully:
    For Restore Previous Status:
    When the system restores the previous cargo status, then the system reverts the cargo status to its state before the export operation and clears export-related flags.
  • Context - a container type validation has failed:
    For Handle Invalid Container Type:
    When the system handles the invalid container type, then the system bypasses export message generation and completes the process without creating export messages.
👨‍💻 Technical ACs (Gherkin)
Context: An export message generation request is received
GIVEN
An export message generation request is received
Applied to: Export Operation Type?
WHEN
The system evaluates the export operation type flag
THEN
The system routes to either standard export processing or export cancellation processing based on the flag value
Context: A cargo record with container type information is being processed for export
GIVEN
A cargo record with container type information is being processed for export
Applied to: Container Type Valid?
WHEN
The system checks if the container type is valid for export operations
THEN
The system either proceeds with message generation for valid container types or handles invalid container type scenarios
Context: A standard export operation is being processed
GIVEN
A standard export operation is being processed
Applied to: Set Export Message Type
WHEN
The system needs to set the message type for export processing
THEN
The system assigns the export message type flag to indicate standard export processing
Context: An export cancellation operation is being processed
GIVEN
An export cancellation operation is being processed
Applied to: Set Export Cancellation Message Type
WHEN
The system needs to set the message type for cancellation processing
THEN
The system assigns the export cancellation message type flag to indicate cancellation processing
Context: A standard export message type has been set
GIVEN
A standard export message type has been set
Applied to: Prepare Export Message Content
WHEN
The system prepares the export message content
THEN
The system formats the message with export-specific information and cargo details
Context: An export cancellation message type has been set
GIVEN
An export cancellation message type has been set
Applied to: Prepare Cancellation Message Content
WHEN
The system prepares the cancellation message content
THEN
The system formats the message with cancellation-specific information and reason codes
Context: An export message is being prepared
GIVEN
An export message is being prepared
Applied to: Include Cargo Details
WHEN
The system includes cargo details in the message
THEN
The system adds cargo identification, quantities, and export-related information to the message content
Context: An export cancellation message is being prepared
GIVEN
An export cancellation message is being prepared
Applied to: Include Cancellation Reason
WHEN
The system includes cancellation reason information
THEN
The system adds the cancellation reason code and description to the message content
Context: Export message content has been prepared with cargo details
GIVEN
Export message content has been prepared with cargo details
Applied to: Format USCS Export Message
WHEN
The system formats the message for USCS transmission
THEN
The system creates a properly formatted USCS export message with all required fields and structure
Context: Cancellation message content has been prepared with reason information
GIVEN
Cancellation message content has been prepared with reason information
Applied to: Format USCS Cancellation Message
WHEN
The system formats the cancellation message for USCS transmission
THEN
The system creates a properly formatted USCS cancellation message with all required fields and structure
Context: A USCS export message has been formatted
GIVEN
A USCS export message has been formatted
Applied to: Route to USEXP Basket
WHEN
The system routes the message for transmission
THEN
The system sends the export message to the USEXP basket for delivery to USCS systems
Context: A USCS cancellation message has been formatted
GIVEN
A USCS cancellation message has been formatted
Applied to: Route to Cancellation Recipients
WHEN
The system routes the cancellation message for transmission
THEN
The system sends the cancellation message to designated cancellation recipients for processing
Context: An export message has been routed to USEXP basket
GIVEN
An export message has been routed to USEXP basket
Applied to: Log Export Operation
WHEN
The system logs the export operation
THEN
The system records the export operation details including cargo information and timestamp for audit purposes
Context: A cancellation message has been routed to recipients
GIVEN
A cancellation message has been routed to recipients
Applied to: Log Cancellation Operation
WHEN
The system logs the cancellation operation
THEN
The system records the cancellation operation details including reason and timestamp for audit purposes
Context: An export operation has been logged successfully
GIVEN
An export operation has been logged successfully
Applied to: Update Cargo Export Status
WHEN
The system updates the cargo export status
THEN
The system sets the cargo status to exported and updates relevant export flags and timestamps
Context: A cancellation operation has been logged successfully
GIVEN
A cancellation operation has been logged successfully
Applied to: Restore Previous Status
WHEN
The system restores the previous cargo status
THEN
The system reverts the cargo status to its state before the export operation and clears export-related flags
Context: A container type validation has failed
GIVEN
A container type validation has failed
Applied to: Handle Invalid Container Type
WHEN
The system handles the invalid container type
THEN
The system bypasses export message generation and completes the process without creating export messages
R-GCX016-cbl-03376 (+13) File: GCX016.cbl Arrival Message Generation with Cancellation Support Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Arrival Message Generation with Cancellation Support':
  • Context - an arrival message processing request is initiated:
    For Set Arrival Message Type:
    When the system evaluates the message type for arrival processing, then the system sets the arrival message type flag to indicate standard arrival message generation.
  • Context - an arrival cancellation processing request is initiated:
    For Set Cancellation Message Type:
    When the system evaluates the message type for cancellation processing, then the system sets the cancellation message type flag to indicate arrival cancellation message generation.
  • Context - a message type has been determined for arrival or cancellation processing:
    For Call Z110-PREP-EMCSEND for Message Preparation:
    When the system needs to prepare the message for transmission, then the system calls z110-prep-emcsend service to handle message preparation and routing.
  • Context - an arrival message type has been set and cargo details are available:
    For Format Arrival Message with Cargo Details:
    When the system formats the arrival message, then the system includes cargo details, arrival date, time, and location information in the message format.
  • Context - a cancellation message type has been set and cancellation reason is available:
    For Format Cancellation Message with Reason:
    When the system formats the cancellation message, then the system includes cancellation reason, original arrival details, and instructions for re-arrival in the message format.
  • Context - a message has been formatted for arrival or cancellation:
    For Message Routing Required?:
    When the system evaluates routing requirements, then the system determines if the message needs to be routed to uscs operations or other destinations based on message type and content.
  • Context - a message requires routing and uscs operations is the target destination:
    For Route to USCS Operations:
    When the system routes the message, then the system sends the message to uscs operations with appropriate priority and delivery confirmation.
  • Context - a message is routed to uscs operations and involves container equipment types:
    For Route to Export Baskets for Container Types:
    When the system evaluates equipment type for additional routing, then the system also routes the message to export baskets for container-specific processing.
  • Context - a message has been routed to appropriate destinations:
    For Set Message Keywords for Categorization:
    When the system sets message categorization, then the system assigns relevant keywords based on message type, cargo type, and operation type for proper filtering and processing.
  • Context - a message has been categorized with appropriate keywords:
    For Determine Destination Users:
    When the system determines destination users, then the system identifies target users based on user configuration, message type, and operational requirements.
  • Context - destination users have been determined for message delivery:
    For Valid Users?:
    When the system validates user configuration, then the system confirms that users are valid, active, and properly configured to receive the message type.
  • Context - valid configured users have been identified for message delivery:
    For Send to Configured Users:
    When the system sends the message, then the system delivers the message to all configured users with delivery confirmation and tracking.
  • Context - configured users are invalid or unavailable for message delivery:
    For Reroute to Default Users with Notification:
    When the system reroutes the message, then the system sends the message to default users and generates a notification about the rerouting due to invalid user configuration.
  • Context - a message has been processed and delivered or rerouted:
    For Log Message Generation Activity:
    When the system logs the activity, then the system records message generation details, delivery status, user information, and timestamps for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: An arrival message processing request is initiated
GIVEN
An arrival message processing request is initiated
Applied to: Set Arrival Message Type
WHEN
The system evaluates the message type for arrival processing
THEN
The system sets the arrival message type flag to indicate standard arrival message generation
Context: An arrival cancellation processing request is initiated
GIVEN
An arrival cancellation processing request is initiated
Applied to: Set Cancellation Message Type
WHEN
The system evaluates the message type for cancellation processing
THEN
The system sets the cancellation message type flag to indicate arrival cancellation message generation
Context: A message type has been determined for arrival or cancellation processing
GIVEN
A message type has been determined for arrival or cancellation processing
Applied to: Call Z110-PREP-EMCSEND for Message Preparation
WHEN
The system needs to prepare the message for transmission
THEN
The system calls Z110-PREP-EMCSEND service to handle message preparation and routing
Context: An arrival message type has been set and cargo details are available
GIVEN
An arrival message type has been set and cargo details are available
Applied to: Format Arrival Message with Cargo Details
WHEN
The system formats the arrival message
THEN
The system includes cargo details, arrival date, time, and location information in the message format
Context: A cancellation message type has been set and cancellation reason is available
GIVEN
A cancellation message type has been set and cancellation reason is available
Applied to: Format Cancellation Message with Reason
WHEN
The system formats the cancellation message
THEN
The system includes cancellation reason, original arrival details, and instructions for re-arrival in the message format
Context: A message has been formatted for arrival or cancellation
GIVEN
A message has been formatted for arrival or cancellation
Applied to: Message Routing Required?
WHEN
The system evaluates routing requirements
THEN
The system determines if the message needs to be routed to USCS operations or other destinations based on message type and content
Context: A message requires routing and USCS operations is the target destination
GIVEN
A message requires routing and USCS operations is the target destination
Applied to: Route to USCS Operations
WHEN
The system routes the message
THEN
The system sends the message to USCS operations with appropriate priority and delivery confirmation
Context: A message is routed to USCS operations and involves container equipment types
GIVEN
A message is routed to USCS operations and involves container equipment types
Applied to: Route to Export Baskets for Container Types
WHEN
The system evaluates equipment type for additional routing
THEN
The system also routes the message to export baskets for container-specific processing
Context: A message has been routed to appropriate destinations
GIVEN
A message has been routed to appropriate destinations
Applied to: Set Message Keywords for Categorization
WHEN
The system sets message categorization
THEN
The system assigns relevant keywords based on message type, cargo type, and operation type for proper filtering and processing
Context: A message has been categorized with appropriate keywords
GIVEN
A message has been categorized with appropriate keywords
Applied to: Determine Destination Users
WHEN
The system determines destination users
THEN
The system identifies target users based on user configuration, message type, and operational requirements
Context: Destination users have been determined for message delivery
GIVEN
Destination users have been determined for message delivery
Applied to: Valid Users?
WHEN
The system validates user configuration
THEN
The system confirms that users are valid, active, and properly configured to receive the message type
Context: Valid configured users have been identified for message delivery
GIVEN
Valid configured users have been identified for message delivery
Applied to: Send to Configured Users
WHEN
The system sends the message
THEN
The system delivers the message to all configured users with delivery confirmation and tracking
Context: Configured users are invalid or unavailable for message delivery
GIVEN
Configured users are invalid or unavailable for message delivery
Applied to: Reroute to Default Users with Notification
WHEN
The system reroutes the message
THEN
The system sends the message to default users and generates a notification about the rerouting due to invalid user configuration
Context: A message has been processed and delivered or rerouted
GIVEN
A message has been processed and delivered or rerouted
Applied to: Log Message Generation Activity
WHEN
The system logs the activity
THEN
The system records message generation details, delivery status, user information, and timestamps for audit trail
R-GCX016-cbl-03390 (+19) File: GCX016.cbl Foreign Bill Cargo Creation Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Foreign Bill Cargo Creation':
  • Context - a foreign bill is not found in the system:
    For Initialize New Cargo Record:
    When the system needs to create a new cargo record, then initialize a new cargo record structure with default field values and prepare it for data population.
  • Context - a new cargo record is being created:
    For Set Default CPRS/USCS Status:
    When the cargo type is cprs, then set cargo status to 'error' with description 'error', otherwise set status to 'sent' with description 'sent'.
    For Set Creation Date and Time:
    When finalizing cargo record creation, then set creation date and time fields to current system date and time.
  • Context - an m10 segment contains manifest information:
    For Extract Manifest Information from M10 Segment:
    When creating a new cargo record, then extract and populate vessel name, voyage number, manifest type, and related manifest fields into the cargo record.
  • Context - manifest information is available from m10 segment:
    For Set SCAC Code and Transport Type:
    When setting up cargo transportation details, then assign scac code from manifest and set appropriate transport type based on carrier information.
  • Context - manifest contains country and vessel information:
    For Set Country Code and Vessel Name:
    When creating cargo record, then set country code and vessel name from manifest data into cargo record fields.
  • Context - manifest contains voyage and quantity data:
    For Set Flight/Voyage Number and Quantity:
    When setting up cargo shipment details, then assign flight/voyage number and cargo quantity from manifest to cargo record.
  • Context - manifest type information is available:
    For Set Manifest Type Code and Condition Response:
    When finalizing manifest details in cargo record, then set manifest type code and condition response based on manifest classification.
  • Context - an x4 segment contains customs release information:
    For Extract X4 Segment Information:
    When creating cargo record with customs data, then extract broker information, entry numbers, bond details, and disposition codes from x4 segment into cargo record.
  • Context - x4 segment contains broker information:
    For Set Broker Information:
    When setting up cargo broker details, then populate broker id, name, and contact information from x4 segment into cargo record.
  • Context - x4 segment contains bond information:
    For Set Bond Control Number:
    When setting up customs bond details, then extract and assign bond control number from x4 segment to cargo record.
  • Context - x4 segment contains entry information:
    For Set Entry Number and Type:
    When setting up customs entry details, then extract entry number and entry type code from x4 segment and populate cargo record fields.
  • Context - entry type code is 61, 62, 63, or 69:
    For Process Master In-Bond Entry Types 61,62,63,69:
    When processing entry type for new cargo, then set master in-bond flag and configure specific transport type and bond processing requirements for the entry type.
  • Context - entry type code is 61 (immediate transport), 62 (transport export), 63 (immediate export), or 69 (us-canada-us):
    For Map Entry Type to Transport Type:
    When mapping entry type to transport classification, then set corresponding transport type: 61 maps to immediate transport, 62 to transport export, 63 to immediate export, 69 to us-canada-us movement.
  • Context - entry type code is 00:
    For Process Border Entry Type 00:
    When processing border entry type, then configure cargo for border processing and clear bond information as required for border entries.
  • Context - entry type is border entry (00):
    For Clear Bond Information for Border Entry:
    When processing bond requirements, then clear bond control number and related bond fields as border entries do not require customs bonding.
  • Context - a new cargo record is being finalized:
    For Set Default Cargo Values:
    When setting default values for unpopulated fields, then assign system default values to cargo fields including acknowledgment status, processing flags, and standard field defaults.
  • Context - a new cargo record requires a unique identifier:
    For Generate New US-CCN Key:
    When generating cargo record key, then create a new us-ccn key using system key generation logic to ensure uniqueness.
  • Context - a complete cargo record is ready for storage:
    For Store New Cargo Record in Database:
    When saving the cargo record, then insert the cargo record into the database and confirm successful storage.
  • Context - a new cargo record has been successfully created:
    For Log Cargo Creation Activity:
    When completing cargo creation process, then log the cargo creation activity with relevant details for audit trail and system tracking.
👨‍💻 Technical ACs (Gherkin)
Context: A foreign bill is not found in the system
GIVEN
A foreign bill is not found in the system
Applied to: Initialize New Cargo Record
WHEN
The system needs to create a new cargo record
THEN
Initialize a new cargo record structure with default field values and prepare it for data population
Context: A new cargo record is being created
GIVEN
A new cargo record is being created
Applied to: Set Default CPRS/USCS Status
WHEN
The cargo type is CPRS
THEN
Set cargo status to 'ERROR' with description 'ERROR', otherwise set status to 'SENT' with description 'SENT'
Applied to: Set Creation Date and Time
WHEN
Finalizing cargo record creation
THEN
Set creation date and time fields to current system date and time
Context: An M10 segment contains manifest information
GIVEN
An M10 segment contains manifest information
Applied to: Extract Manifest Information from M10 Segment
WHEN
Creating a new cargo record
THEN
Extract and populate vessel name, voyage number, manifest type, and related manifest fields into the cargo record
Context: Manifest information is available from M10 segment
GIVEN
Manifest information is available from M10 segment
Applied to: Set SCAC Code and Transport Type
WHEN
Setting up cargo transportation details
THEN
Assign SCAC code from manifest and set appropriate transport type based on carrier information
Context: Manifest contains country and vessel information
GIVEN
Manifest contains country and vessel information
Applied to: Set Country Code and Vessel Name
WHEN
Creating cargo record
THEN
Set country code and vessel name from manifest data into cargo record fields
Context: Manifest contains voyage and quantity data
GIVEN
Manifest contains voyage and quantity data
Applied to: Set Flight/Voyage Number and Quantity
WHEN
Setting up cargo shipment details
THEN
Assign flight/voyage number and cargo quantity from manifest to cargo record
Context: Manifest type information is available
GIVEN
Manifest type information is available
Applied to: Set Manifest Type Code and Condition Response
WHEN
Finalizing manifest details in cargo record
THEN
Set manifest type code and condition response based on manifest classification
Context: An X4 segment contains customs release information
GIVEN
An X4 segment contains customs release information
Applied to: Extract X4 Segment Information
WHEN
Creating cargo record with customs data
THEN
Extract broker information, entry numbers, bond details, and disposition codes from X4 segment into cargo record
Context: X4 segment contains broker information
GIVEN
X4 segment contains broker information
Applied to: Set Broker Information
WHEN
Setting up cargo broker details
THEN
Populate broker ID, name, and contact information from X4 segment into cargo record
Context: X4 segment contains bond information
GIVEN
X4 segment contains bond information
Applied to: Set Bond Control Number
WHEN
Setting up customs bond details
THEN
Extract and assign bond control number from X4 segment to cargo record
Context: X4 segment contains entry information
GIVEN
X4 segment contains entry information
Applied to: Set Entry Number and Type
WHEN
Setting up customs entry details
THEN
Extract entry number and entry type code from X4 segment and populate cargo record fields
Context: Entry type code is 61, 62, 63, or 69
GIVEN
Entry type code is 61, 62, 63, or 69
Applied to: Process Master In-Bond Entry Types 61,62,63,69
WHEN
Processing entry type for new cargo
THEN
Set master in-bond flag and configure specific transport type and bond processing requirements for the entry type
Context: Entry type code is 61 (immediate transport), 62 (transport export), 63 (immediate export), or 69 (US-Canada-US)
GIVEN
Entry type code is 61 (immediate transport), 62 (transport export), 63 (immediate export), or 69 (US-Canada-US)
Applied to: Map Entry Type to Transport Type
WHEN
Mapping entry type to transport classification
THEN
Set corresponding transport type: 61 maps to immediate transport, 62 to transport export, 63 to immediate export, 69 to US-Canada-US movement
Context: Entry type code is 00
GIVEN
Entry type code is 00
Applied to: Process Border Entry Type 00
WHEN
Processing border entry type
THEN
Configure cargo for border processing and clear bond information as required for border entries
Context: Entry type is border entry (00)
GIVEN
Entry type is border entry (00)
Applied to: Clear Bond Information for Border Entry
WHEN
Processing bond requirements
THEN
Clear bond control number and related bond fields as border entries do not require customs bonding
Context: A new cargo record is being finalized
GIVEN
A new cargo record is being finalized
Applied to: Set Default Cargo Values
WHEN
Setting default values for unpopulated fields
THEN
Assign system default values to cargo fields including acknowledgment status, processing flags, and standard field defaults
Context: A new cargo record requires a unique identifier
GIVEN
A new cargo record requires a unique identifier
Applied to: Generate New US-CCN Key
WHEN
Generating cargo record key
THEN
Create a new US-CCN key using system key generation logic to ensure uniqueness
Context: A complete cargo record is ready for storage
GIVEN
A complete cargo record is ready for storage
Applied to: Store New Cargo Record in Database
WHEN
Saving the cargo record
THEN
Insert the cargo record into the database and confirm successful storage
Context: A new cargo record has been successfully created
GIVEN
A new cargo record has been successfully created
Applied to: Log Cargo Creation Activity
WHEN
Completing cargo creation process
THEN
Log the cargo creation activity with relevant details for audit trail and system tracking
R-GCX016-cbl-03410 (+18) File: GCX016.cbl Cargo Initialization with Default Values Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Initialization with Default Values':
  • Context - a new cargo record is being initialized:
    For Set Default CPRS/USCS Status:
    When the cargo type is cprs, then set cargo status to 'error' with status description 'error'.
    For Set Default CPRS/USCS Status:
    When the cargo type is not cprs, then set cargo status to 'sent' with status description 'sent'.
    For Set Default Manifest Data:
    When manifest data fields need default values, then set manifest number, waybill number, and related tracking fields to system defaults.
    For Set Default Quantity Values:
    When quantity fields need default values, then set total quantity, released quantity, and piece count to zero or system default values.
    For Set Default Location Information:
    When location fields need default values, then set origin location, destination location, and current location to system defaults.
  • Context - a cargo record is being processed:
    For Set Default CPRS/USCS Status:
    When the current cargo status is blank or equals 'ack-r', then set default acknowledgment status to 'ack' or 'ack-r' based on system configuration.
  • Context - a new cargo record is being created:
    For Initialize Broker Information Fields:
    When broker information fields need initialization, then clear broker id, broker name, and notification preference fields to default values.
    For Initialize Cargo Status Fields:
    When status fields need initialization, then set cargo status, status description, hold flags, and release flags to default values.
    For Initialize Date Fields:
    When date fields need initialization, then set arrival date, departure date, and status change dates to system defaults or current date.
    For Initialize Equipment Information:
    When equipment fields need initialization, then set car id, equipment type, and transportation unit information based on cargo type and n7 segment data.
  • Context - a cargo record with disposition code in ('1j', '69', '55'):
    For Process Master In-Bond Entry Types:
    When the disposition code indicates master in-bond processing is required, then set m1109 master in-bond flag and evaluate entry type codes for bond type determination.
  • Context - a cargo record with master in-bond processing required:
    For Map Entry Type to Transport Type:
    When the entry type code is '61', then set transport type to immediate transport and configure appropriate bond processing parameters.
    For Map Entry Type to Transport Type:
    When the entry type code is '62', then set transport type to transport export and configure appropriate bond processing parameters.
    For Map Entry Type to Transport Type:
    When the entry type code is '63', then set transport type to immediate export and configure appropriate bond processing parameters.
    For Map Entry Type to Transport Type:
    When the entry type code is '69', then set transport type to us-canada-us movement and configure appropriate bond processing parameters.
  • Context - a cargo record being processed:
    For Clear Bond Information:
    When the entry type is '00' indicating border processing, then clear bond number, bond date, and related bond information fields.
  • Context - a cargo record with bond processing required:
    For Set Default Bond Values:
    When the entry type is not '00' (not border processing), then set default bond number, establish bond dates, and initialize bond-related tracking fields.
  • Context - a new cargo record is being finalized:
    For Set Cargo Record Key Fields:
    When key fields need to be set, then set us-ccn key, manifest key, and other unique identifiers for database operations.
  • Context - a cargo record has been fully initialized:
    For Mark Record as New/Active:
    When the record is ready for database insertion, then set new record flag to true and active status flag to indicate the record is available for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A new cargo record is being initialized
GIVEN
A new cargo record is being initialized
Applied to: Set Default CPRS/USCS Status
WHEN
The cargo type is CPRS
THEN
Set cargo status to 'ERROR' with status description 'ERROR'
Applied to: Set Default CPRS/USCS Status
WHEN
The cargo type is not CPRS
THEN
Set cargo status to 'SENT' with status description 'SENT'
Applied to: Set Default Manifest Data
WHEN
Manifest data fields need default values
THEN
Set manifest number, waybill number, and related tracking fields to system defaults
Applied to: Set Default Quantity Values
WHEN
Quantity fields need default values
THEN
Set total quantity, released quantity, and piece count to zero or system default values
Applied to: Set Default Location Information
WHEN
Location fields need default values
THEN
Set origin location, destination location, and current location to system defaults
Context: A cargo record is being processed
GIVEN
A cargo record is being processed
Applied to: Set Default CPRS/USCS Status
WHEN
The current cargo status is blank or equals 'ACK-R'
THEN
Set default acknowledgment status to 'ACK' or 'ACK-R' based on system configuration
Context: A new cargo record is being created
GIVEN
A new cargo record is being created
Applied to: Initialize Broker Information Fields
WHEN
Broker information fields need initialization
THEN
Clear broker ID, broker name, and notification preference fields to default values
Applied to: Initialize Cargo Status Fields
WHEN
Status fields need initialization
THEN
Set cargo status, status description, hold flags, and release flags to default values
Applied to: Initialize Date Fields
WHEN
Date fields need initialization
THEN
Set arrival date, departure date, and status change dates to system defaults or current date
Applied to: Initialize Equipment Information
WHEN
Equipment fields need initialization
THEN
Set car ID, equipment type, and transportation unit information based on cargo type and N7 segment data
Context: A cargo record with disposition code in ('1J', '69', '55')
GIVEN
A cargo record with disposition code in ('1J', '69', '55')
Applied to: Process Master In-Bond Entry Types
WHEN
The disposition code indicates master in-bond processing is required
THEN
Set M1109 master in-bond flag and evaluate entry type codes for bond type determination
Context: A cargo record with master in-bond processing required
GIVEN
A cargo record with master in-bond processing required
Applied to: Map Entry Type to Transport Type
WHEN
The entry type code is '61'
THEN
Set transport type to immediate transport and configure appropriate bond processing parameters
Applied to: Map Entry Type to Transport Type
WHEN
The entry type code is '62'
THEN
Set transport type to transport export and configure appropriate bond processing parameters
Applied to: Map Entry Type to Transport Type
WHEN
The entry type code is '63'
THEN
Set transport type to immediate export and configure appropriate bond processing parameters
Applied to: Map Entry Type to Transport Type
WHEN
The entry type code is '69'
THEN
Set transport type to US-Canada-US movement and configure appropriate bond processing parameters
Context: A cargo record being processed
GIVEN
A cargo record being processed
Applied to: Clear Bond Information
WHEN
The entry type is '00' indicating border processing
THEN
Clear bond number, bond date, and related bond information fields
Context: A cargo record with bond processing required
GIVEN
A cargo record with bond processing required
Applied to: Set Default Bond Values
WHEN
The entry type is not '00' (not border processing)
THEN
Set default bond number, establish bond dates, and initialize bond-related tracking fields
Context: A new cargo record is being finalized
GIVEN
A new cargo record is being finalized
Applied to: Set Cargo Record Key Fields
WHEN
Key fields need to be set
THEN
Set US-CCN key, manifest key, and other unique identifiers for database operations
Context: A cargo record has been fully initialized
GIVEN
A cargo record has been fully initialized
Applied to: Mark Record as New/Active
WHEN
The record is ready for database insertion
THEN
Set new record flag to true and active status flag to indicate the record is available for processing
R-GCX016-cbl-03437 (+8) File: GCX016.cbl Border Entry Special Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Border Entry Special Processing':
  • Context - a cargo record is being processed for entry type validation:
    For Entry Type Code = '00'?:
    When the entry type code equals '00', then the system identifies this as a border entry requiring special processing.
  • Context - a cargo record has entry type code '00':
    For Identify as Border Entry:
    When the system processes the entry type classification, then the cargo is classified as a border entry type.
  • Context - a cargo record is classified as border entry with type code '00':
    For Clear Bond Control Number:
    When the system processes bond control number clearing, then the bond control number field is cleared to empty value.
    For Clear Broker Entry Number:
    When the system processes broker entry number clearing, then the broker entry number field is cleared to empty value.
    For Clear Related Bond Data:
    When the system processes related bond data clearing, then all related bond data fields are cleared including bond numbers, dates, and references.
    For Set Border Entry Flag:
    When the system processes border entry flag setting, then the border entry flag is set to indicate this cargo requires border processing.
  • Context - a cargo record has been processed as border entry with cleared bond data and set flags:
    For Update Cargo Record with Border Status:
    When the system updates the cargo record status, then the cargo record is updated with border processing status and all cleared fields are saved.
  • Context - a cargo record has been processed as border entry with updated status:
    For Log Border Entry Processing:
    When the system performs logging activities, then border entry processing activities are logged including entry type, cleared fields, and status changes.
  • Context - a cargo record has entry type code that is not '00':
    For Process as Regular Entry:
    When the system determines processing path, then the cargo is processed through regular entry processing without border-specific clearing operations.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for entry type validation
GIVEN
A cargo record is being processed for entry type validation
Applied to: Entry Type Code = '00'?
WHEN
The entry type code equals '00'
THEN
The system identifies this as a border entry requiring special processing
Context: A cargo record has entry type code '00'
GIVEN
A cargo record has entry type code '00'
Applied to: Identify as Border Entry
WHEN
The system processes the entry type classification
THEN
The cargo is classified as a border entry type
Context: A cargo record is classified as border entry with type code '00'
GIVEN
A cargo record is classified as border entry with type code '00'
Applied to: Clear Bond Control Number
WHEN
The system processes bond control number clearing
THEN
The bond control number field is cleared to empty value
Applied to: Clear Broker Entry Number
WHEN
The system processes broker entry number clearing
THEN
The broker entry number field is cleared to empty value
Applied to: Clear Related Bond Data
WHEN
The system processes related bond data clearing
THEN
All related bond data fields are cleared including bond numbers, dates, and references
Applied to: Set Border Entry Flag
WHEN
The system processes border entry flag setting
THEN
The border entry flag is set to indicate this cargo requires border processing
Context: A cargo record has been processed as border entry with cleared bond data and set flags
GIVEN
A cargo record has been processed as border entry with cleared bond data and set flags
Applied to: Update Cargo Record with Border Status
WHEN
The system updates the cargo record status
THEN
The cargo record is updated with border processing status and all cleared fields are saved
Context: A cargo record has been processed as border entry with updated status
GIVEN
A cargo record has been processed as border entry with updated status
Applied to: Log Border Entry Processing
WHEN
The system performs logging activities
THEN
Border entry processing activities are logged including entry type, cleared fields, and status changes
Context: A cargo record has entry type code that is not '00'
GIVEN
A cargo record has entry type code that is not '00'
Applied to: Process as Regular Entry
WHEN
The system determines processing path
THEN
The cargo is processed through regular entry processing without border-specific clearing operations
R-GCX016-cbl-03446 (+14) File: GCX016.cbl Station Information Integration Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Information Integration':
  • Context - a cargo record is being processed:
    For Cargo Record Requires Station Info?:
    When the system evaluates whether station information is required for the cargo record, then the system determines if station lookup and integration should proceed or skip station processing.
  • Context - a cargo record contains location information:
    For Identify Location ID from Cargo Record:
    When station information integration is required, then the system extracts the location id from the cargo record for station table queries.
  • Context - a location id has been identified from the cargo record:
    For Lookup Station in DS Table:
    When the system performs ds table lookup, then the system searches the ds table for matching station name records.
  • Context - a ds table lookup has been performed using location id:
    For DS Table Entry Found?:
    When the system checks the lookup results, then the system determines if a valid ds table entry was found and sets appropriate processing flags.
  • Context - a valid ds table entry has been found for the location id:
    For Retrieve Station Name from DS Table:
    When the system retrieves station information, then the system extracts the station name from the ds table entry for integration.
  • Context - a location id has been identified and ds table processing is complete:
    For Lookup Station in KS Table:
    When the system performs ks table lookup, then the system searches the ks table for matching station description records.
  • Context - a ks table lookup has been performed using location id:
    For KS Table Entry Found?:
    When the system checks the lookup results, then the system determines if a valid ks table entry was found and sets appropriate processing flags.
  • Context - a valid ks table entry has been found for the location id:
    For Retrieve Station Description from KS Table:
    When the system retrieves station description information, then the system extracts the station description from the ks table entry for integration.
  • Context - a location id has been identified and ds/ks table processing is complete:
    For Lookup Station in SD Table:
    When the system performs sd table lookup, then the system searches the sd table for matching station detail records.
  • Context - an sd table lookup has been performed using location id:
    For SD Table Entry Found?:
    When the system checks the lookup results, then the system determines if a valid sd table entry was found and sets appropriate processing flags.
  • Context - a valid sd table entry has been found for the location id:
    For Retrieve Additional Station Details from SD Table:
    When the system retrieves additional station details, then the system extracts the additional station details from the sd table entry for integration.
  • Context - station name information has been retrieved from ds table or default values are used:
    For Integrate Station Name into Cargo Record:
    When the system integrates station information into cargo record, then the system updates the cargo record with the station name information.
  • Context - station description information has been retrieved from ks table or default values are used:
    For Integrate Station Description into Cargo Record:
    When the system integrates station description into cargo record, then the system updates the cargo record with the station description information.
  • Context - station name and description have been integrated into the cargo record:
    For Update Cargo Record with Complete Station Information:
    When the system completes the station information integration, then the system updates the cargo record with complete station information including names, descriptions, and additional details.
  • Context - station table lookups have failed to find matching entries:
    For Use Default/Empty Station Information:
    When the system cannot retrieve station information from ds, ks, or sd tables, then the system assigns default or empty station information to the cargo record.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed
GIVEN
A cargo record is being processed
Applied to: Cargo Record Requires Station Info?
WHEN
The system evaluates whether station information is required for the cargo record
THEN
The system determines if station lookup and integration should proceed or skip station processing
Context: A cargo record contains location information
GIVEN
A cargo record contains location information
Applied to: Identify Location ID from Cargo Record
WHEN
Station information integration is required
THEN
The system extracts the location ID from the cargo record for station table queries
Context: A location ID has been identified from the cargo record
GIVEN
A location ID has been identified from the cargo record
Applied to: Lookup Station in DS Table
WHEN
The system performs DS table lookup
THEN
The system searches the DS table for matching station name records
Context: A DS table lookup has been performed using location ID
GIVEN
A DS table lookup has been performed using location ID
Applied to: DS Table Entry Found?
WHEN
The system checks the lookup results
THEN
The system determines if a valid DS table entry was found and sets appropriate processing flags
Context: A valid DS table entry has been found for the location ID
GIVEN
A valid DS table entry has been found for the location ID
Applied to: Retrieve Station Name from DS Table
WHEN
The system retrieves station information
THEN
The system extracts the station name from the DS table entry for integration
Context: A location ID has been identified and DS table processing is complete
GIVEN
A location ID has been identified and DS table processing is complete
Applied to: Lookup Station in KS Table
WHEN
The system performs KS table lookup
THEN
The system searches the KS table for matching station description records
Context: A KS table lookup has been performed using location ID
GIVEN
A KS table lookup has been performed using location ID
Applied to: KS Table Entry Found?
WHEN
The system checks the lookup results
THEN
The system determines if a valid KS table entry was found and sets appropriate processing flags
Context: A valid KS table entry has been found for the location ID
GIVEN
A valid KS table entry has been found for the location ID
Applied to: Retrieve Station Description from KS Table
WHEN
The system retrieves station description information
THEN
The system extracts the station description from the KS table entry for integration
Context: A location ID has been identified and DS/KS table processing is complete
GIVEN
A location ID has been identified and DS/KS table processing is complete
Applied to: Lookup Station in SD Table
WHEN
The system performs SD table lookup
THEN
The system searches the SD table for matching station detail records
Context: An SD table lookup has been performed using location ID
GIVEN
An SD table lookup has been performed using location ID
Applied to: SD Table Entry Found?
WHEN
The system checks the lookup results
THEN
The system determines if a valid SD table entry was found and sets appropriate processing flags
Context: A valid SD table entry has been found for the location ID
GIVEN
A valid SD table entry has been found for the location ID
Applied to: Retrieve Additional Station Details from SD Table
WHEN
The system retrieves additional station details
THEN
The system extracts the additional station details from the SD table entry for integration
Context: Station name information has been retrieved from DS table or default values are used
GIVEN
Station name information has been retrieved from DS table or default values are used
Applied to: Integrate Station Name into Cargo Record
WHEN
The system integrates station information into cargo record
THEN
The system updates the cargo record with the station name information
Context: Station description information has been retrieved from KS table or default values are used
GIVEN
Station description information has been retrieved from KS table or default values are used
Applied to: Integrate Station Description into Cargo Record
WHEN
The system integrates station description into cargo record
THEN
The system updates the cargo record with the station description information
Context: Station name and description have been integrated into the cargo record
GIVEN
Station name and description have been integrated into the cargo record
Applied to: Update Cargo Record with Complete Station Information
WHEN
The system completes the station information integration
THEN
The system updates the cargo record with complete station information including names, descriptions, and additional details
Context: Station table lookups have failed to find matching entries
GIVEN
Station table lookups have failed to find matching entries
Applied to: Use Default/Empty Station Information
WHEN
The system cannot retrieve station information from DS, KS, or SD tables
THEN
The system assigns default or empty station information to the cargo record
R-GCX016-cbl-03461 (+10) File: GCX016.cbl Broker Bond Message Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Bond Message Processing':
  • Context - a cargo record with scac code information is being processed:
    For Identify Canadian Pacific Entity:
    When the system checks the cargo scac code, then the system identifies canadian pacific railway entities (cprs) for special bond message handling.
  • Context - a message is being processed with disposition code and entry information:
    For Detect Broker-Created Bond Pattern:
    When the disposition code is '95' and entry type is in ('61', '62', '63', '69'), then the system identifies this as a broker-created bond message requiring special handling.
  • Context - a broker-created bond message has been identified:
    For Apply Special Bond Message Formatting:
    When the system formats the message for broker notification, then the system applies special bond message formatting including bond control information and broker entity details.
  • Context - a broker bond message is being formatted:
    For Include Bond Control Information:
    When the system prepares the message content, then the system includes bond control number, entry number, and related bond identifiers in the message.
  • Context - a broker bond message requires entity details:
    For Add Broker Entity Details:
    When the system retrieves broker information from cargo records, then the system adds broker short name, tax number, and entity identification to the message.
  • Context - a broker bond message contains disposition code information:
    For Format Disposition Code Information:
    When the system formats the disposition code for the message, then the system includes disposition code, description, and related customs information in the broker message.
  • Context - a broker bond message is being prepared with cargo quantity data:
    For Include Quantity Information:
    When the system formats quantity information, then the system includes total quantity, release quantity, and quantity impact information in the broker message.
  • Context - a broker bond message has associated k1 comment segments:
    For Add K1 Comment Segments:
    When the system processes k1 segments for the message, then the system includes k1 remarks and special comments in the broker notification message.
  • Context - a broker bond message requires routing configuration:
    For Set Special Routing Parameters:
    When the system determines routing parameters, then the system sets special routing parameters including broker notification preferences and delivery methods.
  • Context - a broker bond message is formatted and ready for delivery:
    For Route to Broker Notification System:
    When the system routes the message, then the system sends the message to the broker notification system using configured delivery methods (email or merlin).
  • Context - a broker bond message has been processed and routed:
    For Log Broker Bond Transaction:
    When the system completes the transaction, then the system logs the broker bond transaction with timestamp, message details, and routing information for audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with SCAC code information is being processed
GIVEN
A cargo record with SCAC code information is being processed
Applied to: Identify Canadian Pacific Entity
WHEN
The system checks the cargo SCAC code
THEN
The system identifies Canadian Pacific Railway entities (CPRS) for special bond message handling
Context: A message is being processed with disposition code and entry information
GIVEN
A message is being processed with disposition code and entry information
Applied to: Detect Broker-Created Bond Pattern
WHEN
The disposition code is '95' and entry type is in ('61', '62', '63', '69')
THEN
The system identifies this as a broker-created bond message requiring special handling
Context: A broker-created bond message has been identified
GIVEN
A broker-created bond message has been identified
Applied to: Apply Special Bond Message Formatting
WHEN
The system formats the message for broker notification
THEN
The system applies special bond message formatting including bond control information and broker entity details
Context: A broker bond message is being formatted
GIVEN
A broker bond message is being formatted
Applied to: Include Bond Control Information
WHEN
The system prepares the message content
THEN
The system includes bond control number, entry number, and related bond identifiers in the message
Context: A broker bond message requires entity details
GIVEN
A broker bond message requires entity details
Applied to: Add Broker Entity Details
WHEN
The system retrieves broker information from cargo records
THEN
The system adds broker short name, tax number, and entity identification to the message
Context: A broker bond message contains disposition code information
GIVEN
A broker bond message contains disposition code information
Applied to: Format Disposition Code Information
WHEN
The system formats the disposition code for the message
THEN
The system includes disposition code, description, and related customs information in the broker message
Context: A broker bond message is being prepared with cargo quantity data
GIVEN
A broker bond message is being prepared with cargo quantity data
Applied to: Include Quantity Information
WHEN
The system formats quantity information
THEN
The system includes total quantity, release quantity, and quantity impact information in the broker message
Context: A broker bond message has associated K1 comment segments
GIVEN
A broker bond message has associated K1 comment segments
Applied to: Add K1 Comment Segments
WHEN
The system processes K1 segments for the message
THEN
The system includes K1 remarks and special comments in the broker notification message
Context: A broker bond message requires routing configuration
GIVEN
A broker bond message requires routing configuration
Applied to: Set Special Routing Parameters
WHEN
The system determines routing parameters
THEN
The system sets special routing parameters including broker notification preferences and delivery methods
Context: A broker bond message is formatted and ready for delivery
GIVEN
A broker bond message is formatted and ready for delivery
Applied to: Route to Broker Notification System
WHEN
The system routes the message
THEN
The system sends the message to the broker notification system using configured delivery methods (email or Merlin)
Context: A broker bond message has been processed and routed
GIVEN
A broker bond message has been processed and routed
Applied to: Log Broker Bond Transaction
WHEN
The system completes the transaction
THEN
The system logs the broker bond transaction with timestamp, message details, and routing information for audit purposes
R-GCX016-cbl-03472 (+24) File: GCX016.cbl Cargo Status Preservation and Restoration Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Preservation and Restoration':
  • Context - a cargo record exists in the system with a valid ccn key:
    For Retrieve Current Cargo Status:
    When the system needs to process status changes for the cargo, then the current cargo status information is retrieved from the gcsuss09 status segments.
  • Context - current cargo status has been retrieved from the database:
    For Save Current Status to Working Storage:
    When status processing is about to begin, then the current status values are saved to working storage arrays for potential restoration.
  • Context - a cargo record is being processed for status changes:
    For Status Array Exists?:
    When the system checks for existing s09 status segments, then if s09 segments exist, load existing status array, otherwise create new status array.
  • Context - a cargo record has no existing s09 status segments:
    For Create New Status Array:
    When status processing requires a status array, then a new s09 status segment is created with cargo ccn key and sequence '0001'.
  • Context - s09 status segments exist for the cargo record:
    For Load Existing Status Array:
    When status processing begins, then all s09 sequences and occurrences are loaded into the consolidated status array.
  • Context - status array has been loaded or created:
    For Save Original Status Values:
    When complex status transitions may require restoration of original values, then original ptt status, hold location information, and release quantities are saved to working storage.
  • Context - a disposition code change request is received:
    For Process Disposition Code Changes:
    When the disposition code is processed against the current status array, then status changes are applied based on disposition code type (hold, release, remove, info).
  • Context - disposition code changes have been processed:
    For Status Transition Required?:
    When the system evaluates the impact on cargo status, then if status changes affect cargo state, status transition processing is initiated, otherwise processing completes.
  • Context - status transition is required:
    For Analyze New Status Requirements:
    When the system analyzes the updated status array, then new status requirements are determined based on hold conditions, release quantities, and ptt eligibility.
  • Context - new status requirements have been analyzed:
    For Preserve Original Status?:
    When the system evaluates preservation rules, then if preservation is required, saved status values are restored, otherwise new status changes are applied.
  • Context - status preservation is required and original values were saved:
    For Restore Saved Status Values:
    When status restoration is triggered, then original ptt status, hold information, and release quantities are restored from working storage.
  • Context - status preservation is not required:
    For Apply New Status Changes:
    When new status changes are ready to be applied, then the status array is updated with new disposition codes and status information.
  • Context - status changes have been applied or restored:
    For Update Status Flags:
    When status flags need to be updated, then flags for empty, held, released, ptt, export, and arrival conditions are set based on status array analysis.
  • Context - status flags have been updated:
    For Complex Status Logic?:
    When the system evaluates complexity requirements, then if complex logic is needed, ptt status and hold information are preserved, otherwise status validation proceeds.
  • Context - complex status logic is required:
    For Save PTT Status:
    When ptt status needs to be preserved, then current ptt status flags and related information are saved to working storage.
  • Context - ptt status has been preserved:
    For Save Hold Location Info:
    When hold location information needs to be saved, then border hold, destination hold, and location-specific information are preserved in working storage.
  • Context - hold location information has been preserved:
    For Save Release Quantities:
    When release quantities need to be saved, then current release quantities and total quantities are preserved in working storage.
  • Context - all necessary status information has been preserved:
    For Process Status Transition:
    When status transition processing is executed, then cargo status is updated according to business rules while maintaining data integrity.
  • Context - status transition processing has been completed:
    For Restore Required?:
    When the system evaluates restoration requirements, then if restoration is needed, preserved values are restored, otherwise status validation proceeds.
  • Context - status restoration is required and ptt status was preserved:
    For Restore PTT Status:
    When ptt status restoration is executed, then preserved ptt status flags and information are restored to the cargo record.
  • Context - ptt status has been restored:
    For Restore Hold Information:
    When hold information restoration is executed, then preserved border hold, destination hold, and location information are restored.
  • Context - hold information has been restored:
    For Restore Release Quantities:
    When release quantity restoration is executed, then preserved release quantities and total quantities are restored to maintain data consistency.
  • Context - status processing and any required restoration has been completed:
    For Validate Status Consistency:
    When status consistency validation is performed, then the final status array is validated for logical consistency and business rule compliance.
  • Context - status consistency has been validated:
    For Update Final Status Array:
    When final status array update is performed, then the s09a status array is updated with all processed status changes and redistributed across s09 sequences.
  • Context - final status array has been updated and validated:
    For Persist Status Changes to Database:
    When database persistence is executed, then updated s09 status segments are written to the gcsuss09 database and cargo status is updated.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with a valid CCN key
GIVEN
A cargo record exists in the system with a valid CCN key
Applied to: Retrieve Current Cargo Status
WHEN
The system needs to process status changes for the cargo
THEN
The current cargo status information is retrieved from the GCSUSS09 status segments
Context: Current cargo status has been retrieved from the database
GIVEN
Current cargo status has been retrieved from the database
Applied to: Save Current Status to Working Storage
WHEN
Status processing is about to begin
THEN
The current status values are saved to working storage arrays for potential restoration
Context: A cargo record is being processed for status changes
GIVEN
A cargo record is being processed for status changes
Applied to: Status Array Exists?
WHEN
The system checks for existing S09 status segments
THEN
If S09 segments exist, load existing status array, otherwise create new status array
Context: A cargo record has no existing S09 status segments
GIVEN
A cargo record has no existing S09 status segments
Applied to: Create New Status Array
WHEN
Status processing requires a status array
THEN
A new S09 status segment is created with cargo CCN key and sequence '0001'
Context: S09 status segments exist for the cargo record
GIVEN
S09 status segments exist for the cargo record
Applied to: Load Existing Status Array
WHEN
Status processing begins
THEN
All S09 sequences and occurrences are loaded into the consolidated status array
Context: Status array has been loaded or created
GIVEN
Status array has been loaded or created
Applied to: Save Original Status Values
WHEN
Complex status transitions may require restoration of original values
THEN
Original PTT status, hold location information, and release quantities are saved to working storage
Context: A disposition code change request is received
GIVEN
A disposition code change request is received
Applied to: Process Disposition Code Changes
WHEN
The disposition code is processed against the current status array
THEN
Status changes are applied based on disposition code type (hold, release, remove, info)
Context: Disposition code changes have been processed
GIVEN
Disposition code changes have been processed
Applied to: Status Transition Required?
WHEN
The system evaluates the impact on cargo status
THEN
If status changes affect cargo state, status transition processing is initiated, otherwise processing completes
Context: Status transition is required
GIVEN
Status transition is required
Applied to: Analyze New Status Requirements
WHEN
The system analyzes the updated status array
THEN
New status requirements are determined based on hold conditions, release quantities, and PTT eligibility
Context: New status requirements have been analyzed
GIVEN
New status requirements have been analyzed
Applied to: Preserve Original Status?
WHEN
The system evaluates preservation rules
THEN
If preservation is required, saved status values are restored, otherwise new status changes are applied
Context: Status preservation is required and original values were saved
GIVEN
Status preservation is required and original values were saved
Applied to: Restore Saved Status Values
WHEN
Status restoration is triggered
THEN
Original PTT status, hold information, and release quantities are restored from working storage
Context: Status preservation is not required
GIVEN
Status preservation is not required
Applied to: Apply New Status Changes
WHEN
New status changes are ready to be applied
THEN
The status array is updated with new disposition codes and status information
Context: Status changes have been applied or restored
GIVEN
Status changes have been applied or restored
Applied to: Update Status Flags
WHEN
Status flags need to be updated
THEN
Flags for empty, held, released, PTT, export, and arrival conditions are set based on status array analysis
Context: Status flags have been updated
GIVEN
Status flags have been updated
Applied to: Complex Status Logic?
WHEN
The system evaluates complexity requirements
THEN
If complex logic is needed, PTT status and hold information are preserved, otherwise status validation proceeds
Context: Complex status logic is required
GIVEN
Complex status logic is required
Applied to: Save PTT Status
WHEN
PTT status needs to be preserved
THEN
Current PTT status flags and related information are saved to working storage
Context: PTT status has been preserved
GIVEN
PTT status has been preserved
Applied to: Save Hold Location Info
WHEN
Hold location information needs to be saved
THEN
Border hold, destination hold, and location-specific information are preserved in working storage
Context: Hold location information has been preserved
GIVEN
Hold location information has been preserved
Applied to: Save Release Quantities
WHEN
Release quantities need to be saved
THEN
Current release quantities and total quantities are preserved in working storage
Context: All necessary status information has been preserved
GIVEN
All necessary status information has been preserved
Applied to: Process Status Transition
WHEN
Status transition processing is executed
THEN
Cargo status is updated according to business rules while maintaining data integrity
Context: Status transition processing has been completed
GIVEN
Status transition processing has been completed
Applied to: Restore Required?
WHEN
The system evaluates restoration requirements
THEN
If restoration is needed, preserved values are restored, otherwise status validation proceeds
Context: Status restoration is required and PTT status was preserved
GIVEN
Status restoration is required and PTT status was preserved
Applied to: Restore PTT Status
WHEN
PTT status restoration is executed
THEN
Preserved PTT status flags and information are restored to the cargo record
Context: PTT status has been restored
GIVEN
PTT status has been restored
Applied to: Restore Hold Information
WHEN
Hold information restoration is executed
THEN
Preserved border hold, destination hold, and location information are restored
Context: Hold information has been restored
GIVEN
Hold information has been restored
Applied to: Restore Release Quantities
WHEN
Release quantity restoration is executed
THEN
Preserved release quantities and total quantities are restored to maintain data consistency
Context: Status processing and any required restoration has been completed
GIVEN
Status processing and any required restoration has been completed
Applied to: Validate Status Consistency
WHEN
Status consistency validation is performed
THEN
The final status array is validated for logical consistency and business rule compliance
Context: Status consistency has been validated
GIVEN
Status consistency has been validated
Applied to: Update Final Status Array
WHEN
Final status array update is performed
THEN
The S09A status array is updated with all processed status changes and redistributed across S09 sequences
Context: Final status array has been updated and validated
GIVEN
Final status array has been updated and validated
Applied to: Persist Status Changes to Database
WHEN
Database persistence is executed
THEN
Updated S09 status segments are written to the GCSUSS09 database and cargo status is updated
R-GCX016-cbl-03497 (+12) File: GCX016.cbl Equipment Car Information Updates Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Car Information Updates':
  • Context - an n7 equipment segment is received with equipment information:
    For Extract Equipment ID from N7-02:
    When the system processes the n7-02 field to extract equipment id, then the equipment id is captured from n7-02 field for further processing.
  • Context - an equipment id has been extracted from n7-02 field:
    For Format Equipment ID using GCCCARFM:
    When the system calls gcccarfm utility to format the equipment id, then the equipment id is formatted according to standard rules and validation status is determined.
  • Context - an equipment id has been formatted using gcccarfm utility:
    For Equipment ID Valid?:
    When the system checks if the equipment id is valid, then if equipment id is valid, proceed to retrieve cargo records, otherwise log equipment id error.
  • Context - a valid equipment id has been confirmed:
    For Retrieve Cargo Records by Car ID:
    When the system searches for cargo records using the car id, then all cargo records associated with the car id are retrieved from the cargo database.
  • Context - the system has searched for cargo records by car id:
    For Cargo Records Found?:
    When the system checks if any cargo records were found, then if cargo records are found, proceed to update car id, otherwise log cargo not found error.
  • Context - cargo records have been found for the equipment car id:
    For Update Car ID in Cargo Record:
    When the system updates the car id field in the cargo record, then the cargo record car id is updated with the formatted equipment id from n7 segment.
  • Context - car id has been updated in the cargo record:
    For Validate Equipment Information:
    When the system validates the equipment information completeness and accuracy, then equipment information is verified for data integrity and business rule compliance.
  • Context - equipment information has been validated:
    For Validation Successful?:
    When the system checks if validation was successful, then if validation successful, replace cargo record in database, otherwise log validation error.
  • Context - equipment validation has been successful:
    For Replace Cargo Record in Database:
    When the system replaces the cargo record in the database, then the cargo record is updated in the database with the new car id and equipment information.
  • Context - cargo record has been successfully updated in the database:
    For Log Equipment Update:
    When the system logs the equipment update transaction, then equipment update is recorded in system logs with cargo and equipment details.
  • Context - equipment id validation has failed:
    For Log Equipment ID Error:
    When the system encounters an invalid equipment id, then equipment id error is logged with details about the validation failure.
  • Context - no cargo records were found for the equipment car id:
    For Log Cargo Not Found Error:
    When the system cannot locate cargo records to update, then cargo not found error is logged with the equipment car id details.
  • Context - equipment information validation has failed:
    For Log Validation Error:
    When the system encounters validation errors for equipment data, then validation error is logged with details about the failed validation criteria.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 equipment segment is received with equipment information
GIVEN
An N7 equipment segment is received with equipment information
Applied to: Extract Equipment ID from N7-02
WHEN
The system processes the N7-02 field to extract equipment ID
THEN
The equipment ID is captured from N7-02 field for further processing
Context: An equipment ID has been extracted from N7-02 field
GIVEN
An equipment ID has been extracted from N7-02 field
Applied to: Format Equipment ID using GCCCARFM
WHEN
The system calls GCCCARFM utility to format the equipment ID
THEN
The equipment ID is formatted according to standard rules and validation status is determined
Context: An equipment ID has been formatted using GCCCARFM utility
GIVEN
An equipment ID has been formatted using GCCCARFM utility
Applied to: Equipment ID Valid?
WHEN
The system checks if the equipment ID is valid
THEN
If equipment ID is valid, proceed to retrieve cargo records, otherwise log equipment ID error
Context: A valid equipment ID has been confirmed
GIVEN
A valid equipment ID has been confirmed
Applied to: Retrieve Cargo Records by Car ID
WHEN
The system searches for cargo records using the car ID
THEN
All cargo records associated with the car ID are retrieved from the cargo database
Context: The system has searched for cargo records by car ID
GIVEN
The system has searched for cargo records by car ID
Applied to: Cargo Records Found?
WHEN
The system checks if any cargo records were found
THEN
If cargo records are found, proceed to update car ID, otherwise log cargo not found error
Context: Cargo records have been found for the equipment car ID
GIVEN
Cargo records have been found for the equipment car ID
Applied to: Update Car ID in Cargo Record
WHEN
The system updates the car ID field in the cargo record
THEN
The cargo record car ID is updated with the formatted equipment ID from N7 segment
Context: Car ID has been updated in the cargo record
GIVEN
Car ID has been updated in the cargo record
Applied to: Validate Equipment Information
WHEN
The system validates the equipment information completeness and accuracy
THEN
Equipment information is verified for data integrity and business rule compliance
Context: Equipment information has been validated
GIVEN
Equipment information has been validated
Applied to: Validation Successful?
WHEN
The system checks if validation was successful
THEN
If validation successful, replace cargo record in database, otherwise log validation error
Context: Equipment validation has been successful
GIVEN
Equipment validation has been successful
Applied to: Replace Cargo Record in Database
WHEN
The system replaces the cargo record in the database
THEN
The cargo record is updated in the database with the new car ID and equipment information
Context: Cargo record has been successfully updated in the database
GIVEN
Cargo record has been successfully updated in the database
Applied to: Log Equipment Update
WHEN
The system logs the equipment update transaction
THEN
Equipment update is recorded in system logs with cargo and equipment details
Context: Equipment ID validation has failed
GIVEN
Equipment ID validation has failed
Applied to: Log Equipment ID Error
WHEN
The system encounters an invalid equipment ID
THEN
Equipment ID error is logged with details about the validation failure
Context: No cargo records were found for the equipment car ID
GIVEN
No cargo records were found for the equipment car ID
Applied to: Log Cargo Not Found Error
WHEN
The system cannot locate cargo records to update
THEN
Cargo not found error is logged with the equipment car ID details
Context: Equipment information validation has failed
GIVEN
Equipment information validation has failed
Applied to: Log Validation Error
WHEN
The system encounters validation errors for equipment data
THEN
Validation error is logged with details about the failed validation criteria
R-GCX016-cbl-03510 (+22) File: GCX016.cbl Manifest Information Integration Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Information Integration':
  • Context - an m10 manifest segment is received with scac code data:
    For Extract SCAC Code from M10:
    When the system processes the m10 segment, then the scac code is extracted and stored for cargo record integration.
  • Context - an m10 manifest segment contains transport type information:
    For Extract Transport Type from M10:
    When the system processes the m10 segment, then the transport type is extracted and prepared for cargo record update.
  • Context - an m10 manifest segment contains country code information:
    For Extract Country Code from M10:
    When the system processes the m10 segment, then the country code is extracted for cargo record integration.
  • Context - an m10 manifest segment contains vessel name information:
    For Extract Vessel Name from M10:
    When the system processes the m10 segment, then the vessel name is extracted and prepared for cargo record update.
  • Context - an m10 manifest segment contains flight or voyage number:
    For Extract Flight/Voyage Number from M10:
    When the system processes the m10 segment, then the flight/voyage number is extracted for cargo identification.
  • Context - an m10 manifest segment contains quantity information:
    For Extract Quantity from M10:
    When the system processes the m10 segment, then the quantity is extracted and prepared for cargo record integration.
  • Context - an m10 manifest segment contains manifest type code:
    For Extract Manifest Type Code from M10:
    When the system processes the m10 segment, then the manifest type code is extracted for cargo classification.
  • Context - an m10 manifest segment contains condition response code:
    For Extract Condition Response Code from M10:
    When the system processes the m10 segment, then the condition response code is extracted for cargo status determination.
  • Context - m10 manifest segment data has been extracted:
    For All Required Fields Present?:
    When the system validates the extracted data elements, then if all required fields are present, processing continues; otherwise, an error is logged and integration is skipped.
  • Context - all required m10 manifest data elements have been validated:
    For Build Manifest Information Block:
    When the system builds the manifest information block, then a complete manifest information structure is created with all extracted data elements.
  • Context - a manifest information block has been built:
    For Locate Target Cargo Record:
    When the system searches for the target cargo record, then the system identifies the cargo record that corresponds to the manifest data.
  • Context - no existing cargo record is found for the manifest data:
    For Create New Cargo Record:
    When the system attempts to locate a target cargo record, then a new cargo record is created to receive the manifest information.
  • Context - a cargo record exists and scac code has been extracted from m10:
    For Set SCAC Code in Cargo:
    When the system updates the cargo record with manifest information, then the scac code is set in the cargo record.
  • Context - a cargo record exists and transport type has been extracted from m10:
    For Set Transport Type in Cargo:
    When the system updates the cargo record with manifest information, then the transport type is set in the cargo record.
  • Context - a cargo record exists and country code has been extracted from m10:
    For Set Country Code in Cargo:
    When the system updates the cargo record with manifest information, then the country code is set in the cargo record.
  • Context - a cargo record exists and vessel name has been extracted from m10:
    For Set Vessel Name in Cargo:
    When the system updates the cargo record with manifest information, then the vessel name is set in the cargo record.
  • Context - a cargo record exists and flight/voyage number has been extracted from m10:
    For Set Flight/Voyage Number in Cargo:
    When the system updates the cargo record with manifest information, then the flight/voyage number is set in the cargo record.
  • Context - a cargo record exists and quantity has been extracted from m10:
    For Set Quantity in Cargo:
    When the system updates the cargo record with manifest information, then the quantity is set in the cargo record.
  • Context - a cargo record exists and manifest type code has been extracted from m10:
    For Set Manifest Type Code in Cargo:
    When the system updates the cargo record with manifest information, then the manifest type code is set in the cargo record.
  • Context - a cargo record exists and condition response code has been extracted from m10:
    For Set Condition Response Code in Cargo:
    When the system updates the cargo record with manifest information, then the condition response code is set in the cargo record.
  • Context - a cargo record has been updated with all manifest information:
    For Save Updated Cargo Record:
    When the system completes the manifest integration process, then the updated cargo record is saved to the database.
  • Context - required manifest data fields are missing from the m10 segment:
    For Log Missing Field Error:
    When the system validates the extracted data elements, then an error is logged indicating which required fields are missing.
  • Context - manifest data validation has failed due to missing required fields:
    For Skip Manifest Integration:
    When the system determines that integration cannot proceed, then the manifest integration process is skipped and processing continues with the next segment.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 manifest segment is received with SCAC code data
GIVEN
An M10 manifest segment is received with SCAC code data
Applied to: Extract SCAC Code from M10
WHEN
The system processes the M10 segment
THEN
The SCAC code is extracted and stored for cargo record integration
Context: An M10 manifest segment contains transport type information
GIVEN
An M10 manifest segment contains transport type information
Applied to: Extract Transport Type from M10
WHEN
The system processes the M10 segment
THEN
The transport type is extracted and prepared for cargo record update
Context: An M10 manifest segment contains country code information
GIVEN
An M10 manifest segment contains country code information
Applied to: Extract Country Code from M10
WHEN
The system processes the M10 segment
THEN
The country code is extracted for cargo record integration
Context: An M10 manifest segment contains vessel name information
GIVEN
An M10 manifest segment contains vessel name information
Applied to: Extract Vessel Name from M10
WHEN
The system processes the M10 segment
THEN
The vessel name is extracted and prepared for cargo record update
Context: An M10 manifest segment contains flight or voyage number
GIVEN
An M10 manifest segment contains flight or voyage number
Applied to: Extract Flight/Voyage Number from M10
WHEN
The system processes the M10 segment
THEN
The flight/voyage number is extracted for cargo identification
Context: An M10 manifest segment contains quantity information
GIVEN
An M10 manifest segment contains quantity information
Applied to: Extract Quantity from M10
WHEN
The system processes the M10 segment
THEN
The quantity is extracted and prepared for cargo record integration
Context: An M10 manifest segment contains manifest type code
GIVEN
An M10 manifest segment contains manifest type code
Applied to: Extract Manifest Type Code from M10
WHEN
The system processes the M10 segment
THEN
The manifest type code is extracted for cargo classification
Context: An M10 manifest segment contains condition response code
GIVEN
An M10 manifest segment contains condition response code
Applied to: Extract Condition Response Code from M10
WHEN
The system processes the M10 segment
THEN
The condition response code is extracted for cargo status determination
Context: M10 manifest segment data has been extracted
GIVEN
M10 manifest segment data has been extracted
Applied to: All Required Fields Present?
WHEN
The system validates the extracted data elements
THEN
If all required fields are present, processing continues; otherwise, an error is logged and integration is skipped
Context: All required M10 manifest data elements have been validated
GIVEN
All required M10 manifest data elements have been validated
Applied to: Build Manifest Information Block
WHEN
The system builds the manifest information block
THEN
A complete manifest information structure is created with all extracted data elements
Context: A manifest information block has been built
GIVEN
A manifest information block has been built
Applied to: Locate Target Cargo Record
WHEN
The system searches for the target cargo record
THEN
The system identifies the cargo record that corresponds to the manifest data
Context: No existing cargo record is found for the manifest data
GIVEN
No existing cargo record is found for the manifest data
Applied to: Create New Cargo Record
WHEN
The system attempts to locate a target cargo record
THEN
A new cargo record is created to receive the manifest information
Context: A cargo record exists and SCAC code has been extracted from M10
GIVEN
A cargo record exists and SCAC code has been extracted from M10
Applied to: Set SCAC Code in Cargo
WHEN
The system updates the cargo record with manifest information
THEN
The SCAC code is set in the cargo record
Context: A cargo record exists and transport type has been extracted from M10
GIVEN
A cargo record exists and transport type has been extracted from M10
Applied to: Set Transport Type in Cargo
WHEN
The system updates the cargo record with manifest information
THEN
The transport type is set in the cargo record
Context: A cargo record exists and country code has been extracted from M10
GIVEN
A cargo record exists and country code has been extracted from M10
Applied to: Set Country Code in Cargo
WHEN
The system updates the cargo record with manifest information
THEN
The country code is set in the cargo record
Context: A cargo record exists and vessel name has been extracted from M10
GIVEN
A cargo record exists and vessel name has been extracted from M10
Applied to: Set Vessel Name in Cargo
WHEN
The system updates the cargo record with manifest information
THEN
The vessel name is set in the cargo record
Context: A cargo record exists and flight/voyage number has been extracted from M10
GIVEN
A cargo record exists and flight/voyage number has been extracted from M10
Applied to: Set Flight/Voyage Number in Cargo
WHEN
The system updates the cargo record with manifest information
THEN
The flight/voyage number is set in the cargo record
Context: A cargo record exists and quantity has been extracted from M10
GIVEN
A cargo record exists and quantity has been extracted from M10
Applied to: Set Quantity in Cargo
WHEN
The system updates the cargo record with manifest information
THEN
The quantity is set in the cargo record
Context: A cargo record exists and manifest type code has been extracted from M10
GIVEN
A cargo record exists and manifest type code has been extracted from M10
Applied to: Set Manifest Type Code in Cargo
WHEN
The system updates the cargo record with manifest information
THEN
The manifest type code is set in the cargo record
Context: A cargo record exists and condition response code has been extracted from M10
GIVEN
A cargo record exists and condition response code has been extracted from M10
Applied to: Set Condition Response Code in Cargo
WHEN
The system updates the cargo record with manifest information
THEN
The condition response code is set in the cargo record
Context: A cargo record has been updated with all manifest information
GIVEN
A cargo record has been updated with all manifest information
Applied to: Save Updated Cargo Record
WHEN
The system completes the manifest integration process
THEN
The updated cargo record is saved to the database
Context: Required manifest data fields are missing from the M10 segment
GIVEN
Required manifest data fields are missing from the M10 segment
Applied to: Log Missing Field Error
WHEN
The system validates the extracted data elements
THEN
An error is logged indicating which required fields are missing
Context: Manifest data validation has failed due to missing required fields
GIVEN
Manifest data validation has failed due to missing required fields
Applied to: Skip Manifest Integration
WHEN
The system determines that integration cannot proceed
THEN
The manifest integration process is skipped and processing continues with the next segment
R-GCX016-cbl-03533 (+12) File: GCX016.cbl Station Information Lookup Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Information Lookup':
  • Context - a location id is provided for station information lookup:
    For Station Information Lookup Request:
    When the system searches for station information across sd, ds, and ks tables in hierarchical order, then the system returns the first matching station record found or uses default location name if no records are found.
  • Context - a location id is available for lookup:
    For Lookup SD Table:
    When the system performs station information lookup, then the system first searches the sd table in gcstbrt database for matching station records.
  • Context - the system has searched the sd table for a location id:
    For SD Record Found?:
    When a matching sd record is found, then the system extracts station name and description from the sd record and completes the lookup process.
  • Context - no matching record was found in the sd table:
    For Lookup DS Table:
    When the system continues the hierarchical lookup process, then the system searches the ds table in gcstbrt database for matching station records.
  • Context - the system has searched the ds table for a location id after sd table lookup failed:
    For DS Record Found?:
    When a matching ds record is found, then the system extracts station name and description from the ds record and completes the lookup process.
  • Context - no matching records were found in both sd and ds tables:
    For Lookup KS Table:
    When the system continues the hierarchical lookup process, then the system searches the ks table in gcstbrt database for matching station records.
  • Context - the system has searched the ks table for a location id after sd and ds table lookups failed:
    For KS Record Found?:
    When a matching ks record is found, then the system extracts station name and description from the ks record and completes the lookup process.
  • Context - a matching station record has been found in any of the station tables (sd, ds, or ks):
    For Extract Station Name:
    When the system processes the found record, then the system extracts the station name field from the record for use in location mapping.
  • Context - station name has been extracted from a found station record:
    For Extract Station Description:
    When the system continues processing the station record, then the system extracts the station description field from the record for detailed location information.
  • Context - station name and description have been extracted from a station record:
    For Set Location Description:
    When the system completes station information processing, then the system sets the location description field with the extracted station information for use in cargo processing.
  • Context - either no location id is available or no matching records are found in any station table (sd, ds, ks):
    For Use Default Location Name:
    When the system cannot retrieve station information from database tables, then the system uses a default location name to ensure cargo processing can continue.
  • Context - the system has searched all station tables (sd, ds, ks) for a location id:
    For Log Station Not Found:
    When no matching station records are found in any table, then the system logs the station not found condition before using default location name.
  • Context - a station information lookup request is initiated:
    For Location ID Available?:
    When the system begins the lookup process, then the system checks if a location id is available and either proceeds with table lookups or uses default location name.
👨‍💻 Technical ACs (Gherkin)
Context: A location ID is provided for station information lookup
GIVEN
A location ID is provided for station information lookup
Applied to: Station Information Lookup Request
WHEN
The system searches for station information across SD, DS, and KS tables in hierarchical order
THEN
The system returns the first matching station record found or uses default location name if no records are found
Context: A location ID is available for lookup
GIVEN
A location ID is available for lookup
Applied to: Lookup SD Table
WHEN
The system performs station information lookup
THEN
The system first searches the SD table in GCSTBRT database for matching station records
Context: The system has searched the SD table for a location ID
GIVEN
The system has searched the SD table for a location ID
Applied to: SD Record Found?
WHEN
A matching SD record is found
THEN
The system extracts station name and description from the SD record and completes the lookup process
Context: No matching record was found in the SD table
GIVEN
No matching record was found in the SD table
Applied to: Lookup DS Table
WHEN
The system continues the hierarchical lookup process
THEN
The system searches the DS table in GCSTBRT database for matching station records
Context: The system has searched the DS table for a location ID after SD table lookup failed
GIVEN
The system has searched the DS table for a location ID after SD table lookup failed
Applied to: DS Record Found?
WHEN
A matching DS record is found
THEN
The system extracts station name and description from the DS record and completes the lookup process
Context: No matching records were found in both SD and DS tables
GIVEN
No matching records were found in both SD and DS tables
Applied to: Lookup KS Table
WHEN
The system continues the hierarchical lookup process
THEN
The system searches the KS table in GCSTBRT database for matching station records
Context: The system has searched the KS table for a location ID after SD and DS table lookups failed
GIVEN
The system has searched the KS table for a location ID after SD and DS table lookups failed
Applied to: KS Record Found?
WHEN
A matching KS record is found
THEN
The system extracts station name and description from the KS record and completes the lookup process
Context: A matching station record has been found in any of the station tables (SD, DS, or KS)
GIVEN
A matching station record has been found in any of the station tables (SD, DS, or KS)
Applied to: Extract Station Name
WHEN
The system processes the found record
THEN
The system extracts the station name field from the record for use in location mapping
Context: Station name has been extracted from a found station record
GIVEN
Station name has been extracted from a found station record
Applied to: Extract Station Description
WHEN
The system continues processing the station record
THEN
The system extracts the station description field from the record for detailed location information
Context: Station name and description have been extracted from a station record
GIVEN
Station name and description have been extracted from a station record
Applied to: Set Location Description
WHEN
The system completes station information processing
THEN
The system sets the location description field with the extracted station information for use in cargo processing
Context: Either no location ID is available or no matching records are found in any station table (SD, DS, KS)
GIVEN
Either no location ID is available or no matching records are found in any station table (SD, DS, KS)
Applied to: Use Default Location Name
WHEN
The system cannot retrieve station information from database tables
THEN
The system uses a default location name to ensure cargo processing can continue
Context: The system has searched all station tables (SD, DS, KS) for a location ID
GIVEN
The system has searched all station tables (SD, DS, KS) for a location ID
Applied to: Log Station Not Found
WHEN
No matching station records are found in any table
THEN
The system logs the station not found condition before using default location name
Context: A station information lookup request is initiated
GIVEN
A station information lookup request is initiated
Applied to: Location ID Available?
WHEN
The system begins the lookup process
THEN
The system checks if a location ID is available and either proceeds with table lookups or uses default location name
R-GCX016-cbl-03546 (+10) File: GCX016.cbl Payer of Freight Broker Name Resolution Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Payer of Freight Broker Name Resolution':
  • Context - a cargo record requires payer of freight information:
    For Access Secondary Cargo Records GCSA2RT:
    When the system accesses secondary cargo records gcsa2rt, then secondary cargo record data is retrieved for further processing.
  • Context - secondary cargo records have been accessed:
    For N101 Payer of Freight Record Found?:
    When the system checks for n101 payer of freight record existence, then processing continues if n101 record found, otherwise process terminates.
  • Context - n101 payer of freight record exists:
    For Extract Payer of Freight Entity Information:
    When the system extracts payer of freight entity information, then entity details are available for broker type validation.
  • Context - payer of freight entity information has been extracted:
    For Check if Entity is Broker Type:
    When the system checks if entity is classified as broker type, then entity is classified as broker or non-broker for appropriate processing path.
  • Context - entity is classified as broker type:
    For Construct PF= Prefix Lookup Key:
    When the system constructs pf= prefix lookup key, then specialized broker lookup key is created for table search.
  • Context - pf= prefix lookup key has been constructed:
    For Search Broker Table with PF= Prefix:
    When the system searches broker table with pf= prefix key, then broker table search is executed using specialized prefix lookup.
  • Context - broker table search with pf= prefix has been executed:
    For Broker Short Name Found?:
    When the system validates broker short name discovery, then processing continues with found name or falls back to original entity name.
  • Context - broker short name has been found in table lookup:
    For Retrieve Broker Short Name:
    When the system retrieves broker short name, then broker short name is set as the payer of freight name.
  • Context - entity is not broker type or broker short name lookup failed:
    For Use Original Entity Name:
    When the system uses original entity name as fallback, then original entity name is set as the payer of freight name.
  • Context - payer of freight name has been determined (either broker short name or original entity name):
    For Complete Payer of Freight Resolution:
    When the system completes payer of freight resolution, then payer of freight name resolution process is finalized.
  • Context - payer of freight resolution process has been completed:
    For Log Resolution Results:
    When the system logs resolution results, then resolution results are recorded for audit and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires payer of freight information
GIVEN
A cargo record requires payer of freight information
Applied to: Access Secondary Cargo Records GCSA2RT
WHEN
The system accesses secondary cargo records GCSA2RT
THEN
Secondary cargo record data is retrieved for further processing
Context: Secondary cargo records have been accessed
GIVEN
Secondary cargo records have been accessed
Applied to: N101 Payer of Freight Record Found?
WHEN
The system checks for N101 payer of freight record existence
THEN
Processing continues if N101 record found, otherwise process terminates
Context: N101 payer of freight record exists
GIVEN
N101 payer of freight record exists
Applied to: Extract Payer of Freight Entity Information
WHEN
The system extracts payer of freight entity information
THEN
Entity details are available for broker type validation
Context: Payer of freight entity information has been extracted
GIVEN
Payer of freight entity information has been extracted
Applied to: Check if Entity is Broker Type
WHEN
The system checks if entity is classified as broker type
THEN
Entity is classified as broker or non-broker for appropriate processing path
Context: Entity is classified as broker type
GIVEN
Entity is classified as broker type
Applied to: Construct PF= Prefix Lookup Key
WHEN
The system constructs PF= prefix lookup key
THEN
Specialized broker lookup key is created for table search
Context: PF= prefix lookup key has been constructed
GIVEN
PF= prefix lookup key has been constructed
Applied to: Search Broker Table with PF= Prefix
WHEN
The system searches broker table with PF= prefix key
THEN
Broker table search is executed using specialized prefix lookup
Context: Broker table search with PF= prefix has been executed
GIVEN
Broker table search with PF= prefix has been executed
Applied to: Broker Short Name Found?
WHEN
The system validates broker short name discovery
THEN
Processing continues with found name or falls back to original entity name
Context: Broker short name has been found in table lookup
GIVEN
Broker short name has been found in table lookup
Applied to: Retrieve Broker Short Name
WHEN
The system retrieves broker short name
THEN
Broker short name is set as the payer of freight name
Context: Entity is not broker type OR broker short name lookup failed
GIVEN
Entity is not broker type OR broker short name lookup failed
Applied to: Use Original Entity Name
WHEN
The system uses original entity name as fallback
THEN
Original entity name is set as the payer of freight name
Context: Payer of freight name has been determined (either broker short name or original entity name)
GIVEN
Payer of freight name has been determined (either broker short name or original entity name)
Applied to: Complete Payer of Freight Resolution
WHEN
The system completes payer of freight resolution
THEN
Payer of freight name resolution process is finalized
Context: Payer of freight resolution process has been completed
GIVEN
Payer of freight resolution process has been completed
Applied to: Log Resolution Results
WHEN
The system logs resolution results
THEN
Resolution results are recorded for audit and tracking purposes
R-GCX016-cbl-03557 (+9) File: GCX016.cbl Merlin Message Formatting Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Message Formatting':
  • Context - a merlin message is being formatted for cargo processing:
    For Check Message Type:
    When the disposition code type is manual release (mrl) or auto release (arl), then skip formatting the disposition code message and proceed to standard cargo details formatting.
    For Apply Special Broker Bond Formatting:
    When the message type is identified as a broker bond message, then apply special formatting rules including bond number, broker information, and enhanced cargo details specific to bond processing.
  • Context - a merlin message requires cargo information formatting:
    For Format Cargo Information:
    When standard cargo details need to be included in the message, then format message with car initial, car number, waybill number, and us-ccn (customs control number).
  • Context - a disposition code is being processed for cargo:
    For Add Disposition Code Details:
    When the disposition code type is not manual release and not auto release, then include the disposition code and its corresponding merlin message text in the formatted message.
  • Context - a disposition code affects cargo release quantities:
    For Calculate Quantity Actions:
    When the quantity action is add_quantity or subtract_quantity, then format and display the quantity change impact showing current release quantity, action type, and resulting new quantity.
  • Context - cargo release quantities are being modified by disposition code processing:
    For Include Release Quantity Changes:
    When quantity changes need to be communicated in the merlin message, then include current release quantity, planned quantity change, and resulting final quantity in the message format.
  • Context - k1 comment segments are available for the cargo being processed:
    For Add First K1 Comment:
    When the first k1 comment segment exists and contains data, then add the first k1 comment segment to the merlin message format.
  • Context - multiple k1 comment segments are available and the first k1 comment has been added:
    For Add Additional K1 Comments Up to 4 Total:
    When additional k1 comment segments exist and the total count is less than 4, then add the next available k1 comment segment to the message and continue checking for more comments until maximum of 4 is reached.
  • Context - all message components have been collected including cargo details, disposition codes, quantities, and comments:
    For Format Final Message Structure:
    When the message formatting process is ready for finalization, then organize all components into the final merlin message structure with proper formatting, spacing, and message layout.
  • Context - a merlin message has been formatted and is ready for transmission:
    For Set Message Destination:
    When message destination routing needs to be determined, then set the appropriate message destination based on message type, cargo location, and processing requirements.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin message is being formatted for cargo processing
GIVEN
A Merlin message is being formatted for cargo processing
Applied to: Check Message Type
WHEN
The disposition code type is Manual Release (MRL) OR Auto Release (ARL)
THEN
Skip formatting the disposition code message and proceed to standard cargo details formatting
Applied to: Apply Special Broker Bond Formatting
WHEN
The message type is identified as a broker bond message
THEN
Apply special formatting rules including bond number, broker information, and enhanced cargo details specific to bond processing
Context: A Merlin message requires cargo information formatting
GIVEN
A Merlin message requires cargo information formatting
Applied to: Format Cargo Information
WHEN
Standard cargo details need to be included in the message
THEN
Format message with car initial, car number, waybill number, and US-CCN (customs control number)
Context: A disposition code is being processed for cargo
GIVEN
A disposition code is being processed for cargo
Applied to: Add Disposition Code Details
WHEN
The disposition code type is NOT Manual Release AND NOT Auto Release
THEN
Include the disposition code and its corresponding Merlin message text in the formatted message
Context: A disposition code affects cargo release quantities
GIVEN
A disposition code affects cargo release quantities
Applied to: Calculate Quantity Actions
WHEN
The quantity action is ADD_QUANTITY OR SUBTRACT_QUANTITY
THEN
Format and display the quantity change impact showing current release quantity, action type, and resulting new quantity
Context: Cargo release quantities are being modified by disposition code processing
GIVEN
Cargo release quantities are being modified by disposition code processing
Applied to: Include Release Quantity Changes
WHEN
Quantity changes need to be communicated in the Merlin message
THEN
Include current release quantity, planned quantity change, and resulting final quantity in the message format
Context: K1 comment segments are available for the cargo being processed
GIVEN
K1 comment segments are available for the cargo being processed
Applied to: Add First K1 Comment
WHEN
The first K1 comment segment exists and contains data
THEN
Add the first K1 comment segment to the Merlin message format
Context: Multiple K1 comment segments are available and the first K1 comment has been added
GIVEN
Multiple K1 comment segments are available and the first K1 comment has been added
Applied to: Add Additional K1 Comments Up to 4 Total
WHEN
Additional K1 comment segments exist AND the total count is less than 4
THEN
Add the next available K1 comment segment to the message and continue checking for more comments until maximum of 4 is reached
Context: All message components have been collected including cargo details, disposition codes, quantities, and comments
GIVEN
All message components have been collected including cargo details, disposition codes, quantities, and comments
Applied to: Format Final Message Structure
WHEN
The message formatting process is ready for finalization
THEN
Organize all components into the final Merlin message structure with proper formatting, spacing, and message layout
Context: A Merlin message has been formatted and is ready for transmission
GIVEN
A Merlin message has been formatted and is ready for transmission
Applied to: Set Message Destination
WHEN
Message destination routing needs to be determined
THEN
Set the appropriate message destination based on message type, cargo location, and processing requirements
R-GCX016-cbl-03567 (+7) File: GCX016.cbl Broker Bond Message Detection Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Bond Message Detection':
  • Context - a message is received for processing:
    For Check Message Source:
    When the system checks the message source and cargo type, then the system identifies if the message is from a canadian pacific entity based on cprs cargo type designation.
  • Context - a message from canadian pacific entity is being processed:
    For Identify Bond Message Type:
    When the system evaluates disposition codes for bond creation indicators, then the system identifies broker-created bond messages when disposition codes are '1j', '69', or '55' indicating master in-bond processing.
  • Context - a broker-created bond message from canadian pacific is identified:
    For Extract Bond Information:
    When the system processes the x4 segment containing bond information, then the system extracts entry numbers, bond control numbers, and entry type codes for bond processing.
  • Context - bond information has been extracted from a canadian pacific message:
    For Apply Canadian Pacific Formatting Rules:
    When the system formats the bond message for processing, then the system applies cprs-specific formatting by setting cargo status to 'error' and clearing car id information for cprs records.
  • Context - a broker bond message contains entry type codes:
    For Include Bond Control Numbers:
    When the system processes entry type codes '61', '62', '63', '69', or '00', then the system translates codes to immediate transport, transport export, immediate export, us-canada-us movement, or default border processing respectively.
  • Context - a bond message contains k1 segment with broker information:
    For Add Broker Entry Information:
    When the system processes broker details for bond entries, then the system extracts broker information, validates broker codes, and associates broker details with the bond entry for notification purposes.
  • Context - a formatted canadian pacific bond message is ready for routing:
    For Set Special Message Routing:
    When the system determines message routing based on message type and broker configuration, then the system routes error messages to both 'in' and 'userr' destinations, and routes other bond messages to station-specific merlin ids.
  • Context - a bond message contains entry number information:
    For Complete Bond Message Formatting:
    When the system processes entry numbers with 'v' prefix or other formats, then the system places v-prefixed entry numbers in the entry number field and places other formats in the in-bond control number field.
👨‍💻 Technical ACs (Gherkin)
Context: A message is received for processing
GIVEN
A message is received for processing
Applied to: Check Message Source
WHEN
The system checks the message source and cargo type
THEN
The system identifies if the message is from a Canadian Pacific entity based on CPRS cargo type designation
Context: A message from Canadian Pacific entity is being processed
GIVEN
A message from Canadian Pacific entity is being processed
Applied to: Identify Bond Message Type
WHEN
The system evaluates disposition codes for bond creation indicators
THEN
The system identifies broker-created bond messages when disposition codes are '1J', '69', or '55' indicating master in-bond processing
Context: A broker-created bond message from Canadian Pacific is identified
GIVEN
A broker-created bond message from Canadian Pacific is identified
Applied to: Extract Bond Information
WHEN
The system processes the X4 segment containing bond information
THEN
The system extracts entry numbers, bond control numbers, and entry type codes for bond processing
Context: Bond information has been extracted from a Canadian Pacific message
GIVEN
Bond information has been extracted from a Canadian Pacific message
Applied to: Apply Canadian Pacific Formatting Rules
WHEN
The system formats the bond message for processing
THEN
The system applies CPRS-specific formatting by setting cargo status to 'ERROR' and clearing car ID information for CPRS records
Context: A broker bond message contains entry type codes
GIVEN
A broker bond message contains entry type codes
Applied to: Include Bond Control Numbers
WHEN
The system processes entry type codes '61', '62', '63', '69', or '00'
THEN
The system translates codes to immediate transport, transport export, immediate export, US-Canada-US movement, or default border processing respectively
Context: A bond message contains K1 segment with broker information
GIVEN
A bond message contains K1 segment with broker information
Applied to: Add Broker Entry Information
WHEN
The system processes broker details for bond entries
THEN
The system extracts broker information, validates broker codes, and associates broker details with the bond entry for notification purposes
Context: A formatted Canadian Pacific bond message is ready for routing
GIVEN
A formatted Canadian Pacific bond message is ready for routing
Applied to: Set Special Message Routing
WHEN
The system determines message routing based on message type and broker configuration
THEN
The system routes ERROR messages to both 'IN' and 'USERR' destinations, and routes other bond messages to station-specific Merlin IDs
Context: A bond message contains entry number information
GIVEN
A bond message contains entry number information
Applied to: Complete Bond Message Formatting
WHEN
The system processes entry numbers with 'V' prefix or other formats
THEN
The system places V-prefixed entry numbers in the entry number field and places other formats in the in-bond control number field
R-GCX016-cbl-03575 (+12) File: GCX016.cbl Quantity Action Message Formatting Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Quantity Action Message Formatting':
  • Context - a disposition code is being processed for quantity action message formatting:
    For Disposition Code Has Quantity Action?:
    When the system checks if the disposition code has quantity action requirements, then the system determines whether to proceed with quantity action formatting or skip quantity processing.
  • Context - a disposition code requires quantity action processing:
    For Retrieve Disposition Code Details:
    When the system needs disposition code details for message formatting, then the system retrieves disposition code information including action type and description from the dc table.
  • Context - disposition code details have been retrieved with quantity action requirements:
    For Action Type?:
    When the system evaluates the action type for quantity processing, then the system classifies the action as either add operation or subtract operation based on disposition code configuration.
  • Context - a disposition code has been classified as add operation type:
    For Format ADD Operation Message:
    When the system formats the quantity action message, then the system creates an add operation message showing the quantity increase to release amounts.
  • Context - a disposition code has been classified as subtract operation type:
    For Format SUBTRACT Operation Message:
    When the system formats the quantity action message, then the system creates a subtract operation message showing the quantity decrease from release amounts.
  • Context - a quantity action operation (add or subtract) needs to be processed:
    For Get Current Release Quantity:
    When the system requires current release quantity information, then the system retrieves the current release quantity from the cargo record for calculation purposes.
  • Context - current release quantity has been retrieved and action type is determined:
    For Calculate New Quantity After Action:
    When the system calculates the new quantity after applying the disposition code action, then the system computes the resulting quantity by adding or subtracting the disposition code quantity from current release quantity.
  • Context - a new quantity has been calculated after applying disposition code action:
    For Quantity Change Valid?:
    When the system validates the quantity change, then the system verifies the quantity change is valid (non-negative for subtractions and within business limits for additions).
  • Context - a valid quantity change has been calculated:
    For Format Quantity Change Display:
    When the system formats the quantity change for display, then the system creates a formatted display showing current quantity, action amount, and resulting quantity.
  • Context - quantity change display has been formatted:
    For Add Quantity Action to Message:
    When the system adds quantity action to the message, then the system incorporates the quantity action information into the message structure for transmission.
  • Context - quantity action has been added to the message:
    For Include Disposition Code Description:
    When the system includes disposition code description, then the system adds the disposition code description to provide context for the quantity action in the message.
  • Context - disposition code description has been included in the message:
    For Format Complete Quantity Action Message:
    When the system formats the complete quantity action message, then the system assembles all message components including quantity action, disposition code description, and formatting into a complete message.
  • Context - a disposition code does not have quantity action requirements or quantity change validation fails:
    For No Quantity Action Required:
    When the system determines no quantity action is required, then the system bypasses quantity action message formatting and proceeds to message completion.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for quantity action message formatting
GIVEN
A disposition code is being processed for quantity action message formatting
Applied to: Disposition Code Has Quantity Action?
WHEN
The system checks if the disposition code has quantity action requirements
THEN
The system determines whether to proceed with quantity action formatting or skip quantity processing
Context: A disposition code requires quantity action processing
GIVEN
A disposition code requires quantity action processing
Applied to: Retrieve Disposition Code Details
WHEN
The system needs disposition code details for message formatting
THEN
The system retrieves disposition code information including action type and description from the DC table
Context: Disposition code details have been retrieved with quantity action requirements
GIVEN
Disposition code details have been retrieved with quantity action requirements
Applied to: Action Type?
WHEN
The system evaluates the action type for quantity processing
THEN
The system classifies the action as either ADD operation or SUBTRACT operation based on disposition code configuration
Context: A disposition code has been classified as ADD operation type
GIVEN
A disposition code has been classified as ADD operation type
Applied to: Format ADD Operation Message
WHEN
The system formats the quantity action message
THEN
The system creates an ADD operation message showing the quantity increase to release amounts
Context: A disposition code has been classified as SUBTRACT operation type
GIVEN
A disposition code has been classified as SUBTRACT operation type
Applied to: Format SUBTRACT Operation Message
WHEN
The system formats the quantity action message
THEN
The system creates a SUBTRACT operation message showing the quantity decrease from release amounts
Context: A quantity action operation (ADD or SUBTRACT) needs to be processed
GIVEN
A quantity action operation (ADD or SUBTRACT) needs to be processed
Applied to: Get Current Release Quantity
WHEN
The system requires current release quantity information
THEN
The system retrieves the current release quantity from the cargo record for calculation purposes
Context: Current release quantity has been retrieved and action type is determined
GIVEN
Current release quantity has been retrieved and action type is determined
Applied to: Calculate New Quantity After Action
WHEN
The system calculates the new quantity after applying the disposition code action
THEN
The system computes the resulting quantity by adding or subtracting the disposition code quantity from current release quantity
Context: A new quantity has been calculated after applying disposition code action
GIVEN
A new quantity has been calculated after applying disposition code action
Applied to: Quantity Change Valid?
WHEN
The system validates the quantity change
THEN
The system verifies the quantity change is valid (non-negative for subtractions and within business limits for additions)
Context: A valid quantity change has been calculated
GIVEN
A valid quantity change has been calculated
Applied to: Format Quantity Change Display
WHEN
The system formats the quantity change for display
THEN
The system creates a formatted display showing current quantity, action amount, and resulting quantity
Context: Quantity change display has been formatted
GIVEN
Quantity change display has been formatted
Applied to: Add Quantity Action to Message
WHEN
The system adds quantity action to the message
THEN
The system incorporates the quantity action information into the message structure for transmission
Context: Quantity action has been added to the message
GIVEN
Quantity action has been added to the message
Applied to: Include Disposition Code Description
WHEN
The system includes disposition code description
THEN
The system adds the disposition code description to provide context for the quantity action in the message
Context: Disposition code description has been included in the message
GIVEN
Disposition code description has been included in the message
Applied to: Format Complete Quantity Action Message
WHEN
The system formats the complete quantity action message
THEN
The system assembles all message components including quantity action, disposition code description, and formatting into a complete message
Context: A disposition code does not have quantity action requirements OR quantity change validation fails
GIVEN
A disposition code does not have quantity action requirements OR quantity change validation fails
Applied to: No Quantity Action Required
WHEN
The system determines no quantity action is required
THEN
The system bypasses quantity action message formatting and proceeds to message completion
R-GCX016-cbl-03588 (+11) File: GCX016.cbl Container Type Validation for Integration Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Type Validation for Integration':
  • Context - a cargo record exists in the system:
    For Retrieve Equipment Type from Cargo Record:
    When the system needs to validate container type for integration, then the equipment type is retrieved from the cargo record for further validation.
  • Context - an equipment type code has been retrieved from the cargo record:
    For Check Equipment Type Code:
    When the system validates the equipment type code format and content, then the equipment type code is checked against valid equipment type patterns.
  • Context - an equipment type code has been validated:
    For Valid Container Type?:
    When the system evaluates if the equipment type is a container or trailer, then the system classifies the equipment as either valid container type or other equipment type.
  • Context - a container or trailer equipment type has been identified:
    For Validate Against Equipment Type Table:
    When the system looks up the equipment type in the master equipment type table, then the system validates that the equipment type exists in the reference table.
  • Context - equipment type lookup has been performed against the master table:
    For Equipment Type Found in System?:
    When the system checks if the equipment type was found in the reference table, then the system determines if the equipment type is valid (found) or invalid (not found).
  • Context - equipment type has been found in the master equipment type table:
    For Set Valid Equipment Flag:
    When the system confirms the equipment type is valid, then a valid equipment flag is set to allow further processing.
  • Context - a valid equipment type has been confirmed:
    For Map Equipment Type to Integration Format:
    When the system prepares data for integration service call, then the equipment type is mapped to the integration service format requirements.
  • Context - equipment type has been mapped to integration format:
    For Prepare Equipment Data for Integration Call:
    When the system prepares the complete equipment data package, then all required equipment data is formatted and ready for integration service call.
  • Context - equipment data has been prepared for integration:
    For Equipment Type Validation Complete:
    When all validation steps have been completed successfully, then equipment type validation is marked as complete and integration can proceed.
  • Context - equipment type was not found in the master equipment type table:
    For Set Invalid Equipment Flag:
    When the system confirms the equipment type is invalid, then an invalid equipment flag is set to prevent further processing.
  • Context - an invalid equipment flag has been set:
    For Log Equipment Type Error:
    When the system needs to record the validation failure, then an equipment type error is logged with relevant details for troubleshooting.
  • Context - equipment type error has been logged:
    For Skip Integration Service Call:
    When the system determines integration cannot proceed due to invalid equipment type, then the integration service call is skipped and processing continues without integration.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Retrieve Equipment Type from Cargo Record
WHEN
The system needs to validate container type for integration
THEN
The equipment type is retrieved from the cargo record for further validation
Context: An equipment type code has been retrieved from the cargo record
GIVEN
An equipment type code has been retrieved from the cargo record
Applied to: Check Equipment Type Code
WHEN
The system validates the equipment type code format and content
THEN
The equipment type code is checked against valid equipment type patterns
Context: An equipment type code has been validated
GIVEN
An equipment type code has been validated
Applied to: Valid Container Type?
WHEN
The system evaluates if the equipment type is a container or trailer
THEN
The system classifies the equipment as either valid container type or other equipment type
Context: A container or trailer equipment type has been identified
GIVEN
A container or trailer equipment type has been identified
Applied to: Validate Against Equipment Type Table
WHEN
The system looks up the equipment type in the master equipment type table
THEN
The system validates that the equipment type exists in the reference table
Context: Equipment type lookup has been performed against the master table
GIVEN
Equipment type lookup has been performed against the master table
Applied to: Equipment Type Found in System?
WHEN
The system checks if the equipment type was found in the reference table
THEN
The system determines if the equipment type is valid (found) or invalid (not found)
Context: Equipment type has been found in the master equipment type table
GIVEN
Equipment type has been found in the master equipment type table
Applied to: Set Valid Equipment Flag
WHEN
The system confirms the equipment type is valid
THEN
A valid equipment flag is set to allow further processing
Context: A valid equipment type has been confirmed
GIVEN
A valid equipment type has been confirmed
Applied to: Map Equipment Type to Integration Format
WHEN
The system prepares data for integration service call
THEN
The equipment type is mapped to the integration service format requirements
Context: Equipment type has been mapped to integration format
GIVEN
Equipment type has been mapped to integration format
Applied to: Prepare Equipment Data for Integration Call
WHEN
The system prepares the complete equipment data package
THEN
All required equipment data is formatted and ready for integration service call
Context: Equipment data has been prepared for integration
GIVEN
Equipment data has been prepared for integration
Applied to: Equipment Type Validation Complete
WHEN
All validation steps have been completed successfully
THEN
Equipment type validation is marked as complete and integration can proceed
Context: Equipment type was not found in the master equipment type table
GIVEN
Equipment type was not found in the master equipment type table
Applied to: Set Invalid Equipment Flag
WHEN
The system confirms the equipment type is invalid
THEN
An invalid equipment flag is set to prevent further processing
Context: An invalid equipment flag has been set
GIVEN
An invalid equipment flag has been set
Applied to: Log Equipment Type Error
WHEN
The system needs to record the validation failure
THEN
An equipment type error is logged with relevant details for troubleshooting
Context: Equipment type error has been logged
GIVEN
Equipment type error has been logged
Applied to: Skip Integration Service Call
WHEN
The system determines integration cannot proceed due to invalid equipment type
THEN
The integration service call is skipped and processing continues without integration
R-GCX016-cbl-03604 (+8) File: GCX016.cbl Secondary Cargo Record Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Secondary Cargo Record Processing':
  • Context - a cargo record requires secondary information processing:
    For Access Cargo Secondary Records GCSA2RT Segments:
    When the system attempts to access gcsa2rt secondary cargo records, then the system should verify if secondary records are available and proceed accordingly.
    For No Secondary Records Available - Continue:
    When no secondary cargo records are available in gcsa2rt segments, then the system should continue processing without payer of freight information and proceed to the next step.
  • Context - secondary cargo records are available for processing:
    For Read N101 Segments from Secondary Records:
    When the system reads n101 segments from the secondary records, then the system should determine if n101 segments exist and are accessible for processing.
  • Context - an n101 segment is found in secondary cargo records:
    For Check N101-01 Qualifier:
    When the system checks the n101-01 qualifier field, then the system should determine if the qualifier equals 'pf' indicating payer of freight information.
  • Context - an n101 segment has qualifier 'pf' for payer of freight:
    For Extract Payer of Freight Entity Information:
    When the system processes the payer of freight entity information, then the system should extract the entity name from n101-02 field and store it in payer fields.
  • Context - one n101 segment has been processed in a secondary record:
    For Check for Additional N101 Segments:
    When the system checks for additional n101 segments in the same record, then the system should determine if more n101 segments exist for continued processing.
  • Context - an n101 segment exists with a qualifier other than 'pf':
    For Extract Other Supplemental Information from N101:
    When the system processes the non-pf n101 segment, then the system should extract other supplemental information and store it in working storage.
  • Context - one secondary record has been processed completely:
    For Continue Processing Next Secondary Record:
    When the system checks for additional secondary records, then the system should continue processing the next available secondary record if more exist.
  • Context - all available secondary records have been processed:
    For Complete Secondary Record Processing:
    When the system completes secondary record processing, then the system should finalize the extraction of payer of freight and supplemental information for return to calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires secondary information processing
GIVEN
A cargo record requires secondary information processing
Applied to: Access Cargo Secondary Records GCSA2RT Segments
WHEN
The system attempts to access GCSA2RT secondary cargo records
THEN
The system should verify if secondary records are available and proceed accordingly
Applied to: No Secondary Records Available - Continue
WHEN
No secondary cargo records are available in GCSA2RT segments
THEN
The system should continue processing without payer of freight information and proceed to the next step
Context: Secondary cargo records are available for processing
GIVEN
Secondary cargo records are available for processing
Applied to: Read N101 Segments from Secondary Records
WHEN
The system reads N101 segments from the secondary records
THEN
The system should determine if N101 segments exist and are accessible for processing
Context: An N101 segment is found in secondary cargo records
GIVEN
An N101 segment is found in secondary cargo records
Applied to: Check N101-01 Qualifier
WHEN
The system checks the N101-01 qualifier field
THEN
The system should determine if the qualifier equals 'PF' indicating payer of freight information
Context: An N101 segment has qualifier 'PF' for payer of freight
GIVEN
An N101 segment has qualifier 'PF' for payer of freight
Applied to: Extract Payer of Freight Entity Information
WHEN
The system processes the payer of freight entity information
THEN
The system should extract the entity name from N101-02 field and store it in payer fields
Context: One N101 segment has been processed in a secondary record
GIVEN
One N101 segment has been processed in a secondary record
Applied to: Check for Additional N101 Segments
WHEN
The system checks for additional N101 segments in the same record
THEN
The system should determine if more N101 segments exist for continued processing
Context: An N101 segment exists with a qualifier other than 'PF'
GIVEN
An N101 segment exists with a qualifier other than 'PF'
Applied to: Extract Other Supplemental Information from N101
WHEN
The system processes the non-PF N101 segment
THEN
The system should extract other supplemental information and store it in working storage
Context: One secondary record has been processed completely
GIVEN
One secondary record has been processed completely
Applied to: Continue Processing Next Secondary Record
WHEN
The system checks for additional secondary records
THEN
The system should continue processing the next available secondary record if more exist
Context: All available secondary records have been processed
GIVEN
All available secondary records have been processed
Applied to: Complete Secondary Record Processing
WHEN
The system completes secondary record processing
THEN
The system should finalize the extraction of payer of freight and supplemental information for return to calling process
R-GCX016-cbl-03613 (+12) File: GCX016.cbl Message Routing by Type Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Routing by Type':
  • Context - a message is ready for routing and has been classified as an error message type:
    For Route to Error Destinations:
    When the message type is error or arrcanl (arrival cancellation), then the system routes the message to both 'in' destination and 'userr' destination for error processing.
  • Context - a message is ready for routing and has been classified as an information message:
    For Route to Info Users:
    When the message type is info, then the system routes the message to 'in' destination and station-specific merlin ids for information distribution.
  • Context - a message is ready for routing and has been classified as an unrelease message:
    For Route to Unrelease Baskets:
    When the message type is unrlse (unrelease), then the system routes the message to default merlin ids and cancel-specific merlin ids for unrelease processing.
  • Context - a message is ready for routing and has been classified as a release message:
    For Route to Release Users:
    When the message type is rlse (release), then the system routes the message only to station-specific merlin ids for release notification.
  • Context - a message is ready for routing and has been classified as an export message:
    For Container Type Check:
    When the message type is export and container type validation is required, then the system checks if the container type is a specific container type or other equipment type to determine routing path.
  • Context - an export message has been validated and container type has been determined:
    For Route to USEXP Baskets:
    When the container type is identified as a specific container type requiring special handling, then the system routes the message to usexp baskets for specialized container export processing.
    For Route to Standard Export:
    When the container type is not a specific container type requiring special handling, then the system routes the message through standard export processing channels.
  • Context - a message has been routed to its initial destination based on message type:
    For Valid User Check:
    When the system performs user validation for the destination, then the system checks if the destination user is valid and authorized to receive this message type.
  • Context - a message destination has been validated and found to be invalid or unauthorized:
    For Reroute to Default Users:
    When the destination user validation fails, then the system reroutes the message to default users to ensure proper message delivery.
  • Context - a message has been validated and destination has been confirmed:
    For Set Message Keywords:
    When the message is ready for final formatting and delivery, then the system sets appropriate message keywords based on message type and content for proper categorization.
  • Context - a message has keywords set and is ready for delivery formatting:
    For Format Subject Line:
    When the system prepares the final message format, then the system formats the subject line with relevant business information including message type and key identifiers.
  • Context - a message has been fully formatted with keywords and subject line:
    For Send to Destination:
    When all routing validation and formatting is complete, then the system sends the message to its final destination through the appropriate messaging channel.
  • Context - a message has been successfully sent to its destination:
    For Log Routing Action:
    When the message delivery is complete, then the system logs the routing action including message type, destination, and delivery status for audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A message is ready for routing and has been classified as an error message type
GIVEN
A message is ready for routing and has been classified as an error message type
Applied to: Route to Error Destinations
WHEN
The message type is ERROR or ARRCANL (arrival cancellation)
THEN
The system routes the message to both 'IN' destination and 'USERR' destination for error processing
Context: A message is ready for routing and has been classified as an information message
GIVEN
A message is ready for routing and has been classified as an information message
Applied to: Route to Info Users
WHEN
The message type is INFO
THEN
The system routes the message to 'IN' destination and station-specific Merlin IDs for information distribution
Context: A message is ready for routing and has been classified as an unrelease message
GIVEN
A message is ready for routing and has been classified as an unrelease message
Applied to: Route to Unrelease Baskets
WHEN
The message type is UNRLSE (unrelease)
THEN
The system routes the message to default Merlin IDs and cancel-specific Merlin IDs for unrelease processing
Context: A message is ready for routing and has been classified as a release message
GIVEN
A message is ready for routing and has been classified as a release message
Applied to: Route to Release Users
WHEN
The message type is RLSE (release)
THEN
The system routes the message only to station-specific Merlin IDs for release notification
Context: A message is ready for routing and has been classified as an export message
GIVEN
A message is ready for routing and has been classified as an export message
Applied to: Container Type Check
WHEN
The message type is EXPORT and container type validation is required
THEN
The system checks if the container type is a specific container type or other equipment type to determine routing path
Context: An export message has been validated and container type has been determined
GIVEN
An export message has been validated and container type has been determined
Applied to: Route to USEXP Baskets
WHEN
The container type is identified as a specific container type requiring special handling
THEN
The system routes the message to USEXP baskets for specialized container export processing
Applied to: Route to Standard Export
WHEN
The container type is not a specific container type requiring special handling
THEN
The system routes the message through standard export processing channels
Context: A message has been routed to its initial destination based on message type
GIVEN
A message has been routed to its initial destination based on message type
Applied to: Valid User Check
WHEN
The system performs user validation for the destination
THEN
The system checks if the destination user is valid and authorized to receive this message type
Context: A message destination has been validated and found to be invalid or unauthorized
GIVEN
A message destination has been validated and found to be invalid or unauthorized
Applied to: Reroute to Default Users
WHEN
The destination user validation fails
THEN
The system reroutes the message to default users to ensure proper message delivery
Context: A message has been validated and destination has been confirmed
GIVEN
A message has been validated and destination has been confirmed
Applied to: Set Message Keywords
WHEN
The message is ready for final formatting and delivery
THEN
The system sets appropriate message keywords based on message type and content for proper categorization
Context: A message has keywords set and is ready for delivery formatting
GIVEN
A message has keywords set and is ready for delivery formatting
Applied to: Format Subject Line
WHEN
The system prepares the final message format
THEN
The system formats the subject line with relevant business information including message type and key identifiers
Context: A message has been fully formatted with keywords and subject line
GIVEN
A message has been fully formatted with keywords and subject line
Applied to: Send to Destination
WHEN
All routing validation and formatting is complete
THEN
The system sends the message to its final destination through the appropriate messaging channel
Context: A message has been successfully sent to its destination
GIVEN
A message has been successfully sent to its destination
Applied to: Log Routing Action
WHEN
The message delivery is complete
THEN
The system logs the routing action including message type, destination, and delivery status for audit purposes
R-GCX016-cbl-03626 (+10) File: GCX016.cbl Invalid User Handling and Rerouting Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Invalid User Handling and Rerouting':
  • Context - a message is ready for routing with a destination user id:
    For Check Destination User ID:
    When the system checks the destination user id validity, then the system determines if the user id is valid or invalid for message routing.
  • Context - a message with a valid destination user id:
    For Route to Original User:
    When the user id validation passes, then the message is routed to the original specified user without modification.
  • Context - a message with an invalid destination user id:
    For Identify Default User for Message Type:
    When the system needs to identify a default user, then the system determines the default user based on the message type (error, info, release, or export).
  • Context - an error message with an invalid destination user id:
    For Route to Default Error User:
    When the message type is identified as error, then the message is routed to the default error user.
  • Context - an informational message with an invalid destination user id:
    For Route to Default Info User:
    When the message type is identified as info, then the message is routed to the default info user.
  • Context - a release message with an invalid destination user id:
    For Route to Default Release User:
    When the message type is identified as release, then the message is routed to the default release user.
  • Context - an export message with an invalid destination user id:
    For Route to Default Export User:
    When the message type is identified as export, then the message is routed to the default export user.
  • Context - a message has been rerouted due to invalid user id:
    For Generate Invalid User Notification:
    When the rerouting to default user is completed, then a notification is generated indicating the invalid user id and the rerouting action taken.
  • Context - a message has been rerouted from invalid user to default user:
    For Log Rerouting Action:
    When the invalid user notification is generated, then the rerouting action is logged with original user id, default user id, message type, and timestamp.
  • Context - a rerouting action has been logged:
    For Update Message Routing History:
    When the system updates the message routing history, then the routing history is updated with the rerouting event details including original destination, new destination, and reason for rerouting.
  • Context - message routing history has been updated with rerouting details:
    For Send Message to New Destination:
    When the system sends the message to the new destination, then the message is delivered to the default user with all original content intact.
👨‍💻 Technical ACs (Gherkin)
Context: A message is ready for routing with a destination user ID
GIVEN
A message is ready for routing with a destination user ID
Applied to: Check Destination User ID
WHEN
The system checks the destination user ID validity
THEN
The system determines if the user ID is valid or invalid for message routing
Context: A message with a valid destination user ID
GIVEN
A message with a valid destination user ID
Applied to: Route to Original User
WHEN
The user ID validation passes
THEN
The message is routed to the original specified user without modification
Context: A message with an invalid destination user ID
GIVEN
A message with an invalid destination user ID
Applied to: Identify Default User for Message Type
WHEN
The system needs to identify a default user
THEN
The system determines the default user based on the message type (Error, Info, Release, or Export)
Context: An error message with an invalid destination user ID
GIVEN
An error message with an invalid destination user ID
Applied to: Route to Default Error User
WHEN
The message type is identified as Error
THEN
The message is routed to the default error user
Context: An informational message with an invalid destination user ID
GIVEN
An informational message with an invalid destination user ID
Applied to: Route to Default Info User
WHEN
The message type is identified as Info
THEN
The message is routed to the default info user
Context: A release message with an invalid destination user ID
GIVEN
A release message with an invalid destination user ID
Applied to: Route to Default Release User
WHEN
The message type is identified as Release
THEN
The message is routed to the default release user
Context: An export message with an invalid destination user ID
GIVEN
An export message with an invalid destination user ID
Applied to: Route to Default Export User
WHEN
The message type is identified as Export
THEN
The message is routed to the default export user
Context: A message has been rerouted due to invalid user ID
GIVEN
A message has been rerouted due to invalid user ID
Applied to: Generate Invalid User Notification
WHEN
The rerouting to default user is completed
THEN
A notification is generated indicating the invalid user ID and the rerouting action taken
Context: A message has been rerouted from invalid user to default user
GIVEN
A message has been rerouted from invalid user to default user
Applied to: Log Rerouting Action
WHEN
The invalid user notification is generated
THEN
The rerouting action is logged with original user ID, default user ID, message type, and timestamp
Context: A rerouting action has been logged
GIVEN
A rerouting action has been logged
Applied to: Update Message Routing History
WHEN
The system updates the message routing history
THEN
The routing history is updated with the rerouting event details including original destination, new destination, and reason for rerouting
Context: Message routing history has been updated with rerouting details
GIVEN
Message routing history has been updated with rerouting details
Applied to: Send Message to New Destination
WHEN
The system sends the message to the new destination
THEN
The message is delivered to the default user with all original content intact
R-GCX016-cbl-03651 (+15) File: GCX016.cbl Report Field Formatting Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Field Formatting':
  • Context - a cargo record with car identification data:
    For Format Car ID Information:
    When car id is available in the system, then format car initial and car number into displayable car id information.
  • Context - a cargo record being processed for reporting:
    For Set Car ID to Spaces:
    When car id information is not available, then set car id field to spaces for report display.
    For Set Waybill to Spaces:
    When waybill number is not available, then set waybill field to spaces for report display.
    For Set US-CCN to Spaces:
    When us-ccn is not available, then set us-ccn field to spaces for report display.
    For Set Disposition to Spaces:
    When disposition code is not available, then set disposition code field to spaces for report display.
  • Context - a cargo record with waybill number data:
    For Format Waybill Information:
    When waybill number is available in the system, then format waybill number into displayable format for reports.
  • Context - a cargo record with us-ccn data:
    For Format US-CCN with Status:
    When us-ccn is available in the system, then format us-ccn with current cargo status for report display.
  • Context - a cprs cargo record with status information:
    For Add CPRS Status Description:
    When cargo belongs to cprs system, then add cprs-specific status description to the formatted output.
  • Context - a uscs cargo record with status information:
    For Add USCS Status Description:
    When cargo belongs to uscs system, then add uscs-specific status description to the formatted output.
  • Context - a cargo record with disposition code data:
    For Format Disposition Code:
    When disposition code is available in the system, then format disposition code into displayable format for reports.
  • Context - a formatted disposition code:
    For Add Disposition Description:
    When disposition code has an associated description, then add disposition code description to the formatted output for clarity.
  • Context - a report being generated:
    For Format Current Date/Time:
    When current date and time formatting is required, then format current system date and time into standard report format.
  • Context - a cargo processing event:
    For Format Processing Timestamp:
    When processing timestamp needs to be recorded, then format processing timestamp into standard audit format for reports.
  • Context - cargo with associated broker entry numbers:
    For Format Entry Numbers for Display:
    When broker entry numbers are available, then format entry numbers into displayable format for broker reports.
  • Context - cargo with quantity discrepancies:
    For Format Quantities for Mismatch Report:
    When quantity mismatch reporting is required, then format quantity information highlighting mismatches for review.
  • Context - a formatted report ready for distribution:
    For Set Destination User Codes:
    When report routing is required, then set appropriate destination user codes based on cargo type and processing requirements.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with car identification data
GIVEN
A cargo record with car identification data
Applied to: Format Car ID Information
WHEN
Car ID is available in the system
THEN
Format car initial and car number into displayable car ID information
Context: A cargo record being processed for reporting
GIVEN
A cargo record being processed for reporting
Applied to: Set Car ID to Spaces
WHEN
Car ID information is not available
THEN
Set car ID field to spaces for report display
Applied to: Set Waybill to Spaces
WHEN
Waybill number is not available
THEN
Set waybill field to spaces for report display
Applied to: Set US-CCN to Spaces
WHEN
US-CCN is not available
THEN
Set US-CCN field to spaces for report display
Applied to: Set Disposition to Spaces
WHEN
Disposition code is not available
THEN
Set disposition code field to spaces for report display
Context: A cargo record with waybill number data
GIVEN
A cargo record with waybill number data
Applied to: Format Waybill Information
WHEN
Waybill number is available in the system
THEN
Format waybill number into displayable format for reports
Context: A cargo record with US-CCN data
GIVEN
A cargo record with US-CCN data
Applied to: Format US-CCN with Status
WHEN
US-CCN is available in the system
THEN
Format US-CCN with current cargo status for report display
Context: A CPRS cargo record with status information
GIVEN
A CPRS cargo record with status information
Applied to: Add CPRS Status Description
WHEN
Cargo belongs to CPRS system
THEN
Add CPRS-specific status description to the formatted output
Context: A USCS cargo record with status information
GIVEN
A USCS cargo record with status information
Applied to: Add USCS Status Description
WHEN
Cargo belongs to USCS system
THEN
Add USCS-specific status description to the formatted output
Context: A cargo record with disposition code data
GIVEN
A cargo record with disposition code data
Applied to: Format Disposition Code
WHEN
Disposition code is available in the system
THEN
Format disposition code into displayable format for reports
Context: A formatted disposition code
GIVEN
A formatted disposition code
Applied to: Add Disposition Description
WHEN
Disposition code has an associated description
THEN
Add disposition code description to the formatted output for clarity
Context: A report being generated
GIVEN
A report being generated
Applied to: Format Current Date/Time
WHEN
Current date and time formatting is required
THEN
Format current system date and time into standard report format
Context: A cargo processing event
GIVEN
A cargo processing event
Applied to: Format Processing Timestamp
WHEN
Processing timestamp needs to be recorded
THEN
Format processing timestamp into standard audit format for reports
Context: Cargo with associated broker entry numbers
GIVEN
Cargo with associated broker entry numbers
Applied to: Format Entry Numbers for Display
WHEN
Broker entry numbers are available
THEN
Format entry numbers into displayable format for broker reports
Context: Cargo with quantity discrepancies
GIVEN
Cargo with quantity discrepancies
Applied to: Format Quantities for Mismatch Report
WHEN
Quantity mismatch reporting is required
THEN
Format quantity information highlighting mismatches for review
Context: A formatted report ready for distribution
GIVEN
A formatted report ready for distribution
Applied to: Set Destination User Codes
WHEN
Report routing is required
THEN
Set appropriate destination user codes based on cargo type and processing requirements
R-GCX016-cbl-03667 (+14) File: GCX016.cbl Quantity Display Formatting Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Quantity Display Formatting':
  • Context - an x4 customs release segment is available for processing:
    For Retrieve Broker Entry Number from X4 Segment:
    When the system needs to retrieve broker entry number for quantity comparison, then the broker entry number is extracted from the x4 segment and made available for display formatting.
  • Context - a cargo record exists in the system:
    For Retrieve Manifest Quantity from Cargo Record:
    When the system needs to retrieve manifest quantity for quantity mismatch validation, then the manifest quantity is extracted from the cargo record and made available for comparison.
  • Context - an x4 customs release segment contains broker entry quantity information:
    For Retrieve Broker Entry Quantity from X4 Segment:
    When the system needs to retrieve broker entry quantity for mismatch detection, then the broker entry quantity is extracted from the x4 segment and made available for comparison.
  • Context - manifest quantity and broker entry quantity are available:
    For Calculate Quantity Difference:
    When the system calculates the difference between these quantities, then the quantity difference is computed as the absolute difference between manifest quantity and broker entry quantity.
  • Context - manifest quantity and broker entry quantity have been retrieved and compared:
    For Quantity Mismatch Detected?:
    When the system evaluates if the quantities match, then if the manifest quantity does not equal the broker entry quantity, a mismatch is detected and formatting is required, otherwise no formatting is needed.
  • Context - a quantity mismatch has been detected and broker entry number is available:
    For Format Broker Entry Number for Display:
    When the system formats the broker entry number for display, then the broker entry number is formatted according to report display standards and prepared for inclusion in the mismatch report.
  • Context - a quantity mismatch has been detected and manifest quantity is available:
    For Format Manifest Quantity for Display:
    When the system formats the manifest quantity for display, then the manifest quantity is formatted according to report display standards and prepared for inclusion in the mismatch report.
  • Context - a quantity mismatch has been detected and broker entry quantity is available:
    For Format Broker Entry Quantity for Display:
    When the system formats the broker entry quantity for display, then the broker entry quantity is formatted according to report display standards and prepared for inclusion in the mismatch report.
  • Context - a quantity mismatch has been detected and quantity difference has been calculated:
    For Format Quantity Difference for Display:
    When the system formats the quantity difference for display, then the quantity difference is formatted according to report display standards and prepared for inclusion in the mismatch report.
  • Context - all quantity information has been formatted for display:
    For Build Mismatch Report Line:
    When the system builds the mismatch report line, then a complete report line is constructed that will contain the entry number, manifest quantity, broker quantity, and difference amount.
  • Context - a mismatch report line is being built and broker entry number is formatted:
    For Add Entry Number to Report:
    When the system adds the entry number to the report, then the formatted broker entry number is included in the appropriate position within the mismatch report line.
  • Context - a mismatch report line is being built and manifest quantity is formatted:
    For Add Manifest Quantity to Report:
    When the system adds the manifest quantity to the report, then the formatted manifest quantity is included in the appropriate position within the mismatch report line.
  • Context - a mismatch report line is being built and broker entry quantity is formatted:
    For Add Broker Quantity to Report:
    When the system adds the broker quantity to the report, then the formatted broker entry quantity is included in the appropriate position within the mismatch report line.
  • Context - a mismatch report line is being built and quantity difference is formatted:
    For Add Difference Amount to Report:
    When the system adds the difference amount to the report, then the formatted quantity difference is included in the appropriate position within the mismatch report line.
  • Context - a quantity mismatch has been detected and formatted for reporting:
    For Set Mismatch Flag for Notification:
    When the system sets the mismatch flag, then the mismatch notification flag is activated to ensure broker notification will be triggered for this quantity discrepancy.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 customs release segment is available for processing
GIVEN
An X4 customs release segment is available for processing
Applied to: Retrieve Broker Entry Number from X4 Segment
WHEN
The system needs to retrieve broker entry number for quantity comparison
THEN
The broker entry number is extracted from the X4 segment and made available for display formatting
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Retrieve Manifest Quantity from Cargo Record
WHEN
The system needs to retrieve manifest quantity for quantity mismatch validation
THEN
The manifest quantity is extracted from the cargo record and made available for comparison
Context: An X4 customs release segment contains broker entry quantity information
GIVEN
An X4 customs release segment contains broker entry quantity information
Applied to: Retrieve Broker Entry Quantity from X4 Segment
WHEN
The system needs to retrieve broker entry quantity for mismatch detection
THEN
The broker entry quantity is extracted from the X4 segment and made available for comparison
Context: Manifest quantity and broker entry quantity are available
GIVEN
Manifest quantity and broker entry quantity are available
Applied to: Calculate Quantity Difference
WHEN
The system calculates the difference between these quantities
THEN
The quantity difference is computed as the absolute difference between manifest quantity and broker entry quantity
Context: Manifest quantity and broker entry quantity have been retrieved and compared
GIVEN
Manifest quantity and broker entry quantity have been retrieved and compared
Applied to: Quantity Mismatch Detected?
WHEN
The system evaluates if the quantities match
THEN
If the manifest quantity does not equal the broker entry quantity, a mismatch is detected and formatting is required, otherwise no formatting is needed
Context: A quantity mismatch has been detected and broker entry number is available
GIVEN
A quantity mismatch has been detected and broker entry number is available
Applied to: Format Broker Entry Number for Display
WHEN
The system formats the broker entry number for display
THEN
The broker entry number is formatted according to report display standards and prepared for inclusion in the mismatch report
Context: A quantity mismatch has been detected and manifest quantity is available
GIVEN
A quantity mismatch has been detected and manifest quantity is available
Applied to: Format Manifest Quantity for Display
WHEN
The system formats the manifest quantity for display
THEN
The manifest quantity is formatted according to report display standards and prepared for inclusion in the mismatch report
Context: A quantity mismatch has been detected and broker entry quantity is available
GIVEN
A quantity mismatch has been detected and broker entry quantity is available
Applied to: Format Broker Entry Quantity for Display
WHEN
The system formats the broker entry quantity for display
THEN
The broker entry quantity is formatted according to report display standards and prepared for inclusion in the mismatch report
Context: A quantity mismatch has been detected and quantity difference has been calculated
GIVEN
A quantity mismatch has been detected and quantity difference has been calculated
Applied to: Format Quantity Difference for Display
WHEN
The system formats the quantity difference for display
THEN
The quantity difference is formatted according to report display standards and prepared for inclusion in the mismatch report
Context: All quantity information has been formatted for display
GIVEN
All quantity information has been formatted for display
Applied to: Build Mismatch Report Line
WHEN
The system builds the mismatch report line
THEN
A complete report line is constructed that will contain the entry number, manifest quantity, broker quantity, and difference amount
Context: A mismatch report line is being built and broker entry number is formatted
GIVEN
A mismatch report line is being built and broker entry number is formatted
Applied to: Add Entry Number to Report
WHEN
The system adds the entry number to the report
THEN
The formatted broker entry number is included in the appropriate position within the mismatch report line
Context: A mismatch report line is being built and manifest quantity is formatted
GIVEN
A mismatch report line is being built and manifest quantity is formatted
Applied to: Add Manifest Quantity to Report
WHEN
The system adds the manifest quantity to the report
THEN
The formatted manifest quantity is included in the appropriate position within the mismatch report line
Context: A mismatch report line is being built and broker entry quantity is formatted
GIVEN
A mismatch report line is being built and broker entry quantity is formatted
Applied to: Add Broker Quantity to Report
WHEN
The system adds the broker quantity to the report
THEN
The formatted broker entry quantity is included in the appropriate position within the mismatch report line
Context: A mismatch report line is being built and quantity difference is formatted
GIVEN
A mismatch report line is being built and quantity difference is formatted
Applied to: Add Difference Amount to Report
WHEN
The system adds the difference amount to the report
THEN
The formatted quantity difference is included in the appropriate position within the mismatch report line
Context: A quantity mismatch has been detected and formatted for reporting
GIVEN
A quantity mismatch has been detected and formatted for reporting
Applied to: Set Mismatch Flag for Notification
WHEN
The system sets the mismatch flag
THEN
The mismatch notification flag is activated to ensure broker notification will be triggered for this quantity discrepancy
R-GCX016-cbl-03694 (+21) File: GCX016.cbl Merlin Report Field Initialization Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Report Field Initialization':
  • Context - a merlin report needs to be generated:
    For Clear Report Working Fields:
    When the system starts report field initialization, then all report working fields are cleared to spaces or zeros.
  • Context - report working fields have been cleared:
    For Initialize Message Header Fields:
    When message header initialization is performed, then message header fields are set with standard merlin format values.
  • Context - message header fields are initialized:
    For Set Default User Codes:
    When default user code setup is executed, then standard user codes are assigned for message routing destinations.
  • Context - message type is identified as error or arrival cancellation:
    For Set Error Message Routing:
    When error message routing is configured, then message is routed to both 'in' destination and 'userr' error destination.
  • Context - message type is identified as informational:
    For Set Info Message Routing:
    When information message routing is configured, then message is routed to 'in' destination and station-specific merlin ids.
  • Context - message type is identified as cargo release:
    For Set Release Message Routing:
    When release message routing is configured, then message is routed only to station-specific merlin ids.
  • Context - message type is identified as export:
    For Set Export Message Routing:
    When export message routing is configured, then message routing is set with equipment type validation for containers and trailers.
  • Context - message type is identified as cargo unrelease:
    For Set Unrelease Message Routing:
    When unrelease message routing is configured, then message is routed to default destinations and cancel-specific merlin ids.
  • Context - message routing has been configured:
    For Initialize Report Display Fields:
    When report display field initialization is performed, then all display fields are formatted with standard presentation templates.
  • Context - report display fields are initialized:
    For Set Car ID Format Fields:
    When car id formatting is applied, then car identification fields are formatted with standard car id display format.
  • Context - car id fields are formatted:
    For Set Waybill Display Fields:
    When waybill display formatting is applied, then waybill fields are formatted with standard waybill display format.
  • Context - waybill fields are formatted:
    For Set US-CCN Display Fields:
    When us-ccn display formatting is applied, then us-ccn fields are formatted with standard ccn display format.
  • Context - us-ccn fields are formatted:
    For Set Disposition Code Fields:
    When disposition code formatting is applied, then disposition code fields include both code and description for clarity.
  • Context - disposition code fields are formatted:
    For Set Date/Time Stamp Fields:
    When date and time stamp setting is performed, then current date and time are captured in standard report timestamp format.
  • Context - date and time stamps are set:
    For Set Quantity Display Fields:
    When quantity display formatting is applied, then quantity fields are formatted with standard numerical display format.
  • Context - quantity fields are formatted:
    For Initialize Destination Baskets:
    When destination basket initialization is performed, then destination basket arrays are cleared and ready for recipient assignment.
  • Context - destination baskets are initialized:
    For Invalid User Code?:
    When user code validation is performed, then system identifies whether assigned user codes are valid or require default rerouting.
  • Context - user code validation identifies invalid codes:
    For Set Default Rerouting User:
    When default rerouting is applied, then system assigns default rerouting user for message delivery.
  • Context - user code validation is complete:
    For Set Message Keywords:
    When message keyword assignment is performed, then appropriate keywords are assigned based on message type and content.
  • Context - message keywords are assigned:
    For Set Subject Line Format:
    When subject line formatting is applied, then subject line is formatted with standard message identification format.
  • Context - subject line format is set:
    For Finalize Report Field Setup:
    When report field setup finalization is performed, then all report fields are validated and confirmed ready for message generation.
  • Context - report field setup is finalized:
    For Report Fields Ready for Message Generation:
    When final readiness confirmation is performed, then system confirms all fields are ready and message generation can proceed.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin report needs to be generated
GIVEN
A Merlin report needs to be generated
Applied to: Clear Report Working Fields
WHEN
The system starts report field initialization
THEN
All report working fields are cleared to spaces or zeros
Context: Report working fields have been cleared
GIVEN
Report working fields have been cleared
Applied to: Initialize Message Header Fields
WHEN
Message header initialization is performed
THEN
Message header fields are set with standard Merlin format values
Context: Message header fields are initialized
GIVEN
Message header fields are initialized
Applied to: Set Default User Codes
WHEN
Default user code setup is executed
THEN
Standard user codes are assigned for message routing destinations
Context: Message type is identified as error or arrival cancellation
GIVEN
Message type is identified as error or arrival cancellation
Applied to: Set Error Message Routing
WHEN
Error message routing is configured
THEN
Message is routed to both 'IN' destination and 'USERR' error destination
Context: Message type is identified as informational
GIVEN
Message type is identified as informational
Applied to: Set Info Message Routing
WHEN
Information message routing is configured
THEN
Message is routed to 'IN' destination and station-specific Merlin IDs
Context: Message type is identified as cargo release
GIVEN
Message type is identified as cargo release
Applied to: Set Release Message Routing
WHEN
Release message routing is configured
THEN
Message is routed only to station-specific Merlin IDs
Context: Message type is identified as export
GIVEN
Message type is identified as export
Applied to: Set Export Message Routing
WHEN
Export message routing is configured
THEN
Message routing is set with equipment type validation for containers and trailers
Context: Message type is identified as cargo unrelease
GIVEN
Message type is identified as cargo unrelease
Applied to: Set Unrelease Message Routing
WHEN
Unrelease message routing is configured
THEN
Message is routed to default destinations and cancel-specific Merlin IDs
Context: Message routing has been configured
GIVEN
Message routing has been configured
Applied to: Initialize Report Display Fields
WHEN
Report display field initialization is performed
THEN
All display fields are formatted with standard presentation templates
Context: Report display fields are initialized
GIVEN
Report display fields are initialized
Applied to: Set Car ID Format Fields
WHEN
Car ID formatting is applied
THEN
Car identification fields are formatted with standard car ID display format
Context: Car ID fields are formatted
GIVEN
Car ID fields are formatted
Applied to: Set Waybill Display Fields
WHEN
Waybill display formatting is applied
THEN
Waybill fields are formatted with standard waybill display format
Context: Waybill fields are formatted
GIVEN
Waybill fields are formatted
Applied to: Set US-CCN Display Fields
WHEN
US-CCN display formatting is applied
THEN
US-CCN fields are formatted with standard CCN display format
Context: US-CCN fields are formatted
GIVEN
US-CCN fields are formatted
Applied to: Set Disposition Code Fields
WHEN
Disposition code formatting is applied
THEN
Disposition code fields include both code and description for clarity
Context: Disposition code fields are formatted
GIVEN
Disposition code fields are formatted
Applied to: Set Date/Time Stamp Fields
WHEN
Date and time stamp setting is performed
THEN
Current date and time are captured in standard report timestamp format
Context: Date and time stamps are set
GIVEN
Date and time stamps are set
Applied to: Set Quantity Display Fields
WHEN
Quantity display formatting is applied
THEN
Quantity fields are formatted with standard numerical display format
Context: Quantity fields are formatted
GIVEN
Quantity fields are formatted
Applied to: Initialize Destination Baskets
WHEN
Destination basket initialization is performed
THEN
Destination basket arrays are cleared and ready for recipient assignment
Context: Destination baskets are initialized
GIVEN
Destination baskets are initialized
Applied to: Invalid User Code?
WHEN
User code validation is performed
THEN
System identifies whether assigned user codes are valid or require default rerouting
Context: User code validation identifies invalid codes
GIVEN
User code validation identifies invalid codes
Applied to: Set Default Rerouting User
WHEN
Default rerouting is applied
THEN
System assigns default rerouting user for message delivery
Context: User code validation is complete
GIVEN
User code validation is complete
Applied to: Set Message Keywords
WHEN
Message keyword assignment is performed
THEN
Appropriate keywords are assigned based on message type and content
Context: Message keywords are assigned
GIVEN
Message keywords are assigned
Applied to: Set Subject Line Format
WHEN
Subject line formatting is applied
THEN
Subject line is formatted with standard message identification format
Context: Subject line format is set
GIVEN
Subject line format is set
Applied to: Finalize Report Field Setup
WHEN
Report field setup finalization is performed
THEN
All report fields are validated and confirmed ready for message generation
Context: Report field setup is finalized
GIVEN
Report field setup is finalized
Applied to: Report Fields Ready for Message Generation
WHEN
Final readiness confirmation is performed
THEN
System confirms all fields are ready and message generation can proceed
R-GCX016-cbl-03716 (+4) File: GCX016.cbl Machine Sequence Number Management Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Machine Sequence Number Management':
  • Context - the machine sequence number management process is started:
    For Initialize Sequence Number to 1:
    When the current sequence number is invalid, not found, or not readable, then the sequence number should be initialized to 1.
  • Context - a valid machine sequence number exists:
    For Increment Sequence Number by 1:
    When a new transaction requires sequence number assignment, then the sequence number should be incremented by 1.
  • Context - the machine sequence number has been incremented:
    For Reset Sequence Number to 1:
    When the sequence number reaches the maximum allowable value, then the sequence number should be reset to 1.
  • Context - the machine sequence number has been updated (incremented or reset):
    For Store Updated Sequence Number:
    When the sequence number update process is completed, then the updated sequence number should be stored in the machine sequence counter for future use.
  • Context - the machine sequence number has been successfully updated and stored:
    For Return Sequence Number for Transaction Tracking:
    When the sequence number management process is completed, then the current sequence number should be returned for transaction tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: The machine sequence number management process is started
GIVEN
The machine sequence number management process is started
Applied to: Initialize Sequence Number to 1
WHEN
The current sequence number is invalid, not found, or not readable
THEN
The sequence number should be initialized to 1
Context: A valid machine sequence number exists
GIVEN
A valid machine sequence number exists
Applied to: Increment Sequence Number by 1
WHEN
A new transaction requires sequence number assignment
THEN
The sequence number should be incremented by 1
Context: The machine sequence number has been incremented
GIVEN
The machine sequence number has been incremented
Applied to: Reset Sequence Number to 1
WHEN
The sequence number reaches the maximum allowable value
THEN
The sequence number should be reset to 1
Context: The machine sequence number has been updated (incremented or reset)
GIVEN
The machine sequence number has been updated (incremented or reset)
Applied to: Store Updated Sequence Number
WHEN
The sequence number update process is completed
THEN
The updated sequence number should be stored in the machine sequence counter for future use
Context: The machine sequence number has been successfully updated and stored
GIVEN
The machine sequence number has been successfully updated and stored
Applied to: Return Sequence Number for Transaction Tracking
WHEN
The sequence number management process is completed
THEN
The current sequence number should be returned for transaction tracking purposes
R-GCX016-cbl-03721 (+14) File: GCX016.cbl Message Queue Array Initialization for Train Operations Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Queue Array Initialization for Train Operations':
  • Context - a train operation requires message processing:
    For Initialize MQ Message Arrays:
    When the system begins message queue initialization, then message queue arrays are cleared and prepared for train segment processing.
  • Context - message queue arrays are initialized:
    For Set Train Operation Parameters:
    When train operation parameters need to be established, then system sets appropriate flags and counters for train message processing.
  • Context - a message segment is available for processing:
    For Process M10 Manifest Segment:
    When the segment type is identified as m10 manifest segment, then the system routes the segment for train manifest processing.
    For Process V9 Event Detail Segment:
    When the segment type is identified as v9 event detail segment, then the system routes the segment for train event processing.
  • Context - an m10 manifest segment is being processed:
    For Extract Train Information:
    When train information extraction is required, then system extracts vessel name, train identifier, and related manifest data for validation.
  • Context - train information has been extracted from manifest:
    For Validate Train Existence:
    When train validation is performed, then system confirms train exists in database or generates appropriate error for non-existent trains.
  • Context - a v9 event detail segment is being processed:
    For Extract Disposition Code:
    When disposition code extraction is required, then system extracts the disposition code that indicates the specific train operation type.
  • Context - a disposition code has been extracted from v9 segment:
    For Set Train Arrival Parameters:
    When the disposition code is pod (port of discharge) or aad (actual arrival date), then system sets train arrival processing parameters and flags.
    For Set Train Cancellation Parameters:
    When the disposition code is coc (cancel on condition), then system sets train cancellation processing parameters and flags.
  • Context - a train segment requires array storage:
    For Initialize Message Array Entry:
    When a new message array entry is needed, then system initializes array entry with proper structure and default values.
  • Context - message array entries are being added:
    For Calculate Array Entry Count:
    When array entry count calculation is required, then system increments entry count and maintains accurate array index.
  • Context - segment data has been processed and validated:
    For Store Segment Data in Array:
    When data storage in message array is required, then system stores segment data in the correct array entry with proper formatting.
  • Context - current segment has been processed and stored:
    For More Segments?:
    When system checks for additional segments to process, then system continues processing if more segments exist or proceeds to finalization if complete.
  • Context - all required segments have been processed and stored:
    For Finalize Array Structure:
    When array structure finalization is required, then system finalizes array structure and prepares for train operation execution.
  • Context - message array structure has been finalized:
    For Set Processing Flags:
    When processing control flags need to be set, then system sets flags indicating successful initialization and readiness for train operation processing.
👨‍💻 Technical ACs (Gherkin)
Context: A train operation requires message processing
GIVEN
A train operation requires message processing
Applied to: Initialize MQ Message Arrays
WHEN
The system begins message queue initialization
THEN
Message queue arrays are cleared and prepared for train segment processing
Context: Message queue arrays are initialized
GIVEN
Message queue arrays are initialized
Applied to: Set Train Operation Parameters
WHEN
Train operation parameters need to be established
THEN
System sets appropriate flags and counters for train message processing
Context: A message segment is available for processing
GIVEN
A message segment is available for processing
Applied to: Process M10 Manifest Segment
WHEN
The segment type is identified as M10 manifest segment
THEN
The system routes the segment for train manifest processing
Applied to: Process V9 Event Detail Segment
WHEN
The segment type is identified as V9 event detail segment
THEN
The system routes the segment for train event processing
Context: An M10 manifest segment is being processed
GIVEN
An M10 manifest segment is being processed
Applied to: Extract Train Information
WHEN
Train information extraction is required
THEN
System extracts vessel name, train identifier, and related manifest data for validation
Context: Train information has been extracted from manifest
GIVEN
Train information has been extracted from manifest
Applied to: Validate Train Existence
WHEN
Train validation is performed
THEN
System confirms train exists in database or generates appropriate error for non-existent trains
Context: A V9 event detail segment is being processed
GIVEN
A V9 event detail segment is being processed
Applied to: Extract Disposition Code
WHEN
Disposition code extraction is required
THEN
System extracts the disposition code that indicates the specific train operation type
Context: A disposition code has been extracted from V9 segment
GIVEN
A disposition code has been extracted from V9 segment
Applied to: Set Train Arrival Parameters
WHEN
The disposition code is POD (Port of Discharge) or AAD (Actual Arrival Date)
THEN
System sets train arrival processing parameters and flags
Applied to: Set Train Cancellation Parameters
WHEN
The disposition code is COC (Cancel on Condition)
THEN
System sets train cancellation processing parameters and flags
Context: A train segment requires array storage
GIVEN
A train segment requires array storage
Applied to: Initialize Message Array Entry
WHEN
A new message array entry is needed
THEN
System initializes array entry with proper structure and default values
Context: Message array entries are being added
GIVEN
Message array entries are being added
Applied to: Calculate Array Entry Count
WHEN
Array entry count calculation is required
THEN
System increments entry count and maintains accurate array index
Context: Segment data has been processed and validated
GIVEN
Segment data has been processed and validated
Applied to: Store Segment Data in Array
WHEN
Data storage in message array is required
THEN
System stores segment data in the correct array entry with proper formatting
Context: Current segment has been processed and stored
GIVEN
Current segment has been processed and stored
Applied to: More Segments?
WHEN
System checks for additional segments to process
THEN
System continues processing if more segments exist or proceeds to finalization if complete
Context: All required segments have been processed and stored
GIVEN
All required segments have been processed and stored
Applied to: Finalize Array Structure
WHEN
Array structure finalization is required
THEN
System finalizes array structure and prepares for train operation execution
Context: Message array structure has been finalized
GIVEN
Message array structure has been finalized
Applied to: Set Processing Flags
WHEN
Processing control flags need to be set
THEN
System sets flags indicating successful initialization and readiness for train operation processing
R-GCX016-cbl-03759 (+6) File: GCX016.cbl MQ Queue Opening Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MQ Queue Opening':
  • Context - mq connection parameters are initialized:
    For Establish MQ Connection:
    When system attempts to establish mq connection, then connection is established successfully or connection failure is handled.
  • Context - mq connection is established successfully:
    For Open EDI Message Queue for Reading:
    When system attempts to open edi message queue for reading, then queue is opened successfully for message retrieval or queue access failure is handled.
  • Context - edi message queue is opened successfully:
    For Set Queue Ready Status:
    When queue open operation completes without errors, then queue status is set to ready for message processing.
  • Context - queue is ready for message processing:
    For Initialize Message Array Parameters:
    When system initializes message array parameters, then message arrays are configured with proper parameters for edi message storage.
  • Context - message array parameters are initialized:
    For Calculate Message Entry Counts:
    When system calculates message entry counts, then maximum message entry count is determined for processing capacity.
  • Context - mq connection attempt is made:
    For Handle MQ Connection Error:
    When mq connection fails, then connection failure is logged and error status is set.
  • Context - queue open attempt is made:
    For Handle Queue Open Error:
    When queue open operation fails, then queue access failure is logged and error status is set.
👨‍💻 Technical ACs (Gherkin)
Context: MQ connection parameters are initialized
GIVEN
MQ connection parameters are initialized
Applied to: Establish MQ Connection
WHEN
System attempts to establish MQ connection
THEN
Connection is established successfully or connection failure is handled
Context: MQ connection is established successfully
GIVEN
MQ connection is established successfully
Applied to: Open EDI Message Queue for Reading
WHEN
System attempts to open EDI message queue for reading
THEN
Queue is opened successfully for message retrieval or queue access failure is handled
Context: EDI message queue is opened successfully
GIVEN
EDI message queue is opened successfully
Applied to: Set Queue Ready Status
WHEN
Queue open operation completes without errors
THEN
Queue status is set to ready for message processing
Context: Queue is ready for message processing
GIVEN
Queue is ready for message processing
Applied to: Initialize Message Array Parameters
WHEN
System initializes message array parameters
THEN
Message arrays are configured with proper parameters for EDI message storage
Context: Message array parameters are initialized
GIVEN
Message array parameters are initialized
Applied to: Calculate Message Entry Counts
WHEN
System calculates message entry counts
THEN
Maximum message entry count is determined for processing capacity
Context: MQ connection attempt is made
GIVEN
MQ connection attempt is made
Applied to: Handle MQ Connection Error
WHEN
MQ connection fails
THEN
Connection failure is logged and error status is set
Context: Queue open attempt is made
GIVEN
Queue open attempt is made
Applied to: Handle Queue Open Error
WHEN
Queue open operation fails
THEN
Queue access failure is logged and error status is set
R-GCX016-cbl-03766 (+17) File: GCX016.cbl MQ Message Retrieval Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MQ Message Retrieval':
  • Context - mq message retrieval process is starting:
    For Initialize Message Arrays:
    When system begins message processing operations, then message arrays are initialized and entry counters are reset to zero.
  • Context - message arrays are initialized:
    For Open MQ Queue for Reading:
    When system attempts to open mq queue for reading, then mq queue connection is established for message retrieval operations.
  • Context - system attempts to open mq queue:
    For MQ Queue Available?:
    When mq queue connection status is evaluated, then if queue is available, proceed to message retrieval, otherwise handle connection error.
  • Context - mq queue is available and connected:
    For Get Message from Queue:
    When system attempts to get next message from queue, then message is retrieved from queue and made available for processing.
  • Context - system attempts to retrieve message from queue:
    For Message Retrieved?:
    When message retrieval operation completes, then if message retrieved successfully, proceed to calculate length, otherwise check for more messages.
  • Context - message is successfully retrieved from mq queue:
    For Calculate Message Length:
    When system processes the variable-length message, then message length is calculated and stored for entry count determination.
  • Context - message length is calculated:
    For Determine Entry Count Based on Message Structure:
    When system analyzes message structure and content, then entry count is determined based on message segments and structure.
  • Context - entry count is determined from message structure:
    For Process Variable-Length Message Array:
    When system processes the variable-length message array, then message array is processed and prepared for validation.
  • Context - message array is processed:
    For Validate Message Completeness:
    When system validates message completeness and format, then message completeness and integrity are verified.
  • Context - message completeness validation is performed:
    For Message Valid?:
    When system evaluates overall message validity, then if message is valid, store in processing array, otherwise handle processing error.
  • Context - message passes all validation checks:
    For Store Message in Processing Array:
    When system stores message for processing, then message is stored in processing array and available for business logic processing.
  • Context - message is stored in processing array:
    For Increment Message Counter:
    When system updates message tracking counters, then message counter is incremented to reflect successful message processing.
  • Context - current message processing is complete:
    For More Messages?:
    When system checks for additional messages in queue, then if more messages available, continue retrieval, otherwise close queue and return results.
  • Context - no more messages are available in queue:
    For Close MQ Queue:
    When system completes message retrieval operations, then mq queue connection is properly closed.
  • Context - mq queue is closed and all messages processed:
    For Return Entry Count and Messages:
    When system completes message retrieval process, then entry count and processed messages are returned to calling program.
  • Context - mq queue is not available or connection fails:
    For Handle MQ Connection Error:
    When system encounters mq connection error, then error is logged and processing continues with error handling.
  • Context - message fails validation or processing encounters error:
    For Handle Message Processing Error:
    When system detects message processing error, then error is logged and processing continues with error handling.
  • Context - mq connection error or message processing error occurs:
    For Log Error and Continue:
    When system handles the error condition, then error is logged and system continues to check for more messages.
👨‍💻 Technical ACs (Gherkin)
Context: MQ message retrieval process is starting
GIVEN
MQ message retrieval process is starting
Applied to: Initialize Message Arrays
WHEN
system begins message processing operations
THEN
message arrays are initialized and entry counters are reset to zero
Context: message arrays are initialized
GIVEN
message arrays are initialized
Applied to: Open MQ Queue for Reading
WHEN
system attempts to open MQ queue for reading
THEN
MQ queue connection is established for message retrieval operations
Context: system attempts to open MQ queue
GIVEN
system attempts to open MQ queue
Applied to: MQ Queue Available?
WHEN
MQ queue connection status is evaluated
THEN
if queue is available, proceed to message retrieval, otherwise handle connection error
Context: MQ queue is available and connected
GIVEN
MQ queue is available and connected
Applied to: Get Message from Queue
WHEN
system attempts to get next message from queue
THEN
message is retrieved from queue and made available for processing
Context: system attempts to retrieve message from queue
GIVEN
system attempts to retrieve message from queue
Applied to: Message Retrieved?
WHEN
message retrieval operation completes
THEN
if message retrieved successfully, proceed to calculate length, otherwise check for more messages
Context: message is successfully retrieved from MQ queue
GIVEN
message is successfully retrieved from MQ queue
Applied to: Calculate Message Length
WHEN
system processes the variable-length message
THEN
message length is calculated and stored for entry count determination
Context: message length is calculated
GIVEN
message length is calculated
Applied to: Determine Entry Count Based on Message Structure
WHEN
system analyzes message structure and content
THEN
entry count is determined based on message segments and structure
Context: entry count is determined from message structure
GIVEN
entry count is determined from message structure
Applied to: Process Variable-Length Message Array
WHEN
system processes the variable-length message array
THEN
message array is processed and prepared for validation
Context: message array is processed
GIVEN
message array is processed
Applied to: Validate Message Completeness
WHEN
system validates message completeness and format
THEN
message completeness and integrity are verified
Context: message completeness validation is performed
GIVEN
message completeness validation is performed
Applied to: Message Valid?
WHEN
system evaluates overall message validity
THEN
if message is valid, store in processing array, otherwise handle processing error
Context: message passes all validation checks
GIVEN
message passes all validation checks
Applied to: Store Message in Processing Array
WHEN
system stores message for processing
THEN
message is stored in processing array and available for business logic processing
Context: message is stored in processing array
GIVEN
message is stored in processing array
Applied to: Increment Message Counter
WHEN
system updates message tracking counters
THEN
message counter is incremented to reflect successful message processing
Context: current message processing is complete
GIVEN
current message processing is complete
Applied to: More Messages?
WHEN
system checks for additional messages in queue
THEN
if more messages available, continue retrieval, otherwise close queue and return results
Context: no more messages are available in queue
GIVEN
no more messages are available in queue
Applied to: Close MQ Queue
WHEN
system completes message retrieval operations
THEN
MQ queue connection is properly closed
Context: MQ queue is closed and all messages processed
GIVEN
MQ queue is closed and all messages processed
Applied to: Return Entry Count and Messages
WHEN
system completes message retrieval process
THEN
entry count and processed messages are returned to calling program
Context: MQ queue is not available or connection fails
GIVEN
MQ queue is not available or connection fails
Applied to: Handle MQ Connection Error
WHEN
system encounters MQ connection error
THEN
error is logged and processing continues with error handling
Context: message fails validation or processing encounters error
GIVEN
message fails validation or processing encounters error
Applied to: Handle Message Processing Error
WHEN
system detects message processing error
THEN
error is logged and processing continues with error handling
Context: MQ connection error or message processing error occurs
GIVEN
MQ connection error or message processing error occurs
Applied to: Log Error and Continue
WHEN
system handles the error condition
THEN
error is logged and system continues to check for more messages
R-GCX016-cbl-03784 (+13) File: GCX016.cbl Message Array Entry Calculation Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Array Entry Calculation':
  • Context - an edi message has been received from the mq queue:
    For Get Message Length:
    When the system needs to determine the message processing requirements, then the system retrieves and stores the total message length for subsequent processing.
  • Context - the system is ready to parse an edi message:
    For Initialize Entry Counter:
    When message processing begins, then the entry counter is set to zero to track the number of segments processed.
  • Context - an edi message with known length is available for processing:
    For Parse Message Structure:
    When the system begins message analysis, then the message structure is parsed to identify individual edi segments.
  • Context - the system is processing edi message segments:
    For More Segments to Process?:
    When a segment has been processed, then the system checks if more segments exist in the message for continued processing.
  • Context - an edi segment is available for processing:
    For Identify Segment Type:
    When the system encounters a new segment, then the segment type is identified based on the segment identifier.
  • Context - an edi segment has been identified:
    For Calculate Segment Length:
    When the system needs to process the segment, then the segment length is calculated based on the segment structure and content.
  • Context - an edi segment has been successfully processed:
    For Increment Entry Counter:
    When the segment processing is complete, then the entry counter is incremented by one to track the total number of processed segments.
  • Context - a segment has been processed and its length calculated:
    For Move to Next Segment Position:
    When the system needs to continue processing, then the message position pointer is moved to the start of the next segment.
  • Context - all segments in the edi message have been processed:
    For Validate Total Entries Against Message Length:
    When the system completes segment counting, then the total entry count is validated against the expected count derived from message length.
  • Context - the entry count has been calculated and validated:
    For Entry Count Valid?:
    When the system needs to determine processing success, then the entry count is checked for validity and consistency with the message structure.
  • Context - the entry count has been validated as correct:
    For Set Final Entry Count:
    When validation passes successfully, then the final entry count is set for use in subsequent message processing.
  • Context - the entry count validation has failed:
    For Log Entry Count Error:
    When an invalid entry count is detected, then an error is logged indicating the entry count validation failure.
  • Context - an entry count error has been logged:
    For Set Error Flag:
    When entry count validation fails, then an error flag is set to indicate processing failure.
  • Context - entry count calculation is complete (either successful or with error):
    For Return Entry Count for Processing:
    When the calling process requests the entry count, then the calculated entry count is returned along with any error indicators for further processing.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI message has been received from the MQ queue
GIVEN
An EDI message has been received from the MQ queue
Applied to: Get Message Length
WHEN
The system needs to determine the message processing requirements
THEN
The system retrieves and stores the total message length for subsequent processing
Context: The system is ready to parse an EDI message
GIVEN
The system is ready to parse an EDI message
Applied to: Initialize Entry Counter
WHEN
Message processing begins
THEN
The entry counter is set to zero to track the number of segments processed
Context: An EDI message with known length is available for processing
GIVEN
An EDI message with known length is available for processing
Applied to: Parse Message Structure
WHEN
The system begins message analysis
THEN
The message structure is parsed to identify individual EDI segments
Context: The system is processing EDI message segments
GIVEN
The system is processing EDI message segments
Applied to: More Segments to Process?
WHEN
A segment has been processed
THEN
The system checks if more segments exist in the message for continued processing
Context: An EDI segment is available for processing
GIVEN
An EDI segment is available for processing
Applied to: Identify Segment Type
WHEN
The system encounters a new segment
THEN
The segment type is identified based on the segment identifier
Context: An EDI segment has been identified
GIVEN
An EDI segment has been identified
Applied to: Calculate Segment Length
WHEN
The system needs to process the segment
THEN
The segment length is calculated based on the segment structure and content
Context: An EDI segment has been successfully processed
GIVEN
An EDI segment has been successfully processed
Applied to: Increment Entry Counter
WHEN
The segment processing is complete
THEN
The entry counter is incremented by one to track the total number of processed segments
Context: A segment has been processed and its length calculated
GIVEN
A segment has been processed and its length calculated
Applied to: Move to Next Segment Position
WHEN
The system needs to continue processing
THEN
The message position pointer is moved to the start of the next segment
Context: All segments in the EDI message have been processed
GIVEN
All segments in the EDI message have been processed
Applied to: Validate Total Entries Against Message Length
WHEN
The system completes segment counting
THEN
The total entry count is validated against the expected count derived from message length
Context: The entry count has been calculated and validated
GIVEN
The entry count has been calculated and validated
Applied to: Entry Count Valid?
WHEN
The system needs to determine processing success
THEN
The entry count is checked for validity and consistency with the message structure
Context: The entry count has been validated as correct
GIVEN
The entry count has been validated as correct
Applied to: Set Final Entry Count
WHEN
Validation passes successfully
THEN
The final entry count is set for use in subsequent message processing
Context: The entry count validation has failed
GIVEN
The entry count validation has failed
Applied to: Log Entry Count Error
WHEN
An invalid entry count is detected
THEN
An error is logged indicating the entry count validation failure
Context: An entry count error has been logged
GIVEN
An entry count error has been logged
Applied to: Set Error Flag
WHEN
Entry count validation fails
THEN
An error flag is set to indicate processing failure
Context: Entry count calculation is complete (either successful or with error)
GIVEN
Entry count calculation is complete (either successful or with error)
Applied to: Return Entry Count for Processing
WHEN
The calling process requests the entry count
THEN
The calculated entry count is returned along with any error indicators for further processing
R-GCX016-cbl-03798 (+11) File: GCX016.cbl Shiproot Existence Verification Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Shiproot Existence Verification':
  • Context - edi segments are available in the message queue:
    For Receive EDI Segment for Processing:
    When the system processes messages from the queue, then valid messages with backout count zero are accepted for processing and messages with non-zero backout count are skipped.
  • Context - an edi segment is received for processing:
    For Extract Shipment Identifier from EDI Segment:
    When the segment type is x4 (customs release), then the system extracts ccn key, car id, waybill number, and disposition code from the segment.
  • Context - shipment identifiers have been extracted from edi segment:
    For Query Shipment Root Database:
    When the system searches for cargo records, then it performs exact match search using ccn key first, then broader search if exact match fails, excluding deleted records.
  • Context - the system has queried the shipment database:
    For Shipment Root Record Exists?:
    When searching for cargo records by ccn key and car id, then if no matching non-deleted cargo record is found, set cargo not found flag, otherwise set cargo found flag.
  • Context - cargo record search has failed to find matching records:
    For Log Shipment Root Not Found Error:
    When processing cprs cargo that is not found, then increment error counter and create error message with disposition code and ccn key marked as not found.
  • Context - an error has been logged for cargo not found:
    For Send Error Notification to Business Users:
    When the error involves cprs cargo processing, then send merlin error message to business users with cargo details and not found status.
  • Context - shipment root record does not exist in the database:
    For Skip EDI Segment Processing:
    When cargo not found flag is set, then skip further processing of the current edi segment and continue to next segment.
  • Context - shipment root record exists in the database:
    For Proceed with EDI Segment Processing:
    When cargo found flag is set, then proceed with disposition code processing and cargo status updates.
  • Context - disposition code is 95 (proceed) and entry type is in (61, 62, 63, 69):
    For Create U1 Segment with In-Bond Information:
    When processing new cargo with in-bond requirements, then create master in-bond record with appropriate entry type classification and bond number validation.
  • Context - edi segment has been successfully processed:
    For Update Shipment Record with EDI Data:
    When cargo status changes are required, then update cargo record with new status, release quantities, and disposition codes, and call gcciis for hold/release status changes if cargo status description changed.
  • Context - edi segment processing has completed successfully:
    For Log Successful Processing:
    When cargo record has been updated, then log cargo status changes and spawn gct1051e logging transaction excluding disposition codes 54 and 55.
  • Context - current edi segment processing is complete:
    For Continue to Next EDI Segment:
    When more segments exist in the message queue, then continue processing next available segment until end of queue is reached.
👨‍💻 Technical ACs (Gherkin)
Context: EDI segments are available in the message queue
GIVEN
EDI segments are available in the message queue
Applied to: Receive EDI Segment for Processing
WHEN
the system processes messages from the queue
THEN
valid messages with backout count zero are accepted for processing and messages with non-zero backout count are skipped
Context: an EDI segment is received for processing
GIVEN
an EDI segment is received for processing
Applied to: Extract Shipment Identifier from EDI Segment
WHEN
the segment type is X4 (customs release)
THEN
the system extracts CCN key, car ID, waybill number, and disposition code from the segment
Context: shipment identifiers have been extracted from EDI segment
GIVEN
shipment identifiers have been extracted from EDI segment
Applied to: Query Shipment Root Database
WHEN
the system searches for cargo records
THEN
it performs exact match search using CCN key first, then broader search if exact match fails, excluding deleted records
Context: the system has queried the shipment database
GIVEN
the system has queried the shipment database
Applied to: Shipment Root Record Exists?
WHEN
searching for cargo records by CCN key and car ID
THEN
if no matching non-deleted cargo record is found, set cargo not found flag, otherwise set cargo found flag
Context: cargo record search has failed to find matching records
GIVEN
cargo record search has failed to find matching records
Applied to: Log Shipment Root Not Found Error
WHEN
processing CPRS cargo that is not found
THEN
increment error counter and create error message with disposition code and CCN key marked as not found
Context: an error has been logged for cargo not found
GIVEN
an error has been logged for cargo not found
Applied to: Send Error Notification to Business Users
WHEN
the error involves CPRS cargo processing
THEN
send Merlin error message to business users with cargo details and not found status
Context: shipment root record does not exist in the database
GIVEN
shipment root record does not exist in the database
Applied to: Skip EDI Segment Processing
WHEN
cargo not found flag is set
THEN
skip further processing of the current EDI segment and continue to next segment
Context: shipment root record exists in the database
GIVEN
shipment root record exists in the database
Applied to: Proceed with EDI Segment Processing
WHEN
cargo found flag is set
THEN
proceed with disposition code processing and cargo status updates
Context: disposition code is 95 (proceed) and entry type is in (61, 62, 63, 69)
GIVEN
disposition code is 95 (proceed) and entry type is in (61, 62, 63, 69)
Applied to: Create U1 Segment with In-Bond Information
WHEN
processing new cargo with in-bond requirements
THEN
create master in-bond record with appropriate entry type classification and bond number validation
Context: EDI segment has been successfully processed
GIVEN
EDI segment has been successfully processed
Applied to: Update Shipment Record with EDI Data
WHEN
cargo status changes are required
THEN
update cargo record with new status, release quantities, and disposition codes, and call GCCIIS for hold/release status changes if cargo status description changed
Context: EDI segment processing has completed successfully
GIVEN
EDI segment processing has completed successfully
Applied to: Log Successful Processing
WHEN
cargo record has been updated
THEN
log cargo status changes and spawn GCT1051E logging transaction excluding disposition codes 54 and 55
Context: current EDI segment processing is complete
GIVEN
current EDI segment processing is complete
Applied to: Continue to Next EDI Segment
WHEN
more segments exist in the message queue
THEN
continue processing next available segment until end of queue is reached
R-GCX016-cbl-03810 (+9) File: GCX016.cbl U1 Segment Creation and Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'U1 Segment Creation and Processing':
  • Context - a request to create u1 segment for a shipment:
    For Validate Shipment Root Record:
    When the system checks for shipment root record existence, then the system should validate the shipment root record exists and proceed with u1 creation, or log an error if not found.
  • Context - a u1 segment creation request for a shipment:
    For Log Shiproot Not Found Error:
    When the shipment root record does not exist in the system, then the system should log a shiproot not found error and terminate the u1 creation process.
  • Context - a valid shipment root record exists:
    For Retrieve In-Bond Information:
    When the system processes u1 segment creation, then the system should retrieve all relevant in-bond information from the shipment record for u1 population.
  • Context - in-bond information contains cprail type codes:
    For Convert CPRAIL Type Codes to EDI 309 Values:
    When the system creates u1 segment structure, then the system should convert cprail type codes to corresponding edi 309 standard values using the type code mapping table.
  • Context - in-bond information has been retrieved and type codes converted:
    For Create U1 Segment Structure:
    When the system processes u1 segment creation, then the system should create a properly formatted u1 segment structure with all required fields initialized.
  • Context - a u1 segment structure has been created:
    For Populate In-Bond Details:
    When the system populates in-bond details, then the system should populate all in-bond fields including bond numbers, entry types, broker information, and customs data into the u1 segment.
  • Context - a u1 segment has been populated with in-bond details:
    For Insert U1 Segment into Database:
    When the system attempts to store the u1 segment, then the system should insert the u1 segment into the database and return success or failure status.
  • Context - a u1 segment insertion has been attempted:
    For Database Operation Successful?:
    When the database operation completes, then the system should check if the database operation was successful and proceed accordingly or log an error if failed.
    For Log Database Error:
    When the database operation fails, then the system should log the database error with relevant details and terminate the u1 creation process.
  • Context - u1 segment has been successfully inserted into the database:
    For U1 Segment Created Successfully:
    When the database operation returns success status, then the system should confirm u1 segment creation was successful and complete the process.
👨‍💻 Technical ACs (Gherkin)
Context: A request to create U1 segment for a shipment
GIVEN
A request to create U1 segment for a shipment
Applied to: Validate Shipment Root Record
WHEN
The system checks for shipment root record existence
THEN
The system should validate the shipment root record exists and proceed with U1 creation, or log an error if not found
Context: A U1 segment creation request for a shipment
GIVEN
A U1 segment creation request for a shipment
Applied to: Log Shiproot Not Found Error
WHEN
The shipment root record does not exist in the system
THEN
The system should log a shiproot not found error and terminate the U1 creation process
Context: A valid shipment root record exists
GIVEN
A valid shipment root record exists
Applied to: Retrieve In-Bond Information
WHEN
The system processes U1 segment creation
THEN
The system should retrieve all relevant in-bond information from the shipment record for U1 population
Context: In-bond information contains CPRAIL type codes
GIVEN
In-bond information contains CPRAIL type codes
Applied to: Convert CPRAIL Type Codes to EDI 309 Values
WHEN
The system creates U1 segment structure
THEN
The system should convert CPRAIL type codes to corresponding EDI 309 standard values using the type code mapping table
Context: In-bond information has been retrieved and type codes converted
GIVEN
In-bond information has been retrieved and type codes converted
Applied to: Create U1 Segment Structure
WHEN
The system processes U1 segment creation
THEN
The system should create a properly formatted U1 segment structure with all required fields initialized
Context: A U1 segment structure has been created
GIVEN
A U1 segment structure has been created
Applied to: Populate In-Bond Details
WHEN
The system populates in-bond details
THEN
The system should populate all in-bond fields including bond numbers, entry types, broker information, and customs data into the U1 segment
Context: A U1 segment has been populated with in-bond details
GIVEN
A U1 segment has been populated with in-bond details
Applied to: Insert U1 Segment into Database
WHEN
The system attempts to store the U1 segment
THEN
The system should insert the U1 segment into the database and return success or failure status
Context: A U1 segment insertion has been attempted
GIVEN
A U1 segment insertion has been attempted
Applied to: Database Operation Successful?
WHEN
The database operation completes
THEN
The system should check if the database operation was successful and proceed accordingly or log an error if failed
Applied to: Log Database Error
WHEN
The database operation fails
THEN
The system should log the database error with relevant details and terminate the U1 creation process
Context: U1 segment has been successfully inserted into the database
GIVEN
U1 segment has been successfully inserted into the database
Applied to: U1 Segment Created Successfully
WHEN
The database operation returns success status
THEN
The system should confirm U1 segment creation was successful and complete the process
R-GCX016-cbl-03829 (+8) File: GCX016.cbl Shipment Segment Database Operations Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Shipment Segment Database Operations':
  • Context - a u1 shipment segment needs to be processed:
    For Validate Shiproot Existence:
    When the system checks for shipment root existence in the database, then if shipment root does not exist, processing stops with error handling, otherwise processing continues.
  • Context - a u1 segment contains cprail in-bond type codes:
    For Convert CPRAIL to EDI 309 Values:
    When the system processes the in-bond type codes for edi transmission, then cprail codes are converted to their corresponding edi 309 standard values.
  • Context - a u1 segment is being prepared for database storage:
    For Include In-Bond Details:
    When the system builds the segment structure, then all relevant in-bond details including bond numbers, entry types, and customs information are included in the segment.
  • Context - a u1 segment needs to be stored in the database:
    For U1 Segment Exists?:
    When the system checks if a u1 segment already exists for the shipment, then if segment exists, perform replace operation, otherwise perform insert operation.
  • Context - no existing u1 segment exists for the shipment:
    For Insert New U1 Segment:
    When the system performs database insert operation, then a new u1 segment record is created with all in-bond details.
  • Context - an existing u1 segment exists for the shipment:
    For Replace Existing U1 Segment:
    When the system performs database replace operation, then the existing u1 segment record is updated with current in-bond details.
  • Context - a database operation has been performed on u1 segment:
    For Operation Successful?:
    When the system checks the operation result status, then if operation successful, log success and continue, otherwise handle database error.
  • Context - u1 segment database operation completed successfully:
    For Log Successful Update:
    When the system processes the successful operation, then success information is logged for audit trail and processing continues.
  • Context - a database operation on u1 segment has failed:
    For Handle Database Error:
    When the system detects the operation failure, then error handling procedures are invoked and processing terminates with error status.
👨‍💻 Technical ACs (Gherkin)
Context: A U1 shipment segment needs to be processed
GIVEN
A U1 shipment segment needs to be processed
Applied to: Validate Shiproot Existence
WHEN
The system checks for shipment root existence in the database
THEN
If shipment root does not exist, processing stops with error handling, otherwise processing continues
Context: A U1 segment contains CPRAIL in-bond type codes
GIVEN
A U1 segment contains CPRAIL in-bond type codes
Applied to: Convert CPRAIL to EDI 309 Values
WHEN
The system processes the in-bond type codes for EDI transmission
THEN
CPRAIL codes are converted to their corresponding EDI 309 standard values
Context: A U1 segment is being prepared for database storage
GIVEN
A U1 segment is being prepared for database storage
Applied to: Include In-Bond Details
WHEN
The system builds the segment structure
THEN
All relevant in-bond details including bond numbers, entry types, and customs information are included in the segment
Context: A U1 segment needs to be stored in the database
GIVEN
A U1 segment needs to be stored in the database
Applied to: U1 Segment Exists?
WHEN
The system checks if a U1 segment already exists for the shipment
THEN
If segment exists, perform replace operation, otherwise perform insert operation
Context: No existing U1 segment exists for the shipment
GIVEN
No existing U1 segment exists for the shipment
Applied to: Insert New U1 Segment
WHEN
The system performs database insert operation
THEN
A new U1 segment record is created with all in-bond details
Context: An existing U1 segment exists for the shipment
GIVEN
An existing U1 segment exists for the shipment
Applied to: Replace Existing U1 Segment
WHEN
The system performs database replace operation
THEN
The existing U1 segment record is updated with current in-bond details
Context: A database operation has been performed on U1 segment
GIVEN
A database operation has been performed on U1 segment
Applied to: Operation Successful?
WHEN
The system checks the operation result status
THEN
If operation successful, log success and continue, otherwise handle database error
Context: U1 segment database operation completed successfully
GIVEN
U1 segment database operation completed successfully
Applied to: Log Successful Update
WHEN
The system processes the successful operation
THEN
Success information is logged for audit trail and processing continues
Context: A database operation on U1 segment has failed
GIVEN
A database operation on U1 segment has failed
Applied to: Handle Database Error
WHEN
The system detects the operation failure
THEN
Error handling procedures are invoked and processing terminates with error status
R-GCX016-cbl-03838 (+12) File: GCX016.cbl Location Name Resolution Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Location Name Resolution':
  • Context - a location id is received for resolution:
    For Location ID Type?:
    When the system evaluates the location id type, then the system selects ds table for station codes, ks table for port codes, or sd table for general locations.
  • Context - a station code location id needs to be resolved:
    For Lookup in DS Table:
    When the system performs ds table lookup using the location id, then the system retrieves station data from ds table or determines location not found.
  • Context - a port code location id needs to be resolved:
    For Lookup in KS Table:
    When the system performs ks table lookup using the location id, then the system retrieves port data from ks table or determines location not found.
  • Context - a general location id needs to be resolved:
    For Lookup in SD Table:
    When the system performs sd table lookup using the location id, then the system retrieves location data from sd table or determines location not found.
  • Context - ds table lookup has been performed for a station location:
    For Location Found in DS?:
    When the system checks the lookup result, then if location is found in ds table, proceed to retrieve location name, otherwise try ks table lookup.
  • Context - ks table lookup has been performed for a port location or ds lookup failed:
    For Location Found in KS?:
    When the system checks the lookup result, then if location is found in ks table, proceed to retrieve location name, otherwise try sd table lookup.
  • Context - sd table lookup has been performed for a general location or previous lookups failed:
    For Location Found in SD?:
    When the system checks the lookup result, then if location is found in sd table, proceed to retrieve location name, otherwise generate location not found error.
  • Context - location has been successfully found in ds table:
    For Retrieve Location Name from DS:
    When the system retrieves the location information, then the system extracts the descriptive location name from the ds table record.
  • Context - location has been successfully found in ks table:
    For Retrieve Location Name from KS:
    When the system retrieves the location information, then the system extracts the descriptive location name from the ks table record.
  • Context - location has been successfully found in sd table:
    For Retrieve Location Name from SD:
    When the system retrieves the location information, then the system extracts the descriptive location name from the sd table record.
  • Context - a location name has been successfully retrieved from ds, ks, or sd table:
    For Set Location Description:
    When the system processes the retrieved location information, then the system sets the location description field with the retrieved location name.
  • Context - location description has been set with resolved location name:
    For Update Cargo Record with Location Info:
    When the system updates the cargo record, then the system stores the location information in the appropriate cargo record fields.
  • Context - location id has been searched in ds, ks, and sd tables without success:
    For Location Not Found Error:
    When all table lookups have failed to find the location, then the system generates a location not found error and continues processing.
👨‍💻 Technical ACs (Gherkin)
Context: A location ID is received for resolution
GIVEN
A location ID is received for resolution
Applied to: Location ID Type?
WHEN
The system evaluates the location ID type
THEN
The system selects DS table for station codes, KS table for port codes, or SD table for general locations
Context: A station code location ID needs to be resolved
GIVEN
A station code location ID needs to be resolved
Applied to: Lookup in DS Table
WHEN
The system performs DS table lookup using the location ID
THEN
The system retrieves station data from DS table or determines location not found
Context: A port code location ID needs to be resolved
GIVEN
A port code location ID needs to be resolved
Applied to: Lookup in KS Table
WHEN
The system performs KS table lookup using the location ID
THEN
The system retrieves port data from KS table or determines location not found
Context: A general location ID needs to be resolved
GIVEN
A general location ID needs to be resolved
Applied to: Lookup in SD Table
WHEN
The system performs SD table lookup using the location ID
THEN
The system retrieves location data from SD table or determines location not found
Context: DS table lookup has been performed for a station location
GIVEN
DS table lookup has been performed for a station location
Applied to: Location Found in DS?
WHEN
The system checks the lookup result
THEN
If location is found in DS table, proceed to retrieve location name, otherwise try KS table lookup
Context: KS table lookup has been performed for a port location or DS lookup failed
GIVEN
KS table lookup has been performed for a port location or DS lookup failed
Applied to: Location Found in KS?
WHEN
The system checks the lookup result
THEN
If location is found in KS table, proceed to retrieve location name, otherwise try SD table lookup
Context: SD table lookup has been performed for a general location or previous lookups failed
GIVEN
SD table lookup has been performed for a general location or previous lookups failed
Applied to: Location Found in SD?
WHEN
The system checks the lookup result
THEN
If location is found in SD table, proceed to retrieve location name, otherwise generate location not found error
Context: Location has been successfully found in DS table
GIVEN
Location has been successfully found in DS table
Applied to: Retrieve Location Name from DS
WHEN
The system retrieves the location information
THEN
The system extracts the descriptive location name from the DS table record
Context: Location has been successfully found in KS table
GIVEN
Location has been successfully found in KS table
Applied to: Retrieve Location Name from KS
WHEN
The system retrieves the location information
THEN
The system extracts the descriptive location name from the KS table record
Context: Location has been successfully found in SD table
GIVEN
Location has been successfully found in SD table
Applied to: Retrieve Location Name from SD
WHEN
The system retrieves the location information
THEN
The system extracts the descriptive location name from the SD table record
Context: A location name has been successfully retrieved from DS, KS, or SD table
GIVEN
A location name has been successfully retrieved from DS, KS, or SD table
Applied to: Set Location Description
WHEN
The system processes the retrieved location information
THEN
The system sets the location description field with the retrieved location name
Context: Location description has been set with resolved location name
GIVEN
Location description has been set with resolved location name
Applied to: Update Cargo Record with Location Info
WHEN
The system updates the cargo record
THEN
The system stores the location information in the appropriate cargo record fields
Context: Location ID has been searched in DS, KS, and SD tables without success
GIVEN
Location ID has been searched in DS, KS, and SD tables without success
Applied to: Location Not Found Error
WHEN
All table lookups have failed to find the location
THEN
The system generates a location not found error and continues processing
R-GCX016-cbl-03851 (+11) File: GCX016.cbl N9 Reference Information Retrieval Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N9 Reference Information Retrieval':
  • Context - a shipment requires n9 reference information processing:
    For Access Secondary Cargo Records:
    When the system initiates n9 reference retrieval process, then secondary cargo records (gcsa2rt) are accessed to locate n9 segments.
  • Context - secondary cargo records are accessible:
    For Search for N9 Segments:
    When the system searches for n9 segments within the records, then all available n9 segments are identified and flagged for processing.
  • Context - secondary cargo records have been searched for n9 segments:
    For N9 Segments Found?:
    When the system evaluates the search results, then if n9 segments are found, proceed to extract reference information, otherwise log no references found and continue processing.
    For Log No References Found:
    When no n9 segments are found in the records, then the absence of n9 references is logged and shipment processing continues without reference information.
  • Context - n9 segments have been found in secondary cargo records:
    For Extract Reference Numbers:
    When the system processes each n9 segment, then reference numbers are extracted and stored for further validation.
  • Context - reference numbers have been extracted from n9 segments:
    For Extract Reference Qualifiers:
    When the system processes the qualifier information in each n9 segment, then reference qualifiers are extracted and associated with their corresponding reference numbers.
  • Context - reference numbers and qualifiers have been extracted from n9 segments:
    For Validate FDA Reference Types:
    When the system validates the reference types against fda requirements, then references are classified as valid or invalid based on fda compliance criteria.
  • Context - fda reference validation has been performed:
    For Valid FDA References?:
    When the system evaluates the validation results, then if references are valid for fda processing, store them for shipment use, otherwise skip n9 processing and continue.
  • Context - n9 references have been validated as fda-compliant:
    For Store Reference Information for Shipment:
    When the system processes the valid references, then reference information is stored in memory structures for shipment record updates.
  • Context - valid n9 reference information has been stored:
    For Update Shipment Record with N9 Data:
    When the system updates the shipment record, then shipment record is updated with n9 reference numbers and qualifiers for regulatory compliance.
  • Context - n9 reference information has been processed and shipment record updated:
    For Log Reference Processing:
    When the system completes the reference processing, then processing activity is logged with details of references processed and shipment updates made.
  • Context - n9 references have been found but failed fda validation:
    For Skip N9 Processing:
    When the system determines references are invalid, then n9 processing is skipped and shipment processing continues without reference updates.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires N9 reference information processing
GIVEN
A shipment requires N9 reference information processing
Applied to: Access Secondary Cargo Records
WHEN
The system initiates N9 reference retrieval process
THEN
Secondary cargo records (GCSA2RT) are accessed to locate N9 segments
Context: Secondary cargo records are accessible
GIVEN
Secondary cargo records are accessible
Applied to: Search for N9 Segments
WHEN
The system searches for N9 segments within the records
THEN
All available N9 segments are identified and flagged for processing
Context: Secondary cargo records have been searched for N9 segments
GIVEN
Secondary cargo records have been searched for N9 segments
Applied to: N9 Segments Found?
WHEN
The system evaluates the search results
THEN
If N9 segments are found, proceed to extract reference information, otherwise log no references found and continue processing
Applied to: Log No References Found
WHEN
No N9 segments are found in the records
THEN
The absence of N9 references is logged and shipment processing continues without reference information
Context: N9 segments have been found in secondary cargo records
GIVEN
N9 segments have been found in secondary cargo records
Applied to: Extract Reference Numbers
WHEN
The system processes each N9 segment
THEN
Reference numbers are extracted and stored for further validation
Context: Reference numbers have been extracted from N9 segments
GIVEN
Reference numbers have been extracted from N9 segments
Applied to: Extract Reference Qualifiers
WHEN
The system processes the qualifier information in each N9 segment
THEN
Reference qualifiers are extracted and associated with their corresponding reference numbers
Context: Reference numbers and qualifiers have been extracted from N9 segments
GIVEN
Reference numbers and qualifiers have been extracted from N9 segments
Applied to: Validate FDA Reference Types
WHEN
The system validates the reference types against FDA requirements
THEN
References are classified as valid or invalid based on FDA compliance criteria
Context: FDA reference validation has been performed
GIVEN
FDA reference validation has been performed
Applied to: Valid FDA References?
WHEN
The system evaluates the validation results
THEN
If references are valid for FDA processing, store them for shipment use, otherwise skip N9 processing and continue
Context: N9 references have been validated as FDA-compliant
GIVEN
N9 references have been validated as FDA-compliant
Applied to: Store Reference Information for Shipment
WHEN
The system processes the valid references
THEN
Reference information is stored in memory structures for shipment record updates
Context: Valid N9 reference information has been stored
GIVEN
Valid N9 reference information has been stored
Applied to: Update Shipment Record with N9 Data
WHEN
The system updates the shipment record
THEN
Shipment record is updated with N9 reference numbers and qualifiers for regulatory compliance
Context: N9 reference information has been processed and shipment record updated
GIVEN
N9 reference information has been processed and shipment record updated
Applied to: Log Reference Processing
WHEN
The system completes the reference processing
THEN
Processing activity is logged with details of references processed and shipment updates made
Context: N9 references have been found but failed FDA validation
GIVEN
N9 references have been found but failed FDA validation
Applied to: Skip N9 Processing
WHEN
The system determines references are invalid
THEN
N9 processing is skipped and shipment processing continues without reference updates
R-GCX016-cbl-03863 (+6) File: GCX016.cbl Canadian Cargo Cross Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Cargo Cross':
  • Context - a us cargo release request is being processed:
    For Extract Equipment ID from US Cargo:
    When the system needs to coordinate with canadian cargo systems, then the equipment id (car initial and car number) is extracted from the us cargo record for cross-reference 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 canadian waybill records are retrieved based on the equipment id match.
  • Context - canadian cargo records have been found by equipment id:
    For Validate Canadian Cargo Record:
    When the system validates the canadian cargo record, then only non-deleted canadian cargo records are considered valid for cross-border processing.
  • Context - valid canadian cargo records are found with matching equipment id:
    For Establish Cross-Border Link:
    When equipment id match is confirmed between us and canadian systems, then a cross-border link is established between the corresponding cargo records.
  • Context - cross-border cargo coordination is being processed:
    For Generate Cross-Border Log Message:
    When canadian cargo records are found and linked to us cargo, then a log message is generated documenting the cross-border cargo release coordination.
  • Context - a search for canadian cargo records by equipment id is performed:
    For Log No Canadian Match Found:
    When no canadian cargo records are found matching the equipment id, then the system logs that no canadian match was found and continues with us-only processing.
  • Context - canadian cargo coordination has failed due to no match, invalid records, or equipment id mismatch:
    For Continue US Processing Only:
    When cross-border coordination cannot be established, then the system continues processing the us cargo release without canadian coordination.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo release request is being processed
GIVEN
A US cargo release request is being processed
Applied to: Extract Equipment ID from US Cargo
WHEN
The system needs to coordinate with Canadian cargo systems
THEN
The equipment ID (car initial and car number) is extracted from the US cargo record for cross-reference 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
Canadian waybill records are retrieved based on the equipment ID match
Context: Canadian cargo records have been found by equipment ID
GIVEN
Canadian cargo records have been found by equipment ID
Applied to: Validate Canadian Cargo Record
WHEN
The system validates the Canadian cargo record
THEN
Only non-deleted Canadian cargo records are considered valid for cross-border processing
Context: Valid Canadian cargo records are found with matching equipment ID
GIVEN
Valid Canadian cargo records are found with matching equipment ID
Applied to: Establish Cross-Border Link
WHEN
Equipment ID match is confirmed between US and Canadian systems
THEN
A cross-border link is established between the corresponding cargo records
Context: Cross-border cargo coordination is being processed
GIVEN
Cross-border cargo coordination is being processed
Applied to: Generate Cross-Border Log Message
WHEN
Canadian cargo records are found and linked to US cargo
THEN
A log message is generated documenting the cross-border cargo release coordination
Context: A search for Canadian cargo records by equipment ID is performed
GIVEN
A search for Canadian cargo records by equipment ID is performed
Applied to: Log No Canadian Match Found
WHEN
No Canadian cargo records are found matching the equipment ID
THEN
The system logs that no Canadian match was found and continues with US-only processing
Context: Canadian cargo coordination has failed due to no match, invalid records, or equipment ID mismatch
GIVEN
Canadian cargo coordination has failed due to no match, invalid records, or equipment ID mismatch
Applied to: Continue US Processing Only
WHEN
Cross-border coordination cannot be established
THEN
The system continues processing the US cargo release without Canadian coordination
R-GCX016-cbl-03870 (+14) File: GCX016.cbl Equipment ID Matching for Cross Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment ID Matching for Cross':
  • Context - a us cargo record exists in the system:
    For Retrieve US Cargo Equipment ID:
    When the system processes cross-border equipment matching, then the equipment identifier is retrieved from the us cargo record for matching purposes.
  • Context - a us equipment identifier has been retrieved:
    For Format Equipment ID for Canadian System:
    When the system prepares to search canadian cargo database, then the equipment identifier is formatted according to canadian system requirements.
  • Context - an equipment identifier has been formatted for canadian system:
    For Search Canadian Cargo Database:
    When the system searches the canadian cargo database, then canadian cargo records matching the equipment identifier are retrieved.
  • Context - a search has been performed in the canadian cargo database:
    For Canadian Cargo Found?:
    When the system evaluates search results, then the system determines if canadian cargo records exist and proceeds accordingly.
  • Context - canadian cargo records have been found:
    For Validate Canadian Record Status:
    When the system validates record status, then the system confirms the canadian record is valid and active for processing.
  • Context - canadian cargo record status has been validated:
    For Record Valid?:
    When the system determines record validity, then the system confirms if the record is valid for cross-border matching or requires alternative processing.
  • Context - valid canadian cargo record exists:
    For Match Equipment Identifiers:
    When the system compares us and canadian equipment identifiers, then equipment identifiers are matched for cross-border coordination.
  • Context - equipment identifiers have been compared:
    For Equipment IDs Match?:
    When the system evaluates matching results, then the system determines if equipment identifiers match and proceeds with appropriate action.
  • Context - equipment identifiers match between us and canadian systems:
    For Establish Cross-Border Link:
    When the system establishes cross-border coordination, then a cross-border link is created between the cargo records.
  • Context - cross-border link has been established:
    For Update Coordination Status:
    When the system updates coordination status, then cargo records are updated with cross-border coordination information.
  • Context - cross-border coordination status has been updated:
    For Log Cross-Border Match:
    When the system logs the matching event, then cross-border match information is recorded in system logs.
  • Context - initial equipment matching has failed or no canadian cargo found:
    For Try Alternative Equipment Format:
    When the system tries alternative formatting, then equipment identifier is reformatted using alternative rules for another search attempt.
  • Context - alternative equipment formatting has been attempted:
    For Alternative Format Available?:
    When the system checks for more format options, then the system determines if additional format alternatives exist or matching should be concluded.
  • Context - all alternative equipment formats have been exhausted:
    For Mark No Canadian Match Found:
    When the system concludes matching attempts, then the system marks that no canadian cargo match was found.
  • Context - no canadian match has been found and marked:
    For Log No Match Information:
    When the system logs the no-match event, then information about unsuccessful matching is recorded in system logs.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo record exists in the system
GIVEN
A US cargo record exists in the system
Applied to: Retrieve US Cargo Equipment ID
WHEN
The system processes cross-border equipment matching
THEN
The equipment identifier is retrieved from the US cargo record for matching purposes
Context: A US equipment identifier has been retrieved
GIVEN
A US equipment identifier has been retrieved
Applied to: Format Equipment ID for Canadian System
WHEN
The system prepares to search Canadian cargo database
THEN
The equipment identifier is formatted according to Canadian system requirements
Context: An equipment identifier has been formatted for Canadian system
GIVEN
An equipment identifier has been formatted for Canadian system
Applied to: Search Canadian Cargo Database
WHEN
The system searches the Canadian cargo database
THEN
Canadian cargo records matching the equipment identifier are retrieved
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 Found?
WHEN
The system evaluates search results
THEN
The system determines if Canadian cargo records exist and proceeds accordingly
Context: Canadian cargo records have been found
GIVEN
Canadian cargo records have been found
Applied to: Validate Canadian Record Status
WHEN
The system validates record status
THEN
The system confirms the Canadian record is valid and active for processing
Context: Canadian cargo record status has been validated
GIVEN
Canadian cargo record status has been validated
Applied to: Record Valid?
WHEN
The system determines record validity
THEN
The system confirms if the record is valid for cross-border matching or requires alternative processing
Context: Valid Canadian cargo record exists
GIVEN
Valid Canadian cargo record exists
Applied to: Match Equipment Identifiers
WHEN
The system compares US and Canadian equipment identifiers
THEN
Equipment identifiers are matched for cross-border coordination
Context: Equipment identifiers have been compared
GIVEN
Equipment identifiers have been compared
Applied to: Equipment IDs Match?
WHEN
The system evaluates matching results
THEN
The system determines if equipment identifiers match and proceeds with appropriate action
Context: Equipment identifiers match between US and Canadian systems
GIVEN
Equipment identifiers match between US and Canadian systems
Applied to: Establish Cross-Border Link
WHEN
The system establishes cross-border coordination
THEN
A cross-border link is created between the cargo records
Context: Cross-border link has been established
GIVEN
Cross-border link has been established
Applied to: Update Coordination Status
WHEN
The system updates coordination status
THEN
Cargo records are updated with cross-border coordination information
Context: Cross-border coordination status has been updated
GIVEN
Cross-border coordination status has been updated
Applied to: Log Cross-Border Match
WHEN
The system logs the matching event
THEN
Cross-border match information is recorded in system logs
Context: Initial equipment matching has failed or no Canadian cargo found
GIVEN
Initial equipment matching has failed or no Canadian cargo found
Applied to: Try Alternative Equipment Format
WHEN
The system tries alternative formatting
THEN
Equipment identifier is reformatted using alternative rules for another search attempt
Context: Alternative equipment formatting has been attempted
GIVEN
Alternative equipment formatting has been attempted
Applied to: Alternative Format Available?
WHEN
The system checks for more format options
THEN
The system determines if additional format alternatives exist or matching should be concluded
Context: All alternative equipment formats have been exhausted
GIVEN
All alternative equipment formats have been exhausted
Applied to: Mark No Canadian Match Found
WHEN
The system concludes matching attempts
THEN
The system marks that no Canadian cargo match was found
Context: No Canadian match has been found and marked
GIVEN
No Canadian match has been found and marked
Applied to: Log No Match Information
WHEN
The system logs the no-match event
THEN
Information about unsuccessful matching is recorded in system logs
R-GCX016-cbl-03885 (+8) File: GCX016.cbl KCSM Broker Name Lookup Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Broker Name Lookup':
  • Context - kcsm broker name lookup process is initiated:
    For Initialize Broker Name Fields:
    When the system begins broker name retrieval, then all broker name fields are set to spaces to ensure clean processing.
  • Context - a broker code lookup request for kcsm processing:
    For Check if Broker Code Exists:
    When the system checks for broker code presence, then the system determines if broker code exists and is not empty.
  • Context - a broker code validation check has been performed:
    For Broker Code Present?:
    When the system evaluates broker code presence, then if broker code is present, proceed to bk table lookup, otherwise set broker name to spaces.
  • Context - a valid broker code exists for kcsm processing:
    For Set Up BK Table Key with Broker Code:
    When the system prepares to lookup broker information, then the bk table key is constructed using the broker code for table access.
  • Context - a properly formatted bk table key with broker code:
    For Call GCCTBIO to Read BK Table:
    When the system calls gcctbio table service, then the system attempts to read the broker record from the bk table.
  • Context - a bk table lookup has been performed using gcctbio:
    For BK Table Record Found?:
    When the system evaluates the lookup results, then if record is found, extract broker name, otherwise set broker name to spaces.
  • Context - a broker record has been successfully found in the bk table:
    For Extract Broker Short Name from BK Table:
    When the system processes the retrieved record, then the broker short name is extracted from the bk table record.
  • Context - a broker short name has been extracted from the bk table record:
    For Store Broker Name for KCSM Processing:
    When the system completes broker name extraction, then the broker name is stored in the designated field for kcsm processing use.
  • Context - either no broker code exists or bk table lookup failed to find a record:
    For Set Broker Name to Spaces if Not Found:
    When the system handles the missing broker information scenario, then the broker name field is set to spaces to indicate no broker information available.
👨‍💻 Technical ACs (Gherkin)
Context: KCSM broker name lookup process is initiated
GIVEN
KCSM broker name lookup process is initiated
Applied to: Initialize Broker Name Fields
WHEN
the system begins broker name retrieval
THEN
all broker name fields are set to spaces to ensure clean processing
Context: a broker code lookup request for KCSM processing
GIVEN
a broker code lookup request for KCSM processing
Applied to: Check if Broker Code Exists
WHEN
the system checks for broker code presence
THEN
the system determines if broker code exists and is not empty
Context: a broker code validation check has been performed
GIVEN
a broker code validation check has been performed
Applied to: Broker Code Present?
WHEN
the system evaluates broker code presence
THEN
if broker code is present, proceed to BK table lookup, otherwise set broker name to spaces
Context: a valid broker code exists for KCSM processing
GIVEN
a valid broker code exists for KCSM processing
Applied to: Set Up BK Table Key with Broker Code
WHEN
the system prepares to lookup broker information
THEN
the BK table key is constructed using the broker code for table access
Context: a properly formatted BK table key with broker code
GIVEN
a properly formatted BK table key with broker code
Applied to: Call GCCTBIO to Read BK Table
WHEN
the system calls GCCTBIO table service
THEN
the system attempts to read the broker record from the BK table
Context: a BK table lookup has been performed using GCCTBIO
GIVEN
a BK table lookup has been performed using GCCTBIO
Applied to: BK Table Record Found?
WHEN
the system evaluates the lookup results
THEN
if record is found, extract broker name, otherwise set broker name to spaces
Context: a broker record has been successfully found in the BK table
GIVEN
a broker record has been successfully found in the BK table
Applied to: Extract Broker Short Name from BK Table
WHEN
the system processes the retrieved record
THEN
the broker short name is extracted from the BK table record
Context: a broker short name has been extracted from the BK table record
GIVEN
a broker short name has been extracted from the BK table record
Applied to: Store Broker Name for KCSM Processing
WHEN
the system completes broker name extraction
THEN
the broker name is stored in the designated field for KCSM processing use
Context: either no broker code exists or BK table lookup failed to find a record
GIVEN
either no broker code exists or BK table lookup failed to find a record
Applied to: Set Broker Name to Spaces if Not Found
WHEN
the system handles the missing broker information scenario
THEN
the broker name field is set to spaces to indicate no broker information available
R-GCX016-cbl-03894 (+13) File: GCX016.cbl EDI Transmission Root Segment Creation Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI Transmission Root Segment Creation':
  • Context - edi transmission root segment creation is requested:
    For Initialize Transmission Parameters:
    When the system begins transmission parameter initialization, then transmission parameters are loaded from aecwrktb work table.
  • Context - transmission parameters are initialized:
    For Set Transmission Control Information:
    When transmission control information is being set, then control information is configured for message routing and tracking purposes.
  • Context - transmission control information is set:
    For Generate Transmission ID:
    When a transmission id is required, then a unique transmission identifier is generated for message tracking.
  • Context - transmission id is generated:
    For Set Message Routing Information:
    When message routing information is being configured, then routing information is set to determine message destination and delivery path.
  • Context - message routing information is configured:
    For Create A9RT Root Segment:
    When a9rt root segment creation is initiated, then a9rt root segment is created with transmission control and routing information.
  • Context - a9rt root segment is created:
    For Set Tracking Information:
    When tracking information is being set, then tracking information is established for monitoring transmission status and progress.
  • Context - tracking information is set:
    For Validate Segment Structure:
    When segment structure validation is performed, then root segment structure is validated for data integrity and completeness.
  • Context - segment structure validation is completed:
    For Validation Successful?:
    When validation results are evaluated, then system determines if validation was successful to proceed with storage or error handling.
  • Context - segment validation is successful:
    For Store Root Segment to Database:
    When root segment storage is initiated, then validated root segment is stored to a9rt transmission segment database.
  • Context - root segment is successfully stored to database:
    For Log Transmission Creation:
    When transmission creation logging is performed, then successful transmission creation is logged for audit and monitoring purposes.
  • Context - transmission creation is logged successfully:
    For Return Success Status:
    When process completion status is returned, then success status is returned to indicate successful root segment creation.
  • Context - segment validation fails:
    For Handle Creation Error:
    When creation error handling is initiated, then system handles errors that occurred during root segment creation process.
  • Context - creation error handling is initiated:
    For Log Error Details:
    When error logging is performed, then detailed error information is logged for troubleshooting and audit purposes.
  • Context - error details are logged:
    For Return Error Status:
    When error status is returned, then error status is returned to indicate failure in root segment creation process.
👨‍💻 Technical ACs (Gherkin)
Context: EDI transmission root segment creation is requested
GIVEN
EDI transmission root segment creation is requested
Applied to: Initialize Transmission Parameters
WHEN
the system begins transmission parameter initialization
THEN
transmission parameters are loaded from AECWRKTB work table
Context: transmission parameters are initialized
GIVEN
transmission parameters are initialized
Applied to: Set Transmission Control Information
WHEN
transmission control information is being set
THEN
control information is configured for message routing and tracking purposes
Context: transmission control information is set
GIVEN
transmission control information is set
Applied to: Generate Transmission ID
WHEN
a transmission ID is required
THEN
a unique transmission identifier is generated for message tracking
Context: transmission ID is generated
GIVEN
transmission ID is generated
Applied to: Set Message Routing Information
WHEN
message routing information is being configured
THEN
routing information is set to determine message destination and delivery path
Context: message routing information is configured
GIVEN
message routing information is configured
Applied to: Create A9RT Root Segment
WHEN
A9RT root segment creation is initiated
THEN
A9RT root segment is created with transmission control and routing information
Context: A9RT root segment is created
GIVEN
A9RT root segment is created
Applied to: Set Tracking Information
WHEN
tracking information is being set
THEN
tracking information is established for monitoring transmission status and progress
Context: tracking information is set
GIVEN
tracking information is set
Applied to: Validate Segment Structure
WHEN
segment structure validation is performed
THEN
root segment structure is validated for data integrity and completeness
Context: segment structure validation is completed
GIVEN
segment structure validation is completed
Applied to: Validation Successful?
WHEN
validation results are evaluated
THEN
system determines if validation was successful to proceed with storage or error handling
Context: segment validation is successful
GIVEN
segment validation is successful
Applied to: Store Root Segment to Database
WHEN
root segment storage is initiated
THEN
validated root segment is stored to A9RT transmission segment database
Context: root segment is successfully stored to database
GIVEN
root segment is successfully stored to database
Applied to: Log Transmission Creation
WHEN
transmission creation logging is performed
THEN
successful transmission creation is logged for audit and monitoring purposes
Context: transmission creation is logged successfully
GIVEN
transmission creation is logged successfully
Applied to: Return Success Status
WHEN
process completion status is returned
THEN
success status is returned to indicate successful root segment creation
Context: segment validation fails
GIVEN
segment validation fails
Applied to: Handle Creation Error
WHEN
creation error handling is initiated
THEN
system handles errors that occurred during root segment creation process
Context: creation error handling is initiated
GIVEN
creation error handling is initiated
Applied to: Log Error Details
WHEN
error logging is performed
THEN
detailed error information is logged for troubleshooting and audit purposes
Context: error details are logged
GIVEN
error details are logged
Applied to: Return Error Status
WHEN
error status is returned
THEN
error status is returned to indicate failure in root segment creation process
R-GCX016-cbl-03908 (+14) File: GCX016.cbl EDI Transmission Dependent Segment Creation Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI Transmission Dependent Segment Creation':
  • Context - an edi transmission process is initiated:
    For Retrieve EDI 350 Message Data:
    When the system needs to process edi 350 message data, then the system retrieves the edi 350 message data from the message queue for further processing.
  • Context - edi 350 message data has been retrieved:
    For Initialize A9DP Dependent Segment:
    When the system needs to create dependent segments for transmission, then the system initializes a new a9dp dependent segment structure with default values.
  • Context - an a9dp dependent segment has been initialized:
    For Set Transmission Control Information:
    When the system needs to establish transmission control, then the system sets transmission control information including sequence numbers and transmission identifiers in the dependent segment.
  • Context - transmission control information has been set in the a9dp segment:
    For Copy EDI Segment Data to A9DP:
    When edi segment data needs to be stored for transmission, then the system copies the edi segment data from the 350 message into the a9dp dependent segment.
  • Context - edi segment data has been copied to an a9dp segment:
    For More EDI Segments?:
    When the system checks for additional segments to process, then the system evaluates if more edi segments exist and continues processing if segments remain, or proceeds to transmission preparation if all segments are processed.
  • Context - more edi segments exist to be processed:
    For Create Next A9DP Segment:
    When the system needs to create another dependent segment, then the system creates a new a9dp dependent segment for the next edi segment data.
  • Context - a new a9dp dependent segment has been created:
    For Set Segment Sequence Number:
    When the system needs to establish segment ordering, then the system assigns a sequential sequence number to the dependent segment to maintain proper transmission order.
  • Context - a segment sequence number has been assigned:
    For Store EDI Data in Dependent Segment:
    When edi data needs to be stored in the dependent segment, then the system stores the edi data in the dependent segment with proper formatting and structure.
  • Context - edi data has been stored in the dependent segment:
    For Link to Transmission Root Segment:
    When the dependent segment needs to be associated with its transmission root, then the system links the a9dp dependent segment to the a9rt transmission root segment.
  • Context - the dependent segment has been linked to the transmission root segment:
    For Insert A9DP Segment to Database:
    When the segment needs to be persisted for transmission, then the system inserts the a9dp dependent segment into the database.
  • Context - an a9dp segment has been inserted into the database:
    For Database Insert Successful?:
    When the system needs to verify the insertion was successful, then the system checks the database insert status and proceeds with logging if successful, or handles the error if unsuccessful.
  • Context - the database insertion was successful:
    For Log Transmission Details:
    When the system needs to maintain an audit trail, then the system logs transmission details including segment information and processing status.
  • Context - all edi segments have been processed and stored in dependent segments:
    For Prepare for KCSM Transmission:
    When the system is ready for transmission, then the system prepares the dependent segments for kcsm transmission processing.
  • Context - a database insertion has failed:
    For Handle Database Error:
    When the system encounters a database error, then the system handles the database error through appropriate error recovery procedures.
  • Context - all dependent segments have been processed or errors have been handled:
    For Complete Dependent Segment Creation:
    When the dependent segment creation process needs to be finalized, then the system completes the dependent segment creation process and finalizes edi transmission preparation.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI transmission process is initiated
GIVEN
An EDI transmission process is initiated
Applied to: Retrieve EDI 350 Message Data
WHEN
The system needs to process EDI 350 message data
THEN
The system retrieves the EDI 350 message data from the message queue for further processing
Context: EDI 350 message data has been retrieved
GIVEN
EDI 350 message data has been retrieved
Applied to: Initialize A9DP Dependent Segment
WHEN
The system needs to create dependent segments for transmission
THEN
The system initializes a new A9DP dependent segment structure with default values
Context: An A9DP dependent segment has been initialized
GIVEN
An A9DP dependent segment has been initialized
Applied to: Set Transmission Control Information
WHEN
The system needs to establish transmission control
THEN
The system sets transmission control information including sequence numbers and transmission identifiers in the dependent segment
Context: Transmission control information has been set in the A9DP segment
GIVEN
Transmission control information has been set in the A9DP segment
Applied to: Copy EDI Segment Data to A9DP
WHEN
EDI segment data needs to be stored for transmission
THEN
The system copies the EDI segment data from the 350 message into the A9DP dependent segment
Context: EDI segment data has been copied to an A9DP segment
GIVEN
EDI segment data has been copied to an A9DP segment
Applied to: More EDI Segments?
WHEN
The system checks for additional segments to process
THEN
The system evaluates if more EDI segments exist and continues processing if segments remain, or proceeds to transmission preparation if all segments are processed
Context: More EDI segments exist to be processed
GIVEN
More EDI segments exist to be processed
Applied to: Create Next A9DP Segment
WHEN
The system needs to create another dependent segment
THEN
The system creates a new A9DP dependent segment for the next EDI segment data
Context: A new A9DP dependent segment has been created
GIVEN
A new A9DP dependent segment has been created
Applied to: Set Segment Sequence Number
WHEN
The system needs to establish segment ordering
THEN
The system assigns a sequential sequence number to the dependent segment to maintain proper transmission order
Context: A segment sequence number has been assigned
GIVEN
A segment sequence number has been assigned
Applied to: Store EDI Data in Dependent Segment
WHEN
EDI data needs to be stored in the dependent segment
THEN
The system stores the EDI data in the dependent segment with proper formatting and structure
Context: EDI data has been stored in the dependent segment
GIVEN
EDI data has been stored in the dependent segment
Applied to: Link to Transmission Root Segment
WHEN
The dependent segment needs to be associated with its transmission root
THEN
The system links the A9DP dependent segment to the A9RT transmission root segment
Context: The dependent segment has been linked to the transmission root segment
GIVEN
The dependent segment has been linked to the transmission root segment
Applied to: Insert A9DP Segment to Database
WHEN
The segment needs to be persisted for transmission
THEN
The system inserts the A9DP dependent segment into the database
Context: An A9DP segment has been inserted into the database
GIVEN
An A9DP segment has been inserted into the database
Applied to: Database Insert Successful?
WHEN
The system needs to verify the insertion was successful
THEN
The system checks the database insert status and proceeds with logging if successful, or handles the error if unsuccessful
Context: The database insertion was successful
GIVEN
The database insertion was successful
Applied to: Log Transmission Details
WHEN
The system needs to maintain an audit trail
THEN
The system logs transmission details including segment information and processing status
Context: All EDI segments have been processed and stored in dependent segments
GIVEN
All EDI segments have been processed and stored in dependent segments
Applied to: Prepare for KCSM Transmission
WHEN
The system is ready for transmission
THEN
The system prepares the dependent segments for KCSM transmission processing
Context: A database insertion has failed
GIVEN
A database insertion has failed
Applied to: Handle Database Error
WHEN
The system encounters a database error
THEN
The system handles the database error through appropriate error recovery procedures
Context: All dependent segments have been processed or errors have been handled
GIVEN
All dependent segments have been processed or errors have been handled
Applied to: Complete Dependent Segment Creation
WHEN
The dependent segment creation process needs to be finalized
THEN
The system completes the dependent segment creation process and finalizes EDI transmission preparation
R-GCX016-cbl-03923 (+15) File: GCX016.cbl KCSM Transaction Spawning Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Transaction Spawning':
  • Context - a cargo record requires kcsm integration processing:
    For Retrieve Broker Name for KCSM:
    When the system attempts to retrieve broker information from gcstbrt broker tables, then the broker name is successfully retrieved and made available for transmission processing.
  • Context - the system has attempted to retrieve broker information for kcsm processing:
    For Broker Name Found?:
    When the broker lookup operation completes, then if broker name is found, proceed to transmission creation; if broker name is not found, handle broker lookup error and complete kcsm integration.
  • Context - a valid broker name has been retrieved for kcsm processing:
    For Create Transmission Root Segment:
    When the system creates the transmission root segment, then a9rt transmission root segment is created with proper structure for edi message transmission.
  • Context - a transmission root segment has been created:
    For Set Transmission Control Information:
    When the system sets transmission control information, then transmission control parameters including routing, priority, and processing flags are established.
  • Context - transmission control information has been set:
    For Create Dependent Segment with EDI Data:
    When the system creates the dependent segment with edi data, then a9dp dependent segment is created containing the formatted edi message data for transmission.
  • Context - edi dependent segment has been created with message data:
    For Set Message Length and Entry Count:
    When the system calculates message parameters, then message length and entry count are calculated and set for transmission validation.
  • Context - message length and entry count have been set:
    For Transmission Created Successfully?:
    When the system validates transmission creation, then if transmission created successfully, spawn gct1091e transaction; if transmission creation failed, handle transmission creation error and complete kcsm integration.
  • Context - transmission has been created successfully:
    For Spawn GCT1091E Transaction:
    When the system spawns gct1091e transaction, then gct1091e transaction is initiated for kcsm system integration processing.
  • Context - gct1091e transaction spawn has been attempted:
    For GCT1091E Spawn Successful?:
    When the system checks spawn operation status, then if gct1091e spawn successful, pass transmission parameters; if spawn failed, handle spawn transaction error and complete kcsm integration.
  • Context - gct1091e transaction has been spawned successfully:
    For Pass Transmission Parameters:
    When the system passes transmission parameters, then transmission parameters including root segment, dependent segment, and control information are passed to gct1091e.
  • Context - transmission parameters have been passed to gct1091e:
    For Log Transmission Details:
    When the system logs transmission details, then transmission details including broker information, message length, and timestamp are logged for audit purposes.
  • Context - transmission details have been logged:
    For Queue EDI Message for Transmission:
    When the system queues edi message for transmission, then edi message is placed in transmission queue for delivery to kcsm system.
  • Context - edi message has been queued for transmission:
    For Update Transaction Status:
    When the system updates transaction status, then aecwrktb work tables are updated with current transaction status and processing results.
  • Context - broker name lookup has failed:
    For Handle Broker Lookup Error:
    When the system handles broker lookup error, then error is logged and kcsm integration process is completed without transmission.
  • Context - transmission creation has failed:
    For Handle Transmission Creation Error:
    When the system handles transmission creation error, then error is logged and kcsm integration process is completed without spawning transaction.
  • Context - gct1091e transaction spawn has failed:
    For Handle Spawn Transaction Error:
    When the system handles spawn transaction error, then error is logged and kcsm integration process is completed without parameter passing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires KCSM integration processing
GIVEN
A cargo record requires KCSM integration processing
Applied to: Retrieve Broker Name for KCSM
WHEN
The system attempts to retrieve broker information from GCSTBRT broker tables
THEN
The broker name is successfully retrieved and made available for transmission processing
Context: The system has attempted to retrieve broker information for KCSM processing
GIVEN
The system has attempted to retrieve broker information for KCSM processing
Applied to: Broker Name Found?
WHEN
The broker lookup operation completes
THEN
If broker name is found, proceed to transmission creation; if broker name is not found, handle broker lookup error and complete KCSM integration
Context: A valid broker name has been retrieved for KCSM processing
GIVEN
A valid broker name has been retrieved for KCSM processing
Applied to: Create Transmission Root Segment
WHEN
The system creates the transmission root segment
THEN
A9RT transmission root segment is created with proper structure for EDI message transmission
Context: A transmission root segment has been created
GIVEN
A transmission root segment has been created
Applied to: Set Transmission Control Information
WHEN
The system sets transmission control information
THEN
Transmission control parameters including routing, priority, and processing flags are established
Context: Transmission control information has been set
GIVEN
Transmission control information has been set
Applied to: Create Dependent Segment with EDI Data
WHEN
The system creates the dependent segment with EDI data
THEN
A9DP dependent segment is created containing the formatted EDI message data for transmission
Context: EDI dependent segment has been created with message data
GIVEN
EDI dependent segment has been created with message data
Applied to: Set Message Length and Entry Count
WHEN
The system calculates message parameters
THEN
Message length and entry count are calculated and set for transmission validation
Context: Message length and entry count have been set
GIVEN
Message length and entry count have been set
Applied to: Transmission Created Successfully?
WHEN
The system validates transmission creation
THEN
If transmission created successfully, spawn GCT1091E transaction; if transmission creation failed, handle transmission creation error and complete KCSM integration
Context: Transmission has been created successfully
GIVEN
Transmission has been created successfully
Applied to: Spawn GCT1091E Transaction
WHEN
The system spawns GCT1091E transaction
THEN
GCT1091E transaction is initiated for KCSM system integration processing
Context: GCT1091E transaction spawn has been attempted
GIVEN
GCT1091E transaction spawn has been attempted
Applied to: GCT1091E Spawn Successful?
WHEN
The system checks spawn operation status
THEN
If GCT1091E spawn successful, pass transmission parameters; if spawn failed, handle spawn transaction error and complete KCSM integration
Context: GCT1091E transaction has been spawned successfully
GIVEN
GCT1091E transaction has been spawned successfully
Applied to: Pass Transmission Parameters
WHEN
The system passes transmission parameters
THEN
Transmission parameters including root segment, dependent segment, and control information are passed to GCT1091E
Context: Transmission parameters have been passed to GCT1091E
GIVEN
Transmission parameters have been passed to GCT1091E
Applied to: Log Transmission Details
WHEN
The system logs transmission details
THEN
Transmission details including broker information, message length, and timestamp are logged for audit purposes
Context: Transmission details have been logged
GIVEN
Transmission details have been logged
Applied to: Queue EDI Message for Transmission
WHEN
The system queues EDI message for transmission
THEN
EDI message is placed in transmission queue for delivery to KCSM system
Context: EDI message has been queued for transmission
GIVEN
EDI message has been queued for transmission
Applied to: Update Transaction Status
WHEN
The system updates transaction status
THEN
AECWRKTB work tables are updated with current transaction status and processing results
Context: Broker name lookup has failed
GIVEN
Broker name lookup has failed
Applied to: Handle Broker Lookup Error
WHEN
The system handles broker lookup error
THEN
Error is logged and KCSM integration process is completed without transmission
Context: Transmission creation has failed
GIVEN
Transmission creation has failed
Applied to: Handle Transmission Creation Error
WHEN
The system handles transmission creation error
THEN
Error is logged and KCSM integration process is completed without spawning transaction
Context: GCT1091E transaction spawn has failed
GIVEN
GCT1091E transaction spawn has failed
Applied to: Handle Spawn Transaction Error
WHEN
The system handles spawn transaction error
THEN
Error is logged and KCSM integration process is completed without parameter passing
R-GCX016-cbl-03939 (+6) File: GCX016.cbl Train Validation Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Validation':
  • Context - a train identifier is extracted from m10 manifest segment:
    For Search GCWTL-TRAIN-LIST Database:
    When the system searches the gcwtl-train-list database for the train, then the system determines if the train exists and sets appropriate validation flags.
  • Context - train validation has been completed against gcwtl-train-list database:
    For Train Found in System?:
    When the system evaluates the train validation result, then if train is found, continue with train operations; if train is not found, generate train not found error.
  • Context - train validation has failed and train is not found in gcwtl-train-list database:
    For Generate Train Not Found Error:
    When the system processes the train not found condition, then generate train not found error message and prepare error notification for operations.
  • Context - train has been successfully found in gcwtl-train-list database:
    For Train Validation Successful:
    When the system processes the successful validation result, then set train validation successful status and continue with normal train operations.
  • Context - train not found error has been generated:
    For Send Error Message to Operations:
    When the system processes the error notification requirement, then send error message to operations team with train identification details.
  • Context - train not found error message has been sent to operations:
    For Log Train Not Found Event:
    When the system processes the logging requirement, then log the train not found event with timestamp and train identification details.
  • Context - train not found event has been logged:
    For Skip Train Processing:
    When the system determines next processing step, then skip all subsequent train processing operations and terminate the train workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A train identifier is extracted from M10 manifest segment
GIVEN
A train identifier is extracted from M10 manifest segment
Applied to: Search GCWTL-TRAIN-LIST Database
WHEN
The system searches the GCWTL-TRAIN-LIST database for the train
THEN
The system determines if the train exists and sets appropriate validation flags
Context: Train validation has been completed against GCWTL-TRAIN-LIST database
GIVEN
Train validation has been completed against GCWTL-TRAIN-LIST database
Applied to: Train Found in System?
WHEN
The system evaluates the train validation result
THEN
If train is found, continue with train operations; if train is not found, generate train not found error
Context: Train validation has failed and train is not found in GCWTL-TRAIN-LIST database
GIVEN
Train validation has failed and train is not found in GCWTL-TRAIN-LIST database
Applied to: Generate Train Not Found Error
WHEN
The system processes the train not found condition
THEN
Generate train not found error message and prepare error notification for operations
Context: Train has been successfully found in GCWTL-TRAIN-LIST database
GIVEN
Train has been successfully found in GCWTL-TRAIN-LIST database
Applied to: Train Validation Successful
WHEN
The system processes the successful validation result
THEN
Set train validation successful status and continue with normal train operations
Context: Train not found error has been generated
GIVEN
Train not found error has been generated
Applied to: Send Error Message to Operations
WHEN
The system processes the error notification requirement
THEN
Send error message to operations team with train identification details
Context: Train not found error message has been sent to operations
GIVEN
Train not found error message has been sent to operations
Applied to: Log Train Not Found Event
WHEN
The system processes the logging requirement
THEN
Log the train not found event with timestamp and train identification details
Context: Train not found event has been logged
GIVEN
Train not found event has been logged
Applied to: Skip Train Processing
WHEN
The system determines next processing step
THEN
Skip all subsequent train processing operations and terminate the train workflow
R-GCX016-cbl-03946 (+23) File: GCX016.cbl Equipment Hold Processing Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Hold Processing':
  • Context - a message contains hmi disposition code followed by vid segments:
    For VID Segment Following HMI Code Received:
    When the system processes the message segments in sequence, then vid segment processing is initiated for equipment hold operations.
  • Context - a vid segment is being processed for equipment hold:
    For Extract Equipment ID from VID Segment:
    When the system reads the vid segment data, then equipment id is extracted from the vid segment for further processing.
  • Context - an equipment id has been extracted from vid segment:
    For Validate Equipment ID Format:
    When the system validates the equipment id format, then equipment id format is checked against validation criteria.
  • Context - equipment id format validation has been performed:
    For Equipment ID Valid?:
    When the system evaluates validation results, then system determines if equipment id is valid for hold processing or requires error handling.
  • Context - equipment id validation has failed:
    For Log Equipment ID Validation Error:
    When the system processes the validation failure, then validation error is logged with equipment id details for audit purposes.
  • Context - equipment id validation has failed and error has been logged:
    For Skip Invalid Equipment:
    When the system continues vid segment processing, then invalid equipment is skipped and processing continues with next vid segment.
  • Context - equipment id has passed validation checks:
    For Add Equipment to Train Hold List:
    When the system processes the valid equipment for hold, then equipment is added to the train's hold list for tracking purposes.
  • Context - equipment has been added to train hold list:
    For Increment Held Equipment Counter:
    When the system updates hold tracking counters, then held equipment counter is incremented by one.
  • Context - equipment has been added to hold list and counter incremented:
    For Mark Equipment as Held in System:
    When the system updates equipment status, then equipment record is marked as held in the system database.
  • Context - equipment has been marked as held in system:
    For Generate Equipment Hold Notification:
    When the system processes hold notification requirements, then hold notification is generated for the equipment.
  • Context - equipment hold notification has been generated:
    For Update Equipment Hold Count on Train:
    When the system updates train-level hold information, then train record is updated with current equipment hold count.
  • Context - equipment hold count has been updated on train:
    For Update Train Hold Status:
    When the system evaluates train hold status, then train hold status is updated to reflect current hold conditions.
  • Context - current vid segment processing is complete:
    For More VID Segments?:
    When the system checks for remaining vid segments, then system determines if more vid segments need processing or if hold processing is complete.
  • Context - all vid segments have been processed for equipment holds:
    For Equipment Hold Processing Complete:
    When the system finalizes hold processing, then equipment hold processing is marked as complete.
    For Determine Overall Train Hold Status:
    When the system determines the overall train hold status, then the train hold status is evaluated based on the number of equipment items held and train hold policies.
  • Context - a vid segment is received after an hmi (hold train) event code:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment to extract equipment information, then the equipment id is extracted from the vid segment data for further processing.
  • Context - an equipment id has been extracted from a vid segment:
    For Format Equipment ID Using GCCCARFM:
    When the system calls gcccarfm to format the equipment id, then the equipment id is formatted according to standard car identification rules and validated for correctness.
  • Context - an equipment id has been formatted using gcccarfm:
    For Equipment ID Valid?:
    When the system evaluates the equipment id validity, then if the equipment id is valid, proceed with hold processing; if invalid, skip this equipment id.
  • Context - a valid equipment id has been identified for hold processing:
    For Hold Specific Equipment on Train:
    When the system processes the equipment hold request, then the specific equipment/car is placed on hold status within the train.
  • Context - a specific equipment has been successfully placed on hold:
    For Update Equipment Hold Count:
    When the system updates the equipment hold tracking, then the equipment hold count for the train is incremented by one.
  • Context - an equipment hold has been applied and the hold count updated:
    For Log Equipment Hold Action:
    When the system logs the equipment hold action, then the equipment hold action is recorded with equipment id, timestamp, and hold details.
  • Context - an equipment id has failed validation checks:
    For Skip Invalid Equipment ID:
    When the system encounters an invalid equipment id, then the invalid equipment id is skipped and processing continues with the next vid segment.
  • Context - a vid segment has been processed (either held or skipped):
    For More VID Segments?:
    When the system checks for additional vid segments in the message, then if more vid segments exist, continue processing; if no more segments, proceed to train status determination.
  • Context - the overall train hold status has been determined based on equipment hold counts:
    For Update Train Hold Status Based on Equipment Count:
    When the system updates the train hold status, then the train hold status is updated in the train list records based on the equipment hold count and business rules.
👨‍💻 Technical ACs (Gherkin)
Context: A message contains HMI disposition code followed by VID segments
GIVEN
A message contains HMI disposition code followed by VID segments
Applied to: VID Segment Following HMI Code Received
WHEN
The system processes the message segments in sequence
THEN
VID segment processing is initiated for equipment hold operations
Context: A VID segment is being processed for equipment hold
GIVEN
A VID segment is being processed for equipment hold
Applied to: Extract Equipment ID from VID Segment
WHEN
The system reads the VID segment data
THEN
Equipment ID is extracted from the VID segment for further processing
Context: An equipment ID has been extracted from VID segment
GIVEN
An equipment ID has been extracted from VID segment
Applied to: Validate Equipment ID Format
WHEN
The system validates the equipment ID format
THEN
Equipment ID format is checked against validation criteria
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
System determines if equipment ID is valid for hold processing or requires error handling
Context: Equipment ID validation has failed
GIVEN
Equipment ID validation has failed
Applied to: Log Equipment ID Validation Error
WHEN
The system processes the validation failure
THEN
Validation error is logged with equipment ID details for audit purposes
Context: Equipment ID validation has failed and error has been logged
GIVEN
Equipment ID validation has failed and error has been logged
Applied to: Skip Invalid Equipment
WHEN
The system continues VID segment processing
THEN
Invalid equipment is skipped and processing continues with next VID segment
Context: Equipment ID has passed validation checks
GIVEN
Equipment ID has passed validation checks
Applied to: Add Equipment to Train Hold List
WHEN
The system processes the valid equipment for hold
THEN
Equipment is added to the train's hold list for tracking purposes
Context: Equipment has been added to train hold list
GIVEN
Equipment has been added to train hold list
Applied to: Increment Held Equipment Counter
WHEN
The system updates hold tracking counters
THEN
Held equipment counter is incremented by one
Context: Equipment has been added to hold list and counter incremented
GIVEN
Equipment has been added to hold list and counter incremented
Applied to: Mark Equipment as Held in System
WHEN
The system updates equipment status
THEN
Equipment record is marked as held in the system database
Context: Equipment has been marked as held in system
GIVEN
Equipment has been marked as held in system
Applied to: Generate Equipment Hold Notification
WHEN
The system processes hold notification requirements
THEN
Hold notification is generated for the equipment
Context: Equipment hold notification has been generated
GIVEN
Equipment hold notification has been generated
Applied to: Update Equipment Hold Count on Train
WHEN
The system updates train-level hold information
THEN
Train record is updated with current equipment hold count
Context: Equipment hold count has been updated on train
GIVEN
Equipment hold count has been updated on train
Applied to: Update Train Hold Status
WHEN
The system evaluates train hold status
THEN
Train hold status is updated to reflect current hold conditions
Context: Current VID segment processing is complete
GIVEN
Current VID segment processing is complete
Applied to: More VID Segments?
WHEN
The system checks for remaining VID segments
THEN
System determines if more VID segments need processing or if hold processing is complete
Context: All VID segments have been processed for equipment holds
GIVEN
All VID segments have been processed for equipment holds
Applied to: Equipment Hold Processing Complete
WHEN
The system finalizes hold processing
THEN
Equipment hold processing is marked as complete
Applied to: Determine Overall Train Hold Status
WHEN
The system determines the overall train hold status
THEN
The train hold status is evaluated based on the number of equipment items held and train hold policies
Context: A VID segment is received after an HMI (Hold train) event code
GIVEN
A VID segment is received after an HMI (Hold train) event code
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment to extract equipment information
THEN
The equipment ID is extracted from the VID segment data for further processing
Context: An equipment ID has been extracted from a VID segment
GIVEN
An equipment ID has been extracted from a VID segment
Applied to: Format Equipment ID Using GCCCARFM
WHEN
The system calls GCCCARFM to format the equipment ID
THEN
The equipment ID is formatted according to standard car identification rules and validated for correctness
Context: An equipment ID has been formatted using GCCCARFM
GIVEN
An equipment ID has been formatted using GCCCARFM
Applied to: Equipment ID Valid?
WHEN
The system evaluates the equipment ID validity
THEN
If the equipment ID is valid, proceed with hold processing; if invalid, skip this equipment ID
Context: A valid equipment ID has been identified for hold processing
GIVEN
A valid equipment ID has been identified for hold processing
Applied to: Hold Specific Equipment on Train
WHEN
The system processes the equipment hold request
THEN
The specific equipment/car is placed on hold status within the train
Context: A specific equipment has been successfully placed on hold
GIVEN
A specific equipment has been successfully placed on hold
Applied to: Update Equipment Hold Count
WHEN
The system updates the equipment hold tracking
THEN
The equipment hold count for the train is incremented by one
Context: An equipment hold has been applied and the hold count updated
GIVEN
An equipment hold has been applied and the hold count updated
Applied to: Log Equipment Hold Action
WHEN
The system logs the equipment hold action
THEN
The equipment hold action is recorded with equipment ID, timestamp, and hold details
Context: An equipment ID has failed validation checks
GIVEN
An equipment ID has failed validation checks
Applied to: Skip Invalid Equipment ID
WHEN
The system encounters an invalid equipment ID
THEN
The invalid equipment ID is skipped and processing continues with the next VID segment
Context: A VID segment has been processed (either held or skipped)
GIVEN
A VID segment has been processed (either held or skipped)
Applied to: More VID Segments?
WHEN
The system checks for additional VID segments in the message
THEN
If more VID segments exist, continue processing; if no more segments, proceed to train status determination
Context: The overall train hold status has been determined based on equipment hold counts
GIVEN
The overall train hold status has been determined based on equipment hold counts
Applied to: Update Train Hold Status Based on Equipment Count
WHEN
The system updates the train hold status
THEN
The train hold status is updated in the train list records based on the equipment hold count and business rules
R-GCX016-cbl-03960 (+36) File: GCX016.cbl Equipment Release Processing Merged 37 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Release Processing':
  • Context - an hre train release disposition code has been processed:
    For Read Next VID Segment:
    When the system reads the next vid segment in the message, then the vid segment is retrieved and made available for equipment processing.
  • Context - the system is processing equipment release following hre disposition code:
    For VID Segment Found?:
    When the system checks for the presence of a vid segment, then if vid segment is found, continue with equipment processing, otherwise complete equipment release processing.
  • Context - a valid vid segment has been found:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment content, then the equipment id is extracted from the vid segment data.
  • Context - an equipment id has been extracted from the vid segment:
    For Format Equipment ID using GCCCARFM:
    When the system calls gcccarfm formatting routine, then the equipment id is formatted according to standard business rules for equipment identification.
  • Context - an equipment id has been formatted using gcccarfm:
    For Equipment ID Valid?:
    When the system validates the formatted equipment id, then if equipment id is valid, proceed with equipment lookup, otherwise log invalid equipment id error and continue to next vid segment.
  • Context - a valid equipment id has been formatted and validated:
    For Find Equipment in Train Hold List:
    When the system searches the train hold list for the equipment, then the equipment record is located in the train hold list if it exists.
  • Context - equipment has been located in the train hold list:
    For Equipment Currently Held?:
    When the system checks the equipment's current hold status, then if equipment is currently held, proceed with release processing, otherwise log equipment not found warning and continue to next vid segment.
  • Context - equipment is currently in hold status and eligible for release:
    For Remove Equipment from Hold Status:
    When the system processes the equipment release request, then the equipment is removed from hold status and marked as released.
  • Context - equipment has been successfully removed from hold status:
    For Decrement Train Held Equipment Count:
    When the system updates train statistics, then the train's held equipment count is decremented by one.
  • Context - equipment has been released from hold status and train count updated:
    For Log Equipment Release Action:
    When the system logs the release action, then the equipment release action is recorded with equipment id, timestamp, and release details.
  • Context - current equipment has been processed (released or logged as error):
    For More Equipment to Process?:
    When the system checks for additional vid segments in the message, then if more vid segments exist, continue processing next vid segment, otherwise proceed to update train hold status.
  • Context - all vid segments have been processed for equipment releases:
    For Update Train Hold Status:
    When the system evaluates the train's overall hold status, then the train hold status is updated based on remaining held equipment count.
  • Context - train hold status has been updated after processing all equipment releases:
    For Any Equipment Still Held?:
    When the system checks if any equipment is still held on the train, then if equipment is still held, keep train in hold status, otherwise release train from hold status.
  • Context - some equipment on the train is still in hold status after processing releases:
    For Keep Train in Hold Status:
    When the system updates the train status, then the train remains in hold status and equipment release processing is complete.
  • Context - no equipment on the train is in hold status after processing releases:
    For Release Train from Hold Status:
    When the system updates the train status, then the train is released from hold status and equipment release processing is complete.
  • Context - equipment id has been validated but equipment is not found in hold status:
    For Log Equipment Not Found Warning:
    When the system processes the equipment not found condition, then a warning is logged indicating equipment was not found in hold list and processing continues to next vid segment.
  • Context - equipment id has been extracted and formatted but fails validation:
    For Log Invalid Equipment ID Error:
    When the system processes the invalid equipment id condition, then an error is logged indicating invalid equipment id format and processing continues to next vid segment.
  • Context - an error or warning has been logged for current equipment processing:
    For Continue to Next VID Segment:
    When the system continues with vid segment processing, then processing returns to read the next vid segment in the message.
  • Context - all vid segments have been processed and train status has been updated:
    For Equipment Release Processing Complete:
    When the system finalizes equipment release processing, then equipment release processing is marked as complete and control returns to main message processing.
  • Context - a train hold release event (hre) is being processed:
    For Equipment Release Processing Start:
    When the system begins equipment release processing, then the equipment release workflow is initiated.
  • Context - an hre event is being processed:
    For Receive VID Segment for HRE:
    When vid segments are present in the message, then each vid segment is processed for equipment release.
  • Context - a vid segment is being processed for equipment release:
    For Extract Equipment ID from VID Segment:
    When the system reads the vid segment data, then the equipment id is extracted from the vid segment.
  • Context - an equipment id has been extracted from a vid segment:
    For Locate Equipment in Train Equipment List:
    When the system searches the train equipment list, then the system attempts to locate the equipment in the train list.
  • Context - the system is searching for equipment in the train list:
    For Equipment Found in Train?:
    When the equipment search is completed, then the system determines if the equipment exists in the train or not.
  • Context - equipment has been found in the train equipment list:
    For Check Current Equipment Hold Status:
    When the system checks the equipment's current status, then the current hold status of the equipment is determined.
    For Log Equipment Already Released Warning:
    When the equipment is not currently held, then a warning is logged indicating equipment is already released.
  • Context - equipment has been found and its hold status checked:
    For Equipment Currently Held?:
    When the system evaluates if the equipment is currently held, then the system determines whether the equipment can be released or is already released.
  • Context - equipment is currently held and eligible for release:
    For Remove Hold Status from Equipment:
    When the system processes the equipment release, then the hold status is removed from the equipment.
  • Context - equipment hold status has been removed:
    For Decrement Train Held Equipment Count:
    When the system updates train statistics, then the train's held equipment count is decremented by one.
  • Context - equipment hold has been removed and count decremented:
    For Update Equipment Status in Train List:
    When the system updates the train equipment list, then the equipment's status is updated to reflect the release.
  • Context - equipment has been released and train statistics updated:
    For Any Equipment Still Held on Train?:
    When the system checks remaining held equipment on the train, then the system determines if any equipment is still held on the train.
  • Context - some equipment on the train is still held after release processing:
    For Set Train Status to Partially Held:
    When the system updates the train status, then the train status is set to partially held.
  • Context - no equipment on the train is held after release processing:
    For Set Train Status to Fully Released:
    When the system updates the train status, then the train status is set to fully released.
  • Context - equipment has been successfully released and train status updated:
    For Log Equipment Release Action:
    When the system completes the release processing, then the equipment release action is logged.
  • Context - current vid segment processing is complete:
    For Continue to Next VID Segment:
    When additional vid segments exist for processing, then the system continues to the next vid segment.
  • Context - all vid segments have been processed for equipment release:
    For Equipment Release Processing Complete:
    When no more vid segments remain, then the equipment release processing is marked as complete.
  • Context - equipment id has been extracted from vid segment:
    For Log Equipment Not Found Warning:
    When the equipment is not found in the train equipment list, then a warning is logged indicating equipment not found.
👨‍💻 Technical ACs (Gherkin)
Context: An HRE train release disposition code has been processed
GIVEN
An HRE train release disposition code has been processed
Applied to: Read Next VID Segment
WHEN
The system reads the next VID segment in the message
THEN
The VID segment is retrieved and made available for equipment processing
Context: The system is processing equipment release following HRE disposition code
GIVEN
The system is processing equipment release following HRE disposition code
Applied to: VID Segment Found?
WHEN
The system checks for the presence of a VID segment
THEN
If VID segment is found, continue with equipment processing, otherwise complete equipment release processing
Context: A valid VID segment has been found
GIVEN
A valid VID segment has been found
Applied to: Extract Equipment ID from VID Segment
WHEN
The system processes the VID segment content
THEN
The equipment ID is extracted from the VID segment data
Context: An equipment ID has been extracted from the VID segment
GIVEN
An equipment ID has been extracted from the VID segment
Applied to: Format Equipment ID using GCCCARFM
WHEN
The system calls GCCCARFM formatting routine
THEN
The equipment ID is formatted according to standard business rules for equipment identification
Context: An equipment ID has been formatted using GCCCARFM
GIVEN
An equipment ID has been formatted using GCCCARFM
Applied to: Equipment ID Valid?
WHEN
The system validates the formatted equipment ID
THEN
If equipment ID is valid, proceed with equipment lookup, otherwise log invalid equipment ID error and continue to next VID segment
Context: A valid equipment ID has been formatted and validated
GIVEN
A valid equipment ID has been formatted and validated
Applied to: Find Equipment in Train Hold List
WHEN
The system searches the train hold list for the equipment
THEN
The equipment record is located in the train hold list if it exists
Context: Equipment has been located in the train hold list
GIVEN
Equipment has been located in the train hold list
Applied to: Equipment Currently Held?
WHEN
The system checks the equipment's current hold status
THEN
If equipment is currently held, proceed with release processing, otherwise log equipment not found warning and continue to next VID segment
Context: Equipment is currently in hold status and eligible for release
GIVEN
Equipment is currently in hold status and eligible for release
Applied to: Remove Equipment from Hold Status
WHEN
The system processes the equipment release request
THEN
The equipment is removed from hold status and marked as released
Context: Equipment has been successfully removed from hold status
GIVEN
Equipment has been successfully removed from hold status
Applied to: Decrement Train Held Equipment Count
WHEN
The system updates train statistics
THEN
The train's held equipment count is decremented by one
Context: Equipment has been released from hold status and train count updated
GIVEN
Equipment has been released from hold status and train count updated
Applied to: Log Equipment Release Action
WHEN
The system logs the release action
THEN
The equipment release action is recorded with equipment ID, timestamp, and release details
Context: Current equipment has been processed (released or logged as error)
GIVEN
Current equipment has been processed (released or logged as error)
Applied to: More Equipment to Process?
WHEN
The system checks for additional VID segments in the message
THEN
If more VID segments exist, continue processing next VID segment, otherwise proceed to update train hold status
Context: All VID segments have been processed for equipment releases
GIVEN
All VID segments have been processed for equipment releases
Applied to: Update Train Hold Status
WHEN
The system evaluates the train's overall hold status
THEN
The train hold status is updated based on remaining held equipment count
Context: Train hold status has been updated after processing all equipment releases
GIVEN
Train hold status has been updated after processing all equipment releases
Applied to: Any Equipment Still Held?
WHEN
The system checks if any equipment is still held on the train
THEN
If equipment is still held, keep train in hold status, otherwise release train from hold status
Context: Some equipment on the train is still in hold status after processing releases
GIVEN
Some equipment on the train is still in hold status after processing releases
Applied to: Keep Train in Hold Status
WHEN
The system updates the train status
THEN
The train remains in hold status and equipment release processing is complete
Context: No equipment on the train is in hold status after processing releases
GIVEN
No equipment on the train is in hold status after processing releases
Applied to: Release Train from Hold Status
WHEN
The system updates the train status
THEN
The train is released from hold status and equipment release processing is complete
Context: Equipment ID has been validated but equipment is not found in hold status
GIVEN
Equipment ID has been validated but equipment is not found in hold status
Applied to: Log Equipment Not Found Warning
WHEN
The system processes the equipment not found condition
THEN
A warning is logged indicating equipment was not found in hold list and processing continues to next VID segment
Context: Equipment ID has been extracted and formatted but fails validation
GIVEN
Equipment ID has been extracted and formatted but fails validation
Applied to: Log Invalid Equipment ID Error
WHEN
The system processes the invalid equipment ID condition
THEN
An error is logged indicating invalid equipment ID format and processing continues to next VID segment
Context: An error or warning has been logged for current equipment processing
GIVEN
An error or warning has been logged for current equipment processing
Applied to: Continue to Next VID Segment
WHEN
The system continues with VID segment processing
THEN
Processing returns to read the next VID segment in the message
Context: All VID segments have been processed and train status has been updated
GIVEN
All VID segments have been processed and train status has been updated
Applied to: Equipment Release Processing Complete
WHEN
The system finalizes equipment release processing
THEN
Equipment release processing is marked as complete and control returns to main message processing
Context: A train hold release event (HRE) is being processed
GIVEN
A train hold release event (HRE) is being processed
Applied to: Equipment Release Processing Start
WHEN
The system begins equipment release processing
THEN
The equipment release workflow is initiated
Context: An HRE event is being processed
GIVEN
An HRE event is being processed
Applied to: Receive VID Segment for HRE
WHEN
VID segments are present in the message
THEN
Each VID segment is processed for equipment release
Context: A VID segment is being processed for equipment release
GIVEN
A VID segment is being processed for equipment release
Applied to: Extract Equipment ID from VID Segment
WHEN
The system reads the VID segment data
THEN
The equipment ID is extracted from the VID segment
Context: An equipment ID has been extracted from a VID segment
GIVEN
An equipment ID has been extracted from a VID segment
Applied to: Locate Equipment in Train Equipment List
WHEN
The system searches the train equipment list
THEN
The system attempts to locate the equipment in the train list
Context: The system is searching for equipment in the train list
GIVEN
The system is searching for equipment in the train list
Applied to: Equipment Found in Train?
WHEN
The equipment search is completed
THEN
The system determines if the equipment exists in the train or not
Context: Equipment has been found in the train equipment list
GIVEN
Equipment has been found in the train equipment list
Applied to: Check Current Equipment Hold Status
WHEN
The system checks the equipment's current status
THEN
The current hold status of the equipment is determined
Applied to: Log Equipment Already Released Warning
WHEN
The equipment is not currently held
THEN
A warning is logged indicating equipment is already released
Context: Equipment has been found and its hold status checked
GIVEN
Equipment has been found and its hold status checked
Applied to: Equipment Currently Held?
WHEN
The system evaluates if the equipment is currently held
THEN
The system determines whether the equipment can be released or is already released
Context: Equipment is currently held and eligible for release
GIVEN
Equipment is currently held and eligible for release
Applied to: Remove Hold Status from Equipment
WHEN
The system processes the equipment release
THEN
The hold status is removed from the equipment
Context: Equipment hold status has been removed
GIVEN
Equipment hold status has been removed
Applied to: Decrement Train Held Equipment Count
WHEN
The system updates train statistics
THEN
The train's held equipment count is decremented by one
Context: Equipment hold has been removed and count decremented
GIVEN
Equipment hold has been removed and count decremented
Applied to: Update Equipment Status in Train List
WHEN
The system updates the train equipment list
THEN
The equipment's status is updated to reflect the release
Context: Equipment has been released and train statistics updated
GIVEN
Equipment has been released and train statistics updated
Applied to: Any Equipment Still Held on Train?
WHEN
The system checks remaining held equipment on the train
THEN
The system determines if any equipment is still held on the train
Context: Some equipment on the train is still held after release processing
GIVEN
Some equipment on the train is still held after release processing
Applied to: Set Train Status to Partially Held
WHEN
The system updates the train status
THEN
The train status is set to partially held
Context: No equipment on the train is held after release processing
GIVEN
No equipment on the train is held after release processing
Applied to: Set Train Status to Fully Released
WHEN
The system updates the train status
THEN
The train status is set to fully released
Context: Equipment has been successfully released and train status updated
GIVEN
Equipment has been successfully released and train status updated
Applied to: Log Equipment Release Action
WHEN
The system completes the release processing
THEN
The equipment release action is logged
Context: Current VID segment processing is complete
GIVEN
Current VID segment processing is complete
Applied to: Continue to Next VID Segment
WHEN
Additional VID segments exist for processing
THEN
The system continues to the next VID segment
Context: All VID segments have been processed for equipment release
GIVEN
All VID segments have been processed for equipment release
Applied to: Equipment Release Processing Complete
WHEN
No more VID segments remain
THEN
The equipment release processing is marked as complete
Context: Equipment ID has been extracted from VID segment
GIVEN
Equipment ID has been extracted from VID segment
Applied to: Log Equipment Not Found Warning
WHEN
The equipment is not found in the train equipment list
THEN
A warning is logged indicating equipment not found
R-GCX016-cbl-03979 (+22) File: GCX016.cbl Equipment Seizure Processing Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Seizure Processing':
  • Context - a vid segment is received following an sei disposition code:
    For Extract Equipment ID from VID Segment:
    When the system processes the vid segment, then the equipment id is extracted from the vid segment for seizure processing.
  • 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 is confirmed as valid or invalid based on format requirements and the equipment id is confirmed as valid format for seizure processing or marked as invalid.
  • Context - a valid equipment id has been identified for seizure:
    For Mark Equipment as Seized by Customs:
    When the system processes the seizure request, then the equipment is marked as seized by customs in the system.
  • Context - equipment has been marked as seized by customs:
    For Update Equipment Seizure Status:
    When the system updates equipment records, then the equipment seizure status is updated in the equipment record and the equipment seizure status is updated to indicate active customs seizure.
  • Context - an equipment item on a train has been seized:
    For Increment Train Seizure Count:
    When the system updates train seizure statistics, then the train seizure count is incremented by one.
  • Context - equipment seizure count has been updated for a train:
    For All Equipment on Train Seized?:
    When the system evaluates total train seizure status, then the system determines if all equipment on the train has been seized.
  • Context - all equipment on a train has been seized:
    For Set Train Seizure Status:
    When the system updates train status, then the train seizure status is set to indicate complete train seizure.
  • Context - equipment seizure processing has been completed:
    For Log Equipment Seizure Action:
    When the system performs logging operations, then the equipment seizure action is logged with relevant details.
  • Context - equipment seizure has been logged:
    For Generate Seizure Notification:
    When the system processes notifications, then seizure notifications are generated for relevant stakeholders.
  • Context - seizure notifications have been generated:
    For Update Train Equipment Records:
    When the system updates train records, then train equipment records are updated with current seizure information.
  • Context - an equipment id fails format validation:
    For Log Invalid Equipment ID Error:
    When the system handles the validation error, then an invalid equipment id error is logged for troubleshooting.
  • Context - an invalid equipment id error has been logged:
    For Skip Equipment Processing:
    When the system continues processing, then equipment seizure processing is skipped for the invalid equipment id.
  • Context - a sei disposition code has been received for a train:
    For Process VID Segments Following SEI:
    When the system processes the message segments following the sei code, then all vid segments in the message are identified and processed for equipment seizure.
  • Context - a message contains sei disposition code for equipment seizure:
    For VID Segment Available?:
    When the system searches for vid segments in the message, then the system determines if vid segments are available for processing or if no equipment identification is provided.
  • Context - a vid segment is available in the message:
    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 for further validation and processing.
  • Context - a valid equipment id has been identified from vid segment processing:
    For Mark Equipment as Seized by Customs:
    When the sei disposition code is applied to the equipment, then the equipment is marked as seized by customs in the system.
  • Context - equipment on a train has been marked as seized:
    For Increment Train Seizure Count:
    When the seizure status is updated, then the train's total seizure count is incremented by one.
  • Context - one vid segment has been processed for equipment seizure:
    For More VID Segments?:
    When the system checks for additional vid segments in the message, then the system continues processing if more vid segments exist or proceeds to finalize seizure processing.
  • Context - all vid segments have been processed for equipment seizure:
    For Update Overall Train Seizure Status:
    When the system finalizes seizure processing for the train, then the overall train seizure status is updated to reflect the seizure of equipment.
  • Context - equipment seizure processing has been completed for a train:
    For Log Equipment Seizure Action:
    When the system finalizes the seizure action, then a log entry is created documenting the equipment seizure action with relevant details.
  • Context - an equipment id extracted from vid segment fails format validation:
    For Skip Invalid Equipment ID:
    When the system encounters invalid equipment id, then the invalid equipment id is skipped and processing continues with the next vid segment if available.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment is received following an SEI disposition code
GIVEN
A VID segment is received following an SEI disposition code
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 for seizure processing
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 is confirmed as valid or invalid based on format requirements AND The equipment ID is confirmed as valid format for seizure processing or marked as invalid
Context: A valid equipment ID has been identified for seizure
GIVEN
A valid equipment ID has been identified for seizure
Applied to: Mark Equipment as Seized by Customs
WHEN
The system processes the seizure request
THEN
The equipment is marked as seized by customs in the system
Context: Equipment has been marked as seized by customs
GIVEN
Equipment has been marked as seized by customs
Applied to: Update Equipment Seizure Status
WHEN
The system updates equipment records
THEN
The equipment seizure status is updated in the equipment record AND The equipment seizure status is updated to indicate active customs seizure
Context: An equipment item on a train has been seized
GIVEN
An equipment item on a train has been seized
Applied to: Increment Train Seizure Count
WHEN
The system updates train seizure statistics
THEN
The train seizure count is incremented by one
Context: Equipment seizure count has been updated for a train
GIVEN
Equipment seizure count has been updated for a train
Applied to: All Equipment on Train Seized?
WHEN
The system evaluates total train seizure status
THEN
The system determines if all equipment on the train has been seized
Context: All equipment on a train has been seized
GIVEN
All equipment on a train has been seized
Applied to: Set Train Seizure Status
WHEN
The system updates train status
THEN
The train seizure status is set to indicate complete train seizure
Context: Equipment seizure processing has been completed
GIVEN
Equipment seizure processing has been completed
Applied to: Log Equipment Seizure Action
WHEN
The system performs logging operations
THEN
The equipment seizure action is logged with relevant details
Context: Equipment seizure has been logged
GIVEN
Equipment seizure has been logged
Applied to: Generate Seizure Notification
WHEN
The system processes notifications
THEN
Seizure notifications are generated for relevant stakeholders
Context: Seizure notifications have been generated
GIVEN
Seizure notifications have been generated
Applied to: Update Train Equipment Records
WHEN
The system updates train records
THEN
Train equipment records are updated with current seizure information
Context: An equipment ID fails format validation
GIVEN
An equipment ID fails format validation
Applied to: Log Invalid Equipment ID Error
WHEN
The system handles the validation error
THEN
An invalid equipment ID error is logged for troubleshooting
Context: An invalid equipment ID error has been logged
GIVEN
An invalid equipment ID error has been logged
Applied to: Skip Equipment Processing
WHEN
The system continues processing
THEN
Equipment seizure processing is skipped for the invalid equipment ID
Context: A SEI disposition code has been received for a train
GIVEN
A SEI disposition code has been received for a train
Applied to: Process VID Segments Following SEI
WHEN
The system processes the message segments following the SEI code
THEN
All VID segments in the message are identified and processed for equipment seizure
Context: A message contains SEI disposition code for equipment seizure
GIVEN
A message contains SEI disposition code for equipment seizure
Applied to: VID Segment Available?
WHEN
The system searches for VID segments in the message
THEN
The system determines if VID segments are available for processing or if no equipment identification is provided
Context: A VID segment is available in the message
GIVEN
A VID segment is available in the message
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 for further validation and processing
Context: A valid equipment ID has been identified from VID segment processing
GIVEN
A valid equipment ID has been identified from VID segment processing
Applied to: Mark Equipment as Seized by Customs
WHEN
The SEI disposition code is applied to the equipment
THEN
The equipment is marked as seized by customs in the system
Context: Equipment on a train has been marked as seized
GIVEN
Equipment on a train has been marked as seized
Applied to: Increment Train Seizure Count
WHEN
The seizure status is updated
THEN
The train's total seizure count is incremented by one
Context: One VID segment has been processed for equipment seizure
GIVEN
One VID segment has been processed for equipment seizure
Applied to: More VID Segments?
WHEN
The system checks for additional VID segments in the message
THEN
The system continues processing if more VID segments exist or proceeds to finalize seizure processing
Context: All VID segments have been processed for equipment seizure
GIVEN
All VID segments have been processed for equipment seizure
Applied to: Update Overall Train Seizure Status
WHEN
The system finalizes seizure processing for the train
THEN
The overall train seizure status is updated to reflect the seizure of equipment
Context: Equipment seizure processing has been completed for a train
GIVEN
Equipment seizure processing has been completed for a train
Applied to: Log Equipment Seizure Action
WHEN
The system finalizes the seizure action
THEN
A log entry is created documenting the equipment seizure action with relevant details
Context: An equipment ID extracted from VID segment fails format validation
GIVEN
An equipment ID extracted from VID segment fails format validation
Applied to: Skip Invalid Equipment ID
WHEN
The system encounters invalid equipment ID
THEN
The invalid equipment ID is skipped and processing continues with the next VID segment if available
R-GCX016-cbl-03991 (+34) File: GCX016.cbl Equipment Seizure Release Processing Merged 35 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Seizure Release Processing':
  • Context - a ser disposition code has been processed for a train:
    For Check if VID Segments Follow SER Code:
    When the system checks for vid segments following the ser code, then the system identifies whether vid segments are present for equipment processing.
  • Context - a vid segment is being processed for equipment seizure release:
    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 system determines if the equipment id format is valid or invalid.
  • Context - a valid equipment id has been extracted from vid segment:
    For Find Equipment on Train:
    When the system searches for the equipment on the train, then the system determines if the equipment is found or not found on the train.
  • Context - equipment has been found on the train:
    For Check Current Equipment Status:
    When the system checks the current equipment status, then the system determines if the equipment is currently seized or not seized.
  • Context - equipment is currently under seizure status:
    For Release Equipment from Seizure:
    When the system processes the seizure release request, then the equipment seizure status is removed.
  • Context - equipment seizure has been released:
    For Update Equipment Status to Normal:
    When the system updates the equipment status, then the equipment status is set to normal operational status.
  • Context - equipment has been released from seizure:
    For Decrement Train Seized Equipment Count:
    When the system updates train seizure statistics, then the train's seized equipment count is decremented by one.
  • Context - equipment seizure has been successfully released:
    For Log Equipment Seizure Release:
    When the system logs the seizure release activity, then an audit log entry is created documenting the equipment seizure release.
  • Context - all vid segments have been processed for seizure release:
    For Check Overall Train Seizure Status:
    When the system checks the overall train seizure status, then the system determines if any equipment still remains seized on the train.
  • Context - no equipment remains seized on the train:
    For Remove Train Seizure Status:
    When the system updates the train seizure status, then the overall train seizure status is removed.
  • Context - some equipment still remains seized on the train:
    For Keep Train Seizure Status:
    When the system updates the train seizure status, then the overall train seizure status is maintained.
  • Context - train seizure status has been determined:
    For Update Train Status in Database:
    When the system updates the database, then the train status changes are persisted to the database.
  • Context - train status has been updated in the database:
    For Generate Equipment Release Notification:
    When the system generates release notifications, then equipment release notification is created and sent to appropriate recipients.
  • Context - equipment id is valid but equipment is not found on the train:
    For Log Equipment Not Found Error:
    When the system processes the equipment search result, then an error is logged indicating equipment not found on train.
  • Context - equipment id has been extracted from vid segment:
    For Log Invalid Equipment ID Error:
    When the equipment id format validation fails, then an error is logged indicating invalid equipment id format.
  • Context - equipment is found on train but is not currently seized:
    For Log Equipment Not Seized Warning:
    When the system attempts to release equipment from seizure, then a warning is logged indicating equipment is not currently seized.
  • Context - a message with disposition code is being processed:
    For SER Disposition Code Present?:
    When the system evaluates the disposition code, then if disposition code is 'ser', initiate equipment seizure release processing, otherwise skip seizure release processing.
  • Context - ser disposition code is present and seizure release processing is initiated:
    For Initialize Equipment Counter:
    When the system begins equipment seizure release processing, then initialize equipment counter to track the number of equipment items currently under seizure on the train.
  • Context - equipment counter is initialized for seizure release processing:
    For VID Segments Available?:
    When the system checks for vid segments in the message, then if vid segments are available, proceed to process each vid segment, otherwise update train seizure status directly.
  • Context - vid segments are available for processing:
    For Get Next VID Segment:
    When the system processes vid segments sequentially, then retrieve the next available vid segment containing equipment identification information.
  • Context - a vid segment is retrieved for processing:
    For Extract Equipment ID from VID:
    When the system processes the vid segment, then extract the equipment identification information from the vid segment data.
  • Context - equipment id is extracted from vid segment:
    For Format Equipment ID:
    When the system processes the equipment id, then format the equipment id according to standard equipment identification format for train registry lookup.
  • Context - equipment id is formatted for lookup:
    For Equipment Found on Train?:
    When the system searches for the equipment on the train, then if equipment is found on the train, proceed with seizure release, otherwise generate equipment not found warning.
  • Context - equipment is found on the train and has seizure status:
    For Remove Seizure Status from Equipment:
    When the system processes seizure release for the equipment, then remove the seizure status from the equipment record.
  • Context - seizure status is removed from an equipment item:
    For Decrement Seized Equipment Count:
    When the system updates equipment seizure tracking, then decrement the total count of seized equipment on the train by one.
  • Context - equipment seizure status is removed and count is decremented:
    For Log Equipment Release from Seizure:
    When the system completes seizure release for an equipment item, then log the equipment seizure release event with equipment id, timestamp, and release details.
  • Context - current vid segment processing is complete:
    For More VID Segments?:
    When the system checks for remaining vid segments, then if more vid segments exist, continue processing the next vid segment, otherwise proceed to update train seizure status.
  • Context - equipment id is formatted but not found on the train:
    For Equipment Not Found Warning:
    When the system cannot locate the equipment on the train, then generate a warning message indicating the equipment was not found on the train and continue processing remaining vid segments.
  • Context - all vid segments have been processed for equipment seizure releases:
    For Update Train Seizure Status:
    When the system evaluates the train's overall seizure status, then update the train seizure status based on remaining seized equipment count.
  • Context - train seizure status is being updated:
    For Any Equipment Still Seized?:
    When the system evaluates the seized equipment count, then if any equipment still has seizure status, keep train seizure status active, otherwise remove train seizure status.
  • Context - some equipment on the train still has seizure status:
    For Keep Train Seizure Status:
    When the system updates train seizure status, then maintain the train seizure status as active since seized equipment remains on the train.
  • Context - no equipment on the train has seizure status:
    For Remove Train Seizure Status:
    When the system updates train seizure status, then remove the train seizure status since no seized equipment remains on the train.
  • Context - train seizure status has been updated after processing all equipment seizure releases:
    For Generate Train Seizure Release Notification:
    When the system completes seizure release processing, then generate notification about the completion of train seizure release processing with final status details.
  • Context - a message is being processed for disposition codes:
    For Skip - No SER Code:
    When the disposition code is not 'ser', then skip all equipment seizure release processing and complete the seizure release workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A SER disposition code has been processed for a train
GIVEN
A SER disposition code has been processed for a train
Applied to: Check if VID Segments Follow SER Code
WHEN
The system checks for VID segments following the SER code
THEN
The system identifies whether VID segments are present for equipment processing
Context: A VID segment is being processed for equipment seizure release
GIVEN
A VID segment is being processed for equipment seizure release
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 system determines if the equipment ID format is valid or invalid
Context: A valid equipment ID has been extracted from VID segment
GIVEN
A valid equipment ID has been extracted from VID segment
Applied to: Find Equipment on Train
WHEN
The system searches for the equipment on the train
THEN
The system determines if the equipment is found or not found on the train
Context: Equipment has been found on the train
GIVEN
Equipment has been found on the train
Applied to: Check Current Equipment Status
WHEN
The system checks the current equipment status
THEN
The system determines if the equipment is currently seized or not seized
Context: Equipment is currently under seizure status
GIVEN
Equipment is currently under seizure status
Applied to: Release Equipment from Seizure
WHEN
The system processes the seizure release request
THEN
The equipment seizure status is removed
Context: Equipment seizure has been released
GIVEN
Equipment seizure has been released
Applied to: Update Equipment Status to Normal
WHEN
The system updates the equipment status
THEN
The equipment status is set to normal operational status
Context: Equipment has been released from seizure
GIVEN
Equipment has been released from seizure
Applied to: Decrement Train Seized Equipment Count
WHEN
The system updates train seizure statistics
THEN
The train's seized equipment count is decremented by one
Context: Equipment seizure has been successfully released
GIVEN
Equipment seizure has been successfully released
Applied to: Log Equipment Seizure Release
WHEN
The system logs the seizure release activity
THEN
An audit log entry is created documenting the equipment seizure release
Context: All VID segments have been processed for seizure release
GIVEN
All VID segments have been processed for seizure release
Applied to: Check Overall Train Seizure Status
WHEN
The system checks the overall train seizure status
THEN
The system determines if any equipment still remains seized on the train
Context: No equipment remains seized on the train
GIVEN
No equipment remains seized on the train
Applied to: Remove Train Seizure Status
WHEN
The system updates the train seizure status
THEN
The overall train seizure status is removed
Context: Some equipment still remains seized on the train
GIVEN
Some equipment still remains seized on the train
Applied to: Keep Train Seizure Status
WHEN
The system updates the train seizure status
THEN
The overall train seizure status is maintained
Context: Train seizure status has been determined
GIVEN
Train seizure status has been determined
Applied to: Update Train Status in Database
WHEN
The system updates the database
THEN
The train status changes are persisted to the database
Context: Train status has been updated in the database
GIVEN
Train status has been updated in the database
Applied to: Generate Equipment Release Notification
WHEN
The system generates release notifications
THEN
Equipment release notification is created and sent to appropriate recipients
Context: Equipment ID is valid but equipment is not found on the train
GIVEN
Equipment ID is valid but equipment is not found on the train
Applied to: Log Equipment Not Found Error
WHEN
The system processes the equipment search result
THEN
An error is logged indicating equipment not found on train
Context: Equipment ID has been extracted from VID segment
GIVEN
Equipment ID has been extracted from VID segment
Applied to: Log Invalid Equipment ID Error
WHEN
The equipment ID format validation fails
THEN
An error is logged indicating invalid equipment ID format
Context: Equipment is found on train but is not currently seized
GIVEN
Equipment is found on train but is not currently seized
Applied to: Log Equipment Not Seized Warning
WHEN
The system attempts to release equipment from seizure
THEN
A warning is logged indicating equipment is not currently seized
Context: A message with disposition code is being processed
GIVEN
A message with disposition code is being processed
Applied to: SER Disposition Code Present?
WHEN
The system evaluates the disposition code
THEN
If disposition code is 'SER', initiate equipment seizure release processing, otherwise skip seizure release processing
Context: SER disposition code is present and seizure release processing is initiated
GIVEN
SER disposition code is present and seizure release processing is initiated
Applied to: Initialize Equipment Counter
WHEN
The system begins equipment seizure release processing
THEN
Initialize equipment counter to track the number of equipment items currently under seizure on the train
Context: Equipment counter is initialized for seizure release processing
GIVEN
Equipment counter is initialized for seizure release processing
Applied to: VID Segments Available?
WHEN
The system checks for VID segments in the message
THEN
If VID segments are available, proceed to process each VID segment, otherwise update train seizure status directly
Context: VID segments are available for processing
GIVEN
VID segments are available for processing
Applied to: Get Next VID Segment
WHEN
The system processes VID segments sequentially
THEN
Retrieve the next available VID segment containing equipment identification information
Context: A VID segment is retrieved for processing
GIVEN
A VID segment is retrieved for processing
Applied to: Extract Equipment ID from VID
WHEN
The system processes the VID segment
THEN
Extract the equipment identification information from the VID segment data
Context: Equipment ID is extracted from VID segment
GIVEN
Equipment ID is extracted from VID segment
Applied to: Format Equipment ID
WHEN
The system processes the equipment ID
THEN
Format the equipment ID according to standard equipment identification format for train registry lookup
Context: Equipment ID is formatted for lookup
GIVEN
Equipment ID is formatted for lookup
Applied to: Equipment Found on Train?
WHEN
The system searches for the equipment on the train
THEN
If equipment is found on the train, proceed with seizure release, otherwise generate equipment not found warning
Context: Equipment is found on the train and has seizure status
GIVEN
Equipment is found on the train and has seizure status
Applied to: Remove Seizure Status from Equipment
WHEN
The system processes seizure release for the equipment
THEN
Remove the seizure status from the equipment record
Context: Seizure status is removed from an equipment item
GIVEN
Seizure status is removed from an equipment item
Applied to: Decrement Seized Equipment Count
WHEN
The system updates equipment seizure tracking
THEN
Decrement the total count of seized equipment on the train by one
Context: Equipment seizure status is removed and count is decremented
GIVEN
Equipment seizure status is removed and count is decremented
Applied to: Log Equipment Release from Seizure
WHEN
The system completes seizure release for an equipment item
THEN
Log the equipment seizure release event with equipment ID, timestamp, and release details
Context: Current VID segment processing is complete
GIVEN
Current VID segment processing is complete
Applied to: More VID Segments?
WHEN
The system checks for remaining VID segments
THEN
If more VID segments exist, continue processing the next VID segment, otherwise proceed to update train seizure status
Context: Equipment ID is formatted but not found on the train
GIVEN
Equipment ID is formatted but not found on the train
Applied to: Equipment Not Found Warning
WHEN
The system cannot locate the equipment on the train
THEN
Generate a warning message indicating the equipment was not found on the train and continue processing remaining VID segments
Context: All VID segments have been processed for equipment seizure releases
GIVEN
All VID segments have been processed for equipment seizure releases
Applied to: Update Train Seizure Status
WHEN
The system evaluates the train's overall seizure status
THEN
Update the train seizure status based on remaining seized equipment count
Context: Train seizure status is being updated
GIVEN
Train seizure status is being updated
Applied to: Any Equipment Still Seized?
WHEN
The system evaluates the seized equipment count
THEN
If any equipment still has seizure status, keep train seizure status active, otherwise remove train seizure status
Context: Some equipment on the train still has seizure status
GIVEN
Some equipment on the train still has seizure status
Applied to: Keep Train Seizure Status
WHEN
The system updates train seizure status
THEN
Maintain the train seizure status as active since seized equipment remains on the train
Context: No equipment on the train has seizure status
GIVEN
No equipment on the train has seizure status
Applied to: Remove Train Seizure Status
WHEN
The system updates train seizure status
THEN
Remove the train seizure status since no seized equipment remains on the train
Context: Train seizure status has been updated after processing all equipment seizure releases
GIVEN
Train seizure status has been updated after processing all equipment seizure releases
Applied to: Generate Train Seizure Release Notification
WHEN
The system completes seizure release processing
THEN
Generate notification about the completion of train seizure release processing with final status details
Context: A message is being processed for disposition codes
GIVEN
A message is being processed for disposition codes
Applied to: Skip - No SER Code
WHEN
The disposition code is not 'SER'
THEN
Skip all equipment seizure release processing and complete the seizure release workflow
R-GCX016-cbl-04008 (+55) File: GCX016.cbl Bond Merged 56 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond':
  • Context - an x4 segment is being processed for bond-based cargo operations:
    For Bond Number Available?:
    When the system checks for bond number availability in the x4 segment, then processing continues to bond extraction if bond number exists, otherwise skips bond processing and processing continues to bond extraction if bond number exists, otherwise generates bond error message.
  • Context - an x4 segment contains bond information:
    For Extract Bond Control Number from X4 Segment:
    When the system processes the x4 segment for bond-based operations, then the bond control number is extracted and stored for subsequent cargo processing.
  • Context - a bond control number has been extracted from the x4 segment:
    For Validate Bond Number Format:
    When the system validates the bond number format, then processing continues if format is valid, otherwise generates validation error and processing continues if format is valid, otherwise generates bond error message.
  • Context - a bond number has undergone format validation:
    For Bond Number Valid?:
    When the system evaluates bond number validity, then sets bond processing flag if valid, otherwise generates bond validation error.
  • Context - a valid bond number has been confirmed:
    For Set Bond Processing Flag:
    When the system prepares for bond-based cargo processing, then bond processing flag is set to enable bond-specific cargo operations.
  • Context - bond processing flag has been set:
    For Initialize Cargo Counter:
    When the system prepares to process cargo records by bond, then cargo counter is initialized to zero for tracking processed records.
    For Initialize Cargo Counter:
    When the system prepares to process cargo records by bond number, then cargo counter is initialized to zero to track processing progress.
  • Context - a valid bond number and initialized cargo counter:
    For Fetch First Cargo Record by Bond Number:
    When the system searches for cargo records by bond number, then first cargo record matching the bond number is retrieved from cargo database.
    For Fetch First Cargo Record by Bond Number:
    When the system searches for cargo records using the bond number as index, then first cargo record matching the bond number is retrieved if exists, otherwise no cargo found flag is set.
  • Context - a search for cargo records by bond number has been executed:
    For Cargo Found?:
    When the system evaluates search results, then proceeds to cargo processing if records found, otherwise moves to bond processing summary.
    For Cargo Found?:
    When the system evaluates the search results, then processing continues to cargo processing if records found, otherwise proceeds to bond processing summary.
  • Context - a cargo record has been found for the bond number:
    For Load Cargo Information:
    When the system prepares to process the cargo, then complete cargo information including status, quantities, and identifiers is loaded.
    For Process Current Cargo Record:
    When the system processes the current cargo record, then cargo record is prepared for disposition code application and status updates.
  • Context - cargo information has been loaded and x4 segment contains disposition code:
    For Process Disposition Code for Cargo:
    When the system processes disposition code for the cargo, then disposition code is validated and appropriate cargo actions are determined.
  • Context - disposition code has been processed for the cargo:
    For Update Cargo Status Array:
    When the system updates cargo status information, then status array is modified to reflect new disposition code and associated status changes.
  • Context - cargo status array has been updated with disposition code information:
    For Apply Business Rules to Cargo:
    When the system applies business rules to the cargo, then cargo processing rules are executed based on cargo characteristics and disposition requirements.
  • Context - business rules have been applied to the cargo:
    For Update Cargo Release Status:
    When the system determines final cargo release status, then cargo release status is updated to reflect hold, release, or other appropriate status conditions.
  • Context - cargo release status has been updated:
    For Generate Cargo Messages if Required:
    When the system evaluates message generation requirements, then appropriate cargo messages are generated if status changes require notification.
  • Context - a cargo record has been successfully processed:
    For Increment Cargo Counter:
    When the system completes cargo processing, then cargo counter is incremented by one to track processed records.
  • Context - current cargo record has been processed and cargo counter incremented:
    For Fetch Next Cargo Record with Same Bond:
    When the system searches for additional cargo records with the same bond number, then next cargo record matching the bond number is retrieved if available.
  • Context - a search for next cargo record with same bond has been executed:
    For More Cargo Records?:
    When the system evaluates if more cargo records exist, then continues cargo processing loop if more records found, otherwise proceeds to bond processing summary.
  • Context - all cargo records for the bond number have been processed or no cargo records were found:
    For Generate Bond Processing Summary:
    When the system completes bond-based cargo processing, then bond processing summary is generated including cargo count and processing results.
  • Context - bond processing summary has been generated:
    For Log Bond Processing Results:
    When the system finalizes bond processing, then bond processing results are logged to appropriate system logs for audit trail.
    For Update All Processed Cargo Records:
    When the system updates all processed cargo records, then all cargo records under the bond are updated in the database with new status and quantity information.
  • Context - bond number has failed format or validity validation:
    For Generate Bond Validation Error:
    When the system encounters invalid bond number, then bond validation error is generated with appropriate error details.
  • Context - bond validation error has been generated:
    For Log Bond Error:
    When the system handles bond validation failure, then bond error details are logged to error logs for analysis and resolution.
  • Context - bond number is unavailable or bond validation has failed:
    For Skip Bond Processing:
    When the system cannot proceed with bond-based processing, then bond processing is skipped and system proceeds to completion.
  • Context - a valid x4 segment contains bond information:
    For Extract Bond Control Number from X4 Segment:
    When the system extracts the bond control number from the x4 segment, then the bond control number is captured and made available for validation and processing.
  • Context - a valid bond number has been extracted and validated:
    For Set Bond Processing Flag:
    When the system initializes bond processing mode, then bond processing flag is set and cargo counter is initialized for bond-based operations.
  • Context - a cargo record is being processed and disposition code is available from x4 segment:
    For Apply Disposition Code to Cargo:
    When the system applies the disposition code to the cargo, then disposition code is validated against disposition code tables and applied to cargo status array.
  • Context - a disposition code has been applied to cargo:
    For Update Cargo Status Array:
    When the system updates the cargo status array, then status array is modified to reflect new disposition code and associated status changes.
  • Context - cargo status array has been updated with disposition code:
    For Calculate Release Quantities:
    When the system calculates release quantities for the cargo, then release quantities are computed based on disposition code action (add, subtract, or set) and validated against total cargo quantities.
  • Context - release quantities have been calculated for cargo:
    For Update Cargo Hold/Release Status:
    When the system updates cargo hold and release status, then cargo status is set to appropriate hold or release condition based on quantity comparisons and disposition code effects.
  • Context - current cargo record has been processed under the bond:
    For Fetch Next Cargo with Same Bond:
    When the system searches for additional cargo records with the same bond number, then next cargo record is retrieved if exists, otherwise end of cargo records flag is set.
  • Context - a search for next cargo record by bond number has been executed:
    For More Cargo Records?:
    When the system evaluates if more cargo records exist, then processing loops back to cargo processing if more records exist, otherwise proceeds to bond processing summary.
  • Context - all cargo records for the bond number have been processed:
    For Generate Bond Processing Summary:
    When the system generates bond processing summary, then summary includes total cargo count, processing results, and status changes for the bond.
  • Context - all cargo records for the bond have been updated:
    For Send Broker Notifications for Bond:
    When the system sends broker notifications, then notifications are sent to relevant brokers for all cargo status changes under the bond number.
  • Context - broker notifications have been sent for the bond:
    For Log Bond Processing Results:
    When the system logs bond processing results, then processing results, cargo counts, and status changes are logged for audit trail and system monitoring.
  • Context - bond number is missing, invalid format, or validation fails:
    For Generate Bond Error Message:
    When the system generates bond error message, then error message is created indicating bond processing cannot proceed and includes relevant error details.
  • Context - bond error message has been generated:
    For Log Bond Processing Error:
    When the system logs bond processing error, then error details are logged including bond number, error type, and processing context for system monitoring.
  • Context - an x4 segment is available for processing:
    For Extract Bond Control Number from X4 Segment:
    When the system processes the x4 segment for bond-based cargo fetching, then the bond control number is extracted from the x4 segment and prepared as search key.
  • Context - a bond control number has been extracted from x4 segment:
    For Bond Number Valid?:
    When the system validates the bond number, then if bond number is empty or invalid, processing stops with error; if valid, processing continues.
  • Context - a valid bond control number exists:
    For Set Bond Number as Search Key:
    When the system prepares for cargo database search, then the bond number is set as the search key for bond index lookup.
  • Context - bond number is set as search key:
    For Call GCCUSIO with Bond Index:
    When the system performs database lookup, then gccusio is called with bond index to retrieve matching cargo records.
  • Context - database lookup by bond number has been performed:
    For Cargo Records Found?:
    When the system evaluates the search results, then if no cargo records found, log error and return error status; if records found, proceed with retrieval.
  • Context - cargo records exist for the bond number:
    For Retrieve First Cargo Record:
    When the system begins cargo record processing, then the first cargo record matching the bond number is retrieved.
  • Context - a cargo record has been retrieved:
    For Load Cargo Root Segment:
    When the system loads cargo data, then the cargo root segment is loaded from gcsusrt ims segment.
  • Context - current cargo record has been processed:
    For More Cargo with Same Bond?:
    When the system checks for additional cargo with same bond, then if more cargo exists with same bond, continue processing; if no more cargo, complete bond processing.
  • Context - a cargo record with matching bond number is loaded:
    For Process Current Cargo Record:
    When the system processes the cargo record, then the cargo record is processed according to disposition code and business rules.
  • Context - current cargo record has been processed and more cargo exists with same bond:
    For Get Next Cargo Record with Same Bond:
    When the system retrieves the next cargo record, then the next cargo record with matching bond number is retrieved for processing.
  • Context - all cargo records with the bond number have been processed:
    For All Bond Cargo Retrieved:
    When no more cargo records exist with the same bond number, then bond-based cargo processing is completed successfully.
  • Context - bond number is valid but no cargo records exist for the bond:
    For Log Bond Number Not Found Error:
    When the system encounters bond not found condition, then an error is logged indicating bond number not found.
  • Context - bond number is invalid or no cargo records found for valid bond:
    For Return Error Status:
    When bond processing encounters an error condition, then error status is returned to calling process.
  • Context - all cargo records for the bond have been successfully processed:
    For Return Success Status:
    When bond processing completes without errors, then success status is returned to calling process.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed for bond-based cargo operations
GIVEN
An X4 segment is being processed for bond-based cargo operations
Applied to: Bond Number Available?
WHEN
The system checks for bond number availability in the X4 segment
THEN
Processing continues to bond extraction if bond number exists, otherwise skips bond processing AND Processing continues to bond extraction if bond number exists, otherwise generates bond error message
Context: An X4 segment contains bond information
GIVEN
An X4 segment contains bond information
Applied to: Extract Bond Control Number from X4 Segment
WHEN
The system processes the X4 segment for bond-based operations
THEN
The bond control number is extracted and stored for subsequent cargo processing
Context: A bond control number has been extracted from the X4 segment
GIVEN
A bond control number has been extracted from the X4 segment
Applied to: Validate Bond Number Format
WHEN
The system validates the bond number format
THEN
Processing continues if format is valid, otherwise generates validation error AND Processing continues if format is valid, otherwise generates bond error message
Context: A bond number has undergone format validation
GIVEN
A bond number has undergone format validation
Applied to: Bond Number Valid?
WHEN
The system evaluates bond number validity
THEN
Sets bond processing flag if valid, otherwise generates bond validation error
Context: A valid bond number has been confirmed
GIVEN
A valid bond number has been confirmed
Applied to: Set Bond Processing Flag
WHEN
The system prepares for bond-based cargo processing
THEN
Bond processing flag is set to enable bond-specific cargo operations
Context: Bond processing flag has been set
GIVEN
Bond processing flag has been set
Applied to: Initialize Cargo Counter
WHEN
The system prepares to process cargo records by bond
THEN
Cargo counter is initialized to zero for tracking processed records
Applied to: Initialize Cargo Counter
WHEN
The system prepares to process cargo records by bond number
THEN
Cargo counter is initialized to zero to track processing progress
Context: A valid bond number and initialized cargo counter
GIVEN
A valid bond number and initialized cargo counter
Applied to: Fetch First Cargo Record by Bond Number
WHEN
The system searches for cargo records by bond number
THEN
First cargo record matching the bond number is retrieved from cargo database
Applied to: Fetch First Cargo Record by Bond Number
WHEN
The system searches for cargo records using the bond number as index
THEN
First cargo record matching the bond number is retrieved if exists, otherwise no cargo found flag is set
Context: A search for cargo records by bond number has been executed
GIVEN
A search for cargo records by bond number has been executed
Applied to: Cargo Found?
WHEN
The system evaluates search results
THEN
Proceeds to cargo processing if records found, otherwise moves to bond processing summary
Applied to: Cargo Found?
WHEN
The system evaluates the search results
THEN
Processing continues to cargo processing if records found, otherwise proceeds to bond processing summary
Context: A cargo record has been found for the bond number
GIVEN
A cargo record has been found for the bond number
Applied to: Load Cargo Information
WHEN
The system prepares to process the cargo
THEN
Complete cargo information including status, quantities, and identifiers is loaded
Applied to: Process Current Cargo Record
WHEN
The system processes the current cargo record
THEN
Cargo record is prepared for disposition code application and status updates
Context: Cargo information has been loaded and X4 segment contains disposition code
GIVEN
Cargo information has been loaded and X4 segment contains disposition code
Applied to: Process Disposition Code for Cargo
WHEN
The system processes disposition code for the cargo
THEN
Disposition code is validated and appropriate cargo actions are determined
Context: Disposition code has been processed for the cargo
GIVEN
Disposition code has been processed for the cargo
Applied to: Update Cargo Status Array
WHEN
The system updates cargo status information
THEN
Status array is modified to reflect new disposition code and associated status changes
Context: Cargo status array has been updated with disposition code information
GIVEN
Cargo status array has been updated with disposition code information
Applied to: Apply Business Rules to Cargo
WHEN
The system applies business rules to the cargo
THEN
Cargo processing rules are executed based on cargo characteristics and disposition requirements
Context: Business rules have been applied to the cargo
GIVEN
Business rules have been applied to the cargo
Applied to: Update Cargo Release Status
WHEN
The system determines final cargo release status
THEN
Cargo release status is updated to reflect hold, release, or other appropriate status conditions
Context: Cargo release status has been updated
GIVEN
Cargo release status has been updated
Applied to: Generate Cargo Messages if Required
WHEN
The system evaluates message generation requirements
THEN
Appropriate cargo messages are generated if status changes require notification
Context: A cargo record has been successfully processed
GIVEN
A cargo record has been successfully processed
Applied to: Increment Cargo Counter
WHEN
The system completes cargo processing
THEN
Cargo counter is incremented by one to track processed records
Context: Current cargo record has been processed and cargo counter incremented
GIVEN
Current cargo record has been processed and cargo counter incremented
Applied to: Fetch Next Cargo Record with Same Bond
WHEN
The system searches for additional cargo records with the same bond number
THEN
Next cargo record matching the bond number is retrieved if available
Context: A search for next cargo record with same bond has been executed
GIVEN
A search for next cargo record with same bond has been executed
Applied to: More Cargo Records?
WHEN
The system evaluates if more cargo records exist
THEN
Continues cargo processing loop if more records found, otherwise proceeds to bond processing summary
Context: All cargo records for the bond number have been processed or no cargo records were found
GIVEN
All cargo records for the bond number have been processed or no cargo records were found
Applied to: Generate Bond Processing Summary
WHEN
The system completes bond-based cargo processing
THEN
Bond processing summary is generated including cargo count and processing results
Context: Bond processing summary has been generated
GIVEN
Bond processing summary has been generated
Applied to: Log Bond Processing Results
WHEN
The system finalizes bond processing
THEN
Bond processing results are logged to appropriate system logs for audit trail
Applied to: Update All Processed Cargo Records
WHEN
The system updates all processed cargo records
THEN
All cargo records under the bond are updated in the database with new status and quantity information
Context: Bond number has failed format or validity validation
GIVEN
Bond number has failed format or validity validation
Applied to: Generate Bond Validation Error
WHEN
The system encounters invalid bond number
THEN
Bond validation error is generated with appropriate error details
Context: Bond validation error has been generated
GIVEN
Bond validation error has been generated
Applied to: Log Bond Error
WHEN
The system handles bond validation failure
THEN
Bond error details are logged to error logs for analysis and resolution
Context: Bond number is unavailable or bond validation has failed
GIVEN
Bond number is unavailable or bond validation has failed
Applied to: Skip Bond Processing
WHEN
The system cannot proceed with bond-based processing
THEN
Bond processing is skipped and system proceeds to completion
Context: A valid X4 segment contains bond information
GIVEN
A valid X4 segment contains bond information
Applied to: Extract Bond Control Number from X4 Segment
WHEN
The system extracts the bond control number from the X4 segment
THEN
The bond control number is captured and made available for validation and processing
Context: A valid bond number has been extracted and validated
GIVEN
A valid bond number has been extracted and validated
Applied to: Set Bond Processing Flag
WHEN
The system initializes bond processing mode
THEN
Bond processing flag is set and cargo counter is initialized for bond-based operations
Context: A cargo record is being processed and disposition code is available from X4 segment
GIVEN
A cargo record is being processed and disposition code is available from X4 segment
Applied to: Apply Disposition Code to Cargo
WHEN
The system applies the disposition code to the cargo
THEN
Disposition code is validated against disposition code tables and applied to cargo status array
Context: A disposition code has been applied to cargo
GIVEN
A disposition code has been applied to cargo
Applied to: Update Cargo Status Array
WHEN
The system updates the cargo status array
THEN
Status array is modified to reflect new disposition code and associated status changes
Context: Cargo status array has been updated with disposition code
GIVEN
Cargo status array has been updated with disposition code
Applied to: Calculate Release Quantities
WHEN
The system calculates release quantities for the cargo
THEN
Release quantities are computed based on disposition code action (add, subtract, or set) and validated against total cargo quantities
Context: Release quantities have been calculated for cargo
GIVEN
Release quantities have been calculated for cargo
Applied to: Update Cargo Hold/Release Status
WHEN
The system updates cargo hold and release status
THEN
Cargo status is set to appropriate hold or release condition based on quantity comparisons and disposition code effects
Context: Current cargo record has been processed under the bond
GIVEN
Current cargo record has been processed under the bond
Applied to: Fetch Next Cargo with Same Bond
WHEN
The system searches for additional cargo records with the same bond number
THEN
Next cargo record is retrieved if exists, otherwise end of cargo records flag is set
Context: A search for next cargo record by bond number has been executed
GIVEN
A search for next cargo record by bond number has been executed
Applied to: More Cargo Records?
WHEN
The system evaluates if more cargo records exist
THEN
Processing loops back to cargo processing if more records exist, otherwise proceeds to bond processing summary
Context: All cargo records for the bond number have been processed
GIVEN
All cargo records for the bond number have been processed
Applied to: Generate Bond Processing Summary
WHEN
The system generates bond processing summary
THEN
Summary includes total cargo count, processing results, and status changes for the bond
Context: All cargo records for the bond have been updated
GIVEN
All cargo records for the bond have been updated
Applied to: Send Broker Notifications for Bond
WHEN
The system sends broker notifications
THEN
Notifications are sent to relevant brokers for all cargo status changes under the bond number
Context: Broker notifications have been sent for the bond
GIVEN
Broker notifications have been sent for the bond
Applied to: Log Bond Processing Results
WHEN
The system logs bond processing results
THEN
Processing results, cargo counts, and status changes are logged for audit trail and system monitoring
Context: Bond number is missing, invalid format, or validation fails
GIVEN
Bond number is missing, invalid format, or validation fails
Applied to: Generate Bond Error Message
WHEN
The system generates bond error message
THEN
Error message is created indicating bond processing cannot proceed and includes relevant error details
Context: Bond error message has been generated
GIVEN
Bond error message has been generated
Applied to: Log Bond Processing Error
WHEN
The system logs bond processing error
THEN
Error details are logged including bond number, error type, and processing context for system monitoring
Context: An X4 segment is available for processing
GIVEN
An X4 segment is available for processing
Applied to: Extract Bond Control Number from X4 Segment
WHEN
The system processes the X4 segment for bond-based cargo fetching
THEN
The bond control number is extracted from the X4 segment and prepared as search key
Context: A bond control number has been extracted from X4 segment
GIVEN
A bond control number has been extracted from X4 segment
Applied to: Bond Number Valid?
WHEN
The system validates the bond number
THEN
If bond number is empty or invalid, processing stops with error; if valid, processing continues
Context: A valid bond control number exists
GIVEN
A valid bond control number exists
Applied to: Set Bond Number as Search Key
WHEN
The system prepares for cargo database search
THEN
The bond number is set as the search key for bond index lookup
Context: Bond number is set as search key
GIVEN
Bond number is set as search key
Applied to: Call GCCUSIO with Bond Index
WHEN
The system performs database lookup
THEN
GCCUSIO is called with bond index to retrieve matching cargo records
Context: Database lookup by bond number has been performed
GIVEN
Database lookup by bond number has been performed
Applied to: Cargo Records Found?
WHEN
The system evaluates the search results
THEN
If no cargo records found, log error and return error status; if records found, proceed with retrieval
Context: Cargo records exist for the bond number
GIVEN
Cargo records exist for the bond number
Applied to: Retrieve First Cargo Record
WHEN
The system begins cargo record processing
THEN
The first cargo record matching the bond number is retrieved
Context: A cargo record has been retrieved
GIVEN
A cargo record has been retrieved
Applied to: Load Cargo Root Segment
WHEN
The system loads cargo data
THEN
The cargo root segment is loaded from GCSUSRT IMS segment
Context: Current cargo record has been processed
GIVEN
Current cargo record has been processed
Applied to: More Cargo with Same Bond?
WHEN
The system checks for additional cargo with same bond
THEN
If more cargo exists with same bond, continue processing; if no more cargo, complete bond processing
Context: A cargo record with matching bond number is loaded
GIVEN
A cargo record with matching bond number is loaded
Applied to: Process Current Cargo Record
WHEN
The system processes the cargo record
THEN
The cargo record is processed according to disposition code and business rules
Context: Current cargo record has been processed and more cargo exists with same bond
GIVEN
Current cargo record has been processed and more cargo exists with same bond
Applied to: Get Next Cargo Record with Same Bond
WHEN
The system retrieves the next cargo record
THEN
The next cargo record with matching bond number is retrieved for processing
Context: All cargo records with the bond number have been processed
GIVEN
All cargo records with the bond number have been processed
Applied to: All Bond Cargo Retrieved
WHEN
No more cargo records exist with the same bond number
THEN
Bond-based cargo processing is completed successfully
Context: Bond number is valid but no cargo records exist for the bond
GIVEN
Bond number is valid but no cargo records exist for the bond
Applied to: Log Bond Number Not Found Error
WHEN
The system encounters bond not found condition
THEN
An error is logged indicating bond number not found
Context: Bond number is invalid or no cargo records found for valid bond
GIVEN
Bond number is invalid or no cargo records found for valid bond
Applied to: Return Error Status
WHEN
Bond processing encounters an error condition
THEN
Error status is returned to calling process
Context: All cargo records for the bond have been successfully processed
GIVEN
All cargo records for the bond have been successfully processed
Applied to: Return Success Status
WHEN
Bond processing completes without errors
THEN
Success status is returned to calling process
R-GCX016-cbl-04030 (+38) File: GCX016.cbl Car/Waybill Cargo Processing Merged 39 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car/Waybill Cargo Processing':
  • Context - a cargo processing request is initiated:
    For X4 Segment Available?:
    When the system checks for x4 segment availability, then processing continues if x4 segment is available, otherwise error handling is triggered.
  • Context - x4 segment is available with car information:
    For Extract Car ID from X4-01:
    When the system processes the x4-01 field, then car id is extracted and stored for further processing.
  • Context - x4 segment contains waybill information in x4-02 field:
    For Extract Waybill from X4-02:
    When the system processes the waybill data, then waybill number is extracted and prepared for cargo lookup.
  • Context - raw car id has been extracted from x4 segment:
    For Format Car ID using GCCCARFM:
    When the system calls gcccarfm formatting module, then car id is formatted according to standard business rules and validation is performed.
  • Context - car id has been formatted using gcccarfm:
    For Car ID Valid?:
    When the system validates the car id format and content, then processing continues if car id is valid, otherwise error handling is initiated.
  • Context - valid car id and waybill number are available:
    For Build Car/Waybill Key:
    When the system builds the composite search key, then car/waybill key is constructed for database lookup operations.
  • Context - car/waybill key has been constructed:
    For Search Cargo by Car/Waybill Index:
    When the system searches the cargo database using car/waybill index, then cargo records matching the key are identified or search returns no results.
  • Context - car/waybill index search has been completed:
    For Cargo Found?:
    When the system evaluates search results, then if cargo is found, proceed to retrieve records; if not found, initiate fallback search by car id only.
  • Context - cargo has been found using car/waybill search:
    For Retrieve Cargo Record:
    When the system retrieves the cargo record, then complete cargo record is loaded for status validation and processing.
  • Context - cargo record has been retrieved from the database:
    For Validate Cargo Status:
    When the system validates the cargo status, then cargo status is checked for validity and processing eligibility.
  • Context - cargo status has been validated:
    For Cargo Valid?:
    When the system assesses overall cargo validity, then if cargo is valid, proceed to disposition code processing; if invalid, trigger error handling.
    For Valid Cargo?:
    When the system evaluates processing eligibility, then the system determines if cargo can proceed with disposition code processing or requires error handling.
  • Context - valid cargo record is available for processing:
    For Process Disposition Codes:
    When the system processes disposition codes from x4 segment, then disposition codes are evaluated and appropriate cargo status changes are determined.
  • Context - disposition codes have been processed and status changes determined:
    For Update Cargo Status:
    When the system updates the cargo record, then cargo status is updated in the database and processing is marked complete.
  • Context - car/waybill search did not find any cargo records:
    For Try Car ID Only Search:
    When the system performs car id only search using car id index, then cargo records matching the car id are identified regardless of waybill.
  • Context - car id only search has been completed:
    For Cargo Found by Car ID?:
    When the system evaluates fallback search results, then if cargo is found, proceed to waybill matching; if not found, generate cargo not found error.
  • Context - cargo records have been found using car id only search:
    For Check Multiple Waybills:
    When the system analyzes waybill information in found records, then waybill matching is performed to identify the correct cargo record.
  • Context - multiple cargo records exist for the car id:
    For Single Waybill Match?:
    When the system checks for waybill matches, then if exactly one waybill matches, select that cargo; if multiple or no matches, generate error.
  • Context - exactly one cargo record matches the waybill criteria:
    For Select Matching Cargo:
    When the system selects the matching cargo record, then the correct cargo record is identified for processing.
  • Context - cargo was successfully found using car id only search:
    For Log Car ID Search Used:
    When the system logs the search method used, then car id search usage is recorded for audit and monitoring purposes.
  • Context - both car/waybill and car id only searches failed to find valid cargo:
    For Generate Cargo Not Found Error:
    When the system generates cargo not found error, then error message is created indicating cargo could not be located for processing.
  • Context - cargo not found error has been generated:
    For Create Foreign Bill Record:
    When the system creates a foreign bill record, then new foreign bill record is created to handle the unmatched cargo information.
  • Context - a car id exists in the n7 segment data:
    For Format Equipment ID using GCCCARFM:
    When the system needs to search for cargo by car and waybill, then the car id is formatted using standard equipment formatting rules to ensure consistent search keys.
  • Context - a formatted car id and waybill number are available:
    For Set Car ID and Waybill in Search Key:
    When the system prepares to search for cargo records, then the search key is populated with the car id and waybill number to enable precise cargo matching.
  • Context - a search key with car id and waybill is constructed:
    For Call GCCUSIO with Car/Waybill Index:
    When the system executes cargo search operation, then the cargo database is queried using the car/waybill index to locate matching records.
  • Context - a cargo search operation has been executed:
    For Cargo Found?:
    When the system evaluates the search results, then the system determines if cargo records were found and sets appropriate processing flags.
  • Context - cargo records exist for the car and waybill combination:
    For Retrieve Cargo Record:
    When the system processes the found cargo, then complete cargo record data is retrieved including status, quantities, and identification information.
  • Context - a cargo record has been retrieved:
    For Validate Cargo Status:
    When the system evaluates cargo eligibility, then the cargo status is validated to ensure it is not deleted and is eligible for customs processing.
  • Context - valid cargo exists and disposition codes are available from x4 segment:
    For Process Disposition Codes:
    When the system processes customs disposition codes, then disposition codes are evaluated and appropriate cargo status changes are determined based on customs requirements.
  • Context - disposition codes have been processed:
    For Update Cargo Status Array:
    When the system updates cargo status information, then the cargo status array is updated with new status codes, removing counterpart codes as needed and maintaining status history.
  • Context - disposition codes specify quantity actions:
    For Calculate Release Quantities:
    When the system processes quantity changes, then release quantities are calculated by adding or subtracting specified amounts while ensuring quantities do not become negative.
  • Context - cargo processing is underway for a specific waybill:
    For Multiple Cars with Same Waybill?:
    When the system evaluates waybill scope, then the system determines if multiple cars are associated with the same waybill and require coordinated release processing.
  • Context - multiple cars share the same waybill number:
    For Process All Related Cars:
    When the system processes waybill-level operations, then all cars associated with the waybill are processed to ensure consistent cargo status and release coordination.
  • Context - cargo status and quantities have been updated:
    For Verify Release Eligibility:
    When the system evaluates release eligibility, then the system verifies that cargo meets all customs requirements, quantity thresholds, and status conditions for release.
  • Context - cargo is eligible for release:
    For Generate Release Messages:
    When the system processes release notifications, then release messages are generated with cargo details, quantities, and routing information for broker and system notifications.
  • Context - cargo processing is complete with new status and quantity information:
    For Update Cargo Records:
    When the system finalizes cargo updates, then cargo records are updated in the database with new status, quantities, and processing timestamps.
  • Context - no cargo was found using car id and waybill combination:
    For Try Car ID Only Search:
    When the system performs alternative search strategy, then a broader search is performed using only the car id to locate any cargo associated with the equipment.
  • Context - no cargo records exist for the car and waybill combination:
    For Log Cargo Not Found Error:
    When the system handles cargo not found condition, then an error is logged with disposition code and search criteria details for tracking and resolution.
  • Context - cargo is not found and error has been logged:
    For Create Foreign Bill Record:
    When the system handles missing cargo scenario, then a foreign bill record is created to track the cargo information for future reference and processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing request is initiated
GIVEN
A cargo processing request is initiated
Applied to: X4 Segment Available?
WHEN
The system checks for X4 segment availability
THEN
Processing continues if X4 segment is available, otherwise error handling is triggered
Context: X4 segment is available with car information
GIVEN
X4 segment is available with car information
Applied to: Extract Car ID from X4-01
WHEN
The system processes the X4-01 field
THEN
Car ID is extracted and stored for further processing
Context: X4 segment contains waybill information in X4-02 field
GIVEN
X4 segment contains waybill information in X4-02 field
Applied to: Extract Waybill from X4-02
WHEN
The system processes the waybill data
THEN
Waybill number is extracted and prepared for cargo lookup
Context: Raw car ID has been extracted from X4 segment
GIVEN
Raw car ID has been extracted from X4 segment
Applied to: Format Car ID using GCCCARFM
WHEN
The system calls GCCCARFM formatting module
THEN
Car ID is formatted according to standard business rules and validation is performed
Context: Car ID has been formatted using GCCCARFM
GIVEN
Car ID has been formatted using GCCCARFM
Applied to: Car ID Valid?
WHEN
The system validates the car ID format and content
THEN
Processing continues if car ID is valid, otherwise error handling is initiated
Context: Valid car ID and waybill number are available
GIVEN
Valid car ID and waybill number are available
Applied to: Build Car/Waybill Key
WHEN
The system builds the composite search key
THEN
Car/waybill key is constructed for database lookup operations
Context: Car/waybill key has been constructed
GIVEN
Car/waybill key has been constructed
Applied to: Search Cargo by Car/Waybill Index
WHEN
The system searches the cargo database using car/waybill index
THEN
Cargo records matching the key are identified or search returns no results
Context: Car/waybill index search has been completed
GIVEN
Car/waybill index search has been completed
Applied to: Cargo Found?
WHEN
The system evaluates search results
THEN
If cargo is found, proceed to retrieve records; if not found, initiate fallback search by car ID only
Context: Cargo has been found using car/waybill search
GIVEN
Cargo has been found using car/waybill search
Applied to: Retrieve Cargo Record
WHEN
The system retrieves the cargo record
THEN
Complete cargo record is loaded for status validation and processing
Context: Cargo record has been retrieved from the database
GIVEN
Cargo record has been retrieved from the database
Applied to: Validate Cargo Status
WHEN
The system validates the cargo status
THEN
Cargo status is checked for validity and processing eligibility
Context: Cargo status has been validated
GIVEN
Cargo status has been validated
Applied to: Cargo Valid?
WHEN
The system assesses overall cargo validity
THEN
If cargo is valid, proceed to disposition code processing; if invalid, trigger error handling
Applied to: Valid Cargo?
WHEN
The system evaluates processing eligibility
THEN
The system determines if cargo can proceed with disposition code processing or requires error handling
Context: Valid cargo record is available for processing
GIVEN
Valid cargo record is available for processing
Applied to: Process Disposition Codes
WHEN
The system processes disposition codes from X4 segment
THEN
Disposition codes are evaluated and appropriate cargo status changes are determined
Context: Disposition codes have been processed and status changes determined
GIVEN
Disposition codes have been processed and status changes determined
Applied to: Update Cargo Status
WHEN
The system updates the cargo record
THEN
Cargo status is updated in the database and processing is marked complete
Context: Car/waybill search did not find any cargo records
GIVEN
Car/waybill search did not find any cargo records
Applied to: Try Car ID Only Search
WHEN
The system performs car ID only search using car ID index
THEN
Cargo records matching the car ID are identified regardless of waybill
Context: Car ID only search has been completed
GIVEN
Car ID only search has been completed
Applied to: Cargo Found by Car ID?
WHEN
The system evaluates fallback search results
THEN
If cargo is found, proceed to waybill matching; if not found, generate cargo not found error
Context: Cargo records have been found using car ID only search
GIVEN
Cargo records have been found using car ID only search
Applied to: Check Multiple Waybills
WHEN
The system analyzes waybill information in found records
THEN
Waybill matching is performed to identify the correct cargo record
Context: Multiple cargo records exist for the car ID
GIVEN
Multiple cargo records exist for the car ID
Applied to: Single Waybill Match?
WHEN
The system checks for waybill matches
THEN
If exactly one waybill matches, select that cargo; if multiple or no matches, generate error
Context: Exactly one cargo record matches the waybill criteria
GIVEN
Exactly one cargo record matches the waybill criteria
Applied to: Select Matching Cargo
WHEN
The system selects the matching cargo record
THEN
The correct cargo record is identified for processing
Context: Cargo was successfully found using car ID only search
GIVEN
Cargo was successfully found using car ID only search
Applied to: Log Car ID Search Used
WHEN
The system logs the search method used
THEN
Car ID search usage is recorded for audit and monitoring purposes
Context: Both car/waybill and car ID only searches failed to find valid cargo
GIVEN
Both car/waybill and car ID only searches failed to find valid cargo
Applied to: Generate Cargo Not Found Error
WHEN
The system generates cargo not found error
THEN
Error message is created 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: Create Foreign Bill Record
WHEN
The system creates a foreign bill record
THEN
New foreign bill record is created to handle the unmatched cargo information
Context: A car ID exists in the N7 segment data
GIVEN
A car ID exists in the N7 segment data
Applied to: Format Equipment ID using GCCCARFM
WHEN
The system needs to search for cargo by car and waybill
THEN
The car ID is formatted using standard equipment formatting rules to ensure consistent search keys
Context: A formatted car ID and waybill number are available
GIVEN
A formatted car ID and waybill number are available
Applied to: Set Car ID and Waybill in Search Key
WHEN
The system prepares to search for cargo records
THEN
The search key is populated with the car ID and waybill number to enable precise cargo matching
Context: A search key with car ID and waybill is constructed
GIVEN
A search key with car ID and waybill is constructed
Applied to: Call GCCUSIO with Car/Waybill Index
WHEN
The system executes cargo search operation
THEN
The cargo database is queried using the car/waybill index to locate matching records
Context: A cargo search operation has been executed
GIVEN
A cargo search operation has been executed
Applied to: Cargo Found?
WHEN
The system evaluates the search results
THEN
The system determines if cargo records were found and sets appropriate processing flags
Context: Cargo records exist for the car and waybill combination
GIVEN
Cargo records exist for the car and waybill combination
Applied to: Retrieve Cargo Record
WHEN
The system processes the found cargo
THEN
Complete cargo record data is retrieved including status, quantities, and identification information
Context: A cargo record has been retrieved
GIVEN
A cargo record has been retrieved
Applied to: Validate Cargo Status
WHEN
The system evaluates cargo eligibility
THEN
The cargo status is validated to ensure it is not deleted and is eligible for customs processing
Context: Valid cargo exists and disposition codes are available from X4 segment
GIVEN
Valid cargo exists and disposition codes are available from X4 segment
Applied to: Process Disposition Codes
WHEN
The system processes customs disposition codes
THEN
Disposition codes are evaluated and appropriate cargo status changes are determined based on customs requirements
Context: Disposition codes have been processed
GIVEN
Disposition codes have been processed
Applied to: Update Cargo Status Array
WHEN
The system updates cargo status information
THEN
The cargo status array is updated with new status codes, removing counterpart codes as needed and maintaining status history
Context: Disposition codes specify quantity actions
GIVEN
Disposition codes specify quantity actions
Applied to: Calculate Release Quantities
WHEN
The system processes quantity changes
THEN
Release quantities are calculated by adding or subtracting specified amounts while ensuring quantities do not become negative
Context: Cargo processing is underway for a specific waybill
GIVEN
Cargo processing is underway for a specific waybill
Applied to: Multiple Cars with Same Waybill?
WHEN
The system evaluates waybill scope
THEN
The system determines if multiple cars are associated with the same waybill and require coordinated release processing
Context: Multiple cars share the same waybill number
GIVEN
Multiple cars share the same waybill number
Applied to: Process All Related Cars
WHEN
The system processes waybill-level operations
THEN
All cars associated with the waybill are processed to ensure consistent cargo status and release coordination
Context: Cargo status and quantities have been updated
GIVEN
Cargo status and quantities have been updated
Applied to: Verify Release Eligibility
WHEN
The system evaluates release eligibility
THEN
The system verifies that cargo meets all customs requirements, quantity thresholds, and status conditions for release
Context: Cargo is eligible for release
GIVEN
Cargo is eligible for release
Applied to: Generate Release Messages
WHEN
The system processes release notifications
THEN
Release messages are generated with cargo details, quantities, and routing information for broker and system notifications
Context: Cargo processing is complete with new status and quantity information
GIVEN
Cargo processing is complete with new status and quantity information
Applied to: Update Cargo Records
WHEN
The system finalizes cargo updates
THEN
Cargo records are updated in the database with new status, quantities, and processing timestamps
Context: No cargo was found using car ID and waybill combination
GIVEN
No cargo was found using car ID and waybill combination
Applied to: Try Car ID Only Search
WHEN
The system performs alternative search strategy
THEN
A broader search is performed using only the car ID to locate any cargo associated with the equipment
Context: No cargo records exist for the car and waybill combination
GIVEN
No cargo records exist for the car and waybill combination
Applied to: Log Cargo Not Found Error
WHEN
The system handles cargo not found condition
THEN
An error is logged with disposition code and search criteria details for tracking and resolution
Context: Cargo is not found and error has been logged
GIVEN
Cargo is not found and error has been logged
Applied to: Create Foreign Bill Record
WHEN
The system handles missing cargo scenario
THEN
A foreign bill record is created to track the cargo information for future reference and processing
R-GCX016-cbl-04051 (+11) File: GCX016.cbl Disposition Code Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Disposition Code Processing':
  • Context - a disposition code is provided from the x4 segment:
    For Retrieve Disposition Code from DC Table:
    When the system looks up the disposition code in the dc table, then the disposition code details are retrieved including merlin messages and processing flags.
  • Context - a disposition code lookup has been performed:
    For Disposition Code Found?:
    When the disposition code is not found in the dc table, then an error message is generated indicating the code is not found.
  • Context - a disposition code with arl (auto release) type is being processed:
    For ARL - Auto Release Processing:
    When the disposition code action is arl, then the system generates an auto release message and sets appropriate release flags.
  • Context - a disposition code with mrl (manual release) type is being processed for cprs cargo:
    For MRL - Manual Release for CPRS:
    When the disposition code action is mrl, then the system processes the manual release request and clears destination index.
  • Context - a disposition code with removal type is being processed:
    For Process Removal Codes:
    When the disposition code action is dc removal, then the system removes the specified disposition code from the cargo status array.
  • Context - a disposition code with hold type is being processed:
    For Process Hold Codes with Location:
    When the disposition code action is dc hold, then the system adds the hold code to status array and sets location information from the message.
  • Context - a disposition code with release type is being processed:
    For Process Release Codes with Released Flag:
    When the disposition code action is dc release, then the system adds the release code to status array, sets released flag, and updates release quantities.
  • Context - a disposition code with information type is being processed:
    For Process Status Information Codes:
    When the disposition code action is dc status info, then the system adds the informational code to status array without changing cargo release status.
  • Context - a disposition code is being added to the cargo status array:
    For Check for Duplicates in Status Array:
    When the same disposition code already exists in the status array, then the system skips adding the duplicate code and continues processing.
  • Context - a new disposition code needs to be added to the status array:
    For Check Array Capacity:
    When the status array is at maximum capacity, then the system generates an array overflow error and stops processing.
  • Context - a hold or release disposition code is being added to the status array:
    For Process Counterpart Code Removal:
    When counterpart disposition codes exist in the status array, then the system removes the counterpart codes before adding the new disposition code.
  • Context - a release disposition code is being processed with quantity information:
    For Update Cargo Release Quantities:
    When the disposition code affects release quantities, then the system adds or subtracts the specified quantity from cargo release quantities with minimum value of zero.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is provided from the X4 segment
GIVEN
A disposition code is provided from the X4 segment
Applied to: Retrieve Disposition Code from DC Table
WHEN
The system looks up the disposition code in the DC table
THEN
The disposition code details are retrieved including Merlin messages and processing flags
Context: A disposition code lookup has been performed
GIVEN
A disposition code lookup has been performed
Applied to: Disposition Code Found?
WHEN
The disposition code is not found in the DC table
THEN
An error message is generated indicating the code is not found
Context: A disposition code with ARL (Auto Release) type is being processed
GIVEN
A disposition code with ARL (Auto Release) type is being processed
Applied to: ARL - Auto Release Processing
WHEN
The disposition code action is ARL
THEN
The system generates an auto release message and sets appropriate release flags
Context: A disposition code with MRL (Manual Release) type is being processed for CPRS cargo
GIVEN
A disposition code with MRL (Manual Release) type is being processed for CPRS cargo
Applied to: MRL - Manual Release for CPRS
WHEN
The disposition code action is MRL
THEN
The system processes the manual release request and clears destination index
Context: A disposition code with removal type is being processed
GIVEN
A disposition code with removal type is being processed
Applied to: Process Removal Codes
WHEN
The disposition code action is DC removal
THEN
The system removes the specified disposition code from the cargo status array
Context: A disposition code with hold type is being processed
GIVEN
A disposition code with hold type is being processed
Applied to: Process Hold Codes with Location
WHEN
The disposition code action is DC hold
THEN
The system adds the hold code to status array and sets location information from the message
Context: A disposition code with release type is being processed
GIVEN
A disposition code with release type is being processed
Applied to: Process Release Codes with Released Flag
WHEN
The disposition code action is DC release
THEN
The system adds the release code to status array, sets released flag, and updates release quantities
Context: A disposition code with information type is being processed
GIVEN
A disposition code with information type is being processed
Applied to: Process Status Information Codes
WHEN
The disposition code action is DC status info
THEN
The system adds the informational code to status array without changing cargo release status
Context: A disposition code is being added to the cargo status array
GIVEN
A disposition code is being added to the cargo status array
Applied to: Check for Duplicates in Status Array
WHEN
The same disposition code already exists in the status array
THEN
The system skips adding the duplicate code and continues processing
Context: A new disposition code needs to be added to the status array
GIVEN
A new disposition code needs to be added to the status array
Applied to: Check Array Capacity
WHEN
The status array is at maximum capacity
THEN
The system generates an array overflow error and stops processing
Context: A hold or release disposition code is being added to the status array
GIVEN
A hold or release disposition code is being added to the status array
Applied to: Process Counterpart Code Removal
WHEN
Counterpart disposition codes exist in the status array
THEN
The system removes the counterpart codes before adding the new disposition code
Context: A release disposition code is being processed with quantity information
GIVEN
A release disposition code is being processed with quantity information
Applied to: Update Cargo Release Quantities
WHEN
The disposition code affects release quantities
THEN
The system adds or subtracts the specified quantity from cargo release quantities with minimum value of zero
R-GCX016-cbl-04063 (+19) File: GCX016.cbl Status Array Management Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Management':
  • Context - a cargo record exists in the system:
    For Fetch S09 Segments from Database:
    When the system needs to manage cargo status information, then the system fetches all existing s09 status segments associated with the cargo ccn key.
    For Retrieve S09 Segments from Database:
    When the cargo has existing status segments in the database, then the system retrieves all s09 status segments associated with the cargo record.
    For Create New Empty Status Array:
    When the cargo has no existing status segments in the database, then the system creates a new empty s09a status array structure with initialized counters.
  • Context - a cargo record has no existing s09 status segments:
    For Create Empty S09A Status Array:
    When the system attempts to fetch cargo status information, then the system creates a new empty s09a status array structure.
  • Context - s09 status segments exist for a cargo record:
    For Populate S09A Array from S09 Segments:
    When the system retrieves the segments from the database, then the system populates the s09a status array with all status entries from the retrieved segments.
  • Context - a new cargo record is being processed without existing status segments:
    For Initialize Array with Default Values:
    When the system creates an empty status array, then the system initializes the array with default status values and proper sequence numbering.
  • Context - a disposition code needs to be added to cargo status and the status array has available capacity:
    For Add New Disposition Code to Array:
    When the system processes a new disposition code from x4 segment, then the system adds the disposition code with appropriate status flags, location information, and quantity details to the next available position in the status array.
  • Context - a new disposition code has counterpart codes that must be removed and counterpart codes exist in the status array:
    For Remove Counterpart Codes from Array:
    When the system adds a new disposition code that conflicts with existing codes, then the system removes all counterpart disposition codes from the status array before adding the new code.
  • Context - disposition codes are being processed in the status array:
    For Update Status Flags in Array Elements:
    When the system evaluates disposition code types and processing requirements, then the system sets appropriate status flags including hold indicators, release indicators, location flags, and quantity impact flags for each array element.
  • Context - disposition codes have been removed from the status array creating gaps:
    For Compact Array After Removals:
    When the system completes code removal operations, then the system compacts the array by moving remaining entries to eliminate empty positions and maintains proper sequence numbering.
  • Context - the status array is at maximum capacity and a new disposition code needs to be added:
    For Prevent Array Overflow:
    When the system attempts to add another status entry, then the system prevents the addition and maintains array integrity without exceeding capacity limits.
  • Context - status array processing is complete and modifications have been made to the array:
    For Move S09A Array Data to S09 Segments:
    When the system needs to persist status changes, then the system transfers all status entries from the s09a array back to properly formatted s09 database segments with correct sequence numbering.
  • Context - s09 segments have been updated with new status information:
    For Replace S09 Segments in Database:
    When the system completes status array processing, then the system replaces the existing s09 segments in the database with the updated segment data.
  • Context - status segments have been successfully updated in the database:
    For Update Cargo Record with New Status:
    When the system completes status array management, then the system updates the cargo record with the current status description and any related status indicators.
  • Context - s09 status segments exist in the database for a cargo record:
    For Populate Array from S09 Segments:
    When the system needs to process status information, then the system copies all status codes, disposition codes, entry numbers, quantities, locations, and release flags from s09 segments into the s09a working array.
  • Context - a status array exists and has available space:
    For Add Status Code to Array:
    When a new status code needs to be added to the array, then the system adds the status code along with disposition code, entry number, quantity information, location details, and release flag to the next available array position.
  • Context - a status array is being populated with status codes:
    For Prevent Array Overflow:
    When the array reaches its maximum capacity limit, then the system prevents additional entries from being added to avoid array overflow.
  • Context - a status array has been processed and updated:
    For Move Array Back to S09 Segments:
    When the processing is complete and changes need to be persisted, then the system moves all status information from the s09a array back to s09 database segments, distributing entries across multiple sequences as needed.
  • Context - status segments have been updated in memory:
    For Replace Database Records:
    When changes need to be committed to the database, then the system replaces the existing s09 status segments in the database with the updated information.
  • Context - status segments exist for a cargo record and n7 equipment data is available:
    For Update Array Elements:
    When car id information needs to be updated in the status segments, then for cprs cargo records, the system clears the car id, and for other cargo types, the system updates the car initial and number from n7 segment data if available.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Fetch S09 Segments from Database
WHEN
The system needs to manage cargo status information
THEN
The system fetches all existing S09 status segments associated with the cargo CCN key
Applied to: Retrieve S09 Segments from Database
WHEN
The cargo has existing status segments in the database
THEN
The system retrieves all S09 status segments associated with the cargo record
Applied to: Create New Empty Status Array
WHEN
The cargo has no existing status segments in the database
THEN
The system creates a new empty S09A status array structure with initialized counters
Context: A cargo record has no existing S09 status segments
GIVEN
A cargo record has no existing S09 status segments
Applied to: Create Empty S09A Status Array
WHEN
The system attempts to fetch cargo status information
THEN
The system creates a new empty S09A status array structure
Context: S09 status segments exist for a cargo record
GIVEN
S09 status segments exist for a cargo record
Applied to: Populate S09A Array from S09 Segments
WHEN
The system retrieves the segments from the database
THEN
The system populates the S09A status array with all status entries from the retrieved segments
Context: A new cargo record is being processed without existing status segments
GIVEN
A new cargo record is being processed without existing status segments
Applied to: Initialize Array with Default Values
WHEN
The system creates an empty status array
THEN
The system initializes the array with default status values and proper sequence numbering
Context: A disposition code needs to be added to cargo status AND the status array has available capacity
GIVEN
A disposition code needs to be added to cargo status AND the status array has available capacity
Applied to: Add New Disposition Code to Array
WHEN
The system processes a new disposition code from X4 segment
THEN
The system adds the disposition code with appropriate status flags, location information, and quantity details to the next available position in the status array
Context: A new disposition code has counterpart codes that must be removed AND counterpart codes exist in the status array
GIVEN
A new disposition code has counterpart codes that must be removed AND counterpart codes exist in the status array
Applied to: Remove Counterpart Codes from Array
WHEN
The system adds a new disposition code that conflicts with existing codes
THEN
The system removes all counterpart disposition codes from the status array before adding the new code
Context: Disposition codes are being processed in the status array
GIVEN
Disposition codes are being processed in the status array
Applied to: Update Status Flags in Array Elements
WHEN
The system evaluates disposition code types and processing requirements
THEN
The system sets appropriate status flags including hold indicators, release indicators, location flags, and quantity impact flags for each array element
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: Compact Array After Removals
WHEN
The system completes code removal operations
THEN
The system compacts the array by moving remaining entries to eliminate empty positions and maintains proper sequence numbering
Context: The status array is at maximum capacity AND a new disposition code needs to be added
GIVEN
The status array is at maximum capacity AND a new disposition code needs to be added
Applied to: Prevent Array Overflow
WHEN
The system attempts to add another status entry
THEN
The system prevents the addition and maintains array integrity without exceeding capacity limits
Context: Status array processing is complete AND modifications have been made to the array
GIVEN
Status array processing is complete AND modifications have been made to the array
Applied to: Move S09A Array Data to S09 Segments
WHEN
The system needs to persist status changes
THEN
The system transfers all status entries from the S09A array back to properly formatted S09 database segments with correct sequence numbering
Context: S09 segments have been updated with new status information
GIVEN
S09 segments have been updated with new status information
Applied to: Replace S09 Segments in Database
WHEN
The system completes status array processing
THEN
The system replaces the existing S09 segments in the database with the updated segment data
Context: Status segments have been successfully updated in the database
GIVEN
Status segments have been successfully updated in the database
Applied to: Update Cargo Record with New Status
WHEN
The system completes status array management
THEN
The system updates the cargo record with the current status description and any related status indicators
Context: S09 status segments exist in the database for a cargo record
GIVEN
S09 status segments exist in the database for a cargo record
Applied to: Populate Array from S09 Segments
WHEN
The system needs to process status information
THEN
The system copies all status codes, disposition codes, entry numbers, quantities, locations, and release flags from S09 segments into the S09A working array
Context: A status array exists and has available space
GIVEN
A status array exists and has available space
Applied to: Add Status Code to Array
WHEN
A new status code needs to be added to the array
THEN
The system adds the status code along with disposition code, entry number, quantity information, location details, and release flag to the next available array position
Context: A status array is being populated with status codes
GIVEN
A status array is being populated with status codes
Applied to: Prevent Array Overflow
WHEN
The array reaches its maximum capacity limit
THEN
The system prevents additional entries from being added to avoid array overflow
Context: A status array has been processed and updated
GIVEN
A status array has been processed and updated
Applied to: Move Array Back to S09 Segments
WHEN
The processing is complete and changes need to be persisted
THEN
The system moves all status information from the S09A array back to S09 database segments, distributing entries across multiple sequences as needed
Context: Status segments have been updated in memory
GIVEN
Status segments have been updated in memory
Applied to: Replace Database Records
WHEN
Changes need to be committed to the database
THEN
The system replaces the existing S09 status segments in the database with the updated information
Context: Status segments exist for a cargo record and N7 equipment data is available
GIVEN
Status segments exist for a cargo record and N7 equipment data is available
Applied to: Update Array Elements
WHEN
Car ID information needs to be updated in the status segments
THEN
For CPRS cargo records, the system clears the car ID, and for other cargo types, the system updates the car initial and number from N7 segment data if available
R-GCX016-cbl-04075 (+4) File: GCX016.cbl DC Table Lookup Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'DC Table Lookup':
  • Context - a disposition code is received from x4 segment:
    For Call GCCTBIO to Access DC Table:
    When the system performs a table lookup using gcctbio to access the dc table, then the system retrieves the disposition code record from gcstbrt dc table segments.
  • Context - a disposition code lookup has been performed against the dc table:
    For DC Table Record Found?:
    When the system checks if a matching record was found in the table, then the system sets success status if record found or error status if record not found.
    For Set Error Status - Code Not Found:
    When no matching record is found for the disposition code, then the system sets error status, logs the disposition code error, and returns error status to the calling process.
  • Context - a valid disposition code record has been found in the dc table:
    For Extract Disposition Code Information:
    When the system processes the found record, then the system extracts disposition code information, counterpart code information, processing instructions, quantity action indicators, and location processing flags.
  • Context - disposition code information has been successfully extracted from the dc table:
    For Store DC Information in Working Storage:
    When the system processes the extracted information, then the system stores all dc information in working storage and returns success status.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received from X4 segment
GIVEN
A disposition code is received from X4 segment
Applied to: Call GCCTBIO to Access DC Table
WHEN
The system performs a table lookup using GCCTBIO to access the DC table
THEN
The system retrieves the disposition code record from GCSTBRT DC table segments
Context: A disposition code lookup has been performed against the DC table
GIVEN
A disposition code lookup has been performed against the DC table
Applied to: DC Table Record Found?
WHEN
The system checks if a matching record was found in the table
THEN
The system sets success status if record found or error status if record not found
Applied to: Set Error Status - Code Not Found
WHEN
No matching record is found for the disposition code
THEN
The system sets error status, logs the disposition code error, and returns error status to the calling process
Context: A valid disposition code record has been found in the DC table
GIVEN
A valid disposition code record has been found in the DC table
Applied to: Extract Disposition Code Information
WHEN
The system processes the found record
THEN
The system extracts disposition code information, counterpart code information, processing instructions, quantity action indicators, and location processing flags
Context: Disposition code information has been successfully extracted from the DC table
GIVEN
Disposition code information has been successfully extracted from the DC table
Applied to: Store DC Information in Working Storage
WHEN
The system processes the extracted information
THEN
The system stores all DC information in working storage and returns success status
R-GCX016-cbl-04080 (+15) File: GCX016.cbl Counterpart Code Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Counterpart Code Processing':
  • Context - a disposition code exists in the current processing context:
    For Get Counterpart Code from DC Table:
    When the system needs to identify counterpart codes for removal, then the counterpart disposition code is retrieved from the dc table lookup.
  • Context - a counterpart code lookup has been performed from the dc table:
    For Counterpart Code Exists?:
    When the system evaluates whether counterpart processing is required, then if counterpart code exists, proceed with array search; otherwise skip counterpart processing.
  • Context - a valid counterpart code exists and status array contains disposition codes:
    For Search Status Array for Matching Codes:
    When the system searches for matching counterpart codes in the array, then each array element is evaluated against the counterpart code criteria.
  • Context - an array element is being evaluated against counterpart code criteria:
    For Match Found?:
    When the system compares the array element disposition code with the counterpart code, then if codes match, proceed with detailed matching criteria validation; otherwise continue to next element.
  • Context - a disposition code in the array matches the counterpart code:
    For Check Matching Criteria:
    When the system evaluates additional matching criteria including status info, entry number, quantity, and specific code patterns, then multiple validation checks are performed to confirm the code should be removed.
  • Context - a counterpart code match has been found in the status array:
    For Status Info Match?:
    When the system validates status information compatibility, then if status info matches, remove the counterpart code; otherwise check entry number match.
  • Context - status info match validation has been performed and counterpart code exists in array:
    For Entry Number Match?:
    When the system compares entry number values, then if entry numbers match, remove the counterpart code; otherwise check quantity match.
  • Context - entry number match validation has been performed and counterpart code exists in array:
    For Quantity Match?:
    When the system compares quantity values, then if quantities match, remove the counterpart code; otherwise check specific code pattern match.
  • Context - quantity match validation has been performed and counterpart code exists in array:
    For Specific Code Pattern Match?:
    When the system evaluates specific code pattern matching criteria, then if specific patterns match, remove the counterpart code; otherwise continue to next array element.
  • Context - a counterpart code has been validated for removal based on matching criteria:
    For Remove Counterpart Code from Array:
    When the system performs the removal operation, then the counterpart code is marked for removal from the status array.
  • Context - one or more counterpart codes have been removed from the status array:
    For Compact Remaining Array Elements:
    When the system compacts the array structure, then remaining array elements are shifted to eliminate empty positions.
  • Context - the status array has been compacted after counterpart code removal:
    For Update Array Element Count:
    When the system updates array metadata, then the array element count is decremented to reflect the removed counterpart codes.
  • Context - current array element processing is complete (either removed or skipped):
    For Continue to Next Array Element:
    When the system continues array traversal, then processing moves to the next available array element.
  • Context - current array element has been processed:
    For More Elements to Check?:
    When the system checks for remaining elements to evaluate, then if more elements exist, continue searching; otherwise complete counterpart processing.
  • Context - all status array elements have been evaluated for counterpart code removal:
    For Counterpart Processing Complete:
    When the counterpart processing cycle is complete, then processing control returns to the main disposition code handling logic.
  • Context - no counterpart disposition code exists in the dc table lookup:
    For No Counterpart Action Required:
    When the system evaluates counterpart processing requirements, then counterpart processing is skipped and control returns to main processing.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code exists in the current processing context
GIVEN
A disposition code exists in the current processing context
Applied to: Get Counterpart Code from DC Table
WHEN
The system needs to identify counterpart codes for removal
THEN
The counterpart disposition code is retrieved from the DC table lookup
Context: A counterpart code lookup has been performed from the DC table
GIVEN
A counterpart code lookup has been performed from the DC table
Applied to: Counterpart Code Exists?
WHEN
The system evaluates whether counterpart processing is required
THEN
If counterpart code exists, proceed with array search; otherwise skip counterpart processing
Context: A valid counterpart code exists and status array contains disposition codes
GIVEN
A valid counterpart code exists and status array contains disposition codes
Applied to: Search Status Array for Matching Codes
WHEN
The system searches for matching counterpart codes in the array
THEN
Each array element is evaluated against the counterpart code criteria
Context: An array element is being evaluated against counterpart code criteria
GIVEN
An array element is being evaluated against counterpart code criteria
Applied to: Match Found?
WHEN
The system compares the array element disposition code with the counterpart code
THEN
If codes match, proceed with detailed matching criteria validation; otherwise continue to next element
Context: A disposition code in the array matches the counterpart code
GIVEN
A disposition code in the array matches the counterpart code
Applied to: Check Matching Criteria
WHEN
The system evaluates additional matching criteria including status info, entry number, quantity, and specific code patterns
THEN
Multiple validation checks are performed to confirm the code should be removed
Context: A counterpart code match has been found in the status array
GIVEN
A counterpart code match has been found in the status array
Applied to: Status Info Match?
WHEN
The system validates status information compatibility
THEN
If status info matches, remove the counterpart code; otherwise check entry number match
Context: Status info match validation has been performed and counterpart code exists in array
GIVEN
Status info match validation has been performed and counterpart code exists in array
Applied to: Entry Number Match?
WHEN
The system compares entry number values
THEN
If entry numbers match, remove the counterpart code; otherwise check quantity match
Context: Entry number match validation has been performed and counterpart code exists in array
GIVEN
Entry number match validation has been performed and counterpart code exists in array
Applied to: Quantity Match?
WHEN
The system compares quantity values
THEN
If quantities match, remove the counterpart code; otherwise check specific code pattern match
Context: Quantity match validation has been performed and counterpart code exists in array
GIVEN
Quantity match validation has been performed and counterpart code exists in array
Applied to: Specific Code Pattern Match?
WHEN
The system evaluates specific code pattern matching criteria
THEN
If specific patterns match, remove the counterpart code; otherwise continue to next array element
Context: A counterpart code has been validated for removal based on matching criteria
GIVEN
A counterpart code has been validated for removal based on matching criteria
Applied to: Remove Counterpart Code from Array
WHEN
The system performs the removal operation
THEN
The counterpart code is marked for removal from the status array
Context: One or more counterpart codes have been removed from the status array
GIVEN
One or more counterpart codes have been removed from the status array
Applied to: Compact Remaining Array Elements
WHEN
The system compacts the array structure
THEN
Remaining array elements are shifted to eliminate empty positions
Context: The status array has been compacted after counterpart code removal
GIVEN
The status array has been compacted after counterpart code removal
Applied to: Update Array Element Count
WHEN
The system updates array metadata
THEN
The array element count is decremented to reflect the removed counterpart codes
Context: Current array element processing is complete (either removed or skipped)
GIVEN
Current array element processing is complete (either removed or skipped)
Applied to: Continue to Next Array Element
WHEN
The system continues array traversal
THEN
Processing moves to the next available array element
Context: Current array element has been processed
GIVEN
Current array element has been processed
Applied to: More Elements to Check?
WHEN
The system checks for remaining elements to evaluate
THEN
If more elements exist, continue searching; otherwise complete counterpart processing
Context: All status array elements have been evaluated for counterpart code removal
GIVEN
All status array elements have been evaluated for counterpart code removal
Applied to: Counterpart Processing Complete
WHEN
The counterpart processing cycle is complete
THEN
Processing control returns to the main disposition code handling logic
Context: No counterpart disposition code exists in the DC table lookup
GIVEN
No counterpart disposition code exists in the DC table lookup
Applied to: No Counterpart Action Required
WHEN
The system evaluates counterpart processing requirements
THEN
Counterpart processing is skipped and control returns to main processing
R-GCX016-cbl-04096 (+71) File: GCX016.cbl Status Array Analysis Merged 72 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Array Analysis':
  • Context - a cargo record requires status analysis:
    For Initialize Cargo State Flags & Initialize Status Flags:
    When the status array analysis process begins, then all cargo state flags (empty, held, released, ptt, proceed, arrival, export, fda hold) are set to false/off and all quantity counters are reset to zero and all status flags (hold, release, ptt, proceed, arrival, export, fda hold) are set to false and quantity counters are reset to zero.
  • Context - the s09a status array contains cargo disposition codes:
    For Scan S09A Status Array Elements:
    When status analysis is performed, then each array element is examined sequentially until all elements are processed.
  • Context - a disposition code from the s09a array is being examined:
    For Hold Code? & Release Code? & PTT Code? & Proceed Code? & Arrival Code? & Export Code? & FDA Hold Code?:
    When the disposition code type is evaluated, then if the code is classified as a hold type in the disposition code table, the hold status flag is set to true and if the code is classified as a release type in the disposition code table, the release status flag is set to true and if the code is classified as a ptt type in the disposition code table, the ptt status flag is set to true and if the code is classified as a proceed type in the disposition code table, the proceed status flag is set to true and if the code is classified as an arrival type in the disposition code table, the arrival status flag is set to true and if the code is classified as an export type in the disposition code table, the export status flag is set to true and if the code is classified as an fda hold type in the disposition code table, the fda hold status flag is set to true.
  • Context - a disposition code has been identified as a hold type:
    For Border or Destination Hold?:
    When the hold location is determined, then if the hold applies at the border, set border hold flag to true, otherwise if the hold applies at destination, set destination hold flag to true.
  • Context - a disposition code has been identified as a release type:
    For Calculate Release Quantities:
    When release quantities are calculated, then the quantity associated with the release code is added to the total release quantity counter.
  • Context - all disposition codes in the s09a array have been analyzed and status flags have been set:
    For Determine Final Cargo Status:
    When final cargo status determination is performed, then the system evaluates status flags in priority order: border hold, destination hold, released, ptt active, proceed, arrived, exported to set the final cargo status.
  • Context - status analysis has been completed and border hold flag is true:
    For Set Final Status: Hold at Border:
    When final status determination is performed, then the cargo final status is set to 'hold at border' indicating cargo cannot proceed past the border.
  • Context - status analysis has been completed and destination hold flag is true and border hold flag is false:
    For Set Final Status: Hold at Destination:
    When final status determination is performed, then the cargo final status is set to 'hold at destination' indicating cargo is held at the destination location.
  • Context - status analysis has been completed and release flag is true and no hold flags are true:
    For Set Final Status: Released:
    When final status determination is performed, then the cargo final status is set to 'released' indicating cargo is cleared for movement.
  • Context - status analysis has been completed and ptt flag is true and no hold or release flags are true:
    For Set Final Status: PTT Active:
    When final status determination is performed, then the cargo final status is set to 'ptt active' indicating permit to transfer is in effect.
  • Context - status analysis has been completed and proceed flag is true and no hold, release, or ptt flags are true:
    For Set Final Status: Proceed:
    When final status determination is performed, then the cargo final status is set to 'proceed' indicating cargo can continue movement.
  • Context - status analysis has been completed and arrival flag is true and no hold, release, ptt, or proceed flags are true:
    For Set Final Status: Arrived:
    When final status determination is performed, then the cargo final status is set to 'arrived' indicating cargo has reached its destination.
  • Context - status analysis has been completed and export flag is true and no other status flags are true:
    For Set Final Status: Exported:
    When final status determination is performed, then the cargo final status is set to 'exported' indicating cargo has been exported from the country.
  • Context - a cargo status analysis process is starting:
    For Initialize Cargo State Flags:
    When the system begins status array analysis, then all cargo state flags (hold, release, ptt, proceed, arrival, export, fda) are set to false and quantities are initialized to zero.
  • Context - a populated s09a status array exists for cargo:
    For Loop Through S09A Status Array Elements:
    When the system processes status array elements, then each array element is examined in sequence until all elements are processed.
  • Context - a status array element contains a disposition code:
    For Check Disposition Code Type:
    When the disposition code is evaluated for type classification, then the system determines if the code represents a hold condition based on predefined hold code criteria and the system determines if the code represents a release condition based on predefined release code criteria and the system determines if the code represents a ptt condition based on predefined ptt code criteria and the system determines if the code represents a proceed condition based on predefined proceed code criteria and the system determines if the code represents an arrival condition based on predefined arrival code criteria and the system determines if the code represents an export condition based on predefined export code criteria and the system determines if the code represents an fda condition based on predefined fda code criteria.
  • Context - a disposition code is classified as a hold code:
    For Set Hold Flag:
    When the hold code is processed, then the cargo hold flag is set to true.
  • Context - a hold disposition code has been identified:
    For Determine Hold Location:
    When the system evaluates the hold location criteria, then the hold is classified as either border hold or destination hold based on location indicators.
    For Border or Destination Hold?:
    When the system evaluates the hold location, then the hold is classified as either border hold or destination hold based on the disposition code characteristics.
  • Context - a hold disposition code applies to border location:
    For Set Border Hold Flag:
    When the border hold condition is identified, then the border hold flag is set to true.
  • Context - a hold disposition code applies to destination location:
    For Set Destination Hold Flag:
    When the destination hold condition is identified, then the destination hold flag is set to true.
  • Context - a disposition code is classified as a release code:
    For Set Release Flag:
    When the release code is processed, then the cargo release flag is set to true and the release quantity is updated based on the disposition code quantity.
  • Context - a disposition code is classified as a ptt code:
    For Set PTT Flag:
    When the ptt code is processed, then the cargo ptt flag is set to true and the ptt quantity is saved from the disposition code.
  • Context - a disposition code is classified as a proceed code:
    For Set Proceed Flag:
    When the proceed code is processed, then the cargo proceed flag is set to true and the border arrival date is established.
  • Context - a disposition code is classified as an arrival code:
    For Set Arrival Flag:
    When the arrival code is processed, then the cargo arrival flag is set to true.
  • Context - a disposition code is classified as an export code:
    For Set Export Flag:
    When the export code is processed, then the cargo export flag is set to true.
  • Context - a disposition code is classified as an fda code:
    For Set FDA Hold Flag:
    When the fda code is processed, then the cargo fda hold flag is set to true.
  • Context - all status array elements have been processed and flags are set:
    For Analyze Combined Flags:
    When the system evaluates combined flag states, then the system determines if both hold and release conditions exist simultaneously.
  • Context - ptt flag is set and ptt quantity is available:
    For Analyze Combined Flags:
    When the system validates ptt quantity criteria, then the system determines if the ptt quantity is valid and meets threshold requirements.
  • Context - release flag is set and release quantity is available:
    For Analyze Combined Flags:
    When the system compares release quantity to total cargo quantity, then the system determines if the release is partial (release quantity less than total quantity) or complete.
  • Context - hold flags have been set during status array analysis:
    For Set Final Hold Status:
    When the system determines final cargo state, then the final hold status is established considering border holds, destination holds, and other hold conditions.
  • Context - release flags and quantities have been determined during status array analysis:
    For Set Final Release Status:
    When the system determines final cargo state, then the final release status is established considering full release, partial release, and release quantities.
  • Context - ptt flags and quantities have been validated during status array analysis:
    For Set Final PTT Status:
    When the system determines final cargo state, then the final ptt status is established if ptt quantity meets threshold requirements.
  • Context - release quantity is less than total cargo quantity:
    For Set Partial Release Status:
    When the system determines final cargo state, then the partial release status is set to indicate incomplete release of cargo.
  • Context - all individual status flags have been set and analyzed:
    For Determine Final Cargo State:
    When the system consolidates all status information, then the final cargo state is determined considering the priority and combination of hold, release, ptt, proceed, arrival, export, and fda conditions.
  • Context - the s09a status array contains status entries for a cargo record:
    For Scan S09A Status Array:
    When status analysis is performed, then each array element is examined sequentially until all elements are processed.
  • Context - a status code is found in the s09a array:
    For Evaluate Disposition Code Type:
    When the system evaluates the disposition code, then the code is classified as hold, release, ptt, proceed, arrival, export, or fda hold type.
  • Context - a disposition code is being evaluated from the status array:
    For Hold Code?:
    When the code is checked against hold code criteria, then the system determines if the code represents a hold condition and sets the hold status flag accordingly.
    For Release Code?:
    When the code is checked against release code criteria, then the system determines if the code represents a release condition and sets the release status flag accordingly.
    For PTT Code?:
    When the code is checked against ptt code criteria, then the system determines if the code represents a ptt condition and sets the ptt status flag accordingly.
    For Proceed Code?:
    When the code is checked against proceed code criteria, then the system determines if the code represents a proceed condition and sets the proceed status flag accordingly.
    For Arrival Code?:
    When the code is checked against arrival code criteria, then the system determines if the code represents an arrival condition and sets the arrival status flag accordingly.
    For Export Code?:
    When the code is checked against export code criteria, then the system determines if the code represents an export condition and sets the export status flag accordingly.
    For FDA Hold Code?:
    When the code is checked against fda hold code criteria, then the system determines if the code represents an fda hold condition and sets the fda hold status flag accordingly.
  • Context - a disposition code indicates a border hold condition:
    For Set Border Hold Flag:
    When the hold location is determined to be at the border, then the border hold status flag is set to true.
  • Context - a disposition code indicates a destination hold condition:
    For Set Destination Hold Flag:
    When the hold location is determined to be at the destination, then the destination hold status flag is set to true.
  • Context - a release disposition code has been identified:
    For Set Release Status Flag:
    When the release status is processed, then the release status flag is set to true and the released quantity is added to the total released quantity counter.
  • Context - a ptt disposition code has been identified:
    For Set PTT Status Flag:
    When the ptt status is processed, then the ptt status flag is set to true and the ptt quantity is validated against cargo requirements.
  • Context - a proceed disposition code has been identified:
    For Set Proceed Status Flag:
    When the proceed status is processed, then the proceed status flag is set to true and the border arrival date is recorded for tracking purposes.
  • Context - an arrival disposition code has been identified:
    For Set Arrival Status Flag:
    When the arrival status is processed, then the arrival status flag is set to true to indicate cargo has reached its destination.
  • Context - an export disposition code has been identified:
    For Set Export Status Flag:
    When the export status is processed, then the export status flag is set to true to indicate cargo is being exported.
  • Context - an fda hold disposition code has been identified:
    For Set FDA Hold at Destination:
    When the fda hold status is processed, then the fda hold at destination flag is set to true to indicate regulatory hold requirements.
  • Context - all status flags have been analyzed from the s09a array:
    For Determine Final Cargo Status:
    When the final cargo status needs to be determined, then the system applies priority logic where hold statuses take precedence over release statuses, and specific hold types are prioritized based on business rules.
  • Context - status analysis shows cargo has active border hold conditions:
    For Set Final Status: Hold at Border:
    When final status determination is performed, then the cargo status is set to 'hold at border' and appropriate status codes are applied.
  • Context - status analysis shows cargo has active destination hold conditions and no border holds:
    For Set Final Status: Hold at Destination:
    When final status determination is performed, then the cargo status is set to 'hold at destination' and appropriate status codes are applied.
  • Context - status analysis shows cargo has no active hold conditions and has release authorization:
    For Set Final Status: Released:
    When final status determination is performed, then the cargo status is set to 'released' and cargo is authorized for movement.
  • Context - status analysis shows cargo has active ptt conditions with no holds or releases:
    For Set Final Status: PTT:
    When final status determination is performed, then the cargo status is set to 'ptt' (proceed to transfer) for continued processing.
  • Context - status analysis shows cargo has active proceed conditions with no holds, releases, or ptt status:
    For Set Final Status: Proceed:
    When final status determination is performed, then the cargo status is set to 'proceed' allowing cargo movement to continue.
  • Context - status analysis shows cargo has active arrival or export conditions with no holds, releases, ptt, or proceed status:
    For Set Final Status: Arrived/Export:
    When final status determination is performed, then the cargo status is set to either 'arrived' or 'export' based on the specific condition identified.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires status analysis
GIVEN
A cargo record requires status analysis
Applied to: Initialize Cargo State Flags & Initialize Status Flags
WHEN
The status array analysis process begins
THEN
All cargo state flags (empty, held, released, PTT, proceed, arrival, export, FDA hold) are set to false/off and all quantity counters are reset to zero AND All status flags (hold, release, PTT, proceed, arrival, export, FDA hold) are set to false and quantity counters are reset to zero
Context: The S09A status array contains cargo disposition codes
GIVEN
The S09A status array contains cargo disposition codes
Applied to: Scan S09A Status Array Elements
WHEN
Status analysis is performed
THEN
Each array element is examined sequentially until all elements are processed
Context: A disposition code from the S09A array is being examined
GIVEN
A disposition code from the S09A array is being examined
Applied to: Hold Code? & Release Code? & PTT Code? & Proceed Code? & Arrival Code? & Export Code? & FDA Hold Code?
WHEN
The disposition code type is evaluated
THEN
If the code is classified as a hold type in the disposition code table, the hold status flag is set to true AND If the code is classified as a release type in the disposition code table, the release status flag is set to true AND If the code is classified as a PTT type in the disposition code table, the PTT status flag is set to true AND If the code is classified as a proceed type in the disposition code table, the proceed status flag is set to true AND If the code is classified as an arrival type in the disposition code table, the arrival status flag is set to true AND If the code is classified as an export type in the disposition code table, the export status flag is set to true AND If the code is classified as an FDA hold type in the disposition code table, the FDA hold status flag is set to true
Context: A disposition code has been identified as a hold type
GIVEN
A disposition code has been identified as a hold type
Applied to: Border or Destination Hold?
WHEN
The hold location is determined
THEN
If the hold applies at the border, set border hold flag to true, otherwise if the hold applies at destination, set destination hold flag to true
Context: A disposition code has been identified as a release type
GIVEN
A disposition code has been identified as a release type
Applied to: Calculate Release Quantities
WHEN
Release quantities are calculated
THEN
The quantity associated with the release code is added to the total release quantity counter
Context: All disposition codes in the S09A array have been analyzed and status flags have been set
GIVEN
All disposition codes in the S09A array have been analyzed and status flags have been set
Applied to: Determine Final Cargo Status
WHEN
Final cargo status determination is performed
THEN
The system evaluates status flags in priority order: border hold, destination hold, released, PTT active, proceed, arrived, exported to set the final cargo status
Context: Status analysis has been completed and border hold flag is true
GIVEN
Status analysis has been completed and border hold flag is true
Applied to: Set Final Status: Hold at Border
WHEN
Final status determination is performed
THEN
The cargo final status is set to 'Hold at Border' indicating cargo cannot proceed past the border
Context: Status analysis has been completed and destination hold flag is true and border hold flag is false
GIVEN
Status analysis has been completed and destination hold flag is true and border hold flag is false
Applied to: Set Final Status: Hold at Destination
WHEN
Final status determination is performed
THEN
The cargo final status is set to 'Hold at Destination' indicating cargo is held at the destination location
Context: Status analysis has been completed and release flag is true and no hold flags are true
GIVEN
Status analysis has been completed and release flag is true and no hold flags are true
Applied to: Set Final Status: Released
WHEN
Final status determination is performed
THEN
The cargo final status is set to 'Released' indicating cargo is cleared for movement
Context: Status analysis has been completed and PTT flag is true and no hold or release flags are true
GIVEN
Status analysis has been completed and PTT flag is true and no hold or release flags are true
Applied to: Set Final Status: PTT Active
WHEN
Final status determination is performed
THEN
The cargo final status is set to 'PTT Active' indicating permit to transfer is in effect
Context: Status analysis has been completed and proceed flag is true and no hold, release, or PTT flags are true
GIVEN
Status analysis has been completed and proceed flag is true and no hold, release, or PTT flags are true
Applied to: Set Final Status: Proceed
WHEN
Final status determination is performed
THEN
The cargo final status is set to 'Proceed' indicating cargo can continue movement
Context: Status analysis has been completed and arrival flag is true and no hold, release, PTT, or proceed flags are true
GIVEN
Status analysis has been completed and arrival flag is true and no hold, release, PTT, or proceed flags are true
Applied to: Set Final Status: Arrived
WHEN
Final status determination is performed
THEN
The cargo final status is set to 'Arrived' indicating cargo has reached its destination
Context: Status analysis has been completed and export flag is true and no other status flags are true
GIVEN
Status analysis has been completed and export flag is true and no other status flags are true
Applied to: Set Final Status: Exported
WHEN
Final status determination is performed
THEN
The cargo final status is set to 'Exported' indicating cargo has been exported from the country
Context: A cargo status analysis process is starting
GIVEN
A cargo status analysis process is starting
Applied to: Initialize Cargo State Flags
WHEN
The system begins status array analysis
THEN
All cargo state flags (hold, release, PTT, proceed, arrival, export, FDA) are set to false and quantities are initialized to zero
Context: A populated S09A status array exists for cargo
GIVEN
A populated S09A status array exists for cargo
Applied to: Loop Through S09A Status Array Elements
WHEN
The system processes status array elements
THEN
Each array element is examined in sequence until all elements are processed
Context: A status array element contains a disposition code
GIVEN
A status array element contains a disposition code
Applied to: Check Disposition Code Type
WHEN
The disposition code is evaluated for type classification
THEN
The system determines if the code represents a hold condition based on predefined hold code criteria AND The system determines if the code represents a release condition based on predefined release code criteria AND The system determines if the code represents a PTT condition based on predefined PTT code criteria AND The system determines if the code represents a proceed condition based on predefined proceed code criteria AND The system determines if the code represents an arrival condition based on predefined arrival code criteria AND The system determines if the code represents an export condition based on predefined export code criteria AND The system determines if the code represents an FDA condition based on predefined FDA code criteria
Context: A disposition code is classified as a hold code
GIVEN
A disposition code is classified as a hold code
Applied to: Set Hold Flag
WHEN
The hold code is processed
THEN
The cargo hold flag is set to true
Context: A hold disposition code has been identified
GIVEN
A hold disposition code has been identified
Applied to: Determine Hold Location
WHEN
The system evaluates the hold location criteria
THEN
The hold is classified as either border hold or destination hold based on location indicators
Applied to: Border or Destination Hold?
WHEN
The system evaluates the hold location
THEN
The hold is classified as either border hold or destination hold based on the disposition code characteristics
Context: A hold disposition code applies to border location
GIVEN
A hold disposition code applies to border location
Applied to: Set Border Hold Flag
WHEN
The border hold condition is identified
THEN
The border hold flag is set to true
Context: A hold disposition code applies to destination location
GIVEN
A hold disposition code applies to destination location
Applied to: Set Destination Hold Flag
WHEN
The destination hold condition is identified
THEN
The destination hold flag is set to true
Context: A disposition code is classified as a release code
GIVEN
A disposition code is classified as a release code
Applied to: Set Release Flag
WHEN
The release code is processed
THEN
The cargo release flag is set to true and the release quantity is updated based on the disposition code quantity
Context: A disposition code is classified as a PTT code
GIVEN
A disposition code is classified as a PTT code
Applied to: Set PTT Flag
WHEN
The PTT code is processed
THEN
The cargo PTT flag is set to true and the PTT quantity is saved from the disposition code
Context: A disposition code is classified as a proceed code
GIVEN
A disposition code is classified as a proceed code
Applied to: Set Proceed Flag
WHEN
The proceed code is processed
THEN
The cargo proceed flag is set to true and the border arrival date is established
Context: A disposition code is classified as an arrival code
GIVEN
A disposition code is classified as an arrival code
Applied to: Set Arrival Flag
WHEN
The arrival code is processed
THEN
The cargo arrival flag is set to true
Context: A disposition code is classified as an export code
GIVEN
A disposition code is classified as an export code
Applied to: Set Export Flag
WHEN
The export code is processed
THEN
The cargo export flag is set to true
Context: A disposition code is classified as an FDA code
GIVEN
A disposition code is classified as an FDA code
Applied to: Set FDA Hold Flag
WHEN
The FDA code is processed
THEN
The cargo FDA hold flag is set to true
Context: All status array elements have been processed and flags are set
GIVEN
All status array elements have been processed and flags are set
Applied to: Analyze Combined Flags
WHEN
The system evaluates combined flag states
THEN
The system determines if both hold and release conditions exist simultaneously
Context: PTT flag is set and PTT quantity is available
GIVEN
PTT flag is set and PTT quantity is available
Applied to: Analyze Combined Flags
WHEN
The system validates PTT quantity criteria
THEN
The system determines if the PTT quantity is valid and meets threshold requirements
Context: Release flag is set and release quantity is available
GIVEN
Release flag is set and release quantity is available
Applied to: Analyze Combined Flags
WHEN
The system compares release quantity to total cargo quantity
THEN
The system determines if the release is partial (release quantity less than total quantity) or complete
Context: Hold flags have been set during status array analysis
GIVEN
Hold flags have been set during status array analysis
Applied to: Set Final Hold Status
WHEN
The system determines final cargo state
THEN
The final hold status is established considering border holds, destination holds, and other hold conditions
Context: Release flags and quantities have been determined during status array analysis
GIVEN
Release flags and quantities have been determined during status array analysis
Applied to: Set Final Release Status
WHEN
The system determines final cargo state
THEN
The final release status is established considering full release, partial release, and release quantities
Context: PTT flags and quantities have been validated during status array analysis
GIVEN
PTT flags and quantities have been validated during status array analysis
Applied to: Set Final PTT Status
WHEN
The system determines final cargo state
THEN
The final PTT status is established if PTT quantity meets threshold requirements
Context: Release quantity is less than total cargo quantity
GIVEN
Release quantity is less than total cargo quantity
Applied to: Set Partial Release Status
WHEN
The system determines final cargo state
THEN
The partial release status is set to indicate incomplete release of cargo
Context: All individual status flags have been set and analyzed
GIVEN
All individual status flags have been set and analyzed
Applied to: Determine Final Cargo State
WHEN
The system consolidates all status information
THEN
The final cargo state is determined considering the priority and combination of hold, release, PTT, proceed, arrival, export, and FDA conditions
Context: The S09A status array contains status entries for a cargo record
GIVEN
The S09A status array contains status entries for a cargo record
Applied to: Scan S09A Status Array
WHEN
Status analysis is performed
THEN
Each array element is examined sequentially until all elements are processed
Context: A status code is found in the S09A array
GIVEN
A status code is found in the S09A array
Applied to: Evaluate Disposition Code Type
WHEN
The system evaluates the disposition code
THEN
The code is classified as hold, release, PTT, proceed, arrival, export, or FDA hold type
Context: A disposition code is being evaluated from the status array
GIVEN
A disposition code is being evaluated from the status array
Applied to: Hold Code?
WHEN
The code is checked against hold code criteria
THEN
The system determines if the code represents a hold condition and sets the hold status flag accordingly
Applied to: Release Code?
WHEN
The code is checked against release code criteria
THEN
The system determines if the code represents a release condition and sets the release status flag accordingly
Applied to: PTT Code?
WHEN
The code is checked against PTT code criteria
THEN
The system determines if the code represents a PTT condition and sets the PTT status flag accordingly
Applied to: Proceed Code?
WHEN
The code is checked against proceed code criteria
THEN
The system determines if the code represents a proceed condition and sets the proceed status flag accordingly
Applied to: Arrival Code?
WHEN
The code is checked against arrival code criteria
THEN
The system determines if the code represents an arrival condition and sets the arrival status flag accordingly
Applied to: Export Code?
WHEN
The code is checked against export code criteria
THEN
The system determines if the code represents an export condition and sets the export status flag accordingly
Applied to: FDA Hold Code?
WHEN
The code is checked against FDA hold code criteria
THEN
The system determines if the code represents an FDA hold condition and sets the FDA hold status flag accordingly
Context: A disposition code indicates a border hold condition
GIVEN
A disposition code indicates a border hold condition
Applied to: Set Border Hold Flag
WHEN
The hold location is determined to be at the border
THEN
The border hold status flag is set to true
Context: A disposition code indicates a destination hold condition
GIVEN
A disposition code indicates a destination hold condition
Applied to: Set Destination Hold Flag
WHEN
The hold location is determined to be at the destination
THEN
The destination hold status flag is set to true
Context: A release disposition code has been identified
GIVEN
A release disposition code has been identified
Applied to: Set Release Status Flag
WHEN
The release status is processed
THEN
The release status flag is set to true and the released quantity is added to the total released quantity counter
Context: A PTT disposition code has been identified
GIVEN
A PTT disposition code has been identified
Applied to: Set PTT Status Flag
WHEN
The PTT status is processed
THEN
The PTT status flag is set to true and the PTT quantity is validated against cargo requirements
Context: A proceed disposition code has been identified
GIVEN
A proceed disposition code has been identified
Applied to: Set Proceed Status Flag
WHEN
The proceed status is processed
THEN
The proceed status flag is set to true and the border arrival date is recorded for tracking purposes
Context: An arrival disposition code has been identified
GIVEN
An arrival disposition code has been identified
Applied to: Set Arrival Status Flag
WHEN
The arrival status is processed
THEN
The arrival status flag is set to true to indicate cargo has reached its destination
Context: An export disposition code has been identified
GIVEN
An export disposition code has been identified
Applied to: Set Export Status Flag
WHEN
The export status is processed
THEN
The export status flag is set to true to indicate cargo is being exported
Context: An FDA hold disposition code has been identified
GIVEN
An FDA hold disposition code has been identified
Applied to: Set FDA Hold at Destination
WHEN
The FDA hold status is processed
THEN
The FDA hold at destination flag is set to true to indicate regulatory hold requirements
Context: All status flags have been analyzed from the S09A array
GIVEN
All status flags have been analyzed from the S09A array
Applied to: Determine Final Cargo Status
WHEN
The final cargo status needs to be determined
THEN
The system applies priority logic where hold statuses take precedence over release statuses, and specific hold types are prioritized based on business rules
Context: Status analysis shows cargo has active border hold conditions
GIVEN
Status analysis shows cargo has active border hold conditions
Applied to: Set Final Status: Hold at Border
WHEN
Final status determination is performed
THEN
The cargo status is set to 'Hold at Border' and appropriate status codes are applied
Context: Status analysis shows cargo has active destination hold conditions and no border holds
GIVEN
Status analysis shows cargo has active destination hold conditions and no border holds
Applied to: Set Final Status: Hold at Destination
WHEN
Final status determination is performed
THEN
The cargo status is set to 'Hold at Destination' and appropriate status codes are applied
Context: Status analysis shows cargo has no active hold conditions and has release authorization
GIVEN
Status analysis shows cargo has no active hold conditions and has release authorization
Applied to: Set Final Status: Released
WHEN
Final status determination is performed
THEN
The cargo status is set to 'Released' and cargo is authorized for movement
Context: Status analysis shows cargo has active PTT conditions with no holds or releases
GIVEN
Status analysis shows cargo has active PTT conditions with no holds or releases
Applied to: Set Final Status: PTT
WHEN
Final status determination is performed
THEN
The cargo status is set to 'PTT' (Proceed to Transfer) for continued processing
Context: Status analysis shows cargo has active proceed conditions with no holds, releases, or PTT status
GIVEN
Status analysis shows cargo has active proceed conditions with no holds, releases, or PTT status
Applied to: Set Final Status: Proceed
WHEN
Final status determination is performed
THEN
The cargo status is set to 'Proceed' allowing cargo movement to continue
Context: Status analysis shows cargo has active arrival or export conditions with no holds, releases, PTT, or proceed status
GIVEN
Status analysis shows cargo has active arrival or export conditions with no holds, releases, PTT, or proceed status
Applied to: Set Final Status: Arrived/Export
WHEN
Final status determination is performed
THEN
The cargo status is set to either 'Arrived' or 'Export' based on the specific condition identified
R-GCX016-cbl-04115 (+13) File: GCX016.cbl Complex Cargo Status Logic Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Complex Cargo Status Logic':
  • Context - a cargo record exists with manual release flag set:
    For 258: Manual Release Processing:
    When the system processes cargo status determination, then the system clears the destination index and processes canadian manifest coordination.
  • Context - a cargo record exists and fda hold conditions are detected at destination:
    For 259: FDA Hold Status Processing:
    When the system evaluates cargo status requirements, then the system sets fda hold status with specific fda codes.
  • Context - a cargo record exists with quantity information and ptt status requirements:
    For 260: PTT Status Management:
    When the system determines if ptt status is required, then the system validates ptt quantities and saves or restores ptt status accordingly.
  • Context - a cargo record exists with released quantity less than total quantity:
    For 261: Partial Release Hold Processing:
    When the system evaluates partial release conditions, then the system sets hold on piece counts status.
  • Context - a cargo record exists with released quantity equal to or greater than total quantity:
    For 262: Full Release Processing:
    When the system evaluates full release conditions, then the system clears destination index and matches released versus total quantities.
  • Context - a cargo record exists that was previously released but now shows unreleased status:
    For 263: Cargo Unrelease Detection:
    When the system compares current status with previous release status, then the system generates unrelease notifications.
  • Context - a cargo record exists with status changes that require destination index updates:
    For 264: Destination Index Re-establishment:
    When the system determines index update is required, then the system updates rt076 destination index and manages bond dates for arrival or export.
  • Context - a cargo record exists with bond start dates requiring age calculation:
    For 265: Age Calculation for Cargo:
    When the system determines age calculation is required, then the system converts julian dates for bond start dates to calculate cargo age.
  • Context - a cargo record exists with status changes requiring integration service calls:
    For 266: Cargo Record Integration Service Calls:
    When the system determines integration service call is required, then the system calls gcciis for hold or release notifications and sends status change notifications.
  • Context - multiple cargo records exist with the same car id and waybill combination:
    For 267: Multi-cargo Release Verification:
    When the system needs to verify multi-cargo release status, then the system verifies all cargo with same car id and waybill and checks release eligibility.
  • Context - a cargo record exists with conditions requiring release message generation:
    For 268: Release Message Generation:
    When the system determines release message should be generated, then the system creates detailed release messages including cargo status and quantities.
  • Context - a cargo record exists with conditions requiring export message generation:
    For 269: Export Message Generation:
    When the system determines export message is required, then the system generates uscs export operations message and handles export cancellation scenarios.
  • Context - a cargo record exists with conditions requiring arrival message generation:
    For 270: Arrival Message Generation:
    When the system determines arrival message is required, then the system generates uscs arrival operations message and handles arrival cancellation scenarios.
  • Context - a cargo record exists that has completed complex status logic processing:
    For 277: Cargo Status Preservation:
    When the system reaches the end of complex status determination, then the system saves current status information to preserve cargo state.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with manual release flag set
GIVEN
A cargo record exists with manual release flag set
Applied to: 258: Manual Release Processing
WHEN
The system processes cargo status determination
THEN
The system clears the destination index and processes Canadian manifest coordination
Context: A cargo record exists and FDA hold conditions are detected at destination
GIVEN
A cargo record exists and FDA hold conditions are detected at destination
Applied to: 259: FDA Hold Status Processing
WHEN
The system evaluates cargo status requirements
THEN
The system sets FDA hold status with specific FDA codes
Context: A cargo record exists with quantity information and PTT status requirements
GIVEN
A cargo record exists with quantity information and PTT status requirements
Applied to: 260: PTT Status Management
WHEN
The system determines if PTT status is required
THEN
The system validates PTT quantities and saves or restores PTT status accordingly
Context: A cargo record exists with released quantity less than total quantity
GIVEN
A cargo record exists with released quantity less than total quantity
Applied to: 261: Partial Release Hold Processing
WHEN
The system evaluates partial release conditions
THEN
The system sets hold on piece counts status
Context: A cargo record exists with released quantity equal to or greater than total quantity
GIVEN
A cargo record exists with released quantity equal to or greater than total quantity
Applied to: 262: Full Release Processing
WHEN
The system evaluates full release conditions
THEN
The system clears destination index and matches released versus total quantities
Context: A cargo record exists that was previously released but now shows unreleased status
GIVEN
A cargo record exists that was previously released but now shows unreleased status
Applied to: 263: Cargo Unrelease Detection
WHEN
The system compares current status with previous release status
THEN
The system generates unrelease notifications
Context: A cargo record exists with status changes that require destination index updates
GIVEN
A cargo record exists with status changes that require destination index updates
Applied to: 264: Destination Index Re-establishment
WHEN
The system determines index update is required
THEN
The system updates RT076 destination index and manages bond dates for arrival or export
Context: A cargo record exists with bond start dates requiring age calculation
GIVEN
A cargo record exists with bond start dates requiring age calculation
Applied to: 265: Age Calculation for Cargo
WHEN
The system determines age calculation is required
THEN
The system converts Julian dates for bond start dates to calculate cargo age
Context: A cargo record exists with status changes requiring integration service calls
GIVEN
A cargo record exists with status changes requiring integration service calls
Applied to: 266: Cargo Record Integration Service Calls
WHEN
The system determines integration service call is required
THEN
The system calls GCCIIS for hold or release notifications and sends status change notifications
Context: Multiple cargo records exist with the same car ID and waybill combination
GIVEN
Multiple cargo records exist with the same car ID and waybill combination
Applied to: 267: Multi-cargo Release Verification
WHEN
The system needs to verify multi-cargo release status
THEN
The system verifies all cargo with same car ID and waybill and checks release eligibility
Context: A cargo record exists with conditions requiring release message generation
GIVEN
A cargo record exists with conditions requiring release message generation
Applied to: 268: Release Message Generation
WHEN
The system determines release message should be generated
THEN
The system creates detailed release messages including cargo status and quantities
Context: A cargo record exists with conditions requiring export message generation
GIVEN
A cargo record exists with conditions requiring export message generation
Applied to: 269: Export Message Generation
WHEN
The system determines export message is required
THEN
The system generates USCS export operations message and handles export cancellation scenarios
Context: A cargo record exists with conditions requiring arrival message generation
GIVEN
A cargo record exists with conditions requiring arrival message generation
Applied to: 270: Arrival Message Generation
WHEN
The system determines arrival message is required
THEN
The system generates USCS arrival operations message and handles arrival cancellation scenarios
Context: A cargo record exists that has completed complex status logic processing
GIVEN
A cargo record exists that has completed complex status logic processing
Applied to: 277: Cargo Status Preservation
WHEN
The system reaches the end of complex status determination
THEN
The system saves current status information to preserve cargo state
R-GCX016-cbl-04129 (+2) File: GCX016.cbl KCSM Disposition Code Check Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'KCSM Disposition Code Check':
  • Context - a cargo shipment is being processed with a specific port code:
    For Is Port Code = LRD Laredo?:
    When the system checks if the port code equals 'lrd' (laredo), then the system proceeds to kcsm disposition code validation if port is laredo, otherwise skips kcsm processing.
  • Context - a disposition code from the x4 segment and access to the aecwrktb configuration table:
    For Search for Disposition Code in KCSM Configuration:
    When the system searches for the disposition code in the kcsm configuration data, then the system retrieves the kcsm configuration status for the disposition code.
  • Context - a disposition code lookup result from the aecwrktb table:
    For Disposition Code Found in KCSM Table?:
    When the disposition code is found in the kcsm configuration table, then the system sets the kcsm processing flag to true, otherwise sets it to false.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment is being processed with a specific port code
GIVEN
A cargo shipment is being processed with a specific port code
Applied to: Is Port Code = LRD Laredo?
WHEN
The system checks if the port code equals 'LRD' (Laredo)
THEN
The system proceeds to KCSM disposition code validation if port is Laredo, otherwise skips KCSM processing
Context: A disposition code from the X4 segment and access to the AECWRKTB configuration table
GIVEN
A disposition code from the X4 segment and access to the AECWRKTB configuration table
Applied to: Search for Disposition Code in KCSM Configuration
WHEN
The system searches for the disposition code in the KCSM configuration data
THEN
The system retrieves the KCSM configuration status for the disposition code
Context: A disposition code lookup result from the AECWRKTB table
GIVEN
A disposition code lookup result from the AECWRKTB table
Applied to: Disposition Code Found in KCSM Table?
WHEN
The disposition code is found in the KCSM configuration table
THEN
The system sets the KCSM processing flag to TRUE, otherwise sets it to FALSE
R-GCX016-cbl-04132 (+12) File: GCX016.cbl EDI Message Copying Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI Message Copying':
  • Context - an edi 350 message with a disposition code is being processed:
    For Check Disposition Code for KCSM Processing:
    When the system checks the disposition code against kcsm processing requirements, then the system determines whether kcsm transmission is required for this message.
  • Context - a message requires kcsm processing based on disposition code:
    For Validate Port is Laredo:
    When the system validates the port location, then the system confirms the port is laredo before allowing kcsm transmission.
  • Context - disposition code and port validation checks have been completed:
    For KCSM Processing Required?:
    When the system evaluates all kcsm processing criteria, then the system either proceeds with kcsm processing or skips it based on the validation results.
  • Context - kcsm processing is required for the current message:
    For Initialize KCSM Transmission File:
    When the system begins kcsm transmission preparation, then the system initializes the kcsm transmission file with proper structure and parameters.
  • Context - kcsm transmission file is initialized:
    For Copy Original EDI 350 Message Segments:
    When the system processes the original edi 350 message, then the system copies all required message segments to the kcsm transmission structure.
  • Context - original edi message segments have been copied:
    For Create Transmission Root Segment:
    When the system creates the transmission structure, then the system creates a transmission root segment (a9rt) with proper identification and control information.
  • Context - transmission root segment has been created:
    For Create Transmission Dependent Segments:
    When the system builds the complete transmission structure, then the system creates transmission dependent segments (a9dp) linked to the root segment.
  • Context - transmission segments have been created:
    For Format EDI Data for KCSM System:
    When the system prepares data for kcsm transmission, then the system formats all edi data according to kcsm system specifications and requirements.
  • Context - edi data has been formatted for kcsm system:
    For Write Message to KCSM Queue:
    When the system is ready to transmit the message, then the system writes the formatted message to the kcsm message queue for processing.
  • Context - message has been written to kcsm queue:
    For Update Transmission Parameters:
    When the system completes the transmission preparation, then the system updates transmission parameters including timestamps, sequence numbers, and control information.
  • Context - transmission parameters have been updated:
    For Log KCSM Transmission Details:
    When the system completes kcsm message preparation, then the system logs transmission details including message id, timestamp, disposition code, and transmission status.
  • Context - kcsm transmission details have been logged:
    For Spawn KCSM Integration Transaction:
    When the system is ready to initiate kcsm integration, then the system spawns a kcsm integration transaction to handle the actual transmission and processing.
  • Context - kcsm processing validation has been completed:
    For Skip KCSM Processing:
    When the validation criteria indicate kcsm processing is not required, then the system skips all kcsm processing steps and continues with normal message processing.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message with a disposition code is being processed
GIVEN
An EDI 350 message with a disposition code is being processed
Applied to: Check Disposition Code for KCSM Processing
WHEN
The system checks the disposition code against KCSM processing requirements
THEN
The system determines whether KCSM transmission is required for this message
Context: A message requires KCSM processing based on disposition code
GIVEN
A message requires KCSM processing based on disposition code
Applied to: Validate Port is Laredo
WHEN
The system validates the port location
THEN
The system confirms the port is Laredo before allowing KCSM transmission
Context: Disposition code and port validation checks have been completed
GIVEN
Disposition code and port validation checks have been completed
Applied to: KCSM Processing Required?
WHEN
The system evaluates all KCSM processing criteria
THEN
The system either proceeds with KCSM processing or skips it based on the validation results
Context: KCSM processing is required for the current message
GIVEN
KCSM processing is required for the current message
Applied to: Initialize KCSM Transmission File
WHEN
The system begins KCSM transmission preparation
THEN
The system initializes the KCSM transmission file with proper structure and parameters
Context: KCSM transmission file is initialized
GIVEN
KCSM transmission file is initialized
Applied to: Copy Original EDI 350 Message Segments
WHEN
The system processes the original EDI 350 message
THEN
The system copies all required message segments to the KCSM transmission structure
Context: Original EDI message segments have been copied
GIVEN
Original EDI message segments have been copied
Applied to: Create Transmission Root Segment
WHEN
The system creates the transmission structure
THEN
The system creates a transmission root segment (A9RT) with proper identification and control information
Context: Transmission root segment has been created
GIVEN
Transmission root segment has been created
Applied to: Create Transmission Dependent Segments
WHEN
The system builds the complete transmission structure
THEN
The system creates transmission dependent segments (A9DP) linked to the root segment
Context: Transmission segments have been created
GIVEN
Transmission segments have been created
Applied to: Format EDI Data for KCSM System
WHEN
The system prepares data for KCSM transmission
THEN
The system formats all EDI data according to KCSM system specifications and requirements
Context: EDI data has been formatted for KCSM system
GIVEN
EDI data has been formatted for KCSM system
Applied to: Write Message to KCSM Queue
WHEN
The system is ready to transmit the message
THEN
The system writes the formatted message to the KCSM message queue for processing
Context: Message has been written to KCSM queue
GIVEN
Message has been written to KCSM queue
Applied to: Update Transmission Parameters
WHEN
The system completes the transmission preparation
THEN
The system updates transmission parameters including timestamps, sequence numbers, and control information
Context: Transmission parameters have been updated
GIVEN
Transmission parameters have been updated
Applied to: Log KCSM Transmission Details
WHEN
The system completes KCSM message preparation
THEN
The system logs transmission details including message ID, timestamp, disposition code, and transmission status
Context: KCSM transmission details have been logged
GIVEN
KCSM transmission details have been logged
Applied to: Spawn KCSM Integration Transaction
WHEN
The system is ready to initiate KCSM integration
THEN
The system spawns a KCSM integration transaction to handle the actual transmission and processing
Context: KCSM processing validation has been completed
GIVEN
KCSM processing validation has been completed
Applied to: Skip KCSM Processing
WHEN
The validation criteria indicate KCSM processing is not required
THEN
The system skips all KCSM processing steps and continues with normal message processing
R-GCX016-cbl-04145 (+3) File: GCX016.cbl AECWRKTB Table Search Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AECWRKTB Table Search':
  • Context - a disposition code is received from x4 segment:
    For Query AECWRKTB DB2 Table:
    When the system searches aecwrktb table for the disposition code configuration, then the system returns whether kcsm processing is required for this disposition code.
    For Format Search Key with Disposition Code:
    When the system prepares to search aecwrktb table, then the disposition code is formatted into the proper search key structure for table lookup.
  • Context - a disposition code search is performed in aecwrktb table:
    For Set KCSM Processing Flag = YES:
    When the disposition code is found in the aecwrktb configuration table, then the kcsm processing flag is set to yes to enable special kcsm processing.
    For Set KCSM Processing Flag = NO:
    When the disposition code is not found in the aecwrktb configuration table, then the kcsm processing flag is set to no to disable kcsm processing.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is received from X4 segment
GIVEN
A disposition code is received from X4 segment
Applied to: Query AECWRKTB DB2 Table
WHEN
The system searches AECWRKTB table for the disposition code configuration
THEN
The system returns whether KCSM processing is required for this disposition code
Applied to: Format Search Key with Disposition Code
WHEN
The system prepares to search AECWRKTB table
THEN
The disposition code is formatted into the proper search key structure for table lookup
Context: A disposition code search is performed in AECWRKTB table
GIVEN
A disposition code search is performed in AECWRKTB table
Applied to: Set KCSM Processing Flag = YES
WHEN
The disposition code is found in the AECWRKTB configuration table
THEN
The KCSM processing flag is set to YES to enable special KCSM processing
Applied to: Set KCSM Processing Flag = NO
WHEN
The disposition code is not found in the AECWRKTB configuration table
THEN
The KCSM processing flag is set to NO to disable KCSM processing
R-GCX016-cbl-04149 (+19) File: GCX016.cbl EDI 350 Message Copy Creation Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI 350 Message Copy Creation':
  • Context - an edi 350 message with a disposition code is being processed:
    For Check if KCSM Processing Required:
    When the system checks the aecwrktb kcsm configuration table for the disposition code, then the system determines if kcsm processing is required based on the configuration entry.
  • Context - a disposition code from the edi 350 message:
    For Disposition Code Configured for KCSM?:
    When the system looks up the disposition code in the kcsm configuration table, then if the disposition code is found and marked for kcsm processing, proceed with edi message copy creation, otherwise skip kcsm processing.
  • Context - kcsm processing is required for the current message:
    For Initialize EDI Message Copy Variables:
    When the system begins edi message copy creation process, then all edi message copy variables, counters, and data structures are initialized to their default values.
  • Context - an original edi 350 message with header information:
    For Copy Original EDI Message Header:
    When the system creates a copy for kcsm transmission, then the original message header data is copied exactly to the transmission copy maintaining all header fields and values.
  • Context - an edi 350 message with st transaction set header segment:
    For Process ST Transaction Set Header:
    When the system processes the message for kcsm transmission, then the st segment is copied to the transmission file with proper formatting and sequence control.
  • Context - an edi 350 message with m10 manifest information segment:
    For Copy M10 Manifest Information Segment:
    When the system creates kcsm transmission copy, then the m10 segment with all manifest information is copied to the transmission file.
  • Context - an edi 350 message with p4 port information segment:
    For Copy P4 Port Information Segment:
    When the system creates kcsm transmission copy, then the p4 segment with all port information is copied to the transmission file.
  • Context - an edi 350 message with v9 event detail segment:
    For Copy V9 Event Detail Segment:
    When the system creates kcsm transmission copy, then the v9 segment with all event detail information is copied to the transmission file.
  • Context - an edi 350 message being processed for kcsm transmission:
    For VID Equipment Segments Present?:
    When the system evaluates the message structure for vid segments, then if vid equipment segments are present, they are processed and copied, otherwise the system continues to the next segment type.
  • Context - an edi 350 message with vid equipment information segments:
    For Copy VID Equipment Information:
    When the system processes vid segments for kcsm transmission, then all vid equipment information is copied to the transmission file maintaining equipment details and relationships.
  • Context - an edi 350 message with k1 remarks segments:
    For Copy K1 Remarks Segments:
    When the system creates kcsm transmission copy, then all k1 remarks segments with their associated information are copied to the transmission file.
  • Context - an edi 350 message with x4 customs release information segment:
    For Copy X4 Customs Release Information:
    When the system creates kcsm transmission copy, then the x4 segment with all customs release information including disposition codes is copied to the transmission file.
  • Context - an edi 350 message with n7 equipment details segment:
    For Copy N7 Equipment Details:
    When the system creates kcsm transmission copy, then the n7 segment with all equipment details and specifications is copied to the transmission file.
  • Context - an edi 350 message with se transaction set trailer segment:
    For Copy SE Transaction Set Trailer:
    When the system completes kcsm transmission copy creation, then the se trailer segment is copied to the transmission file with proper segment count and control number.
  • Context - all edi message segments have been copied for kcsm transmission:
    For Format Message for KCSM Transmission:
    When the system formats the message for kcsm transmission, then the message is formatted according to kcsm specifications with proper delimiters, segment terminators, and transmission structure.
  • Context - a formatted edi message ready for kcsm transmission:
    For Create Transmission Root Segment:
    When the system creates transmission control structures, then a transmission root segment (a9rt) is created with proper control information, sequence numbers, and transmission identifiers.
  • Context - a transmission root segment and formatted edi message data:
    For Create Transmission Dependent Segments:
    When the system creates transmission dependent segments, then transmission dependent segments (a9dp) are created containing the edi message data with proper linkage to the root segment.
  • Context - complete transmission root and dependent segments for kcsm message:
    For Store EDI Copy in Transmission File:
    When the system stores the edi copy in the transmission file, then the edi message copy is stored in the transmission file with proper indexing and control information for kcsm retrieval.
  • Context - an edi message copy stored in the transmission file:
    For Mark Message Ready for KCSM Transmission:
    When the system completes the kcsm copy creation process, then the message is marked with appropriate status indicators showing it is ready for kcsm transmission.
  • Context - an edi 350 message with a disposition code not configured for kcsm processing:
    For Skip KCSM Processing:
    When the system checks kcsm configuration requirements, then kcsm processing is skipped and the system continues with normal message processing without creating transmission copies.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message with a disposition code is being processed
GIVEN
An EDI 350 message with a disposition code is being processed
Applied to: Check if KCSM Processing Required
WHEN
The system checks the AECWRKTB KCSM configuration table for the disposition code
THEN
The system determines if KCSM processing is required based on the configuration entry
Context: A disposition code from the EDI 350 message
GIVEN
A disposition code from the EDI 350 message
Applied to: Disposition Code Configured for KCSM?
WHEN
The system looks up the disposition code in the KCSM configuration table
THEN
If the disposition code is found and marked for KCSM processing, proceed with EDI message copy creation, otherwise skip KCSM processing
Context: KCSM processing is required for the current message
GIVEN
KCSM processing is required for the current message
Applied to: Initialize EDI Message Copy Variables
WHEN
The system begins EDI message copy creation process
THEN
All EDI message copy variables, counters, and data structures are initialized to their default values
Context: An original EDI 350 message with header information
GIVEN
An original EDI 350 message with header information
Applied to: Copy Original EDI Message Header
WHEN
The system creates a copy for KCSM transmission
THEN
The original message header data is copied exactly to the transmission copy maintaining all header fields and values
Context: An EDI 350 message with ST transaction set header segment
GIVEN
An EDI 350 message with ST transaction set header segment
Applied to: Process ST Transaction Set Header
WHEN
The system processes the message for KCSM transmission
THEN
The ST segment is copied to the transmission file with proper formatting and sequence control
Context: An EDI 350 message with M10 manifest information segment
GIVEN
An EDI 350 message with M10 manifest information segment
Applied to: Copy M10 Manifest Information Segment
WHEN
The system creates KCSM transmission copy
THEN
The M10 segment with all manifest information is copied to the transmission file
Context: An EDI 350 message with P4 port information segment
GIVEN
An EDI 350 message with P4 port information segment
Applied to: Copy P4 Port Information Segment
WHEN
The system creates KCSM transmission copy
THEN
The P4 segment with all port information is copied to the transmission file
Context: An EDI 350 message with V9 event detail segment
GIVEN
An EDI 350 message with V9 event detail segment
Applied to: Copy V9 Event Detail Segment
WHEN
The system creates KCSM transmission copy
THEN
The V9 segment with all event detail information is copied to the transmission file
Context: An EDI 350 message being processed for KCSM transmission
GIVEN
An EDI 350 message being processed for KCSM transmission
Applied to: VID Equipment Segments Present?
WHEN
The system evaluates the message structure for VID segments
THEN
If VID equipment segments are present, they are processed and copied, otherwise the system continues to the next segment type
Context: An EDI 350 message with VID equipment information segments
GIVEN
An EDI 350 message with VID equipment information segments
Applied to: Copy VID Equipment Information
WHEN
The system processes VID segments for KCSM transmission
THEN
All VID equipment information is copied to the transmission file maintaining equipment details and relationships
Context: An EDI 350 message with K1 remarks segments
GIVEN
An EDI 350 message with K1 remarks segments
Applied to: Copy K1 Remarks Segments
WHEN
The system creates KCSM transmission copy
THEN
All K1 remarks segments with their associated information are copied to the transmission file
Context: An EDI 350 message with X4 customs release information segment
GIVEN
An EDI 350 message with X4 customs release information segment
Applied to: Copy X4 Customs Release Information
WHEN
The system creates KCSM transmission copy
THEN
The X4 segment with all customs release information including disposition codes is copied to the transmission file
Context: An EDI 350 message with N7 equipment details segment
GIVEN
An EDI 350 message with N7 equipment details segment
Applied to: Copy N7 Equipment Details
WHEN
The system creates KCSM transmission copy
THEN
The N7 segment with all equipment details and specifications is copied to the transmission file
Context: An EDI 350 message with SE transaction set trailer segment
GIVEN
An EDI 350 message with SE transaction set trailer segment
Applied to: Copy SE Transaction Set Trailer
WHEN
The system completes KCSM transmission copy creation
THEN
The SE trailer segment is copied to the transmission file with proper segment count and control number
Context: All EDI message segments have been copied for KCSM transmission
GIVEN
All EDI message segments have been copied for KCSM transmission
Applied to: Format Message for KCSM Transmission
WHEN
The system formats the message for KCSM transmission
THEN
The message is formatted according to KCSM specifications with proper delimiters, segment terminators, and transmission structure
Context: A formatted EDI message ready for KCSM transmission
GIVEN
A formatted EDI message ready for KCSM transmission
Applied to: Create Transmission Root Segment
WHEN
The system creates transmission control structures
THEN
A transmission root segment (A9RT) is created with proper control information, sequence numbers, and transmission identifiers
Context: A transmission root segment and formatted EDI message data
GIVEN
A transmission root segment and formatted EDI message data
Applied to: Create Transmission Dependent Segments
WHEN
The system creates transmission dependent segments
THEN
Transmission dependent segments (A9DP) are created containing the EDI message data with proper linkage to the root segment
Context: Complete transmission root and dependent segments for KCSM message
GIVEN
Complete transmission root and dependent segments for KCSM message
Applied to: Store EDI Copy in Transmission File
WHEN
The system stores the EDI copy in the transmission file
THEN
The EDI message copy is stored in the transmission file with proper indexing and control information for KCSM retrieval
Context: An EDI message copy stored in the transmission file
GIVEN
An EDI message copy stored in the transmission file
Applied to: Mark Message Ready for KCSM Transmission
WHEN
The system completes the KCSM copy creation process
THEN
The message is marked with appropriate status indicators showing it is ready for KCSM transmission
Context: An EDI 350 message with a disposition code not configured for KCSM processing
GIVEN
An EDI 350 message with a disposition code not configured for KCSM processing
Applied to: Skip KCSM Processing
WHEN
The system checks KCSM configuration requirements
THEN
KCSM processing is skipped and the system continues with normal message processing without creating transmission copies
R-GCX016-cbl-04169 (+7) File: GCX016.cbl Status Code Evaluation Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Code Evaluation':
  • Context - a disposition code of type arl (auto release) is being processed:
    For ARL Auto Release Code:
    When the system evaluates the disposition code type, then the auto release flag is set and the status array is re-evaluated to determine the final cargo release status.
  • Context - a disposition code of type mrl (manual release) is being processed:
    For MRL Manual Release Code:
    When the system evaluates the disposition code type, then the manual release flag is set and cprs manual release processing is initiated.
  • Context - a disposition code of removal type is being processed:
    For Removal Code Type:
    When the system evaluates the disposition code type, then the removal flag is set, counterpart codes are removed from the status array, and the code is added to the status array.
  • Context - a disposition code of hold type is being processed:
    For Hold Code Type:
    When the system evaluates the disposition code type, then the hold flag is set, location information is added, and the code is added to the status array.
  • Context - a disposition code of release type is being processed:
    For Release Code Type:
    When the system evaluates the disposition code type, then the release flag is set, released status is applied, and the code is added to the status array.
  • Context - a disposition code of status information type is being processed:
    For Status Information Code:
    When the system evaluates the disposition code type, then the information flag is set, status information is added, and the code is added to the status array.
  • Context - a standard disposition code is being processed:
    For Standard Disposition Code:
    When the system evaluates the disposition code type, then the code is added directly to the status array without additional flag setting or special processing.
  • Context - a disposition code needs to be added to the status array:
    For Array Full?:
    When the system checks the array capacity, then if the array is full, the addition is skipped; if not full, the code is added to the array.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code of type ARL (Auto Release) is being processed
GIVEN
A disposition code of type ARL (Auto Release) is being processed
Applied to: ARL Auto Release Code
WHEN
The system evaluates the disposition code type
THEN
The auto release flag is set and the status array is re-evaluated to determine the final cargo release status
Context: A disposition code of type MRL (Manual Release) is being processed
GIVEN
A disposition code of type MRL (Manual Release) is being processed
Applied to: MRL Manual Release Code
WHEN
The system evaluates the disposition code type
THEN
The manual release flag is set and CPRS manual release processing is initiated
Context: A disposition code of removal type is being processed
GIVEN
A disposition code of removal type is being processed
Applied to: Removal Code Type
WHEN
The system evaluates the disposition code type
THEN
The removal flag is set, counterpart codes are removed from the status array, and the code is added to the status array
Context: A disposition code of hold type is being processed
GIVEN
A disposition code of hold type is being processed
Applied to: Hold Code Type
WHEN
The system evaluates the disposition code type
THEN
The hold flag is set, location information is added, and the code is added to the status array
Context: A disposition code of release type is being processed
GIVEN
A disposition code of release type is being processed
Applied to: Release Code Type
WHEN
The system evaluates the disposition code type
THEN
The release flag is set, released status is applied, and the code is added to the status array
Context: A disposition code of status information type is being processed
GIVEN
A disposition code of status information type is being processed
Applied to: Status Information Code
WHEN
The system evaluates the disposition code type
THEN
The information flag is set, status information is added, and the code is added to the status array
Context: A standard disposition code is being processed
GIVEN
A standard disposition code is being processed
Applied to: Standard Disposition Code
WHEN
The system evaluates the disposition code type
THEN
The code is added directly to the status array without additional flag setting or special processing
Context: A disposition code needs to be added to the status array
GIVEN
A disposition code needs to be added to the status array
Applied to: Array Full?
WHEN
The system checks the array capacity
THEN
If the array is full, the addition is skipped; if not full, the code is added to the array
R-GCX016-cbl-04177 (+18) File: GCX016.cbl Final Status Determination Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Final Status Determination':
  • Context - cargo status array has been analyzed for hold conditions:
    For Check Hold Location:
    When hold status is present in the status array, then system checks hold location and sets appropriate hold classification flag.
  • Context - hold status is detected in cargo status array:
    For Set Border Hold Status:
    When hold location is classified as border hold, then system sets border hold status flag for the cargo.
    For Set Destination Hold Status:
    When hold location is classified as destination hold, then system sets destination hold status flag for the cargo.
  • Context - release status is present in cargo status array:
    For Check Release Quantities:
    When released quantity is greater than or equal to total cargo quantity, then system classifies as full release.
  • Context - release quantities have been validated:
    For Set Full Release Status:
    When released quantity equals or exceeds total cargo quantity, then system sets full release status flag for the cargo.
    For Set Partial Release Status:
    When released quantity is less than total cargo quantity, then system sets partial release status flag for the cargo.
  • Context - ptt status is detected in cargo status array:
    For Validate PTT Quantities:
    When cargo quantities meet or exceed ptt threshold requirements, then system validates ptt quantity eligibility.
  • Context - ptt quantities have been validated successfully:
    For Set PTT Status:
    When cargo meets all ptt eligibility criteria, then system sets ptt status flag for the cargo.
  • Context - proceed status is detected in cargo status array:
    For Set Proceed with Border Date:
    When cargo is eligible for proceed status, then system sets proceed status flag and assigns border arrival date.
  • Context - arrival status is detected in cargo status array:
    For Set Arrival Status:
    When cargo arrival conditions are met, then system sets arrival status flag for the cargo.
  • Context - export status is detected in cargo status array:
    For Set Export Status:
    When cargo export conditions are met, then system sets export status flag for the cargo.
  • Context - fda hold status is detected in cargo status array:
    For Set FDA Hold at Destination:
    When fda regulatory hold is required at destination, then system sets fda hold status flag at destination location.
  • Context - all status flags have been combined and analyzed:
    For Manual Release Required?:
    When cargo conditions indicate manual intervention is required for release, then system identifies manual release requirement.
  • Context - manual release requirement has been determined:
    For Set Manual Release Flag:
    When cargo requires manual release processing, then system sets manual release flag for the cargo.
  • Context - manual release processing has been evaluated:
    For Unrelease Detected?:
    When system detects cargo has been unreleased from previous release status, then system identifies unrelease condition.
  • Context - unrelease condition has been detected:
    For Set Unrelease Status:
    When cargo release status needs to be reversed, then system sets unrelease status flag for the cargo.
  • Context - multiple status flags and conditions have been identified:
    For Apply Business Rules Priority:
    When conflicting or multiple status conditions exist for the same cargo, then system applies business rule priority hierarchy to determine final status precedence.
  • Context - all status conditions have been analyzed and business rule priorities applied:
    For Set Final Cargo Status:
    When final status determination is required, then system sets the definitive cargo status based on highest priority applicable condition.
  • Context - final cargo status has been determined:
    For Update Cargo Record:
    When cargo record update is required, then system updates cargo record with final status, dates, and related status information.
👨‍💻 Technical ACs (Gherkin)
Context: Cargo status array has been analyzed for hold conditions
GIVEN
Cargo status array has been analyzed for hold conditions
Applied to: Check Hold Location
WHEN
Hold status is present in the status array
THEN
System checks hold location and sets appropriate hold classification flag
Context: Hold status is detected in cargo status array
GIVEN
Hold status is detected in cargo status array
Applied to: Set Border Hold Status
WHEN
Hold location is classified as border hold
THEN
System sets border hold status flag for the cargo
Applied to: Set Destination Hold Status
WHEN
Hold location is classified as destination hold
THEN
System sets destination hold status flag for the cargo
Context: Release status is present in cargo status array
GIVEN
Release status is present in cargo status array
Applied to: Check Release Quantities
WHEN
Released quantity is greater than or equal to total cargo quantity
THEN
System classifies as full release
Context: Release quantities have been validated
GIVEN
Release quantities have been validated
Applied to: Set Full Release Status
WHEN
Released quantity equals or exceeds total cargo quantity
THEN
System sets full release status flag for the cargo
Applied to: Set Partial Release Status
WHEN
Released quantity is less than total cargo quantity
THEN
System sets partial release status flag for the cargo
Context: PTT status is detected in cargo status array
GIVEN
PTT status is detected in cargo status array
Applied to: Validate PTT Quantities
WHEN
Cargo quantities meet or exceed PTT threshold requirements
THEN
System validates PTT quantity eligibility
Context: PTT quantities have been validated successfully
GIVEN
PTT quantities have been validated successfully
Applied to: Set PTT Status
WHEN
Cargo meets all PTT eligibility criteria
THEN
System sets PTT status flag for the cargo
Context: Proceed status is detected in cargo status array
GIVEN
Proceed status is detected in cargo status array
Applied to: Set Proceed with Border Date
WHEN
Cargo is eligible for proceed status
THEN
System sets proceed status flag and assigns border arrival date
Context: Arrival status is detected in cargo status array
GIVEN
Arrival status is detected in cargo status array
Applied to: Set Arrival Status
WHEN
Cargo arrival conditions are met
THEN
System sets arrival status flag for the cargo
Context: Export status is detected in cargo status array
GIVEN
Export status is detected in cargo status array
Applied to: Set Export Status
WHEN
Cargo export conditions are met
THEN
System sets export status flag for the cargo
Context: FDA hold status is detected in cargo status array
GIVEN
FDA hold status is detected in cargo status array
Applied to: Set FDA Hold at Destination
WHEN
FDA regulatory hold is required at destination
THEN
System sets FDA hold status flag at destination location
Context: All status flags have been combined and analyzed
GIVEN
All status flags have been combined and analyzed
Applied to: Manual Release Required?
WHEN
Cargo conditions indicate manual intervention is required for release
THEN
System identifies manual release requirement
Context: Manual release requirement has been determined
GIVEN
Manual release requirement has been determined
Applied to: Set Manual Release Flag
WHEN
Cargo requires manual release processing
THEN
System sets manual release flag for the cargo
Context: Manual release processing has been evaluated
GIVEN
Manual release processing has been evaluated
Applied to: Unrelease Detected?
WHEN
System detects cargo has been unreleased from previous release status
THEN
System identifies unrelease condition
Context: Unrelease condition has been detected
GIVEN
Unrelease condition has been detected
Applied to: Set Unrelease Status
WHEN
Cargo release status needs to be reversed
THEN
System sets unrelease status flag for the cargo
Context: Multiple status flags and conditions have been identified
GIVEN
Multiple status flags and conditions have been identified
Applied to: Apply Business Rules Priority
WHEN
Conflicting or multiple status conditions exist for the same cargo
THEN
System applies business rule priority hierarchy to determine final status precedence
Context: All status conditions have been analyzed and business rule priorities applied
GIVEN
All status conditions have been analyzed and business rule priorities applied
Applied to: Set Final Cargo Status
WHEN
Final status determination is required
THEN
System sets the definitive cargo status based on highest priority applicable condition
Context: Final cargo status has been determined
GIVEN
Final cargo status has been determined
Applied to: Update Cargo Record
WHEN
Cargo record update is required
THEN
System updates cargo record with final status, dates, and related status information
R-GCX016-cbl-04225 (+28) File: GCX016.cbl PTT Status Management Merged 29 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PTT Status Management':
  • Context - a cargo record is being processed for ptt status management:
    For Current Cargo Has PTT Status?:
    When the system checks the cargo's current status array for ptt indicators, then the system identifies whether ptt status exists and proceeds with appropriate ptt processing or skips ptt management.
  • Context - the cargo has an active ptt status:
    For Save Current PTT Status:
    When ptt status management begins, then the system saves the current ptt status details including quantities and status codes for potential restoration.
  • Context - ptt status information has been saved:
    For Validate PTT Quantities:
    When the system validates ptt quantities against business thresholds, then the system confirms ptt quantities are valid for continued processing or flags invalid quantities for correction.
  • Context - ptt quantities have been validated:
    For Released Quantity < Total Quantity?:
    When the system compares released quantity to total quantity, then if released quantity is less than total quantity, maintain ptt status for partial release, otherwise proceed with full release processing.
  • Context - released quantity is less than total quantity indicating partial release:
    For Maintain PTT Status:
    When the system processes ptt status maintenance, then the system preserves ptt status and calculates remaining ptt quantities for future processing.
  • Context - ptt status is being maintained for partial release:
    For Calculate Remaining PTT Quantity:
    When the system calculates remaining ptt quantity by subtracting released quantity from total quantity, then the system determines the exact remaining quantity that requires continued ptt processing.
  • Context - remaining ptt quantity has been calculated:
    For PTT Quantity Valid?:
    When the system validates the calculated ptt quantity against business rules, then if ptt quantity is valid, update status array, otherwise restore previous ptt status.
  • Context - ptt quantity has been validated as acceptable:
    For Update PTT Status in Status Array:
    When the system updates the status array with ptt information, then the status array contains current ptt status with accurate remaining quantities for continued processing.
  • Context - released quantity equals or exceeds total quantity indicating full release:
    For Clear PTT Status - Full Release:
    When the system processes full release status, then the system clears ptt status from the cargo record as ptt processing is complete.
  • Context - ptt quantity validation has failed or processing errors occurred:
    For Restore Previous PTT Status:
    When the system initiates ptt status restoration, then the system restores the previously saved ptt status information to maintain data integrity.
  • Context - ptt status processing has been completed (update, clear, or restore):
    For PTT Status Change Required?:
    When the system evaluates if ptt status has changed from the original state, then if ptt status has changed, proceed with logging, otherwise update cargo record directly.
  • Context - ptt status change has been identified as required:
    For Log PTT Status Change:
    When the system logs the ptt status change, then the system creates an audit record of the ptt status change with relevant details for compliance and tracking.
  • Context - ptt status processing is complete and any required logging has been performed:
    For Update Cargo Record with PTT Status:
    When the system updates the cargo record with final ptt status, then the cargo record reflects the accurate ptt status and quantities for future business operations.
  • Context - a cargo record is being processed for ptt status changes:
    For Save Current PTT Status:
    When ptt status management begins, then the current ptt status and quantity information is saved for potential restoration.
  • Context - a cargo record has a status array with multiple disposition codes:
    For Analyze Status Array for PTT Codes:
    When the system analyzes the status array for ptt processing, then all ptt-related codes are identified and their positions in the array are noted.
  • Context - the status array has been analyzed for ptt codes:
    For PTT Code Found?:
    When the system checks for ptt code existence, then if ptt codes are found, proceed with ptt quantity extraction, otherwise restore previous status.
  • Context - ptt codes exist in the status array:
    For Extract PTT Quantity Information:
    When the system extracts ptt information, then ptt quantity values are retrieved from the status array entries.
  • Context - ptt quantity information has been extracted from status array:
    For Validate PTT Quantity vs Released Quantity:
    When the system validates ptt quantities against released quantities, then ptt quantities must be within acceptable ranges relative to released quantities.
  • Context - ptt quantity validation has been performed:
    For Quantity Validation Passed?:
    When the system evaluates validation results, then if validation passes, set ptt status flag, otherwise generate ptt validation error.
  • Context - ptt quantity validation has passed successfully:
    For Set PTT Status Flag:
    When the system sets ptt status, then the ptt status flag is activated for the cargo record.
  • Context - ptt status flag has been set:
    For Update PTT Quantity in Status Array:
    When the system updates ptt quantities, then the status array is updated with current ptt quantity values.
  • Context - ptt quantities have been updated in the status array:
    For Partial Release Scenario?:
    When the system checks for partial release conditions, then if partial release is detected, preserve ptt status for remaining quantity, otherwise clear ptt status for released portion.
  • Context - a partial release scenario has been detected:
    For Preserve PTT Status for Remaining Quantity:
    When the system processes ptt status for remaining quantity, then ptt status is preserved for the unreleased portion of the cargo.
  • Context - cargo is not in a partial release scenario:
    For Clear PTT Status for Released Portion:
    When the system processes ptt status for released cargo, then ptt status is cleared for the released portion of the cargo.
  • Context - ptt processing cannot be completed or no ptt codes were found:
    For Restore Previous PTT Status if Needed:
    When the system needs to restore previous state, then the previously saved ptt status and quantity information is restored.
  • Context - ptt status processing has been completed:
    For Status Array Changes Required?:
    When the system checks if status array updates are needed, then if changes are required, update status array with ptt information, otherwise set cargo ptt processing flag.
  • Context - status array changes have been determined to be required:
    For Update Status Array with PTT Information:
    When the system updates the status array, then the status array is updated with final ptt status and quantity information.
  • Context - ptt status management processing is complete:
    For Set Cargo PTT Processing Flag:
    When the system finalizes ptt processing, then the cargo ptt processing flag is set to indicate completion.
  • Context - ptt quantity validation has failed:
    For PTT Validation Error:
    When the system processes the validation error, then an appropriate ptt validation error condition is set and processing continues to completion.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for PTT status management
GIVEN
A cargo record is being processed for PTT status management
Applied to: Current Cargo Has PTT Status?
WHEN
The system checks the cargo's current status array for PTT indicators
THEN
The system identifies whether PTT status exists and proceeds with appropriate PTT processing or skips PTT management
Context: The cargo has an active PTT status
GIVEN
The cargo has an active PTT status
Applied to: Save Current PTT Status
WHEN
PTT status management begins
THEN
The system saves the current PTT status details including quantities and status codes for potential restoration
Context: PTT status information has been saved
GIVEN
PTT status information has been saved
Applied to: Validate PTT Quantities
WHEN
The system validates PTT quantities against business thresholds
THEN
The system confirms PTT quantities are valid for continued processing or flags invalid quantities for correction
Context: PTT quantities have been validated
GIVEN
PTT quantities have been validated
Applied to: Released Quantity < Total Quantity?
WHEN
The system compares released quantity to total quantity
THEN
If released quantity is less than total quantity, maintain PTT status for partial release, otherwise proceed with full release processing
Context: Released quantity is less than total quantity indicating partial release
GIVEN
Released quantity is less than total quantity indicating partial release
Applied to: Maintain PTT Status
WHEN
The system processes PTT status maintenance
THEN
The system preserves PTT status and calculates remaining PTT quantities for future processing
Context: PTT status is being maintained for partial release
GIVEN
PTT status is being maintained for partial release
Applied to: Calculate Remaining PTT Quantity
WHEN
The system calculates remaining PTT quantity by subtracting released quantity from total quantity
THEN
The system determines the exact remaining quantity that requires continued PTT processing
Context: Remaining PTT quantity has been calculated
GIVEN
Remaining PTT quantity has been calculated
Applied to: PTT Quantity Valid?
WHEN
The system validates the calculated PTT quantity against business rules
THEN
If PTT quantity is valid, update status array, otherwise restore previous PTT status
Context: PTT quantity has been validated as acceptable
GIVEN
PTT quantity has been validated as acceptable
Applied to: Update PTT Status in Status Array
WHEN
The system updates the status array with PTT information
THEN
The status array contains current PTT status with accurate remaining quantities for continued processing
Context: Released quantity equals or exceeds total quantity indicating full release
GIVEN
Released quantity equals or exceeds total quantity indicating full release
Applied to: Clear PTT Status - Full Release
WHEN
The system processes full release status
THEN
The system clears PTT status from the cargo record as PTT processing is complete
Context: PTT quantity validation has failed or processing errors occurred
GIVEN
PTT quantity validation has failed or processing errors occurred
Applied to: Restore Previous PTT Status
WHEN
The system initiates PTT status restoration
THEN
The system restores the previously saved PTT status information to maintain data integrity
Context: PTT status processing has been completed (update, clear, or restore)
GIVEN
PTT status processing has been completed (update, clear, or restore)
Applied to: PTT Status Change Required?
WHEN
The system evaluates if PTT status has changed from the original state
THEN
If PTT status has changed, proceed with logging, otherwise update cargo record directly
Context: PTT status change has been identified as required
GIVEN
PTT status change has been identified as required
Applied to: Log PTT Status Change
WHEN
The system logs the PTT status change
THEN
The system creates an audit record of the PTT status change with relevant details for compliance and tracking
Context: PTT status processing is complete and any required logging has been performed
GIVEN
PTT status processing is complete and any required logging has been performed
Applied to: Update Cargo Record with PTT Status
WHEN
The system updates the cargo record with final PTT status
THEN
The cargo record reflects the accurate PTT status and quantities for future business operations
Context: A cargo record is being processed for PTT status changes
GIVEN
A cargo record is being processed for PTT status changes
Applied to: Save Current PTT Status
WHEN
PTT status management begins
THEN
The current PTT status and quantity information is saved for potential restoration
Context: A cargo record has a status array with multiple disposition codes
GIVEN
A cargo record has a status array with multiple disposition codes
Applied to: Analyze Status Array for PTT Codes
WHEN
The system analyzes the status array for PTT processing
THEN
All PTT-related codes are identified and their positions in the array are noted
Context: The status array has been analyzed for PTT codes
GIVEN
The status array has been analyzed for PTT codes
Applied to: PTT Code Found?
WHEN
The system checks for PTT code existence
THEN
If PTT codes are found, proceed with PTT quantity extraction, otherwise restore previous status
Context: PTT codes exist in the status array
GIVEN
PTT codes exist in the status array
Applied to: Extract PTT Quantity Information
WHEN
The system extracts PTT information
THEN
PTT quantity values are retrieved from the status array entries
Context: PTT quantity information has been extracted from status array
GIVEN
PTT quantity information has been extracted from status array
Applied to: Validate PTT Quantity vs Released Quantity
WHEN
The system validates PTT quantities against released quantities
THEN
PTT quantities must be within acceptable ranges relative to released quantities
Context: PTT quantity validation has been performed
GIVEN
PTT quantity validation has been performed
Applied to: Quantity Validation Passed?
WHEN
The system evaluates validation results
THEN
If validation passes, set PTT status flag, otherwise generate PTT validation error
Context: PTT quantity validation has passed successfully
GIVEN
PTT quantity validation has passed successfully
Applied to: Set PTT Status Flag
WHEN
The system sets PTT status
THEN
The PTT status flag is activated for the cargo record
Context: PTT status flag has been set
GIVEN
PTT status flag has been set
Applied to: Update PTT Quantity in Status Array
WHEN
The system updates PTT quantities
THEN
The status array is updated with current PTT quantity values
Context: PTT quantities have been updated in the status array
GIVEN
PTT quantities have been updated in the status array
Applied to: Partial Release Scenario?
WHEN
The system checks for partial release conditions
THEN
If partial release is detected, preserve PTT status for remaining quantity, otherwise clear PTT status for released portion
Context: A partial release scenario has been detected
GIVEN
A partial release scenario has been detected
Applied to: Preserve PTT Status for Remaining Quantity
WHEN
The system processes PTT status for remaining quantity
THEN
PTT status is preserved for the unreleased portion of the cargo
Context: Cargo is not in a partial release scenario
GIVEN
Cargo is not in a partial release scenario
Applied to: Clear PTT Status for Released Portion
WHEN
The system processes PTT status for released cargo
THEN
PTT status is cleared for the released portion of the cargo
Context: PTT processing cannot be completed or no PTT codes were found
GIVEN
PTT processing cannot be completed or no PTT codes were found
Applied to: Restore Previous PTT Status if Needed
WHEN
The system needs to restore previous state
THEN
The previously saved PTT status and quantity information is restored
Context: PTT status processing has been completed
GIVEN
PTT status processing has been completed
Applied to: Status Array Changes Required?
WHEN
The system checks if status array updates are needed
THEN
If changes are required, update status array with PTT information, otherwise set cargo PTT processing flag
Context: Status array changes have been determined to be required
GIVEN
Status array changes have been determined to be required
Applied to: Update Status Array with PTT Information
WHEN
The system updates the status array
THEN
The status array is updated with final PTT status and quantity information
Context: PTT status management processing is complete
GIVEN
PTT status management processing is complete
Applied to: Set Cargo PTT Processing Flag
WHEN
The system finalizes PTT processing
THEN
The cargo PTT processing flag is set to indicate completion
Context: PTT quantity validation has failed
GIVEN
PTT quantity validation has failed
Applied to: PTT Validation Error
WHEN
The system processes the validation error
THEN
An appropriate PTT validation error condition is set and processing continues to completion
R-GCX016-cbl-04238 (+6) File: GCX016.cbl Partial vs Full Release Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Partial vs Full Release Processing':
  • Context - a cargo record with total quantity and released quantity values:
    For Check Released Quantity vs Total Quantity:
    When the system compares released quantity to total quantity, then the system determines if cargo is partially released (released quantity < total quantity) or fully released (released quantity = total quantity).
  • Context - a cargo record where released quantity is less than total quantity:
    For Set Hold on Piece Counts Status:
    When the system processes the partial release, then the system sets cargo status to 'holdpcs' (hold on piece counts) to indicate partial release.
  • Context - a cargo record where released quantity equals or exceeds total quantity:
    For Set Full Release Status:
    When the system processes the full release, then the system sets cargo status to indicate full release and removes any partial release indicators.
  • Context - a cargo record that has been fully released:
    For Clear Destination Index:
    When the system processes the full release status, then the system clears the destination index field to remove destination processing requirements.
  • Context - a cargo record that has been fully released and had its destination index cleared:
    For Update Cargo Status to Released:
    When the system completes full release processing, then the system updates the cargo status to 'released' or equivalent release status code.
  • Context - a cargo record with partial release where released quantity is less than total quantity:
    For Preserve Remaining Held Quantity:
    When the system processes the partial release, then the system calculates remaining held quantity as (total quantity - released quantity) and preserves this value for future processing.
  • Context - a cargo record that has been processed for partial release with remaining held quantity preserved:
    For Mark Cargo as Partially Released:
    When the system finalizes partial release processing, then the system marks the cargo record with partial release status indicators and maintains tracking of unreleased portions.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with total quantity and released quantity values
GIVEN
A cargo record with total quantity and released quantity values
Applied to: Check Released Quantity vs Total Quantity
WHEN
The system compares released quantity to total quantity
THEN
The system determines if cargo is partially released (released quantity < total quantity) or fully released (released quantity = total quantity)
Context: A cargo record where released quantity is less than total quantity
GIVEN
A cargo record where released quantity is less than total quantity
Applied to: Set Hold on Piece Counts Status
WHEN
The system processes the partial release
THEN
The system sets cargo status to 'HOLDPCS' (Hold on Piece Counts) to indicate partial release
Context: A cargo record where released quantity equals or exceeds total quantity
GIVEN
A cargo record where released quantity equals or exceeds total quantity
Applied to: Set Full Release Status
WHEN
The system processes the full release
THEN
The system sets cargo status to indicate full release and removes any partial release indicators
Context: A cargo record that has been fully released
GIVEN
A cargo record that has been fully released
Applied to: Clear Destination Index
WHEN
The system processes the full release status
THEN
The system clears the destination index field to remove destination processing requirements
Context: A cargo record that has been fully released and had its destination index cleared
GIVEN
A cargo record that has been fully released and had its destination index cleared
Applied to: Update Cargo Status to Released
WHEN
The system completes full release processing
THEN
The system updates the cargo status to 'RELEASED' or equivalent release status code
Context: A cargo record with partial release where released quantity is less than total quantity
GIVEN
A cargo record with partial release where released quantity is less than total quantity
Applied to: Preserve Remaining Held Quantity
WHEN
The system processes the partial release
THEN
The system calculates remaining held quantity as (total quantity - released quantity) and preserves this value for future processing
Context: A cargo record that has been processed for partial release with remaining held quantity preserved
GIVEN
A cargo record that has been processed for partial release with remaining held quantity preserved
Applied to: Mark Cargo as Partially Released
WHEN
The system finalizes partial release processing
THEN
The system marks the cargo record with partial release status indicators and maintains tracking of unreleased portions
R-GCX016-cbl-04245 (+12) File: GCX016.cbl Status Transition Logic Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Transition Logic':
  • Context - a cargo record is being processed for status transition:
    For Manual Release Flag Set?:
    When the manual release flag is set to true, then the system clears the destination index and processes canadian manifest coordination.
  • Context - a cargo record is undergoing status evaluation:
    For FDA Hold at Destination?:
    When fda hold conditions are present at the destination location, then the system sets fda hold status with status code 66.
    For Arrival Status Present?:
    When arrival status is present on the cargo, then the system sets arrival status and clears the destination index.
  • Context - a cargo record has existing status information:
    For PTT Status Present?:
    When ptt status is currently present on the cargo, then the system saves and preserves the current ptt status.
  • Context - a cargo record has both released quantity and total quantity values:
    For Released Quantity < Total Quantity?:
    When the released quantity is less than the total quantity, then the system sets hold on piece counts status to indicate partial release.
  • Context - a cargo record has released quantity and total quantity values:
    For Released Quantity = Total Quantity?:
    When the released quantity equals the total quantity exactly, then the system sets full release status and clears the destination index.
  • Context - a cargo record is being evaluated for status changes:
    For Proceed Status Present?:
    When proceed status is present on the cargo, then the system sets proceed status and updates the border arrival date.
  • Context - a cargo record has hold status present:
    For Hold at Border?:
    When the hold location is determined to be at the border, then the system sets border hold status.
    For Hold Status Present?:
    When the hold location is not at the border, then the system sets destination hold status.
  • Context - a cargo record is being processed for status changes:
    For Export Status Present?:
    When export status is present on the cargo, then the system sets export status and clears the destination index.
  • Context - a cargo record has historical release status information:
    For Previously Released but Now Unreleased?:
    When the cargo was previously released but current processing indicates it is now unreleased, then the system generates unrelease notification and re-establishes the destination index.
  • Context - a cargo record requires age calculation for processing decisions:
    For Calculate Cargo Age using Julian Date:
    When the system needs to determine cargo age, then the system calculates cargo age using julian date format.
  • Context - all status transition logic has been evaluated for a cargo record:
    For Determine Final Cargo Status:
    When the system needs to finalize the cargo status, then the system determines and assigns the final cargo status based on all evaluated conditions.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for status transition
GIVEN
A cargo record is being processed for status transition
Applied to: Manual Release Flag Set?
WHEN
The manual release flag is set to true
THEN
The system clears the destination index and processes Canadian manifest coordination
Context: A cargo record is undergoing status evaluation
GIVEN
A cargo record is undergoing status evaluation
Applied to: FDA Hold at Destination?
WHEN
FDA hold conditions are present at the destination location
THEN
The system sets FDA hold status with status code 66
Applied to: Arrival Status Present?
WHEN
Arrival status is present on the cargo
THEN
The system sets arrival status and clears the destination index
Context: A cargo record has existing status information
GIVEN
A cargo record has existing status information
Applied to: PTT Status Present?
WHEN
PTT status is currently present on the cargo
THEN
The system saves and preserves the current PTT status
Context: A cargo record has both released quantity and total quantity values
GIVEN
A cargo record has both released quantity and total quantity values
Applied to: Released Quantity < Total Quantity?
WHEN
The released quantity is less than the total quantity
THEN
The system sets hold on piece counts status to indicate partial release
Context: A cargo record has released quantity and total quantity values
GIVEN
A cargo record has released quantity and total quantity values
Applied to: Released Quantity = Total Quantity?
WHEN
The released quantity equals the total quantity exactly
THEN
The system sets full release status and clears the destination index
Context: A cargo record is being evaluated for status changes
GIVEN
A cargo record is being evaluated for status changes
Applied to: Proceed Status Present?
WHEN
Proceed status is present on the cargo
THEN
The system sets proceed status and updates the border arrival date
Context: A cargo record has hold status present
GIVEN
A cargo record has hold status present
Applied to: Hold at Border?
WHEN
The hold location is determined to be at the border
THEN
The system sets border hold status
Applied to: Hold Status Present?
WHEN
The hold location is not at the border
THEN
The system sets destination hold status
Context: A cargo record is being processed for status changes
GIVEN
A cargo record is being processed for status changes
Applied to: Export Status Present?
WHEN
Export status is present on the cargo
THEN
The system sets export status and clears the destination index
Context: A cargo record has historical release status information
GIVEN
A cargo record has historical release status information
Applied to: Previously Released but Now Unreleased?
WHEN
The cargo was previously released but current processing indicates it is now unreleased
THEN
The system generates unrelease notification and re-establishes the destination index
Context: A cargo record requires age calculation for processing decisions
GIVEN
A cargo record requires age calculation for processing decisions
Applied to: Calculate Cargo Age using Julian Date
WHEN
The system needs to determine cargo age
THEN
The system calculates cargo age using Julian date format
Context: All status transition logic has been evaluated for a cargo record
GIVEN
All status transition logic has been evaluated for a cargo record
Applied to: Determine Final Cargo Status
WHEN
The system needs to finalize the cargo status
THEN
The system determines and assigns the final cargo status based on all evaluated conditions
R-GCX016-cbl-04258 (+13) File: GCX016.cbl Process Disposition Code for Cargo Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Disposition Code for Cargo':
  • Context - a disposition code from x4 segment needs to be processed for cargo:
    For 218:Disposition Code Table Lookup:
    When the system looks up the disposition code in the gcstbrt disposition code table, then the system determines if the disposition code is valid and retrieves associated processing rules.
  • Context - a disposition code lookup has failed in the disposition code table:
    For 228:Disposition Code Error Handling:
    When the disposition code is not found in gcstbrt table, then the system generates an error message and stops processing for this disposition code.
  • Context - a disposition code is classified as arl (auto release) type:
    For 232:ARL Auto Release Array Re-evaluation:
    When the system processes the arl disposition code, then the system re-evaluates the entire status array and applies auto release logic without adding the code to the array.
  • Context - a disposition code is classified as mrl (manual release) type for cprs cargo:
    For 233:Manual Release Processing for CPRS:
    When the system processes the mrl disposition code, then the system processes the manual release without adding the disposition code to the status array and updates cargo status accordingly.
  • Context - a disposition code requires counterpart removal and the status array contains existing codes:
    For 219:Counterpart Disposition Code Removal:
    When the system processes a disposition code with counterpart removal requirements, then the system removes all counterpart disposition codes from the status array before adding the new code.
  • Context - a disposition code is classified as a hold code type:
    For 61:Hold Code Processing:
    When the system processes the hold disposition code, then the system adds the hold code to the status array with appropriate hold flags and location information.
  • Context - a disposition code is classified as a release code type:
    For 62:Release Code Processing:
    When the system processes the release disposition code, then the system adds the release code to the status array with release flags and updates release quantities.
  • Context - a disposition code is classified as status information type:
    For 63:Status Info Processing:
    When the system processes the status information disposition code, then the system adds the information code to the status array with status info flags without affecting quantities.
  • Context - a disposition code is classified as release with counterpart removal type:
    For 235:Release Code with Counterpart Removal:
    When the system processes the release disposition code with counterpart removal, then the system removes counterpart codes from status array and adds the release code with release flags.
  • Context - a disposition code is classified as information with counterpart removal type:
    For 236:Information Code with Counterpart Removal:
    When the system processes the information disposition code with counterpart removal, then the system removes counterpart codes from status array and adds the information code with status info flags.
  • Context - a disposition code is ready to be added to the status array:
    For 221:Disposition Code Duplicate Prevention:
    When the system checks if the same disposition code already exists in the status array, then the system skips adding the code if a duplicate is found, otherwise proceeds with adding the code.
  • Context - a disposition code has been added to the status array:
    For 238:Quantity Action Processing for Release Codes:
    When the system evaluates if the disposition code affects release quantities, then the system determines whether to add, subtract, or leave release quantities unchanged based on the code type.
  • Context - a disposition code requires quantity impact and current release quantities exist:
    For 226:Release Quantity Calculation:
    When the system processes quantity changes for add or subtract actions, then the system updates release quantities ensuring they do not go below zero for subtract actions.
  • Context - the status array has been modified with new disposition codes:
    For 217:Status Array Persistence:
    When all disposition code processing is complete, then the system updates the cargo s09 status segments with the modified status array information.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code from X4 segment needs to be processed for cargo
GIVEN
A disposition code from X4 segment needs to be processed for cargo
Applied to: 218:Disposition Code Table Lookup
WHEN
The system looks up the disposition code in the GCSTBRT disposition code table
THEN
The system determines if the disposition code is valid and retrieves associated processing rules
Context: A disposition code lookup has failed in the disposition code table
GIVEN
A disposition code lookup has failed in the disposition code table
Applied to: 228:Disposition Code Error Handling
WHEN
The disposition code is not found in GCSTBRT table
THEN
The system generates an error message and stops processing for this disposition code
Context: A disposition code is classified as ARL (Auto Release) type
GIVEN
A disposition code is classified as ARL (Auto Release) type
Applied to: 232:ARL Auto Release Array Re-evaluation
WHEN
The system processes the ARL disposition code
THEN
The system re-evaluates the entire status array and applies auto release logic without adding the code to the array
Context: A disposition code is classified as MRL (Manual Release) type for CPRS cargo
GIVEN
A disposition code is classified as MRL (Manual Release) type for CPRS cargo
Applied to: 233:Manual Release Processing for CPRS
WHEN
The system processes the MRL disposition code
THEN
The system processes the manual release without adding the disposition code to the status array and updates cargo status accordingly
Context: A disposition code requires counterpart removal and the status array contains existing codes
GIVEN
A disposition code requires counterpart removal and the status array contains existing codes
Applied to: 219:Counterpart Disposition Code Removal
WHEN
The system processes a disposition code with counterpart removal requirements
THEN
The system removes all counterpart disposition codes from the status array before adding the new code
Context: A disposition code is classified as a hold code type
GIVEN
A disposition code is classified as a hold code type
Applied to: 61:Hold Code Processing
WHEN
The system processes the hold disposition code
THEN
The system adds the hold code to the status array with appropriate hold flags and location information
Context: A disposition code is classified as a release code type
GIVEN
A disposition code is classified as a release code type
Applied to: 62:Release Code Processing
WHEN
The system processes the release disposition code
THEN
The system adds the release code to the status array with release flags and updates release quantities
Context: A disposition code is classified as status information type
GIVEN
A disposition code is classified as status information type
Applied to: 63:Status Info Processing
WHEN
The system processes the status information disposition code
THEN
The system adds the information code to the status array with status info flags without affecting quantities
Context: A disposition code is classified as release with counterpart removal type
GIVEN
A disposition code is classified as release with counterpart removal type
Applied to: 235:Release Code with Counterpart Removal
WHEN
The system processes the release disposition code with counterpart removal
THEN
The system removes counterpart codes from status array and adds the release code with release flags
Context: A disposition code is classified as information with counterpart removal type
GIVEN
A disposition code is classified as information with counterpart removal type
Applied to: 236:Information Code with Counterpart Removal
WHEN
The system processes the information disposition code with counterpart removal
THEN
The system removes counterpart codes from status array and adds the information code with status info flags
Context: A disposition code is ready to be added to the status array
GIVEN
A disposition code is ready to be added to the status array
Applied to: 221:Disposition Code Duplicate Prevention
WHEN
The system checks if the same disposition code already exists in the status array
THEN
The system skips adding the code if a duplicate is found, otherwise proceeds with adding the code
Context: A disposition code has been added to the status array
GIVEN
A disposition code has been added to the status array
Applied to: 238:Quantity Action Processing for Release Codes
WHEN
The system evaluates if the disposition code affects release quantities
THEN
The system determines whether to add, subtract, or leave release quantities unchanged based on the code type
Context: A disposition code requires quantity impact and current release quantities exist
GIVEN
A disposition code requires quantity impact and current release quantities exist
Applied to: 226:Release Quantity Calculation
WHEN
The system processes quantity changes for add or subtract actions
THEN
The system updates release quantities ensuring they do not go below zero for subtract actions
Context: The status array has been modified with new disposition codes
GIVEN
The status array has been modified with new disposition codes
Applied to: 217:Status Array Persistence
WHEN
All disposition code processing is complete
THEN
The system updates the cargo S09 status segments with the modified status array information
R-GCX016-cbl-04272 (+10) File: GCX016.cbl Fallback Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Fallback Processing':
  • Context - cargo was not found using primary search methods:
    For Car ID Available?:
    When system checks for car id availability in the message data, then if car id is present, proceed with car id search, otherwise create new foreign bill record.
  • Context - car id is available in the message data:
    For B530: Attempt Car ID Only Search:
    When system executes car id only search using gccusio with car id index, then system retrieves cargo records matching the car identification.
  • Context - car id search has been executed:
    For Cargo Found by Car ID?:
    When system evaluates the search results, then if cargo records are found, proceed with us-ccn validation, otherwise attempt broader search.
  • Context - cargo record was found using car id search:
    For US-CCN Matches?:
    When system compares the us-ccn key from the message with the cargo record us-ccn, then if us-ccn keys match exactly, use the found cargo record, otherwise try broader search without us-ccn.
  • Context - us-ccn key does not match or car id search failed:
    For Try Broader Search Without US-CCN:
    When system executes broader search criteria without us-ccn validation, then system retrieves any cargo records matching available search criteria.
  • Context - multiple cargo records were found in broader search:
    For Validate Multiple Waybill Numbers:
    When system compares waybill numbers from message against found cargo records, then if waybill validation passes, select best matching cargo record, otherwise create new foreign bill.
  • Context - no existing cargo record could be found or validated:
    For C200: Create Foreign Bill Record:
    When system initiates foreign bill creation process, then new cargo record is created with default values and manifest information.
  • Context - new foreign bill record is being created:
    For Set CPRS/USCS Status Codes:
    When system determines if cargo is cprs or uscs type, then if cprs cargo, set status to error, otherwise set status to sent.
  • Context - new cargo record has entry type code 61, 62, 63, or 69:
    For Handle Master In-Bond Types 61,62,63,69:
    When system processes master in-bond entry type, then set master in-bond flag and apply specific processing rules: 61 for immediate transport, 62 for transport export, 63 for immediate export, 69 for us-canada-us movement.
  • Context - new cargo record has entry type code 00:
    For Handle Border Entry Type 00:
    When system processes border entry type, then clear bond information and apply default border processing rules.
  • Context - new cargo record has been initialized with entry type processing:
    For Map Transport Type Codes:
    When system maps transport type codes from message data, then assign appropriate transport category and processing flags based on transport type.
👨‍💻 Technical ACs (Gherkin)
Context: Cargo was not found using primary search methods
GIVEN
Cargo was not found using primary search methods
Applied to: Car ID Available?
WHEN
System checks for car ID availability in the message data
THEN
If car ID is present, proceed with car ID search, otherwise create new foreign bill record
Context: Car ID is available in the message data
GIVEN
Car ID is available in the message data
Applied to: B530: Attempt Car ID Only Search
WHEN
System executes car ID only search using GCCUSIO with car ID index
THEN
System retrieves cargo records matching the car identification
Context: Car ID search has been executed
GIVEN
Car ID search has been executed
Applied to: Cargo Found by Car ID?
WHEN
System evaluates the search results
THEN
If cargo records are found, proceed with US-CCN validation, otherwise attempt broader search
Context: Cargo record was found using car ID search
GIVEN
Cargo record was found using car ID search
Applied to: US-CCN Matches?
WHEN
System compares the US-CCN key from the message with the cargo record US-CCN
THEN
If US-CCN keys match exactly, use the found cargo record, otherwise try broader search without US-CCN
Context: US-CCN key does not match or car ID search failed
GIVEN
US-CCN key does not match or car ID search failed
Applied to: Try Broader Search Without US-CCN
WHEN
System executes broader search criteria without US-CCN validation
THEN
System retrieves any cargo records matching available search criteria
Context: Multiple cargo records were found in broader search
GIVEN
Multiple cargo records were found in broader search
Applied to: Validate Multiple Waybill Numbers
WHEN
System compares waybill numbers from message against found cargo records
THEN
If waybill validation passes, select best matching cargo record, otherwise create new foreign bill
Context: No existing cargo record could be found or validated
GIVEN
No existing cargo record could be found or validated
Applied to: C200: Create Foreign Bill Record
WHEN
System initiates foreign bill creation process
THEN
New cargo record is created with default values and manifest information
Context: New foreign bill record is being created
GIVEN
New foreign bill record is being created
Applied to: Set CPRS/USCS Status Codes
WHEN
System determines if cargo is CPRS or USCS type
THEN
If CPRS cargo, set status to ERROR, otherwise set status to SENT
Context: New cargo record has entry type code 61, 62, 63, or 69
GIVEN
New cargo record has entry type code 61, 62, 63, or 69
Applied to: Handle Master In-Bond Types 61,62,63,69
WHEN
System processes master in-bond entry type
THEN
Set master in-bond flag and apply specific processing rules: 61 for immediate transport, 62 for transport export, 63 for immediate export, 69 for US-Canada-US movement
Context: New cargo record has entry type code 00
GIVEN
New cargo record has entry type code 00
Applied to: Handle Border Entry Type 00
WHEN
System processes border entry type
THEN
Clear bond information and apply default border processing rules
Context: New cargo record has been initialized with entry type processing
GIVEN
New cargo record has been initialized with entry type processing
Applied to: Map Transport Type Codes
WHEN
System maps transport type codes from message data
THEN
Assign appropriate transport category and processing flags based on transport type
R-GCX016-cbl-04283 (+13) File: GCX016.cbl Process Counterpart Code Removal Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Counterpart Code Removal':
  • Context - a disposition code exists in the current processing context:
    For Get Counterpart Code from DC Table:
    When the system needs to find counterpart codes for removal, then the counterpart disposition code is retrieved from the dc table lookup.
  • Context - a dc table lookup has been performed for counterpart codes:
    For Counterpart Code Exists?:
    When the system evaluates the lookup result, then if no counterpart code exists, skip counterpart removal processing, otherwise proceed with status array search.
  • Context - a valid counterpart disposition code exists from the dc table:
    For Search Status Array for Matching Codes:
    When the system searches the status array for matching codes, then all status array elements are examined for potential counterpart code matches.
  • Context - the status array has been searched for counterpart codes:
    For Match Found in Array?:
    When the system evaluates the search results, then if no matches are found, end the counterpart removal process, otherwise proceed with detailed matching validation.
  • Context - a potential counterpart code match has been found in the status array:
    For Status Info Matches?:
    When the system compares status information fields, then if status info matches exactly, mark the element for removal, otherwise continue with entry number validation.
  • Context - status info validation failed for a counterpart code match:
    For Entry Number Matches?:
    When the system compares entry number fields, then if entry numbers match exactly, mark the element for removal, otherwise continue with quantity validation.
  • Context - entry number validation failed for a counterpart code match:
    For Quantity Matches?:
    When the system compares quantity fields, then if quantities match exactly, mark the element for removal, otherwise continue with code pattern validation.
  • Context - quantity validation failed for a counterpart code match:
    For Code Pattern Matches?:
    When the system evaluates specific code pattern matching rules, then if the code pattern matches specific business rules, mark the element for removal, otherwise continue searching.
  • Context - a counterpart code has passed all validation criteria:
    For Mark Array Element for Removal:
    When the system processes the validated match, then the array element is marked for removal and the system continues searching for additional matches.
  • Context - the current status array element has been processed:
    For More Elements to Check?:
    When the system evaluates remaining array elements, then if more elements exist, continue the search process, otherwise proceed to remove marked elements.
  • Context - one or more status array elements have been marked for removal:
    For Remove Marked Elements from Array:
    When the system processes the removal operation, then all marked elements are removed from the status array.
  • Context - counterpart code elements have been removed from the status array:
    For Compact Remaining Array Elements:
    When the system compacts the array structure, then remaining array elements are moved to eliminate gaps and maintain proper array structure.
  • Context - the status array has been compacted after counterpart removal:
    For Update Array Element Count:
    When the system finalizes the array structure, then the array element count is updated to reflect the current number of active status entries.
  • Context - no counterpart disposition code exists in the dc table:
    For No Counterpart Action Required:
    When the system evaluates counterpart processing requirements, then counterpart removal processing is skipped and the process ends normally.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code exists in the current processing context
GIVEN
A disposition code exists in the current processing context
Applied to: Get Counterpart Code from DC Table
WHEN
The system needs to find counterpart codes for removal
THEN
The counterpart disposition code is retrieved from the DC table lookup
Context: A DC table lookup has been performed for counterpart codes
GIVEN
A DC table lookup has been performed for counterpart codes
Applied to: Counterpart Code Exists?
WHEN
The system evaluates the lookup result
THEN
If no counterpart code exists, skip counterpart removal processing, otherwise proceed with status array search
Context: A valid counterpart disposition code exists from the DC table
GIVEN
A valid counterpart disposition code exists from the DC table
Applied to: Search Status Array for Matching Codes
WHEN
The system searches the status array for matching codes
THEN
All status array elements are examined for potential counterpart code matches
Context: The status array has been searched for counterpart codes
GIVEN
The status array has been searched for counterpart codes
Applied to: Match Found in Array?
WHEN
The system evaluates the search results
THEN
If no matches are found, end the counterpart removal process, otherwise proceed with detailed matching validation
Context: A potential counterpart code match has been found in the status array
GIVEN
A potential counterpart code match has been found in the status array
Applied to: Status Info Matches?
WHEN
The system compares status information fields
THEN
If status info matches exactly, mark the element for removal, otherwise continue with entry number validation
Context: Status info validation failed for a counterpart code match
GIVEN
Status info validation failed for a counterpart code match
Applied to: Entry Number Matches?
WHEN
The system compares entry number fields
THEN
If entry numbers match exactly, mark the element for removal, otherwise continue with quantity validation
Context: Entry number validation failed for a counterpart code match
GIVEN
Entry number validation failed for a counterpart code match
Applied to: Quantity Matches?
WHEN
The system compares quantity fields
THEN
If quantities match exactly, mark the element for removal, otherwise continue with code pattern validation
Context: Quantity validation failed for a counterpart code match
GIVEN
Quantity validation failed for a counterpart code match
Applied to: Code Pattern Matches?
WHEN
The system evaluates specific code pattern matching rules
THEN
If the code pattern matches specific business rules, mark the element for removal, otherwise continue searching
Context: A counterpart code has passed all validation criteria
GIVEN
A counterpart code has passed all validation criteria
Applied to: Mark Array Element for Removal
WHEN
The system processes the validated match
THEN
The array element is marked for removal and the system continues searching for additional matches
Context: The current status array element has been processed
GIVEN
The current status array element has been processed
Applied to: More Elements to Check?
WHEN
The system evaluates remaining array elements
THEN
If more elements exist, continue the search process, otherwise proceed to remove marked elements
Context: One or more status array elements have been marked for removal
GIVEN
One or more status array elements have been marked for removal
Applied to: Remove Marked Elements from Array
WHEN
The system processes the removal operation
THEN
All marked elements are removed from the status array
Context: Counterpart code elements have been removed from the status array
GIVEN
Counterpart code elements have been removed from the status array
Applied to: Compact Remaining Array Elements
WHEN
The system compacts the array structure
THEN
Remaining array elements are moved to eliminate gaps and maintain proper array structure
Context: The status array has been compacted after counterpart removal
GIVEN
The status array has been compacted after counterpart removal
Applied to: Update Array Element Count
WHEN
The system finalizes the array structure
THEN
The array element count is updated to reflect the current number of active status entries
Context: No counterpart disposition code exists in the DC table
GIVEN
No counterpart disposition code exists in the DC table
Applied to: No Counterpart Action Required
WHEN
The system evaluates counterpart processing requirements
THEN
Counterpart removal processing is skipped and the process ends normally
R-GCX016-cbl-04297 (+11) File: GCX016.cbl Array Modifications Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Array Modifications Processing':
  • Context - a disposition code of type arl (auto release) is being processed:
    For ARL Auto Release - Re-evaluate Array:
    When the system encounters an arl disposition code, then the system re-evaluates the status array and proceeds to capacity checking.
  • Context - a disposition code of type mrl (manual release) is being processed:
    For MRL Manual Release - Force Processing:
    When the system encounters an mrl disposition code, then the system forces processing and proceeds to capacity checking.
  • Context - a new disposition code needs to be added to the status array:
    For Array Overflow Protection:
    When the array capacity is exceeded or at maximum limit, then the system terminates processing to prevent overflow and completes array modifications.
  • Context - a disposition code is being added to the status array:
    For Skip Duplicate Entry:
    When the same disposition code already exists in the array, then the system skips adding the duplicate entry and completes array modifications.
  • Context - a new disposition code is being added that has a defined counterpart code:
    For Remove Counterpart Code:
    When the counterpart code is found in the status array, then the system removes the counterpart code and compacts the array before adding the new code.
  • Context - one or more disposition codes have been removed from the status array:
    For Compact Array Elements:
    When array compaction is required, then the system shifts remaining elements to fill gaps and updates the array count.
  • Context - a disposition code requires location information and border location is specified:
    For Add Border Location:
    When the system processes location information for the disposition code, then the system adds border location information to the status entry and updates the released flag.
  • Context - a disposition code requires location information and destination location is specified:
    For Add Destination Location:
    When the system processes location information for the disposition code, then the system adds destination location information to the status entry and updates the released flag.
  • Context - a disposition code requires quantity action of type add:
    For Process Add Quantity:
    When the system processes the quantity action, then the system adds the specified quantity to the release amount and proceeds to array compaction.
  • Context - a disposition code requires quantity action of type subtract:
    For Process Subtract Quantity:
    When the system processes the quantity action, then the system subtracts the specified quantity from the release amount and proceeds to array compaction.
  • Context - a disposition code is for informational purposes only:
    For Set Information Flag Only:
    When the system processes the information-only disposition code, then the system sets the information flag without processing quantities and proceeds to array compaction.
  • Context - array modifications have been completed including compaction and count updates:
    For Validate Array Integrity:
    When the system validates array integrity, then the system ensures array structure is valid and completes the array modifications process.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code of type ARL (Auto Release) is being processed
GIVEN
A disposition code of type ARL (Auto Release) is being processed
Applied to: ARL Auto Release - Re-evaluate Array
WHEN
The system encounters an ARL disposition code
THEN
The system re-evaluates the status array and proceeds to capacity checking
Context: A disposition code of type MRL (Manual Release) is being processed
GIVEN
A disposition code of type MRL (Manual Release) is being processed
Applied to: MRL Manual Release - Force Processing
WHEN
The system encounters an MRL disposition code
THEN
The system forces processing and proceeds to capacity checking
Context: A new disposition code needs to be added to the status array
GIVEN
A new disposition code needs to be added to the status array
Applied to: Array Overflow Protection
WHEN
The array capacity is exceeded or at maximum limit
THEN
The system terminates processing to prevent overflow and completes array modifications
Context: A disposition code is being added to the status array
GIVEN
A disposition code is being added to the status array
Applied to: Skip Duplicate Entry
WHEN
The same disposition code already exists in the array
THEN
The system skips adding the duplicate entry and completes array modifications
Context: A new disposition code is being added that has a defined counterpart code
GIVEN
A new disposition code is being added that has a defined counterpart code
Applied to: Remove Counterpart Code
WHEN
The counterpart code is found in the status array
THEN
The system removes the counterpart code and compacts the array before adding the new code
Context: One or more disposition codes have been removed from the status array
GIVEN
One or more disposition codes have been removed from the status array
Applied to: Compact Array Elements
WHEN
Array compaction is required
THEN
The system shifts remaining elements to fill gaps and updates the array count
Context: A disposition code requires location information and border location is specified
GIVEN
A disposition code requires location information and border location is specified
Applied to: Add Border Location
WHEN
The system processes location information for the disposition code
THEN
The system adds border location information to the status entry and updates the released flag
Context: A disposition code requires location information and destination location is specified
GIVEN
A disposition code requires location information and destination location is specified
Applied to: Add Destination Location
WHEN
The system processes location information for the disposition code
THEN
The system adds destination location information to the status entry and updates the released flag
Context: A disposition code requires quantity action of type ADD
GIVEN
A disposition code requires quantity action of type ADD
Applied to: Process Add Quantity
WHEN
The system processes the quantity action
THEN
The system adds the specified quantity to the release amount and proceeds to array compaction
Context: A disposition code requires quantity action of type SUBTRACT
GIVEN
A disposition code requires quantity action of type SUBTRACT
Applied to: Process Subtract Quantity
WHEN
The system processes the quantity action
THEN
The system subtracts the specified quantity from the release amount and proceeds to array compaction
Context: A disposition code is for informational purposes only
GIVEN
A disposition code is for informational purposes only
Applied to: Set Information Flag Only
WHEN
The system processes the information-only disposition code
THEN
The system sets the information flag without processing quantities and proceeds to array compaction
Context: Array modifications have been completed including compaction and count updates
GIVEN
Array modifications have been completed including compaction and count updates
Applied to: Validate Array Integrity
WHEN
The system validates array integrity
THEN
The system ensures array structure is valid and completes the array modifications process
R-GCX016-cbl-04309 (+20) File: GCX016.cbl Cargo State Flag Determination Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo State Flag Determination':
  • Context - a cargo record requires state flag analysis:
    For Initialize All State Flags to False:
    When the system begins cargo state flag determination process, then all cargo state flags (empty, held, released, ptt, proceed, arrival, export, fda) are set to false.
  • Context - a disposition code exists in the cargo status array:
    For Is Hold Code?:
    When the system evaluates the disposition code type, then the system identifies if the code represents a hold condition and determines the hold location (border or destination).
    For Is Release Code?:
    When the system evaluates the disposition code for release characteristics, then the system determines if the code represents a release condition.
    For Is PTT Code?:
    When the system evaluates the disposition code for ptt characteristics, then the system determines if the code represents a ptt condition.
    For Is Proceed Code?:
    When the system evaluates the disposition code for proceed characteristics, then the system determines if the code represents a proceed condition.
    For Is Arrival Code?:
    When the system evaluates the disposition code for arrival characteristics, then the system determines if the code represents an arrival condition.
    For Is Export Code?:
    When the system evaluates the disposition code for export characteristics, then the system determines if the code represents an export condition.
    For Is FDA Code?:
    When the system evaluates the disposition code for fda characteristics, then the system determines if the code represents an fda hold condition.
  • Context - a hold disposition code is identified in the status array:
    For Set Border Hold Flag:
    When the hold location is determined to be at the border, then the border hold flag is set to true.
    For Set Destination Hold Flag:
    When the hold location is determined to be at the destination, then the destination hold flag is set to true.
  • Context - a release disposition code is identified in the status array:
    For Set Release Flag:
    When the system processes the release code, then the release flag is set to true and release quantities are updated based on the disposition code.
  • Context - a ptt disposition code is identified in the status array:
    For Set PTT Flag:
    When the system processes the ptt code, then the ptt flag is set to true and ptt quantities are validated against cargo totals.
  • Context - a proceed disposition code is identified in the status array:
    For Set Proceed Flag:
    When the system processes the proceed code, then the proceed flag is set to true and border arrival date is established.
  • Context - an arrival disposition code is identified in the status array:
    For Set Arrival Flag:
    When the system processes the arrival code, then the arrival flag is set to true.
  • Context - an export disposition code is identified in the status array:
    For Set Export Flag:
    When the system processes the export code, then the export flag is set to true.
  • Context - an fda disposition code is identified in the status array:
    For Set FDA Hold Flag:
    When the system processes the fda code, then the fda hold flag is set to true and fda location status is determined.
  • Context - both hold and release flags are set to true for a cargo record:
    For Determine Partial Release Status:
    When the system analyzes the combined flag states, then the system determines partial release status based on quantity comparisons.
  • Context - ptt flag is set to true for a cargo record:
    For Set Hold on Piece Counts:
    When the ptt quantity is insufficient compared to total cargo quantity, then the system sets hold on piece counts flag to true.
  • Context - proceed flag is set to true and border arrival date is established:
    For Set Proceed Status Active:
    When the system evaluates proceed conditions, then the proceed status is activated for the cargo record.
  • Context - both export and arrival flags are set to true for a cargo record:
    For Prioritize Export Status:
    When the system resolves conflicting status flags, then export status takes priority over arrival status.
  • Context - fda hold flag is set to true and fda location is at destination:
    For Override Other Release Flags:
    When the system finalizes cargo state flags, then fda hold status overrides other release flags and takes precedence.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires state flag analysis
GIVEN
A cargo record requires state flag analysis
Applied to: Initialize All State Flags to False
WHEN
The system begins cargo state flag determination process
THEN
All cargo state flags (empty, held, released, PTT, proceed, arrival, export, FDA) are set to false
Context: A disposition code exists in the cargo status array
GIVEN
A disposition code exists in the cargo status array
Applied to: Is Hold Code?
WHEN
The system evaluates the disposition code type
THEN
The system identifies if the code represents a hold condition and determines the hold location (border or destination)
Applied to: Is Release Code?
WHEN
The system evaluates the disposition code for release characteristics
THEN
The system determines if the code represents a release condition
Applied to: Is PTT Code?
WHEN
The system evaluates the disposition code for PTT characteristics
THEN
The system determines if the code represents a PTT condition
Applied to: Is Proceed Code?
WHEN
The system evaluates the disposition code for proceed characteristics
THEN
The system determines if the code represents a proceed condition
Applied to: Is Arrival Code?
WHEN
The system evaluates the disposition code for arrival characteristics
THEN
The system determines if the code represents an arrival condition
Applied to: Is Export Code?
WHEN
The system evaluates the disposition code for export characteristics
THEN
The system determines if the code represents an export condition
Applied to: Is FDA Code?
WHEN
The system evaluates the disposition code for FDA characteristics
THEN
The system determines if the code represents an FDA hold condition
Context: A hold disposition code is identified in the status array
GIVEN
A hold disposition code is identified in the status array
Applied to: Set Border Hold Flag
WHEN
The hold location is determined to be at the border
THEN
The border hold flag is set to true
Applied to: Set Destination Hold Flag
WHEN
The hold location is determined to be at the destination
THEN
The destination hold flag is set to true
Context: A release disposition code is identified in the status array
GIVEN
A release disposition code is identified in the status array
Applied to: Set Release Flag
WHEN
The system processes the release code
THEN
The release flag is set to true and release quantities are updated based on the disposition code
Context: A PTT disposition code is identified in the status array
GIVEN
A PTT disposition code is identified in the status array
Applied to: Set PTT Flag
WHEN
The system processes the PTT code
THEN
The PTT flag is set to true and PTT quantities are validated against cargo totals
Context: A proceed disposition code is identified in the status array
GIVEN
A proceed disposition code is identified in the status array
Applied to: Set Proceed Flag
WHEN
The system processes the proceed code
THEN
The proceed flag is set to true and border arrival date is established
Context: An arrival disposition code is identified in the status array
GIVEN
An arrival disposition code is identified in the status array
Applied to: Set Arrival Flag
WHEN
The system processes the arrival code
THEN
The arrival flag is set to true
Context: An export disposition code is identified in the status array
GIVEN
An export disposition code is identified in the status array
Applied to: Set Export Flag
WHEN
The system processes the export code
THEN
The export flag is set to true
Context: An FDA disposition code is identified in the status array
GIVEN
An FDA disposition code is identified in the status array
Applied to: Set FDA Hold Flag
WHEN
The system processes the FDA code
THEN
The FDA hold flag is set to true and FDA location status is determined
Context: Both hold and release flags are set to true for a cargo record
GIVEN
Both hold and release flags are set to true for a cargo record
Applied to: Determine Partial Release Status
WHEN
The system analyzes the combined flag states
THEN
The system determines partial release status based on quantity comparisons
Context: PTT flag is set to true for a cargo record
GIVEN
PTT flag is set to true for a cargo record
Applied to: Set Hold on Piece Counts
WHEN
The PTT quantity is insufficient compared to total cargo quantity
THEN
The system sets hold on piece counts flag to true
Context: Proceed flag is set to true and border arrival date is established
GIVEN
Proceed flag is set to true and border arrival date is established
Applied to: Set Proceed Status Active
WHEN
The system evaluates proceed conditions
THEN
The proceed status is activated for the cargo record
Context: Both export and arrival flags are set to true for a cargo record
GIVEN
Both export and arrival flags are set to true for a cargo record
Applied to: Prioritize Export Status
WHEN
The system resolves conflicting status flags
THEN
Export status takes priority over arrival status
Context: FDA hold flag is set to true and FDA location is at destination
GIVEN
FDA hold flag is set to true and FDA location is at destination
Applied to: Override Other Release Flags
WHEN
The system finalizes cargo state flags
THEN
FDA hold status overrides other release flags and takes precedence
R-GCX016-cbl-04330 (+16) File: GCX016.cbl Status Change Impact Processing Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Change Impact Processing':
  • Context - a cargo record exists with an active destination index:
    For Manual Release Processing?:
    When the cargo status is set to manual release (mrl), then the destination index must be cleared and the cargo routing constraints removed.
  • Context - a cargo record has been manually released and canadian manifest coordination is required:
    For Process Canadian Manifest Coordination:
    When the system processes the manual release, then the system must search for matching canadian manifest records by waybill and generate appropriate coordination messages.
  • Context - a cargo record is being processed for status change:
    For FDA Hold at Destination?:
    When the cargo requires fda hold at destination location, then the system must set fda hold status (holdfda) with appropriate fda codes and prevent cargo release until fda clearance.
  • Context - a cargo record currently has ptt status assigned:
    For PTT Status Required?:
    When the cargo undergoes status change processing, then the system must save the current ptt status and validate that quantity thresholds are met before allowing status changes.
  • Context - a cargo record has total quantity greater than released quantity:
    For Partial Release Scenario?:
    When the cargo undergoes partial release processing, then the system must set hold on piece counts status (holdpcs) for the unreleased quantity portion.
  • Context - a cargo record has released quantity equal to or greater than total quantity:
    For Full Release Conditions Met?:
    When the system evaluates full release conditions, then the destination index must be cleared and all routing restrictions removed.
  • Context - a cargo record was previously in released status:
    For Detect Unrelease Scenario:
    When the cargo status is being changed to a non-released status, then the system must detect the unrelease scenario and flag it for notification processing.
  • Context - a cargo record is undergoing arrival status processing:
    For Arrival Status Change?:
    When the arrival status is being updated, then the system must re-establish the destination index based on the new arrival status and update routing information.
  • Context - a cargo record has arrival status being processed:
    For Update Bond Start Date:
    When the destination index is re-established for arrival, then the bond start date must be updated to reflect the current arrival date and time.
  • Context - a cargo record is being processed for export status change:
    For Export Status Change?:
    When the export status is being updated, then the destination index must be cleared as export cargo does not require domestic destination routing.
  • Context - a cargo record is being processed for export with cleared destination index:
    For Update Export Bond Date:
    When the export status processing occurs, then the export bond date must be updated to reflect the current export processing date.
  • Context - a cargo record requires age calculation for bond or compliance purposes:
    For Calculate Cargo Age Using Julian Dates:
    When age calculation processing is triggered, then the system must calculate cargo age using julian date format and provide accurate age information.
  • Context - cargo age has been calculated using julian dates:
    For Update Bond Date Management:
    When bond date management processing occurs, then the system must update all relevant bond date management records with the calculated age information.
  • Context - a cargo record has undergone status changes with updated bond date management:
    For Cross-Border Coordination Needed?:
    When the system evaluates cross-border coordination requirements, then the system must determine if cross-border coordination is needed based on cargo movement patterns and international requirements.
  • Context - cross-border coordination has been determined as necessary:
    For Find Matching Canadian Manifests:
    When the system searches for canadian manifest coordination, then the system must find and retrieve all matching canadian manifest records by waybill and equipment identifiers.
  • Context - matching canadian manifest records have been found:
    For Generate Canadian Log Messages:
    When cross-border coordination processing occurs, then the system must generate canadian log messages with cargo release information and cross-border status updates.
  • Context - canadian log messages have been generated for cross-border coordination:
    For Update Cross-Border Status:
    When the cross-border coordination process completes, then the system must update the cross-border status to reflect completed coordination and maintain accurate international shipment tracking.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with an active destination index
GIVEN
A cargo record exists with an active destination index
Applied to: Manual Release Processing?
WHEN
The cargo status is set to manual release (MRL)
THEN
The destination index must be cleared and the cargo routing constraints removed
Context: A cargo record has been manually released and Canadian manifest coordination is required
GIVEN
A cargo record has been manually released and Canadian manifest coordination is required
Applied to: Process Canadian Manifest Coordination
WHEN
The system processes the manual release
THEN
The system must search for matching Canadian manifest records by waybill and generate appropriate coordination messages
Context: A cargo record is being processed for status change
GIVEN
A cargo record is being processed for status change
Applied to: FDA Hold at Destination?
WHEN
The cargo requires FDA hold at destination location
THEN
The system must set FDA hold status (HOLDFDA) with appropriate FDA codes and prevent cargo release until FDA clearance
Context: A cargo record currently has PTT status assigned
GIVEN
A cargo record currently has PTT status assigned
Applied to: PTT Status Required?
WHEN
The cargo undergoes status change processing
THEN
The system must save the current PTT status and validate that quantity thresholds are met before allowing status changes
Context: A cargo record has total quantity greater than released quantity
GIVEN
A cargo record has total quantity greater than released quantity
Applied to: Partial Release Scenario?
WHEN
The cargo undergoes partial release processing
THEN
The system must set hold on piece counts status (HOLDPCS) for the unreleased quantity portion
Context: A cargo record has released quantity equal to or greater than total quantity
GIVEN
A cargo record has released quantity equal to or greater than total quantity
Applied to: Full Release Conditions Met?
WHEN
The system evaluates full release conditions
THEN
The destination index must be cleared and all routing restrictions removed
Context: A cargo record was previously in released status
GIVEN
A cargo record was previously in released status
Applied to: Detect Unrelease Scenario
WHEN
The cargo status is being changed to a non-released status
THEN
The system must detect the unrelease scenario and flag it for notification processing
Context: A cargo record is undergoing arrival status processing
GIVEN
A cargo record is undergoing arrival status processing
Applied to: Arrival Status Change?
WHEN
The arrival status is being updated
THEN
The system must re-establish the destination index based on the new arrival status and update routing information
Context: A cargo record has arrival status being processed
GIVEN
A cargo record has arrival status being processed
Applied to: Update Bond Start Date
WHEN
The destination index is re-established for arrival
THEN
The bond start date must be updated to reflect the current arrival date and time
Context: A cargo record is being processed for export status change
GIVEN
A cargo record is being processed for export status change
Applied to: Export Status Change?
WHEN
The export status is being updated
THEN
The destination index must be cleared as export cargo does not require domestic destination routing
Context: A cargo record is being processed for export with cleared destination index
GIVEN
A cargo record is being processed for export with cleared destination index
Applied to: Update Export Bond Date
WHEN
The export status processing occurs
THEN
The export bond date must be updated to reflect the current export processing date
Context: A cargo record requires age calculation for bond or compliance purposes
GIVEN
A cargo record requires age calculation for bond or compliance purposes
Applied to: Calculate Cargo Age Using Julian Dates
WHEN
Age calculation processing is triggered
THEN
The system must calculate cargo age using Julian date format and provide accurate age information
Context: Cargo age has been calculated using Julian dates
GIVEN
Cargo age has been calculated using Julian dates
Applied to: Update Bond Date Management
WHEN
Bond date management processing occurs
THEN
The system must update all relevant bond date management records with the calculated age information
Context: A cargo record has undergone status changes with updated bond date management
GIVEN
A cargo record has undergone status changes with updated bond date management
Applied to: Cross-Border Coordination Needed?
WHEN
The system evaluates cross-border coordination requirements
THEN
The system must determine if cross-border coordination is needed based on cargo movement patterns and international requirements
Context: Cross-border coordination has been determined as necessary
GIVEN
Cross-border coordination has been determined as necessary
Applied to: Find Matching Canadian Manifests
WHEN
The system searches for Canadian manifest coordination
THEN
The system must find and retrieve all matching Canadian manifest records by waybill and equipment identifiers
Context: Matching Canadian manifest records have been found
GIVEN
Matching Canadian manifest records have been found
Applied to: Generate Canadian Log Messages
WHEN
Cross-border coordination processing occurs
THEN
The system must generate Canadian log messages with cargo release information and cross-border status updates
Context: Canadian log messages have been generated for cross-border coordination
GIVEN
Canadian log messages have been generated for cross-border coordination
Applied to: Update Cross-Border Status
WHEN
The cross-border coordination process completes
THEN
The system must update the cross-border status to reflect completed coordination and maintain accurate international shipment tracking
R-GCX016-cbl-04347 (+7) File: GCX016.cbl Canadian Manifest Coordination Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Manifest Coordination':
  • Context - a us cargo record has been processed for release:
    For Canadian Manifest Coordination Required?:
    When the system evaluates if canadian manifest coordination is needed, then canadian manifest processing is initiated if cargo is manually released or meets specific release criteria.
  • Context - canadian manifest coordination is required for released us cargo:
    For Search for Matching Canadian Manifests:
    When the system searches for matching canadian manifests using waybill number, then canadian cargo records are retrieved based on waybill and equipment matching criteria.
  • Context - a search for canadian manifests has been initiated:
    For Retrieve Canadian Cargo Records:
    When the system retrieves canadian cargo records by waybill, then only active canadian cargo records are returned, excluding deleted records and new bond created records.
  • Context - canadian cargo records have been retrieved from the database:
    For Matching Canadian Manifest Found?:
    When the system validates matching criteria between us and canadian cargo, then a match is confirmed if canadian cargo exists and meets validation criteria, otherwise no match is found.
  • Context - a matching canadian manifest has been found for released us cargo:
    For Generate Cross-Border Log Message:
    When the system generates a cross-border coordination log message, then a detailed log message is created containing cargo release information, waybill details, and cross-border coordination data.
  • Context - a cross-border log message has been generated for matching canadian cargo:
    For Update Canadian Manifest Status:
    When the system updates canadian manifest status, then canadian cargo records are updated to reflect the cross-border coordination and us cargo release status.
  • Context - canadian manifest status has been updated for cross-border coordination:
    For Create Audit Trail for Canadian System:
    When the system creates an audit trail for the canadian system, then a complete audit record is generated documenting the cross-border cargo coordination, including timestamps, cargo details, and system integration information.
  • Context - an audit trail has been created for canadian system coordination:
    For Place Log Message on Canadian CCN:
    When the system places the log message on the canadian ccn, then the cross-border coordination log message is successfully placed on the canadian cargo control number for integration with canadian customs systems.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo record has been processed for release
GIVEN
A US cargo record has been processed for release
Applied to: Canadian Manifest Coordination Required?
WHEN
The system evaluates if Canadian manifest coordination is needed
THEN
Canadian manifest processing is initiated if cargo is manually released or meets specific release criteria
Context: Canadian manifest coordination is required for released US cargo
GIVEN
Canadian manifest coordination is required for released US cargo
Applied to: Search for Matching Canadian Manifests
WHEN
The system searches for matching Canadian manifests using waybill number
THEN
Canadian cargo records are retrieved based on waybill and equipment matching criteria
Context: A search for Canadian manifests has been initiated
GIVEN
A search for Canadian manifests has been initiated
Applied to: Retrieve Canadian Cargo Records
WHEN
The system retrieves Canadian cargo records by waybill
THEN
Only active Canadian cargo records are returned, excluding deleted records and new bond created records
Context: Canadian cargo records have been retrieved from the database
GIVEN
Canadian cargo records have been retrieved from the database
Applied to: Matching Canadian Manifest Found?
WHEN
The system validates matching criteria between US and Canadian cargo
THEN
A match is confirmed if Canadian cargo exists and meets validation criteria, otherwise no match is found
Context: A matching Canadian manifest has been found for released US cargo
GIVEN
A matching Canadian manifest has been found for released US cargo
Applied to: Generate Cross-Border Log Message
WHEN
The system generates a cross-border coordination log message
THEN
A detailed log message is created containing cargo release information, waybill details, and cross-border coordination data
Context: A cross-border log message has been generated for matching Canadian cargo
GIVEN
A cross-border log message has been generated for matching Canadian cargo
Applied to: Update Canadian Manifest Status
WHEN
The system updates Canadian manifest status
THEN
Canadian cargo records are updated to reflect the cross-border coordination and US cargo release status
Context: Canadian manifest status has been updated for cross-border coordination
GIVEN
Canadian manifest status has been updated for cross-border coordination
Applied to: Create Audit Trail for Canadian System
WHEN
The system creates an audit trail for the Canadian system
THEN
A complete audit record is generated documenting the cross-border cargo coordination, including timestamps, cargo details, and system integration information
Context: An audit trail has been created for Canadian system coordination
GIVEN
An audit trail has been created for Canadian system coordination
Applied to: Place Log Message on Canadian CCN
WHEN
The system places the log message on the Canadian CCN
THEN
The cross-border coordination log message is successfully placed on the Canadian cargo control number for integration with Canadian customs systems
R-GCX016-cbl-04355 (+11) File: GCX016.cbl Final Status Determination Logic Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Final Status Determination Logic':
  • Context - a cargo record is being processed for final status determination:
    For Manual Release Flag Set?:
    When the manual release flag is set to true, then the system sets manual release status, clears the destination index, and processes canadian manifest coordination.
  • Context - a cargo record is being evaluated for final status and manual release is not applicable:
    For FDA Hold at Destination?:
    When fda hold conditions are detected at the destination, then the system sets fda hold status and applies the appropriate fda status code.
  • Context - a cargo record has ptt status indicators present:
    For PTT Status Present?:
    When the system evaluates ptt status conditions, then the system validates ptt quantities against established thresholds and maintains ptt status if conditions are met.
  • Context - a cargo record with ptt status is being processed and quantities have been validated:
    For Released Qty < Total Qty?:
    When the released quantity is less than the total quantity, then the system sets partial release hold status and applies hold on piece counts.
  • Context - a cargo record is being evaluated for release status and released quantity equals or exceeds total quantity:
    For Full Release Conditions Met?:
    When all full release conditions are met, then the system processes full release and clears the destination index.
  • Context - a cargo record has hold status present and is not in manual release or full release state:
    For Hold at Border?:
    When hold conditions exist at the border location, then the system sets border hold status for the cargo.
  • Context - a cargo record has hold status present and is not held at border:
    For Hold at Destination?:
    When hold conditions exist at the destination location, then the system sets destination hold status for the cargo.
  • Context - a cargo record is not in hold status and proceed status indicators are present:
    For Proceed Status Present?:
    When proceed status conditions are validated, then the system sets proceed status and updates the border arrival date.
  • Context - a cargo record has completed proceed status processing or is not in proceed status:
    For Arrival Status Present?:
    When arrival status indicators are present, then the system sets arrival status and updates the arrival date.
  • Context - a cargo record has completed arrival status processing or is not in arrival status:
    For Export Status Present?:
    When export status indicators are present, then the system sets export status and clears the destination index.
  • Context - a cargo record has completed export status processing or is not in export status:
    For Unrelease Detected?:
    When unrelease conditions are detected in the cargo status, then the system generates unrelease notification and restores the previous cargo status.
  • Context - a cargo record has completed unrelease processing or no unrelease was detected:
    For Age Calculation Required?:
    When age calculation is required for the cargo, then the system calculates cargo age using julian date conversion and re-establishes the destination index.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for final status determination
GIVEN
A cargo record is being processed for final status determination
Applied to: Manual Release Flag Set?
WHEN
The manual release flag is set to true
THEN
The system sets manual release status, clears the destination index, and processes Canadian manifest coordination
Context: A cargo record is being evaluated for final status and manual release is not applicable
GIVEN
A cargo record is being evaluated for final status and manual release is not applicable
Applied to: FDA Hold at Destination?
WHEN
FDA hold conditions are detected at the destination
THEN
The system sets FDA hold status and applies the appropriate FDA status code
Context: A cargo record has PTT status indicators present
GIVEN
A cargo record has PTT status indicators present
Applied to: PTT Status Present?
WHEN
The system evaluates PTT status conditions
THEN
The system validates PTT quantities against established thresholds and maintains PTT status if conditions are met
Context: A cargo record with PTT status is being processed and quantities have been validated
GIVEN
A cargo record with PTT status is being processed and quantities have been validated
Applied to: Released Qty < Total Qty?
WHEN
The released quantity is less than the total quantity
THEN
The system sets partial release hold status and applies hold on piece counts
Context: A cargo record is being evaluated for release status and released quantity equals or exceeds total quantity
GIVEN
A cargo record is being evaluated for release status and released quantity equals or exceeds total quantity
Applied to: Full Release Conditions Met?
WHEN
All full release conditions are met
THEN
The system processes full release and clears the destination index
Context: A cargo record has hold status present and is not in manual release or full release state
GIVEN
A cargo record has hold status present and is not in manual release or full release state
Applied to: Hold at Border?
WHEN
Hold conditions exist at the border location
THEN
The system sets border hold status for the cargo
Context: A cargo record has hold status present and is not held at border
GIVEN
A cargo record has hold status present and is not held at border
Applied to: Hold at Destination?
WHEN
Hold conditions exist at the destination location
THEN
The system sets destination hold status for the cargo
Context: A cargo record is not in hold status and proceed status indicators are present
GIVEN
A cargo record is not in hold status and proceed status indicators are present
Applied to: Proceed Status Present?
WHEN
Proceed status conditions are validated
THEN
The system sets proceed status and updates the border arrival date
Context: A cargo record has completed proceed status processing or is not in proceed status
GIVEN
A cargo record has completed proceed status processing or is not in proceed status
Applied to: Arrival Status Present?
WHEN
Arrival status indicators are present
THEN
The system sets arrival status and updates the arrival date
Context: A cargo record has completed arrival status processing or is not in arrival status
GIVEN
A cargo record has completed arrival status processing or is not in arrival status
Applied to: Export Status Present?
WHEN
Export status indicators are present
THEN
The system sets export status and clears the destination index
Context: A cargo record has completed export status processing or is not in export status
GIVEN
A cargo record has completed export status processing or is not in export status
Applied to: Unrelease Detected?
WHEN
Unrelease conditions are detected in the cargo status
THEN
The system generates unrelease notification and restores the previous cargo status
Context: A cargo record has completed unrelease processing or no unrelease was detected
GIVEN
A cargo record has completed unrelease processing or no unrelease was detected
Applied to: Age Calculation Required?
WHEN
Age calculation is required for the cargo
THEN
The system calculates cargo age using Julian date conversion and re-establishes the destination index
R-GCX016-cbl-04367 (+8) File: GCX016.cbl 218:Disposition Code Table Lookup Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '218:Disposition Code Table Lookup':
  • Context - a disposition code needs to be validated and processed for cargo operations:
    For Disposition Code Table Lookup - Retrieve disposition code information from DC table including counterpart codes, quantity action flags, location requirements, and processing instructions:
    When the system performs a disposition code table lookup using the provided disposition code, then the system retrieves all associated disposition code information including counterpart codes, quantity action flags, location requirements, and processing instructions from the dc table and sets appropriate availability flags.
  • Context - a disposition code is available for table lookup:
    For Initialize DC Table Key with Disposition Code:
    When the system prepares to read the dc table, then the system initializes the dc table key with the disposition code value.
  • Context - a dc table lookup has been performed for a disposition code:
    For DC Table Record Found?:
    When the system evaluates the table read results, then if the dc table record is found, the system proceeds to extract disposition code information, otherwise it sets the disposition code not found error flag.
  • Context - a valid dc table record has been retrieved for a disposition code:
    For Extract Counterpart Code from DC-COUNTERPART-CODE & Extract Quantity Action Flag from DC-QTY-ACTION & Extract Location Requirements from DC-LOCATION-INFO & Extract Processing Instructions from DC-PROCESS-TYPE:
    When the system processes the dc table record information, then the system extracts the counterpart code value from the dc-counterpart-code field and the system extracts the quantity action flag from the dc-qty-action field to determine quantity processing requirements and the system extracts location requirements from the dc-location-info field and the system extracts processing instructions from the dc-process-type field.
  • Context - all disposition code information has been successfully extracted from the dc table record:
    For Set Disposition Code Information Available Flag:
    When the system completes the information extraction process, then the system sets the disposition code information available flag to indicate successful retrieval.
  • Context - a disposition code lookup has been performed against the dc table:
    For Set Disposition Code Not Found Error Flag:
    When the dc table record is not found for the specified disposition code, then the system sets the disposition code not found error flag.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code needs to be validated and processed for cargo operations
GIVEN
A disposition code needs to be validated and processed for cargo operations
Applied to: Disposition Code Table Lookup - Retrieve disposition code information from DC table including counterpart codes, quantity action flags, location requirements, and processing instructions
WHEN
The system performs a disposition code table lookup using the provided disposition code
THEN
The system retrieves all associated disposition code information including counterpart codes, quantity action flags, location requirements, and processing instructions from the DC table and sets appropriate availability flags
Context: A disposition code is available for table lookup
GIVEN
A disposition code is available for table lookup
Applied to: Initialize DC Table Key with Disposition Code
WHEN
The system prepares to read the DC table
THEN
The system initializes the DC table key with the disposition code value
Context: A DC table lookup has been performed for a disposition code
GIVEN
A DC table lookup has been performed for a disposition code
Applied to: DC Table Record Found?
WHEN
The system evaluates the table read results
THEN
If the DC table record is found, the system proceeds to extract disposition code information, otherwise it sets the disposition code not found error flag
Context: A valid DC table record has been retrieved for a disposition code
GIVEN
A valid DC table record has been retrieved for a disposition code
Applied to: Extract Counterpart Code from DC-COUNTERPART-CODE & Extract Quantity Action Flag from DC-QTY-ACTION & Extract Location Requirements from DC-LOCATION-INFO & Extract Processing Instructions from DC-PROCESS-TYPE
WHEN
The system processes the DC table record information
THEN
The system extracts the counterpart code value from the DC-COUNTERPART-CODE field AND The system extracts the quantity action flag from the DC-QTY-ACTION field to determine quantity processing requirements AND The system extracts location requirements from the DC-LOCATION-INFO field AND The system extracts processing instructions from the DC-PROCESS-TYPE field
Context: All disposition code information has been successfully extracted from the DC table record
GIVEN
All disposition code information has been successfully extracted from the DC table record
Applied to: Set Disposition Code Information Available Flag
WHEN
The system completes the information extraction process
THEN
The system sets the disposition code information available flag to indicate successful retrieval
Context: A disposition code lookup has been performed against the DC table
GIVEN
A disposition code lookup has been performed against the DC table
Applied to: Set Disposition Code Not Found Error Flag
WHEN
The DC table record is not found for the specified disposition code
THEN
The system sets the disposition code not found error flag
R-GCX016-cbl-04376 (+14) File: GCX016.cbl 219:Counterpart Disposition Code Removal Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '219:Counterpart Disposition Code Removal':
  • Context - a disposition code exists in the current processing context:
    For Get Counterpart Code from DC Table:
    When the system needs to find counterpart codes for removal, then the system looks up the counterpart code from the dc table and sets the counterpart code found flag.
  • Context - the dc table lookup has been performed for counterpart codes:
    For Counterpart Code Exists?:
    When the system checks if a counterpart code was found, then if counterpart code exists, proceed with status array search; otherwise, skip counterpart removal processing.
  • Context - a counterpart disposition code exists and status array contains disposition codes:
    For Search Status Array for Matching Codes:
    When the system searches for matching counterpart codes in the status array, then the system iterates through all status array elements to find codes matching the counterpart code.
  • Context - the system is searching through status array elements for counterpart codes:
    For Match Found?:
    When a status array element's disposition code is compared to the counterpart code, then if codes match, proceed with additional matching criteria validation; otherwise, continue to next array element.
  • Context - a matching counterpart disposition code is found in the status array:
    For Check Status Info Match:
    When the system validates status information compatibility, then the system compares status info fields and proceeds only if they match the removal criteria.
  • Context - status information matching has been validated for a counterpart code:
    For Check Entry Number Match:
    When the system checks entry number compatibility, then the system compares entry numbers and proceeds only if they match or meet the removal criteria.
  • Context - entry number matching has been validated for a counterpart code:
    For Check Quantity Match:
    When the system checks quantity compatibility, then the system compares quantities and proceeds only if they match or meet the removal criteria.
  • Context - quantity matching has been validated for a counterpart code:
    For Check Specific Code Patterns:
    When the system checks for specific code patterns requiring special handling, then the system applies pattern-specific validation rules and determines if the counterpart code qualifies for removal.
  • Context - all individual matching validations have been performed for a counterpart code:
    For All Matching Criteria Met?:
    When the system evaluates the combined results of all matching criteria, then if all criteria are met, mark the array element for removal; otherwise, continue to next array element.
  • Context - all matching criteria are satisfied for a counterpart disposition code:
    For Mark Array Element for Removal:
    When the system needs to prepare the array element for removal, then the system marks the array element for deletion and sets appropriate removal flags.
  • Context - a status array element has been marked for removal:
    For Remove Element from Array:
    When the system performs the actual removal operation, then the system removes the counterpart disposition code from the status array and sets removal tracking flags.
  • Context - one or more counterpart disposition codes have been removed from the status array:
    For Compact Remaining Array Elements:
    When the system needs to maintain array integrity, then the system shifts remaining array elements to eliminate gaps and maintains sequential order.
  • Context - the status array has been compacted after counterpart code removal:
    For Update Array Count:
    When the system needs to maintain accurate array metadata, then the system updates the array count to reflect the current number of active disposition codes.
  • Context - the current status array element has been processed for counterpart code removal:
    For More Elements to Check?:
    When the system checks if more elements exist in the array, then if more elements exist, continue processing next element; otherwise, complete counterpart removal process.
  • Context - additional status array elements exist for processing:
    For Continue to Next Element:
    When the system needs to continue counterpart code removal evaluation, then the system advances to the next array element and repeats the counterpart matching process.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code exists in the current processing context
GIVEN
A disposition code exists in the current processing context
Applied to: Get Counterpart Code from DC Table
WHEN
The system needs to find counterpart codes for removal
THEN
The system looks up the counterpart code from the DC table and sets the counterpart code found flag
Context: The DC table lookup has been performed for counterpart codes
GIVEN
The DC table lookup has been performed for counterpart codes
Applied to: Counterpart Code Exists?
WHEN
The system checks if a counterpart code was found
THEN
If counterpart code exists, proceed with status array search; otherwise, skip counterpart removal processing
Context: A counterpart disposition code exists and status array contains disposition codes
GIVEN
A counterpart disposition code exists and status array contains disposition codes
Applied to: Search Status Array for Matching Codes
WHEN
The system searches for matching counterpart codes in the status array
THEN
The system iterates through all status array elements to find codes matching the counterpart code
Context: The system is searching through status array elements for counterpart codes
GIVEN
The system is searching through status array elements for counterpart codes
Applied to: Match Found?
WHEN
A status array element's disposition code is compared to the counterpart code
THEN
If codes match, proceed with additional matching criteria validation; otherwise, continue to next array element
Context: A matching counterpart disposition code is found in the status array
GIVEN
A matching counterpart disposition code is found in the status array
Applied to: Check Status Info Match
WHEN
The system validates status information compatibility
THEN
The system compares status info fields and proceeds only if they match the removal criteria
Context: Status information matching has been validated for a counterpart code
GIVEN
Status information matching has been validated for a counterpart code
Applied to: Check Entry Number Match
WHEN
The system checks entry number compatibility
THEN
The system compares entry numbers and proceeds only if they match or meet the removal criteria
Context: Entry number matching has been validated for a counterpart code
GIVEN
Entry number matching has been validated for a counterpart code
Applied to: Check Quantity Match
WHEN
The system checks quantity compatibility
THEN
The system compares quantities and proceeds only if they match or meet the removal criteria
Context: Quantity matching has been validated for a counterpart code
GIVEN
Quantity matching has been validated for a counterpart code
Applied to: Check Specific Code Patterns
WHEN
The system checks for specific code patterns requiring special handling
THEN
The system applies pattern-specific validation rules and determines if the counterpart code qualifies for removal
Context: All individual matching validations have been performed for a counterpart code
GIVEN
All individual matching validations have been performed for a counterpart code
Applied to: All Matching Criteria Met?
WHEN
The system evaluates the combined results of all matching criteria
THEN
If all criteria are met, mark the array element for removal; otherwise, continue to next array element
Context: All matching criteria are satisfied for a counterpart disposition code
GIVEN
All matching criteria are satisfied for a counterpart disposition code
Applied to: Mark Array Element for Removal
WHEN
The system needs to prepare the array element for removal
THEN
The system marks the array element for deletion and sets appropriate removal flags
Context: A status array element has been marked for removal
GIVEN
A status array element has been marked for removal
Applied to: Remove Element from Array
WHEN
The system performs the actual removal operation
THEN
The system removes the counterpart disposition code from the status array and sets removal tracking flags
Context: One or more counterpart disposition codes have been removed from the status array
GIVEN
One or more counterpart disposition codes have been removed from the status array
Applied to: Compact Remaining Array Elements
WHEN
The system needs to maintain array integrity
THEN
The system shifts remaining array elements to eliminate gaps and maintains sequential order
Context: The status array has been compacted after counterpart code removal
GIVEN
The status array has been compacted after counterpart code removal
Applied to: Update Array Count
WHEN
The system needs to maintain accurate array metadata
THEN
The system updates the array count to reflect the current number of active disposition codes
Context: The current status array element has been processed for counterpart code removal
GIVEN
The current status array element has been processed for counterpart code removal
Applied to: More Elements to Check?
WHEN
The system checks if more elements exist in the array
THEN
If more elements exist, continue processing next element; otherwise, complete counterpart removal process
Context: Additional status array elements exist for processing
GIVEN
Additional status array elements exist for processing
Applied to: Continue to Next Element
WHEN
The system needs to continue counterpart code removal evaluation
THEN
The system advances to the next array element and repeats the counterpart matching process
R-GCX016-cbl-04391 (+5) File: GCX016.cbl 226:Release Quantity Calculation Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '226:Release Quantity Calculation':
  • Context - a cargo record exists with current released quantity and a disposition code contains quantity action instructions:
    For Release Quantity Calculation - Calculate and adjust cargo release quantities based on disposition code quantity actions with add/subtract operations and negative quantity prevention:
    When the system processes the disposition code quantity action, then the system retrieves current released quantity, applies the specified action (add or subtract), prevents negative results by setting to zero if needed, and updates the cargo status array with the new quantity.
  • Context - a disposition code has action type add_quantity and contains a quantity value:
    For Add Quantity to Released Amount:
    When the system processes the quantity action, then the system adds the disposition code quantity to the current released quantity.
  • Context - a disposition code has action type subtract_quantity and contains a quantity value:
    For Subtract Quantity from Released Amount:
    When the system processes the quantity action, then the system subtracts the disposition code quantity from the current released quantity.
  • Context - a quantity subtraction operation would result in a negative released quantity:
    For Set Released Quantity to Zero:
    When the system calculates the new released quantity, then the system sets the released quantity to zero instead of allowing the negative value.
  • Context - a disposition code is being processed for quantity actions:
    For Check Disposition Code Quantity Action:
    When the system evaluates the disposition code action type, then the system identifies whether to add quantity, subtract quantity, or perform no quantity action based on the disposition code configuration.
  • Context - a new released quantity has been calculated from disposition code processing:
    For Store Updated Quantity in Status Array:
    When the system completes the quantity calculation, then the system stores the updated released quantity in the appropriate cargo status array entry.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with current released quantity and a disposition code contains quantity action instructions
GIVEN
A cargo record exists with current released quantity and a disposition code contains quantity action instructions
Applied to: Release Quantity Calculation - Calculate and adjust cargo release quantities based on disposition code quantity actions with add/subtract operations and negative quantity prevention
WHEN
The system processes the disposition code quantity action
THEN
The system retrieves current released quantity, applies the specified action (add or subtract), prevents negative results by setting to zero if needed, and updates the cargo status array with the new quantity
Context: A disposition code has action type ADD_QUANTITY and contains a quantity value
GIVEN
A disposition code has action type ADD_QUANTITY and contains a quantity value
Applied to: Add Quantity to Released Amount
WHEN
The system processes the quantity action
THEN
The system adds the disposition code quantity to the current released quantity
Context: A disposition code has action type SUBTRACT_QUANTITY and contains a quantity value
GIVEN
A disposition code has action type SUBTRACT_QUANTITY and contains a quantity value
Applied to: Subtract Quantity from Released Amount
WHEN
The system processes the quantity action
THEN
The system subtracts the disposition code quantity from the current released quantity
Context: A quantity subtraction operation would result in a negative released quantity
GIVEN
A quantity subtraction operation would result in a negative released quantity
Applied to: Set Released Quantity to Zero
WHEN
The system calculates the new released quantity
THEN
The system sets the released quantity to zero instead of allowing the negative value
Context: A disposition code is being processed for quantity actions
GIVEN
A disposition code is being processed for quantity actions
Applied to: Check Disposition Code Quantity Action
WHEN
The system evaluates the disposition code action type
THEN
The system identifies whether to add quantity, subtract quantity, or perform no quantity action based on the disposition code configuration
Context: A new released quantity has been calculated from disposition code processing
GIVEN
A new released quantity has been calculated from disposition code processing
Applied to: Store Updated Quantity in Status Array
WHEN
The system completes the quantity calculation
THEN
The system stores the updated released quantity in the appropriate cargo status array entry
R-GCX016-cbl-04397 (+10) File: GCX016.cbl B530: Attempt Car ID Only Search Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'B530: Attempt Car ID Only Search':
  • Context - a car id and us-ccn key are available for cargo search:
    For Set US-CCN Key for Initial Search:
    When the system initiates cargo search with both car id and us-ccn key parameters, then the system should set the us-ccn key constraint and perform targeted search using car id index.
  • Context - a raw car id or equipment identifier is provided:
    For Format Equipment ID using GCCCARFM:
    When the system needs to search for cargo by car id, then the system should format the equipment id using gcccarfm formatting rules before search.
  • Context - formatted car id and us-ccn key are available:
    For Call GCCUSIO with Car ID Index:
    When the system performs primary cargo search, then the system should call gccusio using car id index with us-ccn key constraint to find matching cargo.
  • Context - primary cargo search has been executed with car id and us-ccn key:
    For Cargo Found with US-CCN Key?:
    When the system evaluates search results, then the system should determine if cargo was found and validate the cargo record matches search criteria.
  • Context - primary cargo search with us-ccn key constraint returned no results:
    For Clear US-CCN Key Constraint:
    When the system needs to perform fallback search, then the system should clear the us-ccn key constraint to enable broader search criteria.
  • Context - us-ccn key constraint has been cleared and car id is available:
    For Call GCCUSIO with Car ID Only:
    When the system performs secondary cargo search, then the system should call gccusio using car id index without us-ccn key constraint.
  • Context - secondary cargo search has been executed with car id only:
    For Cargo Found without US-CCN?:
    When the system evaluates secondary search results, then the system should determine if cargo was found without us-ccn key constraint.
  • Context - cargo record has been found through either primary or secondary search:
    For Validate Cargo Record Match:
    When the system validates the found cargo record, then the system should verify the cargo record matches business validation criteria.
  • Context - a valid cargo record has been found and validated:
    For Return Found Cargo Record:
    When the system completes cargo search process, then the system should return the found cargo record for further processing.
  • Context - both primary search with us-ccn key and secondary search with car id only have failed:
    For Set Cargo Not Found Status:
    When the system cannot locate any matching cargo records, then the system should set cargo not found status to indicate search failure.
  • Context - cargo search process has completed with either success or failure:
    For Log Search Attempt Results:
    When the system finalizes search operations, then the system should log search attempt results including search criteria and outcomes.
👨‍💻 Technical ACs (Gherkin)
Context: A car ID and US-CCN key are available for cargo search
GIVEN
A car ID and US-CCN key are available for cargo search
Applied to: Set US-CCN Key for Initial Search
WHEN
The system initiates cargo search with both car ID and US-CCN key parameters
THEN
The system should set the US-CCN key constraint and perform targeted search using car ID index
Context: A raw car ID or equipment identifier is provided
GIVEN
A raw car ID or equipment identifier is provided
Applied to: Format Equipment ID using GCCCARFM
WHEN
The system needs to search for cargo by car ID
THEN
The system should format the equipment ID using GCCCARFM formatting rules before search
Context: Formatted car ID and US-CCN key are available
GIVEN
Formatted car ID and US-CCN key are available
Applied to: Call GCCUSIO with Car ID Index
WHEN
The system performs primary cargo search
THEN
The system should call GCCUSIO using car ID index with US-CCN key constraint to find matching cargo
Context: Primary cargo search has been executed with car ID and US-CCN key
GIVEN
Primary cargo search has been executed with car ID and US-CCN key
Applied to: Cargo Found with US-CCN Key?
WHEN
The system evaluates search results
THEN
The system should determine if cargo was found and validate the cargo record matches search criteria
Context: Primary cargo search with US-CCN key constraint returned no results
GIVEN
Primary cargo search with US-CCN key constraint returned no results
Applied to: Clear US-CCN Key Constraint
WHEN
The system needs to perform fallback search
THEN
The system should clear the US-CCN key constraint to enable broader search criteria
Context: US-CCN key constraint has been cleared and car ID is available
GIVEN
US-CCN key constraint has been cleared and car ID is available
Applied to: Call GCCUSIO with Car ID Only
WHEN
The system performs secondary cargo search
THEN
The system should call GCCUSIO using car ID index without US-CCN key constraint
Context: Secondary cargo search has been executed with car ID only
GIVEN
Secondary cargo search has been executed with car ID only
Applied to: Cargo Found without US-CCN?
WHEN
The system evaluates secondary search results
THEN
The system should determine if cargo was found without US-CCN key constraint
Context: Cargo record has been found through either primary or secondary search
GIVEN
Cargo record has been found through either primary or secondary search
Applied to: Validate Cargo Record Match
WHEN
The system validates the found cargo record
THEN
The system should verify the cargo record matches business validation criteria
Context: A valid cargo record has been found and validated
GIVEN
A valid cargo record has been found and validated
Applied to: Return Found Cargo Record
WHEN
The system completes cargo search process
THEN
The system should return the found cargo record for further processing
Context: Both primary search with US-CCN key and secondary search with car ID only have failed
GIVEN
Both primary search with US-CCN key and secondary search with car ID only have failed
Applied to: Set Cargo Not Found Status
WHEN
The system cannot locate any matching cargo records
THEN
The system should set cargo not found status to indicate search failure
Context: Cargo search process has completed with either success or failure
GIVEN
Cargo search process has completed with either success or failure
Applied to: Log Search Attempt Results
WHEN
The system finalizes search operations
THEN
The system should log search attempt results including search criteria and outcomes
R-GCX016-cbl-04408 (+13) File: GCX016.cbl C200: Create Foreign Bill Record Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'C200: Create Foreign Bill Record':
  • Context - a foreign bill does not exist in the system:
    For Initialize New Cargo Record:
    When the system creates a new cargo record, then the cargo record is initialized with default values including cleared fields and basic structure.
  • Context - a new cargo record is being created:
    For Set Default CPRS Status Code:
    When the cargo type is cprs, then set cargo status to error with description error, otherwise set status to sent with description sent.
    For Initialize Broker Information Fields:
    When broker information needs to be initialized, then clear and initialize all broker-related fields to default values.
  • Context - a new cargo record with status information:
    For Set Default USCS Status Code:
    When the current acknowledgment status is blank or equals ack-r, then set default acknowledgment status to ack or ack-r as appropriate.
  • Context - m10 segment data is available:
    For Build M10 Manifest Information:
    When building manifest information for new cargo, then extract and assign manifest details from m10 segment to cargo record.
  • Context - a new cargo record with disposition code 1j, 69, or 55:
    For Process Master In-Bond Entry Types 61,62,63,69:
    When the entry type is 61, 62, 63, or 69, then set master in-bond flag m1109 and process as master in-bond entry.
  • Context - an entry type code for master in-bond processing:
    For Map Entry Type to Transport Type:
    When entry type is 61, 62, 63, 69, or 00, then map to immediate transport, transport export, immediate export, us-canada-us movement, or border processing respectively.
  • Context - a cargo record with entry type 00 (border entry):
    For Clear Bond Information for Border Entry:
    When processing bond information, then clear all bond-related fields and information.
  • Context - a cargo record with entry number information:
    For Set Bond Control Numbers:
    When entry number starts with v, then place in entry number field, otherwise place in in-bond control number field.
  • Context - a new cargo record being created:
    For Initialize Cargo Quantities:
    When quantity information needs initialization, then initialize all quantity fields including total quantity, release quantity, and piece counts.
  • Context - a new cargo record with manifest information:
    For Set Manifest Type and Condition Codes:
    When setting manifest classification, then assign appropriate manifest type and condition codes based on cargo type and processing requirements.
  • Context - a new cargo record with carrier information:
    For Assign SCAC Code and Vessel Information:
    When assigning carrier and vessel details, then set scac code and vessel information from manifest data.
  • Context - a new cargo record with transportation details:
    For Set Country Code and Flight/Voyage Number:
    When setting origin and transportation identifiers, then assign country code and flight or voyage number from manifest information.
  • Context - a fully initialized new cargo record:
    For Store Cargo Record in Database:
    When saving the record to the database, then insert the cargo record into the database and confirm successful storage.
👨‍💻 Technical ACs (Gherkin)
Context: A foreign bill does not exist in the system
GIVEN
A foreign bill does not exist in the system
Applied to: Initialize New Cargo Record
WHEN
The system creates a new cargo record
THEN
The cargo record is initialized with default values including cleared fields and basic structure
Context: A new cargo record is being created
GIVEN
A new cargo record is being created
Applied to: Set Default CPRS Status Code
WHEN
The cargo type is CPRS
THEN
Set cargo status to ERROR with description ERROR, otherwise set status to SENT with description SENT
Applied to: Initialize Broker Information Fields
WHEN
Broker information needs to be initialized
THEN
Clear and initialize all broker-related fields to default values
Context: A new cargo record with status information
GIVEN
A new cargo record with status information
Applied to: Set Default USCS Status Code
WHEN
The current acknowledgment status is blank or equals ACK-R
THEN
Set default acknowledgment status to ACK or ACK-R as appropriate
Context: M10 segment data is available
GIVEN
M10 segment data is available
Applied to: Build M10 Manifest Information
WHEN
Building manifest information for new cargo
THEN
Extract and assign manifest details from M10 segment to cargo record
Context: A new cargo record with disposition code 1J, 69, or 55
GIVEN
A new cargo record with disposition code 1J, 69, or 55
Applied to: Process Master In-Bond Entry Types 61,62,63,69
WHEN
The entry type is 61, 62, 63, or 69
THEN
Set master in-bond flag M1109 and process as master in-bond entry
Context: An entry type code for master in-bond processing
GIVEN
An entry type code for master in-bond processing
Applied to: Map Entry Type to Transport Type
WHEN
Entry type is 61, 62, 63, 69, or 00
THEN
Map to immediate transport, transport export, immediate export, US-Canada-US movement, or border processing respectively
Context: A cargo record with entry type 00 (border entry)
GIVEN
A cargo record with entry type 00 (border entry)
Applied to: Clear Bond Information for Border Entry
WHEN
Processing bond information
THEN
Clear all bond-related fields and information
Context: A cargo record with entry number information
GIVEN
A cargo record with entry number information
Applied to: Set Bond Control Numbers
WHEN
Entry number starts with V
THEN
Place in entry number field, otherwise place in in-bond control number field
Context: A new cargo record being created
GIVEN
A new cargo record being created
Applied to: Initialize Cargo Quantities
WHEN
Quantity information needs initialization
THEN
Initialize all quantity fields including total quantity, release quantity, and piece counts
Context: A new cargo record with manifest information
GIVEN
A new cargo record with manifest information
Applied to: Set Manifest Type and Condition Codes
WHEN
Setting manifest classification
THEN
Assign appropriate manifest type and condition codes based on cargo type and processing requirements
Context: A new cargo record with carrier information
GIVEN
A new cargo record with carrier information
Applied to: Assign SCAC Code and Vessel Information
WHEN
Assigning carrier and vessel details
THEN
Set SCAC code and vessel information from manifest data
Context: A new cargo record with transportation details
GIVEN
A new cargo record with transportation details
Applied to: Set Country Code and Flight/Voyage Number
WHEN
Setting origin and transportation identifiers
THEN
Assign country code and flight or voyage number from manifest information
Context: A fully initialized new cargo record
GIVEN
A fully initialized new cargo record
Applied to: Store Cargo Record in Database
WHEN
Saving the record to the database
THEN
Insert the cargo record into the database and confirm successful storage
R-GCX016-cbl-04422 (+12) File: GCX016.cbl Search Status Array for Matching Codes Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search Status Array for Matching Codes':
  • Context - a status array search operation is requested:
    For Start Status Array Search:
    When the search process begins, then the system initializes the search parameters and prepares to iterate through the status array.
  • Context - the status array search is initialized:
    For Initialize Array Index to 1:
    When the system prepares to iterate through array elements, then the array index is set to position 1 to start from the first element.
  • Context - an array index position is being evaluated:
    For Index <= Array Count?:
    When the system checks if more elements exist to process, then if index is less than or equal to array count, continue processing; otherwise terminate search.
  • Context - a valid array index position exists:
    For Get Current Array Element:
    When the system needs to examine a status element, then the current array element is retrieved and made available for matching criteria evaluation.
  • Context - a status array element is being evaluated for matching:
    For Check Status Info Match?:
    When the system checks the status information field, then if status information matches search criteria, proceed to next validation; otherwise skip to next element.
  • Context - a status element has passed status information validation:
    For Check Entry Number Match?:
    When the system checks the entry number field, then if entry number matches search criteria, proceed to quantity validation; otherwise skip to next element.
  • Context - a status element has passed status information and entry number validation:
    For Check Quantity Match?:
    When the system checks the quantity field, then if quantity matches search criteria, proceed to code pattern validation; otherwise skip to next element.
  • Context - a status element has passed all previous validation criteria:
    For Check Code Pattern Match?:
    When the system checks the code pattern field, then if code pattern matches search criteria, mark element as found; otherwise skip to next element.
  • Context - a status element has satisfied all matching criteria:
    For Mark Element as Match Found:
    When the system confirms a complete match, then the element is marked as found and flagged for further processing.
  • Context - the current array element has been processed:
    For Increment Array Index:
    When the system needs to move to the next element, then the array index is incremented by one position.
  • Context - the current array element does not meet matching criteria:
    For Continue to Next Element:
    When the system needs to continue searching, then the process moves to increment the array index and evaluate the next element.
  • Context - the status array search has completed processing all elements:
    For Return Match Results:
    When the system has finished evaluating the entire array, then the search results including any matching elements are returned to the calling process.
  • Context - the search results have been returned:
    For End Search Process:
    When the status array search operation is complete, then the search process is terminated and control returns to the calling procedure.
👨‍💻 Technical ACs (Gherkin)
Context: A status array search operation is requested
GIVEN
A status array search operation is requested
Applied to: Start Status Array Search
WHEN
The search process begins
THEN
The system initializes the search parameters and prepares to iterate through the status array
Context: The status array search is initialized
GIVEN
The status array search is initialized
Applied to: Initialize Array Index to 1
WHEN
The system prepares to iterate through array elements
THEN
The array index is set to position 1 to start from the first element
Context: An array index position is being evaluated
GIVEN
An array index position is being evaluated
Applied to: Index <= Array Count?
WHEN
The system checks if more elements exist to process
THEN
If index is less than or equal to array count, continue processing; otherwise terminate search
Context: A valid array index position exists
GIVEN
A valid array index position exists
Applied to: Get Current Array Element
WHEN
The system needs to examine a status element
THEN
The current array element is retrieved and made available for matching criteria evaluation
Context: A status array element is being evaluated for matching
GIVEN
A status array element is being evaluated for matching
Applied to: Check Status Info Match?
WHEN
The system checks the status information field
THEN
If status information matches search criteria, proceed to next validation; otherwise skip to next element
Context: A status element has passed status information validation
GIVEN
A status element has passed status information validation
Applied to: Check Entry Number Match?
WHEN
The system checks the entry number field
THEN
If entry number matches search criteria, proceed to quantity validation; otherwise skip to next element
Context: A status element has passed status information and entry number validation
GIVEN
A status element has passed status information and entry number validation
Applied to: Check Quantity Match?
WHEN
The system checks the quantity field
THEN
If quantity matches search criteria, proceed to code pattern validation; otherwise skip to next element
Context: A status element has passed all previous validation criteria
GIVEN
A status element has passed all previous validation criteria
Applied to: Check Code Pattern Match?
WHEN
The system checks the code pattern field
THEN
If code pattern matches search criteria, mark element as found; otherwise skip to next element
Context: A status element has satisfied all matching criteria
GIVEN
A status element has satisfied all matching criteria
Applied to: Mark Element as Match Found
WHEN
The system confirms a complete match
THEN
The element is marked as found and flagged for further processing
Context: The current array element has been processed
GIVEN
The current array element has been processed
Applied to: Increment Array Index
WHEN
The system needs to move to the next element
THEN
The array index is incremented by one position
Context: The current array element does not meet matching criteria
GIVEN
The current array element does not meet matching criteria
Applied to: Continue to Next Element
WHEN
The system needs to continue searching
THEN
The process moves to increment the array index and evaluate the next element
Context: The status array search has completed processing all elements
GIVEN
The status array search has completed processing all elements
Applied to: Return Match Results
WHEN
The system has finished evaluating the entire array
THEN
The search results including any matching elements are returned to the calling process
Context: The search results have been returned
GIVEN
The search results have been returned
Applied to: End Search Process
WHEN
The status array search operation is complete
THEN
The search process is terminated and control returns to the calling procedure
R-GCX016-cbl-04435 (+9) File: GCX016.cbl Array Overflow Protection Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Array Overflow Protection':
  • Context - a status array exists with current disposition codes:
    For Check Current Array Count:
    When the system needs to add a new disposition code to the array, then the system checks the current count of entries in the status array.
  • Context - the system needs to validate array capacity:
    For Get Maximum Array Limit:
    When checking if new disposition codes can be added, then the system retrieves the maximum allowed array limit from system configuration.
  • Context - current array count and maximum array limit are known:
    For Array Count < Maximum?:
    When the system evaluates array capacity, then if current array count is less than maximum limit, allow addition; otherwise prevent addition.
  • Context - array has available capacity for new entries:
    For Add Disposition Code to Array:
    When a valid disposition code needs to be added, then the system adds the disposition code to the next available position in the status array.
  • Context - array count equals or exceeds maximum capacity:
    For Set Array Overflow Flag:
    When attempting to add a new disposition code, then the system sets an array overflow flag to indicate capacity exceeded condition.
  • Context - array overflow flag has been set:
    For Generate Overflow Error Message:
    When processing the overflow condition, then the system generates an appropriate error message indicating array capacity has been exceeded.
  • Context - an overflow error message has been generated:
    For Log Overflow Condition:
    When recording the overflow event, then the system logs the overflow condition with relevant details for operational review.
  • Context - array overflow condition has been logged:
    For Skip Code Addition:
    When continuing with processing, then the system skips adding the disposition code and continues without modifying the array.
  • Context - a disposition code has been successfully added to the array:
    For Update Array Counter:
    When completing the addition process, then the system increments the array counter to reflect the new total count.
  • Context - array overflow condition has been detected and logged:
    For Route Error to Operations:
    When error handling is required, then the system routes the overflow error to the operations team for investigation and resolution.
👨‍💻 Technical ACs (Gherkin)
Context: A status array exists with current disposition codes
GIVEN
A status array exists with current disposition codes
Applied to: Check Current Array Count
WHEN
The system needs to add a new disposition code to the array
THEN
The system checks the current count of entries in the status array
Context: The system needs to validate array capacity
GIVEN
The system needs to validate array capacity
Applied to: Get Maximum Array Limit
WHEN
Checking if new disposition codes can be added
THEN
The system retrieves the maximum allowed array limit from system configuration
Context: Current array count and maximum array limit are known
GIVEN
Current array count and maximum array limit are known
Applied to: Array Count < Maximum?
WHEN
The system evaluates array capacity
THEN
If current array count is less than maximum limit, allow addition; otherwise prevent addition
Context: Array has available capacity for new entries
GIVEN
Array has available capacity for new entries
Applied to: Add Disposition Code to Array
WHEN
A valid disposition code needs to be added
THEN
The system adds the disposition code to the next available position in the status array
Context: Array count equals or exceeds maximum capacity
GIVEN
Array count equals or exceeds maximum capacity
Applied to: Set Array Overflow Flag
WHEN
Attempting to add a new disposition code
THEN
The system sets an array overflow flag to indicate capacity exceeded condition
Context: Array overflow flag has been set
GIVEN
Array overflow flag has been set
Applied to: Generate Overflow Error Message
WHEN
Processing the overflow condition
THEN
The system generates an appropriate error message indicating array capacity has been exceeded
Context: An overflow error message has been generated
GIVEN
An overflow error message has been generated
Applied to: Log Overflow Condition
WHEN
Recording the overflow event
THEN
The system logs the overflow condition with relevant details for operational review
Context: Array overflow condition has been logged
GIVEN
Array overflow condition has been logged
Applied to: Skip Code Addition
WHEN
Continuing with processing
THEN
The system skips adding the disposition code and continues without modifying the array
Context: A disposition code has been successfully added to the array
GIVEN
A disposition code has been successfully added to the array
Applied to: Update Array Counter
WHEN
Completing the addition process
THEN
The system increments the array counter to reflect the new total count
Context: Array overflow condition has been detected and logged
GIVEN
Array overflow condition has been detected and logged
Applied to: Route Error to Operations
WHEN
Error handling is required
THEN
The system routes the overflow error to the operations team for investigation and resolution
R-GCX016-cbl-04445 (+21) File: GCX016.cbl Array Compaction Process Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Array Compaction Process':
  • Context - array compaction process is starting:
    For Initialize Compaction Variables:
    When system begins array compaction operation, then compaction variables are initialized to default values for tracking element positions and array boundaries.
  • Context - status array contains elements that may be marked for removal:
    For Scan Status Array for Marked Elements:
    When system scans through each array position, then each element is evaluated to determine if it should be removed from the array.
  • Context - an array element is being evaluated during compaction scan:
    For Element Marked for Removal?:
    When system checks element removal markers or status flags, then element is classified as either marked for removal or to be retained in the array.
  • Context - an array element has been identified for removal:
    For Mark Element Position:
    When system processes the element marked for removal, then element position is recorded for subsequent removal during array compaction.
  • Context - current array element has been processed for removal evaluation:
    For Continue Scanning:
    When system moves to next array position, then scanning continues with the subsequent array element.
  • Context - system is scanning array elements for compaction:
    For More Elements to Check?:
    When current element scanning is complete, then system determines whether more elements remain to be checked or scanning phase is complete.
  • Context - array scanning is complete and elements marked for removal are identified:
    For Begin Element Shifting Process:
    When system starts the element shifting phase of compaction, then element shifting process begins to compact the array by removing gaps.
  • Context - array contains gaps from removed elements:
    For Identify First Gap Position:
    When system searches for the first available gap position, then first gap position is identified as the target for element movement.
  • Context - a gap position has been identified for filling:
    For Find Next Valid Element:
    When system searches for valid elements to move into the gap, then next valid element is located for movement to the gap position.
  • Context - system is searching for elements to move during compaction:
    For Valid Element Found?:
    When search for valid element is complete, then system determines if a valid element was found or if no more elements need to be moved.
  • Context - a valid element and gap position have been identified:
    For Shift Element to Gap Position:
    When system performs element movement operation, then element is copied from its current position to the gap position in the array.
  • Context - an element has been moved to a new position in the array:
    For Update Element Pointers:
    When system updates element tracking information, then all pointers and references are updated to reflect the element's new position.
  • Context - an element has been successfully moved to a new position:
    For Mark Old Position as Empty:
    When system processes the element's original position, then original position is marked as empty and available for future use.
  • Context - an element has been successfully shifted to fill a gap:
    For More Elements to Shift?:
    When system evaluates remaining elements for movement, then system determines whether more elements need to be shifted or compaction is complete.
  • Context - array compaction and element shifting is complete:
    For Update Array Count:
    When system calculates the new array element count, then array count is updated to reflect the number of valid elements remaining after compaction.
  • Context - array compaction process is complete:
    For Validate Array Integrity:
    When system validates the compacted array structure, then array integrity is verified to ensure all elements are properly positioned and accessible.
  • Context - array integrity validation has been performed:
    For Array Structure Valid?:
    When system evaluates validation results, then system determines if array structure is valid or if error recovery is needed.
  • Context - array structure has been validated as correct after compaction:
    For Clear Unused Array Positions:
    When system processes unused array positions, then all unused positions beyond the new array boundary are cleared and reset.
  • Context - array compaction is complete and unused positions are cleared:
    For Set New Array Boundary:
    When system sets the new array boundary, then array boundary is updated to reflect the compacted size and valid element range.
  • Context - all compaction steps have been completed successfully:
    For Array Compaction Complete:
    When system finalizes the compaction process, then array compaction is marked as complete and array is ready for normal operations.
  • Context - array structure validation has failed:
    For Log Array Compaction Error:
    When system detects compaction errors, then error details are logged for troubleshooting and recovery processing.
  • Context - array compaction has failed validation and errors are logged:
    For Restore Array to Previous State:
    When system performs error recovery, then array is restored to its previous valid state before compaction was attempted.
👨‍💻 Technical ACs (Gherkin)
Context: Array compaction process is starting
GIVEN
Array compaction process is starting
Applied to: Initialize Compaction Variables
WHEN
System begins array compaction operation
THEN
Compaction variables are initialized to default values for tracking element positions and array boundaries
Context: Status array contains elements that may be marked for removal
GIVEN
Status array contains elements that may be marked for removal
Applied to: Scan Status Array for Marked Elements
WHEN
System scans through each array position
THEN
Each element is evaluated to determine if it should be removed from the array
Context: An array element is being evaluated during compaction scan
GIVEN
An array element is being evaluated during compaction scan
Applied to: Element Marked for Removal?
WHEN
System checks element removal markers or status flags
THEN
Element is classified as either marked for removal or to be retained in the array
Context: An array element has been identified for removal
GIVEN
An array element has been identified for removal
Applied to: Mark Element Position
WHEN
System processes the element marked for removal
THEN
Element position is recorded for subsequent removal during array compaction
Context: Current array element has been processed for removal evaluation
GIVEN
Current array element has been processed for removal evaluation
Applied to: Continue Scanning
WHEN
System moves to next array position
THEN
Scanning continues with the subsequent array element
Context: System is scanning array elements for compaction
GIVEN
System is scanning array elements for compaction
Applied to: More Elements to Check?
WHEN
Current element scanning is complete
THEN
System determines whether more elements remain to be checked or scanning phase is complete
Context: Array scanning is complete and elements marked for removal are identified
GIVEN
Array scanning is complete and elements marked for removal are identified
Applied to: Begin Element Shifting Process
WHEN
System starts the element shifting phase of compaction
THEN
Element shifting process begins to compact the array by removing gaps
Context: Array contains gaps from removed elements
GIVEN
Array contains gaps from removed elements
Applied to: Identify First Gap Position
WHEN
System searches for the first available gap position
THEN
First gap position is identified as the target for element movement
Context: A gap position has been identified for filling
GIVEN
A gap position has been identified for filling
Applied to: Find Next Valid Element
WHEN
System searches for valid elements to move into the gap
THEN
Next valid element is located for movement to the gap position
Context: System is searching for elements to move during compaction
GIVEN
System is searching for elements to move during compaction
Applied to: Valid Element Found?
WHEN
Search for valid element is complete
THEN
System determines if a valid element was found or if no more elements need to be moved
Context: A valid element and gap position have been identified
GIVEN
A valid element and gap position have been identified
Applied to: Shift Element to Gap Position
WHEN
System performs element movement operation
THEN
Element is copied from its current position to the gap position in the array
Context: An element has been moved to a new position in the array
GIVEN
An element has been moved to a new position in the array
Applied to: Update Element Pointers
WHEN
System updates element tracking information
THEN
All pointers and references are updated to reflect the element's new position
Context: An element has been successfully moved to a new position
GIVEN
An element has been successfully moved to a new position
Applied to: Mark Old Position as Empty
WHEN
System processes the element's original position
THEN
Original position is marked as empty and available for future use
Context: An element has been successfully shifted to fill a gap
GIVEN
An element has been successfully shifted to fill a gap
Applied to: More Elements to Shift?
WHEN
System evaluates remaining elements for movement
THEN
System determines whether more elements need to be shifted or compaction is complete
Context: Array compaction and element shifting is complete
GIVEN
Array compaction and element shifting is complete
Applied to: Update Array Count
WHEN
System calculates the new array element count
THEN
Array count is updated to reflect the number of valid elements remaining after compaction
Context: Array compaction process is complete
GIVEN
Array compaction process is complete
Applied to: Validate Array Integrity
WHEN
System validates the compacted array structure
THEN
Array integrity is verified to ensure all elements are properly positioned and accessible
Context: Array integrity validation has been performed
GIVEN
Array integrity validation has been performed
Applied to: Array Structure Valid?
WHEN
System evaluates validation results
THEN
System determines if array structure is valid or if error recovery is needed
Context: Array structure has been validated as correct after compaction
GIVEN
Array structure has been validated as correct after compaction
Applied to: Clear Unused Array Positions
WHEN
System processes unused array positions
THEN
All unused positions beyond the new array boundary are cleared and reset
Context: Array compaction is complete and unused positions are cleared
GIVEN
Array compaction is complete and unused positions are cleared
Applied to: Set New Array Boundary
WHEN
System sets the new array boundary
THEN
Array boundary is updated to reflect the compacted size and valid element range
Context: All compaction steps have been completed successfully
GIVEN
All compaction steps have been completed successfully
Applied to: Array Compaction Complete
WHEN
System finalizes the compaction process
THEN
Array compaction is marked as complete and array is ready for normal operations
Context: Array structure validation has failed
GIVEN
Array structure validation has failed
Applied to: Log Array Compaction Error
WHEN
System detects compaction errors
THEN
Error details are logged for troubleshooting and recovery processing
Context: Array compaction has failed validation and errors are logged
GIVEN
Array compaction has failed validation and errors are logged
Applied to: Restore Array to Previous State
WHEN
System performs error recovery
THEN
Array is restored to its previous valid state before compaction was attempted
R-GCX016-cbl-04467 (+30) File: GCX016.cbl Begin S09A Status Array Analysis Merged 31 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Begin S09A Status Array Analysis':
  • Context - the system is about to analyze the s09a status array:
    For Initialize Analysis Variables:
    When the status analysis process begins, then all analysis variables are initialized to default values including hold flags, release flags, ptt flags, proceed flags, arrival flags, export flags, fda hold flags, and quantity counters.
  • Context - the s09a status array exists and contains elements:
    For Set Array Index to First Element:
    When the system begins array processing, then the array index is set to position 1 to start processing from the first element.
  • Context - the system is processing the s09a status array:
    For More Elements in S09A Array?:
    When the system checks the current array index position, then if the current index is within the array bounds, continue processing; otherwise, complete the analysis.
  • Context - the array index points to a valid position in the s09a array:
    For Get Current Array Element:
    When the system processes the current array element, then the current array element is retrieved and made available for disposition code analysis.
  • Context - a valid s09a array element is being processed:
    For Extract Disposition Code:
    When the system analyzes the array element structure, then the disposition code is extracted from the element and made available for classification.
  • Context - a disposition code has been extracted from the array element:
    For Extract Status Information:
    When the system continues element analysis, then status information including flags and indicators are extracted from the element.
  • Context - status information has been extracted from the array element:
    For Extract Location Information:
    When the system continues detailed element analysis, then location information including border and destination indicators are extracted from the element.
  • Context - location information has been extracted from the array element:
    For Extract Quantity Information:
    When the system completes element data extraction, then quantity information including release quantities and totals are extracted from the element.
  • Context - a disposition code has been extracted from the s09a array element:
    For Is Hold Code?:
    When the system evaluates the disposition code type, then if the disposition code indicates a hold status, set the hold processing flag; otherwise, continue to release code evaluation.
  • Context - the disposition code has been identified as a hold code:
    For Set Hold Status Flag:
    When the system processes the hold disposition, then the hold status flag is set to true to indicate cargo is held.
  • Context - a hold status flag has been set and location information is available:
    For Is Border Hold?:
    When the system evaluates the hold location, then if the hold applies to border location, set border hold flag; otherwise, set destination hold flag.
  • Context - the hold has been determined to apply to border location:
    For Set Border Hold Flag:
    When the system processes the border hold, then the border hold flag is set to true to indicate cargo is held at border.
  • Context - the hold has been determined to apply to destination location:
    For Set Destination Hold Flag:
    When the system processes the destination hold, then the destination hold flag is set to true to indicate cargo is held at destination.
  • Context - the disposition code is not a hold code:
    For Is Release Code?:
    When the system evaluates the disposition code for release status, then if the disposition code indicates a release status, set the release processing flag; otherwise, continue to ptt code evaluation.
  • Context - the disposition code has been identified as a release code:
    For Set Release Status Flag:
    When the system processes the release disposition, then the release status flag is set to true to indicate cargo is released.
  • Context - a release status flag has been set and quantity information is available:
    For Update Release Quantity:
    When the system processes the release quantity, then the release quantity is updated by adding or subtracting the specified quantity amount.
  • Context - the disposition code is not a release code:
    For Is PTT Code?:
    When the system evaluates the disposition code for ptt status, then if the disposition code indicates ptt status, set the ptt processing flag; otherwise, continue to proceed code evaluation.
  • Context - the disposition code has been identified as a ptt code:
    For Set PTT Status Flag:
    When the system processes the ptt disposition, then the ptt status flag is set to true to indicate cargo can proceed to transfer.
  • Context - a ptt status flag has been set:
    For Save PTT Information:
    When the system processes ptt information, then ptt information including location and quantity details are saved for later use.
  • Context - the disposition code is not a ptt code:
    For Is Proceed Code?:
    When the system evaluates the disposition code for proceed status, then if the disposition code indicates proceed status, set the proceed processing flag; otherwise, continue to arrival code evaluation.
  • Context - the disposition code has been identified as a proceed code:
    For Set Proceed Status Flag:
    When the system processes the proceed disposition, then the proceed status flag is set to true to indicate cargo can proceed.
  • Context - a proceed status flag has been set:
    For Update Border Arrival Date:
    When the system processes the proceed status, then the border arrival date is updated to reflect the proceed processing date.
  • Context - the disposition code is not a proceed code:
    For Is Arrival Code?:
    When the system evaluates the disposition code for arrival status, then if the disposition code indicates arrival status, set the arrival processing flag; otherwise, continue to export code evaluation.
  • Context - the disposition code has been identified as an arrival code:
    For Set Arrival Status Flag:
    When the system processes the arrival disposition, then the arrival status flag is set to true to indicate cargo has arrived.
  • Context - the disposition code is not an arrival code:
    For Is Export Code?:
    When the system evaluates the disposition code for export status, then if the disposition code indicates export status, set the export processing flag; otherwise, continue to fda hold code evaluation.
  • Context - the disposition code has been identified as an export code:
    For Set Export Status Flag:
    When the system processes the export disposition, then the export status flag is set to true to indicate cargo is being exported.
  • Context - the disposition code is not an export code:
    For Is FDA Hold Code?:
    When the system evaluates the disposition code for fda hold status, then if the disposition code indicates fda hold status, set the fda hold processing flag; otherwise, continue to next array element.
  • Context - the disposition code has been identified as an fda hold code:
    For Set FDA Hold Status Flag:
    When the system processes the fda hold disposition, then the fda hold status flag is set to true to indicate cargo is under fda hold.
  • Context - the current array element has been completely processed:
    For Increment Array Index:
    When the system prepares to process the next element, then the array index is incremented by 1 to point to the next element in the array.
  • Context - all elements in the s09a status array have been processed:
    For Complete Status Determination:
    When the system reaches the end of the array, then the status determination analysis is marked as complete with all flags and counters finalized.
  • Context - the status determination analysis has been completed:
    For Return Analysis Results:
    When the system prepares to return control to the calling process, then all analysis results including hold flags, release flags, ptt flags, proceed flags, arrival flags, export flags, fda hold flags, and quantity totals are returned.
👨‍💻 Technical ACs (Gherkin)
Context: The system is about to analyze the S09A status array
GIVEN
The system is about to analyze the S09A status array
Applied to: Initialize Analysis Variables
WHEN
The status analysis process begins
THEN
All analysis variables are initialized to default values including hold flags, release flags, PTT flags, proceed flags, arrival flags, export flags, FDA hold flags, and quantity counters
Context: The S09A status array exists and contains elements
GIVEN
The S09A status array exists and contains elements
Applied to: Set Array Index to First Element
WHEN
The system begins array processing
THEN
The array index is set to position 1 to start processing from the first element
Context: The system is processing the S09A status array
GIVEN
The system is processing the S09A status array
Applied to: More Elements in S09A Array?
WHEN
The system checks the current array index position
THEN
If the current index is within the array bounds, continue processing; otherwise, complete the analysis
Context: The array index points to a valid position in the S09A array
GIVEN
The array index points to a valid position in the S09A array
Applied to: Get Current Array Element
WHEN
The system processes the current array element
THEN
The current array element is retrieved and made available for disposition code analysis
Context: A valid S09A array element is being processed
GIVEN
A valid S09A array element is being processed
Applied to: Extract Disposition Code
WHEN
The system analyzes the array element structure
THEN
The disposition code is extracted from the element and made available for classification
Context: A disposition code has been extracted from the array element
GIVEN
A disposition code has been extracted from the array element
Applied to: Extract Status Information
WHEN
The system continues element analysis
THEN
Status information including flags and indicators are extracted from the element
Context: Status information has been extracted from the array element
GIVEN
Status information has been extracted from the array element
Applied to: Extract Location Information
WHEN
The system continues detailed element analysis
THEN
Location information including border and destination indicators are extracted from the element
Context: Location information has been extracted from the array element
GIVEN
Location information has been extracted from the array element
Applied to: Extract Quantity Information
WHEN
The system completes element data extraction
THEN
Quantity information including release quantities and totals are extracted from the element
Context: A disposition code has been extracted from the S09A array element
GIVEN
A disposition code has been extracted from the S09A array element
Applied to: Is Hold Code?
WHEN
The system evaluates the disposition code type
THEN
If the disposition code indicates a hold status, set the hold processing flag; otherwise, continue to release code evaluation
Context: The disposition code has been identified as a hold code
GIVEN
The disposition code has been identified as a hold code
Applied to: Set Hold Status Flag
WHEN
The system processes the hold disposition
THEN
The hold status flag is set to true to indicate cargo is held
Context: A hold status flag has been set and location information is available
GIVEN
A hold status flag has been set and location information is available
Applied to: Is Border Hold?
WHEN
The system evaluates the hold location
THEN
If the hold applies to border location, set border hold flag; otherwise, set destination hold flag
Context: The hold has been determined to apply to border location
GIVEN
The hold has been determined to apply to border location
Applied to: Set Border Hold Flag
WHEN
The system processes the border hold
THEN
The border hold flag is set to true to indicate cargo is held at border
Context: The hold has been determined to apply to destination location
GIVEN
The hold has been determined to apply to destination location
Applied to: Set Destination Hold Flag
WHEN
The system processes the destination hold
THEN
The destination hold flag is set to true to indicate cargo is held at destination
Context: The disposition code is not a hold code
GIVEN
The disposition code is not a hold code
Applied to: Is Release Code?
WHEN
The system evaluates the disposition code for release status
THEN
If the disposition code indicates a release status, set the release processing flag; otherwise, continue to PTT code evaluation
Context: The disposition code has been identified as a release code
GIVEN
The disposition code has been identified as a release code
Applied to: Set Release Status Flag
WHEN
The system processes the release disposition
THEN
The release status flag is set to true to indicate cargo is released
Context: A release status flag has been set and quantity information is available
GIVEN
A release status flag has been set and quantity information is available
Applied to: Update Release Quantity
WHEN
The system processes the release quantity
THEN
The release quantity is updated by adding or subtracting the specified quantity amount
Context: The disposition code is not a release code
GIVEN
The disposition code is not a release code
Applied to: Is PTT Code?
WHEN
The system evaluates the disposition code for PTT status
THEN
If the disposition code indicates PTT status, set the PTT processing flag; otherwise, continue to proceed code evaluation
Context: The disposition code has been identified as a PTT code
GIVEN
The disposition code has been identified as a PTT code
Applied to: Set PTT Status Flag
WHEN
The system processes the PTT disposition
THEN
The PTT status flag is set to true to indicate cargo can proceed to transfer
Context: A PTT status flag has been set
GIVEN
A PTT status flag has been set
Applied to: Save PTT Information
WHEN
The system processes PTT information
THEN
PTT information including location and quantity details are saved for later use
Context: The disposition code is not a PTT code
GIVEN
The disposition code is not a PTT code
Applied to: Is Proceed Code?
WHEN
The system evaluates the disposition code for proceed status
THEN
If the disposition code indicates proceed status, set the proceed processing flag; otherwise, continue to arrival code evaluation
Context: The disposition code has been identified as a proceed code
GIVEN
The disposition code has been identified as a proceed code
Applied to: Set Proceed Status Flag
WHEN
The system processes the proceed disposition
THEN
The proceed status flag is set to true to indicate cargo can proceed
Context: A proceed status flag has been set
GIVEN
A proceed status flag has been set
Applied to: Update Border Arrival Date
WHEN
The system processes the proceed status
THEN
The border arrival date is updated to reflect the proceed processing date
Context: The disposition code is not a proceed code
GIVEN
The disposition code is not a proceed code
Applied to: Is Arrival Code?
WHEN
The system evaluates the disposition code for arrival status
THEN
If the disposition code indicates arrival status, set the arrival processing flag; otherwise, continue to export code evaluation
Context: The disposition code has been identified as an arrival code
GIVEN
The disposition code has been identified as an arrival code
Applied to: Set Arrival Status Flag
WHEN
The system processes the arrival disposition
THEN
The arrival status flag is set to true to indicate cargo has arrived
Context: The disposition code is not an arrival code
GIVEN
The disposition code is not an arrival code
Applied to: Is Export Code?
WHEN
The system evaluates the disposition code for export status
THEN
If the disposition code indicates export status, set the export processing flag; otherwise, continue to FDA hold code evaluation
Context: The disposition code has been identified as an export code
GIVEN
The disposition code has been identified as an export code
Applied to: Set Export Status Flag
WHEN
The system processes the export disposition
THEN
The export status flag is set to true to indicate cargo is being exported
Context: The disposition code is not an export code
GIVEN
The disposition code is not an export code
Applied to: Is FDA Hold Code?
WHEN
The system evaluates the disposition code for FDA hold status
THEN
If the disposition code indicates FDA hold status, set the FDA hold processing flag; otherwise, continue to next array element
Context: The disposition code has been identified as an FDA hold code
GIVEN
The disposition code has been identified as an FDA hold code
Applied to: Set FDA Hold Status Flag
WHEN
The system processes the FDA hold disposition
THEN
The FDA hold status flag is set to true to indicate cargo is under FDA hold
Context: The current array element has been completely processed
GIVEN
The current array element has been completely processed
Applied to: Increment Array Index
WHEN
The system prepares to process the next element
THEN
The array index is incremented by 1 to point to the next element in the array
Context: All elements in the S09A status array have been processed
GIVEN
All elements in the S09A status array have been processed
Applied to: Complete Status Determination
WHEN
The system reaches the end of the array
THEN
The status determination analysis is marked as complete with all flags and counters finalized
Context: The status determination analysis has been completed
GIVEN
The status determination analysis has been completed
Applied to: Return Analysis Results
WHEN
The system prepares to return control to the calling process
THEN
All analysis results including hold flags, release flags, PTT flags, proceed flags, arrival flags, export flags, FDA hold flags, and quantity totals are returned
R-GCX016-cbl-04498 (+18) File: GCX016.cbl Analyze Combined Flag States Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Analyze Combined Flag States':
  • Context - cargo status analysis is being performed and hold flags have been set during processing and release flags have been set during processing:
    For Check Hold/Release Conflict:
    When the system evaluates flag combinations for conflicts, then a hold/release conflict is identified when both flag types are active simultaneously.
  • Context - a hold/release conflict exists and both hold and release flags are set:
    For Apply Hold Priority Rule:
    When the system applies conflict resolution rules, then hold flags take priority and release flags are overridden and hold status is preserved.
  • Context - ptt flag is set for cargo and cargo has defined total quantities and cargo has defined release quantities:
    For Validate PTT Quantities:
    When the system validates ptt quantity requirements, then ptt quantities are valid when release quantities meet or exceed required thresholds for ptt status.
  • Context - ptt flag is set and ptt quantity validation has been performed and ptt quantities are determined to be invalid:
    For Clear PTT Flag:
    When the system processes invalid ptt quantities, then ptt flag is cleared and ptt status is removed from cargo.
  • Context - ptt flag is set and ptt quantity validation has been performed and ptt quantities are determined to be valid:
    For Preserve PTT Status:
    When the system processes valid ptt quantities, then ptt status is preserved and ptt flag remains active.
  • Context - fda hold flag is set and cargo has destination location information:
    For FDA at Destination?:
    When the system evaluates fda hold location requirements, then fda hold at destination is true when fda requirements apply to destination location and false when fda requirements apply to other locations.
  • Context - fda hold flag is set and fda hold applies at destination location:
    For Set FDA Hold Priority:
    When the system applies fda override logic, then fda hold status takes highest priority and overrides all conflicting status flags.
  • Context - fda hold priority has been established and other release flags are currently set:
    For Override Other Release Flags:
    When the system applies fda override logic, then all other release flags are overridden and cleared by fda hold priority.
  • Context - cargo status analysis is in progress and proceed flag evaluation is required:
    For Proceed Flag Set?:
    When the system evaluates proceed flag status, then proceed flag is set when cargo is authorized to proceed and proceed flag is not set when cargo is not authorized to proceed.
  • Context - proceed flag is set and cargo requires border arrival processing:
    For Set Border Arrival Status:
    When the system processes proceed flag activation, then border arrival status is set and border arrival date is recorded.
  • Context - cargo status analysis is in progress and export flag evaluation is required:
    For Export Flag Set?:
    When the system evaluates export flag status, then export flag is set when cargo is designated for export and export flag is not set when cargo is not designated for export.
  • Context - export flag is set and cargo has existing destination index information:
    For Clear Destination Index:
    When the system processes export flag activation, then destination index is cleared and destination routing information is removed.
  • Context - export flag is set and destination index has been cleared:
    For Set Export Status:
    When the system completes export flag processing, then export status is assigned to cargo and export processing indicators are set.
  • Context - cargo status analysis is in progress and arrival flag evaluation is required:
    For Arrival Flag Set?:
    When the system evaluates arrival flag status, then arrival flag is set when cargo has arrived at destination and arrival flag is not set when cargo has not arrived at destination.
  • Context - arrival flag is set and cargo requires arrival status processing:
    For Set Arrival Status:
    When the system processes arrival flag activation, then arrival status is assigned to cargo and arrival date and time are recorded.
  • Context - final status determination is in progress and multiple status flags are set:
    For Multiple Conflicting States?:
    When the system evaluates flag combinations for conflicts, then multiple conflicting states exist when incompatible status flags are simultaneously active and no conflicts exist when status flags are compatible.
  • Context - multiple conflicting states have been detected and business rule priorities are defined:
    For Apply Business Rule Priority:
    When the system resolves status conflicts, then highest priority business rule is applied and lower priority rules are subordinated according to established hierarchy.
  • Context - business rule priority has been applied and winning status has been determined:
    For Set Primary Status Flag:
    When the system finalizes status assignment, then primary status flag is set to the highest priority status and primary status becomes the active cargo status.
  • Context - primary status flag has been set and conflicting flags still exist:
    For Clear Conflicting Flags:
    When the system completes conflict resolution, then all conflicting flags are cleared and only the primary status flag remains active.
👨‍💻 Technical ACs (Gherkin)
Context: Cargo status analysis is being performed AND hold flags have been set during processing AND release flags have been set during processing
GIVEN
Cargo status analysis is being performed AND hold flags have been set during processing AND release flags have been set during processing
Applied to: Check Hold/Release Conflict
WHEN
The system evaluates flag combinations for conflicts
THEN
A hold/release conflict is identified when both flag types are active simultaneously
Context: A hold/release conflict exists AND both hold and release flags are set
GIVEN
A hold/release conflict exists AND both hold and release flags are set
Applied to: Apply Hold Priority Rule
WHEN
The system applies conflict resolution rules
THEN
Hold flags take priority AND release flags are overridden AND hold status is preserved
Context: PTT flag is set for cargo AND cargo has defined total quantities AND cargo has defined release quantities
GIVEN
PTT flag is set for cargo AND cargo has defined total quantities AND cargo has defined release quantities
Applied to: Validate PTT Quantities
WHEN
The system validates PTT quantity requirements
THEN
PTT quantities are valid when release quantities meet or exceed required thresholds for PTT status
Context: PTT flag is set AND PTT quantity validation has been performed AND PTT quantities are determined to be invalid
GIVEN
PTT flag is set AND PTT quantity validation has been performed AND PTT quantities are determined to be invalid
Applied to: Clear PTT Flag
WHEN
The system processes invalid PTT quantities
THEN
PTT flag is cleared AND PTT status is removed from cargo
Context: PTT flag is set AND PTT quantity validation has been performed AND PTT quantities are determined to be valid
GIVEN
PTT flag is set AND PTT quantity validation has been performed AND PTT quantities are determined to be valid
Applied to: Preserve PTT Status
WHEN
The system processes valid PTT quantities
THEN
PTT status is preserved AND PTT flag remains active
Context: FDA hold flag is set AND cargo has destination location information
GIVEN
FDA hold flag is set AND cargo has destination location information
Applied to: FDA at Destination?
WHEN
The system evaluates FDA hold location requirements
THEN
FDA hold at destination is true when FDA requirements apply to destination location AND false when FDA requirements apply to other locations
Context: FDA hold flag is set AND FDA hold applies at destination location
GIVEN
FDA hold flag is set AND FDA hold applies at destination location
Applied to: Set FDA Hold Priority
WHEN
The system applies FDA override logic
THEN
FDA hold status takes highest priority AND overrides all conflicting status flags
Context: FDA hold priority has been established AND other release flags are currently set
GIVEN
FDA hold priority has been established AND other release flags are currently set
Applied to: Override Other Release Flags
WHEN
The system applies FDA override logic
THEN
All other release flags are overridden AND cleared by FDA hold priority
Context: Cargo status analysis is in progress AND proceed flag evaluation is required
GIVEN
Cargo status analysis is in progress AND proceed flag evaluation is required
Applied to: Proceed Flag Set?
WHEN
The system evaluates proceed flag status
THEN
Proceed flag is set when cargo is authorized to proceed AND proceed flag is not set when cargo is not authorized to proceed
Context: Proceed flag is set AND cargo requires border arrival processing
GIVEN
Proceed flag is set AND cargo requires border arrival processing
Applied to: Set Border Arrival Status
WHEN
The system processes proceed flag activation
THEN
Border arrival status is set AND border arrival date is recorded
Context: Cargo status analysis is in progress AND export flag evaluation is required
GIVEN
Cargo status analysis is in progress AND export flag evaluation is required
Applied to: Export Flag Set?
WHEN
The system evaluates export flag status
THEN
Export flag is set when cargo is designated for export AND export flag is not set when cargo is not designated for export
Context: Export flag is set AND cargo has existing destination index information
GIVEN
Export flag is set AND cargo has existing destination index information
Applied to: Clear Destination Index
WHEN
The system processes export flag activation
THEN
Destination index is cleared AND destination routing information is removed
Context: Export flag is set AND destination index has been cleared
GIVEN
Export flag is set AND destination index has been cleared
Applied to: Set Export Status
WHEN
The system completes export flag processing
THEN
Export status is assigned to cargo AND export processing indicators are set
Context: Cargo status analysis is in progress AND arrival flag evaluation is required
GIVEN
Cargo status analysis is in progress AND arrival flag evaluation is required
Applied to: Arrival Flag Set?
WHEN
The system evaluates arrival flag status
THEN
Arrival flag is set when cargo has arrived at destination AND arrival flag is not set when cargo has not arrived at destination
Context: Arrival flag is set AND cargo requires arrival status processing
GIVEN
Arrival flag is set AND cargo requires arrival status processing
Applied to: Set Arrival Status
WHEN
The system processes arrival flag activation
THEN
Arrival status is assigned to cargo AND arrival date and time are recorded
Context: Final status determination is in progress AND multiple status flags are set
GIVEN
Final status determination is in progress AND multiple status flags are set
Applied to: Multiple Conflicting States?
WHEN
The system evaluates flag combinations for conflicts
THEN
Multiple conflicting states exist when incompatible status flags are simultaneously active AND no conflicts exist when status flags are compatible
Context: Multiple conflicting states have been detected AND business rule priorities are defined
GIVEN
Multiple conflicting states have been detected AND business rule priorities are defined
Applied to: Apply Business Rule Priority
WHEN
The system resolves status conflicts
THEN
Highest priority business rule is applied AND lower priority rules are subordinated according to established hierarchy
Context: Business rule priority has been applied AND winning status has been determined
GIVEN
Business rule priority has been applied AND winning status has been determined
Applied to: Set Primary Status Flag
WHEN
The system finalizes status assignment
THEN
Primary status flag is set to the highest priority status AND primary status becomes the active cargo status
Context: Primary status flag has been set AND conflicting flags still exist
GIVEN
Primary status flag has been set AND conflicting flags still exist
Applied to: Clear Conflicting Flags
WHEN
The system completes conflict resolution
THEN
All conflicting flags are cleared AND only the primary status flag remains active
R-GCX016-cbl-04517 (+14) File: GCX016.cbl Process Canadian Manifest Coordination Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Canadian Manifest Coordination':
  • Context - a us cargo record exists with equipment information:
    For Get Equipment ID from US Cargo:
    When the system initiates canadian manifest coordination processing, then the equipment id is extracted from the us cargo record for canadian database search.
  • Context - an equipment id has been extracted from us cargo record:
    For Search Canadian Cargo Database:
    When the system searches the canadian cargo database, then the system retrieves canadian cargo records matching the equipment id.
  • Context - a search has been performed in the canadian cargo database using equipment id:
    For Canadian Cargo Found?:
    When the system evaluates the search results, then the system determines if canadian cargo records were found and routes processing accordingly.
  • Context - canadian cargo records have been found for the equipment id:
    For Validate Canadian Record Status:
    When the system validates the record status, then the system checks that records are not deleted and have valid processing status.
  • Context - canadian cargo records have been retrieved and status validated:
    For Record Valid?:
    When the system evaluates record validity, then the system determines if records are valid for processing or should be excluded due to deletion or invalid status.
  • Context - valid canadian cargo records exist and us cargo equipment id is available:
    For Match Equipment ID with Canadian Cargo:
    When the system performs equipment id matching, then the system compares us cargo equipment id with canadian cargo equipment id for exact match.
  • Context - equipment id comparison has been performed between us and canadian cargo records:
    For Equipment ID Matches?:
    When the system evaluates the match results, then the system determines if equipment ids match exactly and routes to appropriate processing path.
  • Context - us and canadian cargo records have matching equipment ids:
    For Generate Cross-Border Log Message:
    When the system generates cross-border coordination log, then the system creates a log message with us cargo details, canadian cargo details, and coordination timestamp.
  • Context - us and canadian cargo records are successfully matched and cross-border log generated:
    For Update Canadian CCN with US Release Status:
    When the system updates canadian ccn record, then the canadian cargo record is updated with us release status, release quantities, and coordination timestamp.
  • Context - canadian ccn has been updated with us release status:
    For Create Audit Trail Entry:
    When the system creates audit trail entry, then the system records coordination details, timestamp, user information, and status changes in audit trail.
  • Context - audit trail entry has been created for cross-border coordination:
    For Send Notification to Canadian System:
    When the system sends notification to canadian system, then the system transmits notification message with cargo release details and coordination status to canadian system.
  • Context - notification has been sent to canadian system:
    For Log Coordination Complete:
    When the system logs coordination completion, then the system records successful coordination completion with timestamp and processing details.
  • Context - canadian cargo search returns no results or canadian records are invalid or equipment ids do not match:
    For No Canadian Match Found:
    When the system processes no match condition, then the system routes to no match processing path without updating canadian records.
  • Context - no matching canadian cargo records were found or records were invalid:
    For Log No Match Status:
    When the system logs no match status, then the system records no match condition with equipment id, search criteria, and timestamp for audit purposes.
  • Context - cross-border coordination is complete or no canadian match was found and logged:
    For Continue Processing:
    When the system continues processing, then the system proceeds with normal us cargo processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo record exists with equipment information
GIVEN
A US cargo record exists with equipment information
Applied to: Get Equipment ID from US Cargo
WHEN
The system initiates Canadian manifest coordination processing
THEN
The equipment ID is extracted from the US cargo record for Canadian database search
Context: An equipment ID has been extracted from US cargo record
GIVEN
An equipment ID has been extracted from US cargo record
Applied to: Search Canadian Cargo Database
WHEN
The system searches the Canadian cargo database
THEN
The system retrieves Canadian cargo records matching the equipment ID
Context: A search has been performed in the Canadian cargo database using equipment ID
GIVEN
A search has been performed in the Canadian cargo database using equipment ID
Applied to: Canadian Cargo Found?
WHEN
The system evaluates the search results
THEN
The system determines if Canadian cargo records were found and routes processing accordingly
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 Record Status
WHEN
The system validates the record status
THEN
The system checks that records are not deleted and have valid processing status
Context: Canadian cargo records have been retrieved and status validated
GIVEN
Canadian cargo records have been retrieved and status validated
Applied to: Record Valid?
WHEN
The system evaluates record validity
THEN
The system determines if records are valid for processing or should be excluded due to deletion or invalid status
Context: Valid Canadian cargo records exist and US cargo equipment ID is available
GIVEN
Valid Canadian cargo records exist and US cargo equipment ID is available
Applied to: Match Equipment ID with Canadian Cargo
WHEN
The system performs equipment ID matching
THEN
The system compares US cargo equipment ID with Canadian cargo equipment ID for exact match
Context: Equipment ID comparison has been performed between US and Canadian cargo records
GIVEN
Equipment ID comparison has been performed between US and Canadian cargo records
Applied to: Equipment ID Matches?
WHEN
The system evaluates the match results
THEN
The system determines if equipment IDs match exactly and routes to appropriate processing path
Context: US and Canadian cargo records have matching equipment IDs
GIVEN
US and Canadian cargo records have matching equipment IDs
Applied to: Generate Cross-Border Log Message
WHEN
The system generates cross-border coordination log
THEN
The system creates a log message with US cargo details, Canadian cargo details, and coordination timestamp
Context: US and Canadian cargo records are successfully matched and cross-border log generated
GIVEN
US and Canadian cargo records are successfully matched and cross-border log generated
Applied to: Update Canadian CCN with US Release Status
WHEN
The system updates Canadian CCN record
THEN
The Canadian cargo record is updated with US release status, release quantities, and coordination timestamp
Context: Canadian CCN has been updated with US release status
GIVEN
Canadian CCN has been updated with US release status
Applied to: Create Audit Trail Entry
WHEN
The system creates audit trail entry
THEN
The system records coordination details, timestamp, user information, and status changes in audit trail
Context: Audit trail entry has been created for cross-border coordination
GIVEN
Audit trail entry has been created for cross-border coordination
Applied to: Send Notification to Canadian System
WHEN
The system sends notification to Canadian system
THEN
The system transmits notification message with cargo release details and coordination status to Canadian system
Context: Notification has been sent to Canadian system
GIVEN
Notification has been sent to Canadian system
Applied to: Log Coordination Complete
WHEN
The system logs coordination completion
THEN
The system records successful coordination completion with timestamp and processing details
Context: Canadian cargo search returns no results OR Canadian records are invalid OR equipment IDs do not match
GIVEN
Canadian cargo search returns no results OR Canadian records are invalid OR equipment IDs do not match
Applied to: No Canadian Match Found
WHEN
The system processes no match condition
THEN
The system routes to no match processing path without updating Canadian records
Context: No matching Canadian cargo records were found or records were invalid
GIVEN
No matching Canadian cargo records were found or records were invalid
Applied to: Log No Match Status
WHEN
The system logs no match status
THEN
The system records no match condition with equipment ID, search criteria, and timestamp for audit purposes
Context: Cross-border coordination is complete OR no Canadian match was found and logged
GIVEN
Cross-border coordination is complete OR no Canadian match was found and logged
Applied to: Continue Processing
WHEN
The system continues processing
THEN
The system proceeds with normal US cargo processing workflow
R-GCX016-cbl-04532 (+7) File: GCX016.cbl Calculate Cargo Age Using Julian Dates Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Calculate Cargo Age Using Julian Dates':
  • Context - a cargo record is being processed for age calculation:
    For Bond Start Date Available?:
    When the system checks the bond start date field in the cargo record, then if bond start date is present, proceed with age calculation; if bond start date is missing or blank, skip age calculation and end the process.
  • Context - a valid bond start date exists in the cargo record:
    For Convert Bond Start Date to Julian Format:
    When the system needs to calculate cargo age, then convert the bond start date to julian format using the date conversion utility.
  • Context - the current system date is available:
    For Convert Current Date to Julian Format:
    When age calculation is being performed, then convert the current system date to julian format using the date conversion utility.
  • Context - both bond start date and current date are converted to julian format:
    For Calculate Age in Days Current Julian - Bond Start Julian:
    When the system performs age calculation, then calculate age in days by subtracting bond start julian date from current julian date.
  • Context - cargo age in days has been calculated:
    For Age > Threshold for Destination Indexing?:
    When the system evaluates destination indexing requirements, then if age is greater than the destination indexing threshold, set destination index required flag; otherwise clear the destination index flag.
  • Context - cargo age exceeds the destination indexing threshold:
    For Set Destination Index Required Flag:
    When the system processes destination indexing requirements, then set the destination index required flag to indicate that destination indexing is needed.
  • Context - cargo age does not exceed the destination indexing threshold:
    For Clear Destination Index Flag:
    When the system processes destination indexing requirements, then clear the destination index flag to indicate that destination indexing is not required.
  • Context - cargo age has been calculated and destination index requirements determined:
    For Update Cargo Record with Age Information:
    When the system completes age calculation processing, then update the cargo record with the calculated age information and destination index flag status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for age calculation
GIVEN
A cargo record is being processed for age calculation
Applied to: Bond Start Date Available?
WHEN
The system checks the bond start date field in the cargo record
THEN
If bond start date is present, proceed with age calculation; if bond start date is missing or blank, skip age calculation and end the process
Context: A valid bond start date exists in the cargo record
GIVEN
A valid bond start date exists in the cargo record
Applied to: Convert Bond Start Date to Julian Format
WHEN
The system needs to calculate cargo age
THEN
Convert the bond start date to Julian format using the date conversion utility
Context: The current system date is available
GIVEN
The current system date is available
Applied to: Convert Current Date to Julian Format
WHEN
Age calculation is being performed
THEN
Convert the current system date to Julian format using the date conversion utility
Context: Both bond start date and current date are converted to Julian format
GIVEN
Both bond start date and current date are converted to Julian format
Applied to: Calculate Age in Days Current Julian - Bond Start Julian
WHEN
The system performs age calculation
THEN
Calculate age in days by subtracting bond start Julian date from current Julian date
Context: Cargo age in days has been calculated
GIVEN
Cargo age in days has been calculated
Applied to: Age > Threshold for Destination Indexing?
WHEN
The system evaluates destination indexing requirements
THEN
If age is greater than the destination indexing threshold, set destination index required flag; otherwise clear the destination index flag
Context: Cargo age exceeds the destination indexing threshold
GIVEN
Cargo age exceeds the destination indexing threshold
Applied to: Set Destination Index Required Flag
WHEN
The system processes destination indexing requirements
THEN
Set the destination index required flag to indicate that destination indexing is needed
Context: Cargo age does not exceed the destination indexing threshold
GIVEN
Cargo age does not exceed the destination indexing threshold
Applied to: Clear Destination Index Flag
WHEN
The system processes destination indexing requirements
THEN
Clear the destination index flag to indicate that destination indexing is not required
Context: Cargo age has been calculated and destination index requirements determined
GIVEN
Cargo age has been calculated and destination index requirements determined
Applied to: Update Cargo Record with Age Information
WHEN
The system completes age calculation processing
THEN
Update the cargo record with the calculated age information and destination index flag status
R-GCX016-cbl-04540 (+11) File: GCX016.cbl Search for Matching Canadian Manifests Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search for Matching Canadian Manifests':
  • Context - a us cargo record exists with equipment information:
    For Extract Equipment ID from US Cargo:
    When the system initiates canadian manifest search process, then the equipment id is extracted from the us cargo record for database query purposes.
  • Context - an equipment id has been extracted from us cargo record:
    For Query Canadian Cargo Database:
    When the system queries the canadian cargo database, then all canadian cargo records matching the equipment id are retrieved from the database.
  • Context - a query has been executed against the canadian cargo database:
    For Canadian Record Found?:
    When the system evaluates the query results, then if canadian records are found, proceed to record validation, otherwise check for more equipment ids to process.
  • Context - canadian cargo records have been found for the equipment id:
    For Validate Record Status:
    When the system validates each record's status, then record status is checked against valid status criteria for further processing eligibility.
  • Context - a canadian cargo record status has been validated:
    For Record Status Valid?:
    When the system determines record validity, then if record status is valid, proceed to usability check, otherwise skip to next equipment id processing.
  • Context - a canadian cargo record has valid status:
    For Check Record Usability:
    When the system checks record usability criteria, then record is evaluated against usability requirements including deletion status and bond creation flags.
  • Context - a canadian cargo record has been checked for usability:
    For Record Usable?:
    When the system evaluates usability criteria, then if record is usable, add to matching records list, otherwise proceed to check for more equipment ids.
  • Context - a canadian cargo record is determined to be valid and usable:
    For Add to Matching Records List:
    When the system processes the matching record, then the canadian cargo record is added to the collection of matching manifests for further processing.
  • Context - a canadian cargo record has been added to the matching records list:
    For Log Cross-Border Coordination:
    When the system logs the cross-border coordination, then the cargo release information is logged to the gcx105 system for audit trail and tracking.
  • Context - processing has completed for current equipment id:
    For More Equipment IDs?:
    When the system checks for additional equipment ids to process, then if more equipment ids exist, return to equipment id extraction, otherwise proceed to return matching results.
  • Context - all equipment ids have been processed for canadian manifest matching:
    For Return Matching Canadian Manifests:
    When the system completes the search process, then all matching canadian cargo records are returned for cross-border cargo coordination.
  • Context - no canadian cargo records are found for any equipment id:
    For No Matching Records Found:
    When the system completes the database search, then an empty result set is prepared for return to indicate no matching canadian manifests were found.
👨‍💻 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 initiates Canadian manifest search process
THEN
The equipment ID is extracted from the US cargo record for database query purposes
Context: An equipment ID has been extracted from US cargo record
GIVEN
An equipment ID has been extracted from US cargo record
Applied to: Query Canadian Cargo Database
WHEN
The system queries the Canadian cargo database
THEN
All Canadian cargo records matching the equipment ID are retrieved from the database
Context: A query has been executed against the Canadian cargo database
GIVEN
A query has been executed against the Canadian cargo database
Applied to: Canadian Record Found?
WHEN
The system evaluates the query results
THEN
If Canadian records are found, proceed to record validation, otherwise check for more equipment IDs to process
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 Record Status
WHEN
The system validates each record's status
THEN
Record status is checked against valid status criteria for further processing eligibility
Context: A Canadian cargo record status has been validated
GIVEN
A Canadian cargo record status has been validated
Applied to: Record Status Valid?
WHEN
The system determines record validity
THEN
If record status is valid, proceed to usability check, otherwise skip to next equipment ID processing
Context: A Canadian cargo record has valid status
GIVEN
A Canadian cargo record has valid status
Applied to: Check Record Usability
WHEN
The system checks record usability criteria
THEN
Record is evaluated against usability requirements including deletion status and bond creation flags
Context: A Canadian cargo record has been checked for usability
GIVEN
A Canadian cargo record has been checked for usability
Applied to: Record Usable?
WHEN
The system evaluates usability criteria
THEN
If record is usable, add to matching records list, otherwise proceed to check for more equipment IDs
Context: A Canadian cargo record is determined to be valid and usable
GIVEN
A Canadian cargo record is determined to be valid and usable
Applied to: Add to Matching Records List
WHEN
The system processes the matching record
THEN
The Canadian cargo record is added to the collection of matching manifests for further processing
Context: A Canadian cargo record has been added to the matching records list
GIVEN
A Canadian cargo record has been added to the matching records list
Applied to: Log Cross-Border Coordination
WHEN
The system logs the cross-border coordination
THEN
The cargo release information is logged to the GCX105 system for audit trail and tracking
Context: Processing has completed for current equipment ID
GIVEN
Processing has completed for current equipment ID
Applied to: More Equipment IDs?
WHEN
The system checks for additional equipment IDs to process
THEN
If more equipment IDs exist, return to equipment ID extraction, otherwise proceed to return matching results
Context: All equipment IDs have been processed for Canadian manifest matching
GIVEN
All equipment IDs have been processed for Canadian manifest matching
Applied to: Return Matching Canadian Manifests
WHEN
The system completes the search process
THEN
All matching Canadian cargo records are returned for cross-border cargo coordination
Context: No Canadian cargo records are found for any equipment ID
GIVEN
No Canadian cargo records are found for any equipment ID
Applied to: No Matching Records Found
WHEN
The system completes the database search
THEN
An empty result set is prepared for return to indicate no matching Canadian manifests were found
R-GCX016-cbl-04552 (+12) File: GCX016.cbl Validate PTT Quantities Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate PTT Quantities':
  • Context - a cargo record with ptt status and release quantity information in the status array:
    For Released Quantity > 0?:
    When the system evaluates the released quantity value, then if released quantity is greater than zero, proceed to compare with total quantity, otherwise set no release status.
  • Context - a cargo record with positive released quantity and known total quantity:
    For Released Quantity = Total Quantity?:
    When the system compares released quantity to total quantity, then if released quantity equals total quantity, set full release status and clear hold flags, otherwise set partial release status.
  • Context - a cargo record where released quantity equals total quantity:
    For Set Full Release Status:
    When the system processes the full release condition, then set the cargo status to full release and prepare for hold flag clearing.
  • Context - a cargo record with full release status confirmed:
    For Clear Hold Flags:
    When the system processes hold flag updates, then clear all hold-related status flags from the cargo record.
  • Context - a cargo record where released quantity is greater than zero but less than total quantity:
    For Set Partial Release Status:
    When the system processes the partial release condition, then set the cargo status to partial release and calculate remaining quantity.
  • Context - a cargo record with partial release status and known total and released quantities:
    For Calculate Remaining Quantity:
    When the system calculates remaining quantities, then subtract released quantity from total quantity to determine remaining held quantity.
  • Context - a cargo record with calculated remaining quantity after partial release:
    For Remaining Quantity > 0?:
    When the system validates the remaining quantity value, then if remaining quantity is greater than zero, set hold on piece counts status, otherwise maintain ptt status flag.
  • Context - a cargo record with positive remaining quantity after partial release:
    For Set Hold on Piece Counts Status:
    When the system processes piece count hold requirements, then set hold on piece counts status for the remaining unreleased quantity.
  • Context - a cargo record with partial release or hold on piece counts status:
    For Maintain PTT Status Flag:
    When the system updates status flags, then maintain the ptt status flag to indicate proceed-to-transfer eligibility.
  • Context - a cargo record where released quantity is zero or negative:
    For Set No Release Status:
    When the system processes release status determination, then set the cargo status to no release and maintain current hold status.
  • Context - a cargo record with no release status and existing hold conditions:
    For Maintain Current Hold Status:
    When the system updates hold status flags, then maintain the current hold status without modification.
  • Context - a cargo record with determined ptt status, release conditions, and hold flags:
    For Update Status Array with PTT Flags:
    When the system updates the status array, then apply all determined ptt flags, release status, and hold conditions to the cargo status array.
  • Context - a cargo record with updated status array containing ptt flags and release conditions:
    For Save PTT Status for Processing:
    When the system completes ptt quantity validation, then save the final ptt status determination for use in downstream processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with PTT status and release quantity information in the status array
GIVEN
A cargo record with PTT status and release quantity information in the status array
Applied to: Released Quantity > 0?
WHEN
The system evaluates the released quantity value
THEN
If released quantity is greater than zero, proceed to compare with total quantity, otherwise set no release status
Context: A cargo record with positive released quantity and known total quantity
GIVEN
A cargo record with positive released quantity and known total quantity
Applied to: Released Quantity = Total Quantity?
WHEN
The system compares released quantity to total quantity
THEN
If released quantity equals total quantity, set full release status and clear hold flags, otherwise set partial release status
Context: A cargo record where released quantity equals total quantity
GIVEN
A cargo record where released quantity equals total quantity
Applied to: Set Full Release Status
WHEN
The system processes the full release condition
THEN
Set the cargo status to full release and prepare for hold flag clearing
Context: A cargo record with full release status confirmed
GIVEN
A cargo record with full release status confirmed
Applied to: Clear Hold Flags
WHEN
The system processes hold flag updates
THEN
Clear all hold-related status flags from the cargo record
Context: A cargo record where released quantity is greater than zero but less than total quantity
GIVEN
A cargo record where released quantity is greater than zero but less than total quantity
Applied to: Set Partial Release Status
WHEN
The system processes the partial release condition
THEN
Set the cargo status to partial release and calculate remaining quantity
Context: A cargo record with partial release status and known total and released quantities
GIVEN
A cargo record with partial release status and known total and released quantities
Applied to: Calculate Remaining Quantity
WHEN
The system calculates remaining quantities
THEN
Subtract released quantity from total quantity to determine remaining held quantity
Context: A cargo record with calculated remaining quantity after partial release
GIVEN
A cargo record with calculated remaining quantity after partial release
Applied to: Remaining Quantity > 0?
WHEN
The system validates the remaining quantity value
THEN
If remaining quantity is greater than zero, set hold on piece counts status, otherwise maintain PTT status flag
Context: A cargo record with positive remaining quantity after partial release
GIVEN
A cargo record with positive remaining quantity after partial release
Applied to: Set Hold on Piece Counts Status
WHEN
The system processes piece count hold requirements
THEN
Set hold on piece counts status for the remaining unreleased quantity
Context: A cargo record with partial release or hold on piece counts status
GIVEN
A cargo record with partial release or hold on piece counts status
Applied to: Maintain PTT Status Flag
WHEN
The system updates status flags
THEN
Maintain the PTT status flag to indicate proceed-to-transfer eligibility
Context: A cargo record where released quantity is zero or negative
GIVEN
A cargo record where released quantity is zero or negative
Applied to: Set No Release Status
WHEN
The system processes release status determination
THEN
Set the cargo status to no release and maintain current hold status
Context: A cargo record with no release status and existing hold conditions
GIVEN
A cargo record with no release status and existing hold conditions
Applied to: Maintain Current Hold Status
WHEN
The system updates hold status flags
THEN
Maintain the current hold status without modification
Context: A cargo record with determined PTT status, release conditions, and hold flags
GIVEN
A cargo record with determined PTT status, release conditions, and hold flags
Applied to: Update Status Array with PTT Flags
WHEN
The system updates the status array
THEN
Apply all determined PTT flags, release status, and hold conditions to the cargo status array
Context: A cargo record with updated status array containing PTT flags and release conditions
GIVEN
A cargo record with updated status array containing PTT flags and release conditions
Applied to: Save PTT Status for Processing
WHEN
The system completes PTT quantity validation
THEN
Save the final PTT status determination for use in downstream processing
R-GCX016-cbl-04565 (+17) File: GCX016.cbl Call GCCTBIO to Read DC Table Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call GCCTBIO to Read DC Table':
  • Context - a disposition code lookup is required:
    For Set Table Type to 'DC':
    When the system prepares to read disposition code information, then the table type is set to 'dc' to identify the disposition code table.
  • Context - a specific disposition code needs to be looked up:
    For Set Key to Disposition Code:
    When the system prepares the table lookup key, then the disposition code value is assigned as the search key.
  • Context - table type is set to 'dc' and key is assigned:
    For Call GCCTBIO for DC Table Read:
    When the system needs to retrieve disposition code details, then gcctbio service is called to read from the dc table.
  • Context - a database call has been executed:
    For Database Call Successful?:
    When the system checks the operation result, then the operation is validated as successful or failed based on return status.
  • Context - a successful database operation has completed:
    For Record Found?:
    When the system checks for record existence, then the system determines whether the disposition code record was found or not found.
  • Context - a disposition code record has been found in the table:
    For Extract Disposition Code Details:
    When the system processes the retrieved record, then disposition code details including description and processing attributes are extracted.
  • Context - disposition code details have been extracted:
    For Get Counterpart Code Information:
    When the system processes counterpart relationships, then related counterpart disposition codes are identified and retrieved.
  • Context - counterpart code information has been retrieved:
    For Get Processing Instructions:
    When the system needs processing guidance, then specific processing instructions for the disposition code are obtained.
  • Context - processing instructions have been successfully retrieved:
    For Set Found Flag to True:
    When the lookup operation completes successfully, then the found flag is set to true to indicate successful record retrieval.
  • Context - the found flag has been set to true:
    For Return Success Status:
    When the lookup operation is complete, then a success status is returned to the calling process.
  • Context - a database operation has failed:
    For Retry Needed?:
    When the system evaluates retry eligibility, then a decision is made whether to retry the operation based on error type and retry count.
  • Context - a retry is needed for a failed operation:
    For Increment Retry Counter:
    When the system prepares for retry, then the retry counter is incremented to track attempt number.
  • Context - the retry counter has been incremented:
    For Max Retries Exceeded?:
    When the system checks retry limits, then the system determines if maximum retry attempts have been exceeded.
  • Context - a database operation has failed and retries are exhausted or not applicable:
    For Log Database Error:
    When the system handles the error condition, then the database error is logged with relevant details for analysis.
  • Context - a database error has been logged:
    For Set Error Status:
    When the system prepares error response, then an error status is set to indicate operation failure.
  • Context - an error status has been set:
    For Return Error Status:
    When the lookup operation concludes with failure, then an error status is returned to the calling process.
  • Context - a successful database operation completed but no record was found:
    For Set Not Found Flag:
    When the system processes the not found condition, then the not found flag is set to indicate the disposition code does not exist.
  • Context - the not found flag has been set:
    For Return Not Found Status:
    When the lookup operation concludes with no record found, then a not found status is returned to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code lookup is required
GIVEN
A disposition code lookup is required
Applied to: Set Table Type to 'DC'
WHEN
The system prepares to read disposition code information
THEN
The table type is set to 'DC' to identify the disposition code table
Context: A specific disposition code needs to be looked up
GIVEN
A specific disposition code needs to be looked up
Applied to: Set Key to Disposition Code
WHEN
The system prepares the table lookup key
THEN
The disposition code value is assigned as the search key
Context: Table type is set to 'DC' and key is assigned
GIVEN
Table type is set to 'DC' and key is assigned
Applied to: Call GCCTBIO for DC Table Read
WHEN
The system needs to retrieve disposition code details
THEN
GCCTBIO service is called to read from the DC table
Context: A database call has been executed
GIVEN
A database call has been executed
Applied to: Database Call Successful?
WHEN
The system checks the operation result
THEN
The operation is validated as successful or failed based on return status
Context: A successful database operation has completed
GIVEN
A successful database operation has completed
Applied to: Record Found?
WHEN
The system checks for record existence
THEN
The system determines whether the disposition code record was found or not found
Context: A disposition code record has been found in the table
GIVEN
A disposition code record has been found in the table
Applied to: Extract Disposition Code Details
WHEN
The system processes the retrieved record
THEN
Disposition code details including description and processing attributes are extracted
Context: Disposition code details have been extracted
GIVEN
Disposition code details have been extracted
Applied to: Get Counterpart Code Information
WHEN
The system processes counterpart relationships
THEN
Related counterpart disposition codes are identified and retrieved
Context: Counterpart code information has been retrieved
GIVEN
Counterpart code information has been retrieved
Applied to: Get Processing Instructions
WHEN
The system needs processing guidance
THEN
Specific processing instructions for the disposition code are obtained
Context: Processing instructions have been successfully retrieved
GIVEN
Processing instructions have been successfully retrieved
Applied to: Set Found Flag to True
WHEN
The lookup operation completes successfully
THEN
The found flag is set to true to indicate successful record retrieval
Context: The found flag has been set to true
GIVEN
The found flag has been set to true
Applied to: Return Success Status
WHEN
The lookup operation is complete
THEN
A success status is returned to the calling process
Context: A database operation has failed
GIVEN
A database operation has failed
Applied to: Retry Needed?
WHEN
The system evaluates retry eligibility
THEN
A decision is made whether to retry the operation based on error type and retry count
Context: A retry is needed for a failed operation
GIVEN
A retry is needed for a failed operation
Applied to: Increment Retry Counter
WHEN
The system prepares for retry
THEN
The retry counter is incremented to track attempt number
Context: The retry counter has been incremented
GIVEN
The retry counter has been incremented
Applied to: Max Retries Exceeded?
WHEN
The system checks retry limits
THEN
The system determines if maximum retry attempts have been exceeded
Context: A database operation has failed and retries are exhausted or not applicable
GIVEN
A database operation has failed and retries are exhausted or not applicable
Applied to: Log Database Error
WHEN
The system handles the error condition
THEN
The database error is logged with relevant details for analysis
Context: A database error has been logged
GIVEN
A database error has been logged
Applied to: Set Error Status
WHEN
The system prepares error response
THEN
An error status is set to indicate operation failure
Context: An error status has been set
GIVEN
An error status has been set
Applied to: Return Error Status
WHEN
The lookup operation concludes with failure
THEN
An error status is returned to the calling process
Context: A successful database operation completed but no record was found
GIVEN
A successful database operation completed but no record was found
Applied to: Set Not Found Flag
WHEN
The system processes the not found condition
THEN
The not found flag is set to indicate the disposition code does not exist
Context: The not found flag has been set
GIVEN
The not found flag has been set
Applied to: Return Not Found Status
WHEN
The lookup operation concludes with no record found
THEN
A not found status is returned to the calling process
R-GCX016-cbl-04583 (+5) File: GCX016.cbl Check Status Info Match Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Status Info Match':
  • Context - a current disposition code with status information fields and an array element with corresponding status information fields are available for comparison:
    For Check Status Info Match - Compare disposition code status information fields including location codes, entry types, and processing flags:
    When the system compares status information fields between the current disposition code and array element, then the system marks the status information as matching if all status information fields are identical, otherwise marks as non-matching.
  • Context - a current disposition code location code and an array element location code are available for comparison:
    For Check Location Code Match:
    When the system compares the location codes between current disposition code and array element, then the system proceeds to next comparison field if location codes match, otherwise continues to mark as non-matching status information.
  • Context - a current disposition code entry type and an array element entry type are available for comparison:
    For Check Entry Type Match:
    When the system compares the entry types between current disposition code and array element, then the system proceeds to processing flags check if entry types match, otherwise continues to mark as non-matching status information.
  • Context - a current disposition code processing flags and an array element processing flags are available for comparison:
    For Check Processing Flags Match:
    When the system compares the processing flags between current disposition code and array element, then the system marks as matching status info if processing flags match, otherwise marks as non-matching status information.
  • Context - all status information fields including location codes, entry types, and processing flags have been successfully matched between current disposition code and array element:
    For Mark as Matching Status Info:
    When the system completes the status information comparison process, then the system marks the status information as matching and returns the positive match result.
  • Context - at least one status information field including location codes, entry types, or processing flags differs between current disposition code and array element:
    For Mark as Non-Matching Status Info:
    When the system completes the status information comparison process, then the system marks the status information as non-matching and returns the negative match result.
👨‍💻 Technical ACs (Gherkin)
Context: A current disposition code with status information fields and an array element with corresponding status information fields are available for comparison
GIVEN
A current disposition code with status information fields and an array element with corresponding status information fields are available for comparison
Applied to: Check Status Info Match - Compare disposition code status information fields including location codes, entry types, and processing flags
WHEN
The system compares status information fields between the current disposition code and array element
THEN
The system marks the status information as matching if all status information fields are identical, otherwise marks as non-matching
Context: A current disposition code location code and an array element location code are available for comparison
GIVEN
A current disposition code location code and an array element location code are available for comparison
Applied to: Check Location Code Match
WHEN
The system compares the location codes between current disposition code and array element
THEN
The system proceeds to next comparison field if location codes match, otherwise continues to mark as non-matching status information
Context: A current disposition code entry type and an array element entry type are available for comparison
GIVEN
A current disposition code entry type and an array element entry type are available for comparison
Applied to: Check Entry Type Match
WHEN
The system compares the entry types between current disposition code and array element
THEN
The system proceeds to processing flags check if entry types match, otherwise continues to mark as non-matching status information
Context: A current disposition code processing flags and an array element processing flags are available for comparison
GIVEN
A current disposition code processing flags and an array element processing flags are available for comparison
Applied to: Check Processing Flags Match
WHEN
The system compares the processing flags between current disposition code and array element
THEN
The system marks as matching status info if processing flags match, otherwise marks as non-matching status information
Context: All status information fields including location codes, entry types, and processing flags have been successfully matched between current disposition code and array element
GIVEN
All status information fields including location codes, entry types, and processing flags have been successfully matched between current disposition code and array element
Applied to: Mark as Matching Status Info
WHEN
The system completes the status information comparison process
THEN
The system marks the status information as matching and returns the positive match result
Context: At least one status information field including location codes, entry types, or processing flags differs between current disposition code and array element
GIVEN
At least one status information field including location codes, entry types, or processing flags differs between current disposition code and array element
Applied to: Mark as Non-Matching Status Info
WHEN
The system completes the status information comparison process
THEN
The system marks the status information as non-matching and returns the negative match result
R-GCX016-cbl-04589 (+20) File: GCX016.cbl Check Entry Number Match Merged 21 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Entry Number Match':
  • Context - a cargo message with x4 segment is being processed:
    For Entry Number Present in X4-04?:
    When the system checks for entry number in x4-04 field, then if entry number is present, continue with entry number validation, otherwise fail validation.
  • Context - an entry number is present in x4-04 field:
    For Extract Entry Number Pattern:
    When the system extracts the entry number pattern, then the entry number pattern is analyzed to determine if it is a broker entry number, bond control number, or in-bond entry reference.
  • Context - an entry number pattern has been extracted from x4-04:
    For Entry Number Type?:
    When the system analyzes the entry number format, then the entry number is classified as either broker entry number, bond control number, or in-bond entry reference based on its format characteristics.
  • Context - an entry number has been classified as a broker entry number:
    For Validate Broker Entry Number Format:
    When the system validates the broker entry number format, then the broker entry number must conform to established format rules and pass validation checks.
  • Context - an entry number has been classified as a bond control number:
    For Validate Bond Control Number Format:
    When the system validates the bond control number format, then the bond control number must conform to established format rules and pass validation checks.
  • Context - an entry number has been classified as an in-bond entry reference:
    For Validate In-Bond Entry Reference Format:
    When the system validates the in-bond entry reference format, then the in-bond entry reference must conform to established format rules and pass validation checks.
  • Context - an entry number has been validated for format and identified as v37 entry type:
    For Apply Special V37 Entry Validation:
    When the system applies v37 specific validation rules, then the entry number must pass v37 specific validation criteria including special format and business rule requirements.
  • Context - an entry number has been validated for format and is not a v37 entry type:
    For Standard Entry Number Validation:
    When the system applies standard validation rules, then the entry number must pass standard validation criteria including format and business rule requirements.
  • Context - an entry number has undergone format validation (either v37 special or standard):
    For Entry Number Format Valid?:
    When the system checks if the entry number format is valid, then if format is valid, proceed to check against cargo records, otherwise fail the validation process.
  • Context - an entry number has passed format validation:
    For Check Entry Number Against Cargo Records:
    When the system checks the entry number against cargo records, then the entry number is compared with existing cargo records to determine if there is a match.
  • Context - an entry number has been checked against cargo records:
    For Entry Number Matches Cargo?:
    When the system verifies if there is a match, then if entry number matches cargo records, set validation success, otherwise log mismatch error.
  • Context - an entry number matches the cargo records:
    For Set Entry Number Validation Success:
    When the system sets validation success status, then the entry number validation success flag is set and processing continues with broker validation checks.
  • Context - an entry number does not match cargo records:
    For Log Entry Number Mismatch Error:
    When the system logs the mismatch error, then an entry number mismatch error is logged and validation process fails.
  • Context - an entry number has been successfully validated against cargo records:
    For Broker Entry Number?:
    When the system checks if it is a broker entry number, then if it is a broker entry number, validate against broker tables, otherwise check if it is a bond control number.
  • Context - an entry number has been identified as a broker entry number:
    For Validate Against Broker Tables:
    When the system validates against broker tables, then the broker entry number must exist in broker tables and meet authorization requirements.
  • Context - an entry number is not a broker entry number:
    For Bond Control Number?:
    When the system checks if it is a bond control number, then if it is a bond control number, validate against bond records, otherwise check if it is an in-bond reference.
  • Context - an entry number has been identified as a bond control number:
    For Validate Against Bond Records:
    When the system validates against bond records, then the bond control number must exist in bond records and meet validity requirements.
  • Context - an entry number is not a broker entry number or bond control number:
    For In-Bond Reference?:
    When the system checks if it is an in-bond reference, then if it is an in-bond reference, validate against in-bond records, otherwise complete validation process.
  • Context - an entry number has been identified as an in-bond reference:
    For Validate Against In-Bond Records:
    When the system validates against in-bond records, then the in-bond reference must exist in in-bond records and meet validity requirements.
  • Context - all required entry number validations have been completed successfully:
    For Set Entry Number Validation Complete:
    When the system sets validation complete status, then the entry number validation process is marked as complete and successful.
  • Context - any entry number validation step has failed or entry number is not present:
    For Entry Number Validation Failed:
    When the system processes validation failure, then the entry number validation process is marked as failed and appropriate error handling is initiated.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo message with X4 segment is being processed
GIVEN
A cargo message with X4 segment is being processed
Applied to: Entry Number Present in X4-04?
WHEN
The system checks for entry number in X4-04 field
THEN
If entry number is present, continue with entry number validation, otherwise fail validation
Context: An entry number is present in X4-04 field
GIVEN
An entry number is present in X4-04 field
Applied to: Extract Entry Number Pattern
WHEN
The system extracts the entry number pattern
THEN
The entry number pattern is analyzed to determine if it is a broker entry number, bond control number, or in-bond entry reference
Context: An entry number pattern has been extracted from X4-04
GIVEN
An entry number pattern has been extracted from X4-04
Applied to: Entry Number Type?
WHEN
The system analyzes the entry number format
THEN
The entry number is classified as either broker entry number, bond control number, or in-bond entry reference based on its format characteristics
Context: An entry number has been classified as a broker entry number
GIVEN
An entry number has been classified as a broker entry number
Applied to: Validate Broker Entry Number Format
WHEN
The system validates the broker entry number format
THEN
The broker entry number must conform to established format rules and pass validation checks
Context: An entry number has been classified as a bond control number
GIVEN
An entry number has been classified as a bond control number
Applied to: Validate Bond Control Number Format
WHEN
The system validates the bond control number format
THEN
The bond control number must conform to established format rules and pass validation checks
Context: An entry number has been classified as an in-bond entry reference
GIVEN
An entry number has been classified as an in-bond entry reference
Applied to: Validate In-Bond Entry Reference Format
WHEN
The system validates the in-bond entry reference format
THEN
The in-bond entry reference must conform to established format rules and pass validation checks
Context: An entry number has been validated for format and identified as V37 entry type
GIVEN
An entry number has been validated for format and identified as V37 entry type
Applied to: Apply Special V37 Entry Validation
WHEN
The system applies V37 specific validation rules
THEN
The entry number must pass V37 specific validation criteria including special format and business rule requirements
Context: An entry number has been validated for format and is not a V37 entry type
GIVEN
An entry number has been validated for format and is not a V37 entry type
Applied to: Standard Entry Number Validation
WHEN
The system applies standard validation rules
THEN
The entry number must pass standard validation criteria including format and business rule requirements
Context: An entry number has undergone format validation (either V37 special or standard)
GIVEN
An entry number has undergone format validation (either V37 special or standard)
Applied to: Entry Number Format Valid?
WHEN
The system checks if the entry number format is valid
THEN
If format is valid, proceed to check against cargo records, otherwise fail the validation process
Context: An entry number has passed format validation
GIVEN
An entry number has passed format validation
Applied to: Check Entry Number Against Cargo Records
WHEN
The system checks the entry number against cargo records
THEN
The entry number is compared with existing cargo records to determine if there is a match
Context: An entry number has been checked against cargo records
GIVEN
An entry number has been checked against cargo records
Applied to: Entry Number Matches Cargo?
WHEN
The system verifies if there is a match
THEN
If entry number matches cargo records, set validation success, otherwise log mismatch error
Context: An entry number matches the cargo records
GIVEN
An entry number matches the cargo records
Applied to: Set Entry Number Validation Success
WHEN
The system sets validation success status
THEN
The entry number validation success flag is set and processing continues with broker validation checks
Context: An entry number does not match cargo records
GIVEN
An entry number does not match cargo records
Applied to: Log Entry Number Mismatch Error
WHEN
The system logs the mismatch error
THEN
An entry number mismatch error is logged and validation process fails
Context: An entry number has been successfully validated against cargo records
GIVEN
An entry number has been successfully validated against cargo records
Applied to: Broker Entry Number?
WHEN
The system checks if it is a broker entry number
THEN
If it is a broker entry number, validate against broker tables, otherwise check if it is a bond control number
Context: An entry number has been identified as a broker entry number
GIVEN
An entry number has been identified as a broker entry number
Applied to: Validate Against Broker Tables
WHEN
The system validates against broker tables
THEN
The broker entry number must exist in broker tables and meet authorization requirements
Context: An entry number is not a broker entry number
GIVEN
An entry number is not a broker entry number
Applied to: Bond Control Number?
WHEN
The system checks if it is a bond control number
THEN
If it is a bond control number, validate against bond records, otherwise check if it is an in-bond reference
Context: An entry number has been identified as a bond control number
GIVEN
An entry number has been identified as a bond control number
Applied to: Validate Against Bond Records
WHEN
The system validates against bond records
THEN
The bond control number must exist in bond records and meet validity requirements
Context: An entry number is not a broker entry number or bond control number
GIVEN
An entry number is not a broker entry number or bond control number
Applied to: In-Bond Reference?
WHEN
The system checks if it is an in-bond reference
THEN
If it is an in-bond reference, validate against in-bond records, otherwise complete validation process
Context: An entry number has been identified as an in-bond reference
GIVEN
An entry number has been identified as an in-bond reference
Applied to: Validate Against In-Bond Records
WHEN
The system validates against in-bond records
THEN
The in-bond reference must exist in in-bond records and meet validity requirements
Context: All required entry number validations have been completed successfully
GIVEN
All required entry number validations have been completed successfully
Applied to: Set Entry Number Validation Complete
WHEN
The system sets validation complete status
THEN
The entry number validation process is marked as complete and successful
Context: Any entry number validation step has failed or entry number is not present
GIVEN
Any entry number validation step has failed or entry number is not present
Applied to: Entry Number Validation Failed
WHEN
The system processes validation failure
THEN
The entry number validation process is marked as failed and appropriate error handling is initiated
R-GCX016-cbl-04610 (+18) File: GCX016.cbl Check Quantity Match Merged 19 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Quantity Match':
  • Context - a disposition code is being processed for cargo:
    For Disposition Code Affects Quantities?:
    When the system checks if the disposition code affects release quantities, then the system should proceed with quantity processing only if the disposition code has quantity impact, otherwise skip quantity calculations.
  • Context - a disposition code with add_quantity action and a valid quantity value from x4 segment:
    For Add to Release Quantity:
    When the system processes the quantity addition, then the system should add the x4 segment quantity to the current cargo release quantity.
  • Context - a disposition code with subtract_quantity action and a valid quantity value from x4 segment:
    For Subtract from Release Quantity:
    When the system processes the quantity subtraction, then the system should subtract the x4 segment quantity from the current cargo release quantity.
  • Context - a calculated release quantity and the total cargo quantity:
    For Release Quantity > Total Quantity?:
    When the release quantity exceeds the total cargo quantity, then the system should set the release quantity equal to the total cargo quantity to prevent over-release.
  • Context - a calculated release quantity that may be negative:
    For Release Quantity < 0?:
    When the release quantity is less than zero, then the system should set the release quantity to zero to prevent negative release values.
  • Context - a broker entry quantity and the corresponding manifest quantity:
    For Broker Quantity Matches Manifest?:
    When the broker quantity does not match the manifest quantity, then the system should generate a quantity mismatch notification for broker review.
  • Context - a detected quantity mismatch between broker entry and manifest:
    For Generate Quantity Mismatch Notification:
    When the system processes the mismatch notification, then the system should generate a detailed notification message and prepare it for broker delivery.
  • Context - a prepared quantity mismatch notification and broker contact information:
    For Send Email to Broker:
    When the system sends the notification, then the system should deliver the notification via email to the appropriate broker.
  • Context - a cargo with release quantity and total quantity values:
    For Partial Release Scenario?:
    When the release quantity is greater than zero but less than the total quantity, then the system should identify this as a partial release scenario requiring special handling.
  • Context - a cargo in partial release scenario with remaining unreleased quantities:
    For Set Hold on Piece Counts Status:
    When the system processes the partial release, then the system should set hold status on the remaining piece counts to prevent unauthorized release.
  • Context - a cargo with release quantity equal to or greater than total quantity:
    For Full Release Achieved?:
    When the system evaluates release completeness, then the system should identify this as full release achievement.
  • Context - a cargo that has achieved full release status:
    For Clear Destination Index:
    When the system processes the full release, then the system should clear the destination index to indicate no further destination processing required.
  • Context - a cargo with cleared destination index and full quantity release:
    For Set Full Release Status:
    When the system updates cargo status, then the system should set the cargo status to full release.
  • Context - a cargo with updated quantities and status:
    For PTT Validation Required?:
    When the system evaluates ptt requirements, then the system should determine if ptt validation is necessary based on cargo type and disposition code.
  • Context - a cargo requiring ptt validation with specific quantity limits:
    For Validate PTT Quantity Limits:
    When the system validates ptt quantities, then the system should check that quantities are within established ptt limits.
  • Context - ptt quantity validation results:
    For PTT Quantity Valid?:
    When the quantities meet all ptt validation criteria, then the system should proceed with ptt status assignment.
  • Context - a cargo with valid ptt quantities:
    For Set PTT Status with Quantity:
    When the system assigns ptt status, then the system should set ptt status and record the associated quantities.
  • Context - a cargo with ptt quantities that exceed validation limits:
    For Reject PTT - Quantity Exceeded:
    When the system processes the ptt rejection, then the system should reject ptt status and maintain current cargo status.
  • Context - a cargo with processed and validated quantity changes:
    For Update Cargo Record with New Quantities:
    When the system updates the cargo record, then the system should save all new quantity values and status changes to the cargo record.
👨‍💻 Technical ACs (Gherkin)
Context: A disposition code is being processed for cargo
GIVEN
A disposition code is being processed for cargo
Applied to: Disposition Code Affects Quantities?
WHEN
The system checks if the disposition code affects release quantities
THEN
The system should proceed with quantity processing only if the disposition code has quantity impact, otherwise skip quantity calculations
Context: A disposition code with ADD_QUANTITY action and a valid quantity value from X4 segment
GIVEN
A disposition code with ADD_QUANTITY action and a valid quantity value from X4 segment
Applied to: Add to Release Quantity
WHEN
The system processes the quantity addition
THEN
The system should add the X4 segment quantity to the current cargo release quantity
Context: A disposition code with SUBTRACT_QUANTITY action and a valid quantity value from X4 segment
GIVEN
A disposition code with SUBTRACT_QUANTITY action and a valid quantity value from X4 segment
Applied to: Subtract from Release Quantity
WHEN
The system processes the quantity subtraction
THEN
The system should subtract the X4 segment quantity from the current cargo release quantity
Context: A calculated release quantity and the total cargo quantity
GIVEN
A calculated release quantity and the total cargo quantity
Applied to: Release Quantity > Total Quantity?
WHEN
The release quantity exceeds the total cargo quantity
THEN
The system should set the release quantity equal to the total cargo quantity to prevent over-release
Context: A calculated release quantity that may be negative
GIVEN
A calculated release quantity that may be negative
Applied to: Release Quantity < 0?
WHEN
The release quantity is less than zero
THEN
The system should set the release quantity to zero to prevent negative release values
Context: A broker entry quantity and the corresponding manifest quantity
GIVEN
A broker entry quantity and the corresponding manifest quantity
Applied to: Broker Quantity Matches Manifest?
WHEN
The broker quantity does not match the manifest quantity
THEN
The system should generate a quantity mismatch notification for broker review
Context: A detected quantity mismatch between broker entry and manifest
GIVEN
A detected quantity mismatch between broker entry and manifest
Applied to: Generate Quantity Mismatch Notification
WHEN
The system processes the mismatch notification
THEN
The system should generate a detailed notification message and prepare it for broker delivery
Context: A prepared quantity mismatch notification and broker contact information
GIVEN
A prepared quantity mismatch notification and broker contact information
Applied to: Send Email to Broker
WHEN
The system sends the notification
THEN
The system should deliver the notification via email to the appropriate broker
Context: A cargo with release quantity and total quantity values
GIVEN
A cargo with release quantity and total quantity values
Applied to: Partial Release Scenario?
WHEN
The release quantity is greater than zero but less than the total quantity
THEN
The system should identify this as a partial release scenario requiring special handling
Context: A cargo in partial release scenario with remaining unreleased quantities
GIVEN
A cargo in partial release scenario with remaining unreleased quantities
Applied to: Set Hold on Piece Counts Status
WHEN
The system processes the partial release
THEN
The system should set hold status on the remaining piece counts to prevent unauthorized release
Context: A cargo with release quantity equal to or greater than total quantity
GIVEN
A cargo with release quantity equal to or greater than total quantity
Applied to: Full Release Achieved?
WHEN
The system evaluates release completeness
THEN
The system should identify this as full release achievement
Context: A cargo that has achieved full release status
GIVEN
A cargo that has achieved full release status
Applied to: Clear Destination Index
WHEN
The system processes the full release
THEN
The system should clear the destination index to indicate no further destination processing required
Context: A cargo with cleared destination index and full quantity release
GIVEN
A cargo with cleared destination index and full quantity release
Applied to: Set Full Release Status
WHEN
The system updates cargo status
THEN
The system should set the cargo status to full release
Context: A cargo with updated quantities and status
GIVEN
A cargo with updated quantities and status
Applied to: PTT Validation Required?
WHEN
The system evaluates PTT requirements
THEN
The system should determine if PTT validation is necessary based on cargo type and disposition code
Context: A cargo requiring PTT validation with specific quantity limits
GIVEN
A cargo requiring PTT validation with specific quantity limits
Applied to: Validate PTT Quantity Limits
WHEN
The system validates PTT quantities
THEN
The system should check that quantities are within established PTT limits
Context: PTT quantity validation results
GIVEN
PTT quantity validation results
Applied to: PTT Quantity Valid?
WHEN
The quantities meet all PTT validation criteria
THEN
The system should proceed with PTT status assignment
Context: A cargo with valid PTT quantities
GIVEN
A cargo with valid PTT quantities
Applied to: Set PTT Status with Quantity
WHEN
The system assigns PTT status
THEN
The system should set PTT status and record the associated quantities
Context: A cargo with PTT quantities that exceed validation limits
GIVEN
A cargo with PTT quantities that exceed validation limits
Applied to: Reject PTT - Quantity Exceeded
WHEN
The system processes the PTT rejection
THEN
The system should reject PTT status and maintain current cargo status
Context: A cargo with processed and validated quantity changes
GIVEN
A cargo with processed and validated quantity changes
Applied to: Update Cargo Record with New Quantities
WHEN
The system updates the cargo record
THEN
The system should save all new quantity values and status changes to the cargo record
R-GCX016-cbl-04629 (+8) File: GCX016.cbl Call GCCUSIO with Car ID Index Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call GCCUSIO with Car ID Index':
  • Context - a car id is provided for cargo search and database index is set to car id optimization:
    For Call GCCUSIO with Car Index:
    When the system calls gccusio with car id index parameters, then the database query executes with index optimization for faster cargo retrieval.
  • Context - a database call to gccusio has been executed:
    For Database Call Successful?:
    When the system checks the database call completion status, then if the database call was successful then proceed to validate cargo record else log database error and set error status.
  • Context - a database call has completed successfully:
    For Cargo Record Valid?:
    When the system validates the returned cargo record, then if a valid cargo record is found then extract cargo information else attempt broader search without us-ccn.
  • Context - cargo information has been extracted from a valid record:
    For Car ID Matches?:
    When the system verifies the car id match between request and retrieved record, then if the car id matches exactly then set cargo found flag and return cargo record else attempt broader search without us-ccn.
  • Context - primary cargo search by car id has failed to find matching records:
    For Call GCCUSIO with Relaxed Parameters:
    When the system initiates a broader search without us-ccn constraints, then the database query executes with relaxed search parameters to find potential cargo matches.
  • Context - a broader search with relaxed parameters has been executed:
    For Broader Search Successful?:
    When the system evaluates the broader search completion status, then if the broader search was successful then validate relaxed search results else set cargo not found status.
  • Context - a broader search has completed successfully:
    For Valid Results Found?:
    When the system validates the quality and usability of relaxed search results, then if valid results are found then set cargo found flag and return cargo record else set cargo not found status.
  • Context - both primary car id search and broader search have failed to find valid cargo records:
    For Set Cargo Not Found Status:
    When the system determines no cargo can be located for the given car id, then set cargo not found status to indicate unsuccessful search completion.
  • Context - a database call to gccusio has failed:
    For Log Database Error:
    When the system processes the database failure, then log the database error for troubleshooting and set error status to indicate system failure.
👨‍💻 Technical ACs (Gherkin)
Context: A car ID is provided for cargo search AND database index is set to Car ID optimization
GIVEN
A car ID is provided for cargo search AND database index is set to Car ID optimization
Applied to: Call GCCUSIO with Car Index
WHEN
The system calls GCCUSIO with Car ID index parameters
THEN
The database query executes with index optimization for faster cargo retrieval
Context: A database call to GCCUSIO has been executed
GIVEN
A database call to GCCUSIO has been executed
Applied to: Database Call Successful?
WHEN
The system checks the database call completion status
THEN
IF the database call was successful THEN proceed to validate cargo record ELSE log database error and set error status
Context: A database call has completed successfully
GIVEN
A database call has completed successfully
Applied to: Cargo Record Valid?
WHEN
The system validates the returned cargo record
THEN
IF a valid cargo record is found THEN extract cargo information ELSE attempt broader search without US-CCN
Context: Cargo information has been extracted from a valid record
GIVEN
Cargo information has been extracted from a valid record
Applied to: Car ID Matches?
WHEN
The system verifies the Car ID match between request and retrieved record
THEN
IF the Car ID matches exactly THEN set cargo found flag and return cargo record ELSE attempt broader search without US-CCN
Context: Primary cargo search by Car ID has failed to find matching records
GIVEN
Primary cargo search by Car ID has failed to find matching records
Applied to: Call GCCUSIO with Relaxed Parameters
WHEN
The system initiates a broader search without US-CCN constraints
THEN
The database query executes with relaxed search parameters to find potential cargo matches
Context: A broader search with relaxed parameters has been executed
GIVEN
A broader search with relaxed parameters has been executed
Applied to: Broader Search Successful?
WHEN
The system evaluates the broader search completion status
THEN
IF the broader search was successful THEN validate relaxed search results ELSE set cargo not found status
Context: A broader search has completed successfully
GIVEN
A broader search has completed successfully
Applied to: Valid Results Found?
WHEN
The system validates the quality and usability of relaxed search results
THEN
IF valid results are found THEN set cargo found flag and return cargo record ELSE set cargo not found status
Context: Both primary Car ID search and broader search have failed to find valid cargo records
GIVEN
Both primary Car ID search and broader search have failed to find valid cargo records
Applied to: Set Cargo Not Found Status
WHEN
The system determines no cargo can be located for the given Car ID
THEN
Set cargo not found status to indicate unsuccessful search completion
Context: A database call to GCCUSIO has failed
GIVEN
A database call to GCCUSIO has failed
Applied to: Log Database Error
WHEN
The system processes the database failure
THEN
Log the database error for troubleshooting AND set error status to indicate system failure
R-GCX016-cbl-04638 (+14) File: GCX016.cbl Process Master In Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Master In':
  • Context - an x4 segment is received with an entry type code:
    For Entry Type Code?:
    When the entry type code is evaluated for master in-bond eligibility, then entry types 61, 62, 63, and 69 are classified as master in-bond entries requiring special processing, while all other entry types proceed to standard processing.
  • Context - cargo has entry type code 61:
    For Entry Type 61 - Master In-Bond:
    When master in-bond processing is initiated, then the cargo is classified for immediate transport processing and master in-bond flag is set.
  • Context - cargo has entry type code 62:
    For Entry Type 62 - Master In-Bond:
    When master in-bond processing is initiated, then the cargo is classified for transport export processing and master in-bond flag is set.
  • Context - cargo has entry type code 63:
    For Entry Type 63 - Master In-Bond:
    When master in-bond processing is initiated, then the cargo is classified for immediate export processing and master in-bond flag is set.
  • Context - cargo has entry type code 69:
    For Entry Type 69 - Master In-Bond:
    When master in-bond processing is initiated, then the cargo is classified for us-canada-us movement processing and master in-bond flag is set.
  • Context - a master in-bond entry requires bond validation:
    For Validate Bond Control Number:
    When the bond control number is checked against the bond database, then the bond must exist and be active for processing to continue, otherwise a bond validation error is generated.
  • Context - a valid entry type code (61, 62, 63, or 69) has been identified:
    For Map Entry Type to Transport Type:
    When transport type mapping is performed, then entry type 61 maps to immediate transport, 62 maps to transport export, 63 maps to immediate export, and 69 maps to us-canada-us movement.
  • Context - a transport type has been determined from the entry type mapping:
    For Set Transport Type in Cargo Record:
    When the cargo record is updated, then the transport type field in the cargo record is set to the mapped value.
  • Context - transport type has been set in the cargo record:
    For Update In-Bond Status Flags:
    When in-bond status flags are updated, then master in-bond processing flag is set and appropriate status indicators are activated.
  • Context - in-bond status flags have been updated:
    For Validate Regulatory Compliance:
    When regulatory compliance check is performed, then all required documentation, permits, and regulatory conditions must be satisfied for the specific entry type.
  • Context - regulatory compliance check has passed:
    For Set Master In-Bond Processing Flag:
    When master in-bond flag is set, then the cargo is marked for master in-bond processing and subsequent operations will recognize this special status.
  • Context - master in-bond processing flag has been set:
    For Update Cargo Record with In-Bond Details:
    When cargo record is updated with in-bond details, then all relevant in-bond fields including entry type, transport type, bond number, and processing flags are populated in the cargo record.
  • Context - cargo record has been updated with in-bond details:
    For Log Master In-Bond Processing:
    When processing log is created, then an audit record is generated documenting the master in-bond processing including entry type, bond number, and processing timestamp.
  • Context - bond control number validation has failed:
    For Generate Bond Validation Error:
    When bond validation error is generated, then an error message is created indicating invalid or inactive bond number and processing is directed to error handling.
  • Context - regulatory compliance check has failed:
    For Generate Compliance Error:
    When compliance error is generated, then an error message is created indicating specific compliance failure and processing is directed to error handling.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is received with an entry type code
GIVEN
An X4 segment is received with an entry type code
Applied to: Entry Type Code?
WHEN
The entry type code is evaluated for master in-bond eligibility
THEN
Entry types 61, 62, 63, and 69 are classified as master in-bond entries requiring special processing, while all other entry types proceed to standard processing
Context: Cargo has entry type code 61
GIVEN
Cargo has entry type code 61
Applied to: Entry Type 61 - Master In-Bond
WHEN
Master in-bond processing is initiated
THEN
The cargo is classified for immediate transport processing and master in-bond flag is set
Context: Cargo has entry type code 62
GIVEN
Cargo has entry type code 62
Applied to: Entry Type 62 - Master In-Bond
WHEN
Master in-bond processing is initiated
THEN
The cargo is classified for transport export processing and master in-bond flag is set
Context: Cargo has entry type code 63
GIVEN
Cargo has entry type code 63
Applied to: Entry Type 63 - Master In-Bond
WHEN
Master in-bond processing is initiated
THEN
The cargo is classified for immediate export processing and master in-bond flag is set
Context: Cargo has entry type code 69
GIVEN
Cargo has entry type code 69
Applied to: Entry Type 69 - Master In-Bond
WHEN
Master in-bond processing is initiated
THEN
The cargo is classified for US-Canada-US movement processing and master in-bond flag is set
Context: A master in-bond entry requires bond validation
GIVEN
A master in-bond entry requires bond validation
Applied to: Validate Bond Control Number
WHEN
The bond control number is checked against the bond database
THEN
The bond must exist and be active for processing to continue, otherwise a bond validation error is generated
Context: A valid entry type code (61, 62, 63, or 69) has been identified
GIVEN
A valid entry type code (61, 62, 63, or 69) has been identified
Applied to: Map Entry Type to Transport Type
WHEN
Transport type mapping is performed
THEN
Entry type 61 maps to immediate transport, 62 maps to transport export, 63 maps to immediate export, and 69 maps to US-Canada-US movement
Context: A transport type has been determined from the entry type mapping
GIVEN
A transport type has been determined from the entry type mapping
Applied to: Set Transport Type in Cargo Record
WHEN
The cargo record is updated
THEN
The transport type field in the cargo record is set to the mapped value
Context: Transport type has been set in the cargo record
GIVEN
Transport type has been set in the cargo record
Applied to: Update In-Bond Status Flags
WHEN
In-bond status flags are updated
THEN
Master in-bond processing flag is set and appropriate status indicators are activated
Context: In-bond status flags have been updated
GIVEN
In-bond status flags have been updated
Applied to: Validate Regulatory Compliance
WHEN
Regulatory compliance check is performed
THEN
All required documentation, permits, and regulatory conditions must be satisfied for the specific entry type
Context: Regulatory compliance check has passed
GIVEN
Regulatory compliance check has passed
Applied to: Set Master In-Bond Processing Flag
WHEN
Master in-bond flag is set
THEN
The cargo is marked for master in-bond processing and subsequent operations will recognize this special status
Context: Master in-bond processing flag has been set
GIVEN
Master in-bond processing flag has been set
Applied to: Update Cargo Record with In-Bond Details
WHEN
Cargo record is updated with in-bond details
THEN
All relevant in-bond fields including entry type, transport type, bond number, and processing flags are populated in the cargo record
Context: Cargo record has been updated with in-bond details
GIVEN
Cargo record has been updated with in-bond details
Applied to: Log Master In-Bond Processing
WHEN
Processing log is created
THEN
An audit record is generated documenting the master in-bond processing including entry type, bond number, and processing timestamp
Context: Bond control number validation has failed
GIVEN
Bond control number validation has failed
Applied to: Generate Bond Validation Error
WHEN
Bond validation error is generated
THEN
An error message is created indicating invalid or inactive bond number and processing is directed to error handling
Context: Regulatory compliance check has failed
GIVEN
Regulatory compliance check has failed
Applied to: Generate Compliance Error
WHEN
Compliance error is generated
THEN
An error message is created indicating specific compliance failure and processing is directed to error handling
R-GCX016-cbl-04653 (+16) File: GCX016.cbl Build M10 Manifest Information Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build M10 Manifest Information':
  • Context - an m10 manifest segment is received:
    For Extract SCAC Code from M10 & Extract Transport Type & Extract Country Code & Extract Vessel Name/Flight Number & Extract Voyage/Flight Number & Extract Manifest Quantity & Extract Manifest Type Code & Extract Condition Response Code:
    When the system processes the m10 segment, then the scac code is extracted from the m10 segment and stored for manifest processing and the transport type is extracted from the m10 segment and stored for manifest processing and the country code is extracted from the m10 segment and stored for manifest processing and the vessel name or flight number is extracted from the m10 segment and stored for manifest processing and the voyage or flight number is extracted from the m10 segment and stored for manifest processing and the manifest quantity is extracted from the m10 segment and stored for manifest processing and the manifest type code is extracted from the m10 segment and stored for manifest processing and the condition response code is extracted from the m10 segment and stored for manifest processing.
  • Context - a scac code has been extracted from the m10 segment:
    For Validate SCAC Code Format:
    When the system validates the scac code format, then the scac code is verified to meet standard format requirements or validation error is flagged.
  • Context - a transport type has been extracted from the m10 segment:
    For Validate Transport Type:
    When the system validates the transport type, then the transport type is verified against valid transportation modes or validation error is flagged.
  • Context - a country code has been extracted from the m10 segment:
    For Validate Country Code:
    When the system validates the country code, then the country code is verified against valid country identifiers or validation error is flagged.
  • Context - all m10 segment fields have been extracted and validated:
    For All Required Fields Present?:
    When the system checks for required field completeness, then if all required fields are present and valid, processing continues to build manifest record, otherwise missing data error is generated.
  • Context - all required m10 segment fields are present and validated:
    For Build Manifest Information Record:
    When the system builds the manifest information record, then a complete manifest record is constructed with scac code, transport type, country code, vessel information, voyage number, quantity, manifest type, and condition response code.
  • Context - a complete manifest information record has been built:
    For Integrate into Cargo Record:
    When the system integrates the manifest into the cargo record, then the manifest information is linked and stored with the corresponding cargo record.
  • Context - manifest information has been successfully integrated into cargo record:
    For Update Manifest Status:
    When the system updates manifest status, then the manifest status is updated to reflect successful processing and integration.
  • Context - manifest information has been successfully integrated and status updated:
    For Log Manifest Integration:
    When the system logs the manifest integration, then an audit log entry is created documenting the successful manifest integration with relevant details.
  • Context - required m10 segment fields are missing or validation has failed:
    For Generate Missing Data Error:
    When the system detects missing or invalid data, then a missing data error is generated identifying the specific fields that are missing or invalid.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 manifest segment is received
GIVEN
An M10 manifest segment is received
Applied to: Extract SCAC Code from M10 & Extract Transport Type & Extract Country Code & Extract Vessel Name/Flight Number & Extract Voyage/Flight Number & Extract Manifest Quantity & Extract Manifest Type Code & Extract Condition Response Code
WHEN
The system processes the M10 segment
THEN
The SCAC code is extracted from the M10 segment and stored for manifest processing AND The transport type is extracted from the M10 segment and stored for manifest processing AND The country code is extracted from the M10 segment and stored for manifest processing AND The vessel name or flight number is extracted from the M10 segment and stored for manifest processing AND The voyage or flight number is extracted from the M10 segment and stored for manifest processing AND The manifest quantity is extracted from the M10 segment and stored for manifest processing AND The manifest type code is extracted from the M10 segment and stored for manifest processing AND The condition response code is extracted from the M10 segment and stored for manifest processing
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 Code Format
WHEN
The system validates the SCAC code format
THEN
The SCAC code is verified to meet standard format requirements or validation error is flagged
Context: A transport type has been extracted from the M10 segment
GIVEN
A transport type has been extracted from the M10 segment
Applied to: Validate Transport Type
WHEN
The system validates the transport type
THEN
The transport type is verified against valid transportation modes or validation error is flagged
Context: A country code has been extracted from the M10 segment
GIVEN
A country code has been extracted from the M10 segment
Applied to: Validate Country Code
WHEN
The system validates the country code
THEN
The country code is verified against valid country identifiers or validation error is flagged
Context: All M10 segment fields have been extracted and validated
GIVEN
All M10 segment fields have been extracted and validated
Applied to: All Required Fields Present?
WHEN
The system checks for required field completeness
THEN
If all required fields are present and valid, processing continues to build manifest record, otherwise missing data error is generated
Context: All required M10 segment fields are present and validated
GIVEN
All required M10 segment fields are present and validated
Applied to: Build Manifest Information Record
WHEN
The system builds the manifest information record
THEN
A complete manifest record is constructed with SCAC code, transport type, country code, vessel information, voyage number, quantity, manifest type, and condition response code
Context: A complete manifest information record has been built
GIVEN
A complete manifest information record has been built
Applied to: Integrate into Cargo Record
WHEN
The system integrates the manifest into the cargo record
THEN
The manifest information is linked and stored with the corresponding cargo record
Context: Manifest information has been successfully integrated into cargo record
GIVEN
Manifest information has been successfully integrated into cargo record
Applied to: Update Manifest Status
WHEN
The system updates manifest status
THEN
The manifest status is updated to reflect successful processing and integration
Context: Manifest information has been successfully integrated and status updated
GIVEN
Manifest information has been successfully integrated and status updated
Applied to: Log Manifest Integration
WHEN
The system logs the manifest integration
THEN
An audit log entry is created documenting the successful manifest integration with relevant details
Context: Required M10 segment fields are missing or validation has failed
GIVEN
Required M10 segment fields are missing or validation has failed
Applied to: Generate Missing Data Error
WHEN
The system detects missing or invalid data
THEN
A missing data error is generated identifying the specific fields that are missing or invalid
R-GCX016-cbl-04670 (+7) File: GCX016.cbl Extract Disposition Code Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Disposition Code':
  • Context - a status array element s09a-entry exists in the cargo status array:
    For Extract Status Info Code from S09A-STATUS-INFO:
    When the system needs to extract the disposition code for processing, then the system retrieves the status info code from the s09a-status-info field of the current array element.
  • Context - a disposition code has been extracted from the status array element:
    For Is Status Info Code Valid Format?:
    When the system validates the code format for length and character requirements, then the system determines if the code format is valid or invalid based on predefined format rules.
  • Context - a valid format disposition code needs to be validated against the dc table:
    For Perform DC Table Lookup via GCCTBIO:
    When the system calls gcctbio to lookup the disposition code in the gcstbrt dc table, then the system searches for the disposition code and returns whether the code exists in the reference table.
  • Context - a disposition code lookup has been performed against the dc table:
    For Disposition Code Found in DC Table?:
    When the system evaluates the lookup results, then the system determines if the disposition code was found in the table or not found.
  • Context - a disposition code has been found in the dc reference table:
    For Extract Code Definition from DC-DESCRIPTION:
    When the system extracts the code properties, then the system retrieves the code description from dc-description, counterpart code from dc-counterpart-code, and processing instructions from the dc table.
  • Context - a disposition code has been successfully found in the dc table and its properties extracted:
    For Set Code Validation Flag to Valid:
    When the system completes the validation process, then the system sets the code validation flag to valid status and stores the extracted code definition and properties.
  • Context - a disposition code has been extracted from the status array:
    For Log Invalid Code Format Error:
    When the code format validation fails due to invalid length or character composition, then the system logs an invalid code format error and sets the validation flag to invalid.
  • Context - a valid format disposition code has been looked up in the dc table:
    For Log Code Not Found Error:
    When the disposition code is not found in the reference table, then the system logs a code not found error and sets the validation flag to invalid.
👨‍💻 Technical ACs (Gherkin)
Context: A status array element S09A-ENTRY exists in the cargo status array
GIVEN
A status array element S09A-ENTRY exists in the cargo status array
Applied to: Extract Status Info Code from S09A-STATUS-INFO
WHEN
The system needs to extract the disposition code for processing
THEN
The system retrieves the status info code from the S09A-STATUS-INFO field of the current array element
Context: A disposition code has been extracted from the status array element
GIVEN
A disposition code has been extracted from the status array element
Applied to: Is Status Info Code Valid Format?
WHEN
The system validates the code format for length and character requirements
THEN
The system determines if the code format is valid or invalid based on predefined format rules
Context: A valid format disposition code needs to be validated against the DC table
GIVEN
A valid format disposition code needs to be validated against the DC table
Applied to: Perform DC Table Lookup via GCCTBIO
WHEN
The system calls GCCTBIO to lookup the disposition code in the GCSTBRT DC table
THEN
The system searches for the disposition code and returns whether the code exists in the reference table
Context: A disposition code lookup has been performed against the DC table
GIVEN
A disposition code lookup has been performed against the DC table
Applied to: Disposition Code Found in DC Table?
WHEN
The system evaluates the lookup results
THEN
The system determines if the disposition code was found in the table or not found
Context: A disposition code has been found in the DC reference table
GIVEN
A disposition code has been found in the DC reference table
Applied to: Extract Code Definition from DC-DESCRIPTION
WHEN
The system extracts the code properties
THEN
The system retrieves the code description from DC-DESCRIPTION, counterpart code from DC-COUNTERPART-CODE, and processing instructions from the DC table
Context: A disposition code has been successfully found in the DC table and its properties extracted
GIVEN
A disposition code has been successfully found in the DC table and its properties extracted
Applied to: Set Code Validation Flag to Valid
WHEN
The system completes the validation process
THEN
The system sets the code validation flag to valid status and stores the extracted code definition and properties
Context: A disposition code has been extracted from the status array
GIVEN
A disposition code has been extracted from the status array
Applied to: Log Invalid Code Format Error
WHEN
The code format validation fails due to invalid length or character composition
THEN
The system logs an invalid code format error and sets the validation flag to invalid
Context: A valid format disposition code has been looked up in the DC table
GIVEN
A valid format disposition code has been looked up in the DC table
Applied to: Log Code Not Found Error
WHEN
The disposition code is not found in the reference table
THEN
The system logs a code not found error and sets the validation flag to invalid
R-GCX016-cbl-04678 (+20) File: GCX016.cbl Extract Status Information Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Status Information':
  • Context - a s09a array element is being processed:
    For Extract Status Info Code:
    When the system accesses the status information code field, then the status code is extracted and made available for further processing.
  • Context - status information contains location data:
    For Parse Location Code:
    When the system processes the location code field, then the location code is parsed and prepared for location-specific processing.
  • Context - status information is being processed:
    For Location Code Present?:
    When the system evaluates the location code field, then the system determines if location code exists and routes to appropriate processing (border, destination, or no location).
  • Context - location code indicates border location processing:
    For Extract Border Location:
    When the system processes border location data, then border location information is extracted and stored for border-specific cargo processing.
  • Context - location code indicates destination location processing:
    For Extract Destination Location:
    When the system processes destination location data, then destination location information is extracted and stored for destination-specific cargo processing.
  • Context - status information contains processing flag data:
    For Parse Processing Flags:
    When the system processes the flag fields, then processing flags are parsed and made available for cargo status determination.
  • Context - status information contains release flag data:
    For Extract Released Flag:
    When the system processes the released flag field, then the released flag status is extracted and stored for release processing logic.
  • Context - status information contains hold flag data:
    For Extract Hold Flag:
    When the system processes the hold flag field, then the hold flag status is extracted and stored for hold processing logic.
  • Context - status information contains ptt flag data:
    For Extract PTT Flag:
    When the system processes the ptt flag field, then the ptt flag status is extracted and stored for transfer processing logic.
  • Context - status information contains proceed flag data:
    For Extract Proceed Flag:
    When the system processes the proceed flag field, then the proceed flag status is extracted and stored for proceed processing logic.
  • Context - status information contains regulatory indicator data:
    For Parse Regulatory Indicators:
    When the system processes regulatory indicator fields, then regulatory indicators are parsed and prepared for compliance processing.
  • Context - status information contains fda regulatory data:
    For Extract FDA Hold Indicator:
    When the system processes the fda hold indicator field, then the fda hold indicator is extracted and stored for fda compliance processing.
  • Context - status information contains customs regulatory data:
    For Extract Customs Hold Indicator:
    When the system processes the customs hold indicator field, then the customs hold indicator is extracted and stored for customs compliance processing.
  • Context - status information contains seizure indicator data:
    For Extract Seizure Indicator:
    When the system processes the seizure indicator field, then the seizure indicator is extracted and stored for seizure processing logic.
  • Context - status information contains entry number data:
    For Extract Entry Number:
    When the system processes the entry number field, then the entry number is extracted and stored for customs entry processing.
  • Context - status information contains quantity data:
    For Extract Quantity Information:
    When the system processes quantity fields, then quantity information is extracted and stored for quantity-based processing logic.
  • Context - status information contains date stamp data:
    For Extract Date Stamps:
    When the system processes date stamp fields, then date stamps are extracted and stored for time-based processing logic.
  • Context - all status information has been extracted from the array element:
    For Validate Status Consistency:
    When the system performs consistency validation checks, then the system determines if the status information is valid and consistent for processing.
  • Context - status information has been extracted and validated:
    For Status Valid?:
    When the system evaluates the overall validity of the status data, then the system determines if status is valid and routes to appropriate processing (set flags or log invalid status).
  • Context - status information has been validated as correct and consistent:
    For Set Status Flags:
    When the system processes valid status data, then appropriate status flags are set based on the extracted information for subsequent cargo processing.
  • Context - status information has been determined to be invalid or inconsistent:
    For Log Invalid Status:
    When the system encounters invalid status data, then the invalid status information is logged for audit purposes and error tracking.
👨‍💻 Technical ACs (Gherkin)
Context: A S09A array element is being processed
GIVEN
A S09A array element is being processed
Applied to: Extract Status Info Code
WHEN
The system accesses the status information code field
THEN
The status code is extracted and made available for further processing
Context: Status information contains location data
GIVEN
Status information contains location data
Applied to: Parse Location Code
WHEN
The system processes the location code field
THEN
The location code is parsed and prepared for location-specific processing
Context: Status information is being processed
GIVEN
Status information is being processed
Applied to: Location Code Present?
WHEN
The system evaluates the location code field
THEN
The system determines if location code exists and routes to appropriate processing (border, destination, or no location)
Context: Location code indicates border location processing
GIVEN
Location code indicates border location processing
Applied to: Extract Border Location
WHEN
The system processes border location data
THEN
Border location information is extracted and stored for border-specific cargo processing
Context: Location code indicates destination location processing
GIVEN
Location code indicates destination location processing
Applied to: Extract Destination Location
WHEN
The system processes destination location data
THEN
Destination location information is extracted and stored for destination-specific cargo processing
Context: Status information contains processing flag data
GIVEN
Status information contains processing flag data
Applied to: Parse Processing Flags
WHEN
The system processes the flag fields
THEN
Processing flags are parsed and made available for cargo status determination
Context: Status information contains release flag data
GIVEN
Status information contains release flag data
Applied to: Extract Released Flag
WHEN
The system processes the released flag field
THEN
The released flag status is extracted and stored for release processing logic
Context: Status information contains hold flag data
GIVEN
Status information contains hold flag data
Applied to: Extract Hold Flag
WHEN
The system processes the hold flag field
THEN
The hold flag status is extracted and stored for hold processing logic
Context: Status information contains PTT flag data
GIVEN
Status information contains PTT flag data
Applied to: Extract PTT Flag
WHEN
The system processes the PTT flag field
THEN
The PTT flag status is extracted and stored for transfer processing logic
Context: Status information contains proceed flag data
GIVEN
Status information contains proceed flag data
Applied to: Extract Proceed Flag
WHEN
The system processes the proceed flag field
THEN
The proceed flag status is extracted and stored for proceed processing logic
Context: Status information contains regulatory indicator data
GIVEN
Status information contains regulatory indicator data
Applied to: Parse Regulatory Indicators
WHEN
The system processes regulatory indicator fields
THEN
Regulatory indicators are parsed and prepared for compliance processing
Context: Status information contains FDA regulatory data
GIVEN
Status information contains FDA regulatory data
Applied to: Extract FDA Hold Indicator
WHEN
The system processes the FDA hold indicator field
THEN
The FDA hold indicator is extracted and stored for FDA compliance processing
Context: Status information contains customs regulatory data
GIVEN
Status information contains customs regulatory data
Applied to: Extract Customs Hold Indicator
WHEN
The system processes the customs hold indicator field
THEN
The customs hold indicator is extracted and stored for customs compliance processing
Context: Status information contains seizure indicator data
GIVEN
Status information contains seizure indicator data
Applied to: Extract Seizure Indicator
WHEN
The system processes the seizure indicator field
THEN
The seizure indicator is extracted and stored for seizure processing logic
Context: Status information contains entry number data
GIVEN
Status information contains entry number data
Applied to: Extract Entry Number
WHEN
The system processes the entry number field
THEN
The entry number is extracted and stored for customs entry processing
Context: Status information contains quantity data
GIVEN
Status information contains quantity data
Applied to: Extract Quantity Information
WHEN
The system processes quantity fields
THEN
Quantity information is extracted and stored for quantity-based processing logic
Context: Status information contains date stamp data
GIVEN
Status information contains date stamp data
Applied to: Extract Date Stamps
WHEN
The system processes date stamp fields
THEN
Date stamps are extracted and stored for time-based processing logic
Context: All status information has been extracted from the array element
GIVEN
All status information has been extracted from the array element
Applied to: Validate Status Consistency
WHEN
The system performs consistency validation checks
THEN
The system determines if the status information is valid and consistent for processing
Context: Status information has been extracted and validated
GIVEN
Status information has been extracted and validated
Applied to: Status Valid?
WHEN
The system evaluates the overall validity of the status data
THEN
The system determines if status is valid and routes to appropriate processing (set flags or log invalid status)
Context: Status information has been validated as correct and consistent
GIVEN
Status information has been validated as correct and consistent
Applied to: Set Status Flags
WHEN
The system processes valid status data
THEN
Appropriate status flags are set based on the extracted information for subsequent cargo processing
Context: Status information has been determined to be invalid or inconsistent
GIVEN
Status information has been determined to be invalid or inconsistent
Applied to: Log Invalid Status
WHEN
The system encounters invalid status data
THEN
The invalid status information is logged for audit purposes and error tracking
R-GCX016-cbl-04699 (+11) File: GCX016.cbl Apply Hold Priority Rule Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Hold Priority Rule':
  • Context - a cargo status array contains multiple disposition codes including potential fda hold codes:
    For Check for FDA Hold Codes:
    When the system evaluates disposition codes for fda holds (a3 codes) in the status array, then fda hold codes are identified and given highest priority precedence over all other hold and release codes.
  • Context - fda hold codes are detected in the cargo status array:
    For Apply FDA Hold Priority - Highest Precedence:
    When the system resolves conflicting disposition codes with fda holds present, then fda hold status is set as the final cargo status with highest regulatory precedence, and cargo status is set to holdfda.
  • Context - customs hold codes are present in the status array and no fda hold codes exist:
    For Apply Customs Hold Priority:
    When the system evaluates hold code priorities for customs holds, then customs hold codes are given priority over release codes and proceed codes but lower priority than fda holds.
  • Context - release codes are present in the status array and no fda or customs hold codes exist:
    For Apply Release Code Priority:
    When the system evaluates release code priorities, then release codes are processed and applied to determine cargo release status based on quantity validation.
  • Context - ptt status conditions are present and cargo has partial release quantities:
    For Apply PTT Priority for Partial Release:
    When the system evaluates ptt priority against other disposition codes, then ptt status is applied for partial release scenarios while maintaining hold status on remaining quantities.
  • Context - proceed codes are present in the status array and no higher priority hold or release codes exist:
    For Apply Proceed Priority:
    When the system evaluates proceed code priorities, then proceed codes are applied to set cargo proceed status with appropriate location and timing information.
  • Context - hold codes are resolved and location validation determines border location:
    For Set Border Hold Status:
    When the system sets hold status for border location, then border hold status is applied to the cargo with appropriate border location identifiers.
  • Context - hold codes are resolved and location validation determines destination location:
    For Set Destination Hold Status:
    When the system sets hold status for destination location, then destination hold status is applied to the cargo with appropriate destination location identifiers.
  • Context - cargo has release codes and quantity validation is performed:
    For Set Full Release Status:
    When released quantity is greater than or equal to total cargo quantity, then full release status is set for the cargo and all hold conditions are cleared.
  • Context - cargo has release codes and quantity validation shows partial release:
    For Set Partial Release with Hold on Pieces:
    When released quantity is less than total cargo quantity, then partial release status is set with holdpcs (hold pieces) status applied to remaining unreleased quantities.
  • Context - all disposition codes have been evaluated and priorities assigned:
    For Set Final Cargo Status Based on Priority Rules:
    When the system resolves final cargo status based on priority hierarchy, then final cargo status is set according to the highest priority rule: fda holds > customs holds > releases > ptt > proceed codes.
  • Context - final cargo status has been determined through priority rule resolution:
    For Update Status Array with Resolved Status:
    When the system updates the status array with resolved status, then status array is updated with the final resolved disposition codes and conflicting codes are removed or superseded.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo status array contains multiple disposition codes including potential FDA hold codes
GIVEN
A cargo status array contains multiple disposition codes including potential FDA hold codes
Applied to: Check for FDA Hold Codes
WHEN
The system evaluates disposition codes for FDA holds (A3 codes) in the status array
THEN
FDA hold codes are identified and given highest priority precedence over all other hold and release codes
Context: FDA hold codes are detected in the cargo status array
GIVEN
FDA hold codes are detected in the cargo status array
Applied to: Apply FDA Hold Priority - Highest Precedence
WHEN
The system resolves conflicting disposition codes with FDA holds present
THEN
FDA hold status is set as the final cargo status with highest regulatory precedence, and cargo status is set to HOLDFDA
Context: Customs hold codes are present in the status array and no FDA hold codes exist
GIVEN
Customs hold codes are present in the status array and no FDA hold codes exist
Applied to: Apply Customs Hold Priority
WHEN
The system evaluates hold code priorities for customs holds
THEN
Customs hold codes are given priority over release codes and proceed codes but lower priority than FDA holds
Context: Release codes are present in the status array and no FDA or customs hold codes exist
GIVEN
Release codes are present in the status array and no FDA or customs hold codes exist
Applied to: Apply Release Code Priority
WHEN
The system evaluates release code priorities
THEN
Release codes are processed and applied to determine cargo release status based on quantity validation
Context: PTT status conditions are present and cargo has partial release quantities
GIVEN
PTT status conditions are present and cargo has partial release quantities
Applied to: Apply PTT Priority for Partial Release
WHEN
The system evaluates PTT priority against other disposition codes
THEN
PTT status is applied for partial release scenarios while maintaining hold status on remaining quantities
Context: Proceed codes are present in the status array and no higher priority hold or release codes exist
GIVEN
Proceed codes are present in the status array and no higher priority hold or release codes exist
Applied to: Apply Proceed Priority
WHEN
The system evaluates proceed code priorities
THEN
Proceed codes are applied to set cargo proceed status with appropriate location and timing information
Context: Hold codes are resolved and location validation determines border location
GIVEN
Hold codes are resolved and location validation determines border location
Applied to: Set Border Hold Status
WHEN
The system sets hold status for border location
THEN
Border hold status is applied to the cargo with appropriate border location identifiers
Context: Hold codes are resolved and location validation determines destination location
GIVEN
Hold codes are resolved and location validation determines destination location
Applied to: Set Destination Hold Status
WHEN
The system sets hold status for destination location
THEN
Destination hold status is applied to the cargo with appropriate destination location identifiers
Context: Cargo has release codes and quantity validation is performed
GIVEN
Cargo has release codes and quantity validation is performed
Applied to: Set Full Release Status
WHEN
Released quantity is greater than or equal to total cargo quantity
THEN
Full release status is set for the cargo and all hold conditions are cleared
Context: Cargo has release codes and quantity validation shows partial release
GIVEN
Cargo has release codes and quantity validation shows partial release
Applied to: Set Partial Release with Hold on Pieces
WHEN
Released quantity is less than total cargo quantity
THEN
Partial release status is set with HOLDPCS (hold pieces) status applied to remaining unreleased quantities
Context: All disposition codes have been evaluated and priorities assigned
GIVEN
All disposition codes have been evaluated and priorities assigned
Applied to: Set Final Cargo Status Based on Priority Rules
WHEN
The system resolves final cargo status based on priority hierarchy
THEN
Final cargo status is set according to the highest priority rule: FDA holds > customs holds > releases > PTT > proceed codes
Context: Final cargo status has been determined through priority rule resolution
GIVEN
Final cargo status has been determined through priority rule resolution
Applied to: Update Status Array with Resolved Status
WHEN
The system updates the status array with resolved status
THEN
Status array is updated with the final resolved disposition codes and conflicting codes are removed or superseded
R-GCX016-cbl-04711 (+8) File: GCX016.cbl Search Canadian Cargo Database Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search Canadian Cargo Database':
  • Context - equipment id is provided for cross-border matching:
    For Execute Database Query on Canadian Cargo Records:
    When system executes database query on canadian cargo records, then database query is performed to search for matching canadian cargo records.
  • Context - database query is executed on canadian cargo records:
    For Search by Equipment ID Match:
    When system searches by equipment id match, then canadian cargo records are filtered based on equipment id matching criteria.
  • Context - equipment id search has been performed on canadian cargo database:
    For Canadian Cargo Records Found?:
    When system checks if canadian cargo records are found, then system determines if records exist and routes processing accordingly - if records found proceed to validation, if no records found log no valid records.
  • Context - canadian cargo records have been found for the equipment id:
    For Validate Canadian Record Status:
    When system validates canadian record status, then record status is checked to determine if record is valid for cross-border processing.
  • Context - canadian record status has been validated:
    For Record Valid for Processing?:
    When system checks if record is valid for processing, then system routes to appropriate processing path - if valid return record, if deleted exclude record, if unusable exclude record.
  • Context - canadian cargo record has been identified as deleted:
    For Exclude Deleted Records:
    When system processes record validation results, then deleted record is excluded from processing and system logs no valid canadian records found.
  • Context - canadian cargo record has been identified as unusable:
    For Exclude Unusable Records:
    When system processes record validation results, then unusable record is excluded from processing and system logs no valid canadian records found.
  • Context - canadian cargo record has been validated as suitable for processing:
    For Return Valid Canadian Cargo Record:
    When system processes valid record, then valid canadian cargo record is returned for cross-border coordination.
  • Context - no canadian cargo records exist or all found records are deleted or all found records are unusable:
    For Log No Valid Canadian Records Found:
    When system completes canadian cargo record search and validation, then system logs that no valid canadian records were found and continues with cross-border coordination.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment ID is provided for cross-border matching
GIVEN
Equipment ID is provided for cross-border matching
Applied to: Execute Database Query on Canadian Cargo Records
WHEN
System executes database query on Canadian cargo records
THEN
Database query is performed to search for matching Canadian cargo records
Context: Database query is executed on Canadian cargo records
GIVEN
Database query is executed on Canadian cargo records
Applied to: Search by Equipment ID Match
WHEN
System searches by equipment ID match
THEN
Canadian cargo records are filtered based on equipment ID matching criteria
Context: Equipment ID search has been performed on Canadian cargo database
GIVEN
Equipment ID search has been performed on Canadian cargo database
Applied to: Canadian Cargo Records Found?
WHEN
System checks if Canadian cargo records are found
THEN
System determines if records exist and routes processing accordingly - if records found proceed to validation, if no records found log no valid records
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 Record Status
WHEN
System validates Canadian record status
THEN
Record status is checked to determine if record is valid for cross-border processing
Context: Canadian record status has been validated
GIVEN
Canadian record status has been validated
Applied to: Record Valid for Processing?
WHEN
System checks if record is valid for processing
THEN
System routes to appropriate processing path - if valid return record, if deleted exclude record, if unusable exclude record
Context: Canadian cargo record has been identified as deleted
GIVEN
Canadian cargo record has been identified as deleted
Applied to: Exclude Deleted Records
WHEN
System processes record validation results
THEN
Deleted record is excluded from processing and system logs no valid Canadian records found
Context: Canadian cargo record has been identified as unusable
GIVEN
Canadian cargo record has been identified as unusable
Applied to: Exclude Unusable Records
WHEN
System processes record validation results
THEN
Unusable record is excluded from processing and system logs no valid Canadian records found
Context: Canadian cargo record has been validated as suitable for processing
GIVEN
Canadian cargo record has been validated as suitable for processing
Applied to: Return Valid Canadian Cargo Record
WHEN
System processes valid record
THEN
Valid Canadian cargo record is returned for cross-border coordination
Context: No Canadian cargo records exist OR all found records are deleted OR all found records are unusable
GIVEN
No Canadian cargo records exist OR all found records are deleted OR all found records are unusable
Applied to: Log No Valid Canadian Records Found
WHEN
System completes Canadian cargo record search and validation
THEN
System logs that no valid Canadian records were found and continues with cross-border coordination
R-GCX016-cbl-04720 (+12) File: GCX016.cbl Generate Cross Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generate Cross':
  • Context - a cargo record exists in the system:
    For US Cargo Released?:
    When the system checks the cargo release status, then the system determines if the cargo is released and proceeds with cross-border processing or terminates the process.
  • Context - us cargo has been released and equipment id is available:
    For Find Matching Canadian Manifests:
    When the system searches for canadian manifest records using the equipment id, then the system retrieves all matching canadian manifest records for cross-border coordination.
  • Context - the system has searched for canadian manifest records:
    For Canadian Manifest Found?:
    When the search results are evaluated, then if canadian manifest records are found, continue processing; otherwise terminate cross-border log generation.
  • Context - canadian manifest records have been found:
    For Extract Cargo Details:
    When the system extracts cargo details from both us and canadian records, then all relevant cargo information including waybill, car id, and cargo descriptions are captured for cross-border coordination.
  • Context - cargo details have been extracted:
    For Capture Status Changes:
    When the system captures status change information, then all status transitions including timestamps, disposition codes, and release quantities are recorded for the audit trail.
  • Context - status changes have been captured:
    For Build Cross-Border Coordination Info:
    When the system builds cross-border coordination information, then border crossing details, customs release information, and coordination data are assembled for canadian system notification.
  • Context - cross-border coordination information has been built:
    For Format Audit Trail Message:
    When the system formats the audit trail message, then the message is structured with proper headers, cargo details, and status information according to cross-border communication protocols.
  • Context - the audit trail message has been formatted:
    For Include Equipment ID Information:
    When equipment id information is included in the message, then car initial, car number, and other equipment identifiers are added to enable proper cargo tracking across borders.
  • Context - equipment id information has been included:
    For Add Release Status Details:
    When release status details are added to the message, then release quantities, disposition codes, release dates, and customs clearance information are included in the log message.
  • Context - release status details have been added:
    For Add Border Crossing Information:
    When border crossing information is added to the message, then border location codes, crossing dates, and customs port information are included to complete the cross-border coordination data.
  • Context - border crossing information has been added:
    For Generate Log Message for Canadian System:
    When the log message is generated for the canadian system, then a complete cross-border log message is created with all cargo details, status changes, and coordination information formatted for canadian system consumption.
  • Context - the log message has been generated for the canadian system:
    For Send Message to Canadian CCN:
    When the message is sent to canadian ccn, then the cross-border log message is successfully transmitted to the canadian system for cargo coordination and tracking.
  • Context - the message has been sent to canadian ccn:
    For Update Audit Trail:
    When the audit trail is updated, then the cross-border log message transmission is recorded with timestamp, message content, and transmission status for compliance and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: US Cargo Released?
WHEN
The system checks the cargo release status
THEN
The system determines if the cargo is released and proceeds with cross-border processing or terminates the process
Context: US cargo has been released and equipment ID is available
GIVEN
US cargo has been released and equipment ID is available
Applied to: Find Matching Canadian Manifests
WHEN
The system searches for Canadian manifest records using the equipment ID
THEN
The system retrieves all matching Canadian manifest records for cross-border coordination
Context: The system has searched for Canadian manifest records
GIVEN
The system has searched for Canadian manifest records
Applied to: Canadian Manifest Found?
WHEN
The search results are evaluated
THEN
If Canadian manifest records are found, continue processing; otherwise terminate cross-border log generation
Context: Canadian manifest records have been found
GIVEN
Canadian manifest records have been found
Applied to: Extract Cargo Details
WHEN
The system extracts cargo details from both US and Canadian records
THEN
All relevant cargo information including waybill, car ID, and cargo descriptions are captured for cross-border coordination
Context: Cargo details have been extracted
GIVEN
Cargo details have been extracted
Applied to: Capture Status Changes
WHEN
The system captures status change information
THEN
All status transitions including timestamps, disposition codes, and release quantities are recorded for the audit trail
Context: Status changes have been captured
GIVEN
Status changes have been captured
Applied to: Build Cross-Border Coordination Info
WHEN
The system builds cross-border coordination information
THEN
Border crossing details, customs release information, and coordination data are assembled for Canadian system notification
Context: Cross-border coordination information has been built
GIVEN
Cross-border coordination information has been built
Applied to: Format Audit Trail Message
WHEN
The system formats the audit trail message
THEN
The message is structured with proper headers, cargo details, and status information according to cross-border communication protocols
Context: The audit trail message has been formatted
GIVEN
The audit trail message has been formatted
Applied to: Include Equipment ID Information
WHEN
Equipment ID information is included in the message
THEN
Car initial, car number, and other equipment identifiers are added to enable proper cargo tracking across borders
Context: Equipment ID information has been included
GIVEN
Equipment ID information has been included
Applied to: Add Release Status Details
WHEN
Release status details are added to the message
THEN
Release quantities, disposition codes, release dates, and customs clearance information are included in the log message
Context: Release status details have been added
GIVEN
Release status details have been added
Applied to: Add Border Crossing Information
WHEN
Border crossing information is added to the message
THEN
Border location codes, crossing dates, and customs port information are included to complete the cross-border coordination data
Context: Border crossing information has been added
GIVEN
Border crossing information has been added
Applied to: Generate Log Message for Canadian System
WHEN
The log message is generated for the Canadian system
THEN
A complete cross-border log message is created with all cargo details, status changes, and coordination information formatted for Canadian system consumption
Context: The log message has been generated for the Canadian system
GIVEN
The log message has been generated for the Canadian system
Applied to: Send Message to Canadian CCN
WHEN
The message is sent to Canadian CCN
THEN
The cross-border log message is successfully transmitted to the Canadian system for cargo coordination and tracking
Context: The message has been sent to Canadian CCN
GIVEN
The message has been sent to Canadian CCN
Applied to: Update Audit Trail
WHEN
The audit trail is updated
THEN
The cross-border log message transmission is recorded with timestamp, message content, and transmission status for compliance and tracking purposes
R-GCX016-cbl-04733 (+9) File: GCX016.cbl Query Canadian Cargo Database Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Query Canadian Cargo Database':
  • Context - an equipment id needs to be used for canadian cargo database search:
    For Format Equipment ID for Search:
    When the system prepares the search parameters, then the equipment id is formatted according to database requirements.
  • Context - a formatted equipment id is available for search:
    For Execute Database Query with Equipment ID Index:
    When the system executes the database query, then the database is searched using equipment id index for optimal performance.
  • Context - a canadian cargo record has been retrieved from the database:
    For Validate Canadian Record Status:
    When the system validates the record status, then the record status is checked for validity and active status.
  • Context - a canadian cargo record status has been validated:
    For Record Valid and Active?:
    When the system checks if the record is valid and active, then the record is classified as either valid and active or invalid/inactive.
  • Context - a canadian cargo record is determined to be valid and active:
    For Return Canadian Cargo Record:
    When the system processes the successful match, then the valid canadian cargo record is returned for further processing.
  • Context - a valid canadian cargo record has been successfully retrieved:
    For Log Equipment ID Match Success:
    When the system completes the successful match process, then the equipment id match success is logged for audit trail.
  • Context - a database error occurs during canadian cargo search:
    For Handle Database Error:
    When the system encounters the error condition, then the database error is handled according to error handling procedures.
  • Context - a database error has occurred or no initial match was found:
    For Retry Search?:
    When the system evaluates retry conditions, then the system decides whether to attempt an alternate search method or terminate the search.
  • Context - the primary equipment id search has failed or returned no results:
    For Execute Alternate Search Method:
    When the system determines that alternate search should be attempted, then an alternate search method is executed to find canadian cargo records.
  • Context - all search methods have been exhausted without finding matching canadian cargo:
    For Return No Match Found:
    When the system determines no match can be found, then a no match found result is returned to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID needs to be used for Canadian cargo database search
GIVEN
An equipment ID needs to be used for Canadian cargo database search
Applied to: Format Equipment ID for Search
WHEN
The system prepares the search parameters
THEN
The equipment ID is formatted according to database requirements
Context: A formatted equipment ID is available for search
GIVEN
A formatted equipment ID is available for search
Applied to: Execute Database Query with Equipment ID Index
WHEN
The system executes the database query
THEN
The database is searched using equipment ID index for optimal performance
Context: A Canadian cargo record has been retrieved from the database
GIVEN
A Canadian cargo record has been retrieved from the database
Applied to: Validate Canadian Record Status
WHEN
The system validates the record status
THEN
The record status is checked for validity and active status
Context: A Canadian cargo record status has been validated
GIVEN
A Canadian cargo record status has been validated
Applied to: Record Valid and Active?
WHEN
The system checks if the record is valid and active
THEN
The record is classified as either valid and active or invalid/inactive
Context: A Canadian cargo record is determined to be valid and active
GIVEN
A Canadian cargo record is determined to be valid and active
Applied to: Return Canadian Cargo Record
WHEN
The system processes the successful match
THEN
The valid Canadian cargo record is returned for further processing
Context: A valid Canadian cargo record has been successfully retrieved
GIVEN
A valid Canadian cargo record has been successfully retrieved
Applied to: Log Equipment ID Match Success
WHEN
The system completes the successful match process
THEN
The equipment ID match success is logged for audit trail
Context: A database error occurs during Canadian cargo search
GIVEN
A database error occurs during Canadian cargo search
Applied to: Handle Database Error
WHEN
The system encounters the error condition
THEN
The database error is handled according to error handling procedures
Context: A database error has occurred or no initial match was found
GIVEN
A database error has occurred or no initial match was found
Applied to: Retry Search?
WHEN
The system evaluates retry conditions
THEN
The system decides whether to attempt an alternate search method or terminate the search
Context: The primary equipment ID search has failed or returned no results
GIVEN
The primary equipment ID search has failed or returned no results
Applied to: Execute Alternate Search Method
WHEN
The system determines that alternate search should be attempted
THEN
An alternate search method is executed to find Canadian cargo records
Context: All search methods have been exhausted without finding matching Canadian cargo
GIVEN
All search methods have been exhausted without finding matching Canadian cargo
Applied to: Return No Match Found
WHEN
The system determines no match can be found
THEN
A no match found result is returned to the calling process
R-GCX016-cbl-04743 (+4) File: GCX016.cbl Calculate Remaining Quantity Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Calculate Remaining Quantity':
  • Context - a cargo record exists with total quantity and released quantity values:
    For Calculate Remaining Quantity:
    When the system processes quantity calculations for release determination, then the remaining quantity is calculated as total quantity minus released quantity.
  • Context - a remaining quantity has been calculated from total and released quantities:
    For Remaining Quantity >= 0?:
    When the calculated remaining quantity is less than zero, then the system logs a quantity validation error and sets remaining quantity to zero.
  • Context - a valid remaining quantity exists for a cargo record:
    For Partial Release?:
    When the remaining quantity is greater than zero, then the cargo is marked as partially released.
  • Context - a cargo record has remaining quantity equal to zero:
    For Mark as Fully Released:
    When the system evaluates release status, then the cargo is marked as fully released.
  • Context - cargo has been marked as either partially released or fully released:
    For Update Cargo Quantity Status:
    When the quantity calculation process is complete, then the cargo quantity status is updated in the system.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with total quantity and released quantity values
GIVEN
A cargo record exists with total quantity and released quantity values
Applied to: Calculate Remaining Quantity
WHEN
The system processes quantity calculations for release determination
THEN
The remaining quantity is calculated as total quantity minus released quantity
Context: A remaining quantity has been calculated from total and released quantities
GIVEN
A remaining quantity has been calculated from total and released quantities
Applied to: Remaining Quantity >= 0?
WHEN
The calculated remaining quantity is less than zero
THEN
The system logs a quantity validation error and sets remaining quantity to zero
Context: A valid remaining quantity exists for a cargo record
GIVEN
A valid remaining quantity exists for a cargo record
Applied to: Partial Release?
WHEN
The remaining quantity is greater than zero
THEN
The cargo is marked as partially released
Context: A cargo record has remaining quantity equal to zero
GIVEN
A cargo record has remaining quantity equal to zero
Applied to: Mark as Fully Released
WHEN
The system evaluates release status
THEN
The cargo is marked as fully released
Context: Cargo has been marked as either partially released or fully released
GIVEN
Cargo has been marked as either partially released or fully released
Applied to: Update Cargo Quantity Status
WHEN
The quantity calculation process is complete
THEN
The cargo quantity status is updated in the system