Bits In Glass
BIG Pega COE Team

Detailed Acceptance Criteria (ACs)

Category: GCX146_Canada_Import_train

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.

🎯 GCX146_Canada_Import_train Scope Detected: Extracted 1872 rules, Optimally Merged into 163 Feature Scenarios.
R-GCX146-cbl-00001 (+34) File: GCX146.cbl Overview Rules Merged 35 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Overview Rules':
  • Context - the system is ready to process train manifest requests:
    For 1:Input Message Retrieval:
    When the system attempts to retrieve the next input message from the queue, then if a message is available, processing continues; if no message is available, processing terminates.
  • Context - a user submits a train manifest request with a specific scac code:
    For 2:SCAC Access Validation:
    When the system validates scac access permissions for the user, then if scac access is invalid and the request is not an aei train send, the system generates error 36 and rolls back the transaction.
  • Context - an input message is received for train manifest processing:
    For 3:Request Type Validation:
    When the system examines the request type flags, then the request must be classified as add, verify, or notify; if none of these flags are set, the input is marked as invalid.
  • Context - the system needs to validate estimated time of arrival dates:
    For 4:Date and Time Processing:
    When date range calculations are performed, then the system calculates n30 (minus 30 days), p05 (plus 5 days), n02 (minus 2 days), and p02 (plus 2 days) from current date for validation boundaries.
  • Context - a user submits a train manifest with an estimated time of arrival:
    For 5:ETA Date Range Validation:
    When the system validates the eta date against user-specific date ranges, then for 's' type users, eta must be between n30 and p05 dates (error 25 if violated); for other users, eta must be between n02 and p02 dates (error 35 if violated).
  • Context - a train manifest request requires merlin communication capabilities:
    For 6:Merlin ID Management:
    When the system validates merlin id configurations, then public, supervisor, customs, dc-p, and system fax merlin ids must all exist in emtz table; missing ids generate specific errors (4-8, 29).
  • Context - train identification components are provided in the input:
    For 7:Train ID Construction:
    When the system constructs the customs train id, then spaces in train number, day, from/to stations, and consist number are replaced with zeros to create a standardized format.
  • Context - train manifest contains origin and destination station codes:
    For 8:Station Information Validation:
    When the system validates station information, then station codes must exist in the station master data and associated station names and routing information must be retrievable.
  • Context - a train manifest operation requires database record management:
    For 9:Train Record Management:
    When the system performs train record operations, then for add operations, existing train records are deleted and new records are inserted with sent status; for other operations, records are retrieved for validation.
  • Context - a train manifest contains a list of equipment:
    For 10:Equipment Data Extraction:
    When the system validates the equipment list, then the equipment list must contain at least one entry (error 34 if none) and no more than 500 entries (error 28 if exceeded).
  • Context - equipment requires waybill information for processing:
    For 11:Waybill Lookup Processing:
    When the system searches for waybill data, then primary lookup uses fwcarget for latest waybill by car id; if not found, secondary lookup uses fwciio for car inquiry; if still not found, tertiary lookup uses fwiqio for waybill inquiry.
  • Context - primary waybill lookup has failed for equipment:
    For 43:Waybill Inquiry Database Processing:
    When the system performs inquiry database processing, then the system searches fwinq inquiry records and processes waybill sequences to extract equipment and shipment information.
  • Context - equipment information is available for classification:
    For 12:Equipment Type Classification:
    When the system determines equipment type, then equipment is classified as unit (l,p,d,u), van (v), sbu, etu (e), or regular car based on equipment type codes.
  • Context - equipment has a designated load/empty status:
    For 13:Load/Empty Status Processing:
    When the system validates waybill requirements, then empty cars (le = 'e') are allowed without waybill for add operations; loaded cars without waybill generate error 21 for add operations or report 'loaded car - no waybill' for verify operations.
  • Context - equipment requires ccn validation for customs processing:
    For 15:CCN Database Lookup:
    When the system performs ccn database lookup, then the system searches gcccrt database using equipment id and waybill information to retrieve existing ccn records and status.
  • Context - a ccn record exists for equipment:
    For 16:CCN Status Validation:
    When the system validates ccn status, then ccn status must be 'sent', 'return', 'manual', 'release', 'ack', or 'csa-dlv'; invalid status generates error 24 for add operations or reports current status for verify operations.
  • Context - a ccn is being assigned to a train:
    For 17:Train Assignment Validation:
    When the system checks for existing train assignments, then if the ccn is already assigned to a different train, error 13 is generated to prevent duplicate assignments.
  • Context - a flat car is carrying containers and waybill information is available:
    For 19:Container Processing:
    When the system processes container information, then container ids are extracted from waybill cross-reference data and formatted using gcccarfm utility for 12-character format.
  • Context - equipment is classified as empty or exempted from ccn requirements:
    For 20:Empty/Exempted Equipment Processing:
    When the system processes the equipment, then empty cars and exempted equipment types bypass ccn validation requirements and are processed with appropriate status indicators.
  • Context - equipment has been processed and status determined:
    For 21:Equipment Status Totals Compilation:
    When the system compiles status totals, then total-release counts equipment with 'release' or 'csa-dlv' status; total-haulage counts equipment with haulage rights; total-proceed counts equipment in transit between different stations; total-held-ccra counts equipment with 'hold' or 'agi-hold' status; total-held-docs counts equipment at same station with no broker entry.
  • Context - train manifest data has been validated and processed:
    For 22:EDI Transmission Processing:
    When the system transmits edi transactions, then edi transactions are sent to appropriate trading partners and customs authorities with train and equipment information.
  • Context - an aei train send operation is performed:
    For 23:AEI Logging:
    When the system logs aei activity, then aei send activity is logged regardless of processing errors for audit trail and tracking purposes.
  • Context - train manifest processing has completed:
    For 24:Confirmation Message Generation:
    When the system generates confirmation messages, then successful operations generate confirmation messages to originating terminals; failed operations generate error notifications with appropriate error codes.
  • Context - add operation completed successfully without errors:
    For 25:Canada Customs Trip Sheet Generation:
    When the system generates canada customs trip sheets, then trip sheets include equipment details, waybill information, shipper/consignee data, and are sent to appropriate canadian customs terminals.
  • Context - verify operation is requested for train manifest:
    For 26:Status Report Generation:
    When the system generates status reports, then status report includes equipment totals by category, detailed status information, transit status indicators, and up to 90 lines of us status messages.
  • Context - validation errors are detected during processing:
    For 27:Error Message Processing:
    When the system processes error messages, then error messages are formatted with appropriate error codes and descriptions, then distributed to supervisors and originating terminals for resolution.
  • Context - reports or notifications need to be distributed electronically:
    For 28:Email/FAX Distribution:
    When the system processes email and fax distribution, then email messages are limited to 699 lines per message; larger reports create continuation messages with 'continuation of report...' header; failed emails are sent to support team (om01247, aei9999).
  • Context - us-bound cargo requires trip sheet documentation:
    For 29:US Trip Sheet Generation:
    When the system generates us trip sheets, then trip sheets include equipment type descriptions, status mappings (release with export transit becomes 'export', transit status 't' becomes 'transit', return status 'r' becomes 'return'), and are distributed to us merlin users.
  • Context - train manifest contains cargo with destination information:
    For 30:Cargo Arrival Detection:
    When the system detects cargo arrivals, then cargo is identified as arriving when manifest destination codes match station codes; only non-ocean manifest cargo is processed for arrival notifications.
  • Context - arriving cargo has been detected at destination stations:
    For 31:Cargo Arrival Notification:
    When the system processes arrival notifications, then arrival notices are created and sent to customs processing systems via gct1481e transactions for appropriate handling.
  • Context - cargo requires return processing with new ccn creation:
    For 32:Return CCN Creation:
    When the system creates return ccn records, then new ccn records are created with 'return' status, ccn key format includes type(6) + carrier(105) + e + equipment_id + waybill_date + sequence, and audit trail entries are created via gcx105 spawning.
  • Context - ccn keys starting with '6105' (excluding 'i' type) require broker notification:
    For 33:Broker Notification Processing:
    When the system processes broker notifications, then notifications are sent to brokers only if current status is not 'return' or 'manual'; multiple notification methods are supported (x12, merlin, internet, fax, paper) with primary and secondary broker handling.
  • Context - equipment has us customs records requiring status processing:
    For 34:US Customs Status Processing:
    When the system processes us customs status, then bond types (it, tr, mt, te) are validated; warnings are generated for it bond types, train vessel mismatches, in-transit location mismatches, and tib date issues; arrival keys are tracked for specific bond types during add operations.
  • Context - canadian border processing requires special manifest creation:
    For 35:Special Manifest Processing:
    When the system processes special manifests, then special manifest records are created with record type 'ca' (canadian), border code and station name from train data, and ccn keys are stored for processing.
  • Context - a ccn exists for equipment validation:
    For 36:CCN Usability Validation:
    When the system validates ccn usability, then ccn is usable if equipment id matches saved equipment id and (waybill number matches or new bond created flag = 'y'); if ccn exists with same equipment but different waybill and no new bond created, it's marked unusable; for verify operations, 'ccn found not usable' status message is added.
👨‍💻 Technical ACs (Gherkin)
Context: The system is ready to process train manifest requests
GIVEN
The system is ready to process train manifest requests
Applied to: 1:Input Message Retrieval
WHEN
The system attempts to retrieve the next input message from the queue
THEN
If a message is available, processing continues; if no message is available, processing terminates
Context: A user submits a train manifest request with a specific SCAC code
GIVEN
A user submits a train manifest request with a specific SCAC code
Applied to: 2:SCAC Access Validation
WHEN
The system validates SCAC access permissions for the user
THEN
If SCAC access is invalid AND the request is not an AEI train send, the system generates error 36 and rolls back the transaction
Context: An input message is received for train manifest processing
GIVEN
An input message is received for train manifest processing
Applied to: 3:Request Type Validation
WHEN
The system examines the request type flags
THEN
The request must be classified as ADD, VERIFY, or NOTIFY; if none of these flags are set, the input is marked as invalid
Context: The system needs to validate estimated time of arrival dates
GIVEN
The system needs to validate estimated time of arrival dates
Applied to: 4:Date and Time Processing
WHEN
Date range calculations are performed
THEN
The system calculates N30 (minus 30 days), P05 (plus 5 days), N02 (minus 2 days), and P02 (plus 2 days) from current date for validation boundaries
Context: A user submits a train manifest with an estimated time of arrival
GIVEN
A user submits a train manifest with an estimated time of arrival
Applied to: 5:ETA Date Range Validation
WHEN
The system validates the ETA date against user-specific date ranges
THEN
For 'S' type users, ETA must be between N30 and P05 dates (error 25 if violated); for other users, ETA must be between N02 and P02 dates (error 35 if violated)
Context: A train manifest request requires Merlin communication capabilities
GIVEN
A train manifest request requires Merlin communication capabilities
Applied to: 6:Merlin ID Management
WHEN
The system validates Merlin ID configurations
THEN
Public, Supervisor, Customs, DC-P, and System FAX Merlin IDs must all exist in EMTZ table; missing IDs generate specific errors (4-8, 29)
Context: Train identification components are provided in the input
GIVEN
Train identification components are provided in the input
Applied to: 7:Train ID Construction
WHEN
The system constructs the customs train ID
THEN
Spaces in train number, day, from/to stations, and consist number are replaced with zeros to create a standardized format
Context: Train manifest contains origin and destination station codes
GIVEN
Train manifest contains origin and destination station codes
Applied to: 8:Station Information Validation
WHEN
The system validates station information
THEN
Station codes must exist in the station master data and associated station names and routing information must be retrievable
Context: A train manifest operation requires database record management
GIVEN
A train manifest operation requires database record management
Applied to: 9:Train Record Management
WHEN
The system performs train record operations
THEN
For ADD operations, existing train records are deleted and new records are inserted with SENT status; for other operations, records are retrieved for validation
Context: A train manifest contains a list of equipment
GIVEN
A train manifest contains a list of equipment
Applied to: 10:Equipment Data Extraction
WHEN
The system validates the equipment list
THEN
The equipment list must contain at least one entry (error 34 if none) and no more than 500 entries (error 28 if exceeded)
Context: Equipment requires waybill information for processing
GIVEN
Equipment requires waybill information for processing
Applied to: 11:Waybill Lookup Processing
WHEN
The system searches for waybill data
THEN
Primary lookup uses FWCARGET for latest waybill by car ID; if not found, secondary lookup uses FWCIIO for car inquiry; if still not found, tertiary lookup uses FWIQIO for waybill inquiry
Context: Primary waybill lookup has failed for equipment
GIVEN
Primary waybill lookup has failed for equipment
Applied to: 43:Waybill Inquiry Database Processing
WHEN
The system performs inquiry database processing
THEN
The system searches FWINQ inquiry records and processes waybill sequences to extract equipment and shipment information
Context: Equipment information is available for classification
GIVEN
Equipment information is available for classification
Applied to: 12:Equipment Type Classification
WHEN
The system determines equipment type
THEN
Equipment is classified as Unit (L,P,D,U), Van (V), SBU, ETU (E), or regular car based on equipment type codes
Context: Equipment has a designated load/empty status
GIVEN
Equipment has a designated load/empty status
Applied to: 13:Load/Empty Status Processing
WHEN
The system validates waybill requirements
THEN
Empty cars (LE = 'E') are allowed without waybill for ADD operations; loaded cars without waybill generate error 21 for ADD operations or report 'LOADED CAR - NO WAYBILL' for VERIFY operations
Context: Equipment requires CCN validation for customs processing
GIVEN
Equipment requires CCN validation for customs processing
Applied to: 15:CCN Database Lookup
WHEN
The system performs CCN database lookup
THEN
The system searches GCCCRT database using equipment ID and waybill information to retrieve existing CCN records and status
Context: A CCN record exists for equipment
GIVEN
A CCN record exists for equipment
Applied to: 16:CCN Status Validation
WHEN
The system validates CCN status
THEN
CCN status must be 'SENT', 'RETURN', 'MANUAL', 'RELEASE', 'ACK', or 'CSA-DLV'; invalid status generates error 24 for ADD operations or reports current status for VERIFY operations
Context: A CCN is being assigned to a train
GIVEN
A CCN is being assigned to a train
Applied to: 17:Train Assignment Validation
WHEN
The system checks for existing train assignments
THEN
If the CCN is already assigned to a different train, error 13 is generated to prevent duplicate assignments
Context: A flat car is carrying containers and waybill information is available
GIVEN
A flat car is carrying containers and waybill information is available
Applied to: 19:Container Processing
WHEN
The system processes container information
THEN
Container IDs are extracted from waybill cross-reference data and formatted using GCCCARFM utility for 12-character format
Context: Equipment is classified as empty or exempted from CCN requirements
GIVEN
Equipment is classified as empty or exempted from CCN requirements
Applied to: 20:Empty/Exempted Equipment Processing
WHEN
The system processes the equipment
THEN
Empty cars and exempted equipment types bypass CCN validation requirements and are processed with appropriate status indicators
Context: Equipment has been processed and status determined
GIVEN
Equipment has been processed and status determined
Applied to: 21:Equipment Status Totals Compilation
WHEN
The system compiles status totals
THEN
TOTAL-RELEASE counts equipment with 'RELEASE' or 'CSA-DLV' status; TOTAL-HAULAGE counts equipment with haulage rights; TOTAL-PROCEED counts equipment in transit between different stations; TOTAL-HELD-CCRA counts equipment with 'HOLD' or 'AGI-HOLD' status; TOTAL-HELD-DOCS counts equipment at same station with no broker entry
Context: Train manifest data has been validated and processed
GIVEN
Train manifest data has been validated and processed
Applied to: 22:EDI Transmission Processing
WHEN
The system transmits EDI transactions
THEN
EDI transactions are sent to appropriate trading partners and customs authorities with train and equipment information
Context: An AEI train send operation is performed
GIVEN
An AEI train send operation is performed
Applied to: 23:AEI Logging
WHEN
The system logs AEI activity
THEN
AEI send activity is logged regardless of processing errors for audit trail and tracking purposes
Context: Train manifest processing has completed
GIVEN
Train manifest processing has completed
Applied to: 24:Confirmation Message Generation
WHEN
The system generates confirmation messages
THEN
Successful operations generate confirmation messages to originating terminals; failed operations generate error notifications with appropriate error codes
Context: ADD operation completed successfully without errors
GIVEN
ADD operation completed successfully without errors
Applied to: 25:Canada Customs Trip Sheet Generation
WHEN
The system generates Canada customs trip sheets
THEN
Trip sheets include equipment details, waybill information, shipper/consignee data, and are sent to appropriate Canadian customs terminals
Context: VERIFY operation is requested for train manifest
GIVEN
VERIFY operation is requested for train manifest
Applied to: 26:Status Report Generation
WHEN
The system generates status reports
THEN
Status report includes equipment totals by category, detailed status information, transit status indicators, and up to 90 lines of US status messages
Context: Validation errors are detected during processing
GIVEN
Validation errors are detected during processing
Applied to: 27:Error Message Processing
WHEN
The system processes error messages
THEN
Error messages are formatted with appropriate error codes and descriptions, then distributed to supervisors and originating terminals for resolution
Context: Reports or notifications need to be distributed electronically
GIVEN
Reports or notifications need to be distributed electronically
Applied to: 28:Email/FAX Distribution
WHEN
The system processes email and FAX distribution
THEN
Email messages are limited to 699 lines per message; larger reports create continuation messages with 'CONTINUATION OF REPORT...' header; failed emails are sent to support team (OM01247, AEI9999)
Context: US-bound cargo requires trip sheet documentation
GIVEN
US-bound cargo requires trip sheet documentation
Applied to: 29:US Trip Sheet Generation
WHEN
The system generates US trip sheets
THEN
Trip sheets include equipment type descriptions, status mappings (RELEASE with export transit becomes 'EXPORT', transit status 'T' becomes 'TRANSIT', return status 'R' becomes 'RETURN'), and are distributed to US Merlin users
Context: Train manifest contains cargo with destination information
GIVEN
Train manifest contains cargo with destination information
Applied to: 30:Cargo Arrival Detection
WHEN
The system detects cargo arrivals
THEN
Cargo is identified as arriving when manifest destination codes match station codes; only non-ocean manifest cargo is processed for arrival notifications
Context: Arriving cargo has been detected at destination stations
GIVEN
Arriving cargo has been detected at destination stations
Applied to: 31:Cargo Arrival Notification
WHEN
The system processes arrival notifications
THEN
Arrival notices are created and sent to customs processing systems via GCT1481E transactions for appropriate handling
Context: Cargo requires return processing with new CCN creation
GIVEN
Cargo requires return processing with new CCN creation
Applied to: 32:Return CCN Creation
WHEN
The system creates return CCN records
THEN
New CCN records are created with 'RETURN' status, CCN key format includes type(6) + carrier(105) + E + equipment_id + waybill_date + sequence, and audit trail entries are created via GCX105 spawning
Context: CCN keys starting with '6105' (excluding 'I' type) require broker notification
GIVEN
CCN keys starting with '6105' (excluding 'I' type) require broker notification
Applied to: 33:Broker Notification Processing
WHEN
The system processes broker notifications
THEN
Notifications are sent to brokers only if current status is not 'RETURN' or 'MANUAL'; multiple notification methods are supported (X12, Merlin, Internet, FAX, Paper) with primary and secondary broker handling
Context: Equipment has US customs records requiring status processing
GIVEN
Equipment has US customs records requiring status processing
Applied to: 34:US Customs Status Processing
WHEN
The system processes US customs status
THEN
Bond types (IT, TR, MT, TE) are validated; warnings are generated for IT bond types, train vessel mismatches, in-transit location mismatches, and TIB date issues; arrival keys are tracked for specific bond types during ADD operations
Context: Canadian border processing requires special manifest creation
GIVEN
Canadian border processing requires special manifest creation
Applied to: 35:Special Manifest Processing
WHEN
The system processes special manifests
THEN
Special manifest records are created with record type 'CA' (Canadian), border code and station name from train data, and CCN keys are stored for processing
Context: A CCN exists for equipment validation
GIVEN
A CCN exists for equipment validation
Applied to: 36:CCN Usability Validation
WHEN
The system validates CCN usability
THEN
CCN is usable if equipment ID matches saved equipment ID AND (waybill number matches OR new bond created flag = 'Y'); if CCN exists with same equipment but different waybill and no new bond created, it's marked unusable; for VERIFY operations, 'CCN FOUND NOT USABLE' status message is added
R-GCX146-cbl-00036 (+7) File: GCX146.cbl Input Message Retrieval Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Input Message Retrieval':
  • Context - the system needs to process train manifest requests:
    For Call READQ to Access Message Queue:
    When a readq call is made to access the message queue, then the system attempts to read the next available message from the ims message queue.
  • Context - a readq operation has been performed on the message queue:
    For Message Available in Queue?:
    When the system checks the return code from the readq operation, then if return code is zero, a message is available; if return code is non-zero, no message is available.
  • Context - a message has been successfully retrieved from the queue:
    For Move Message to INPUT-MESSAGE Buffer:
    When the message needs to be prepared for processing, then the message content is moved to the input-message buffer.
  • Context - a message has been moved to the input-message buffer:
    For Get Message Length:
    When the system needs to know the message boundaries, then the message length is determined and stored for processing validation.
  • Context - a message has been successfully retrieved and prepared for processing:
    For Set Return Code to Continue Processing:
    When the system needs to indicate processing should continue, then the return code is set to zero to signal continuation of the message retrieval loop.
  • Context - no message is available in the queue:
    For Set Return Code to Stop Processing:
    When the system determines the queue is empty, then the return code is set to non-zero to signal termination of the message retrieval loop.
  • Context - a message has been successfully retrieved and prepared:
    For Proceed to Message Validation:
    When the return code indicates continuation of processing, then the system proceeds to the next phase of message validation and processing.
  • Context - the message queue is empty or no more messages are available:
    For End Message Retrieval Loop:
    When the return code indicates processing should stop, then the message retrieval loop is terminated and the system exits the input processing phase.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process train manifest requests
GIVEN
The system needs to process train manifest requests
Applied to: Call READQ to Access Message Queue
WHEN
A READQ call is made to access the message queue
THEN
The system attempts to read the next available message from the IMS message queue
Context: A READQ operation has been performed on the message queue
GIVEN
A READQ operation has been performed on the message queue
Applied to: Message Available in Queue?
WHEN
The system checks the return code from the READQ operation
THEN
If return code is zero, a message is available; if return code is non-zero, no message is available
Context: A message has been successfully retrieved from the queue
GIVEN
A message has been successfully retrieved from the queue
Applied to: Move Message to INPUT-MESSAGE Buffer
WHEN
The message needs to be prepared for processing
THEN
The message content is moved to the INPUT-MESSAGE buffer
Context: A message has been moved to the INPUT-MESSAGE buffer
GIVEN
A message has been moved to the INPUT-MESSAGE buffer
Applied to: Get Message Length
WHEN
The system needs to know the message boundaries
THEN
The message length is determined and stored for processing validation
Context: A message has been successfully retrieved and prepared for processing
GIVEN
A message has been successfully retrieved and prepared for processing
Applied to: Set Return Code to Continue Processing
WHEN
The system needs to indicate processing should continue
THEN
The return code is set to zero to signal continuation of the message retrieval loop
Context: No message is available in the queue
GIVEN
No message is available in the queue
Applied to: Set Return Code to Stop Processing
WHEN
The system determines the queue is empty
THEN
The return code is set to non-zero to signal termination of the message retrieval loop
Context: A message has been successfully retrieved and prepared
GIVEN
A message has been successfully retrieved and prepared
Applied to: Proceed to Message Validation
WHEN
The return code indicates continuation of processing
THEN
The system proceeds to the next phase of message validation and processing
Context: The message queue is empty or no more messages are available
GIVEN
The message queue is empty or no more messages are available
Applied to: End Message Retrieval Loop
WHEN
The return code indicates processing should stop
THEN
The message retrieval loop is terminated and the system exits the input processing phase
R-GCX146-cbl-00044 (+7) File: GCX146.cbl SCAC Access Validation Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'SCAC Access Validation':
  • Context - an input message is received for processing:
    For Extract User ID from Input Message:
    When the system begins scac access validation, then the user id is extracted from the input message for authorization checking.
  • Context - a customs train id is provided in the request:
    For Extract SCAC Code from Customs Train ID:
    When scac validation is performed, then the scac code is extracted from the customs train id for authorization verification.
  • Context - user id and scac code have been extracted:
    For Call GCCSCAC Module for Validation:
    When authorization validation is required, then the gccscac module is called to validate user access to the scac code.
  • Context - gccscac module has completed validation:
    For Check GCCSCAC-FLAG Result:
    When the validation result flag is checked, then the system determines whether scac access is valid based on the returned flag.
  • Context - scac validation has been performed:
    For Set Access Granted Flag:
    When the scac access is determined to be valid, then the access granted flag is set and processing continues.
  • Context - scac access validation has failed:
    For Is AEI Train Send Request?:
    When the system checks the request type, then if the request is not an aei train send, access is denied with error 36, otherwise processing continues.
    For Generate Error 36 - Access Denied:
    When the request is not an aei train send, then error 36 is generated indicating access denied due to invalid scac authorization.
  • Context - access denied error has been generated:
    For Set Rollback Flag:
    When transaction rollback is required, then the rollback flag is set to ensure no partial updates are committed.
👨‍💻 Technical ACs (Gherkin)
Context: An input message is received for processing
GIVEN
An input message is received for processing
Applied to: Extract User ID from Input Message
WHEN
The system begins SCAC access validation
THEN
The user ID is extracted from the input message for authorization checking
Context: A customs train ID is provided in the request
GIVEN
A customs train ID is provided in the request
Applied to: Extract SCAC Code from Customs Train ID
WHEN
SCAC validation is performed
THEN
The SCAC code is extracted from the customs train ID for authorization verification
Context: User ID and SCAC code have been extracted
GIVEN
User ID and SCAC code have been extracted
Applied to: Call GCCSCAC Module for Validation
WHEN
Authorization validation is required
THEN
The GCCSCAC module is called to validate user access to the SCAC code
Context: GCCSCAC module has completed validation
GIVEN
GCCSCAC module has completed validation
Applied to: Check GCCSCAC-FLAG Result
WHEN
The validation result flag is checked
THEN
The system determines whether SCAC access is valid based on the returned flag
Context: SCAC validation has been performed
GIVEN
SCAC validation has been performed
Applied to: Set Access Granted Flag
WHEN
The SCAC access is determined to be valid
THEN
The access granted flag is set and processing continues
Context: SCAC access validation has failed
GIVEN
SCAC access validation has failed
Applied to: Is AEI Train Send Request?
WHEN
The system checks the request type
THEN
If the request is NOT an AEI train send, access is denied with Error 36, otherwise processing continues
Applied to: Generate Error 36 - Access Denied
WHEN
The request is not an AEI train send
THEN
Error 36 is generated indicating access denied due to invalid SCAC authorization
Context: Access denied error has been generated
GIVEN
Access denied error has been generated
Applied to: Set Rollback Flag
WHEN
Transaction rollback is required
THEN
The rollback flag is set to ensure no partial updates are committed
R-GCX146-cbl-00052 (+7) File: GCX146.cbl Request Type Validation Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Request Type Validation':
  • Context - an input message is received for processing:
    For Request Type = ADD?:
    When the request type field equals 'add', then the system sets the aei-train-send flag and establishes add processing mode.
    For Set INVALID-INPUT-FLAG:
    When the request type is not add, verify, or notify, then the system sets the invalid-input-flag to indicate unsupported request type.
  • Context - an input message is received for processing and request type is not add:
    For Request Type = VERIFY?:
    When the request type field equals 'verify', then the system sets the aei-train-send flag and establishes verify processing mode.
  • Context - an input message is received for processing and request type is neither add nor verify:
    For Request Type = NOTIFY?:
    When the request type field equals 'notify', then the system sets the aei-train-send flag and establishes notify processing mode.
  • Context - the request type has been validated as add:
    For Set AEI-TRAIN-SEND Flag for ADD:
    When processing flags need to be established, then the system sets the aei-train-send flag to enable automatic equipment identification processing.
  • Context - the request type has been validated as verify:
    For Set AEI-TRAIN-SEND Flag for VERIFY:
    When processing flags need to be established, then the system sets the aei-train-send flag to enable automatic equipment identification processing.
  • Context - the request type has been validated as notify:
    For Set AEI-TRAIN-SEND Flag for NOTIFY:
    When processing flags need to be established, then the system sets the aei-train-send flag to enable automatic equipment identification processing.
  • Context - a valid request type (add, verify, or notify) has been identified and aei-train-send flag is set:
    For Set Processing Flags for Request Type:
    When the system needs to configure processing parameters, then the system sets all necessary processing flags to enable the appropriate business logic flow for the request type.
👨‍💻 Technical ACs (Gherkin)
Context: An input message is received for processing
GIVEN
An input message is received for processing
Applied to: Request Type = ADD?
WHEN
The request type field equals 'ADD'
THEN
The system sets the AEI-TRAIN-SEND flag and establishes ADD processing mode
Applied to: Set INVALID-INPUT-FLAG
WHEN
The request type is not ADD, VERIFY, or NOTIFY
THEN
The system sets the INVALID-INPUT-FLAG to indicate unsupported request type
Context: An input message is received for processing and request type is not ADD
GIVEN
An input message is received for processing and request type is not ADD
Applied to: Request Type = VERIFY?
WHEN
The request type field equals 'VERIFY'
THEN
The system sets the AEI-TRAIN-SEND flag and establishes VERIFY processing mode
Context: An input message is received for processing and request type is neither ADD nor VERIFY
GIVEN
An input message is received for processing and request type is neither ADD nor VERIFY
Applied to: Request Type = NOTIFY?
WHEN
The request type field equals 'NOTIFY'
THEN
The system sets the AEI-TRAIN-SEND flag and establishes NOTIFY processing mode
Context: The request type has been validated as ADD
GIVEN
The request type has been validated as ADD
Applied to: Set AEI-TRAIN-SEND Flag for ADD
WHEN
Processing flags need to be established
THEN
The system sets the AEI-TRAIN-SEND flag to enable automatic equipment identification processing
Context: The request type has been validated as VERIFY
GIVEN
The request type has been validated as VERIFY
Applied to: Set AEI-TRAIN-SEND Flag for VERIFY
WHEN
Processing flags need to be established
THEN
The system sets the AEI-TRAIN-SEND flag to enable automatic equipment identification processing
Context: The request type has been validated as NOTIFY
GIVEN
The request type has been validated as NOTIFY
Applied to: Set AEI-TRAIN-SEND Flag for NOTIFY
WHEN
Processing flags need to be established
THEN
The system sets the AEI-TRAIN-SEND flag to enable automatic equipment identification processing
Context: A valid request type (ADD, VERIFY, or NOTIFY) has been identified and AEI-TRAIN-SEND flag is set
GIVEN
A valid request type (ADD, VERIFY, or NOTIFY) has been identified and AEI-TRAIN-SEND flag is set
Applied to: Set Processing Flags for Request Type
WHEN
The system needs to configure processing parameters
THEN
The system sets all necessary processing flags to enable the appropriate business logic flow for the request type
R-GCX146-cbl-00060 (+6) File: GCX146.cbl Date and Time Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Date and Time Processing':
  • Context - the date and time processing routine is initiated:
    For Capture Current System Date and Time:
    When the system needs to establish current date and time, then the current system date and time are captured and stored for subsequent calculations.
  • Context - the current system date is available:
    For Calculate 30 Days Before Current Date:
    When a 30-day lookback date range is required for supervisor-level eta validation, then the system calculates and stores a date that is exactly 30 days before the current date.
    For Calculate 5 Days After Current Date:
    When a 5-day forward date range is required for supervisor-level eta validation, then the system calculates and stores a date that is exactly 5 days after the current date.
    For Calculate 2 Days Before Current Date:
    When a 2-day lookback date range is required for standard user eta validation, then the system calculates and stores a date that is exactly 2 days before the current date.
    For Calculate 2 Days After Current Date:
    When a 2-day forward date range is required for standard user eta validation, then the system calculates and stores a date that is exactly 2 days after the current date.
  • Context - a year value needs century determination for date processing:
    For Handle Century Format for Y2K Compliance:
    When the year value is greater than 70, then the century is set to 19xx (1900s), otherwise the century is set to 20xx (2000s).
  • Context - all date calculations (30-day lookback, 5-day forward, 2-day lookback, 2-day forward) are completed:
    For Store Calculated Date Ranges for ETA Validation:
    When the date ranges need to be preserved for eta validation, then all calculated date ranges are stored in working storage variables for use in eta validation routines.
👨‍💻 Technical ACs (Gherkin)
Context: The date and time processing routine is initiated
GIVEN
The date and time processing routine is initiated
Applied to: Capture Current System Date and Time
WHEN
The system needs to establish current date and time
THEN
The current system date and time are captured and stored for subsequent calculations
Context: The current system date is available
GIVEN
The current system date is available
Applied to: Calculate 30 Days Before Current Date
WHEN
A 30-day lookback date range is required for supervisor-level ETA validation
THEN
The system calculates and stores a date that is exactly 30 days before the current date
Applied to: Calculate 5 Days After Current Date
WHEN
A 5-day forward date range is required for supervisor-level ETA validation
THEN
The system calculates and stores a date that is exactly 5 days after the current date
Applied to: Calculate 2 Days Before Current Date
WHEN
A 2-day lookback date range is required for standard user ETA validation
THEN
The system calculates and stores a date that is exactly 2 days before the current date
Applied to: Calculate 2 Days After Current Date
WHEN
A 2-day forward date range is required for standard user ETA validation
THEN
The system calculates and stores a date that is exactly 2 days after the current date
Context: A year value needs century determination for date processing
GIVEN
A year value needs century determination for date processing
Applied to: Handle Century Format for Y2K Compliance
WHEN
The year value is greater than 70
THEN
The century is set to 19xx (1900s), otherwise the century is set to 20xx (2000s)
Context: All date calculations (30-day lookback, 5-day forward, 2-day lookback, 2-day forward) are completed
GIVEN
All date calculations (30-day lookback, 5-day forward, 2-day lookback, 2-day forward) are completed
Applied to: Store Calculated Date Ranges for ETA Validation
WHEN
The date ranges need to be preserved for ETA validation
THEN
All calculated date ranges are stored in working storage variables for use in ETA validation routines
R-GCX146-cbl-00067 (+7) File: GCX146.cbl ETA Date Range Validation Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ETA Date Range Validation':
  • Context - current date is available in the system:
    For Calculate Date Ranges Using DATECALC:
    When eta validation process is initiated, then standard date range of minus 2 days to plus 2 days from current date is calculated and extended date range of minus 30 days to plus 5 days from current date is calculated.
  • Context - user is authenticated and has a profile in gcstbrt-us-ctf-add:
    For Get User Type from GCSTBRT-US-CTF-ADD:
    When eta validation is performed, then user type is retrieved from the user profile for date range determination.
  • Context - user type has been retrieved from user profile:
    For User Type = 'S' Special User?:
    When user type equals 's' (special user), then extended date range of minus 30 days to plus 5 days is applied for eta validation.
    For User Type = 'S' Special User?:
    When user type is not equal to 's' (not special user), then standard date range of minus 2 days to plus 2 days is applied for eta validation.
  • Context - eta date is provided in the train request:
    For Validate ETA Date Using ISDATECV:
    When date format validation is performed using isdatecv, then eta date format is validated and confirmed as a legitimate calendar date.
  • Context - user is a special user (type 's') and eta date is provided:
    For ETA Date Within Allowed Range?:
    When eta date is compared against extended date range, then eta date is accepted if within minus 30 to plus 5 days range or error 25 is generated if outside this range.
  • Context - user is a standard user (not type 's') and eta date is provided:
    For ETA Date Within Allowed Range?:
    When eta date is compared against standard date range, then eta date is accepted if within minus 2 to plus 2 days range or error 35 is generated if outside this range.
  • Context - eta time is provided in the train request:
    For Validate Time Format HH:MM:
    When time format validation is performed, then time format is validated as hh:mm where hours are 00-23 and minutes are 00-59 or time format error is generated for invalid format.
👨‍💻 Technical ACs (Gherkin)
Context: Current date is available in the system
GIVEN
Current date is available in the system
Applied to: Calculate Date Ranges Using DATECALC
WHEN
ETA validation process is initiated
THEN
Standard date range of minus 2 days to plus 2 days from current date is calculated AND extended date range of minus 30 days to plus 5 days from current date is calculated
Context: User is authenticated and has a profile in GCSTBRT-US-CTF-ADD
GIVEN
User is authenticated and has a profile in GCSTBRT-US-CTF-ADD
Applied to: Get User Type from GCSTBRT-US-CTF-ADD
WHEN
ETA validation is performed
THEN
User type is retrieved from the user profile for date range determination
Context: User type has been retrieved from user profile
GIVEN
User type has been retrieved from user profile
Applied to: User Type = 'S' Special User?
WHEN
User type equals 'S' (Special User)
THEN
Extended date range of minus 30 days to plus 5 days is applied for ETA validation
Applied to: User Type = 'S' Special User?
WHEN
User type is not equal to 'S' (not Special User)
THEN
Standard date range of minus 2 days to plus 2 days is applied for ETA validation
Context: ETA date is provided in the train request
GIVEN
ETA date is provided in the train request
Applied to: Validate ETA Date Using ISDATECV
WHEN
Date format validation is performed using ISDATECV
THEN
ETA date format is validated and confirmed as a legitimate calendar date
Context: User is a special user (type 'S') AND ETA date is provided
GIVEN
User is a special user (type 'S') AND ETA date is provided
Applied to: ETA Date Within Allowed Range?
WHEN
ETA date is compared against extended date range
THEN
ETA date is accepted if within minus 30 to plus 5 days range OR error 25 is generated if outside this range
Context: User is a standard user (not type 'S') AND ETA date is provided
GIVEN
User is a standard user (not type 'S') AND ETA date is provided
Applied to: ETA Date Within Allowed Range?
WHEN
ETA date is compared against standard date range
THEN
ETA date is accepted if within minus 2 to plus 2 days range OR error 35 is generated if outside this range
Context: ETA time is provided in the train request
GIVEN
ETA time is provided in the train request
Applied to: Validate Time Format HH:MM
WHEN
Time format validation is performed
THEN
Time format is validated as HH:MM where hours are 00-23 and minutes are 00-59 OR time format error is generated for invalid format
R-GCX146-cbl-00075 (+10) File: GCX146.cbl Merlin ID Management Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin ID Management':
  • Context - the admin table segment is available in gcstbrt database:
    For Extract PUBLIC Merlin ID & Extract DC-P Merlin ID:
    When the system processes merlin id extraction, then the public merlin id is extracted from the admin table and stored for validation and the dc-p merlin id is extracted from the admin table and stored for validation.
  • Context - the terminal table segment is available in gcstbrt database:
    For Extract SUPERVISOR Merlin ID & Extract ALTERNATE Merlin ID:
    When the system processes merlin id extraction, then the supervisor merlin id is extracted from the terminal table and stored for validation and the alternate merlin id is extracted from the terminal table and stored for validation.
  • Context - a public merlin id has been extracted from the admin table:
    For PUBLIC ID Valid?:
    When the system validates the public merlin id against the emtz database, then if the public merlin id exists in emtz database, validation passes, otherwise validation fails with error 4.
  • Context - a supervisor merlin id has been extracted from the terminal table and the public merlin id validation has passed:
    For SUPERVISOR ID Valid?:
    When the system validates the supervisor merlin id against the emtz database, then if the supervisor merlin id exists in emtz database, validation passes, otherwise validation fails with error 5.
  • Context - the customs merlin id needs validation and the supervisor merlin id validation has passed:
    For CUSTOMS ID Valid?:
    When the system validates the customs merlin id against the emtz database, then if the customs merlin id exists in emtz database, validation passes, otherwise validation fails with error 6.
  • Context - a dc-p merlin id has been extracted from the admin table and the customs merlin id validation has passed:
    For DC-P ID Valid?:
    When the system validates the dc-p merlin id against the emtz database, then if the dc-p merlin id exists in emtz database, validation passes, otherwise validation fails with error 7.
  • Context - the system-fax merlin id needs validation and the dc-p merlin id validation has passed:
    For SYSTEM-FAX ID Valid?:
    When the system validates the system-fax merlin id against the emtz database, then if the system-fax merlin id exists in emtz database, validation passes, otherwise validation fails with error 8.
  • Context - all five merlin ids (public, supervisor, customs, dc-p, system-fax) have been extracted from their respective tables:
    For All Merlin IDs Successfully Validated:
    When all merlin id validations against the emtz database have been completed successfully, then the system proceeds with customs reporting operations using the validated communication channels.
  • Context - one or more merlin ids are being validated against the emtz database:
    For Merlin ID Validation Failed:
    When any merlin id validation fails (public, supervisor, customs, dc-p, or system-fax), then the system stops the validation process and reports the specific validation error without proceeding to customs reporting operations.
👨‍💻 Technical ACs (Gherkin)
Context: The admin table segment is available in GCSTBRT database
GIVEN
The admin table segment is available in GCSTBRT database
Applied to: Extract PUBLIC Merlin ID & Extract DC-P Merlin ID
WHEN
The system processes Merlin ID extraction
THEN
The PUBLIC Merlin ID is extracted from the admin table and stored for validation AND The DC-P Merlin ID is extracted from the admin table and stored for validation
Context: The terminal table segment is available in GCSTBRT database
GIVEN
The terminal table segment is available in GCSTBRT database
Applied to: Extract SUPERVISOR Merlin ID & Extract ALTERNATE Merlin ID
WHEN
The system processes Merlin ID extraction
THEN
The SUPERVISOR Merlin ID is extracted from the terminal table and stored for validation AND The ALTERNATE Merlin ID is extracted from the terminal table and stored for validation
Context: A PUBLIC Merlin ID has been extracted from the admin table
GIVEN
A PUBLIC Merlin ID has been extracted from the admin table
Applied to: PUBLIC ID Valid?
WHEN
The system validates the PUBLIC Merlin ID against the EMTZ database
THEN
If the PUBLIC Merlin ID exists in EMTZ database, validation passes, otherwise validation fails with error 4
Context: A SUPERVISOR Merlin ID has been extracted from the terminal table AND the PUBLIC Merlin ID validation has passed
GIVEN
A SUPERVISOR Merlin ID has been extracted from the terminal table AND the PUBLIC Merlin ID validation has passed
Applied to: SUPERVISOR ID Valid?
WHEN
The system validates the SUPERVISOR Merlin ID against the EMTZ database
THEN
If the SUPERVISOR Merlin ID exists in EMTZ database, validation passes, otherwise validation fails with error 5
Context: The CUSTOMS Merlin ID needs validation AND the SUPERVISOR Merlin ID validation has passed
GIVEN
The CUSTOMS Merlin ID needs validation AND the SUPERVISOR Merlin ID validation has passed
Applied to: CUSTOMS ID Valid?
WHEN
The system validates the CUSTOMS Merlin ID against the EMTZ database
THEN
If the CUSTOMS Merlin ID exists in EMTZ database, validation passes, otherwise validation fails with error 6
Context: A DC-P Merlin ID has been extracted from the admin table AND the CUSTOMS Merlin ID validation has passed
GIVEN
A DC-P Merlin ID has been extracted from the admin table AND the CUSTOMS Merlin ID validation has passed
Applied to: DC-P ID Valid?
WHEN
The system validates the DC-P Merlin ID against the EMTZ database
THEN
If the DC-P Merlin ID exists in EMTZ database, validation passes, otherwise validation fails with error 7
Context: The SYSTEM-FAX Merlin ID needs validation AND the DC-P Merlin ID validation has passed
GIVEN
The SYSTEM-FAX Merlin ID needs validation AND the DC-P Merlin ID validation has passed
Applied to: SYSTEM-FAX ID Valid?
WHEN
The system validates the SYSTEM-FAX Merlin ID against the EMTZ database
THEN
If the SYSTEM-FAX Merlin ID exists in EMTZ database, validation passes, otherwise validation fails with error 8
Context: All five Merlin IDs (PUBLIC, SUPERVISOR, CUSTOMS, DC-P, SYSTEM-FAX) have been extracted from their respective tables
GIVEN
All five Merlin IDs (PUBLIC, SUPERVISOR, CUSTOMS, DC-P, SYSTEM-FAX) have been extracted from their respective tables
Applied to: All Merlin IDs Successfully Validated
WHEN
All Merlin ID validations against the EMTZ database have been completed successfully
THEN
The system proceeds with customs reporting operations using the validated communication channels
Context: One or more Merlin IDs are being validated against the EMTZ database
GIVEN
One or more Merlin IDs are being validated against the EMTZ database
Applied to: Merlin ID Validation Failed
WHEN
Any Merlin ID validation fails (PUBLIC, SUPERVISOR, CUSTOMS, DC-P, or SYSTEM-FAX)
THEN
The system stops the validation process and reports the specific validation error without proceeding to customs reporting operations
R-GCX146-cbl-00086 (+10) File: GCX146.cbl Train ID Construction Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train ID Construction':
  • Context - an input message containing train identification data:
    For Extract Train Number from Input & Extract Train Day from Input & Extract From Station Code & Extract To Station Code & Extract Consist Number:
    When the system processes the train id construction request, then the train number component is extracted from the input message and stored for further processing and the train day component is extracted from the input message and stored for further processing and the from station code is extracted from the input message and stored for further processing and the to station code is extracted from the input message and stored for further processing and the consist number is extracted from the input message and stored for further processing.
  • Context - a train id construction request is being processed:
    For Get System Date:
    When the system needs to build the customs train id, then the current system date is retrieved and stored for inclusion in the train id.
  • Context - train id components have been extracted from the input message:
    For Replace Spaces with Zeros in All Components:
    When any component contains spaces, then all spaces in train number, day, from station, to station, and consist number are replaced with zeros.
  • Context - all train id components have been extracted and spaces replaced with zeros:
    For Construct WS-CUSTOMS-TRAIN-ID:
    When the system constructs the customs train id, then the customs train id is built by concatenating train number, day, from station, to station, consist number, and system date.
  • Context - the customs train id has been constructed:
    For Build GCWB4TL-CP-TRAIN-ID:
    When the system needs to create the cp train id, then the gcwb4tl-cp-train-id is built using the standardized customs train id format.
  • Context - the customs train id and cp train id have been constructed:
    For Validate Train ID Format:
    When the system validates the train id format, then the train id format is checked against business requirements and validation rules.
  • Context - the train id has been constructed and validated successfully:
    For Set Train ID for Processing:
    When the train id format validation passes, then the train id is set as valid and ready for use in downstream processing.
👨‍💻 Technical ACs (Gherkin)
Context: An input message containing train identification data
GIVEN
An input message containing train identification data
Applied to: Extract Train Number from Input & Extract Train Day from Input & Extract From Station Code & Extract To Station Code & Extract Consist Number
WHEN
The system processes the train ID construction request
THEN
The train number component is extracted from the input message and stored for further processing AND The train day component is extracted from the input message and stored for further processing AND The from station code is extracted from the input message and stored for further processing AND The to station code is extracted from the input message and stored for further processing AND The consist number is extracted from the input message and stored for further processing
Context: A train ID construction request is being processed
GIVEN
A train ID construction request is being processed
Applied to: Get System Date
WHEN
The system needs to build the customs train ID
THEN
The current system date is retrieved and stored for inclusion in the train ID
Context: Train ID components have been extracted from the input message
GIVEN
Train ID components have been extracted from the input message
Applied to: Replace Spaces with Zeros in All Components
WHEN
Any component contains spaces
THEN
All spaces in train number, day, from station, to station, and consist number are replaced with zeros
Context: All train ID components have been extracted and spaces replaced with zeros
GIVEN
All train ID components have been extracted and spaces replaced with zeros
Applied to: Construct WS-CUSTOMS-TRAIN-ID
WHEN
The system constructs the customs train ID
THEN
The customs train ID is built by concatenating train number, day, from station, to station, consist number, and system date
Context: The customs train ID has been constructed
GIVEN
The customs train ID has been constructed
Applied to: Build GCWB4TL-CP-TRAIN-ID
WHEN
The system needs to create the CP train ID
THEN
The GCWB4TL-CP-TRAIN-ID is built using the standardized customs train ID format
Context: The customs train ID and CP train ID have been constructed
GIVEN
The customs train ID and CP train ID have been constructed
Applied to: Validate Train ID Format
WHEN
The system validates the train ID format
THEN
The train ID format is checked against business requirements and validation rules
Context: The train ID has been constructed and validated successfully
GIVEN
The train ID has been constructed and validated successfully
Applied to: Set Train ID for Processing
WHEN
The train ID format validation passes
THEN
The train ID is set as valid and ready for use in downstream processing
R-GCX146-cbl-00097 (+4) File: GCX146.cbl Station Information Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Information Validation':
  • Context - a from-station code has been extracted from the input message:
    For Search Station Configuration Table:
    When the system searches the station configuration table for the station code, then the system retrieves the corresponding station data if found, or proceeds to validation checks if not found.
  • Context - a station has been found in the station configuration table:
    For Station Code = '0000'?:
    When the station code equals '0000', then the system sets a station validation error indicating invalid canadian station code.
  • Context - a station code was not found in the station configuration table:
    For Request Type = VERIFY?:
    When the request type is verify, then the system continues processing despite the missing station information.
    For Set Station Validation Error:
    When the request type is not verify, then the system sets a station validation error and fails the validation process.
  • Context - a valid station has been found and station code is not '0000':
    For Auto-FAX Enabled?:
    When the system checks the auto-fax configuration for the station, then if auto-fax is enabled, the system validates fax settings; otherwise, station validation is successful.
👨‍💻 Technical ACs (Gherkin)
Context: A from-station code has been extracted from the input message
GIVEN
A from-station code has been extracted from the input message
Applied to: Search Station Configuration Table
WHEN
The system searches the station configuration table for the station code
THEN
The system retrieves the corresponding station data if found, or proceeds to validation checks if not found
Context: A station has been found in the station configuration table
GIVEN
A station has been found in the station configuration table
Applied to: Station Code = '0000'?
WHEN
The station code equals '0000'
THEN
The system sets a station validation error indicating invalid Canadian station code
Context: A station code was not found in the station configuration table
GIVEN
A station code was not found in the station configuration table
Applied to: Request Type = VERIFY?
WHEN
The request type is VERIFY
THEN
The system continues processing despite the missing station information
Applied to: Set Station Validation Error
WHEN
The request type is not VERIFY
THEN
The system sets a station validation error and fails the validation process
Context: A valid station has been found and station code is not '0000'
GIVEN
A valid station has been found and station code is not '0000'
Applied to: Auto-FAX Enabled?
WHEN
The system checks the auto-FAX configuration for the station
THEN
If auto-FAX is enabled, the system validates FAX settings; otherwise, station validation is successful
R-GCX146-cbl-00102 (+10) File: GCX146.cbl Train Record Management Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Record Management':
  • Context - a train id is provided for processing:
    For Check for Existing Train Records:
    When the system checks the train records database, then the system determines whether a train record exists for the given train id.
  • Context - a train record exists in the database:
    For Retrieve Existing Train Record:
    When the system accesses the train record, then the complete train record details are retrieved including status and equipment information.
  • Context - an existing train record is retrieved:
    For Validate Record Status:
    When the system examines the record status, then the system determines if the record is active, deleted, or in another status state.
  • Context - a train record exists with a status indicator:
    For Record Marked as Deleted?:
    When the system checks the deletion status flag, then the system identifies whether the record is marked as deleted or active.
  • Context - a train record is marked as deleted:
    For Delete Existing Train Record:
    When the system processes the deletion request, then the train record is permanently removed from the database.
  • Context - a deletion operation has been attempted on a train record:
    For Deletion Successful?:
    When the system checks the deletion result, then the system confirms whether the deletion was successful or failed.
  • Context - no existing train record exists or an existing record has been successfully deleted:
    For Create New Train Record:
    When the system creates a new train record, then a new train record is inserted with status 'sent' and all required train information.
  • Context - a new train record has been created:
    For Insert Equipment Details:
    When the system processes equipment details for the train, then all equipment information is inserted and associated with the train record.
  • Context - equipment details insertion has been attempted:
    For Insert Successful?:
    When the system checks the insertion result, then the system confirms whether the equipment insertion was successful or failed.
  • Context - a database operation has failed during train record processing:
    For Handle Database Error:
    When the system encounters the database error, then the system initiates error handling procedures to manage the failure.
  • Context - a critical database error has occurred that cannot be recovered:
    For Log Error and Abort:
    When the system processes the error condition, then the error is logged and processing is aborted to prevent data corruption.
👨‍💻 Technical ACs (Gherkin)
Context: A train ID is provided for processing
GIVEN
A train ID is provided for processing
Applied to: Check for Existing Train Records
WHEN
The system checks the train records database
THEN
The system determines whether a train record exists for the given train ID
Context: A train record exists in the database
GIVEN
A train record exists in the database
Applied to: Retrieve Existing Train Record
WHEN
The system accesses the train record
THEN
The complete train record details are retrieved including status and equipment information
Context: An existing train record is retrieved
GIVEN
An existing train record is retrieved
Applied to: Validate Record Status
WHEN
The system examines the record status
THEN
The system determines if the record is active, deleted, or in another status state
Context: A train record exists with a status indicator
GIVEN
A train record exists with a status indicator
Applied to: Record Marked as Deleted?
WHEN
The system checks the deletion status flag
THEN
The system identifies whether the record is marked as deleted or active
Context: A train record is marked as deleted
GIVEN
A train record is marked as deleted
Applied to: Delete Existing Train Record
WHEN
The system processes the deletion request
THEN
The train record is permanently removed from the database
Context: A deletion operation has been attempted on a train record
GIVEN
A deletion operation has been attempted on a train record
Applied to: Deletion Successful?
WHEN
The system checks the deletion result
THEN
The system confirms whether the deletion was successful or failed
Context: No existing train record exists or an existing record has been successfully deleted
GIVEN
No existing train record exists or an existing record has been successfully deleted
Applied to: Create New Train Record
WHEN
The system creates a new train record
THEN
A new train record is inserted with status 'SENT' and all required train information
Context: A new train record has been created
GIVEN
A new train record has been created
Applied to: Insert Equipment Details
WHEN
The system processes equipment details for the train
THEN
All equipment information is inserted and associated with the train record
Context: Equipment details insertion has been attempted
GIVEN
Equipment details insertion has been attempted
Applied to: Insert Successful?
WHEN
The system checks the insertion result
THEN
The system confirms whether the equipment insertion was successful or failed
Context: A database operation has failed during train record processing
GIVEN
A database operation has failed during train record processing
Applied to: Handle Database Error
WHEN
The system encounters the database error
THEN
The system initiates error handling procedures to manage the failure
Context: A critical database error has occurred that cannot be recovered
GIVEN
A critical database error has occurred that cannot be recovered
Applied to: Log Error and Abort
WHEN
The system processes the error condition
THEN
The error is logged and processing is aborted to prevent data corruption
R-GCX146-cbl-00113 (+14) File: GCX146.cbl Equipment Data Extraction Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Data Extraction':
  • Context - consist data contains equipment information with car id and position details:
    For Extract Equipment ID from Consist Data:
    When processing equipment data from consist input, then equipment id is extracted and stored for further processing.
  • Context - raw equipment id from consist data:
    For Format Equipment Car ID:
    When equipment id needs to be formatted for system use, then equipment id is formatted using gcccarfm utility to 12-character standard format.
  • Context - equipment data with type indicators and characteristics:
    For Determine Equipment Type:
    When equipment type needs to be determined, then equipment is classified as unit (l,p,d,u), van (v), sbu (s), etu (e), or regular car based on type code.
  • Context - equipment identified as container type on flat car:
    For Container Equipment:
    When processing container equipment, then container cross-reference data is processed through fwiq inquiry and container ids are extracted from waybill bottom lines.
  • Context - equipment identified as trailer type:
    For Trailer Equipment:
    When processing trailer equipment, then trailer is processed with standard equipment handling procedures.
  • Context - equipment identified as standard rail car:
    For Rail Car Equipment:
    When processing rail car equipment, then rail car is processed through standard equipment handling workflow.
  • Context - consist input data contains load/empty status indicator:
    For Extract Load/Empty Status from Input:
    When processing equipment status information, then load/empty status is extracted and stored as 'l' for loaded or 'e' for empty.
  • Context - equipment has load/empty status from input and waybill data is available:
    For Validate Load/Empty Status Against Waybill:
    When validating status consistency, then status is verified against waybill data and inconsistencies are flagged for loaded cars marked as empty.
  • Context - equipment status validation confirms loaded condition:
    For Set Load Status Flag:
    When status is consistent between input and waybill, then load status flag is set to indicate loaded equipment.
  • Context - equipment status validation confirms empty condition or detects loaded car marked as empty:
    For Set Empty Status Flag:
    When status inconsistency is detected or equipment is confirmed empty, then empty status flag is set to indicate empty equipment.
  • Context - equipment has been classified and status determined:
    For Process Equipment Segment:
    When processing equipment segment for train consist, then equipment segment data is processed including waybill lookup, ccn validation, and status determination.
  • Context - equipment data has been extracted, formatted, classified, and validated:
    For Build Equipment Record:
    When building final equipment record, then complete equipment record is constructed with id, type, status, waybill information, and validation results.
  • Context - complete equipment record has been built:
    For Add to Equipment List:
    When adding equipment to train consist list, then equipment record is added to the equipment list and equipment counter is incremented.
  • Context - current equipment has been processed and added to equipment list:
    For More Equipment in Consist?:
    When checking for additional equipment in consist, then if more equipment exists in consist, processing continues with next equipment item, otherwise equipment extraction is completed.
  • Context - all equipment in consist has been processed and added to equipment list:
    For Equipment Extraction Complete:
    When no more equipment remains in consist, then equipment extraction process is completed and control returns to main processing flow.
👨‍💻 Technical ACs (Gherkin)
Context: Consist data contains equipment information with car ID and position details
GIVEN
Consist data contains equipment information with car ID and position details
Applied to: Extract Equipment ID from Consist Data
WHEN
Processing equipment data from consist input
THEN
Equipment ID is extracted and stored for further processing
Context: Raw equipment ID from consist data
GIVEN
Raw equipment ID from consist data
Applied to: Format Equipment Car ID
WHEN
Equipment ID needs to be formatted for system use
THEN
Equipment ID is formatted using GCCCARFM utility to 12-character standard format
Context: Equipment data with type indicators and characteristics
GIVEN
Equipment data with type indicators and characteristics
Applied to: Determine Equipment Type
WHEN
Equipment type needs to be determined
THEN
Equipment is classified as Unit (L,P,D,U), Van (V), SBU (S), ETU (E), or regular car based on type code
Context: Equipment identified as container type on flat car
GIVEN
Equipment identified as container type on flat car
Applied to: Container Equipment
WHEN
Processing container equipment
THEN
Container cross-reference data is processed through FWIQ inquiry and container IDs are extracted from waybill bottom lines
Context: Equipment identified as trailer type
GIVEN
Equipment identified as trailer type
Applied to: Trailer Equipment
WHEN
Processing trailer equipment
THEN
Trailer is processed with standard equipment handling procedures
Context: Equipment identified as standard rail car
GIVEN
Equipment identified as standard rail car
Applied to: Rail Car Equipment
WHEN
Processing rail car equipment
THEN
Rail car is processed through standard equipment handling workflow
Context: Consist input data contains load/empty status indicator
GIVEN
Consist input data contains load/empty status indicator
Applied to: Extract Load/Empty Status from Input
WHEN
Processing equipment status information
THEN
Load/empty status is extracted and stored as 'L' for loaded or 'E' for empty
Context: Equipment has load/empty status from input and waybill data is available
GIVEN
Equipment has load/empty status from input and waybill data is available
Applied to: Validate Load/Empty Status Against Waybill
WHEN
Validating status consistency
THEN
Status is verified against waybill data and inconsistencies are flagged for loaded cars marked as empty
Context: Equipment status validation confirms loaded condition
GIVEN
Equipment status validation confirms loaded condition
Applied to: Set Load Status Flag
WHEN
Status is consistent between input and waybill
THEN
Load status flag is set to indicate loaded equipment
Context: Equipment status validation confirms empty condition or detects loaded car marked as empty
GIVEN
Equipment status validation confirms empty condition or detects loaded car marked as empty
Applied to: Set Empty Status Flag
WHEN
Status inconsistency is detected or equipment is confirmed empty
THEN
Empty status flag is set to indicate empty equipment
Context: Equipment has been classified and status determined
GIVEN
Equipment has been classified and status determined
Applied to: Process Equipment Segment
WHEN
Processing equipment segment for train consist
THEN
Equipment segment data is processed including waybill lookup, CCN validation, and status determination
Context: Equipment data has been extracted, formatted, classified, and validated
GIVEN
Equipment data has been extracted, formatted, classified, and validated
Applied to: Build Equipment Record
WHEN
Building final equipment record
THEN
Complete equipment record is constructed with ID, type, status, waybill information, and validation results
Context: Complete equipment record has been built
GIVEN
Complete equipment record has been built
Applied to: Add to Equipment List
WHEN
Adding equipment to train consist list
THEN
Equipment record is added to the equipment list and equipment counter is incremented
Context: Current equipment has been processed and added to equipment list
GIVEN
Current equipment has been processed and added to equipment list
Applied to: More Equipment in Consist?
WHEN
Checking for additional equipment in consist
THEN
If more equipment exists in consist, processing continues with next equipment item, otherwise equipment extraction is completed
Context: All equipment in consist has been processed and added to equipment list
GIVEN
All equipment in consist has been processed and added to equipment list
Applied to: Equipment Extraction Complete
WHEN
No more equipment remains in consist
THEN
Equipment extraction process is completed and control returns to main processing flow
R-GCX146-cbl-00128 (+6) File: GCX146.cbl Waybill Lookup Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Waybill Lookup Processing':
  • Context - an equipment id is provided for waybill lookup:
    For Z003-GU-FWIIROOT: Primary Waybill Lookup:
    When the system searches the primary waybill database (fwiiroot) using the equipment id, then the system retrieves waybill data if found or proceeds to enhanced search if not found.
  • Context - primary waybill lookup has failed to find waybill data:
    For Z420-GU-SHIPROOT-CAR: Enhanced Waybill Search:
    When the system searches the enhanced waybill database (shiproot) using fwcarget with multiple search criteria, then the system retrieves waybill information if available or proceeds to inquiry database search.
  • Context - both primary and enhanced waybill searches have failed:
    For Z450-GU-SHIPROOT-INQ: Inquiry Database Access:
    When the system accesses the inquiry database (fw-iq) for waybill information, then the system searches for waybill data in the inquiry database or marks waybill as not found.
  • Context - waybill data has been found in any of the searched databases:
    For Set WS-WAYBILL-FOUND Flag:
    When the system processes the successful waybill lookup result, then the system sets the waybill found flag to indicate successful retrieval.
  • Context - all waybill database searches (primary, enhanced, and inquiry) have been exhausted:
    For Set WS-WAYBILL-NOT-FOUND Flag:
    When no waybill data is found for the equipment id in any database, then the system sets the waybill not found flag to indicate unsuccessful retrieval.
  • Context - waybill data has been successfully located in one of the databases:
    For Extract Waybill Information:
    When the system processes the retrieved waybill record, then the system extracts relevant waybill information and prepares it for downstream processing.
  • Context - equipment id requires waybill lookup:
    For Search FWIIROOT using Equipment ID:
    When the system initiates waybill search process, then the system searches databases in sequence: primary (fwiiroot), then enhanced (shiproot), then inquiry (fw-iq) until waybill is found or all options exhausted.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID is provided for waybill lookup
GIVEN
An equipment ID is provided for waybill lookup
Applied to: Z003-GU-FWIIROOT: Primary Waybill Lookup
WHEN
The system searches the primary waybill database (FWIIROOT) using the equipment ID
THEN
The system retrieves waybill data if found or proceeds to enhanced search if not found
Context: Primary waybill lookup has failed to find waybill data
GIVEN
Primary waybill lookup has failed to find waybill data
Applied to: Z420-GU-SHIPROOT-CAR: Enhanced Waybill Search
WHEN
The system searches the enhanced waybill database (SHIPROOT) using FWCARGET with multiple search criteria
THEN
The system retrieves waybill information if available or proceeds to inquiry database search
Context: Both primary and enhanced waybill searches have failed
GIVEN
Both primary and enhanced waybill searches have failed
Applied to: Z450-GU-SHIPROOT-INQ: Inquiry Database Access
WHEN
The system accesses the inquiry database (FW-IQ) for waybill information
THEN
The system searches for waybill data in the inquiry database or marks waybill as not found
Context: Waybill data has been found in any of the searched databases
GIVEN
Waybill data has been found in any of the searched databases
Applied to: Set WS-WAYBILL-FOUND Flag
WHEN
The system processes the successful waybill lookup result
THEN
The system sets the waybill found flag to indicate successful retrieval
Context: All waybill database searches (primary, enhanced, and inquiry) have been exhausted
GIVEN
All waybill database searches (primary, enhanced, and inquiry) have been exhausted
Applied to: Set WS-WAYBILL-NOT-FOUND Flag
WHEN
No waybill data is found for the equipment ID in any database
THEN
The system sets the waybill not found flag to indicate unsuccessful retrieval
Context: Waybill data has been successfully located in one of the databases
GIVEN
Waybill data has been successfully located in one of the databases
Applied to: Extract Waybill Information
WHEN
The system processes the retrieved waybill record
THEN
The system extracts relevant waybill information and prepares it for downstream processing
Context: Equipment ID requires waybill lookup
GIVEN
Equipment ID requires waybill lookup
Applied to: Search FWIIROOT using Equipment ID
WHEN
The system initiates waybill search process
THEN
The system searches databases in sequence: primary (FWIIROOT), then enhanced (SHIPROOT), then inquiry (FW-IQ) until waybill is found or all options exhausted
R-GCX146-cbl-00135 (+8) File: GCX146.cbl Equipment Type Classification Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Type Classification':
  • Context - equipment data with equipment id and type code is available:
    For Call GCCCARTP Module for Type Classification:
    When equipment type classification is required, then gcccartp module is called to classify equipment type and return classification results.
  • Context - equipment has been classified as container type:
    For Container Type Processing:
    When container type processing is initiated, then container-specific processing flags are set and container handling requirements are established.
  • Context - equipment has been classified as trailer type:
    For Trailer Type Processing:
    When trailer type processing is initiated, then trailer-specific processing flags are set and trailer handling requirements are established.
  • Context - equipment has been classified as car type:
    For Car Type Processing:
    When car type processing is initiated, then car-specific processing flags are set and car handling requirements are established.
  • Context - equipment is classified as container type:
    For Check for Multiple Containers on Flat Car:
    When system checks for multiple containers on the same flat car, then if multiple containers are detected, ws-flat-car flag is set to indicate special flat car processing requirements.
  • Context - equipment is classified as car type with a car type code:
    For Validate Car Type Code:
    When car type code validation is performed, then system verifies the car type code is valid and exists in the reference data.
  • Context - valid car type code has been confirmed:
    For Get Car Type Description from VI Segment:
    When car type description is needed for processing or reporting, then system retrieves car type description from vi segment using the car type code.
  • Context - equipment type has been classified and processing requirements determined:
    For Assign Type Code for Train Manifest:
    When train manifest requires equipment type code, then system assigns the appropriate equipment type code based on the equipment classification for manifest reporting.
  • Context - equipment type code has been assigned for train manifest:
    For Set Load/Empty Processing Requirements:
    When load/empty status processing requirements need to be established, then system sets appropriate processing requirements based on whether the equipment is loaded or empty.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment data with equipment ID and type code is available
GIVEN
Equipment data with equipment ID and type code is available
Applied to: Call GCCCARTP Module for Type Classification
WHEN
Equipment type classification is required
THEN
GCCCARTP module is called to classify equipment type and return classification results
Context: Equipment has been classified as container type
GIVEN
Equipment has been classified as container type
Applied to: Container Type Processing
WHEN
Container type processing is initiated
THEN
Container-specific processing flags are set and container handling requirements are established
Context: Equipment has been classified as trailer type
GIVEN
Equipment has been classified as trailer type
Applied to: Trailer Type Processing
WHEN
Trailer type processing is initiated
THEN
Trailer-specific processing flags are set and trailer handling requirements are established
Context: Equipment has been classified as car type
GIVEN
Equipment has been classified as car type
Applied to: Car Type Processing
WHEN
Car type processing is initiated
THEN
Car-specific processing flags are set and car handling requirements are established
Context: Equipment is classified as container type
GIVEN
Equipment is classified as container type
Applied to: Check for Multiple Containers on Flat Car
WHEN
System checks for multiple containers on the same flat car
THEN
If multiple containers are detected, WS-FLAT-CAR flag is set to indicate special flat car processing requirements
Context: Equipment is classified as car type with a car type code
GIVEN
Equipment is classified as car type with a car type code
Applied to: Validate Car Type Code
WHEN
Car type code validation is performed
THEN
System verifies the car type code is valid and exists in the reference data
Context: Valid car type code has been confirmed
GIVEN
Valid car type code has been confirmed
Applied to: Get Car Type Description from VI Segment
WHEN
Car type description is needed for processing or reporting
THEN
System retrieves car type description from VI segment using the car type code
Context: Equipment type has been classified and processing requirements determined
GIVEN
Equipment type has been classified and processing requirements determined
Applied to: Assign Type Code for Train Manifest
WHEN
Train manifest requires equipment type code
THEN
System assigns the appropriate equipment type code based on the equipment classification for manifest reporting
Context: Equipment type code has been assigned for train manifest
GIVEN
Equipment type code has been assigned for train manifest
Applied to: Set Load/Empty Processing Requirements
WHEN
Load/empty status processing requirements need to be established
THEN
System sets appropriate processing requirements based on whether the equipment is loaded or empty
R-GCX146-cbl-00144 (+18) File: GCX146.cbl Load/Empty Status Processing Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Load/Empty Status Processing':
  • Context - an equipment record requires load/empty status determination:
    For Retrieve Equipment Waybill Data:
    When the system processes the equipment for waybill data retrieval, then the system attempts to locate waybill information using the equipment identifier and sets waybill availability flag accordingly.
  • Context - equipment waybill data retrieval has been attempted:
    For Waybill Data Available?:
    When the system checks if waybill data is available for the equipment, then if waybill data exists, proceed with cargo analysis; if no waybill data exists, use default empty status processing.
  • Context - waybill data is available for equipment:
    For Analyze Cargo Origin Information:
    When the system processes cargo origin information from the waybill, then the system extracts and analyzes origin station, shipper information, and cargo classification data for load status determination.
  • Context - cargo origin information has been analyzed:
    For Analyze Cargo Destination Information:
    When the system processes cargo destination information from the waybill, then the system extracts and analyzes destination station, consignee information, and delivery requirements for load status determination.
  • Context - cargo origin and destination information has been analyzed:
    For Check Equipment Type Classification:
    When the system checks the equipment type classification, then the system categorizes equipment as container, trailer, or rail car type for specific processing rules.
  • Context - equipment type classification check has been performed:
    For Container Equipment?:
    When the system evaluates if equipment is container type, then if equipment is container type, proceed with container-specific load status determination; otherwise check for trailer type.
  • Context - equipment is not container type:
    For Trailer Equipment?:
    When the system evaluates if equipment is trailer type, then if equipment is trailer type, proceed with trailer-specific load status determination; otherwise treat as rail car equipment.
  • Context - equipment is not container or trailer type:
    For Rail Car Equipment?:
    When the system evaluates if equipment is rail car type, then if equipment is rail car type, proceed with rail car-specific load status determination.
  • Context - equipment is identified as container type with available waybill data:
    For Determine Container Load Status:
    When the system processes container-specific load status determination, then the system analyzes container cargo content, weight information, and commodity details to determine if container is loaded or empty.
  • Context - equipment is identified as trailer type with available waybill data:
    For Determine Trailer Load Status:
    When the system processes trailer-specific load status determination, then the system analyzes trailer cargo content, weight information, and commodity details to determine if trailer is loaded or empty.
  • Context - equipment is identified as rail car type with available waybill data:
    For Determine Rail Car Load Status:
    When the system processes rail car-specific load status determination, then the system analyzes rail car cargo content, weight information, and commodity details to determine if rail car is loaded or empty.
  • Context - load/empty status has been determined for the equipment:
    For Validate Against Input Specifications:
    When the system validates the determined status against input specifications, then the system compares the calculated load/empty status with the input-provided status for consistency verification.
  • Context - load/empty status validation has been performed:
    For Status Matches Input?:
    When the system checks if determined status matches input specifications, then if status matches input, set appropriate load flag; if status does not match, generate validation error and use empty status.
  • Context - equipment status validation confirms loaded status:
    For Set LOAD Flag:
    When the system processes load flag assignment, then the system sets the load indicator flag to indicate equipment carries cargo.
  • Context - equipment status validation confirms empty status or status validation error occurs or no waybill data available:
    For Set EMPTY Flag:
    When the system processes empty flag assignment, then the system sets the empty indicator flag to indicate equipment does not carry cargo.
  • Context - either load flag or empty flag has been set:
    For Assign Load/Empty Status Indicator:
    When the system processes status indicator assignment, then the system assigns the appropriate load/empty status indicator to the equipment record.
  • Context - load/empty status indicator has been assigned:
    For Update Equipment Record Status:
    When the system processes equipment record update, then the system updates the equipment record with the final load/empty status for further processing.
  • Context - determined load/empty status does not match input specifications:
    For Generate Status Validation Error:
    When the system processes status validation error, then the system generates a status validation error and defaults to empty status processing.
  • Context - no waybill data is available for the equipment:
    For Use Default Empty Status:
    When the system processes default status assignment, then the system assigns default empty status to the equipment and proceeds with empty flag processing.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record requires load/empty status determination
GIVEN
An equipment record requires load/empty status determination
Applied to: Retrieve Equipment Waybill Data
WHEN
The system processes the equipment for waybill data retrieval
THEN
The system attempts to locate waybill information using the equipment identifier and sets waybill availability flag accordingly
Context: Equipment waybill data retrieval has been attempted
GIVEN
Equipment waybill data retrieval has been attempted
Applied to: Waybill Data Available?
WHEN
The system checks if waybill data is available for the equipment
THEN
If waybill data exists, proceed with cargo analysis; if no waybill data exists, use default empty status processing
Context: Waybill data is available for equipment
GIVEN
Waybill data is available for equipment
Applied to: Analyze Cargo Origin Information
WHEN
The system processes cargo origin information from the waybill
THEN
The system extracts and analyzes origin station, shipper information, and cargo classification data for load status determination
Context: Cargo origin information has been analyzed
GIVEN
Cargo origin information has been analyzed
Applied to: Analyze Cargo Destination Information
WHEN
The system processes cargo destination information from the waybill
THEN
The system extracts and analyzes destination station, consignee information, and delivery requirements for load status determination
Context: Cargo origin and destination information has been analyzed
GIVEN
Cargo origin and destination information has been analyzed
Applied to: Check Equipment Type Classification
WHEN
The system checks the equipment type classification
THEN
The system categorizes equipment as container, trailer, or rail car type for specific processing rules
Context: Equipment type classification check has been performed
GIVEN
Equipment type classification check has been performed
Applied to: Container Equipment?
WHEN
The system evaluates if equipment is container type
THEN
If equipment is container type, proceed with container-specific load status determination; otherwise check for trailer type
Context: Equipment is not container type
GIVEN
Equipment is not container type
Applied to: Trailer Equipment?
WHEN
The system evaluates if equipment is trailer type
THEN
If equipment is trailer type, proceed with trailer-specific load status determination; otherwise treat as rail car equipment
Context: Equipment is not container or trailer type
GIVEN
Equipment is not container or trailer type
Applied to: Rail Car Equipment?
WHEN
The system evaluates if equipment is rail car type
THEN
If equipment is rail car type, proceed with rail car-specific load status determination
Context: Equipment is identified as container type with available waybill data
GIVEN
Equipment is identified as container type with available waybill data
Applied to: Determine Container Load Status
WHEN
The system processes container-specific load status determination
THEN
The system analyzes container cargo content, weight information, and commodity details to determine if container is loaded or empty
Context: Equipment is identified as trailer type with available waybill data
GIVEN
Equipment is identified as trailer type with available waybill data
Applied to: Determine Trailer Load Status
WHEN
The system processes trailer-specific load status determination
THEN
The system analyzes trailer cargo content, weight information, and commodity details to determine if trailer is loaded or empty
Context: Equipment is identified as rail car type with available waybill data
GIVEN
Equipment is identified as rail car type with available waybill data
Applied to: Determine Rail Car Load Status
WHEN
The system processes rail car-specific load status determination
THEN
The system analyzes rail car cargo content, weight information, and commodity details to determine if rail car is loaded or empty
Context: Load/empty status has been determined for the equipment
GIVEN
Load/empty status has been determined for the equipment
Applied to: Validate Against Input Specifications
WHEN
The system validates the determined status against input specifications
THEN
The system compares the calculated load/empty status with the input-provided status for consistency verification
Context: Load/empty status validation has been performed
GIVEN
Load/empty status validation has been performed
Applied to: Status Matches Input?
WHEN
The system checks if determined status matches input specifications
THEN
If status matches input, set appropriate load flag; if status does not match, generate validation error and use empty status
Context: Equipment status validation confirms loaded status
GIVEN
Equipment status validation confirms loaded status
Applied to: Set LOAD Flag
WHEN
The system processes load flag assignment
THEN
The system sets the load indicator flag to indicate equipment carries cargo
Context: Equipment status validation confirms empty status OR status validation error occurs OR no waybill data available
GIVEN
Equipment status validation confirms empty status OR status validation error occurs OR no waybill data available
Applied to: Set EMPTY Flag
WHEN
The system processes empty flag assignment
THEN
The system sets the empty indicator flag to indicate equipment does not carry cargo
Context: Either load flag or empty flag has been set
GIVEN
Either load flag or empty flag has been set
Applied to: Assign Load/Empty Status Indicator
WHEN
The system processes status indicator assignment
THEN
The system assigns the appropriate load/empty status indicator to the equipment record
Context: Load/empty status indicator has been assigned
GIVEN
Load/empty status indicator has been assigned
Applied to: Update Equipment Record Status
WHEN
The system processes equipment record update
THEN
The system updates the equipment record with the final load/empty status for further processing
Context: Determined load/empty status does not match input specifications
GIVEN
Determined load/empty status does not match input specifications
Applied to: Generate Status Validation Error
WHEN
The system processes status validation error
THEN
The system generates a status validation error and defaults to empty status processing
Context: No waybill data is available for the equipment
GIVEN
No waybill data is available for the equipment
Applied to: Use Default Empty Status
WHEN
The system processes default status assignment
THEN
The system assigns default empty status to the equipment and proceeds with empty flag processing
R-GCX146-cbl-00163 (+8) File: GCX146.cbl Commodity Code Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Commodity Code Processing':
  • Context - equipment requires commodity code validation and waybill data sources are available:
    For Access Waybill Record:
    When system attempts to access waybill record using equipment identifier, then system retrieves waybill data from fwiiroot, shiproot, or fw-iq inquiry database in hierarchical order.
  • Context - system has attempted to access waybill record for equipment:
    For Waybill Data Available?:
    When waybill lookup is performed against available data sources, then system determines if valid waybill data is available for commodity processing or proceeds with default handling.
  • Context - valid waybill data is available for equipment:
    For Extract Commodity Code from Waybill:
    When system processes waybill record for commodity information, then system extracts commodity code from waybill data fields for validation processing.
  • Context - commodity code extraction has been attempted from waybill data:
    For Commodity Code Present?:
    When system evaluates extracted commodity code field, then system determines if commodity code is present and not empty or proceeds with default commodity handling.
  • Context - commodity code is present in waybill data:
    For Validate Commodity Code Format:
    When system validates commodity code format against standard requirements, then system confirms commodity code format is valid or identifies format violations for error handling.
  • Context - commodity code has valid format structure:
    For Validate Against Commodity Standards:
    When system checks commodity code against commodity standards and reference data, then system confirms commodity code is valid according to standards or identifies invalid commodity codes.
  • Context - commodity code has passed all validation checks:
    For Set Commodity Code for Processing:
    When system processes validated commodity code, then system sets commodity code for equipment record and continues with processing workflow.
  • Context - waybill data is unavailable or commodity code is not present in waybill:
    For Set Default/Empty Commodity Code:
    When system cannot extract valid commodity code, then system sets default or empty commodity code value and continues equipment processing.
  • Context - commodity code format validation fails or commodity standards validation fails:
    For Log Commodity Code Validation Error:
    When system encounters commodity code validation errors, then system logs commodity code validation error and continues with equipment processing using default handling.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment requires commodity code validation and waybill data sources are available
GIVEN
Equipment requires commodity code validation and waybill data sources are available
Applied to: Access Waybill Record
WHEN
System attempts to access waybill record using equipment identifier
THEN
System retrieves waybill data from FWIIROOT, SHIPROOT, or FW-IQ inquiry database in hierarchical order
Context: System has attempted to access waybill record for equipment
GIVEN
System has attempted to access waybill record for equipment
Applied to: Waybill Data Available?
WHEN
Waybill lookup is performed against available data sources
THEN
System determines if valid waybill data is available for commodity processing or proceeds with default handling
Context: Valid waybill data is available for equipment
GIVEN
Valid waybill data is available for equipment
Applied to: Extract Commodity Code from Waybill
WHEN
System processes waybill record for commodity information
THEN
System extracts commodity code from waybill data fields for validation processing
Context: Commodity code extraction has been attempted from waybill data
GIVEN
Commodity code extraction has been attempted from waybill data
Applied to: Commodity Code Present?
WHEN
System evaluates extracted commodity code field
THEN
System determines if commodity code is present and not empty or proceeds with default commodity handling
Context: Commodity code is present in waybill data
GIVEN
Commodity code is present in waybill data
Applied to: Validate Commodity Code Format
WHEN
System validates commodity code format against standard requirements
THEN
System confirms commodity code format is valid or identifies format violations for error handling
Context: Commodity code has valid format structure
GIVEN
Commodity code has valid format structure
Applied to: Validate Against Commodity Standards
WHEN
System checks commodity code against commodity standards and reference data
THEN
System confirms commodity code is valid according to standards or identifies invalid commodity codes
Context: Commodity code has passed all validation checks
GIVEN
Commodity code has passed all validation checks
Applied to: Set Commodity Code for Processing
WHEN
System processes validated commodity code
THEN
System sets commodity code for equipment record and continues with processing workflow
Context: Waybill data is unavailable OR commodity code is not present in waybill
GIVEN
Waybill data is unavailable OR commodity code is not present in waybill
Applied to: Set Default/Empty Commodity Code
WHEN
System cannot extract valid commodity code
THEN
System sets default or empty commodity code value and continues equipment processing
Context: Commodity code format validation fails OR commodity standards validation fails
GIVEN
Commodity code format validation fails OR commodity standards validation fails
Applied to: Log Commodity Code Validation Error
WHEN
System encounters commodity code validation errors
THEN
System logs commodity code validation error and continues with equipment processing using default handling
R-GCX146-cbl-00172 (+17) File: GCX146.cbl CCN Database Lookup Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Database Lookup':
  • Context - a train manifest contains equipment records with equipment ids:
    For Extract Equipment ID from Train Manifest:
    When the system processes equipment for ccn lookup, then the equipment id is extracted and prepared for database search key construction.
  • Context - equipment id and waybill data are available:
    For Build CCN Search Key:
    When the system needs to search for ccn records, then a properly formatted search key is constructed for database lookup.
  • Context - a formatted ccn search key exists:
    For Search GCCCRT Database:
    When the system performs database lookup in gcccrt, then the database is searched for matching ccn records.
  • Context - a database search has been performed for ccn records:
    For CCN Record Found?:
    When the system evaluates search results, then the system determines if a matching ccn record was found or not found.
  • Context - a ccn record exists for the equipment:
    For Retrieve CCN Details:
    When the system has located a matching ccn record, then complete ccn record details are retrieved from the database.
  • Context - a ccn record has been retrieved with equipment id and waybill information:
    For Check CCN Usability Flag:
    When the system validates ccn usability, then the ccn is determined usable if equipment id matches and either waybill number matches or new bond created flag is set to 'y'.
  • Context - ccn usability validation has been performed:
    For CCN Usable?:
    When the system evaluates usability results, then the ccn is classified as either usable or unusable for processing.
  • Context - a usable ccn record exists with a current status:
    For Validate CCN Status:
    When the system validates ccn status, then the ccn status must be one of: 'sent', 'return', 'manual', 'release', 'ack', or 'csa-dlv' to be considered valid.
  • Context - ccn status validation has been performed:
    For Status Valid?:
    When the system evaluates status validation results, then the ccn status is classified as either valid or invalid for business processing.
  • Context - a ccn record with valid status exists:
    For Extract CCN Information:
    When the system processes the ccn record, then relevant ccn information is extracted and prepared for equipment record integration.
  • Context - ccn information has been successfully extracted:
    For Set CCN Found Flag:
    When the system updates processing status, then the ccn found flag is set to indicate successful ccn lookup.
  • Context - valid ccn information exists and ccn found flag is set:
    For Add CCN to Equipment Record:
    When the system updates equipment records, then ccn information is added to the equipment record for customs processing.
  • Context - ccn has been successfully added to equipment record:
    For CCN Lookup Complete:
    When the ccn lookup process concludes, then the ccn lookup is marked as complete and processing continues.
  • Context - database search returned no matching ccn records:
    For Set CCN Not Found Flag:
    When the system processes the no-match condition, then the ccn not found flag is set to indicate absence of ccn record.
  • Context - ccn not found flag has been set:
    For Add Status Message: CCN Not Found:
    When the system updates status messaging, then a status message indicating 'ccn not found' is added to the equipment processing record.
  • Context - a ccn record exists but fails usability validation or has invalid status:
    For Set CCN Unusable Flag:
    When the system processes the unusable condition, then the ccn unusable flag is set to indicate the ccn cannot be used for processing.
  • Context - ccn unusable flag has been set:
    For Add Status Message: CCN Found Not Usable:
    When the system updates status messaging, then a status message indicating 'ccn found not usable' is added to the equipment processing record.
  • Context - ccn lookup process has completed with any outcome (found, not found, or unusable):
    For Continue Processing:
    When the system proceeds with equipment processing, then equipment processing continues with appropriate ccn status and messaging.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest contains equipment records with equipment IDs
GIVEN
A train manifest contains equipment records with equipment IDs
Applied to: Extract Equipment ID from Train Manifest
WHEN
The system processes equipment for CCN lookup
THEN
The equipment ID is extracted and prepared for database search key construction
Context: Equipment ID and waybill data are available
GIVEN
Equipment ID and waybill data are available
Applied to: Build CCN Search Key
WHEN
The system needs to search for CCN records
THEN
A properly formatted search key is constructed for database lookup
Context: A formatted CCN search key exists
GIVEN
A formatted CCN search key exists
Applied to: Search GCCCRT Database
WHEN
The system performs database lookup in GCCCRT
THEN
The database is searched for matching CCN records
Context: A database search has been performed for CCN records
GIVEN
A database search has been performed for CCN records
Applied to: CCN Record Found?
WHEN
The system evaluates search results
THEN
The system determines if a matching CCN record was found or not found
Context: A CCN record exists for the equipment
GIVEN
A CCN record exists for the equipment
Applied to: Retrieve CCN Details
WHEN
The system has located a matching CCN record
THEN
Complete CCN record details are retrieved from the database
Context: A CCN record has been retrieved with equipment ID and waybill information
GIVEN
A CCN record has been retrieved with equipment ID and waybill information
Applied to: Check CCN Usability Flag
WHEN
The system validates CCN usability
THEN
The CCN is determined usable if equipment ID matches and either waybill number matches or new bond created flag is set to 'Y'
Context: CCN usability validation has been performed
GIVEN
CCN usability validation has been performed
Applied to: CCN Usable?
WHEN
The system evaluates usability results
THEN
The CCN is classified as either usable or unusable for processing
Context: A usable CCN record exists with a current status
GIVEN
A usable CCN record exists with a current status
Applied to: Validate CCN Status
WHEN
The system validates CCN status
THEN
The CCN status must be one of: 'SENT', 'RETURN', 'MANUAL', 'RELEASE', 'ACK', or 'CSA-DLV' to be considered valid
Context: CCN status validation has been performed
GIVEN
CCN status validation has been performed
Applied to: Status Valid?
WHEN
The system evaluates status validation results
THEN
The CCN status is classified as either valid or invalid for business processing
Context: A CCN record with valid status exists
GIVEN
A CCN record with valid status exists
Applied to: Extract CCN Information
WHEN
The system processes the CCN record
THEN
Relevant CCN information is extracted and prepared for equipment record integration
Context: CCN information has been successfully extracted
GIVEN
CCN information has been successfully extracted
Applied to: Set CCN Found Flag
WHEN
The system updates processing status
THEN
The CCN found flag is set to indicate successful CCN lookup
Context: Valid CCN information exists and CCN found flag is set
GIVEN
Valid CCN information exists and CCN found flag is set
Applied to: Add CCN to Equipment Record
WHEN
The system updates equipment records
THEN
CCN information is added to the equipment record for customs processing
Context: CCN has been successfully added to equipment record
GIVEN
CCN has been successfully added to equipment record
Applied to: CCN Lookup Complete
WHEN
The CCN lookup process concludes
THEN
The CCN lookup is marked as complete and processing continues
Context: Database search returned no matching CCN records
GIVEN
Database search returned no matching CCN records
Applied to: Set CCN Not Found Flag
WHEN
The system processes the no-match condition
THEN
The CCN not found flag is set to indicate absence of CCN record
Context: CCN not found flag has been set
GIVEN
CCN not found flag has been set
Applied to: Add Status Message: CCN Not Found
WHEN
The system updates status messaging
THEN
A status message indicating 'CCN Not Found' is added to the equipment processing record
Context: A CCN record exists but fails usability validation or has invalid status
GIVEN
A CCN record exists but fails usability validation or has invalid status
Applied to: Set CCN Unusable Flag
WHEN
The system processes the unusable condition
THEN
The CCN unusable flag is set to indicate the CCN cannot be used for processing
Context: CCN unusable flag has been set
GIVEN
CCN unusable flag has been set
Applied to: Add Status Message: CCN Found Not Usable
WHEN
The system updates status messaging
THEN
A status message indicating 'CCN Found Not Usable' is added to the equipment processing record
Context: CCN lookup process has completed with any outcome (found, not found, or unusable)
GIVEN
CCN lookup process has completed with any outcome (found, not found, or unusable)
Applied to: Continue Processing
WHEN
The system proceeds with equipment processing
THEN
Equipment processing continues with appropriate CCN status and messaging
R-GCX146-cbl-00190 (+20) File: GCX146.cbl CCN Status Validation Merged 21 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Status Validation':
  • Context - a ccn number needs to be validated for processing:
    For Retrieve CCN Record from Database:
    When the system attempts to retrieve the ccn record from the gcccrt database, then the ccn record is retrieved if it exists in the database.
  • Context - a ccn lookup has been performed in the database:
    For CCN Record Found?:
    When the system checks if a ccn record was found, then if no ccn record is found, the ccn is marked as unusable and validation stops.
  • Context - a ccn record exists in the database:
    For Check CCN Usability Flag:
    When the system evaluates the ccn usability flag, then the usability status is determined based on the flag value.
  • Context - a ccn record is being evaluated for usability:
    For Bond Created Flag = 'Y'?:
    When the bond created flag equals 'y', then the ccn is marked as unusable and cannot be processed further.
  • Context - a ccn fails validation criteria (record not found or bond created flag is 'y'):
    For CCN Marked as Unusable:
    When the system determines the ccn cannot be processed, then the ccn is marked as unusable for customs processing.
  • Context - a ccn is determined to be usable for processing:
    For Check Current CCN Status:
    When the system checks the current ccn status, then the current status is evaluated to determine the appropriate status mapping.
  • Context - a ccn has a current status that needs evaluation:
    For Status = RELEASE?:
    When the ccn status equals 'release', then the system proceeds to check transit status for further status refinement.
  • Context - a ccn has release status:
    For Check Transit Status:
    When the system checks the transit status, then the transit status is evaluated to determine the appropriate final status.
  • Context - a ccn has release status and transit status is being evaluated:
    For Transit Status = E or Z?:
    When the transit status equals 'e' or 'z', then the ccn status is set to 'export'.
  • Context - a ccn has release status and transit status of 'e' or 'z':
    For Set Status to EXPORT:
    When the system determines export status mapping is required, then the ccn status is set to 'export'.
  • Context - a ccn has release status and transit status is not 'e' or 'z':
    For Transit Status = S.A.R.?:
    When the transit status equals 's.a.r.', then the ccn status is set to 's.a.r.'.
  • Context - a ccn has release status and transit status of 's.a.r.':
    For Set Status to S.A.R.:
    When the system determines sar status mapping is required, then the ccn status is set to 's.a.r.'.
  • Context - a ccn has release status and transit status is not 'e', 'z', or 's.a.r.':
    For Keep Status as RELEASE:
    When no special status mapping is required, then the ccn status remains as 'release'.
  • Context - a ccn does not have release status:
    For Transit Status = T?:
    When the transit status equals 't', then the ccn status is set to 'transit'.
  • Context - a ccn has transit status 't':
    For Set Status to TRANSIT:
    When the system determines transit status mapping is required, then the ccn status is set to 'transit'.
  • Context - a ccn does not have release status and transit status is not 't':
    For Transit Status = R?:
    When the transit status equals 'r', then the ccn status is set to 'return'.
  • Context - a ccn has transit status 'r':
    For Set Status to RETURN:
    When the system determines return status mapping is required, then the ccn status is set to 'return'.
  • Context - a ccn does not match any specific status mapping criteria:
    For Keep Current Status:
    When no status transformation is required, then the ccn retains its current status.
  • Context - a ccn has been processed through status validation logic:
    For CCN Status Validated:
    When status mapping is complete, then the ccn has a validated status for further processing.
  • Context - a ccn has been marked as unusable:
    For Add Unusable Status Message:
    When the system needs to communicate the unusable status, then an unusable status message is added to the processing results.
  • Context - a ccn has been processed through all validation steps:
    For CCN Status Validation Complete:
    When all validation logic has been executed, then the ccn status validation process is complete.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN number needs to be validated for processing
GIVEN
A CCN number needs to be validated for processing
Applied to: Retrieve CCN Record from Database
WHEN
The system attempts to retrieve the CCN record from the GCCCRT database
THEN
The CCN record is retrieved if it exists in the database
Context: A CCN lookup has been performed in the database
GIVEN
A CCN lookup has been performed in the database
Applied to: CCN Record Found?
WHEN
The system checks if a CCN record was found
THEN
If no CCN record is found, the CCN is marked as unusable and validation stops
Context: A CCN record exists in the database
GIVEN
A CCN record exists in the database
Applied to: Check CCN Usability Flag
WHEN
The system evaluates the CCN usability flag
THEN
The usability status is determined based on the flag value
Context: A CCN record is being evaluated for usability
GIVEN
A CCN record is being evaluated for usability
Applied to: Bond Created Flag = 'Y'?
WHEN
The bond created flag equals 'Y'
THEN
The CCN is marked as unusable and cannot be processed further
Context: A CCN fails validation criteria (record not found or bond created flag is 'Y')
GIVEN
A CCN fails validation criteria (record not found or bond created flag is 'Y')
Applied to: CCN Marked as Unusable
WHEN
The system determines the CCN cannot be processed
THEN
The CCN is marked as unusable for customs processing
Context: A CCN is determined to be usable for processing
GIVEN
A CCN is determined to be usable for processing
Applied to: Check Current CCN Status
WHEN
The system checks the current CCN status
THEN
The current status is evaluated to determine the appropriate status mapping
Context: A CCN has a current status that needs evaluation
GIVEN
A CCN has a current status that needs evaluation
Applied to: Status = RELEASE?
WHEN
The CCN status equals 'RELEASE'
THEN
The system proceeds to check transit status for further status refinement
Context: A CCN has RELEASE status
GIVEN
A CCN has RELEASE status
Applied to: Check Transit Status
WHEN
The system checks the transit status
THEN
The transit status is evaluated to determine the appropriate final status
Context: A CCN has RELEASE status and transit status is being evaluated
GIVEN
A CCN has RELEASE status and transit status is being evaluated
Applied to: Transit Status = E or Z?
WHEN
The transit status equals 'E' or 'Z'
THEN
The CCN status is set to 'EXPORT'
Context: A CCN has RELEASE status and transit status of 'E' or 'Z'
GIVEN
A CCN has RELEASE status and transit status of 'E' or 'Z'
Applied to: Set Status to EXPORT
WHEN
The system determines export status mapping is required
THEN
The CCN status is set to 'EXPORT'
Context: A CCN has RELEASE status and transit status is not 'E' or 'Z'
GIVEN
A CCN has RELEASE status and transit status is not 'E' or 'Z'
Applied to: Transit Status = S.A.R.?
WHEN
The transit status equals 'S.A.R.'
THEN
The CCN status is set to 'S.A.R.'
Context: A CCN has RELEASE status and transit status of 'S.A.R.'
GIVEN
A CCN has RELEASE status and transit status of 'S.A.R.'
Applied to: Set Status to S.A.R.
WHEN
The system determines SAR status mapping is required
THEN
The CCN status is set to 'S.A.R.'
Context: A CCN has RELEASE status and transit status is not 'E', 'Z', or 'S.A.R.'
GIVEN
A CCN has RELEASE status and transit status is not 'E', 'Z', or 'S.A.R.'
Applied to: Keep Status as RELEASE
WHEN
No special status mapping is required
THEN
The CCN status remains as 'RELEASE'
Context: A CCN does not have RELEASE status
GIVEN
A CCN does not have RELEASE status
Applied to: Transit Status = T?
WHEN
The transit status equals 'T'
THEN
The CCN status is set to 'TRANSIT'
Context: A CCN has transit status 'T'
GIVEN
A CCN has transit status 'T'
Applied to: Set Status to TRANSIT
WHEN
The system determines transit status mapping is required
THEN
The CCN status is set to 'TRANSIT'
Context: A CCN does not have RELEASE status and transit status is not 'T'
GIVEN
A CCN does not have RELEASE status and transit status is not 'T'
Applied to: Transit Status = R?
WHEN
The transit status equals 'R'
THEN
The CCN status is set to 'RETURN'
Context: A CCN has transit status 'R'
GIVEN
A CCN has transit status 'R'
Applied to: Set Status to RETURN
WHEN
The system determines return status mapping is required
THEN
The CCN status is set to 'RETURN'
Context: A CCN does not match any specific status mapping criteria
GIVEN
A CCN does not match any specific status mapping criteria
Applied to: Keep Current Status
WHEN
No status transformation is required
THEN
The CCN retains its current status
Context: A CCN has been processed through status validation logic
GIVEN
A CCN has been processed through status validation logic
Applied to: CCN Status Validated
WHEN
Status mapping is complete
THEN
The CCN has a validated status for further processing
Context: A CCN has been marked as unusable
GIVEN
A CCN has been marked as unusable
Applied to: Add Unusable Status Message
WHEN
The system needs to communicate the unusable status
THEN
An unusable status message is added to the processing results
Context: A CCN has been processed through all validation steps
GIVEN
A CCN has been processed through all validation steps
Applied to: CCN Status Validation Complete
WHEN
All validation logic has been executed
THEN
The CCN status validation process is complete
R-GCX146-cbl-00211 (+10) File: GCX146.cbl Train Assignment Validation Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Assignment Validation':
  • Context - a ccn key exists for equipment being processed:
    For Retrieve CCN Record from Database:
    When the system attempts to retrieve the ccn record from the gcccrt database, then the ccn record is successfully retrieved or marked as not found for further processing.
  • Context - a ccn retrieval operation has been performed:
    For CCN Record Found?:
    When the system checks if a ccn record was found in the database, then if no ccn record exists, the validation process ends; if ccn record exists, proceed to check current train assignment.
  • Context - a valid ccn record exists in the database:
    For Check Current Train Assignment:
    When the system checks the current train assignment field in the ccn record, then the system identifies whether the ccn is currently assigned to any train and retrieves the train identification.
  • Context - a ccn record has a current train assignment:
    For CCN Already Assigned to Different Train?:
    When the system compares the existing train assignment with the current train being processed, then if the ccn is assigned to a different train, proceed to validate assignment conflict; if not assigned to a different train, check ccn transit status.
  • Context - a ccn record exists and is not assigned to a different train:
    For Check CCN Transit Status:
    When the system examines the transit status field of the ccn, then the system determines if the ccn has transit status 't' and proceeds accordingly.
  • Context - a ccn record has been checked for transit status:
    For CCN in Transit Status 'T'?:
    When the ccn has transit status 't', then proceed to validate assignment conflict; otherwise set ccn assignment status.
  • Context - a ccn is either assigned to a different train or has transit status 't':
    For Validate Assignment Conflict:
    When the system evaluates the combination of train assignment and transit status, then determine if a business rule violation exists that prevents the assignment.
  • Context - assignment conflict validation has been performed:
    For Assignment Conflict Exists?:
    When the system evaluates whether a legitimate conflict exists, then if conflict exists, generate assignment conflict error; otherwise set ccn assignment status and allow assignment.
  • Context - a legitimate assignment conflict has been identified:
    For Generate Assignment Conflict Error:
    When the ccn cannot be assigned to the current train due to existing assignments, then generate error 13 indicating the car is already on another train and terminate the validation process.
  • Context - no assignment conflicts have been detected for the ccn:
    For Set CCN Assignment Status:
    When the ccn is eligible for assignment to the current train, then update the ccn record with the current train assignment information.
  • Context - ccn assignment status has been successfully updated:
    For Allow CCN Assignment to Current Train:
    When all validation checks have passed without conflicts, then allow the ccn to be assigned to the current train and proceed with normal processing.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN key exists for equipment being processed
GIVEN
A CCN key exists for equipment being processed
Applied to: Retrieve CCN Record from Database
WHEN
The system attempts to retrieve the CCN record from the GCCCRT database
THEN
The CCN record is successfully retrieved or marked as not found for further processing
Context: A CCN retrieval operation has been performed
GIVEN
A CCN retrieval operation has been performed
Applied to: CCN Record Found?
WHEN
The system checks if a CCN record was found in the database
THEN
If no CCN record exists, the validation process ends; if CCN record exists, proceed to check current train assignment
Context: A valid CCN record exists in the database
GIVEN
A valid CCN record exists in the database
Applied to: Check Current Train Assignment
WHEN
The system checks the current train assignment field in the CCN record
THEN
The system identifies whether the CCN is currently assigned to any train and retrieves the train identification
Context: A CCN record has a current train assignment
GIVEN
A CCN record has a current train assignment
Applied to: CCN Already Assigned to Different Train?
WHEN
The system compares the existing train assignment with the current train being processed
THEN
If the CCN is assigned to a different train, proceed to validate assignment conflict; if not assigned to a different train, check CCN transit status
Context: A CCN record exists and is not assigned to a different train
GIVEN
A CCN record exists and is not assigned to a different train
Applied to: Check CCN Transit Status
WHEN
The system examines the transit status field of the CCN
THEN
The system determines if the CCN has transit status 'T' and proceeds accordingly
Context: A CCN record has been checked for transit status
GIVEN
A CCN record has been checked for transit status
Applied to: CCN in Transit Status 'T'?
WHEN
The CCN has transit status 'T'
THEN
Proceed to validate assignment conflict; otherwise set CCN assignment status
Context: A CCN is either assigned to a different train or has transit status 'T'
GIVEN
A CCN is either assigned to a different train or has transit status 'T'
Applied to: Validate Assignment Conflict
WHEN
The system evaluates the combination of train assignment and transit status
THEN
Determine if a business rule violation exists that prevents the assignment
Context: Assignment conflict validation has been performed
GIVEN
Assignment conflict validation has been performed
Applied to: Assignment Conflict Exists?
WHEN
The system evaluates whether a legitimate conflict exists
THEN
If conflict exists, generate assignment conflict error; otherwise set CCN assignment status and allow assignment
Context: A legitimate assignment conflict has been identified
GIVEN
A legitimate assignment conflict has been identified
Applied to: Generate Assignment Conflict Error
WHEN
The CCN cannot be assigned to the current train due to existing assignments
THEN
Generate error 13 indicating the car is already on another train and terminate the validation process
Context: No assignment conflicts have been detected for the CCN
GIVEN
No assignment conflicts have been detected for the CCN
Applied to: Set CCN Assignment Status
WHEN
The CCN is eligible for assignment to the current train
THEN
Update the CCN record with the current train assignment information
Context: CCN assignment status has been successfully updated
GIVEN
CCN assignment status has been successfully updated
Applied to: Allow CCN Assignment to Current Train
WHEN
All validation checks have passed without conflicts
THEN
Allow the CCN to be assigned to the current train and proceed with normal processing
R-GCX146-cbl-00222 (+3) File: GCX146.cbl Ocean vs Rail Manifest Detection Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Ocean vs Rail Manifest Detection':
  • Context - a cargo manifest with manifest type code:
    For Ocean vs Rail Manifest Detection - Identify and validate manifest types:
    When the manifest type code equals '9' (ocean manifest), then the system sets ocean manifest flag to true and tracks ocean manifest presence.
    For Ocean vs Rail Manifest Detection - Identify and validate manifest types:
    When the manifest type code equals '6' (rail manifest), then the system sets rail manifest flag to true and processes as rail cargo.
  • Context - processing has completed for all equipment on a train and ocean manifest flag is set to true and rail manifest flag is set to false:
    For Ocean vs Rail Manifest Detection - Identify and validate manifest types:
    When the validation check for manifest completeness is performed, then the system generates error 39 indicating ocean manifest without corresponding rail manifest.
  • Context - a new train processing session is starting:
    For Ocean vs Rail Manifest Detection - Identify and validate manifest types:
    When the system begins processing equipment for manifest type detection, then the system sets both ocean manifest flag and rail manifest flag to false as initial state.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest with manifest type code
GIVEN
A cargo manifest with manifest type code
Applied to: Ocean vs Rail Manifest Detection - Identify and validate manifest types
WHEN
The manifest type code equals '9' (ocean manifest)
THEN
The system sets ocean manifest flag to true and tracks ocean manifest presence
Applied to: Ocean vs Rail Manifest Detection - Identify and validate manifest types
WHEN
The manifest type code equals '6' (rail manifest)
THEN
The system sets rail manifest flag to true and processes as rail cargo
Context: Processing has completed for all equipment on a train AND ocean manifest flag is set to true AND rail manifest flag is set to false
GIVEN
Processing has completed for all equipment on a train AND ocean manifest flag is set to true AND rail manifest flag is set to false
Applied to: Ocean vs Rail Manifest Detection - Identify and validate manifest types
WHEN
The validation check for manifest completeness is performed
THEN
The system generates error 39 indicating ocean manifest without corresponding rail manifest
Context: A new train processing session is starting
GIVEN
A new train processing session is starting
Applied to: Ocean vs Rail Manifest Detection - Identify and validate manifest types
WHEN
The system begins processing equipment for manifest type detection
THEN
The system sets both ocean manifest flag and rail manifest flag to false as initial state
R-GCX146-cbl-00226 (+17) File: GCX146.cbl Container Processing Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Processing':
  • Context - a flat car equipment record is being processed:
    For Access Flat Car Container Records:
    When the system needs to identify containers on the flat car, then container records are accessed from the flat car container database using the equipment id.
  • Context - container record lookup has been performed for a flat car:
    For Container Records Found?:
    When the system evaluates the lookup results, then processing continues with container handling if records are found, otherwise container processing is skipped.
  • Context - container records have been found for a flat car:
    For Set Flat Car Processing Flag:
    When the system begins container processing, then a flat car processing flag is set to track the processing state.
  • Context - flat car container records are available:
    For Extract Container IDs from T/C XREF:
    When the system processes the cross-reference data, then individual container ids are extracted from the t/c xref records for further processing.
  • Context - container ids have been extracted from cross-reference records:
    For Process First Container:
    When the system starts individual container processing, then the first container in the sequence is selected for processing.
  • Context - a container is being processed:
    For Validate Container CCN:
    When the system checks for ccn validity, then the container ccn is validated against customs database records.
  • Context - container ccn validation has been performed:
    For CCN Valid?:
    When the system evaluates the validation results, then processing continues with waybill data if ccn is valid, otherwise inquiry database lookup is performed.
  • Context - a container has a valid ccn:
    For Process Container Waybill Data:
    When the system processes container details, then waybill data is retrieved and processed for the container.
  • Context - container waybill data has been processed:
    For Set Container Load/Empty Status:
    When the system evaluates container contents, then container status is set as either loaded or empty based on waybill information.
  • Context - one container has been processed on a flat car:
    For More Containers on Flat Car?:
    When the system checks for additional containers, then processing continues with next container if more exist, otherwise totals are updated.
  • Context - multiple containers exist on a flat car:
    For Get Next Container in Sequence:
    When the system needs to process the next container, then the next container in sequence is retrieved for processing.
  • Context - a subsequent container has been retrieved:
    For Process Additional Container:
    When the system processes the additional container, then the container undergoes the same validation and processing as the first container.
  • Context - all containers on a flat car have been processed:
    For Update Container Totals:
    When the system finalizes container processing, then container totals are updated to reflect all processed containers.
  • Context - all containers have been processed and totals updated:
    For Complete Flat Car Processing:
    When the system finalizes flat car processing, then flat car processing is marked as complete.
  • Context - a container ccn is not valid in the primary system:
    For Container Inquiry Database Lookup:
    When the system needs alternative container data, then container inquiry database is accessed for additional information.
  • Context - inquiry database lookup has been performed:
    For Inquiry Data Found?:
    When the system evaluates lookup results, then primary container data is used if found, otherwise container is marked as not found.
  • Context - container data has been found in inquiry database:
    For Use Primary Container Data:
    When the system processes the container information, then primary container data from inquiry database is used for processing.
  • Context - no container data is found in either primary or inquiry databases:
    For Mark Container as Not Found:
    When the system cannot locate container information, then container is marked as not found and processing continues.
👨‍💻 Technical ACs (Gherkin)
Context: A flat car equipment record is being processed
GIVEN
A flat car equipment record is being processed
Applied to: Access Flat Car Container Records
WHEN
The system needs to identify containers on the flat car
THEN
Container records are accessed from the flat car container database using the equipment ID
Context: Container record lookup has been performed for a flat car
GIVEN
Container record lookup has been performed for a flat car
Applied to: Container Records Found?
WHEN
The system evaluates the lookup results
THEN
Processing continues with container handling if records are found, otherwise container processing is skipped
Context: Container records have been found for a flat car
GIVEN
Container records have been found for a flat car
Applied to: Set Flat Car Processing Flag
WHEN
The system begins container processing
THEN
A flat car processing flag is set to track the processing state
Context: Flat car container records are available
GIVEN
Flat car container records are available
Applied to: Extract Container IDs from T/C XREF
WHEN
The system processes the cross-reference data
THEN
Individual container IDs are extracted from the T/C XREF records for further processing
Context: Container IDs have been extracted from cross-reference records
GIVEN
Container IDs have been extracted from cross-reference records
Applied to: Process First Container
WHEN
The system starts individual container processing
THEN
The first container in the sequence is selected for processing
Context: A container is being processed
GIVEN
A container is being processed
Applied to: Validate Container CCN
WHEN
The system checks for CCN validity
THEN
The container CCN is validated against customs database records
Context: Container CCN validation has been performed
GIVEN
Container CCN validation has been performed
Applied to: CCN Valid?
WHEN
The system evaluates the validation results
THEN
Processing continues with waybill data if CCN is valid, otherwise inquiry database lookup is performed
Context: A container has a valid CCN
GIVEN
A container has a valid CCN
Applied to: Process Container Waybill Data
WHEN
The system processes container details
THEN
Waybill data is retrieved and processed for the container
Context: Container waybill data has been processed
GIVEN
Container waybill data has been processed
Applied to: Set Container Load/Empty Status
WHEN
The system evaluates container contents
THEN
Container status is set as either loaded or empty based on waybill information
Context: One container has been processed on a flat car
GIVEN
One container has been processed on a flat car
Applied to: More Containers on Flat Car?
WHEN
The system checks for additional containers
THEN
Processing continues with next container if more exist, otherwise totals are updated
Context: Multiple containers exist on a flat car
GIVEN
Multiple containers exist on a flat car
Applied to: Get Next Container in Sequence
WHEN
The system needs to process the next container
THEN
The next container in sequence is retrieved for processing
Context: A subsequent container has been retrieved
GIVEN
A subsequent container has been retrieved
Applied to: Process Additional Container
WHEN
The system processes the additional container
THEN
The container undergoes the same validation and processing as the first container
Context: All containers on a flat car have been processed
GIVEN
All containers on a flat car have been processed
Applied to: Update Container Totals
WHEN
The system finalizes container processing
THEN
Container totals are updated to reflect all processed containers
Context: All containers have been processed and totals updated
GIVEN
All containers have been processed and totals updated
Applied to: Complete Flat Car Processing
WHEN
The system finalizes flat car processing
THEN
Flat car processing is marked as complete
Context: A container CCN is not valid in the primary system
GIVEN
A container CCN is not valid in the primary system
Applied to: Container Inquiry Database Lookup
WHEN
The system needs alternative container data
THEN
Container inquiry database is accessed for additional information
Context: Inquiry database lookup has been performed
GIVEN
Inquiry database lookup has been performed
Applied to: Inquiry Data Found?
WHEN
The system evaluates lookup results
THEN
Primary container data is used if found, otherwise container is marked as not found
Context: Container data has been found in inquiry database
GIVEN
Container data has been found in inquiry database
Applied to: Use Primary Container Data
WHEN
The system processes the container information
THEN
Primary container data from inquiry database is used for processing
Context: No container data is found in either primary or inquiry databases
GIVEN
No container data is found in either primary or inquiry databases
Applied to: Mark Container as Not Found
WHEN
The system cannot locate container information
THEN
Container is marked as not found and processing continues
R-GCX146-cbl-00244 (+10) File: GCX146.cbl Empty/Exempted Equipment Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Empty/Exempted Equipment Processing':
  • Context - equipment is being processed for customs validation:
    For Check Load/Empty Status:
    When the equipment load/empty indicator is 'e' (empty), then the equipment is classified as empty and flagged to skip ccn validation requirements.
  • Context - equipment is not classified as empty and requires type validation:
    For Check Equipment Type Code:
    When the equipment type code indicates idler equipment (specific type codes for non-revenue equipment), then the equipment is classified as idler equipment and marked for exemption from ccn validation.
  • Context - equipment is not empty and not idler equipment:
    For Check Exemption Rules:
    When the equipment meets specific exemption criteria (certain car types, special handling codes, or regulatory exemptions), then the equipment is marked as exempted from ccn validation requirements.
  • Context - equipment has been determined to be empty based on load/empty indicator:
    For Set Empty Equipment Flag:
    When the empty classification is confirmed, then the empty equipment flag is set to indicate this equipment should skip ccn validation.
  • Context - equipment has been determined to be idler equipment based on equipment type code:
    For Set Idler Equipment Flag:
    When the idler classification is confirmed, then the idler equipment flag is set to indicate this equipment should skip ccn validation.
  • Context - equipment has been determined to qualify for ccn exemption based on exemption rules:
    For Set Exempted Equipment Flag:
    When the exemption qualification is confirmed, then the exempted equipment flag is set to indicate this equipment should skip ccn validation.
  • Context - equipment has been flagged as empty, idler, or exempted from ccn requirements:
    For Skip CCN Validation:
    When the equipment processing continues, then ccn validation steps are bypassed and the equipment proceeds to manifest generation without ccn checks.
  • Context - equipment has been processed and classified as empty, idler, or exempted:
    For Update Equipment Status Totals:
    When the equipment processing is complete, then the appropriate equipment status totals are incremented (total equipment count, empty count, exempted count) for reporting purposes.
  • Context - equipment has been processed and flagged to skip ccn validation:
    For Generate Equipment Record for Manifest:
    When manifest generation is required, then a manifest record is created for the equipment with appropriate status indicators showing it as empty, idler, or exempted.
  • Context - equipment has been classified and processed without ccn validation:
    For Set Equipment Type Message:
    When status reporting is required, then the appropriate equipment type message is set (empty, idler, or exempted) for display in reports and status inquiries.
  • Context - equipment has been processed and classified as not requiring ccn validation:
    For Add to Trip Sheet without CCN:
    When trip sheet generation is performed, then the equipment is added to the trip sheet with appropriate status indicators but without ccn information.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment is being processed for customs validation
GIVEN
Equipment is being processed for customs validation
Applied to: Check Load/Empty Status
WHEN
The equipment load/empty indicator is 'E' (Empty)
THEN
The equipment is classified as empty and flagged to skip CCN validation requirements
Context: Equipment is not classified as empty and requires type validation
GIVEN
Equipment is not classified as empty and requires type validation
Applied to: Check Equipment Type Code
WHEN
The equipment type code indicates idler equipment (specific type codes for non-revenue equipment)
THEN
The equipment is classified as idler equipment and marked for exemption from CCN validation
Context: Equipment is not empty and not idler equipment
GIVEN
Equipment is not empty and not idler equipment
Applied to: Check Exemption Rules
WHEN
The equipment meets specific exemption criteria (certain car types, special handling codes, or regulatory exemptions)
THEN
The equipment is marked as exempted from CCN validation requirements
Context: Equipment has been determined to be empty based on load/empty indicator
GIVEN
Equipment has been determined to be empty based on load/empty indicator
Applied to: Set Empty Equipment Flag
WHEN
The empty classification is confirmed
THEN
The empty equipment flag is set to indicate this equipment should skip CCN validation
Context: Equipment has been determined to be idler equipment based on equipment type code
GIVEN
Equipment has been determined to be idler equipment based on equipment type code
Applied to: Set Idler Equipment Flag
WHEN
The idler classification is confirmed
THEN
The idler equipment flag is set to indicate this equipment should skip CCN validation
Context: Equipment has been determined to qualify for CCN exemption based on exemption rules
GIVEN
Equipment has been determined to qualify for CCN exemption based on exemption rules
Applied to: Set Exempted Equipment Flag
WHEN
The exemption qualification is confirmed
THEN
The exempted equipment flag is set to indicate this equipment should skip CCN validation
Context: Equipment has been flagged as empty, idler, or exempted from CCN requirements
GIVEN
Equipment has been flagged as empty, idler, or exempted from CCN requirements
Applied to: Skip CCN Validation
WHEN
The equipment processing continues
THEN
CCN validation steps are bypassed and the equipment proceeds to manifest generation without CCN checks
Context: Equipment has been processed and classified as empty, idler, or exempted
GIVEN
Equipment has been processed and classified as empty, idler, or exempted
Applied to: Update Equipment Status Totals
WHEN
The equipment processing is complete
THEN
The appropriate equipment status totals are incremented (total equipment count, empty count, exempted count) for reporting purposes
Context: Equipment has been processed and flagged to skip CCN validation
GIVEN
Equipment has been processed and flagged to skip CCN validation
Applied to: Generate Equipment Record for Manifest
WHEN
Manifest generation is required
THEN
A manifest record is created for the equipment with appropriate status indicators showing it as empty, idler, or exempted
Context: Equipment has been classified and processed without CCN validation
GIVEN
Equipment has been classified and processed without CCN validation
Applied to: Set Equipment Type Message
WHEN
Status reporting is required
THEN
The appropriate equipment type message is set (EMPTY, IDLER, or EXEMPTED) for display in reports and status inquiries
Context: Equipment has been processed and classified as not requiring CCN validation
GIVEN
Equipment has been processed and classified as not requiring CCN validation
Applied to: Add to Trip Sheet without CCN
WHEN
Trip sheet generation is performed
THEN
The equipment is added to the trip sheet with appropriate status indicators but without CCN information
R-GCX146-cbl-00255 (+9) File: GCX146.cbl Equipment Status Totals Compilation Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Status Totals Compilation':
  • Context - a verify operation is being performed on a train:
    For Initialize Status Counters:
    When the equipment status totals compilation process begins, then all status counters (total-equip, total-release, total-haulage, total-held-ccra, total-proceed, total-held-docs, total-docs-nr) are set to zero.
  • Context - equipment status totals are being compiled for a train:
    For Equipment Record Available?:
    When the system checks for the next equipment record, then if equipment records exist, continue processing; otherwise proceed to generate totals summary.
  • Context - an equipment record is being processed for status totals:
    For Increment TOTAL-RELEASE Counter:
    When the equipment has ccn status of 'release' or 'csa-dlv', then the total-release counter is incremented by one.
    For Increment TOTAL-HAULAGE Counter:
    When the equipment has haulage flag set to 'y' or manual haulage flag set to 'y', then the total-haulage counter is incremented by one.
    For Increment TOTAL-HELD-CCRA Counter:
    When the equipment has ccn status of 'hold' or 'agi-hold', then the total-held-ccra counter is incremented by one.
    For Increment TOTAL-PROCEED Counter:
    When the equipment has ccn status of 'return' or the manifest from station differs from the manifest to station and the status is not error, reject, or deleted, then the total-proceed counter is incremented by one.
    For Increment TOTAL-HELD-DOCS Counter:
    When the equipment's manifest from station equals the manifest to station and the broker entry field is empty, then the total-held-docs counter is incremented by one.
  • Context - an equipment record with valid ccn is being processed and it's not a loaded/empty car:
    For Update Equipment Status Report Line:
    When the equipment status totals are being compiled for a verify operation, then a detailed status report line is generated including manifest station names and transit status if in-transit status is 't'.
  • Context - an equipment record has been categorized and its specific counter incremented:
    For Calculate Running Totals:
    When the equipment processing continues to the next record, then the total-equip counter is incremented by one and all category totals are maintained.
  • Context - all equipment records in the train have been processed and categorized:
    For Generate Equipment Totals Summary:
    When no more equipment records remain to be processed, then a summary report is generated showing total-equip, total-release, total-haulage, total-held-ccra, total-proceed, total-held-docs, and total-docs-nr counts.
👨‍💻 Technical ACs (Gherkin)
Context: A VERIFY operation is being performed on a train
GIVEN
A VERIFY operation is being performed on a train
Applied to: Initialize Status Counters
WHEN
The equipment status totals compilation process begins
THEN
All status counters (TOTAL-EQUIP, TOTAL-RELEASE, TOTAL-HAULAGE, TOTAL-HELD-CCRA, TOTAL-PROCEED, TOTAL-HELD-DOCS, TOTAL-DOCS-NR) are set to zero
Context: Equipment status totals are being compiled for a train
GIVEN
Equipment status totals are being compiled for a train
Applied to: Equipment Record Available?
WHEN
The system checks for the next equipment record
THEN
If equipment records exist, continue processing; otherwise proceed to generate totals summary
Context: An equipment record is being processed for status totals
GIVEN
An equipment record is being processed for status totals
Applied to: Increment TOTAL-RELEASE Counter
WHEN
The equipment has CCN status of 'RELEASE' or 'CSA-DLV'
THEN
The TOTAL-RELEASE counter is incremented by one
Applied to: Increment TOTAL-HAULAGE Counter
WHEN
The equipment has haulage flag set to 'Y' or manual haulage flag set to 'Y'
THEN
The TOTAL-HAULAGE counter is incremented by one
Applied to: Increment TOTAL-HELD-CCRA Counter
WHEN
The equipment has CCN status of 'HOLD' or 'AGI-HOLD'
THEN
The TOTAL-HELD-CCRA counter is incremented by one
Applied to: Increment TOTAL-PROCEED Counter
WHEN
The equipment has CCN status of 'RETURN' or the manifest from station differs from the manifest to station and the status is not error, reject, or deleted
THEN
The TOTAL-PROCEED counter is incremented by one
Applied to: Increment TOTAL-HELD-DOCS Counter
WHEN
The equipment's manifest from station equals the manifest to station and the broker entry field is empty
THEN
The TOTAL-HELD-DOCS counter is incremented by one
Context: An equipment record with valid CCN is being processed and it's not a loaded/empty car
GIVEN
An equipment record with valid CCN is being processed and it's not a loaded/empty car
Applied to: Update Equipment Status Report Line
WHEN
The equipment status totals are being compiled for a VERIFY operation
THEN
A detailed status report line is generated including manifest station names and transit status if in-transit status is 'T'
Context: An equipment record has been categorized and its specific counter incremented
GIVEN
An equipment record has been categorized and its specific counter incremented
Applied to: Calculate Running Totals
WHEN
The equipment processing continues to the next record
THEN
The TOTAL-EQUIP counter is incremented by one and all category totals are maintained
Context: All equipment records in the train have been processed and categorized
GIVEN
All equipment records in the train have been processed and categorized
Applied to: Generate Equipment Totals Summary
WHEN
No more equipment records remain to be processed
THEN
A summary report is generated showing TOTAL-EQUIP, TOTAL-RELEASE, TOTAL-HAULAGE, TOTAL-HELD-CCRA, TOTAL-PROCEED, TOTAL-HELD-DOCS, and TOTAL-DOCS-NR counts
R-GCX146-cbl-00265 (+13) File: GCX146.cbl EDI Transmission Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI Transmission Processing':
  • Context - an equipment record needs to be processed for edi transmission:
    For Call GCCCARTP Module for Equipment Type:
    When the system calls the gcccartp module to determine equipment type, then the equipment type is classified and returned for further processing.
  • Context - equipment has been determined to be a container type:
    For Set Container Equipment Type Code:
    When the system processes the equipment for edi transmission, then the equipment type code is set to container classification for edi record.
  • Context - equipment has been determined to be a trailer type:
    For Set Trailer Equipment Type Code:
    When the system processes the equipment for edi transmission, then the equipment type code is set to trailer classification for edi record.
  • Context - equipment has been determined to be a rail car type:
    For Set Car Equipment Type Code:
    When the system processes the equipment for edi transmission, then the equipment type code is set to car classification for edi record.
  • Context - equipment type has been determined for edi processing:
    For Assign Load/Empty Status Indicator:
    When the system evaluates the cargo content status of the equipment, then the load/empty status indicator is assigned to reflect whether equipment is loaded or empty.
  • Context - equipment has load/empty status assigned for edi processing:
    For Set CCN Key for EDI Manifest:
    When the system prepares the edi manifest record, then the ccn key is set in the edi equipment record for customs identification.
  • Context - equipment type, status, and ccn key have been determined:
    For Build EDI Equipment Record Structure:
    When the system builds the edi equipment record, then a complete edi record structure is created with all required data elements populated.
  • Context - an edi equipment record has been built:
    For Validate EDI Record Completeness:
    When the system validates the record for completeness, then the record is confirmed to contain all mandatory data elements required for customs transmission.
  • Context - an edi equipment record has been validated as complete:
    For Queue EDI Record for Transmission:
    When the system processes the valid record, then the edi record is queued for transmission to customs.
  • Context - current equipment record has been queued for edi transmission:
    For Prepare Next Equipment Record:
    When the system continues processing the train consist, then the next equipment record is prepared for edi processing.
  • Context - current equipment record has been processed:
    For More Equipment?:
    When the system checks for remaining equipment in the train consist, then processing continues if more equipment exists or proceeds to transmission if complete.
  • Context - all equipment records have been processed and queued:
    For Transmit EDI Data to Customs:
    When the system initiates edi transmission to customs, then all queued edi records are transmitted to customs authorities.
  • Context - edi data has been transmitted to customs:
    For Log EDI Transmission Status:
    When the system completes the transmission process, then the transmission status is logged for audit and monitoring purposes.
  • Context - an error occurs during edi record validation or transmission:
    For Handle EDI Transmission Error:
    When the system encounters the error condition, then appropriate error handling procedures are executed to manage the failure.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record needs to be processed for EDI transmission
GIVEN
An equipment record needs to be processed for EDI transmission
Applied to: Call GCCCARTP Module for Equipment Type
WHEN
The system calls the GCCCARTP module to determine equipment type
THEN
The equipment type is classified and returned for further processing
Context: Equipment has been determined to be a container type
GIVEN
Equipment has been determined to be a container type
Applied to: Set Container Equipment Type Code
WHEN
The system processes the equipment for EDI transmission
THEN
The equipment type code is set to container classification for EDI record
Context: Equipment has been determined to be a trailer type
GIVEN
Equipment has been determined to be a trailer type
Applied to: Set Trailer Equipment Type Code
WHEN
The system processes the equipment for EDI transmission
THEN
The equipment type code is set to trailer classification for EDI record
Context: Equipment has been determined to be a rail car type
GIVEN
Equipment has been determined to be a rail car type
Applied to: Set Car Equipment Type Code
WHEN
The system processes the equipment for EDI transmission
THEN
The equipment type code is set to car classification for EDI record
Context: Equipment type has been determined for EDI processing
GIVEN
Equipment type has been determined for EDI processing
Applied to: Assign Load/Empty Status Indicator
WHEN
The system evaluates the cargo content status of the equipment
THEN
The load/empty status indicator is assigned to reflect whether equipment is loaded or empty
Context: Equipment has load/empty status assigned for EDI processing
GIVEN
Equipment has load/empty status assigned for EDI processing
Applied to: Set CCN Key for EDI Manifest
WHEN
The system prepares the EDI manifest record
THEN
The CCN key is set in the EDI equipment record for customs identification
Context: Equipment type, status, and CCN key have been determined
GIVEN
Equipment type, status, and CCN key have been determined
Applied to: Build EDI Equipment Record Structure
WHEN
The system builds the EDI equipment record
THEN
A complete EDI record structure is created with all required data elements populated
Context: An EDI equipment record has been built
GIVEN
An EDI equipment record has been built
Applied to: Validate EDI Record Completeness
WHEN
The system validates the record for completeness
THEN
The record is confirmed to contain all mandatory data elements required for customs transmission
Context: An EDI equipment record has been validated as complete
GIVEN
An EDI equipment record has been validated as complete
Applied to: Queue EDI Record for Transmission
WHEN
The system processes the valid record
THEN
The EDI record is queued for transmission to customs
Context: Current equipment record has been queued for EDI transmission
GIVEN
Current equipment record has been queued for EDI transmission
Applied to: Prepare Next Equipment Record
WHEN
The system continues processing the train consist
THEN
The next equipment record is prepared for EDI processing
Context: Current equipment record has been processed
GIVEN
Current equipment record has been processed
Applied to: More Equipment?
WHEN
The system checks for remaining equipment in the train consist
THEN
Processing continues if more equipment exists or proceeds to transmission if complete
Context: All equipment records have been processed and queued
GIVEN
All equipment records have been processed and queued
Applied to: Transmit EDI Data to Customs
WHEN
The system initiates EDI transmission to customs
THEN
All queued EDI records are transmitted to customs authorities
Context: EDI data has been transmitted to customs
GIVEN
EDI data has been transmitted to customs
Applied to: Log EDI Transmission Status
WHEN
The system completes the transmission process
THEN
The transmission status is logged for audit and monitoring purposes
Context: An error occurs during EDI record validation or transmission
GIVEN
An error occurs during EDI record validation or transmission
Applied to: Handle EDI Transmission Error
WHEN
The system encounters the error condition
THEN
Appropriate error handling procedures are executed to manage the failure
R-GCX146-cbl-00279 (+16) File: GCX146.cbl AEI Logging Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AEI Logging':
  • Context - an aei train send process is initiated for a specific station:
    For Retrieve Email User Lists from Station Configuration:
    When the system needs to determine email recipients for the aei report, then the system retrieves email user lists from station configuration tables (gcstbrt and aecwrktb) based on the station code.
  • Context - an aei report has been generated with equipment identification data:
    For Check Report Size:
    When the system prepares to send the report via email, then the system counts the total number of lines in the report to determine if continuation logic is needed.
  • Context - an aei report has been prepared for email transmission:
    For Report > 699 Lines?:
    When the report contains more than 699 lines, then the system activates continuation logic to split the report into multiple email messages.
  • Context - an aei report contains 699 lines or fewer:
    For Prepare Standard AEI Report:
    When the system prepares the report for email transmission, then the system formats the report as a single email message without continuation headers.
  • Context - an aei report contains more than 699 lines:
    For Prepare Report with Continuation Logic:
    When the system prepares the report for email transmission, then the system splits the report into batches of 699 lines or fewer with continuation headers.
  • Context - a batch of aei report data has been prepared for transmission:
    For Send Current Report Batch:
    When the system processes the current batch, then the system transmits the batch via emcsend3 email service to the configured recipients.
  • Context - a batch of aei report data has been successfully sent:
    For Reset Message Buffer:
    When the system prepares for the next batch of data, then the system clears the message buffer and resets line counters for the next batch.
  • Context - an aei report requires multiple email messages due to size:
    For Add Continuation Header:
    When the system prepares a continuation batch after the first message, then the system adds the header 'continuation of report....' to identify the message as a continuation.
  • Context - a batch of aei report data has been processed:
    For More Lines to Process?:
    When the system checks for remaining report content, then the system determines if more lines exist that require additional batch processing.
  • Context - additional lines remain in the aei report after sending a batch:
    For Process Next Batch:
    When the system processes the next batch, then the system prepares up to 699 lines for the next email message with appropriate continuation headers.
  • Context - an aei report batch has been prepared for transmission:
    For Send AEI Report via EMCSEND3:
    When the system initiates email transmission, then the system calls emcsend3 service to deliver the report to the configured email recipients.
  • Context - an aei report has been sent via emcsend3 email service:
    For Email Send Successful?:
    When the system receives the transmission response, then the system evaluates the response to determine if the email was successfully delivered.
  • Context - the primary aei report email transmission has failed:
    For Use Fallback Email Recipients:
    When the system needs to ensure report delivery, then the system configures fallback recipients (om01247 and aei9999) for report transmission.
  • Context - primary aei report email transmission has failed:
    For Send to OM01247/AEI9999:
    When the system uses fallback recipients, then the system sends the aei report to om01247 and aei9999 as backup recipients.
  • Context - an aei report email transmission has failed:
    For Handle Email Failure:
    When the system processes the failure, then the system logs the failure and initiates fallback transmission procedures.
  • Context - an aei train send process has been completed (successful or failed):
    For Log AEI Train Send Activity:
    When the system finalizes the aei process, then the system logs the train send activity with timestamp, user information, and transmission status.
  • Context - an aei train send operation has been logged:
    For Create Audit Trail Entry:
    When the system creates audit records, then the system generates detailed audit trail entries in the audit database with transaction details, user identification, and processing results.
👨‍💻 Technical ACs (Gherkin)
Context: An AEI train send process is initiated for a specific station
GIVEN
An AEI train send process is initiated for a specific station
Applied to: Retrieve Email User Lists from Station Configuration
WHEN
The system needs to determine email recipients for the AEI report
THEN
The system retrieves email user lists from station configuration tables (GCSTBRT and AECWRKTB) based on the station code
Context: An AEI report has been generated with equipment identification data
GIVEN
An AEI report has been generated with equipment identification data
Applied to: Check Report Size
WHEN
The system prepares to send the report via email
THEN
The system counts the total number of lines in the report to determine if continuation logic is needed
Context: An AEI report has been prepared for email transmission
GIVEN
An AEI report has been prepared for email transmission
Applied to: Report > 699 Lines?
WHEN
The report contains more than 699 lines
THEN
The system activates continuation logic to split the report into multiple email messages
Context: An AEI report contains 699 lines or fewer
GIVEN
An AEI report contains 699 lines or fewer
Applied to: Prepare Standard AEI Report
WHEN
The system prepares the report for email transmission
THEN
The system formats the report as a single email message without continuation headers
Context: An AEI report contains more than 699 lines
GIVEN
An AEI report contains more than 699 lines
Applied to: Prepare Report with Continuation Logic
WHEN
The system prepares the report for email transmission
THEN
The system splits the report into batches of 699 lines or fewer with continuation headers
Context: A batch of AEI report data has been prepared for transmission
GIVEN
A batch of AEI report data has been prepared for transmission
Applied to: Send Current Report Batch
WHEN
The system processes the current batch
THEN
The system transmits the batch via EMCSEND3 email service to the configured recipients
Context: A batch of AEI report data has been successfully sent
GIVEN
A batch of AEI report data has been successfully sent
Applied to: Reset Message Buffer
WHEN
The system prepares for the next batch of data
THEN
The system clears the message buffer and resets line counters for the next batch
Context: An AEI report requires multiple email messages due to size
GIVEN
An AEI report requires multiple email messages due to size
Applied to: Add Continuation Header
WHEN
The system prepares a continuation batch after the first message
THEN
The system adds the header 'CONTINUATION OF REPORT....' to identify the message as a continuation
Context: A batch of AEI report data has been processed
GIVEN
A batch of AEI report data has been processed
Applied to: More Lines to Process?
WHEN
The system checks for remaining report content
THEN
The system determines if more lines exist that require additional batch processing
Context: Additional lines remain in the AEI report after sending a batch
GIVEN
Additional lines remain in the AEI report after sending a batch
Applied to: Process Next Batch
WHEN
The system processes the next batch
THEN
The system prepares up to 699 lines for the next email message with appropriate continuation headers
Context: An AEI report batch has been prepared for transmission
GIVEN
An AEI report batch has been prepared for transmission
Applied to: Send AEI Report via EMCSEND3
WHEN
The system initiates email transmission
THEN
The system calls EMCSEND3 service to deliver the report to the configured email recipients
Context: An AEI report has been sent via EMCSEND3 email service
GIVEN
An AEI report has been sent via EMCSEND3 email service
Applied to: Email Send Successful?
WHEN
The system receives the transmission response
THEN
The system evaluates the response to determine if the email was successfully delivered
Context: The primary AEI report email transmission has failed
GIVEN
The primary AEI report email transmission has failed
Applied to: Use Fallback Email Recipients
WHEN
The system needs to ensure report delivery
THEN
The system configures fallback recipients (OM01247 and AEI9999) for report transmission
Context: Primary AEI report email transmission has failed
GIVEN
Primary AEI report email transmission has failed
Applied to: Send to OM01247/AEI9999
WHEN
The system uses fallback recipients
THEN
The system sends the AEI report to OM01247 and AEI9999 as backup recipients
Context: An AEI report email transmission has failed
GIVEN
An AEI report email transmission has failed
Applied to: Handle Email Failure
WHEN
The system processes the failure
THEN
The system logs the failure and initiates fallback transmission procedures
Context: An AEI train send process has been completed (successful or failed)
GIVEN
An AEI train send process has been completed (successful or failed)
Applied to: Log AEI Train Send Activity
WHEN
The system finalizes the AEI process
THEN
The system logs the train send activity with timestamp, user information, and transmission status
Context: An AEI train send operation has been logged
GIVEN
An AEI train send operation has been logged
Applied to: Create Audit Trail Entry
WHEN
The system creates audit records
THEN
The system generates detailed audit trail entries in the audit database with transaction details, user identification, and processing results
R-GCX146-cbl-00296 (+13) File: GCX146.cbl Confirmation Message Generation Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Confirmation Message Generation':
  • Context - a train processing operation has completed:
    For Determine Message Type:
    When the system evaluates the processing outcome, then the system selects success confirmation message type if no errors occurred, otherwise selects error confirmation message type.
  • Context - train processing has completed successfully with no validation errors:
    For Create Success Confirmation Message:
    When the system creates a confirmation message, then the system generates a gct1051e success message with train processing details.
  • Context - train processing has failed due to validation errors or system issues:
    For Create Error Confirmation Message:
    When the system creates a confirmation message, then the system generates either a gct1011e error message or customer report message depending on the error type.
  • Context - a confirmation message type has been determined:
    For Format Message Content:
    When the system formats the message content, then the system includes train identification, processing status, error details if applicable, and relevant business data in the message format.
  • Context - a formatted confirmation message is ready for delivery:
    For Set Message Routing:
    When the system sets message routing parameters, then the system assigns alt-pcb routing, sets message priority, and determines recipient terminals based on message type and business requirements.
  • Context - a confirmation message with routing parameters is ready:
    For Queue Message via CSISER:
    When the system queues the message via csiser, then the system adds the message to the processing queue using the appropriate csiser interface methods.
  • Context - messages need to be processed through cims:
    For Initialize CIMS Interface:
    When the system initializes the cims interface, then the system establishes connection to cims and prepares for message command processing.
  • Context - a message is ready for processing through cims:
    For Add Message Command to Queue:
    When the system adds the message command to the queue, then the system queues the appropriate operation (chng for changes, writmsgl for message logging, or purg for purging) based on message type and processing requirements.
  • Context - a message command has been added to the processing queue:
    For Validate Message Parameters:
    When the system validates message parameters, then the system checks for valid parameters, proper formatting, and required data elements, marking the message as valid or invalid.
  • Context - message parameters have been validated successfully:
    For Process Queued Commands:
    When the system processes queued commands, then the system executes all queued cims commands in sequence for message delivery and processing.
  • Context - queued commands have been processed successfully:
    For Send Message to Recipients:
    When the system sends the message to recipients, then the system delivers the confirmation message to all specified terminals and recipients according to the established routing.
  • Context - a message has been sent to recipients:
    For Update Message Status:
    When the system updates message status, then the system records the delivery status, timestamp, and any delivery confirmation information.
  • Context - a confirmation message has been processed and status updated:
    For Log Confirmation Activity:
    When the system logs confirmation activity, then the system creates audit trail entries with message details, processing timestamps, and delivery status for compliance and tracking.
  • Context - message processing encounters an error condition:
    For Handle Message Errors:
    When the system handles message errors, then the system identifies the error type (invalid parameters, queue full, or system error) and routes to appropriate error handling procedures.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing operation has completed
GIVEN
A train processing operation has completed
Applied to: Determine Message Type
WHEN
The system evaluates the processing outcome
THEN
The system selects success confirmation message type if no errors occurred, otherwise selects error confirmation message type
Context: Train processing has completed successfully with no validation errors
GIVEN
Train processing has completed successfully with no validation errors
Applied to: Create Success Confirmation Message
WHEN
The system creates a confirmation message
THEN
The system generates a GCT1051E success message with train processing details
Context: Train processing has failed due to validation errors or system issues
GIVEN
Train processing has failed due to validation errors or system issues
Applied to: Create Error Confirmation Message
WHEN
The system creates a confirmation message
THEN
The system generates either a GCT1011E error message or customer report message depending on the error type
Context: A confirmation message type has been determined
GIVEN
A confirmation message type has been determined
Applied to: Format Message Content
WHEN
The system formats the message content
THEN
The system includes train identification, processing status, error details if applicable, and relevant business data in the message format
Context: A formatted confirmation message is ready for delivery
GIVEN
A formatted confirmation message is ready for delivery
Applied to: Set Message Routing
WHEN
The system sets message routing parameters
THEN
The system assigns ALT-PCB routing, sets message priority, and determines recipient terminals based on message type and business requirements
Context: A confirmation message with routing parameters is ready
GIVEN
A confirmation message with routing parameters is ready
Applied to: Queue Message via CSISER
WHEN
The system queues the message via CSISER
THEN
The system adds the message to the processing queue using the appropriate CSISER interface methods
Context: Messages need to be processed through CIMS
GIVEN
Messages need to be processed through CIMS
Applied to: Initialize CIMS Interface
WHEN
The system initializes the CIMS interface
THEN
The system establishes connection to CIMS and prepares for message command processing
Context: A message is ready for processing through CIMS
GIVEN
A message is ready for processing through CIMS
Applied to: Add Message Command to Queue
WHEN
The system adds the message command to the queue
THEN
The system queues the appropriate operation (CHNG for changes, WRITMSGL for message logging, or PURG for purging) based on message type and processing requirements
Context: A message command has been added to the processing queue
GIVEN
A message command has been added to the processing queue
Applied to: Validate Message Parameters
WHEN
The system validates message parameters
THEN
The system checks for valid parameters, proper formatting, and required data elements, marking the message as valid or invalid
Context: Message parameters have been validated successfully
GIVEN
Message parameters have been validated successfully
Applied to: Process Queued Commands
WHEN
The system processes queued commands
THEN
The system executes all queued CIMS commands in sequence for message delivery and processing
Context: Queued commands have been processed successfully
GIVEN
Queued commands have been processed successfully
Applied to: Send Message to Recipients
WHEN
The system sends the message to recipients
THEN
The system delivers the confirmation message to all specified terminals and recipients according to the established routing
Context: A message has been sent to recipients
GIVEN
A message has been sent to recipients
Applied to: Update Message Status
WHEN
The system updates message status
THEN
The system records the delivery status, timestamp, and any delivery confirmation information
Context: A confirmation message has been processed and status updated
GIVEN
A confirmation message has been processed and status updated
Applied to: Log Confirmation Activity
WHEN
The system logs confirmation activity
THEN
The system creates audit trail entries with message details, processing timestamps, and delivery status for compliance and tracking
Context: Message processing encounters an error condition
GIVEN
Message processing encounters an error condition
Applied to: Handle Message Errors
WHEN
The system handles message errors
THEN
The system identifies the error type (invalid parameters, queue full, or system error) and routes to appropriate error handling procedures
R-GCX146-cbl-00310 (+16) File: GCX146.cbl Canada Customs Trip Sheet Generation Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canada Customs Trip Sheet Generation':
  • Context - a canada customs trip sheet needs to be generated:
    For Initialize Trip Sheet Header:
    When the trip sheet generation process begins, then the header structure is initialized with proper formatting and line counters are reset.
  • Context - trip sheet header has been initialized:
    For Set Report Parameters:
    When report parameters need to be established, then maximum line limits are set and report formatting parameters are configured.
  • Context - train data is available for processing:
    For Format Train Information:
    When train information needs to be formatted for the trip sheet, then train id, date, and customs train id are formatted and added to the report header.
  • Context - train information has been formatted:
    For Add Station Details:
    When station details need to be added to the trip sheet, then from station, to station, and route information are formatted and included in the header.
  • Context - station details have been added to the trip sheet:
    For Process Equipment List:
    When equipment processing begins, then each equipment piece is processed sequentially for inclusion in the trip sheet.
  • Context - an equipment piece is being processed:
    For Format Equipment Entry:
    When equipment entry formatting is required, then equipment id is extracted, car number is formatted, and load/empty status is determined.
  • Context - equipment entry has been formatted:
    For Determine Equipment Type:
    When equipment type needs to be determined, then car type is analyzed to classify as unit, van, sbu, or regular car for appropriate processing.
  • Context - equipment type has been determined:
    For Container on Flat Car?:
    When container processing check is performed, then if equipment is a flat car with containers, container processing is initiated, otherwise standard equipment processing continues.
  • Context - equipment is identified as a flat car with containers:
    For Process Individual Container:
    When container processing is initiated, then each container is processed individually with proper identification and cross-reference handling.
  • Context - individual container is being processed:
    For Format Container Details:
    When container details need formatting, then container id is formatted using 12-character format and container details are prepared for display.
  • Context - equipment or container details have been formatted:
    For Add Equipment Car Type Description:
    When car type description is needed, then car type description is retrieved from the vi table and added to the equipment information.
  • Context - equipment car type description has been added:
    For Assign Status Information:
    When status assignment is required, then ccn status is evaluated, transit status is determined, and appropriate status is assigned (export for release with e/z transit, s.a.r. for release with s.a.r., transit for t status, return for r status, or current status otherwise).
  • Context - current equipment status has been assigned:
    For More Equipment?:
    When equipment processing continuation check is performed, then if more equipment exists, processing returns to equipment list processing, otherwise equipment totals calculation begins.
  • Context - all equipment has been processed:
    For Calculate Equipment Totals:
    When equipment totals calculation is initiated, then totals are calculated for released equipment (release/csa-dlv status), transit equipment (t status), held equipment (hold/agi-hold status), and proceeding equipment (different from/to stations).
  • Context - equipment totals have been calculated:
    For Add Summary Totals:
    When summary totals need to be added to the trip sheet, then total counts for each equipment category are formatted and added to the trip sheet with appropriate labels.
  • Context - summary totals have been added to the trip sheet:
    For Format Final Report:
    When final report formatting is required, then the complete trip sheet is formatted with proper spacing, headers, and structure for final output.
  • Context - final report formatting has been completed:
    For Trip Sheet Complete:
    When trip sheet generation process concludes, then the completed canada customs trip sheet is ready for distribution and the generation process is marked as complete.
👨‍💻 Technical ACs (Gherkin)
Context: A Canada Customs trip sheet needs to be generated
GIVEN
A Canada Customs trip sheet needs to be generated
Applied to: Initialize Trip Sheet Header
WHEN
The trip sheet generation process begins
THEN
The header structure is initialized with proper formatting and line counters are reset
Context: Trip sheet header has been initialized
GIVEN
Trip sheet header has been initialized
Applied to: Set Report Parameters
WHEN
Report parameters need to be established
THEN
Maximum line limits are set and report formatting parameters are configured
Context: Train data is available for processing
GIVEN
Train data is available for processing
Applied to: Format Train Information
WHEN
Train information needs to be formatted for the trip sheet
THEN
Train ID, date, and customs train ID are formatted and added to the report header
Context: Train information has been formatted
GIVEN
Train information has been formatted
Applied to: Add Station Details
WHEN
Station details need to be added to the trip sheet
THEN
From station, to station, and route information are formatted and included in the header
Context: Station details have been added to the trip sheet
GIVEN
Station details have been added to the trip sheet
Applied to: Process Equipment List
WHEN
Equipment processing begins
THEN
Each equipment piece is processed sequentially for inclusion in the trip sheet
Context: An equipment piece is being processed
GIVEN
An equipment piece is being processed
Applied to: Format Equipment Entry
WHEN
Equipment entry formatting is required
THEN
Equipment ID is extracted, car number is formatted, and load/empty status is determined
Context: Equipment entry has been formatted
GIVEN
Equipment entry has been formatted
Applied to: Determine Equipment Type
WHEN
Equipment type needs to be determined
THEN
Car type is analyzed to classify as Unit, Van, SBU, or regular car for appropriate processing
Context: Equipment type has been determined
GIVEN
Equipment type has been determined
Applied to: Container on Flat Car?
WHEN
Container processing check is performed
THEN
If equipment is a flat car with containers, container processing is initiated, otherwise standard equipment processing continues
Context: Equipment is identified as a flat car with containers
GIVEN
Equipment is identified as a flat car with containers
Applied to: Process Individual Container
WHEN
Container processing is initiated
THEN
Each container is processed individually with proper identification and cross-reference handling
Context: Individual container is being processed
GIVEN
Individual container is being processed
Applied to: Format Container Details
WHEN
Container details need formatting
THEN
Container ID is formatted using 12-character format and container details are prepared for display
Context: Equipment or container details have been formatted
GIVEN
Equipment or container details have been formatted
Applied to: Add Equipment Car Type Description
WHEN
Car type description is needed
THEN
Car type description is retrieved from the VI table and added to the equipment information
Context: Equipment car type description has been added
GIVEN
Equipment car type description has been added
Applied to: Assign Status Information
WHEN
Status assignment is required
THEN
CCN status is evaluated, transit status is determined, and appropriate status is assigned (EXPORT for RELEASE with E/Z transit, S.A.R. for RELEASE with S.A.R., TRANSIT for T status, RETURN for R status, or current status otherwise)
Context: Current equipment status has been assigned
GIVEN
Current equipment status has been assigned
Applied to: More Equipment?
WHEN
Equipment processing continuation check is performed
THEN
If more equipment exists, processing returns to equipment list processing, otherwise equipment totals calculation begins
Context: All equipment has been processed
GIVEN
All equipment has been processed
Applied to: Calculate Equipment Totals
WHEN
Equipment totals calculation is initiated
THEN
Totals are calculated for released equipment (RELEASE/CSA-DLV status), transit equipment (T status), held equipment (HOLD/AGI-HOLD status), and proceeding equipment (different from/to stations)
Context: Equipment totals have been calculated
GIVEN
Equipment totals have been calculated
Applied to: Add Summary Totals
WHEN
Summary totals need to be added to the trip sheet
THEN
Total counts for each equipment category are formatted and added to the trip sheet with appropriate labels
Context: Summary totals have been added to the trip sheet
GIVEN
Summary totals have been added to the trip sheet
Applied to: Format Final Report
WHEN
Final report formatting is required
THEN
The complete trip sheet is formatted with proper spacing, headers, and structure for final output
Context: Final report formatting has been completed
GIVEN
Final report formatting has been completed
Applied to: Trip Sheet Complete
WHEN
Trip sheet generation process concludes
THEN
The completed Canada Customs trip sheet is ready for distribution and the generation process is marked as complete
R-GCX146-cbl-00327 (+14) File: GCX146.cbl Status Report Generation Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Report Generation':
  • Context - a verify operation is being processed for a train:
    For Initialize Status Report Header:
    When the status report generation begins, then the report header is initialized with train id, date, time, and column headers for equipment status display.
  • Context - equipment records exist for the train being verified:
    For Process Equipment Status Records:
    When processing equipment status records, then each equipment record is processed to extract ccn status, equipment details, and manifest information.
  • Context - equipment has manifest from and to station codes:
    For Populate Manifest Station Names:
    When processing equipment for status report, then station names are retrieved and populated for manifest from and to locations using station code lookup.
  • Context - equipment has an in-transit status indicator:
    For Equipment Has Transit Status?:
    When the in-transit status is 't', then the equipment status is set to 'transit' for display purposes.
    For Keep Original Status:
    When the in-transit status is not 't', then the original equipment status is preserved for display.
  • Context - equipment has us customs status messages available:
    For Process US Status Messages:
    When processing status messages for the report, then us status messages are processed and included in the report up to a maximum of 90 lines.
  • Context - status report is being generated with multiple equipment entries:
    For Line Limit Reached?:
    When the maximum number of report lines is reached, then the max-lines-reached flag is set to prevent report overflow.
  • Context - equipment records are being processed for status totals:
    For Calculate Total Released Equipment:
    When equipment has status 'release' or 'csa-dlv', then the total-release counter is incremented by one.
    For Calculate Total Haulage Equipment:
    When equipment has haulage flag set or manual haulage flag set, then the total-haulage counter is incremented by one.
    For Calculate Total Held by CCRA:
    When equipment has status 'hold' or 'agi-hold', then the total-held-ccra counter is incremented by one.
    For Calculate Total Proceeding Equipment:
    When equipment has status 'return' or manifest from station differs from manifest to station and status is not error, reject, or deleted, then the total-proceed counter is incremented by one.
    For Calculate Total Held for Documentation:
    When equipment manifest from station equals manifest to station and broker entry is empty, then the total-held-docs counter is incremented by one.
  • Context - equipment status information has been processed:
    For Format Status Report Lines:
    When formatting the status report, then equipment details are formatted into structured report lines with proper spacing and alignment.
  • Context - equipment status lines have been formatted:
    For Add Equipment Details to Report:
    When building the complete status report, then formatted equipment details are added to the report output including ccn, status, and manifest information.
  • Context - all equipment has been processed and totals calculated:
    For Generate Final Status Report:
    When finalizing the status report, then the complete status report is generated with equipment details, status totals, and summary information.
👨‍💻 Technical ACs (Gherkin)
Context: A VERIFY operation is being processed for a train
GIVEN
A VERIFY operation is being processed for a train
Applied to: Initialize Status Report Header
WHEN
The status report generation begins
THEN
The report header is initialized with train ID, date, time, and column headers for equipment status display
Context: Equipment records exist for the train being verified
GIVEN
Equipment records exist for the train being verified
Applied to: Process Equipment Status Records
WHEN
Processing equipment status records
THEN
Each equipment record is processed to extract CCN status, equipment details, and manifest information
Context: Equipment has manifest from and to station codes
GIVEN
Equipment has manifest from and to station codes
Applied to: Populate Manifest Station Names
WHEN
Processing equipment for status report
THEN
Station names are retrieved and populated for manifest from and to locations using station code lookup
Context: Equipment has an in-transit status indicator
GIVEN
Equipment has an in-transit status indicator
Applied to: Equipment Has Transit Status?
WHEN
The in-transit status is 'T'
THEN
The equipment status is set to 'TRANSIT' for display purposes
Applied to: Keep Original Status
WHEN
The in-transit status is not 'T'
THEN
The original equipment status is preserved for display
Context: Equipment has US customs status messages available
GIVEN
Equipment has US customs status messages available
Applied to: Process US Status Messages
WHEN
Processing status messages for the report
THEN
US status messages are processed and included in the report up to a maximum of 90 lines
Context: Status report is being generated with multiple equipment entries
GIVEN
Status report is being generated with multiple equipment entries
Applied to: Line Limit Reached?
WHEN
The maximum number of report lines is reached
THEN
The MAX-LINES-REACHED flag is set to prevent report overflow
Context: Equipment records are being processed for status totals
GIVEN
Equipment records are being processed for status totals
Applied to: Calculate Total Released Equipment
WHEN
Equipment has status 'RELEASE' or 'CSA-DLV'
THEN
The TOTAL-RELEASE counter is incremented by one
Applied to: Calculate Total Haulage Equipment
WHEN
Equipment has haulage flag set or manual haulage flag set
THEN
The TOTAL-HAULAGE counter is incremented by one
Applied to: Calculate Total Held by CCRA
WHEN
Equipment has status 'HOLD' or 'AGI-HOLD'
THEN
The TOTAL-HELD-CCRA counter is incremented by one
Applied to: Calculate Total Proceeding Equipment
WHEN
Equipment has status 'RETURN' or manifest from station differs from manifest to station and status is not error, reject, or deleted
THEN
The TOTAL-PROCEED counter is incremented by one
Applied to: Calculate Total Held for Documentation
WHEN
Equipment manifest from station equals manifest to station and broker entry is empty
THEN
The TOTAL-HELD-DOCS counter is incremented by one
Context: Equipment status information has been processed
GIVEN
Equipment status information has been processed
Applied to: Format Status Report Lines
WHEN
Formatting the status report
THEN
Equipment details are formatted into structured report lines with proper spacing and alignment
Context: Equipment status lines have been formatted
GIVEN
Equipment status lines have been formatted
Applied to: Add Equipment Details to Report
WHEN
Building the complete status report
THEN
Formatted equipment details are added to the report output including CCN, status, and manifest information
Context: All equipment has been processed and totals calculated
GIVEN
All equipment has been processed and totals calculated
Applied to: Generate Final Status Report
WHEN
Finalizing the status report
THEN
The complete status report is generated with equipment details, status totals, and summary information
R-GCX146-cbl-00342 (+15) File: GCX146.cbl Error Message Processing Merged 16 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Message Processing':
  • Context - a processing error has been detected during train processing:
    For Set Error Code in WS-ERROR-NB:
    When the system identifies the specific type of error that occurred, then the system assigns the corresponding error code to ws-error-nb for tracking and reporting purposes.
  • Context - an error has been detected that requires transaction rollback:
    For Set Rollback Flag WS-ROLB:
    When the error processing begins, then the system sets ws-rolb flag to 'y' to indicate that transaction rollback is required.
  • Context - a user is attempting to perform train operations:
    For Generate SCAC Access Error 36:
    When the user's scac access is invalid and the operation is not an aei train send, then the system generates error code 36 for scac access violation.
  • Context - an eta date has been provided for train processing:
    For Generate ETA Range Error 25/35:
    When the eta date is outside the acceptable range for the user type (30 days before to 5 days after for supervisors, or 2 days before to 2 days after for others), then the system generates error 25 for supervisor users or error 35 for other users.
  • Context - station information is being validated during train processing:
    For Generate Station Validation Error:
    When station codes are invalid, missing, or fail validation rules, then the system generates appropriate station validation error codes.
  • Context - equipment requires waybill validation during processing:
    For Generate Waybill Lookup Error:
    When waybill lookup fails for loaded cars or waybill data is invalid, then the system generates error 21 for loaded cars without waybills or other waybill-related error codes.
  • Context - ccn validation is being performed for equipment:
    For Generate CCN Validation Error:
    When ccn status is invalid, ccn is assigned to another train, or ccn validation rules are violated, then the system generates error 24 for invalid status, error 13 for duplicate train assignment, or other ccn-related error codes.
  • Context - a processing error has occurred during train operations:
    For Generate Other Processing Error:
    When the error is not related to scac access, eta range, station validation, waybill lookup, or ccn validation, then the system generates the appropriate general processing error code based on the specific issue encountered.
  • Context - an error code has been assigned for a processing issue:
    For Format Error Message:
    When the error message needs to be prepared for distribution, then the system formats the error message with error code, description, and relevant context information.
  • Context - an error message has been formatted for distribution:
    For Identify Distribution Recipients:
    When the system needs to determine who should receive the error notification, then the system identifies appropriate recipients based on error type, user roles, and notification requirements.
  • Context - error distribution recipients are being identified:
    For Add Supervisor IDs:
    When the system is building the distribution list for error notifications, then the system adds supervisor ids from gcstbrt configuration to the distribution list.
  • Context - supervisor ids have been added to the error distribution list:
    For Add Designated Personnel:
    When additional designated personnel need to be notified based on error type, then the system adds designated personnel ids to the error distribution list based on operational requirements.
  • Context - error message recipients have been identified and the message is formatted:
    For Queue Error Message:
    When the error message is ready for distribution, then the system queues the error message in ims message queues for delivery to all identified recipients.
  • Context - error messages have been queued for distribution:
    For Distribute via Message Queues:
    When the messaging system processes the queued messages, then the system distributes error messages to all identified recipients via ims message queues.
  • Context - an error has been processed and distributed:
    For Log Error for Audit Trail:
    When the error processing is being completed, then the system logs the error details in the audit trail for compliance and tracking purposes.
  • Context - the rollback flag ws-rolb has been set to 'y' due to an error:
    For Rollback Transaction:
    When error processing is being completed, then the system executes transaction rollback to undo any partial changes and maintain data integrity.
👨‍💻 Technical ACs (Gherkin)
Context: A processing error has been detected during train processing
GIVEN
A processing error has been detected during train processing
Applied to: Set Error Code in WS-ERROR-NB
WHEN
The system identifies the specific type of error that occurred
THEN
The system assigns the corresponding error code to WS-ERROR-NB for tracking and reporting purposes
Context: An error has been detected that requires transaction rollback
GIVEN
An error has been detected that requires transaction rollback
Applied to: Set Rollback Flag WS-ROLB
WHEN
The error processing begins
THEN
The system sets WS-ROLB flag to 'Y' to indicate that transaction rollback is required
Context: A user is attempting to perform train operations
GIVEN
A user is attempting to perform train operations
Applied to: Generate SCAC Access Error 36
WHEN
The user's SCAC access is invalid AND the operation is not an AEI train send
THEN
The system generates error code 36 for SCAC access violation
Context: An ETA date has been provided for train processing
GIVEN
An ETA date has been provided for train processing
Applied to: Generate ETA Range Error 25/35
WHEN
The ETA date is outside the acceptable range for the user type (30 days before to 5 days after for supervisors, or 2 days before to 2 days after for others)
THEN
The system generates error 25 for supervisor users or error 35 for other users
Context: Station information is being validated during train processing
GIVEN
Station information is being validated during train processing
Applied to: Generate Station Validation Error
WHEN
Station codes are invalid, missing, or fail validation rules
THEN
The system generates appropriate station validation error codes
Context: Equipment requires waybill validation during processing
GIVEN
Equipment requires waybill validation during processing
Applied to: Generate Waybill Lookup Error
WHEN
Waybill lookup fails for loaded cars or waybill data is invalid
THEN
The system generates error 21 for loaded cars without waybills or other waybill-related error codes
Context: CCN validation is being performed for equipment
GIVEN
CCN validation is being performed for equipment
Applied to: Generate CCN Validation Error
WHEN
CCN status is invalid, CCN is assigned to another train, or CCN validation rules are violated
THEN
The system generates error 24 for invalid status, error 13 for duplicate train assignment, or other CCN-related error codes
Context: A processing error has occurred during train operations
GIVEN
A processing error has occurred during train operations
Applied to: Generate Other Processing Error
WHEN
The error is not related to SCAC access, ETA range, station validation, waybill lookup, or CCN validation
THEN
The system generates the appropriate general processing error code based on the specific issue encountered
Context: An error code has been assigned for a processing issue
GIVEN
An error code has been assigned for a processing issue
Applied to: Format Error Message
WHEN
The error message needs to be prepared for distribution
THEN
The system formats the error message with error code, description, and relevant context information
Context: An error message has been formatted for distribution
GIVEN
An error message has been formatted for distribution
Applied to: Identify Distribution Recipients
WHEN
The system needs to determine who should receive the error notification
THEN
The system identifies appropriate recipients based on error type, user roles, and notification requirements
Context: Error distribution recipients are being identified
GIVEN
Error distribution recipients are being identified
Applied to: Add Supervisor IDs
WHEN
The system is building the distribution list for error notifications
THEN
The system adds supervisor IDs from GCSTBRT configuration to the distribution list
Context: Supervisor IDs have been added to the error distribution list
GIVEN
Supervisor IDs have been added to the error distribution list
Applied to: Add Designated Personnel
WHEN
Additional designated personnel need to be notified based on error type
THEN
The system adds designated personnel IDs to the error distribution list based on operational requirements
Context: Error message recipients have been identified and the message is formatted
GIVEN
Error message recipients have been identified and the message is formatted
Applied to: Queue Error Message
WHEN
The error message is ready for distribution
THEN
The system queues the error message in IMS message queues for delivery to all identified recipients
Context: Error messages have been queued for distribution
GIVEN
Error messages have been queued for distribution
Applied to: Distribute via Message Queues
WHEN
The messaging system processes the queued messages
THEN
The system distributes error messages to all identified recipients via IMS message queues
Context: An error has been processed and distributed
GIVEN
An error has been processed and distributed
Applied to: Log Error for Audit Trail
WHEN
The error processing is being completed
THEN
The system logs the error details in the audit trail for compliance and tracking purposes
Context: The rollback flag WS-ROLB has been set to 'Y' due to an error
GIVEN
The rollback flag WS-ROLB has been set to 'Y' due to an error
Applied to: Rollback Transaction
WHEN
Error processing is being completed
THEN
The system executes transaction rollback to undo any partial changes and maintain data integrity
R-GCX146-cbl-00358 (+20) File: GCX146.cbl Email/FAX Distribution Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email/FAX Distribution':
  • Context - a station configuration exists for the current station:
    For Check Station Configuration:
    When the system needs to determine distribution methods for reports, then the system should identify if auto-fax is enabled for the station.
  • Context - station configuration has been retrieved:
    For Auto-FAX Enabled?:
    When auto-fax flag is set to enabled in station settings, then the system should proceed with fax routing setup, otherwise proceed to email user lookup.
  • Context - auto-fax is enabled for the station:
    For Setup FAX Routing:
    When fax routing needs to be established, then the system should configure fax routing parameters and proceed to set copy ids.
  • Context - auto-fax is not enabled or fax routing is complete:
    For Get Email User Lists:
    When email distribution is required, then the system should lookup email addresses from cusemail table using station code.
  • Context - email user lookup has been performed:
    For Email Users Found?:
    When email addresses are found for the station, then the system should proceed with aei report email distribution, otherwise proceed to merlin transmission.
  • Context - valid email users exist for the station:
    For Send AEI Report via Email:
    When aei report needs to be distributed, then the system should send the report via email using emcsend3 utility.
  • Context - an aei report is being prepared for email distribution:
    For Report Size > 699 Lines?:
    When the report contains more than 699 lines, then the system should split the report and send with continuation headers, otherwise send as complete report.
  • Context - report size is 699 lines or fewer:
    For Send Complete Report:
    When email distribution is initiated, then the system should send the complete report in a single email message.
  • Context - report size exceeds 699 lines:
    For Send Report with Continuation:
    When email distribution is initiated, then the system should split the report and prepare continuation messages.
  • Context - a report is being split into multiple email messages:
    For Add Continuation Header:
    When continuation messages are created, then the system should add 'continuation of report....' header to each continuation message.
  • Context - continuation header has been added:
    For Send Remaining Lines:
    When remaining report lines need to be sent, then the system should send the remaining lines in subsequent email messages with proper headers.
  • Context - email distribution has been attempted:
    For Primary Email Failed?:
    When primary email delivery fails, then the system should use fallback email addresses, otherwise proceed to merlin transmission.
  • Context - primary email distribution has failed:
    For Use Fallback Email:
    When fallback email is needed, then the system should configure fallback email settings.
  • Context - fallback email has been configured:
    For Send to OM01247/AEI9999:
    When report needs to be delivered despite email failure, then the system should send the report to support team addresses om01247 and aei9999.
  • Context - email distribution is complete or not available:
    For Setup Merlin Transmission:
    When merlin transmission is required, then the system should setup merlin transmission parameters.
  • Context - merlin transmission setup is complete:
    For FAX Configuration Valid?:
    When fax configuration needs validation, then the system should verify fax configuration is valid and proceed to external fax setup if valid, otherwise proceed directly to merlin system send.
  • Context - fax configuration is valid:
    For Configure External FAX:
    When external fax needs to be configured, then the system should configure external fax parameters.
  • Context - fax routing or external fax configuration is complete:
    For Set Copy IDs for FAX:
    When copy ids need to be assigned for fax distribution, then the system should set appropriate copy ids for fax transmission.
  • Context - merlin transmission is configured and copy ids are set if needed:
    For Send via Merlin System:
    When report distribution via merlin is initiated, then the system should send the report through merlin messaging system.
  • Context - all distribution methods have been processed:
    For Distribution Complete:
    When distribution is successful, then the system should mark the distribution as complete.
  • Context - an error occurs during email or merlin distribution:
    For Distribution Error:
    When distribution fails, then the system should handle the error and still complete the distribution process.
👨‍💻 Technical ACs (Gherkin)
Context: A station configuration exists for the current station
GIVEN
A station configuration exists for the current station
Applied to: Check Station Configuration
WHEN
The system needs to determine distribution methods for reports
THEN
The system should identify if auto-FAX is enabled for the station
Context: Station configuration has been retrieved
GIVEN
Station configuration has been retrieved
Applied to: Auto-FAX Enabled?
WHEN
Auto-FAX flag is set to enabled in station settings
THEN
The system should proceed with FAX routing setup, otherwise proceed to email user lookup
Context: Auto-FAX is enabled for the station
GIVEN
Auto-FAX is enabled for the station
Applied to: Setup FAX Routing
WHEN
FAX routing needs to be established
THEN
The system should configure FAX routing parameters and proceed to set copy IDs
Context: Auto-FAX is not enabled or FAX routing is complete
GIVEN
Auto-FAX is not enabled or FAX routing is complete
Applied to: Get Email User Lists
WHEN
Email distribution is required
THEN
The system should lookup email addresses from CUSEMAIL table using station code
Context: Email user lookup has been performed
GIVEN
Email user lookup has been performed
Applied to: Email Users Found?
WHEN
Email addresses are found for the station
THEN
The system should proceed with AEI report email distribution, otherwise proceed to Merlin transmission
Context: Valid email users exist for the station
GIVEN
Valid email users exist for the station
Applied to: Send AEI Report via Email
WHEN
AEI report needs to be distributed
THEN
The system should send the report via email using EMCSEND3 utility
Context: An AEI report is being prepared for email distribution
GIVEN
An AEI report is being prepared for email distribution
Applied to: Report Size > 699 Lines?
WHEN
The report contains more than 699 lines
THEN
The system should split the report and send with continuation headers, otherwise send as complete report
Context: Report size is 699 lines or fewer
GIVEN
Report size is 699 lines or fewer
Applied to: Send Complete Report
WHEN
Email distribution is initiated
THEN
The system should send the complete report in a single email message
Context: Report size exceeds 699 lines
GIVEN
Report size exceeds 699 lines
Applied to: Send Report with Continuation
WHEN
Email distribution is initiated
THEN
The system should split the report and prepare continuation messages
Context: A report is being split into multiple email messages
GIVEN
A report is being split into multiple email messages
Applied to: Add Continuation Header
WHEN
Continuation messages are created
THEN
The system should add 'CONTINUATION OF REPORT....' header to each continuation message
Context: Continuation header has been added
GIVEN
Continuation header has been added
Applied to: Send Remaining Lines
WHEN
Remaining report lines need to be sent
THEN
The system should send the remaining lines in subsequent email messages with proper headers
Context: Email distribution has been attempted
GIVEN
Email distribution has been attempted
Applied to: Primary Email Failed?
WHEN
Primary email delivery fails
THEN
The system should use fallback email addresses, otherwise proceed to Merlin transmission
Context: Primary email distribution has failed
GIVEN
Primary email distribution has failed
Applied to: Use Fallback Email
WHEN
Fallback email is needed
THEN
The system should configure fallback email settings
Context: Fallback email has been configured
GIVEN
Fallback email has been configured
Applied to: Send to OM01247/AEI9999
WHEN
Report needs to be delivered despite email failure
THEN
The system should send the report to support team addresses OM01247 and AEI9999
Context: Email distribution is complete or not available
GIVEN
Email distribution is complete or not available
Applied to: Setup Merlin Transmission
WHEN
Merlin transmission is required
THEN
The system should setup Merlin transmission parameters
Context: Merlin transmission setup is complete
GIVEN
Merlin transmission setup is complete
Applied to: FAX Configuration Valid?
WHEN
FAX configuration needs validation
THEN
The system should verify FAX configuration is valid and proceed to external FAX setup if valid, otherwise proceed directly to Merlin system send
Context: FAX configuration is valid
GIVEN
FAX configuration is valid
Applied to: Configure External FAX
WHEN
External FAX needs to be configured
THEN
The system should configure external FAX parameters
Context: FAX routing or external FAX configuration is complete
GIVEN
FAX routing or external FAX configuration is complete
Applied to: Set Copy IDs for FAX
WHEN
Copy IDs need to be assigned for FAX distribution
THEN
The system should set appropriate copy IDs for FAX transmission
Context: Merlin transmission is configured and copy IDs are set if needed
GIVEN
Merlin transmission is configured and copy IDs are set if needed
Applied to: Send via Merlin System
WHEN
Report distribution via Merlin is initiated
THEN
The system should send the report through Merlin messaging system
Context: All distribution methods have been processed
GIVEN
All distribution methods have been processed
Applied to: Distribution Complete
WHEN
Distribution is successful
THEN
The system should mark the distribution as complete
Context: An error occurs during email or Merlin distribution
GIVEN
An error occurs during email or Merlin distribution
Applied to: Distribution Error
WHEN
Distribution fails
THEN
The system should handle the error and still complete the distribution process
R-GCX146-cbl-00379 (+16) File: GCX146.cbl US Trip Sheet Generation Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US Trip Sheet Generation':
  • Context - a us trip sheet generation process is starting:
    For Initialize US Trip Sheet Equipment Records:
    When the system begins processing equipment records, then equipment record counter is set to zero and data structures are cleared.
  • Context - equipment records exist for the train:
    For Prepare Equipment and Cargo Data:
    When the system processes each equipment item, then equipment details, waybill information, and cargo data are extracted and formatted for customs reporting.
  • Context - equipment data has been prepared:
    For Format Equipment Type Messages:
    When the system formats the equipment information, then equipment details are structured according to us customs trip sheet message format requirements.
  • Context - an equipment record with type information:
    For Equipment Type?:
    When the system evaluates the equipment type, then equipment is classified as idler, unit, van, etu, or other type for specialized processing.
  • Context - equipment is classified as idler type:
    For Process IDLER Equipment:
    When the system processes the idler equipment, then idler equipment is formatted with appropriate customs codes and status information.
  • Context - equipment is classified as unit type (l, p, d, u):
    For Process UNIT Equipment:
    When the system processes the unit equipment, then unit equipment is formatted with cargo details, waybill information, and customs status.
  • Context - equipment is classified as van type:
    For Process VAN Equipment:
    When the system processes the van equipment, then van equipment is formatted with container information and customs documentation.
  • Context - equipment is classified as etu type:
    For Process ETU Equipment:
    When the system processes the etu equipment, then etu equipment is formatted with empty status and appropriate customs codes.
  • Context - equipment does not match idler, unit, van, or etu classifications:
    For Process Other Equipment Types:
    When the system processes the other equipment type, then equipment is formatted using standard customs reporting format with available information.
  • Context - equipment data has been processed and formatted:
    For Build Merlin Transmission Lines:
    When the system builds transmission lines, then message lines are constructed in merlin format with proper headers and equipment details.
  • Context - all equipment has been processed and transmission lines built:
    For Format Trip Sheet Data for US Customs:
    When the system formats the complete trip sheet, then trip sheet data is structured according to us customs specifications with all required fields populated.
  • Context - a formatted trip sheet message:
    For Message Size Check:
    When the system checks the message size, then message is classified as either normal size for direct transmission or large message requiring segmentation.
  • Context - a trip sheet message exceeds maximum transmission size:
    For Segment Large Messages:
    When the system segments the message, then message is divided into multiple segments with proper sequencing and continuation headers.
  • Context - trip sheet data is properly formatted and sized for transmission:
    For Transmit via Merlin Communication:
    When the system initiates transmission via merlin, then trip sheet data is sent through merlin communication system to designated us customs recipients.
  • Context - a trip sheet transmission has been attempted:
    For Transmission Successful?:
    When the system evaluates the transmission result, then transmission status is determined as either successful or failed based on system response.
  • Context - trip sheet transmission was successful:
    For Generate Transmission Confirmation:
    When the system generates confirmation, then confirmation message is created indicating successful transmission with timestamp and reference information.
  • Context - trip sheet transmission failed:
    For Handle Transmission Error:
    When the system handles the transmission error, then error is logged, appropriate notifications are sent, and retry or alternative delivery methods are initiated.
👨‍💻 Technical ACs (Gherkin)
Context: A US trip sheet generation process is starting
GIVEN
A US trip sheet generation process is starting
Applied to: Initialize US Trip Sheet Equipment Records
WHEN
The system begins processing equipment records
THEN
Equipment record counter is set to zero and data structures are cleared
Context: Equipment records exist for the train
GIVEN
Equipment records exist for the train
Applied to: Prepare Equipment and Cargo Data
WHEN
The system processes each equipment item
THEN
Equipment details, waybill information, and cargo data are extracted and formatted for customs reporting
Context: Equipment data has been prepared
GIVEN
Equipment data has been prepared
Applied to: Format Equipment Type Messages
WHEN
The system formats the equipment information
THEN
Equipment details are structured according to US customs trip sheet message format requirements
Context: An equipment record with type information
GIVEN
An equipment record with type information
Applied to: Equipment Type?
WHEN
The system evaluates the equipment type
THEN
Equipment is classified as IDLER, UNIT, VAN, ETU, or Other type for specialized processing
Context: Equipment is classified as IDLER type
GIVEN
Equipment is classified as IDLER type
Applied to: Process IDLER Equipment
WHEN
The system processes the IDLER equipment
THEN
IDLER equipment is formatted with appropriate customs codes and status information
Context: Equipment is classified as UNIT type (L, P, D, U)
GIVEN
Equipment is classified as UNIT type (L, P, D, U)
Applied to: Process UNIT Equipment
WHEN
The system processes the UNIT equipment
THEN
UNIT equipment is formatted with cargo details, waybill information, and customs status
Context: Equipment is classified as VAN type
GIVEN
Equipment is classified as VAN type
Applied to: Process VAN Equipment
WHEN
The system processes the VAN equipment
THEN
VAN equipment is formatted with container information and customs documentation
Context: Equipment is classified as ETU type
GIVEN
Equipment is classified as ETU type
Applied to: Process ETU Equipment
WHEN
The system processes the ETU equipment
THEN
ETU equipment is formatted with empty status and appropriate customs codes
Context: Equipment does not match IDLER, UNIT, VAN, or ETU classifications
GIVEN
Equipment does not match IDLER, UNIT, VAN, or ETU classifications
Applied to: Process Other Equipment Types
WHEN
The system processes the other equipment type
THEN
Equipment is formatted using standard customs reporting format with available information
Context: Equipment data has been processed and formatted
GIVEN
Equipment data has been processed and formatted
Applied to: Build Merlin Transmission Lines
WHEN
The system builds transmission lines
THEN
Message lines are constructed in Merlin format with proper headers and equipment details
Context: All equipment has been processed and transmission lines built
GIVEN
All equipment has been processed and transmission lines built
Applied to: Format Trip Sheet Data for US Customs
WHEN
The system formats the complete trip sheet
THEN
Trip sheet data is structured according to US customs specifications with all required fields populated
Context: A formatted trip sheet message
GIVEN
A formatted trip sheet message
Applied to: Message Size Check
WHEN
The system checks the message size
THEN
Message is classified as either normal size for direct transmission or large message requiring segmentation
Context: A trip sheet message exceeds maximum transmission size
GIVEN
A trip sheet message exceeds maximum transmission size
Applied to: Segment Large Messages
WHEN
The system segments the message
THEN
Message is divided into multiple segments with proper sequencing and continuation headers
Context: Trip sheet data is properly formatted and sized for transmission
GIVEN
Trip sheet data is properly formatted and sized for transmission
Applied to: Transmit via Merlin Communication
WHEN
The system initiates transmission via Merlin
THEN
Trip sheet data is sent through Merlin communication system to designated US customs recipients
Context: A trip sheet transmission has been attempted
GIVEN
A trip sheet transmission has been attempted
Applied to: Transmission Successful?
WHEN
The system evaluates the transmission result
THEN
Transmission status is determined as either successful or failed based on system response
Context: Trip sheet transmission was successful
GIVEN
Trip sheet transmission was successful
Applied to: Generate Transmission Confirmation
WHEN
The system generates confirmation
THEN
Confirmation message is created indicating successful transmission with timestamp and reference information
Context: Trip sheet transmission failed
GIVEN
Trip sheet transmission failed
Applied to: Handle Transmission Error
WHEN
The system handles the transmission error
THEN
Error is logged, appropriate notifications are sent, and retry or alternative delivery methods are initiated
R-GCX146-cbl-00396 File: GCX146.cbl Cargo Arrival Detection
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Arrival Detection':
  • Context - the cobol code summary is provided for analysis:
    For Cargo Arrival Detection - Identify cargo arrived at final destination:
    When attempting to extract business rules for cargo arrival detection, then no specific implementation details are available to generate business rules.
👨‍💻 Technical ACs (Gherkin)
Context: The COBOL code summary is provided for analysis
GIVEN
The COBOL code summary is provided for analysis
Applied to: Cargo Arrival Detection - Identify cargo arrived at final destination
WHEN
Attempting to extract business rules for cargo arrival detection
THEN
No specific implementation details are available to generate business rules
R-GCX146-cbl-00397 (+5) File: GCX146.cbl Cargo Arrival Notification Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Arrival Notification':
  • Context - a cargo item exists on the train with manifest destination information:
    For Check Cargo Status:
    When the system processes cargo for arrival notifications, then the cargo is identified for notification if manifest destination matches train destination and is not ocean manifest type.
  • Context - cargo exists with manifest from and to station codes:
    For Cargo Arrived at Destination?:
    When the system checks if cargo has arrived at destination, then cargo is considered arrived if manifest to-station matches current train location and manifest type is not ocean (type 9).
  • Context - cargo has been identified as arrived at destination:
    For Generate Arrival Notice:
    When the system generates arrival notice, then a gct1481e transaction is spawned with cargo details including ccn key and arrival information.
  • Context - an arrival notice transaction has been generated:
    For Send Notification:
    When the system sends the notification, then the gct1481e transaction is queued for transmission to customs processing system.
  • Context - an arrival notification has been sent:
    For Log Notification Activity:
    When the system logs the notification activity, then the spawn counter is incremented and transaction details are recorded for audit purposes.
  • Context - cargo exists but has not arrived at destination or is ocean manifest type:
    For No Action Required:
    When the system evaluates cargo for arrival processing, then no arrival notification is generated and processing continues to next cargo item.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo item exists on the train with manifest destination information
GIVEN
A cargo item exists on the train with manifest destination information
Applied to: Check Cargo Status
WHEN
The system processes cargo for arrival notifications
THEN
The cargo is identified for notification if manifest destination matches train destination and is not ocean manifest type
Context: Cargo exists with manifest from and to station codes
GIVEN
Cargo exists with manifest from and to station codes
Applied to: Cargo Arrived at Destination?
WHEN
The system checks if cargo has arrived at destination
THEN
Cargo is considered arrived if manifest to-station matches current train location and manifest type is not ocean (type 9)
Context: Cargo has been identified as arrived at destination
GIVEN
Cargo has been identified as arrived at destination
Applied to: Generate Arrival Notice
WHEN
The system generates arrival notice
THEN
A GCT1481E transaction is spawned with cargo details including CCN key and arrival information
Context: An arrival notice transaction has been generated
GIVEN
An arrival notice transaction has been generated
Applied to: Send Notification
WHEN
The system sends the notification
THEN
The GCT1481E transaction is queued for transmission to customs processing system
Context: An arrival notification has been sent
GIVEN
An arrival notification has been sent
Applied to: Log Notification Activity
WHEN
The system logs the notification activity
THEN
The spawn counter is incremented and transaction details are recorded for audit purposes
Context: Cargo exists but has not arrived at destination or is ocean manifest type
GIVEN
Cargo exists but has not arrived at destination or is ocean manifest type
Applied to: No Action Required
WHEN
The system evaluates cargo for arrival processing
THEN
No arrival notification is generated and processing continues to next cargo item
R-GCX146-cbl-00403 (+12) File: GCX146.cbl Return CCN Creation Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Return CCN Creation':
  • Context - a cargo shipment with origin and destination information:
    For Identify Canadian Goods Returning from US:
    When the system evaluates the cargo movement pattern, then the cargo is classified as canadian goods returning if it originated in canada and is returning from the us.
  • Context - canadian goods returning from us requiring ccn creation:
    For Build Return CCN Number:
    When the system builds the return ccn number, then the ccn number is constructed using format: '6' + '105' + 'e' + equipment_id + waybill_date + sequence_number.
  • Context - a return ccn being created for canadian goods:
    For Set CCN Prefix to '6105E':
    When the system sets the ccn prefix, then the ccn prefix is set to '6105e' to identify it as a return customs control number.
  • Context - a return ccn being constructed with equipment information available:
    For Append Equipment ID to CCN:
    When the system appends the equipment id to the ccn, then the equipment id is included in the ccn number to ensure unique identification per equipment piece.
  • Context - a return ccn being created with associated waybill information:
    For Append Waybill Date to CCN:
    When the system appends the waybill date to the ccn, then the waybill date is included in the ccn number to provide temporal context and ensure uniqueness.
  • Context - a ccn being created for canadian goods returning from us:
    For Set CCN Status to 'RETURN':
    When the system sets the ccn status, then the ccn status is set to 'return' to indicate the cargo is returning to canada.
  • Context - a return ccn being created with status information:
    For Set Transit Status to 'R':
    When the system sets the transit status, then the transit status is set to 'r' to indicate return movement.
  • Context - a return ccn being created with available waybill data containing shipper information:
    For Populate Shipper Information from Waybill:
    When the system populates shipper information, then shipper name, address, and other relevant details are extracted from the waybill and stored in the ccn record.
  • Context - a return ccn being created with available waybill data containing consignee information:
    For Populate Consignee Information from Waybill:
    When the system populates consignee information, then consignee name, address, and other relevant details are extracted from the waybill and stored in the ccn record.
  • Context - all return ccn information has been populated and validated:
    For Insert Return CCN Record:
    When the system inserts the return ccn record, then a new ccn record is created in the customs database with all populated information and return status.
  • Context - a return ccn record insertion has been attempted:
    For CCN Creation Successful?:
    When the system checks the creation result, then if the ccn record was successfully created, the process continues with success confirmation, otherwise error handling is initiated.
  • Context - a return ccn record has been successfully inserted into the database:
    For Return CCN Created Successfully:
    When the system processes the successful creation, then the return ccn creation is marked as complete and the process proceeds to completion.
  • Context - an error occurred during return ccn record creation:
    For Handle CCN Creation Error:
    When the system handles the ccn creation error, then appropriate error logging and recovery procedures are executed to manage the failed ccn creation.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment with origin and destination information
GIVEN
A cargo shipment with origin and destination information
Applied to: Identify Canadian Goods Returning from US
WHEN
The system evaluates the cargo movement pattern
THEN
The cargo is classified as Canadian goods returning if it originated in Canada and is returning from the US
Context: Canadian goods returning from US requiring CCN creation
GIVEN
Canadian goods returning from US requiring CCN creation
Applied to: Build Return CCN Number
WHEN
The system builds the return CCN number
THEN
The CCN number is constructed using format: '6' + '105' + 'E' + equipment_id + waybill_date + sequence_number
Context: A return CCN being created for Canadian goods
GIVEN
A return CCN being created for Canadian goods
Applied to: Set CCN Prefix to '6105E'
WHEN
The system sets the CCN prefix
THEN
The CCN prefix is set to '6105E' to identify it as a return customs control number
Context: A return CCN being constructed with equipment information available
GIVEN
A return CCN being constructed with equipment information available
Applied to: Append Equipment ID to CCN
WHEN
The system appends the equipment ID to the CCN
THEN
The equipment ID is included in the CCN number to ensure unique identification per equipment piece
Context: A return CCN being created with associated waybill information
GIVEN
A return CCN being created with associated waybill information
Applied to: Append Waybill Date to CCN
WHEN
The system appends the waybill date to the CCN
THEN
The waybill date is included in the CCN number to provide temporal context and ensure uniqueness
Context: A CCN being created for Canadian goods returning from US
GIVEN
A CCN being created for Canadian goods returning from US
Applied to: Set CCN Status to 'RETURN'
WHEN
The system sets the CCN status
THEN
The CCN status is set to 'RETURN' to indicate the cargo is returning to Canada
Context: A return CCN being created with status information
GIVEN
A return CCN being created with status information
Applied to: Set Transit Status to 'R'
WHEN
The system sets the transit status
THEN
The transit status is set to 'R' to indicate return movement
Context: A return CCN being created with available waybill data containing shipper information
GIVEN
A return CCN being created with available waybill data containing shipper information
Applied to: Populate Shipper Information from Waybill
WHEN
The system populates shipper information
THEN
Shipper name, address, and other relevant details are extracted from the waybill and stored in the CCN record
Context: A return CCN being created with available waybill data containing consignee information
GIVEN
A return CCN being created with available waybill data containing consignee information
Applied to: Populate Consignee Information from Waybill
WHEN
The system populates consignee information
THEN
Consignee name, address, and other relevant details are extracted from the waybill and stored in the CCN record
Context: All return CCN information has been populated and validated
GIVEN
All return CCN information has been populated and validated
Applied to: Insert Return CCN Record
WHEN
The system inserts the return CCN record
THEN
A new CCN record is created in the customs database with all populated information and return status
Context: A return CCN record insertion has been attempted
GIVEN
A return CCN record insertion has been attempted
Applied to: CCN Creation Successful?
WHEN
The system checks the creation result
THEN
If the CCN record was successfully created, the process continues with success confirmation, otherwise error handling is initiated
Context: A return CCN record has been successfully inserted into the database
GIVEN
A return CCN record has been successfully inserted into the database
Applied to: Return CCN Created Successfully
WHEN
The system processes the successful creation
THEN
The return CCN creation is marked as complete and the process proceeds to completion
Context: An error occurred during return CCN record creation
GIVEN
An error occurred during return CCN record creation
Applied to: Handle CCN Creation Error
WHEN
The system handles the CCN creation error
THEN
Appropriate error logging and recovery procedures are executed to manage the failed CCN creation
R-GCX146-cbl-00416 (+12) File: GCX146.cbl Broker Notification Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Notification Processing':
  • Context - a ccn key starts with '6105' and cargo type is not 'i' and current status is not 'return' or 'manual':
    For W300-SEND-TO-BROKER: Primary Broker Notification:
    When the system processes broker notifications for the cargo, then the system should send notifications to the primary broker using their configured communication channels.
  • Context - primary broker notification has been processed and a secondary broker is configured for the cargo:
    For W301-SEND-TO-2-BROKER: Secondary Broker Notification:
    When the system continues broker notification processing, then the system should send notifications to the secondary broker using their configured communication channels.
  • Context - a broker notification needs to be sent and broker configuration exists:
    For X12 EDI Channel Available?:
    When the system evaluates available communication channels, then the system should use x12 edi channel if the broker has x12 edi capability configured.
  • Context - x12 edi channel is available and selected for broker notification:
    For Send X12 EDI Notification via GCCS309C:
    When the system processes the notification transmission, then the system should invoke gccs309c to send the notification in x12 edi format to the broker.
  • Context - x12 edi channel processing is complete and broker configuration exists:
    For Merlin Channel Available?:
    When the system evaluates remaining communication channels, then the system should use merlin channel if the broker has merlin communication capability configured.
  • Context - merlin channel is available and selected for broker notification:
    For Send Merlin Notification via GCX019:
    When the system processes the notification transmission, then the system should invoke gcx019 to send the notification through merlin system to the broker.
  • Context - merlin channel processing is complete and broker configuration exists:
    For Internet Channel Available?:
    When the system evaluates remaining communication channels, then the system should use internet channel if the broker has internet communication capability configured.
  • Context - internet channel is available and selected for broker notification:
    For Send Internet Notification via GCX019:
    When the system processes the notification transmission, then the system should invoke gcx019 to send the notification via internet to the broker.
  • Context - internet channel processing is complete and broker configuration exists:
    For FAX Channel Available?:
    When the system evaluates remaining communication channels, then the system should use fax channel if the broker has fax communication capability configured.
  • Context - fax channel is available and selected for broker notification:
    For Send FAX Notification via GCX019:
    When the system processes the notification transmission, then the system should invoke gcx019 to send the notification via fax to the broker.
  • Context - fax channel processing is complete and broker configuration exists:
    For Paper Channel Available?:
    When the system evaluates remaining communication channels, then the system should use paper channel if the broker has paper communication capability configured.
  • Context - paper channel is available and selected for broker notification:
    For Send Paper Notification via Batch Print Call Letters:
    When the system processes the notification generation, then the system should generate paper notification through batch print call letters system for the broker.
  • Context - all configured communication channels have been processed for broker notification:
    For Multi-Channel Distribution Complete:
    When the system completes the distribution process, then the system should mark the multi-channel distribution as complete and proceed to finalize broker notification processing.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN key starts with '6105' and cargo type is not 'I' and current status is not 'RETURN' or 'MANUAL'
GIVEN
A CCN key starts with '6105' and cargo type is not 'I' and current status is not 'RETURN' or 'MANUAL'
Applied to: W300-SEND-TO-BROKER: Primary Broker Notification
WHEN
The system processes broker notifications for the cargo
THEN
The system should send notifications to the primary broker using their configured communication channels
Context: Primary broker notification has been processed and a secondary broker is configured for the cargo
GIVEN
Primary broker notification has been processed and a secondary broker is configured for the cargo
Applied to: W301-SEND-TO-2-BROKER: Secondary Broker Notification
WHEN
The system continues broker notification processing
THEN
The system should send notifications to the secondary broker using their configured communication channels
Context: A broker notification needs to be sent and broker configuration exists
GIVEN
A broker notification needs to be sent and broker configuration exists
Applied to: X12 EDI Channel Available?
WHEN
The system evaluates available communication channels
THEN
The system should use X12 EDI channel if the broker has X12 EDI capability configured
Context: X12 EDI channel is available and selected for broker notification
GIVEN
X12 EDI channel is available and selected for broker notification
Applied to: Send X12 EDI Notification via GCCS309C
WHEN
The system processes the notification transmission
THEN
The system should invoke GCCS309C to send the notification in X12 EDI format to the broker
Context: X12 EDI channel processing is complete and broker configuration exists
GIVEN
X12 EDI channel processing is complete and broker configuration exists
Applied to: Merlin Channel Available?
WHEN
The system evaluates remaining communication channels
THEN
The system should use Merlin channel if the broker has Merlin communication capability configured
Context: Merlin channel is available and selected for broker notification
GIVEN
Merlin channel is available and selected for broker notification
Applied to: Send Merlin Notification via GCX019
WHEN
The system processes the notification transmission
THEN
The system should invoke GCX019 to send the notification through Merlin system to the broker
Context: Merlin channel processing is complete and broker configuration exists
GIVEN
Merlin channel processing is complete and broker configuration exists
Applied to: Internet Channel Available?
WHEN
The system evaluates remaining communication channels
THEN
The system should use Internet channel if the broker has Internet communication capability configured
Context: Internet channel is available and selected for broker notification
GIVEN
Internet channel is available and selected for broker notification
Applied to: Send Internet Notification via GCX019
WHEN
The system processes the notification transmission
THEN
The system should invoke GCX019 to send the notification via Internet to the broker
Context: Internet channel processing is complete and broker configuration exists
GIVEN
Internet channel processing is complete and broker configuration exists
Applied to: FAX Channel Available?
WHEN
The system evaluates remaining communication channels
THEN
The system should use FAX channel if the broker has FAX communication capability configured
Context: FAX channel is available and selected for broker notification
GIVEN
FAX channel is available and selected for broker notification
Applied to: Send FAX Notification via GCX019
WHEN
The system processes the notification transmission
THEN
The system should invoke GCX019 to send the notification via FAX to the broker
Context: FAX channel processing is complete and broker configuration exists
GIVEN
FAX channel processing is complete and broker configuration exists
Applied to: Paper Channel Available?
WHEN
The system evaluates remaining communication channels
THEN
The system should use Paper channel if the broker has Paper communication capability configured
Context: Paper channel is available and selected for broker notification
GIVEN
Paper channel is available and selected for broker notification
Applied to: Send Paper Notification via Batch Print Call Letters
WHEN
The system processes the notification generation
THEN
The system should generate paper notification through batch print call letters system for the broker
Context: All configured communication channels have been processed for broker notification
GIVEN
All configured communication channels have been processed for broker notification
Applied to: Multi-Channel Distribution Complete
WHEN
The system completes the distribution process
THEN
The system should mark the multi-channel distribution as complete and proceed to finalize broker notification processing
R-GCX146-cbl-00429 (+19) File: GCX146.cbl US Customs Status Processing Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US Customs Status Processing':
  • Context - a request to process us customs status for equipment:
    For Access GCSUSRT Database:
    When the system accesses the gcsusrt database using equipment information, then the system retrieves the corresponding us route record if it exists.
  • Context - the system has attempted to retrieve a us route record from gcsusrt database:
    For US Route Record Found?:
    When the database lookup is completed, then the system determines if a valid us route record was found and proceeds with appropriate processing path.
  • Context - a valid us route record has been found in the gcsusrt database:
    For Extract Bond Type Information:
    When the system processes the route record, then the system extracts bond type, cargo status, vessel information, and location data from the record.
  • Context - bond type information has been extracted from the us route record:
    For Validate Bond Type:
    When the system validates the bond type, then the system confirms the bond type is valid for further processing or flags it as invalid.
  • Context - a valid bond type has been identified from the us route record:
    For Check Bond Types: IT/TR/TE/MT:
    When the bond type is it (in-transit), tr (transportation), te (temporary export), or mt (merchandise transfer), then the system applies specific processing rules and validations appropriate for each bond type.
  • Context - bond type information has been processed:
    For Validate In-Transit Status:
    When the system checks the cargo's in-transit status, then the system validates whether the cargo is properly documented as in-transit or not.
  • Context - the in-transit status has been validated:
    For Cargo In-Transit?:
    When the system evaluates the cargo's current transit state, then the system determines if the cargo is in-transit and routes processing accordingly.
  • Context - cargo has been determined to be in-transit:
    For Validate Location Information:
    When the system validates location information from the us route record, then the system confirms location data is accurate and complete for customs processing.
  • Context - location information has been validated for in-transit cargo:
    For Location Valid?:
    When the system evaluates location validity, then the system determines if location information is valid and proceeds with appropriate processing.
  • Context - valid location information has been confirmed:
    For Check Vessel Name:
    When the system checks the vessel name in the us route record, then the system validates the vessel name for transportation mode consistency.
  • Context - vessel name has been validated from the us route record:
    For Vessel = 'TRAIN'?:
    When the system checks if the vessel name equals 'train', then the system determines the transportation mode and applies train-specific or other vessel processing rules.
  • Context - the vessel has been identified as 'train':
    For Generate Train-Specific Status:
    When the system generates customs status, then the system creates train-specific status information with appropriate customs codes and descriptions.
  • Context - the vessel has been identified as something other than 'train':
    For Generate Other Vessel Status:
    When the system generates customs status, then the system creates vessel-specific status information appropriate for the transportation mode.
  • Context - vessel-specific status has been generated:
    For Check Cargo Conditions:
    When the system checks cargo conditions from the us route record, then the system evaluates conditions such as bond dates, cargo types, and special requirements.
  • Context - cargo conditions have been assessed:
    For Special Conditions?:
    When the system evaluates for special conditions such as it bond warnings, vessel mismatches, or date discrepancies, then the system determines if special conditions exist and routes to appropriate warning generation or normal processing.
  • Context - special conditions have been detected in the cargo:
    For Generate Warning Messages:
    When the system generates warning messages, then the system creates appropriate warning messages for conditions such as it bond type warnings, train vessel warnings, location mismatches, or tib date warnings.
  • Context - all cargo conditions have been processed and any necessary warnings generated:
    For Set US Customs Status:
    When the system sets the us customs status, then the system assigns the appropriate customs status reflecting the cargo's current state and compliance requirements.
  • Context - the us customs status has been set:
    For Update Status Information:
    When the system updates status information, then the system records the customs status, warning messages, and related information in the equipment record for reporting and further processing.
  • Context - invalid bond type, location information, or other critical data has been detected:
    For Generate Error Message:
    When the system encounters validation failures, then the system generates appropriate error messages indicating the specific validation failure.
  • Context - no us route record was found or validation errors occurred:
    For Set Default Status:
    When the system needs to assign a status, then the system sets a default status indicating no us customs information is available.
👨‍💻 Technical ACs (Gherkin)
Context: A request to process US customs status for equipment
GIVEN
A request to process US customs status for equipment
Applied to: Access GCSUSRT Database
WHEN
The system accesses the GCSUSRT database using equipment information
THEN
The system retrieves the corresponding US route record if it exists
Context: The system has attempted to retrieve a US route record from GCSUSRT database
GIVEN
The system has attempted to retrieve a US route record from GCSUSRT database
Applied to: US Route Record Found?
WHEN
The database lookup is completed
THEN
The system determines if a valid US route record was found and proceeds with appropriate processing path
Context: A valid US route record has been found in the GCSUSRT database
GIVEN
A valid US route record has been found in the GCSUSRT database
Applied to: Extract Bond Type Information
WHEN
The system processes the route record
THEN
The system extracts bond type, cargo status, vessel information, and location data from the record
Context: Bond type information has been extracted from the US route record
GIVEN
Bond type information has been extracted from the US route record
Applied to: Validate Bond Type
WHEN
The system validates the bond type
THEN
The system confirms the bond type is valid for further processing or flags it as invalid
Context: A valid bond type has been identified from the US route record
GIVEN
A valid bond type has been identified from the US route record
Applied to: Check Bond Types: IT/TR/TE/MT
WHEN
The bond type is IT (In-Transit), TR (Transportation), TE (Temporary Export), or MT (Merchandise Transfer)
THEN
The system applies specific processing rules and validations appropriate for each bond type
Context: Bond type information has been processed
GIVEN
Bond type information has been processed
Applied to: Validate In-Transit Status
WHEN
The system checks the cargo's in-transit status
THEN
The system validates whether the cargo is properly documented as in-transit or not
Context: The in-transit status has been validated
GIVEN
The in-transit status has been validated
Applied to: Cargo In-Transit?
WHEN
The system evaluates the cargo's current transit state
THEN
The system determines if the cargo is in-transit and routes processing accordingly
Context: Cargo has been determined to be in-transit
GIVEN
Cargo has been determined to be in-transit
Applied to: Validate Location Information
WHEN
The system validates location information from the US route record
THEN
The system confirms location data is accurate and complete for customs processing
Context: Location information has been validated for in-transit cargo
GIVEN
Location information has been validated for in-transit cargo
Applied to: Location Valid?
WHEN
The system evaluates location validity
THEN
The system determines if location information is valid and proceeds with appropriate processing
Context: Valid location information has been confirmed
GIVEN
Valid location information has been confirmed
Applied to: Check Vessel Name
WHEN
The system checks the vessel name in the US route record
THEN
The system validates the vessel name for transportation mode consistency
Context: Vessel name has been validated from the US route record
GIVEN
Vessel name has been validated from the US route record
Applied to: Vessel = 'TRAIN'?
WHEN
The system checks if the vessel name equals 'TRAIN'
THEN
The system determines the transportation mode and applies train-specific or other vessel processing rules
Context: The vessel has been identified as 'TRAIN'
GIVEN
The vessel has been identified as 'TRAIN'
Applied to: Generate Train-Specific Status
WHEN
The system generates customs status
THEN
The system creates train-specific status information with appropriate customs codes and descriptions
Context: The vessel has been identified as something other than 'TRAIN'
GIVEN
The vessel has been identified as something other than 'TRAIN'
Applied to: Generate Other Vessel Status
WHEN
The system generates customs status
THEN
The system creates vessel-specific status information appropriate for the transportation mode
Context: Vessel-specific status has been generated
GIVEN
Vessel-specific status has been generated
Applied to: Check Cargo Conditions
WHEN
The system checks cargo conditions from the US route record
THEN
The system evaluates conditions such as bond dates, cargo types, and special requirements
Context: Cargo conditions have been assessed
GIVEN
Cargo conditions have been assessed
Applied to: Special Conditions?
WHEN
The system evaluates for special conditions such as IT bond warnings, vessel mismatches, or date discrepancies
THEN
The system determines if special conditions exist and routes to appropriate warning generation or normal processing
Context: Special conditions have been detected in the cargo
GIVEN
Special conditions have been detected in the cargo
Applied to: Generate Warning Messages
WHEN
The system generates warning messages
THEN
The system creates appropriate warning messages for conditions such as IT bond type warnings, train vessel warnings, location mismatches, or TIB date warnings
Context: All cargo conditions have been processed and any necessary warnings generated
GIVEN
All cargo conditions have been processed and any necessary warnings generated
Applied to: Set US Customs Status
WHEN
The system sets the US customs status
THEN
The system assigns the appropriate customs status reflecting the cargo's current state and compliance requirements
Context: The US customs status has been set
GIVEN
The US customs status has been set
Applied to: Update Status Information
WHEN
The system updates status information
THEN
The system records the customs status, warning messages, and related information in the equipment record for reporting and further processing
Context: Invalid bond type, location information, or other critical data has been detected
GIVEN
Invalid bond type, location information, or other critical data has been detected
Applied to: Generate Error Message
WHEN
The system encounters validation failures
THEN
The system generates appropriate error messages indicating the specific validation failure
Context: No US route record was found or validation errors occurred
GIVEN
No US route record was found or validation errors occurred
Applied to: Set Default Status
WHEN
The system needs to assign a status
THEN
The system sets a default status indicating no US customs information is available
R-GCX146-cbl-00449 (+6) File: GCX146.cbl Special Manifest Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Manifest Processing':
  • Context - a special manifest processing request is initiated:
    For Set Security Byte to HIGH-VALUES:
    When the system begins special manifest creation, then the security byte must be set to high-values to ensure maximum security level.
  • Context - a special manifest is being created for canadian customs processing:
    For Set Record Type Code to 'CA':
    When the system sets the record type for the manifest, then the record type code must be set to 'ca' to identify it as a canadian manifest.
  • Context - train data exists in gcwb4tl with border information:
    For Extract Border Information from GCWB4TL:
    When special manifest processing requires border details, then the system must extract border code and station name from the train data.
  • Context - a special manifest transaction is being created:
    For Increment Spawn Counter:
    When the system processes the manifest creation, then the spawn counter must be incremented by 1 to track the transaction.
  • Context - a ccn key exists for the cargo being processed:
    For Store CCN Key in Special Manifest:
    When a special manifest is being created, then the ccn key must be stored in the special manifest record for cargo identification.
  • Context - border information, ccn key, and record type are available:
    For Build Special Manifest Input:
    When the system builds the special manifest input structure, then all required data elements must be assembled into the proper input format for manifest processing.
  • Context - a complete special manifest input structure is built:
    For Queue Special Manifest Transaction:
    When the system processes the special manifest, then the transaction must be queued for subsequent processing.
👨‍💻 Technical ACs (Gherkin)
Context: A special manifest processing request is initiated
GIVEN
A special manifest processing request is initiated
Applied to: Set Security Byte to HIGH-VALUES
WHEN
The system begins special manifest creation
THEN
The security byte must be set to HIGH-VALUES to ensure maximum security level
Context: A special manifest is being created for Canadian customs processing
GIVEN
A special manifest is being created for Canadian customs processing
Applied to: Set Record Type Code to 'CA'
WHEN
The system sets the record type for the manifest
THEN
The record type code must be set to 'CA' to identify it as a Canadian manifest
Context: Train data exists in GCWB4TL with border information
GIVEN
Train data exists in GCWB4TL with border information
Applied to: Extract Border Information from GCWB4TL
WHEN
Special manifest processing requires border details
THEN
The system must extract border code and station name from the train data
Context: A special manifest transaction is being created
GIVEN
A special manifest transaction is being created
Applied to: Increment Spawn Counter
WHEN
The system processes the manifest creation
THEN
The spawn counter must be incremented by 1 to track the transaction
Context: A CCN key exists for the cargo being processed
GIVEN
A CCN key exists for the cargo being processed
Applied to: Store CCN Key in Special Manifest
WHEN
A special manifest is being created
THEN
The CCN key must be stored in the special manifest record for cargo identification
Context: Border information, CCN key, and record type are available
GIVEN
Border information, CCN key, and record type are available
Applied to: Build Special Manifest Input
WHEN
The system builds the special manifest input structure
THEN
All required data elements must be assembled into the proper input format for manifest processing
Context: A complete special manifest input structure is built
GIVEN
A complete special manifest input structure is built
Applied to: Queue Special Manifest Transaction
WHEN
The system processes the special manifest
THEN
The transaction must be queued for subsequent processing
R-GCX146-cbl-00456 (+6) File: GCX146.cbl CCN Usability Validation Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Usability Validation':
  • Context - a ccn usability validation is requested for specific equipment:
    For Search GCCCRT Database:
    When the system searches the gcccrt database using equipment id and waybill key, then the system retrieves ccn records matching the search criteria.
  • Context - a search has been performed in the gcccrt database:
    For CCN Record Found?:
    When the system evaluates the search results, then if a ccn record is found, proceed to bond creation flag check, otherwise continue processing.
  • Context - a ccn record exists for the equipment:
    For Bond Created Flag = 'Y'?:
    When the system checks the bond creation flag value, then if bond created flag equals 'y', mark ccn as not usable, otherwise mark ccn as usable.
  • Context - a ccn record exists and bond created flag equals 'y':
    For CCN is Not Usable:
    When the system evaluates ccn usability, then the ccn is marked as not usable for train processing.
  • Context - a ccn record exists and bond created flag does not equal 'y':
    For CCN is Usable:
    When the system evaluates ccn usability, then the ccn is marked as usable for train processing.
  • Context - ccn is marked as not usable and request type is verify:
    For Add 'CCN FOUND NOT USABLE' Status Message:
    When the system processes the unusable ccn for verify operation, then the system adds 'ccn found not usable' status message to the response.
  • Context - ccn has been determined as not usable:
    For Request Type = VERIFY?:
    When the system checks the request type, then if request type is verify, add status message, otherwise continue processing without message.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN usability validation is requested for specific equipment
GIVEN
A CCN usability validation is requested for specific equipment
Applied to: Search GCCCRT Database
WHEN
The system searches the GCCCRT database using equipment ID and waybill key
THEN
The system retrieves CCN records matching the search criteria
Context: A search has been performed in the GCCCRT database
GIVEN
A search has been performed in the GCCCRT database
Applied to: CCN Record Found?
WHEN
The system evaluates the search results
THEN
If a CCN record is found, proceed to bond creation flag check, otherwise continue processing
Context: A CCN record exists for the equipment
GIVEN
A CCN record exists for the equipment
Applied to: Bond Created Flag = 'Y'?
WHEN
The system checks the bond creation flag value
THEN
If bond created flag equals 'Y', mark CCN as not usable, otherwise mark CCN as usable
Context: A CCN record exists and bond created flag equals 'Y'
GIVEN
A CCN record exists and bond created flag equals 'Y'
Applied to: CCN is Not Usable
WHEN
The system evaluates CCN usability
THEN
The CCN is marked as not usable for train processing
Context: A CCN record exists and bond created flag does not equal 'Y'
GIVEN
A CCN record exists and bond created flag does not equal 'Y'
Applied to: CCN is Usable
WHEN
The system evaluates CCN usability
THEN
The CCN is marked as usable for train processing
Context: CCN is marked as not usable and request type is VERIFY
GIVEN
CCN is marked as not usable and request type is VERIFY
Applied to: Add 'CCN FOUND NOT USABLE' Status Message
WHEN
The system processes the unusable CCN for VERIFY operation
THEN
The system adds 'CCN FOUND NOT USABLE' status message to the response
Context: CCN has been determined as not usable
GIVEN
CCN has been determined as not usable
Applied to: Request Type = VERIFY?
WHEN
The system checks the request type
THEN
If request type is VERIFY, add status message, otherwise continue processing without message
R-GCX146-cbl-00463 (+11) File: GCX146.cbl Customer Report Generation Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customer Report Generation':
  • Context - a customer report generation request is initiated:
    For Initialize Customer Report Message:
    When the system begins customer report processing, then the customer report message structure is initialized with default values and proper message formatting.
  • Context - a customer report message is being prepared:
    For Set Report Format to GCT1401E:
    When the system configures the report format, then the report format is set to gct1401e transaction type for customer advice processing.
  • Context - a customer report is ready for distribution:
    For Configure Message Queue Routing:
    When the system configures message queue routing, then the message routing is configured to use alt-pcb2 queue for proper customer report delivery.
  • Context - customer report content is available in gcx140-input data structure:
    For Move Report Content to Message Buffer:
    When the system prepares the report for transmission, then the report content is moved to the message buffer for processing and distribution.
  • Context - customer report message is prepared in the message buffer:
    For Execute CIMS CHNG Operation:
    When the system executes cims change operation, then the cims chng operation is performed to process the customer report message.
  • Context - cims change operation has been executed for customer report:
    For CHNG Successful?:
    When the system checks the operation result, then if cims change operation is successful, proceed to write message; otherwise handle error.
  • Context - cims change operation completed successfully:
    For Execute WRITMSGL Operation:
    When the system executes write message operation, then the writmsgl operation is performed to send the customer report message.
  • Context - write message operation has been executed for customer report:
    For Write Successful?:
    When the system checks the write operation result, then if write operation is successful, proceed to purge operation; otherwise handle error.
  • Context - customer report message has been successfully written to queue:
    For Execute PURG Operation:
    When the system executes purge operation, then the purg operation is performed to clean up the message queue.
  • Context - purge operation has been executed for customer report message:
    For Purge Successful?:
    When the system checks the purge operation result, then if purge operation is successful, customer report generation is complete; otherwise handle error.
  • Context - all customer report operations (chng, writmsgl, purg) have completed successfully:
    For Customer Report Generated Successfully:
    When the system finalizes the customer report generation process, then the customer report is marked as successfully generated and distributed.
  • Context - an error occurs during customer report generation (chng, writmsgl, or purg operation fails):
    For Handle Report Generation Error:
    When the system detects the error condition, then the error is handled appropriately and the customer report generation process is terminated.
👨‍💻 Technical ACs (Gherkin)
Context: A customer report generation request is initiated
GIVEN
A customer report generation request is initiated
Applied to: Initialize Customer Report Message
WHEN
The system begins customer report processing
THEN
The customer report message structure is initialized with default values and proper message formatting
Context: A customer report message is being prepared
GIVEN
A customer report message is being prepared
Applied to: Set Report Format to GCT1401E
WHEN
The system configures the report format
THEN
The report format is set to GCT1401E transaction type for customer advice processing
Context: A customer report is ready for distribution
GIVEN
A customer report is ready for distribution
Applied to: Configure Message Queue Routing
WHEN
The system configures message queue routing
THEN
The message routing is configured to use ALT-PCB2 queue for proper customer report delivery
Context: Customer report content is available in GCX140-INPUT data structure
GIVEN
Customer report content is available in GCX140-INPUT data structure
Applied to: Move Report Content to Message Buffer
WHEN
The system prepares the report for transmission
THEN
The report content is moved to the message buffer for processing and distribution
Context: Customer report message is prepared in the message buffer
GIVEN
Customer report message is prepared in the message buffer
Applied to: Execute CIMS CHNG Operation
WHEN
The system executes CIMS change operation
THEN
The CIMS CHNG operation is performed to process the customer report message
Context: CIMS change operation has been executed for customer report
GIVEN
CIMS change operation has been executed for customer report
Applied to: CHNG Successful?
WHEN
The system checks the operation result
THEN
If CIMS change operation is successful, proceed to write message; otherwise handle error
Context: CIMS change operation completed successfully
GIVEN
CIMS change operation completed successfully
Applied to: Execute WRITMSGL Operation
WHEN
The system executes write message operation
THEN
The WRITMSGL operation is performed to send the customer report message
Context: Write message operation has been executed for customer report
GIVEN
Write message operation has been executed for customer report
Applied to: Write Successful?
WHEN
The system checks the write operation result
THEN
If write operation is successful, proceed to purge operation; otherwise handle error
Context: Customer report message has been successfully written to queue
GIVEN
Customer report message has been successfully written to queue
Applied to: Execute PURG Operation
WHEN
The system executes purge operation
THEN
The PURG operation is performed to clean up the message queue
Context: Purge operation has been executed for customer report message
GIVEN
Purge operation has been executed for customer report message
Applied to: Purge Successful?
WHEN
The system checks the purge operation result
THEN
If purge operation is successful, customer report generation is complete; otherwise handle error
Context: All customer report operations (CHNG, WRITMSGL, PURG) have completed successfully
GIVEN
All customer report operations (CHNG, WRITMSGL, PURG) have completed successfully
Applied to: Customer Report Generated Successfully
WHEN
The system finalizes the customer report generation process
THEN
The customer report is marked as successfully generated and distributed
Context: An error occurs during customer report generation (CHNG, WRITMSGL, or PURG operation fails)
GIVEN
An error occurs during customer report generation (CHNG, WRITMSGL, or PURG operation fails)
Applied to: Handle Report Generation Error
WHEN
The system detects the error condition
THEN
The error is handled appropriately and the customer report generation process is terminated
R-GCX146-cbl-00475 (+2) File: GCX146.cbl Audit Trail Logging Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Audit Trail Logging':
  • Context - a cargo processing activity has occurred that requires audit logging:
    For Create Audit Record:
    When the system needs to create an audit trail record, then the system spawns a gct1051e audit transaction using the gcx105-input data structure and handles the transaction queuing process.
  • Context - an audit trail record needs to be created for a cargo processing activity:
    For Capture Transaction Details:
    When the system prepares to log the audit information, then the system populates the gcx105-input structure with transaction details including user information, timestamps, and activity data.
  • Context - an audit transaction has been spawned successfully:
    For Store Audit Trail:
    When the audit record creation process needs to be completed, then the system handles message queuing operations and purges completed audit transactions to finalize the audit trail storage.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing activity has occurred that requires audit logging
GIVEN
A cargo processing activity has occurred that requires audit logging
Applied to: Create Audit Record
WHEN
The system needs to create an audit trail record
THEN
The system spawns a GCT1051E audit transaction using the GCX105-INPUT data structure and handles the transaction queuing process
Context: An audit trail record needs to be created for a cargo processing activity
GIVEN
An audit trail record needs to be created for a cargo processing activity
Applied to: Capture Transaction Details
WHEN
The system prepares to log the audit information
THEN
The system populates the GCX105-INPUT structure with transaction details including user information, timestamps, and activity data
Context: An audit transaction has been spawned successfully
GIVEN
An audit transaction has been spawned successfully
Applied to: Store Audit Trail
WHEN
The audit record creation process needs to be completed
THEN
The system handles message queuing operations and purges completed audit transactions to finalize the audit trail storage
R-GCX146-cbl-00478 (+9) File: GCX146.cbl ETA Date Range Validation by User Type Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ETA Date Range Validation by User Type':
  • Context - a user is processing a train with eta information:
    For Check User Access Level from GCSTBRT-US-CTF-ADD:
    When the system needs to validate eta date ranges, then the user access level is retrieved from gcstbrt user configuration to determine validation parameters.
  • Context - user access level has been retrieved from gcstbrt configuration:
    For User Type = 'S' Special User?:
    When the system checks if gcstbrt-us-ctf-add equals 's', then user is classified as special user with extended eta date range privileges.
  • Context - user is classified as standard user (ctf add access level is not 's'):
    For Apply Standard User Range -2 to +2 days from current date:
    When eta date validation is performed, then eta date must fall between 2 days before current date and 2 days after current date.
  • Context - user is classified as special user (ctf add access level equals 's'):
    For Apply Special User Range -30 to +5 days from current date:
    When eta date validation is performed, then eta date must fall between 30 days before current date and 5 days after current date.
  • Context - an eta date has been provided for validation:
    For Validate ETA Date using ISDATECV:
    When date format validation is performed using isdatecv utility, then eta date must be in valid date format and represent an actual calendar date.
  • Context - eta date format is valid and user-specific date range has been determined:
    For ETA Date within allowed range?:
    When date range validation is performed, then eta date must fall within the calculated minimum and maximum allowed dates for the user type.
  • Context - an eta time has been provided along with valid eta date:
    For Validate Time Format HH:MM:
    When time format validation is performed, then eta time must be in hh:mm format where hh represents hours and mm represents minutes.
  • Context - eta time is in proper hh:mm format:
    For Time within valid range?:
    When time range validation is performed, then hours must be between 00-23 and minutes must be between 00-59.
  • Context - user is standard user and eta date is outside -2 to +2 days range:
    For Generate Error 35 Standard User Date Out of Range:
    When date range validation fails for standard user, then error 35 is generated indicating date is out of range for standard user privileges.
  • Context - user is special user and eta date is outside -30 to +5 days range:
    For Generate Error 25 Special User Date Out of Range:
    When date range validation fails for special user, then error 25 is generated indicating date is out of range even for special user privileges.
👨‍💻 Technical ACs (Gherkin)
Context: A user is processing a train with ETA information
GIVEN
A user is processing a train with ETA information
Applied to: Check User Access Level from GCSTBRT-US-CTF-ADD
WHEN
The system needs to validate ETA date ranges
THEN
The user access level is retrieved from GCSTBRT user configuration to determine validation parameters
Context: User access level has been retrieved from GCSTBRT configuration
GIVEN
User access level has been retrieved from GCSTBRT configuration
Applied to: User Type = 'S' Special User?
WHEN
The system checks if GCSTBRT-US-CTF-ADD equals 'S'
THEN
User is classified as Special User with extended ETA date range privileges
Context: User is classified as Standard User (CTF ADD access level is not 'S')
GIVEN
User is classified as Standard User (CTF ADD access level is not 'S')
Applied to: Apply Standard User Range -2 to +2 days from current date
WHEN
ETA date validation is performed
THEN
ETA date must fall between 2 days before current date and 2 days after current date
Context: User is classified as Special User (CTF ADD access level equals 'S')
GIVEN
User is classified as Special User (CTF ADD access level equals 'S')
Applied to: Apply Special User Range -30 to +5 days from current date
WHEN
ETA date validation is performed
THEN
ETA date must fall between 30 days before current date and 5 days after current date
Context: An ETA date has been provided for validation
GIVEN
An ETA date has been provided for validation
Applied to: Validate ETA Date using ISDATECV
WHEN
Date format validation is performed using ISDATECV utility
THEN
ETA date must be in valid date format and represent an actual calendar date
Context: ETA date format is valid and user-specific date range has been determined
GIVEN
ETA date format is valid and user-specific date range has been determined
Applied to: ETA Date within allowed range?
WHEN
Date range validation is performed
THEN
ETA date must fall within the calculated minimum and maximum allowed dates for the user type
Context: An ETA time has been provided along with valid ETA date
GIVEN
An ETA time has been provided along with valid ETA date
Applied to: Validate Time Format HH:MM
WHEN
Time format validation is performed
THEN
ETA time must be in HH:MM format where HH represents hours and MM represents minutes
Context: ETA time is in proper HH:MM format
GIVEN
ETA time is in proper HH:MM format
Applied to: Time within valid range?
WHEN
Time range validation is performed
THEN
Hours must be between 00-23 and minutes must be between 00-59
Context: User is Standard User and ETA date is outside -2 to +2 days range
GIVEN
User is Standard User and ETA date is outside -2 to +2 days range
Applied to: Generate Error 35 Standard User Date Out of Range
WHEN
Date range validation fails for standard user
THEN
Error 35 is generated indicating date is out of range for standard user privileges
Context: User is Special User and ETA date is outside -30 to +5 days range
GIVEN
User is Special User and ETA date is outside -30 to +5 days range
Applied to: Generate Error 25 Special User Date Out of Range
WHEN
Date range validation fails for special user
THEN
Error 25 is generated indicating date is out of range even for special user privileges
R-GCX146-cbl-00488 (+8) File: GCX146.cbl Train Record Deletion Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Record Deletion Processing':
  • Context - a train record deletion process is initiated:
    For Retrieve Existing Train Record:
    When the system attempts to retrieve an existing train record from the database, then the system determines whether the train record exists or not.
  • Context - a train record exists in the database:
    For Check Record Status:
    When the system checks the record status, then the system identifies whether the record is marked as deleted or active.
  • Context - a train record is marked as deleted:
    For Confirm Deletion Authorization:
    When the system confirms deletion authorization, then the system either grants or denies deletion permission based on authorization rules.
  • Context - deletion is authorized for a train record:
    For Delete Existing Train Record:
    When the system executes the deletion operation, then the train record is permanently removed from the database.
  • Context - a train record deletion operation has been executed:
    For Deletion Successful?:
    When the system checks the deletion result, then the system confirms whether the deletion was successful or failed.
  • Context - a train record has been successfully deleted:
    For Log Deletion Activity:
    When the system logs the deletion activity, then an audit trail entry is created with deletion details and timestamp.
  • Context - a train record exists but is not marked as deleted:
    For Skip Deletion - Record Not Deleted:
    When the system processes the record status, then the deletion process is skipped and processing continues to new record creation.
  • Context - a train record deletion operation has failed:
    For Deletion Error - Abort Process:
    When the system detects the deletion error, then the entire train processing operation is aborted and error handling is initiated.
  • Context - a train record is marked for deletion but authorization is denied:
    For Authorization Failed - Skip Deletion:
    When the system processes the authorization failure, then the deletion is skipped and processing continues to new record creation.
👨‍💻 Technical ACs (Gherkin)
Context: A train record deletion process is initiated
GIVEN
A train record deletion process is initiated
Applied to: Retrieve Existing Train Record
WHEN
The system attempts to retrieve an existing train record from the database
THEN
The system determines whether the train record exists or not
Context: A train record exists in the database
GIVEN
A train record exists in the database
Applied to: Check Record Status
WHEN
The system checks the record status
THEN
The system identifies whether the record is marked as deleted or active
Context: A train record is marked as deleted
GIVEN
A train record is marked as deleted
Applied to: Confirm Deletion Authorization
WHEN
The system confirms deletion authorization
THEN
The system either grants or denies deletion permission based on authorization rules
Context: Deletion is authorized for a train record
GIVEN
Deletion is authorized for a train record
Applied to: Delete Existing Train Record
WHEN
The system executes the deletion operation
THEN
The train record is permanently removed from the database
Context: A train record deletion operation has been executed
GIVEN
A train record deletion operation has been executed
Applied to: Deletion Successful?
WHEN
The system checks the deletion result
THEN
The system confirms whether the deletion was successful or failed
Context: A train record has been successfully deleted
GIVEN
A train record has been successfully deleted
Applied to: Log Deletion Activity
WHEN
The system logs the deletion activity
THEN
An audit trail entry is created with deletion details and timestamp
Context: A train record exists but is not marked as deleted
GIVEN
A train record exists but is not marked as deleted
Applied to: Skip Deletion - Record Not Deleted
WHEN
The system processes the record status
THEN
The deletion process is skipped and processing continues to new record creation
Context: A train record deletion operation has failed
GIVEN
A train record deletion operation has failed
Applied to: Deletion Error - Abort Process
WHEN
The system detects the deletion error
THEN
The entire train processing operation is aborted and error handling is initiated
Context: A train record is marked for deletion but authorization is denied
GIVEN
A train record is marked for deletion but authorization is denied
Applied to: Authorization Failed - Skip Deletion
WHEN
The system processes the authorization failure
THEN
The deletion is skipped and processing continues to new record creation
R-GCX146-cbl-00497 (+6) File: GCX146.cbl Equipment Type Determination Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Type Determination':
  • Context - an equipment record with equipment id and type code is available:
    For Call GCCCARTP Module:
    When the system needs to classify the equipment type, then the gcccartp module is called to determine equipment classification.
  • Context - equipment has been processed by gcccartp module:
    For Set as Container Type:
    When the module classifies the equipment as container type, then the system sets the equipment type as container for processing.
    For Set as Trailer Type:
    When the module classifies the equipment as trailer type, then the system sets the equipment type as trailer for processing.
    For Set as Car Type:
    When the module classifies the equipment as car type, then the system sets the equipment type as car for processing.
  • Context - equipment has been classified as car type:
    For Retrieve Car Type Description from VI Segment:
    When the system needs car type description information, then the car type description is retrieved from the vi segment using the car type code.
  • Context - equipment type has been determined as container, trailer, or car:
    For Assign Equipment Type Code for Processing:
    When the system needs to assign processing type code, then the appropriate equipment type code is assigned based on the classification.
  • Context - equipment type code has been assigned:
    For Set Processing Requirements Based on Type:
    When the system needs to establish processing requirements, then processing requirements are set according to the specific equipment type (container, trailer, or car).
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record with equipment ID and type code is available
GIVEN
An equipment record with equipment ID and type code is available
Applied to: Call GCCCARTP Module
WHEN
The system needs to classify the equipment type
THEN
The GCCCARTP module is called to determine equipment classification
Context: Equipment has been processed by GCCCARTP module
GIVEN
Equipment has been processed by GCCCARTP module
Applied to: Set as Container Type
WHEN
The module classifies the equipment as container type
THEN
The system sets the equipment type as container for processing
Applied to: Set as Trailer Type
WHEN
The module classifies the equipment as trailer type
THEN
The system sets the equipment type as trailer for processing
Applied to: Set as Car Type
WHEN
The module classifies the equipment as car type
THEN
The system sets the equipment type as car for processing
Context: Equipment has been classified as car type
GIVEN
Equipment has been classified as car type
Applied to: Retrieve Car Type Description from VI Segment
WHEN
The system needs car type description information
THEN
The car type description is retrieved from the VI segment using the car type code
Context: Equipment type has been determined as container, trailer, or car
GIVEN
Equipment type has been determined as container, trailer, or car
Applied to: Assign Equipment Type Code for Processing
WHEN
The system needs to assign processing type code
THEN
The appropriate equipment type code is assigned based on the classification
Context: Equipment type code has been assigned
GIVEN
Equipment type code has been assigned
Applied to: Set Processing Requirements Based on Type
WHEN
The system needs to establish processing requirements
THEN
Processing requirements are set according to the specific equipment type (container, trailer, or car)
R-GCX146-cbl-00504 (+13) File: GCX146.cbl Flat Car Container Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Flat Car Container Processing':
  • Context - a flat car equipment type is being processed for train manifest:
    For Access Container Records on Flat Car:
    When the system needs to identify containers loaded on the flat car, then the system accesses container records from the flat car's equipment data.
  • Context - container records are being accessed for a flat car:
    For Container Record Found?:
    When the system searches for container data associated with the flat car, then the system determines if container records exist and proceeds with container processing if found, or completes flat car processing if no containers are found.
  • Context - a container record has been found on the flat car:
    For Extract Container ID from Record:
    When the system needs to identify the specific container, then the system extracts the container id from the container record for individual container processing.
  • Context - a container id has been extracted from a flat car record:
    For Set Flat Car Processing Flag:
    When the system begins processing containers on the flat car, then the system sets a flat car processing flag to track the current processing state.
  • Context - a container id has been extracted and flat car processing flag is set:
    For Perform Container Waybill Lookup:
    When the system needs to find waybill information for the container, then the system performs a waybill lookup using the container id to retrieve associated shipping documentation.
  • Context - a waybill lookup has been performed for a container:
    For Container Waybill Found?:
    When the system evaluates the lookup results, then the system determines if a waybill was found and proceeds with container validation if found, or uses inquiry database lookup if no waybill is found.
  • Context - no waybill was found for a container through primary lookup:
    For Use Inquiry Database for Container:
    When the system needs alternative container information, then the system accesses the inquiry database to retrieve container information.
  • Context - the inquiry database has been accessed for container information:
    For Extract Container Information from T/C XREF:
    When the system needs to extract specific container details, then the system extracts container information from the t/c xref (trailer/container cross reference) data.
  • Context - container information has been retrieved either from waybill lookup or inquiry database:
    For Validate Individual Container:
    When the system processes the container for train manifest inclusion, then the system validates the individual container against train manifest requirements and business rules.
  • Context - a container has been validated successfully:
    For Process Container for Train Manifest:
    When the container needs to be included in the train manifest, then the system processes the container for train manifest inclusion with all required container details.
  • Context - a container has been processed for train manifest on a flat car:
    For More Containers on Flat Car?:
    When the system checks for additional containers on the same flat car, then the system determines if more containers exist and continues processing if found, or completes flat car processing if no more containers exist.
  • Context - more containers exist on the flat car being processed:
    For Get Next Container Record:
    When the system needs to process the next container, then the system retrieves the next container record from the flat car's container data.
  • Context - all containers on a flat car have been processed or no containers were found:
    For Complete Flat Car Processing:
    When the flat car processing workflow reaches completion, then the system completes flat car processing and finalizes all container-related data for the train manifest.
  • Context - an error occurs during container record access or processing:
    For Container Processing Error:
    When the system encounters a container processing error, then the system handles the error appropriately and proceeds to complete flat car processing.
👨‍💻 Technical ACs (Gherkin)
Context: A flat car equipment type is being processed for train manifest
GIVEN
A flat car equipment type is being processed for train manifest
Applied to: Access Container Records on Flat Car
WHEN
The system needs to identify containers loaded on the flat car
THEN
The system accesses container records from the flat car's equipment data
Context: Container records are being accessed for a flat car
GIVEN
Container records are being accessed for a flat car
Applied to: Container Record Found?
WHEN
The system searches for container data associated with the flat car
THEN
The system determines if container records exist and proceeds with container processing if found, or completes flat car processing if no containers are found
Context: A container record has been found on the flat car
GIVEN
A container record has been found on the flat car
Applied to: Extract Container ID from Record
WHEN
The system needs to identify the specific container
THEN
The system extracts the container ID from the container record for individual container processing
Context: A container ID has been extracted from a flat car record
GIVEN
A container ID has been extracted from a flat car record
Applied to: Set Flat Car Processing Flag
WHEN
The system begins processing containers on the flat car
THEN
The system sets a flat car processing flag to track the current processing state
Context: A container ID has been extracted and flat car processing flag is set
GIVEN
A container ID has been extracted and flat car processing flag is set
Applied to: Perform Container Waybill Lookup
WHEN
The system needs to find waybill information for the container
THEN
The system performs a waybill lookup using the container ID to retrieve associated shipping documentation
Context: A waybill lookup has been performed for a container
GIVEN
A waybill lookup has been performed for a container
Applied to: Container Waybill Found?
WHEN
The system evaluates the lookup results
THEN
The system determines if a waybill was found and proceeds with container validation if found, or uses inquiry database lookup if no waybill is found
Context: No waybill was found for a container through primary lookup
GIVEN
No waybill was found for a container through primary lookup
Applied to: Use Inquiry Database for Container
WHEN
The system needs alternative container information
THEN
The system accesses the inquiry database to retrieve container information
Context: The inquiry database has been accessed for container information
GIVEN
The inquiry database has been accessed for container information
Applied to: Extract Container Information from T/C XREF
WHEN
The system needs to extract specific container details
THEN
The system extracts container information from the T/C XREF (Trailer/Container Cross Reference) data
Context: Container information has been retrieved either from waybill lookup or inquiry database
GIVEN
Container information has been retrieved either from waybill lookup or inquiry database
Applied to: Validate Individual Container
WHEN
The system processes the container for train manifest inclusion
THEN
The system validates the individual container against train manifest requirements and business rules
Context: A container has been validated successfully
GIVEN
A container has been validated successfully
Applied to: Process Container for Train Manifest
WHEN
The container needs to be included in the train manifest
THEN
The system processes the container for train manifest inclusion with all required container details
Context: A container has been processed for train manifest on a flat car
GIVEN
A container has been processed for train manifest on a flat car
Applied to: More Containers on Flat Car?
WHEN
The system checks for additional containers on the same flat car
THEN
The system determines if more containers exist and continues processing if found, or completes flat car processing if no more containers exist
Context: More containers exist on the flat car being processed
GIVEN
More containers exist on the flat car being processed
Applied to: Get Next Container Record
WHEN
The system needs to process the next container
THEN
The system retrieves the next container record from the flat car's container data
Context: All containers on a flat car have been processed or no containers were found
GIVEN
All containers on a flat car have been processed or no containers were found
Applied to: Complete Flat Car Processing
WHEN
The flat car processing workflow reaches completion
THEN
The system completes flat car processing and finalizes all container-related data for the train manifest
Context: An error occurs during container record access or processing
GIVEN
An error occurs during container record access or processing
Applied to: Container Processing Error
WHEN
The system encounters a container processing error
THEN
The system handles the error appropriately and proceeds to complete flat car processing
R-GCX146-cbl-00518 (+13) File: GCX146.cbl Waybill Inquiry Database Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Waybill Inquiry Database Processing':
  • Context - primary waybill lookup has failed for equipment:
    For Initialize Inquiry Database Search:
    When system initiates inquiry database search, then initialize inquiry search parameters and clear previous search results.
  • Context - equipment requires waybill information and primary lookup failed:
    For Search SHIPROOT Inquiry Database:
    When system searches shiproot inquiry database, then execute inquiry search using equipment identification parameters.
  • Context - shiproot inquiry database search has been executed:
    For SHIPROOT Inquiry Found?:
    When system evaluates search results, then if waybill record found in shiproot then proceed with data retrieval, otherwise continue to fw-iq database search.
  • Context - shiproot inquiry database contains waybill record for equipment:
    For Retrieve Waybill Data from SHIPROOT-INQ:
    When system retrieves waybill data, then extract waybill details from shiproot-inq record and prepare for processing.
  • Context - shiproot inquiry database search failed to find waybill information:
    For Search FW-IQ Database:
    When system searches fw-iq database, then execute equipment inquiry search in fw-iq database using equipment parameters.
  • Context - fw-iq database search has been executed:
    For FW-IQ Record Found?:
    When system evaluates search results, then if equipment record found in fw-iq then proceed with information extraction, otherwise return waybill not found status.
  • Context - fw-iq database contains equipment record:
    For Extract Equipment Information:
    When system extracts equipment information, then retrieve equipment details from fw-iq record for further processing.
  • Context - equipment information has been extracted from inquiry database:
    For Check for Container on Flat Car:
    When system evaluates equipment configuration, then check if equipment is flat car type with container loading configuration.
  • Context - equipment configuration has been evaluated:
    For Is Flat Car with Containers?:
    When system determines processing requirements, then if equipment is flat car with containers then initiate container t/c xref processing, otherwise proceed with standard waybill processing.
  • Context - equipment is flat car with containers:
    For Process Container T/C XREF Records:
    When system processes container cross-references, then access and process t/c xref records to identify container details.
  • Context - container t/c xref records are being processed:
    For Extract Container IDs from Inquiry:
    When system extracts container identifiers, then retrieve container id numbers from inquiry database records.
  • Context - container ids have been extracted from inquiry records:
    For Set Flat Car Processing Flag:
    When system sets processing indicators, then set flat car processing flag to indicate container handling requirements.
  • Context - waybill information has been successfully retrieved from inquiry database:
    For Return Waybill Information Found:
    When system completes inquiry processing, then return status indicating waybill information found and available for processing.
  • Context - all inquiry database searches have failed to locate waybill information:
    For Return Waybill Not Found:
    When system completes inquiry processing, then return status indicating waybill information not found in inquiry databases.
👨‍💻 Technical ACs (Gherkin)
Context: Primary waybill lookup has failed for equipment
GIVEN
Primary waybill lookup has failed for equipment
Applied to: Initialize Inquiry Database Search
WHEN
System initiates inquiry database search
THEN
Initialize inquiry search parameters and clear previous search results
Context: Equipment requires waybill information and primary lookup failed
GIVEN
Equipment requires waybill information and primary lookup failed
Applied to: Search SHIPROOT Inquiry Database
WHEN
System searches SHIPROOT inquiry database
THEN
Execute inquiry search using equipment identification parameters
Context: SHIPROOT inquiry database search has been executed
GIVEN
SHIPROOT inquiry database search has been executed
Applied to: SHIPROOT Inquiry Found?
WHEN
System evaluates search results
THEN
If waybill record found in SHIPROOT then proceed with data retrieval, otherwise continue to FW-IQ database search
Context: SHIPROOT inquiry database contains waybill record for equipment
GIVEN
SHIPROOT inquiry database contains waybill record for equipment
Applied to: Retrieve Waybill Data from SHIPROOT-INQ
WHEN
System retrieves waybill data
THEN
Extract waybill details from SHIPROOT-INQ record and prepare for processing
Context: SHIPROOT inquiry database search failed to find waybill information
GIVEN
SHIPROOT inquiry database search failed to find waybill information
Applied to: Search FW-IQ Database
WHEN
System searches FW-IQ database
THEN
Execute equipment inquiry search in FW-IQ database using equipment parameters
Context: FW-IQ database search has been executed
GIVEN
FW-IQ database search has been executed
Applied to: FW-IQ Record Found?
WHEN
System evaluates search results
THEN
If equipment record found in FW-IQ then proceed with information extraction, otherwise return waybill not found status
Context: FW-IQ database contains equipment record
GIVEN
FW-IQ database contains equipment record
Applied to: Extract Equipment Information
WHEN
System extracts equipment information
THEN
Retrieve equipment details from FW-IQ record for further processing
Context: Equipment information has been extracted from inquiry database
GIVEN
Equipment information has been extracted from inquiry database
Applied to: Check for Container on Flat Car
WHEN
System evaluates equipment configuration
THEN
Check if equipment is flat car type with container loading configuration
Context: Equipment configuration has been evaluated
GIVEN
Equipment configuration has been evaluated
Applied to: Is Flat Car with Containers?
WHEN
System determines processing requirements
THEN
If equipment is flat car with containers then initiate container T/C XREF processing, otherwise proceed with standard waybill processing
Context: Equipment is flat car with containers
GIVEN
Equipment is flat car with containers
Applied to: Process Container T/C XREF Records
WHEN
System processes container cross-references
THEN
Access and process T/C XREF records to identify container details
Context: Container T/C XREF records are being processed
GIVEN
Container T/C XREF records are being processed
Applied to: Extract Container IDs from Inquiry
WHEN
System extracts container identifiers
THEN
Retrieve container ID numbers from inquiry database records
Context: Container IDs have been extracted from inquiry records
GIVEN
Container IDs have been extracted from inquiry records
Applied to: Set Flat Car Processing Flag
WHEN
System sets processing indicators
THEN
Set flat car processing flag to indicate container handling requirements
Context: Waybill information has been successfully retrieved from inquiry database
GIVEN
Waybill information has been successfully retrieved from inquiry database
Applied to: Return Waybill Information Found
WHEN
System completes inquiry processing
THEN
Return status indicating waybill information found and available for processing
Context: All inquiry database searches have failed to locate waybill information
GIVEN
All inquiry database searches have failed to locate waybill information
Applied to: Return Waybill Not Found
WHEN
System completes inquiry processing
THEN
Return status indicating waybill information not found in inquiry databases
R-GCX146-cbl-00532 (+12) File: GCX146.cbl Equipment Load/Empty Status Validation Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Load/Empty Status Validation':
  • Context - equipment has associated waybill data available:
    For Extract Cargo Origin/Destination from Waybill:
    When system processes equipment for load/empty status determination, then system extracts cargo origin and destination information from waybill to establish baseline load status.
  • Context - equipment input contains load/empty status specifications:
    For Analyze Input Load/Empty Indicator:
    When system analyzes input load/empty indicator, then system captures and processes the specified load/empty status for validation against waybill data.
  • Context - equipment processing requires load/empty status determination:
    For Input Status Specified?:
    When system checks if load/empty status is specified in input, then system determines if explicit status specification exists or if default waybill status should be used.
  • Context - both input status specification and waybill status are available:
    For Compare Input vs Waybill Status:
    When system compares input load/empty status against waybill status, then system identifies matches or discrepancies between specified and waybill-derived status.
  • Context - input status and waybill status have been compared:
    For Status Match?:
    When system evaluates status match results, then system proceeds with cargo movement validation if statuses match or generates warning if they don't match.
  • Context - equipment status matches between input and waybill data:
    For Validate Against Cargo Movement Rules:
    When system validates against cargo movement rules, then system confirms status compliance with cargo movement regulations and business policies.
  • Context - equipment status has been validated against cargo movement rules:
    For Movement Rules Valid?:
    When system evaluates movement rules compliance, then system sets appropriate validated load or empty status based on compliance results.
  • Context - equipment status passes cargo movement rules validation:
    For Set Validated Load Status:
    When system assigns final status for loaded equipment, then system sets validated load status indicating equipment carries cargo.
  • Context - equipment status fails cargo movement rules validation:
    For Set Validated Empty Status:
    When system assigns final status for equipment, then system sets validated empty status indicating equipment carries no cargo.
  • Context - input load/empty status doesn't match waybill-derived status:
    For Generate Status Validation Warning:
    When system processes status mismatch, then system generates status validation warning and uses default waybill status.
  • Context - no input status specified or input status validation fails:
    For Use Default Status from Waybill:
    When system needs to determine equipment load/empty status, then system uses default load/empty status derived from waybill data.
  • Context - status validation process is complete:
    For Assign Final Load/Empty Status:
    When system assigns final load/empty status to equipment, then system sets definitive load/empty status from validated input, default waybill data, or validation results.
  • Context - final load/empty status has been determined:
    For Update Equipment Status Indicators:
    When system updates equipment status indicators, then system records final load/empty status in equipment data for subsequent processing.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment has associated waybill data available
GIVEN
Equipment has associated waybill data available
Applied to: Extract Cargo Origin/Destination from Waybill
WHEN
System processes equipment for load/empty status determination
THEN
System extracts cargo origin and destination information from waybill to establish baseline load status
Context: Equipment input contains load/empty status specifications
GIVEN
Equipment input contains load/empty status specifications
Applied to: Analyze Input Load/Empty Indicator
WHEN
System analyzes input load/empty indicator
THEN
System captures and processes the specified load/empty status for validation against waybill data
Context: Equipment processing requires load/empty status determination
GIVEN
Equipment processing requires load/empty status determination
Applied to: Input Status Specified?
WHEN
System checks if load/empty status is specified in input
THEN
System determines if explicit status specification exists or if default waybill status should be used
Context: Both input status specification and waybill status are available
GIVEN
Both input status specification and waybill status are available
Applied to: Compare Input vs Waybill Status
WHEN
System compares input load/empty status against waybill status
THEN
System identifies matches or discrepancies between specified and waybill-derived status
Context: Input status and waybill status have been compared
GIVEN
Input status and waybill status have been compared
Applied to: Status Match?
WHEN
System evaluates status match results
THEN
System proceeds with cargo movement validation if statuses match or generates warning if they don't match
Context: Equipment status matches between input and waybill data
GIVEN
Equipment status matches between input and waybill data
Applied to: Validate Against Cargo Movement Rules
WHEN
System validates against cargo movement rules
THEN
System confirms status compliance with cargo movement regulations and business policies
Context: Equipment status has been validated against cargo movement rules
GIVEN
Equipment status has been validated against cargo movement rules
Applied to: Movement Rules Valid?
WHEN
System evaluates movement rules compliance
THEN
System sets appropriate validated load or empty status based on compliance results
Context: Equipment status passes cargo movement rules validation
GIVEN
Equipment status passes cargo movement rules validation
Applied to: Set Validated Load Status
WHEN
System assigns final status for loaded equipment
THEN
System sets validated load status indicating equipment carries cargo
Context: Equipment status fails cargo movement rules validation
GIVEN
Equipment status fails cargo movement rules validation
Applied to: Set Validated Empty Status
WHEN
System assigns final status for equipment
THEN
System sets validated empty status indicating equipment carries no cargo
Context: Input load/empty status doesn't match waybill-derived status
GIVEN
Input load/empty status doesn't match waybill-derived status
Applied to: Generate Status Validation Warning
WHEN
System processes status mismatch
THEN
System generates status validation warning and uses default waybill status
Context: No input status specified or input status validation fails
GIVEN
No input status specified or input status validation fails
Applied to: Use Default Status from Waybill
WHEN
System needs to determine equipment load/empty status
THEN
System uses default load/empty status derived from waybill data
Context: Status validation process is complete
GIVEN
Status validation process is complete
Applied to: Assign Final Load/Empty Status
WHEN
System assigns final load/empty status to equipment
THEN
System sets definitive load/empty status from validated input, default waybill data, or validation results
Context: Final load/empty status has been determined
GIVEN
Final load/empty status has been determined
Applied to: Update Equipment Status Indicators
WHEN
System updates equipment status indicators
THEN
System records final load/empty status in equipment data for subsequent processing
R-GCX146-cbl-00558 (+12) File: GCX146.cbl Container Waybill Inquiry Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Waybill Inquiry Processing':
  • Context - a container requires waybill information and primary waybill data is not available:
    For Access FW-IQ Inquiry Database:
    When the system needs to access container waybill data, then the system accesses the fw-iq inquiry database to retrieve container information.
  • Context - the system has accessed the fw-iq inquiry database for a container:
    For Container Record Found?:
    When the system searches for container records, then the system determines if a container record exists and proceeds with extraction if found, or skips processing if not found.
  • Context - a container record exists in the inquiry database:
    For Extract Container ID from T/C XREF:
    When the system processes the container record, then the system extracts the container id from the t/c xref (trailer/container cross reference) data.
  • Context - a container id has been extracted from t/c xref records:
    For Retrieve Container Waybill Data:
    When the system needs detailed waybill information for the container, then the system retrieves container waybill data from the fwswrwr container records.
  • Context - the system has attempted to retrieve container waybill data:
    For Waybill Data Available?:
    When the system checks for waybill data availability, then the system determines if waybill data is available and proceeds with processing if available, or marks as unavailable if not found.
  • Context - container waybill data is available for processing:
    For Process Container Information:
    When the system processes the container information, then the system extracts and processes relevant container business information including equipment details and waybill data.
  • Context - container information has been successfully processed:
    For Set Flat Car Processing Flag:
    When the system identifies equipment as a flat car with containers, then the system sets the flat car processing flag to enable special container handling procedures.
  • Context - the flat car processing flag has been set for container equipment:
    For Extract Equipment Details:
    When the system extracts equipment details, then the system retrieves detailed equipment information including container specifications and transportation data.
  • Context - equipment details have been extracted for containers:
    For Validate Container Sequence:
    When the system validates container sequence information, then the system verifies that container sequence numbers are valid and properly ordered for processing.
  • Context - container sequence has been validated successfully:
    For Build Container Equipment Record:
    When the system builds the container equipment record, then the system creates a complete equipment record containing all validated container information, equipment details, and waybill data.
  • Context - container equipment record has been successfully built or container was not found or waybill data was not available:
    For Container Processing Complete:
    When the container processing reaches completion, then the system marks container waybill inquiry processing as complete and the container is ready for subsequent operations.
  • Context - the system has searched for container records in the fw-iq inquiry database:
    For Container Not Found - Skip:
    When no container record is found for the specified container, then the system skips container processing and proceeds to completion without processing container information.
  • Context - a container id has been extracted but waybill data retrieval was attempted:
    For Waybill Data Not Available:
    When waybill data is not available for the container, then the system proceeds to completion without processing waybill information for the container.
👨‍💻 Technical ACs (Gherkin)
Context: A container requires waybill information and primary waybill data is not available
GIVEN
A container requires waybill information and primary waybill data is not available
Applied to: Access FW-IQ Inquiry Database
WHEN
The system needs to access container waybill data
THEN
The system accesses the FW-IQ inquiry database to retrieve container information
Context: The system has accessed the FW-IQ inquiry database for a container
GIVEN
The system has accessed the FW-IQ inquiry database for a container
Applied to: Container Record Found?
WHEN
The system searches for container records
THEN
The system determines if a container record exists and proceeds with extraction if found, or skips processing if not found
Context: A container record exists in the inquiry database
GIVEN
A container record exists in the inquiry database
Applied to: Extract Container ID from T/C XREF
WHEN
The system processes the container record
THEN
The system extracts the container ID from the T/C XREF (Trailer/Container Cross Reference) data
Context: A container ID has been extracted from T/C XREF records
GIVEN
A container ID has been extracted from T/C XREF records
Applied to: Retrieve Container Waybill Data
WHEN
The system needs detailed waybill information for the container
THEN
The system retrieves container waybill data from the FWSWRWR container records
Context: The system has attempted to retrieve container waybill data
GIVEN
The system has attempted to retrieve container waybill data
Applied to: Waybill Data Available?
WHEN
The system checks for waybill data availability
THEN
The system determines if waybill data is available and proceeds with processing if available, or marks as unavailable if not found
Context: Container waybill data is available for processing
GIVEN
Container waybill data is available for processing
Applied to: Process Container Information
WHEN
The system processes the container information
THEN
The system extracts and processes relevant container business information including equipment details and waybill data
Context: Container information has been successfully processed
GIVEN
Container information has been successfully processed
Applied to: Set Flat Car Processing Flag
WHEN
The system identifies equipment as a flat car with containers
THEN
The system sets the flat car processing flag to enable special container handling procedures
Context: The flat car processing flag has been set for container equipment
GIVEN
The flat car processing flag has been set for container equipment
Applied to: Extract Equipment Details
WHEN
The system extracts equipment details
THEN
The system retrieves detailed equipment information including container specifications and transportation data
Context: Equipment details have been extracted for containers
GIVEN
Equipment details have been extracted for containers
Applied to: Validate Container Sequence
WHEN
The system validates container sequence information
THEN
The system verifies that container sequence numbers are valid and properly ordered for processing
Context: Container sequence has been validated successfully
GIVEN
Container sequence has been validated successfully
Applied to: Build Container Equipment Record
WHEN
The system builds the container equipment record
THEN
The system creates a complete equipment record containing all validated container information, equipment details, and waybill data
Context: Container equipment record has been successfully built or container was not found or waybill data was not available
GIVEN
Container equipment record has been successfully built or container was not found or waybill data was not available
Applied to: Container Processing Complete
WHEN
The container processing reaches completion
THEN
The system marks container waybill inquiry processing as complete and the container is ready for subsequent operations
Context: The system has searched for container records in the FW-IQ inquiry database
GIVEN
The system has searched for container records in the FW-IQ inquiry database
Applied to: Container Not Found - Skip
WHEN
No container record is found for the specified container
THEN
The system skips container processing and proceeds to completion without processing container information
Context: A container ID has been extracted but waybill data retrieval was attempted
GIVEN
A container ID has been extracted but waybill data retrieval was attempted
Applied to: Waybill Data Not Available
WHEN
Waybill data is not available for the container
THEN
The system proceeds to completion without processing waybill information for the container
R-GCX146-cbl-00571 (+11) File: GCX146.cbl Equipment Car Type Determination Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Car Type Determination':
  • Context - an equipment record with a car type code exists:
    For Access VI Segment Table:
    When the system needs to retrieve the car type description, then the system accesses the vi segment table using the car type code and retrieves the corresponding car type description for display purposes.
  • Context - a car type code from equipment information:
    For Car Type Code Found?:
    When the system looks up the car type code in the vi segment table, then if the car type code is found, continue with description retrieval, otherwise flag as equipment type error.
  • Context - equipment information with car type details retrieved from vi segment:
    For Valid Equipment Type?:
    When the system validates the equipment type classification, then if the equipment type is valid and recognized, proceed with edi code assignment, otherwise flag as equipment type error.
  • Context - a validated equipment type classification:
    For Set Equipment Type Code for EDI:
    When the system needs to set edi equipment type codes, then the system assigns the appropriate edi equipment type code based on the car type classification for electronic transactions.
  • Context - valid equipment type with retrieved car type description:
    For Assign Car Type to Trip Sheet Display:
    When the system generates trip sheet displays, then the system assigns the car type description to the trip sheet display fields for proper reporting.
  • Context - equipment with validated type information:
    For Determine Processing Classification:
    When the system needs to determine processing classification, then the system evaluates equipment characteristics to classify as container, trailer, or car type for appropriate processing workflow.
  • Context - equipment undergoing processing classification:
    For Container Type?:
    When the system evaluates if the equipment is a container type, then if equipment is identified as container type, set container processing flag, otherwise continue to trailer type evaluation.
  • Context - equipment that is not classified as container type:
    For Trailer Type?:
    When the system evaluates if the equipment is a trailer type, then if equipment is identified as trailer type, set trailer processing flag, otherwise continue to car type evaluation.
  • Context - equipment that is not classified as container or trailer type:
    For Car Type?:
    When the system evaluates if the equipment is a car type, then if equipment is identified as car type, set car processing flag, otherwise flag as equipment type error.
  • Context - equipment classified as container type:
    For Set Container Processing Flag:
    When the system sets processing flags, then the system sets the container processing flag to enable container-specific processing and completes equipment type determination.
  • Context - equipment classified as trailer type:
    For Set Trailer Processing Flag:
    When the system sets processing flags, then the system sets the trailer processing flag to enable trailer-specific processing and completes equipment type determination.
  • Context - equipment classified as car type:
    For Set Car Processing Flag:
    When the system sets processing flags, then the system sets the car processing flag to enable car-specific processing and completes equipment type determination.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record with a car type code exists
GIVEN
An equipment record with a car type code exists
Applied to: Access VI Segment Table
WHEN
The system needs to retrieve the car type description
THEN
The system accesses the VI segment table using the car type code and retrieves the corresponding car type description for display purposes
Context: A car type code from equipment information
GIVEN
A car type code from equipment information
Applied to: Car Type Code Found?
WHEN
The system looks up the car type code in the VI segment table
THEN
If the car type code is found, continue with description retrieval, otherwise flag as equipment type error
Context: Equipment information with car type details retrieved from VI segment
GIVEN
Equipment information with car type details retrieved from VI segment
Applied to: Valid Equipment Type?
WHEN
The system validates the equipment type classification
THEN
If the equipment type is valid and recognized, proceed with EDI code assignment, otherwise flag as equipment type error
Context: A validated equipment type classification
GIVEN
A validated equipment type classification
Applied to: Set Equipment Type Code for EDI
WHEN
The system needs to set EDI equipment type codes
THEN
The system assigns the appropriate EDI equipment type code based on the car type classification for electronic transactions
Context: Valid equipment type with retrieved car type description
GIVEN
Valid equipment type with retrieved car type description
Applied to: Assign Car Type to Trip Sheet Display
WHEN
The system generates trip sheet displays
THEN
The system assigns the car type description to the trip sheet display fields for proper reporting
Context: Equipment with validated type information
GIVEN
Equipment with validated type information
Applied to: Determine Processing Classification
WHEN
The system needs to determine processing classification
THEN
The system evaluates equipment characteristics to classify as container, trailer, or car type for appropriate processing workflow
Context: Equipment undergoing processing classification
GIVEN
Equipment undergoing processing classification
Applied to: Container Type?
WHEN
The system evaluates if the equipment is a container type
THEN
If equipment is identified as container type, set container processing flag, otherwise continue to trailer type evaluation
Context: Equipment that is not classified as container type
GIVEN
Equipment that is not classified as container type
Applied to: Trailer Type?
WHEN
The system evaluates if the equipment is a trailer type
THEN
If equipment is identified as trailer type, set trailer processing flag, otherwise continue to car type evaluation
Context: Equipment that is not classified as container or trailer type
GIVEN
Equipment that is not classified as container or trailer type
Applied to: Car Type?
WHEN
The system evaluates if the equipment is a car type
THEN
If equipment is identified as car type, set car processing flag, otherwise flag as equipment type error
Context: Equipment classified as container type
GIVEN
Equipment classified as container type
Applied to: Set Container Processing Flag
WHEN
The system sets processing flags
THEN
The system sets the container processing flag to enable container-specific processing and completes equipment type determination
Context: Equipment classified as trailer type
GIVEN
Equipment classified as trailer type
Applied to: Set Trailer Processing Flag
WHEN
The system sets processing flags
THEN
The system sets the trailer processing flag to enable trailer-specific processing and completes equipment type determination
Context: Equipment classified as car type
GIVEN
Equipment classified as car type
Applied to: Set Car Processing Flag
WHEN
The system sets processing flags
THEN
The system sets the car processing flag to enable car-specific processing and completes equipment type determination
R-GCX146-cbl-00583 (+24) File: GCX146.cbl Multi Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Multi':
  • Context - a waybill record is being processed:
    For Identify Bunch Bill Waybill:
    When the system checks the equipment sequence field in the waybill, then if sequence field contains numeric values greater than 1, the waybill is identified as a bunch bill containing multiple cars.
  • Context - a bunch bill waybill has been identified with multiple equipment sequences:
    For Retrieve Next Equipment Record:
    When the system processes equipment records sequentially using fwcmsget, then each subsequent equipment record in the sequence is retrieved and processed until all cars in the bunch bill are handled.
  • Context - an equipment record is being processed from a bunch bill:
    For Check for Additional Cars in Bunch Bill:
    When the system checks the equipment sequence counter against the total sequence count, then if the current sequence number is less than the total sequence count, more cars exist to be processed.
  • Context - an equipment record is retrieved from the bunch bill sequence:
    For Extract Car Identification:
    When the system processes the equipment data, then car identification including car initial, car number, and equipment type is extracted and validated for completeness.
  • Context - multiple cars are identified in a bunch bill waybill:
    For Link Car to Original Waybill:
    When each car is processed individually, then each car maintains a reference to the original waybill number and sequence position for proper tracking and reporting.
  • Context - cars are being processed from a bunch bill waybill:
    For Update Equipment Totals:
    When each car is successfully processed and validated, then equipment totals including car count, loaded count, and empty count are incremented for each valid car in the sequence.
  • Context - a bunch bill with multiple cars is being processed:
    For Complete Bunch Bill Processing:
    When all equipment records in the sequence have been retrieved and processed, then the bunch bill processing is marked as complete and the system proceeds to the next waybill or operation.
  • Context - a broker notification needs to be sent and broker preferences are configured in the system:
    For Check Broker Preferences:
    When the system checks the broker's communication channel preferences, then the system identifies which channels (x12 edi, merlin, internet, fax, paper, email) are available for this broker.
  • Context - a broker notification is being processed:
    For X12 EDI Channel Available?:
    When the system checks if x12 edi channel is available for the broker, then the system returns true if x12 edi is configured and available, otherwise false.
    For Merlin Channel Available?:
    When the system checks if merlin channel is available for the broker, then the system returns true if merlin is configured and available, otherwise false.
    For Internet Channel Available?:
    When the system checks if internet channel is available for the broker, then the system returns true if internet is configured and available, otherwise false.
    For FAX Channel Available?:
    When the system checks if fax channel is available for the broker, then the system returns true if fax is configured and available, otherwise false.
    For Paper Channel Available?:
    When the system checks if paper channel is available for the broker, then the system returns true if paper is configured and available, otherwise false.
    For Email Channel Available?:
    When the system checks if email channel is available for the broker, then the system returns true if email is configured and available, otherwise false.
  • Context - x12 edi channel is available for the broker:
    For Send X12 EDI Notification:
    When the system processes the notification through x12 edi, then the system invokes gccs309c module to send the x12 edi notification.
  • Context - merlin channel is available for the broker:
    For Send Merlin Notification:
    When the system processes the notification through merlin, then the system invokes gcx019 module to send the merlin notification.
  • Context - internet channel is available for the broker:
    For Send Internet Notification:
    When the system processes the notification through internet, then the system invokes gcx019 module to send the internet notification.
  • Context - fax channel is available for the broker:
    For Send FAX Notification:
    When the system processes the notification through fax, then the system invokes gcx019 module to send the fax notification.
  • Context - fax notification has been processed:
    For Auto-FAX Enabled?:
    When the system checks the auto-fax configuration setting, then the system returns true if auto-fax is enabled, otherwise continues to next channel.
  • Context - auto-fax is enabled in system configuration:
    For Setup FAX Routing:
    When the system sets up fax routing, then the system configures fax routing parameters and copy ids for automatic transmission.
  • Context - fax routing is configured with copy ids:
    For Send via FAX with Copy IDs:
    When the system processes auto-fax transmission, then the system invokes emcsend module to send fax with copy ids.
  • Context - paper channel is available for the broker:
    For Generate Paper Notification:
    When the system processes the notification for paper output, then the system generates paper notification using batch print call letters.
  • Context - an email notification is being prepared:
    For Report Exceeds Line Limit?:
    When the system checks the report size against the line limit, then the system returns true if report exceeds 699 lines, otherwise false.
  • Context - email report does not exceed 699 lines:
    For Send Standard Email:
    When the system processes standard email transmission, then the system invokes emcsend3 module to send the complete email notification.
  • Context - email report exceeds 699 lines:
    For Send Email with Continuation:
    When the system processes large email transmission, then the system sends first 699 lines and creates continuation messages with header 'continuation of report...' for remaining content using emcsend3 module.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill record is being processed
GIVEN
A waybill record is being processed
Applied to: Identify Bunch Bill Waybill
WHEN
The system checks the equipment sequence field in the waybill
THEN
If sequence field contains numeric values greater than 1, the waybill is identified as a bunch bill containing multiple cars
Context: A bunch bill waybill has been identified with multiple equipment sequences
GIVEN
A bunch bill waybill has been identified with multiple equipment sequences
Applied to: Retrieve Next Equipment Record
WHEN
The system processes equipment records sequentially using FWCMSGET
THEN
Each subsequent equipment record in the sequence is retrieved and processed until all cars in the bunch bill are handled
Context: An equipment record is being processed from a bunch bill
GIVEN
An equipment record is being processed from a bunch bill
Applied to: Check for Additional Cars in Bunch Bill
WHEN
The system checks the equipment sequence counter against the total sequence count
THEN
If the current sequence number is less than the total sequence count, more cars exist to be processed
Context: An equipment record is retrieved from the bunch bill sequence
GIVEN
An equipment record is retrieved from the bunch bill sequence
Applied to: Extract Car Identification
WHEN
The system processes the equipment data
THEN
Car identification including car initial, car number, and equipment type is extracted and validated for completeness
Context: Multiple cars are identified in a bunch bill waybill
GIVEN
Multiple cars are identified in a bunch bill waybill
Applied to: Link Car to Original Waybill
WHEN
Each car is processed individually
THEN
Each car maintains a reference to the original waybill number and sequence position for proper tracking and reporting
Context: Cars are being processed from a bunch bill waybill
GIVEN
Cars are being processed from a bunch bill waybill
Applied to: Update Equipment Totals
WHEN
Each car is successfully processed and validated
THEN
Equipment totals including car count, loaded count, and empty count are incremented for each valid car in the sequence
Context: A bunch bill with multiple cars is being processed
GIVEN
A bunch bill with multiple cars is being processed
Applied to: Complete Bunch Bill Processing
WHEN
All equipment records in the sequence have been retrieved and processed
THEN
The bunch bill processing is marked as complete and the system proceeds to the next waybill or operation
Context: A broker notification needs to be sent and broker preferences are configured in the system
GIVEN
A broker notification needs to be sent and broker preferences are configured in the system
Applied to: Check Broker Preferences
WHEN
The system checks the broker's communication channel preferences
THEN
The system identifies which channels (X12 EDI, Merlin, Internet, FAX, Paper, Email) are available for this broker
Context: A broker notification is being processed
GIVEN
A broker notification is being processed
Applied to: X12 EDI Channel Available?
WHEN
The system checks if X12 EDI channel is available for the broker
THEN
The system returns true if X12 EDI is configured and available, otherwise false
Applied to: Merlin Channel Available?
WHEN
The system checks if Merlin channel is available for the broker
THEN
The system returns true if Merlin is configured and available, otherwise false
Applied to: Internet Channel Available?
WHEN
The system checks if Internet channel is available for the broker
THEN
The system returns true if Internet is configured and available, otherwise false
Applied to: FAX Channel Available?
WHEN
The system checks if FAX channel is available for the broker
THEN
The system returns true if FAX is configured and available, otherwise false
Applied to: Paper Channel Available?
WHEN
The system checks if Paper channel is available for the broker
THEN
The system returns true if Paper is configured and available, otherwise false
Applied to: Email Channel Available?
WHEN
The system checks if Email channel is available for the broker
THEN
The system returns true if Email is configured and available, otherwise false
Context: X12 EDI channel is available for the broker
GIVEN
X12 EDI channel is available for the broker
Applied to: Send X12 EDI Notification
WHEN
The system processes the notification through X12 EDI
THEN
The system invokes GCCS309C module to send the X12 EDI notification
Context: Merlin channel is available for the broker
GIVEN
Merlin channel is available for the broker
Applied to: Send Merlin Notification
WHEN
The system processes the notification through Merlin
THEN
The system invokes GCX019 module to send the Merlin notification
Context: Internet channel is available for the broker
GIVEN
Internet channel is available for the broker
Applied to: Send Internet Notification
WHEN
The system processes the notification through Internet
THEN
The system invokes GCX019 module to send the Internet notification
Context: FAX channel is available for the broker
GIVEN
FAX channel is available for the broker
Applied to: Send FAX Notification
WHEN
The system processes the notification through FAX
THEN
The system invokes GCX019 module to send the FAX notification
Context: FAX notification has been processed
GIVEN
FAX notification has been processed
Applied to: Auto-FAX Enabled?
WHEN
The system checks the auto-FAX configuration setting
THEN
The system returns true if auto-FAX is enabled, otherwise continues to next channel
Context: Auto-FAX is enabled in system configuration
GIVEN
Auto-FAX is enabled in system configuration
Applied to: Setup FAX Routing
WHEN
The system sets up FAX routing
THEN
The system configures FAX routing parameters and copy IDs for automatic transmission
Context: FAX routing is configured with copy IDs
GIVEN
FAX routing is configured with copy IDs
Applied to: Send via FAX with Copy IDs
WHEN
The system processes auto-FAX transmission
THEN
The system invokes EMCSEND module to send FAX with copy IDs
Context: Paper channel is available for the broker
GIVEN
Paper channel is available for the broker
Applied to: Generate Paper Notification
WHEN
The system processes the notification for paper output
THEN
The system generates paper notification using batch print call letters
Context: An email notification is being prepared
GIVEN
An email notification is being prepared
Applied to: Report Exceeds Line Limit?
WHEN
The system checks the report size against the line limit
THEN
The system returns true if report exceeds 699 lines, otherwise false
Context: Email report does not exceed 699 lines
GIVEN
Email report does not exceed 699 lines
Applied to: Send Standard Email
WHEN
The system processes standard email transmission
THEN
The system invokes EMCSEND3 module to send the complete email notification
Context: Email report exceeds 699 lines
GIVEN
Email report exceeds 699 lines
Applied to: Send Email with Continuation
WHEN
The system processes large email transmission
THEN
The system sends first 699 lines and creates continuation messages with header 'CONTINUATION OF REPORT...' for remaining content using EMCSEND3 module
R-GCX146-cbl-00590 (+11) File: GCX146.cbl Additional Car Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Additional Car Processing':
  • Context - a waybill record exists in the system:
    For Check Waybill for Additional Cars:
    When the system checks the waybill for additional car indicators, then the system identifies if there are multiple cars associated with this waybill that require bunch bill processing.
  • Context - a waybill has been checked for additional cars:
    For Additional Cars Indicated?:
    When additional cars are indicated in the waybill, then the system initiates bunch bill sequence processing, otherwise skips to completion.
  • Context - additional cars have been detected on a waybill:
    For Initialize Bunch Bill Sequence:
    When bunch bill processing is initiated, then the system initializes sequence counters and prepares for sequential car retrieval.
  • Context - bunch bill sequence has been initialized:
    For Retrieve Next Car in Sequence:
    When the system attempts to retrieve the next car in sequence, then the system accesses equipment records to obtain the next car's data.
  • Context - an attempt has been made to retrieve car data:
    For Car Retrieved Successfully?:
    When the system checks the retrieval status, then if successful, proceed with car validation; if unsuccessful, complete bunch bill processing.
  • Context - a car has been successfully retrieved from equipment records:
    For Validate Car Equipment ID:
    When the system validates the car's equipment id, then the equipment id must meet format and business requirements for further processing.
  • Context - a car's equipment id has been validated:
    For Process Car Equipment Data:
    When the system processes the car's equipment data, then all relevant equipment attributes are extracted and prepared for manifest inclusion.
  • Context - car equipment data has been processed:
    For Extract Car Load/Empty Status:
    When the system extracts the load/empty status, then each car is classified as either loaded or empty based on waybill information.
  • Context - a car's load/empty status has been determined:
    For Update Equipment Totals:
    When the system updates equipment totals, then running counts for total equipment, loaded cars, and empty cars are incremented appropriately.
  • Context - equipment totals have been updated for a car:
    For Add Car to Train Manifest:
    When the system adds the car to the train manifest, then the car becomes part of the official train consist with all required documentation.
  • Context - a car has been added to the train manifest:
    For More Cars in Sequence?:
    When the system checks for more cars in the sequence, then if more cars exist, continue processing; if no more cars, complete bunch bill processing.
  • Context - all cars in the bunch bill sequence have been processed or retrieval has failed:
    For Complete Bunch Bill Processing:
    When the system completes bunch bill processing, then all cars from the waybill are properly documented and totals are finalized.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill record exists in the system
GIVEN
A waybill record exists in the system
Applied to: Check Waybill for Additional Cars
WHEN
The system checks the waybill for additional car indicators
THEN
The system identifies if there are multiple cars associated with this waybill that require bunch bill processing
Context: A waybill has been checked for additional cars
GIVEN
A waybill has been checked for additional cars
Applied to: Additional Cars Indicated?
WHEN
Additional cars are indicated in the waybill
THEN
The system initiates bunch bill sequence processing, otherwise skips to completion
Context: Additional cars have been detected on a waybill
GIVEN
Additional cars have been detected on a waybill
Applied to: Initialize Bunch Bill Sequence
WHEN
Bunch bill processing is initiated
THEN
The system initializes sequence counters and prepares for sequential car retrieval
Context: Bunch bill sequence has been initialized
GIVEN
Bunch bill sequence has been initialized
Applied to: Retrieve Next Car in Sequence
WHEN
The system attempts to retrieve the next car in sequence
THEN
The system accesses equipment records to obtain the next car's data
Context: An attempt has been made to retrieve car data
GIVEN
An attempt has been made to retrieve car data
Applied to: Car Retrieved Successfully?
WHEN
The system checks the retrieval status
THEN
If successful, proceed with car validation; if unsuccessful, complete bunch bill processing
Context: A car has been successfully retrieved from equipment records
GIVEN
A car has been successfully retrieved from equipment records
Applied to: Validate Car Equipment ID
WHEN
The system validates the car's equipment ID
THEN
The equipment ID must meet format and business requirements for further processing
Context: A car's equipment ID has been validated
GIVEN
A car's equipment ID has been validated
Applied to: Process Car Equipment Data
WHEN
The system processes the car's equipment data
THEN
All relevant equipment attributes are extracted and prepared for manifest inclusion
Context: Car equipment data has been processed
GIVEN
Car equipment data has been processed
Applied to: Extract Car Load/Empty Status
WHEN
The system extracts the load/empty status
THEN
Each car is classified as either loaded or empty based on waybill information
Context: A car's load/empty status has been determined
GIVEN
A car's load/empty status has been determined
Applied to: Update Equipment Totals
WHEN
The system updates equipment totals
THEN
Running counts for total equipment, loaded cars, and empty cars are incremented appropriately
Context: Equipment totals have been updated for a car
GIVEN
Equipment totals have been updated for a car
Applied to: Add Car to Train Manifest
WHEN
The system adds the car to the train manifest
THEN
The car becomes part of the official train consist with all required documentation
Context: A car has been added to the train manifest
GIVEN
A car has been added to the train manifest
Applied to: More Cars in Sequence?
WHEN
The system checks for more cars in the sequence
THEN
If more cars exist, continue processing; if no more cars, complete bunch bill processing
Context: All cars in the bunch bill sequence have been processed or retrieval has failed
GIVEN
All cars in the bunch bill sequence have been processed or retrieval has failed
Applied to: Complete Bunch Bill Processing
WHEN
The system completes bunch bill processing
THEN
All cars from the waybill are properly documented and totals are finalized
R-GCX146-cbl-00602 (+14) File: GCX146.cbl US Route Status Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US Route Status Processing':
  • Context - equipment requires us customs processing for cross-border movement:
    For Access US Route Database:
    When system accesses the us route database using equipment and waybill information, then us route record is retrieved if it exists in the gcsusrt database.
  • Context - system has attempted to retrieve us route record for equipment:
    For US Route Record Found?:
    When database lookup is completed, then processing continues with bond validation if record exists, or skips us processing if no record found.
  • Context - us route record exists for the equipment:
    For Extract Bond Type Information:
    When system processes the us route record, then bond type, in-transit status, location, and vessel information are extracted for validation.
  • Context - bond type information has been extracted from us route record:
    For Validate Bond Type:
    When system validates the bond type, then bond type must be it (in-transit), tr (transportation), te (temporary export), or mt (merchandise in transit) to be considered valid.
  • Context - bond type has been validated against acceptable types:
    For Bond Type Valid?:
    When system evaluates bond type validity, then processing continues with in-transit status check if valid, or generates bond type warning if invalid.
  • Context - bond type is valid for us customs processing:
    For Check In-Transit Status:
    When system checks the in-transit status from the us route record, then in-transit status information is validated for consistency with current equipment location and movement.
  • Context - in-transit status has been checked for the equipment:
    For Validate Location Information:
    When system validates location information against current equipment position, then location must be consistent with equipment routing and customs requirements.
  • Context - location information has been validated against equipment routing:
    For Location Valid?:
    When system evaluates location validity, then processing continues with vessel validation if location is valid, or generates location warning if invalid.
  • Context - location information is valid for the equipment:
    For Validate Vessel Name:
    When system validates the vessel name from the us route record, then vessel name is checked against expected transportation mode for the current shipment.
  • Context - vessel name has been extracted from the us route record:
    For Vessel is 'TRAIN'?:
    When system checks if vessel name equals 'train', then processing continues normally if vessel is 'train', or generates vessel warning if vessel name indicates different transportation mode.
  • Context - bond type validation has failed for the equipment:
    For Generate Bond Type Warning:
    When system generates bond type warning, then warning message is created indicating invalid bond type and potential customs compliance issue.
  • Context - location validation has failed for the equipment:
    For Generate Location Warning:
    When system generates location warning, then warning message is created indicating location inconsistency and potential routing issue.
  • Context - vessel name does not indicate 'train' transportation mode:
    For Generate Vessel Warning:
    When system generates vessel warning, then warning message is created indicating vessel name inconsistency with rail transportation mode.
  • Context - us route validation processing is complete with any applicable warnings:
    For Set US Status Message:
    When system sets the us status message, then status message includes validation results, warnings, and current customs status for the equipment.
  • Context - us status message has been configured for the equipment:
    For Update Equipment Status:
    When system updates equipment status, then equipment record is updated with us customs status, bond information, and any validation warnings.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment requires US customs processing for cross-border movement
GIVEN
Equipment requires US customs processing for cross-border movement
Applied to: Access US Route Database
WHEN
System accesses the US Route database using equipment and waybill information
THEN
US Route record is retrieved if it exists in the GCSUSRT database
Context: System has attempted to retrieve US Route record for equipment
GIVEN
System has attempted to retrieve US Route record for equipment
Applied to: US Route Record Found?
WHEN
Database lookup is completed
THEN
Processing continues with bond validation if record exists, or skips US processing if no record found
Context: US Route record exists for the equipment
GIVEN
US Route record exists for the equipment
Applied to: Extract Bond Type Information
WHEN
System processes the US Route record
THEN
Bond type, in-transit status, location, and vessel information are extracted for validation
Context: Bond type information has been extracted from US Route record
GIVEN
Bond type information has been extracted from US Route record
Applied to: Validate Bond Type
WHEN
System validates the bond type
THEN
Bond type must be IT (In-Transit), TR (Transportation), TE (Temporary Export), or MT (Merchandise in Transit) to be considered valid
Context: Bond type has been validated against acceptable types
GIVEN
Bond type has been validated against acceptable types
Applied to: Bond Type Valid?
WHEN
System evaluates bond type validity
THEN
Processing continues with in-transit status check if valid, or generates bond type warning if invalid
Context: Bond type is valid for US customs processing
GIVEN
Bond type is valid for US customs processing
Applied to: Check In-Transit Status
WHEN
System checks the in-transit status from the US Route record
THEN
In-transit status information is validated for consistency with current equipment location and movement
Context: In-transit status has been checked for the equipment
GIVEN
In-transit status has been checked for the equipment
Applied to: Validate Location Information
WHEN
System validates location information against current equipment position
THEN
Location must be consistent with equipment routing and customs requirements
Context: Location information has been validated against equipment routing
GIVEN
Location information has been validated against equipment routing
Applied to: Location Valid?
WHEN
System evaluates location validity
THEN
Processing continues with vessel validation if location is valid, or generates location warning if invalid
Context: Location information is valid for the equipment
GIVEN
Location information is valid for the equipment
Applied to: Validate Vessel Name
WHEN
System validates the vessel name from the US Route record
THEN
Vessel name is checked against expected transportation mode for the current shipment
Context: Vessel name has been extracted from the US Route record
GIVEN
Vessel name has been extracted from the US Route record
Applied to: Vessel is 'TRAIN'?
WHEN
System checks if vessel name equals 'TRAIN'
THEN
Processing continues normally if vessel is 'TRAIN', or generates vessel warning if vessel name indicates different transportation mode
Context: Bond type validation has failed for the equipment
GIVEN
Bond type validation has failed for the equipment
Applied to: Generate Bond Type Warning
WHEN
System generates bond type warning
THEN
Warning message is created indicating invalid bond type and potential customs compliance issue
Context: Location validation has failed for the equipment
GIVEN
Location validation has failed for the equipment
Applied to: Generate Location Warning
WHEN
System generates location warning
THEN
Warning message is created indicating location inconsistency and potential routing issue
Context: Vessel name does not indicate 'TRAIN' transportation mode
GIVEN
Vessel name does not indicate 'TRAIN' transportation mode
Applied to: Generate Vessel Warning
WHEN
System generates vessel warning
THEN
Warning message is created indicating vessel name inconsistency with rail transportation mode
Context: US Route validation processing is complete with any applicable warnings
GIVEN
US Route validation processing is complete with any applicable warnings
Applied to: Set US Status Message
WHEN
System sets the US status message
THEN
Status message includes validation results, warnings, and current customs status for the equipment
Context: US status message has been configured for the equipment
GIVEN
US status message has been configured for the equipment
Applied to: Update Equipment Status
WHEN
System updates equipment status
THEN
Equipment record is updated with US customs status, bond information, and any validation warnings
R-GCX146-cbl-00617 (+8) File: GCX146.cbl Canadian Goods Return Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Goods Return Processing':
  • Context - a cargo shipment with origin and destination location information:
    For Identify Canadian Goods from US:
    When the system processes the shipment location data, then the system determines if the goods are canadian goods returning from us by checking if origin is us and destination is canadian province.
  • Context - canadian goods identified as returning from us with valid waybill data:
    For Extract Equipment ID and Waybill Date:
    When the system processes the equipment for return ccn creation, then the system extracts equipment id and waybill date from the waybill record for ccn key construction.
  • Context - equipment id and waybill date extracted from return cargo:
    For Build Return CCN Number:
    When the system creates a new ccn for return processing, then the system builds ccn key with format '6105e' + equipment id + waybill date + sequence number.
  • Context - a new ccn record being created for canadian return goods:
    For Set CCN Status to RETURN:
    When the system populates the ccn status field, then the system sets the ccn status to 'return' to indicate return cargo processing.
  • Context - a ccn record for canadian return goods being processed:
    For Set Transit Status to R:
    When the system sets the transit status indicator, then the system assigns transit status 'r' to indicate return movement.
  • Context - original waybill data with shipper information and a new return ccn record:
    For Populate Shipper Information:
    When the system populates the return ccn with shipper details, then the system copies shipper name and location information from the waybill to the ccn record.
  • Context - original waybill data with consignee information and a new return ccn record:
    For Populate Consignee Information:
    When the system populates the return ccn with consignee details, then the system copies consignee name and location information from the waybill to the ccn record.
  • Context - complete return ccn information including status, shipper, consignee, and equipment details:
    For Insert Return CCN Record:
    When the system attempts to create the ccn database record, then the system inserts the new ccn record into the gcccrt database with application type '33' for canadian customs.
  • Context - an attempt to create a return ccn record in the database:
    For CCN Creation Successful?:
    When the system checks the result of the ccn creation operation, then the system determines success or failure based on the database operation return status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment with origin and destination location information
GIVEN
A cargo shipment with origin and destination location information
Applied to: Identify Canadian Goods from US
WHEN
The system processes the shipment location data
THEN
The system determines if the goods are Canadian goods returning from US by checking if origin is US and destination is Canadian province
Context: Canadian goods identified as returning from US with valid waybill data
GIVEN
Canadian goods identified as returning from US with valid waybill data
Applied to: Extract Equipment ID and Waybill Date
WHEN
The system processes the equipment for return CCN creation
THEN
The system extracts equipment ID and waybill date from the waybill record for CCN key construction
Context: Equipment ID and waybill date extracted from return cargo
GIVEN
Equipment ID and waybill date extracted from return cargo
Applied to: Build Return CCN Number
WHEN
The system creates a new CCN for return processing
THEN
The system builds CCN key with format '6105E' + equipment ID + waybill date + sequence number
Context: A new CCN record being created for Canadian return goods
GIVEN
A new CCN record being created for Canadian return goods
Applied to: Set CCN Status to RETURN
WHEN
The system populates the CCN status field
THEN
The system sets the CCN status to 'RETURN' to indicate return cargo processing
Context: A CCN record for Canadian return goods being processed
GIVEN
A CCN record for Canadian return goods being processed
Applied to: Set Transit Status to R
WHEN
The system sets the transit status indicator
THEN
The system assigns transit status 'R' to indicate return movement
Context: Original waybill data with shipper information and a new return CCN record
GIVEN
Original waybill data with shipper information and a new return CCN record
Applied to: Populate Shipper Information
WHEN
The system populates the return CCN with shipper details
THEN
The system copies shipper name and location information from the waybill to the CCN record
Context: Original waybill data with consignee information and a new return CCN record
GIVEN
Original waybill data with consignee information and a new return CCN record
Applied to: Populate Consignee Information
WHEN
The system populates the return CCN with consignee details
THEN
The system copies consignee name and location information from the waybill to the CCN record
Context: Complete return CCN information including status, shipper, consignee, and equipment details
GIVEN
Complete return CCN information including status, shipper, consignee, and equipment details
Applied to: Insert Return CCN Record
WHEN
The system attempts to create the CCN database record
THEN
The system inserts the new CCN record into the GCCCRT database with application type '33' for Canadian customs
Context: An attempt to create a return CCN record in the database
GIVEN
An attempt to create a return CCN record in the database
Applied to: CCN Creation Successful?
WHEN
The system checks the result of the CCN creation operation
THEN
The system determines success or failure based on the database operation return status
R-GCX146-cbl-00626 File: GCX146.cbl Conveying Car Validation
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Conveying Car Validation':
  • Context - a request to validate equipment as conveying cars for intermodal processing:
    For Conveying Car Validation - Validate equipment as conveying cars for intermodal processing:
    When the system attempts to perform conveying car validation, then the validation logic cannot be determined as the source code is not found in the provided cobol summary.
👨‍💻 Technical ACs (Gherkin)
Context: A request to validate equipment as conveying cars for intermodal processing
GIVEN
A request to validate equipment as conveying cars for intermodal processing
Applied to: Conveying Car Validation - Validate equipment as conveying cars for intermodal processing
WHEN
The system attempts to perform conveying car validation
THEN
The validation logic cannot be determined as the source code is not found in the provided COBOL summary
R-GCX146-cbl-00627 (+8) File: GCX146.cbl Idler Equipment Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Idler Equipment Processing':
  • Context - an equipment record has been retrieved for processing:
    For Check Equipment Type Classification:
    When the system evaluates the equipment type classification, then the equipment is identified as idler type if it meets idler classification criteria.
  • Context - equipment has been classified as idler type:
    For Set Idler Equipment Flag:
    When the system processes the idler equipment classification, then an idler equipment flag is set to indicate special processing requirements.
  • Context - equipment is flagged as idler type:
    For Bypass CCN Database Lookup:
    When the system processes equipment for ccn requirements, then ccn database lookup is bypassed and not performed.
    For Bypass CCN Status Validation:
    When the system processes equipment for ccn status validation, then ccn status validation is bypassed and not performed.
    For Bypass Train Assignment Validation:
    When the system validates equipment train assignments, then train assignment validation is bypassed for the idler equipment.
  • Context - equipment has been processed as idler type:
    For Set Equipment Status as IDLER:
    When the system assigns equipment status, then equipment status is set to idler designation.
  • Context - equipment status has been set as idler:
    For Add to Equipment Totals as Idler:
    When the system calculates equipment totals for reporting, then the equipment is added to totals under the idler category.
  • Context - equipment has been categorized and counted as idler:
    For Generate Equipment Type Message IDLER:
    When the system generates equipment type messages, then an equipment type message with idler designation is generated.
  • Context - equipment type message has been generated for idler equipment:
    For Include in Trip Sheet without CCN:
    When the system creates trip sheet reports, then idler equipment is included in the trip sheet without ccn data requirements.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record has been retrieved for processing
GIVEN
An equipment record has been retrieved for processing
Applied to: Check Equipment Type Classification
WHEN
The system evaluates the equipment type classification
THEN
The equipment is identified as idler type if it meets idler classification criteria
Context: Equipment has been classified as idler type
GIVEN
Equipment has been classified as idler type
Applied to: Set Idler Equipment Flag
WHEN
The system processes the idler equipment classification
THEN
An idler equipment flag is set to indicate special processing requirements
Context: Equipment is flagged as idler type
GIVEN
Equipment is flagged as idler type
Applied to: Bypass CCN Database Lookup
WHEN
The system processes equipment for CCN requirements
THEN
CCN database lookup is bypassed and not performed
Applied to: Bypass CCN Status Validation
WHEN
The system processes equipment for CCN status validation
THEN
CCN status validation is bypassed and not performed
Applied to: Bypass Train Assignment Validation
WHEN
The system validates equipment train assignments
THEN
Train assignment validation is bypassed for the idler equipment
Context: Equipment has been processed as idler type
GIVEN
Equipment has been processed as idler type
Applied to: Set Equipment Status as IDLER
WHEN
The system assigns equipment status
THEN
Equipment status is set to IDLER designation
Context: Equipment status has been set as IDLER
GIVEN
Equipment status has been set as IDLER
Applied to: Add to Equipment Totals as Idler
WHEN
The system calculates equipment totals for reporting
THEN
The equipment is added to totals under the idler category
Context: Equipment has been categorized and counted as idler
GIVEN
Equipment has been categorized and counted as idler
Applied to: Generate Equipment Type Message IDLER
WHEN
The system generates equipment type messages
THEN
An equipment type message with IDLER designation is generated
Context: Equipment type message has been generated for idler equipment
GIVEN
Equipment type message has been generated for idler equipment
Applied to: Include in Trip Sheet without CCN
WHEN
The system creates trip sheet reports
THEN
Idler equipment is included in the trip sheet without CCN data requirements
R-GCX146-cbl-00636 (+5) File: GCX146.cbl Release Information Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Information Processing':
  • Context - a ccn record has a current status of release or csa-dlv:
    For Check Transit Status Code:
    When the transit status code is 'e' (export) or 'z' (export zone), then the cargo status should be classified as 'export' for reporting purposes.
    For Set Status to 'RELEASE':
    When the transit status is not 'e' or 'z' and the release-by field does not contain 's.a.r.', then the cargo status should be classified as 'release' for reporting purposes.
  • Context - a ccn record has a current status of release or csa-dlv and transit status is not 'e' or 'z':
    For Has S.A.R. Release?:
    When the release-by field contains 's.a.r.' (special administrative release), then the cargo status should be classified as 's.a.r.' for reporting purposes.
  • Context - equipment has a ccn status of release or csa-dlv:
    For Increment Release Equipment Totals:
    When processing equipment for verify operation totals, then the total-release counter should be incremented by one.
  • Context - a ccn record exists with status information:
    For Check Transit Status Code:
    When processing the transit status field from the ccn record, then the transit status code should be evaluated to determine appropriate cargo classification.
  • Context - equipment has been processed and status determined:
    For Track Release Status in Trip Sheet:
    When generating trip sheet details for add operations, then the trip sheet should reflect the determined status (export, s.a.r., or release).
👨‍💻 Technical ACs (Gherkin)
Context: A CCN record has a current status of RELEASE or CSA-DLV
GIVEN
A CCN record has a current status of RELEASE or CSA-DLV
Applied to: Check Transit Status Code
WHEN
The transit status code is 'E' (Export) or 'Z' (Export Zone)
THEN
The cargo status should be classified as 'EXPORT' for reporting purposes
Applied to: Set Status to 'RELEASE'
WHEN
The transit status is not 'E' or 'Z' and the release-by field does not contain 'S.A.R.'
THEN
The cargo status should be classified as 'RELEASE' for reporting purposes
Context: A CCN record has a current status of RELEASE or CSA-DLV and transit status is not 'E' or 'Z'
GIVEN
A CCN record has a current status of RELEASE or CSA-DLV and transit status is not 'E' or 'Z'
Applied to: Has S.A.R. Release?
WHEN
The release-by field contains 'S.A.R.' (Special Administrative Release)
THEN
The cargo status should be classified as 'S.A.R.' for reporting purposes
Context: Equipment has a CCN status of RELEASE or CSA-DLV
GIVEN
Equipment has a CCN status of RELEASE or CSA-DLV
Applied to: Increment Release Equipment Totals
WHEN
Processing equipment for VERIFY operation totals
THEN
The TOTAL-RELEASE counter should be incremented by one
Context: A CCN record exists with status information
GIVEN
A CCN record exists with status information
Applied to: Check Transit Status Code
WHEN
Processing the transit status field from the CCN record
THEN
The transit status code should be evaluated to determine appropriate cargo classification
Context: Equipment has been processed and status determined
GIVEN
Equipment has been processed and status determined
Applied to: Track Release Status in Trip Sheet
WHEN
Generating trip sheet details for ADD operations
THEN
The trip sheet should reflect the determined status (EXPORT, S.A.R., or RELEASE)
R-GCX146-cbl-00642 (+16) File: GCX146.cbl Train Transit Status Management Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Transit Status Management':
  • Context - a ccn record exists with a current status value:
    For Check Current Status Value:
    When the system evaluates the current status code, then the system classifies the status as transit, return, export, s.a.r. release, or standard release based on the status code value.
  • Context - a ccn record has current status equal to 't':
    For Set Transit Status to 'TRANSIT':
    When the system processes the transit status classification, then the transit status is set to 'transit' for business reporting.
  • Context - a ccn record has current status equal to 'r':
    For Set Transit Status to 'RETURN':
    When the system processes the transit status classification, then the transit status is set to 'return' for business reporting.
  • Context - a ccn record has release status 'release' or 'csa-dlv' and in-transit status equal to 'e' or 'z':
    For Set Transit Status to 'EXPORT':
    When the system processes the transit status classification, then the transit status is set to 'export' for business reporting.
  • Context - a ccn record has release status 'release' or 'csa-dlv' and release-by field contains 's.a.r.':
    For Set Transit Status to 'S.A.R.':
    When the system processes the transit status classification, then the transit status is set to 's.a.r.' for business reporting.
  • Context - a ccn record has release status 'release' or 'csa-dlv' and does not meet export or s.a.r. criteria:
    For Set Transit Status to 'RELEASE':
    When the system processes the transit status classification, then the transit status is set to 'release' for business reporting.
  • Context - a ccn is being processed for train assignment:
    For Validate CCN Assignment Conflicts:
    When the system checks existing train assignments for the ccn, then the system validates that the ccn is not already assigned to a different train.
  • Context - a ccn is found to be already assigned to a different train:
    For Generate Assignment Conflict Error:
    When the system detects the assignment conflict, then the system generates error 13 indicating the car is already on another train.
  • Context - equipment has been processed and assigned a transit status:
    For Update Equipment Status Totals:
    When the system updates operational totals, then the appropriate status total counter (total-release, total-haulage, total-proceed, total-held-ccra, total-held-docs) is incremented based on the equipment's final status classification.
  • Context - a ccn record exists with transit status information:
    For Check CCN Transit Status:
    When the system checks the ccn transit status field, then if transit status equals 't', the ccn is classified as in-transit cargo, otherwise it proceeds to assignment conflict validation.
  • Context - a ccn exists and needs to be assigned to a train:
    For CCN Already Assigned to Another Train?:
    When the system checks if the ccn is already assigned to another train, then if the ccn is already assigned to a different train, generate assignment conflict error, otherwise proceed with status evaluation.
  • Context - a ccn has status 'release' and contains transit code information:
    For Transit Code = 'E' or 'Z'?:
    When the transit code is 'e' or 'z', then set the display status to 'export' for reporting purposes.
  • Context - a ccn has status 'release' and transit code is not 'e' or 'z':
    For Transit Code = 'S.A.R.'?:
    When the transit code equals 's.a.r.', then set the display status to 's.a.r.' for reporting purposes.
  • Context - a ccn has status 'release' and transit code is neither 'e', 'z', nor 's.a.r.':
    For Set Status to 'RELEASE':
    When no special transit code conditions are met, then set the display status to 'release' for reporting purposes.
  • Context - a ccn does not have 'release' status:
    For Transit Status = 'R'?:
    When the transit status equals 'r', then set the display status to 'return' for reporting purposes.
  • Context - a ccn does not have 'release' status and transit status is not 'r':
    For Set Status to 'TRANSIT':
    When no other status classification rules apply, then set the display status to 'transit' for reporting purposes.
  • Context - a ccn exists with equipment id and waybill information:
    For CCN Usable for Train?:
    When the system validates ccn usability by checking if equipment id matches and either waybill number matches or new bond created flag is 'y', then if validation fails, mark ccn as unusable and report 'ccn found not usable' for verify operations, otherwise allow ccn usage.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN record exists with a current status value
GIVEN
A CCN record exists with a current status value
Applied to: Check Current Status Value
WHEN
The system evaluates the current status code
THEN
The system classifies the status as Transit, Return, Export, S.A.R. Release, or standard Release based on the status code value
Context: A CCN record has current status equal to 'T'
GIVEN
A CCN record has current status equal to 'T'
Applied to: Set Transit Status to 'TRANSIT'
WHEN
The system processes the transit status classification
THEN
The transit status is set to 'TRANSIT' for business reporting
Context: A CCN record has current status equal to 'R'
GIVEN
A CCN record has current status equal to 'R'
Applied to: Set Transit Status to 'RETURN'
WHEN
The system processes the transit status classification
THEN
The transit status is set to 'RETURN' for business reporting
Context: A CCN record has release status 'RELEASE' or 'CSA-DLV' and in-transit status equal to 'E' or 'Z'
GIVEN
A CCN record has release status 'RELEASE' or 'CSA-DLV' and in-transit status equal to 'E' or 'Z'
Applied to: Set Transit Status to 'EXPORT'
WHEN
The system processes the transit status classification
THEN
The transit status is set to 'EXPORT' for business reporting
Context: A CCN record has release status 'RELEASE' or 'CSA-DLV' and release-by field contains 'S.A.R.'
GIVEN
A CCN record has release status 'RELEASE' or 'CSA-DLV' and release-by field contains 'S.A.R.'
Applied to: Set Transit Status to 'S.A.R.'
WHEN
The system processes the transit status classification
THEN
The transit status is set to 'S.A.R.' for business reporting
Context: A CCN record has release status 'RELEASE' or 'CSA-DLV' and does not meet export or S.A.R. criteria
GIVEN
A CCN record has release status 'RELEASE' or 'CSA-DLV' and does not meet export or S.A.R. criteria
Applied to: Set Transit Status to 'RELEASE'
WHEN
The system processes the transit status classification
THEN
The transit status is set to 'RELEASE' for business reporting
Context: A CCN is being processed for train assignment
GIVEN
A CCN is being processed for train assignment
Applied to: Validate CCN Assignment Conflicts
WHEN
The system checks existing train assignments for the CCN
THEN
The system validates that the CCN is not already assigned to a different train
Context: A CCN is found to be already assigned to a different train
GIVEN
A CCN is found to be already assigned to a different train
Applied to: Generate Assignment Conflict Error
WHEN
The system detects the assignment conflict
THEN
The system generates error 13 indicating the car is already on another train
Context: Equipment has been processed and assigned a transit status
GIVEN
Equipment has been processed and assigned a transit status
Applied to: Update Equipment Status Totals
WHEN
The system updates operational totals
THEN
The appropriate status total counter (TOTAL-RELEASE, TOTAL-HAULAGE, TOTAL-PROCEED, TOTAL-HELD-CCRA, TOTAL-HELD-DOCS) is incremented based on the equipment's final status classification
Context: A CCN record exists with transit status information
GIVEN
A CCN record exists with transit status information
Applied to: Check CCN Transit Status
WHEN
The system checks the CCN transit status field
THEN
If transit status equals 'T', the CCN is classified as in-transit cargo, otherwise it proceeds to assignment conflict validation
Context: A CCN exists and needs to be assigned to a train
GIVEN
A CCN exists and needs to be assigned to a train
Applied to: CCN Already Assigned to Another Train?
WHEN
The system checks if the CCN is already assigned to another train
THEN
If the CCN is already assigned to a different train, generate assignment conflict error, otherwise proceed with status evaluation
Context: A CCN has status 'RELEASE' and contains transit code information
GIVEN
A CCN has status 'RELEASE' and contains transit code information
Applied to: Transit Code = 'E' or 'Z'?
WHEN
The transit code is 'E' or 'Z'
THEN
Set the display status to 'EXPORT' for reporting purposes
Context: A CCN has status 'RELEASE' and transit code is not 'E' or 'Z'
GIVEN
A CCN has status 'RELEASE' and transit code is not 'E' or 'Z'
Applied to: Transit Code = 'S.A.R.'?
WHEN
The transit code equals 'S.A.R.'
THEN
Set the display status to 'S.A.R.' for reporting purposes
Context: A CCN has status 'RELEASE' and transit code is neither 'E', 'Z', nor 'S.A.R.'
GIVEN
A CCN has status 'RELEASE' and transit code is neither 'E', 'Z', nor 'S.A.R.'
Applied to: Set Status to 'RELEASE'
WHEN
No special transit code conditions are met
THEN
Set the display status to 'RELEASE' for reporting purposes
Context: A CCN does not have 'RELEASE' status
GIVEN
A CCN does not have 'RELEASE' status
Applied to: Transit Status = 'R'?
WHEN
The transit status equals 'R'
THEN
Set the display status to 'RETURN' for reporting purposes
Context: A CCN does not have 'RELEASE' status and transit status is not 'R'
GIVEN
A CCN does not have 'RELEASE' status and transit status is not 'R'
Applied to: Set Status to 'TRANSIT'
WHEN
No other status classification rules apply
THEN
Set the display status to 'TRANSIT' for reporting purposes
Context: A CCN exists with equipment ID and waybill information
GIVEN
A CCN exists with equipment ID and waybill information
Applied to: CCN Usable for Train?
WHEN
The system validates CCN usability by checking if equipment ID matches and either waybill number matches or new bond created flag is 'Y'
THEN
If validation fails, mark CCN as unusable and report 'CCN FOUND NOT USABLE' for VERIFY operations, otherwise allow CCN usage
R-GCX146-cbl-00651 (+8) File: GCX146.cbl Haulage Rights Validation Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Haulage Rights Validation':
  • Context - an equipment record exists in the system:
    For Retrieve Equipment SCAC Code:
    When the system processes equipment for haulage rights validation, then the equipment's scac code is retrieved from the equipment record for validation purposes.
  • Context - an equipment scac code has been retrieved:
    For SCAC Code Valid?:
    When the system validates the scac code against authorized carriers, then the system determines if the scac code is valid for haulage rights processing.
  • Context - a valid scac code exists for the equipment:
    For Haulage Rights Authorized?:
    When the system checks haulage rights authorization for the scac, then the system determines if haulage rights are authorized for this scac code.
  • Context - equipment has valid scac code and authorized haulage rights:
    For Set Haulage Rights Flag:
    When the system processes the equipment for haulage validation, then the haulage rights flag is set to indicate authorized haulage status.
  • Context - equipment has been validated with haulage rights authorization:
    For Increment Haulage Total Counter:
    When the haulage rights flag is set for the equipment, then the total haulage counter is incremented by one.
  • Context - equipment has validated haulage rights and the counter has been incremented:
    For Update Equipment Status as Haulage:
    When the system updates equipment processing status, then the equipment status is updated to indicate haulage rights authorization.
  • Context - equipment has an invalid scac code:
    For Generate SCAC Access Error:
    When the system validates scac code for haulage rights, then a scac access error is generated indicating invalid authorization.
  • Context - equipment has valid scac code but lacks haulage rights authorization:
    For Set Invalid Haulage Status:
    When the system processes haulage rights validation, then the equipment status is set to indicate invalid haulage rights.
  • Context - equipment fails either scac validation or haulage rights authorization:
    For Log Validation Failure:
    When the system encounters validation failure, then the validation failure is logged for audit and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record exists in the system
GIVEN
An equipment record exists in the system
Applied to: Retrieve Equipment SCAC Code
WHEN
The system processes equipment for haulage rights validation
THEN
The equipment's SCAC code is retrieved from the equipment record for validation purposes
Context: An equipment SCAC code has been retrieved
GIVEN
An equipment SCAC code has been retrieved
Applied to: SCAC Code Valid?
WHEN
The system validates the SCAC code against authorized carriers
THEN
The system determines if the SCAC code is valid for haulage rights processing
Context: A valid SCAC code exists for the equipment
GIVEN
A valid SCAC code exists for the equipment
Applied to: Haulage Rights Authorized?
WHEN
The system checks haulage rights authorization for the SCAC
THEN
The system determines if haulage rights are authorized for this SCAC code
Context: Equipment has valid SCAC code and authorized haulage rights
GIVEN
Equipment has valid SCAC code and authorized haulage rights
Applied to: Set Haulage Rights Flag
WHEN
The system processes the equipment for haulage validation
THEN
The haulage rights flag is set to indicate authorized haulage status
Context: Equipment has been validated with haulage rights authorization
GIVEN
Equipment has been validated with haulage rights authorization
Applied to: Increment Haulage Total Counter
WHEN
The haulage rights flag is set for the equipment
THEN
The total haulage counter is incremented by one
Context: Equipment has validated haulage rights and the counter has been incremented
GIVEN
Equipment has validated haulage rights and the counter has been incremented
Applied to: Update Equipment Status as Haulage
WHEN
The system updates equipment processing status
THEN
The equipment status is updated to indicate haulage rights authorization
Context: Equipment has an invalid SCAC code
GIVEN
Equipment has an invalid SCAC code
Applied to: Generate SCAC Access Error
WHEN
The system validates SCAC code for haulage rights
THEN
A SCAC access error is generated indicating invalid authorization
Context: Equipment has valid SCAC code but lacks haulage rights authorization
GIVEN
Equipment has valid SCAC code but lacks haulage rights authorization
Applied to: Set Invalid Haulage Status
WHEN
The system processes haulage rights validation
THEN
The equipment status is set to indicate invalid haulage rights
Context: Equipment fails either SCAC validation or haulage rights authorization
GIVEN
Equipment fails either SCAC validation or haulage rights authorization
Applied to: Log Validation Failure
WHEN
The system encounters validation failure
THEN
The validation failure is logged for audit and tracking purposes
R-GCX146-cbl-00660 (+8) File: GCX146.cbl Equipment Status Totals Management Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Status Totals Management':
  • Context - an equipment record is being processed for status totals:
    For Increment TOTAL-RELEASE Counter:
    When the equipment ccn status is 'release' or 'csa-dlv', then the total-release counter should be incremented by 1.
    For Increment TOTAL-HAULAGE Counter:
    When the equipment has haulage flag set to 'y' or manual haulage flag set to 'y', then the total-haulage counter should be incremented by 1.
    For Increment TOTAL-HELD-CCRA Counter:
    When the equipment ccn status is 'hold' or 'agi-hold', then the total-held-ccra counter should be incremented by 1.
    For Increment TOTAL-PROCEED Counter:
    When the equipment ccn status is 'return' or the manifest from station is different from the manifest to station and the status is not 'error', 'reject', or 'deleted', then the total-proceed counter should be incremented by 1.
    For Increment TOTAL-HELD-DOCS Counter:
    When the manifest from station equals the manifest to station and the broker entry field is empty, then the total-held-docs counter should be incremented by 1.
  • Context - an equipment record is being processed:
    For Process Equipment Record:
    When any equipment record is encountered during processing, then the total-equip counter should be incremented by 1.
  • Context - an equipment record has been categorized by status:
    For Update Status Report Fields:
    When the equipment has a valid ccn and is not a loaded or empty car without proper documentation, then the status report should be populated with equipment id, manifest station names, and transit status where transit status shows 'transit' if in-transit status is 't'.
  • Context - equipment status processing is in progress:
    For More Equipment Records?:
    When the current equipment record has been processed and categorized, then if more equipment records exist in the train consist, continue processing the next record, otherwise proceed to calculate final totals.
  • Context - all equipment records have been processed and categorized:
    For Calculate Final Equipment Totals:
    When no more equipment records remain to be processed, then all status counters (total-release, total-haulage, total-held-ccra, total-proceed, total-held-docs, total-equip) should be finalized for summary reporting.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record is being processed for status totals
GIVEN
An equipment record is being processed for status totals
Applied to: Increment TOTAL-RELEASE Counter
WHEN
The equipment CCN status is 'RELEASE' or 'CSA-DLV'
THEN
The TOTAL-RELEASE counter should be incremented by 1
Applied to: Increment TOTAL-HAULAGE Counter
WHEN
The equipment has haulage flag set to 'Y' or manual haulage flag set to 'Y'
THEN
The TOTAL-HAULAGE counter should be incremented by 1
Applied to: Increment TOTAL-HELD-CCRA Counter
WHEN
The equipment CCN status is 'HOLD' or 'AGI-HOLD'
THEN
The TOTAL-HELD-CCRA counter should be incremented by 1
Applied to: Increment TOTAL-PROCEED Counter
WHEN
The equipment CCN status is 'RETURN' or the manifest from station is different from the manifest to station and the status is not 'ERROR', 'REJECT', or 'DELETED'
THEN
The TOTAL-PROCEED counter should be incremented by 1
Applied to: Increment TOTAL-HELD-DOCS Counter
WHEN
The manifest from station equals the manifest to station and the broker entry field is empty
THEN
The TOTAL-HELD-DOCS counter should be incremented by 1
Context: An equipment record is being processed
GIVEN
An equipment record is being processed
Applied to: Process Equipment Record
WHEN
Any equipment record is encountered during processing
THEN
The TOTAL-EQUIP counter should be incremented by 1
Context: An equipment record has been categorized by status
GIVEN
An equipment record has been categorized by status
Applied to: Update Status Report Fields
WHEN
The equipment has a valid CCN and is not a loaded or empty car without proper documentation
THEN
The status report should be populated with equipment ID, manifest station names, and transit status where transit status shows 'TRANSIT' if in-transit status is 'T'
Context: Equipment status processing is in progress
GIVEN
Equipment status processing is in progress
Applied to: More Equipment Records?
WHEN
The current equipment record has been processed and categorized
THEN
If more equipment records exist in the train consist, continue processing the next record, otherwise proceed to calculate final totals
Context: All equipment records have been processed and categorized
GIVEN
All equipment records have been processed and categorized
Applied to: Calculate Final Equipment Totals
WHEN
No more equipment records remain to be processed
THEN
All status counters (TOTAL-RELEASE, TOTAL-HAULAGE, TOTAL-HELD-CCRA, TOTAL-PROCEED, TOTAL-HELD-DOCS, TOTAL-EQUIP) should be finalized for summary reporting
R-GCX146-cbl-00669 (+13) File: GCX146.cbl AEI Train Send Logging Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AEI Train Send Logging':
  • Context - an aei train send operation is being processed:
    For Get Email User Lists from Station Configuration:
    When the system needs to determine email recipients for the aei report, then the system retrieves email user lists from the station configuration database (gcstbrt) based on the train's station information.
  • Context - an aei report has been generated with content lines:
    For Check Report Size:
    When the system prepares to send the report via email, then the system counts the total number of lines in the report to determine if special handling is required.
  • Context - an aei report has been sized and line count determined:
    For Report > 699 Lines?:
    When the report contains more than 699 lines, then the system initiates large report processing with continuation logic, otherwise uses standard single-message processing.
  • Context - an aei report contains 699 lines or fewer:
    For Process Standard AEI Report:
    When the system processes the report for email transmission, then the system prepares the entire report as a single email message without continuation headers.
  • Context - an aei report contains more than 699 lines:
    For Process Large Report with Continuation:
    When the system processes the report for email transmission, then the system splits the report into multiple email messages, each containing up to 699 lines with appropriate continuation headers.
  • Context - an aei report message batch is prepared for transmission:
    For Send Current Batch via EMCSEND3:
    When the system initiates email sending, then the system calls emcsend3 service to transmit the email message to the configured recipients.
  • Context - a batch of aei report lines has been sent via email:
    For Reset Message Buffer:
    When more lines remain to be processed in a large report, then the system clears the current message buffer to prepare for the next continuation segment.
  • Context - a large aei report requires multiple email messages:
    For Add Continuation Header:
    When the system prepares continuation messages after the first message, then the system adds 'continuation of report....' header to identify the message as part of a multi-part report.
  • Context - a batch of lines from a large aei report has been processed:
    For More Lines to Process?:
    When the system checks for remaining content, then if more lines exist beyond the current batch, the system continues processing with the next batch, otherwise completes the report transmission.
  • Context - an aei report email has been sent via emcsend3:
    For Check Email Transmission Status:
    When the system receives the transmission response, then the system evaluates the response to determine if the email was successfully delivered or if fallback procedures are needed.
  • Context - an aei report email transmission attempt has completed:
    For Email Successful?:
    When the system evaluates the transmission status, then if transmission failed, the system initiates fallback email procedures, otherwise proceeds with normal aei logging activities.
  • Context - primary aei report email transmission has failed:
    For Use Fallback Email OM01247/AEI9999:
    When the system needs to ensure report delivery, then the system sends the aei report to fallback email addresses om01247 and aei9999 to ensure delivery to support personnel.
  • Context - an aei report transmission has been completed (successfully or via fallback):
    For Log AEI Transmission Activity:
    When the system finalizes the transmission process, then the system creates audit log entries recording the aei transmission activity, including transmission status and recipient information.
  • Context - aei transmission activities have been logged:
    For Update AEI Send Status:
    When the system completes the aei send process, then the system updates the aei send status in the relevant system records to reflect the completion of the transmission process.
👨‍💻 Technical ACs (Gherkin)
Context: An AEI train send operation is being processed
GIVEN
An AEI train send operation is being processed
Applied to: Get Email User Lists from Station Configuration
WHEN
The system needs to determine email recipients for the AEI report
THEN
The system retrieves email user lists from the station configuration database (GCSTBRT) based on the train's station information
Context: An AEI report has been generated with content lines
GIVEN
An AEI report has been generated with content lines
Applied to: Check Report Size
WHEN
The system prepares to send the report via email
THEN
The system counts the total number of lines in the report to determine if special handling is required
Context: An AEI report has been sized and line count determined
GIVEN
An AEI report has been sized and line count determined
Applied to: Report > 699 Lines?
WHEN
The report contains more than 699 lines
THEN
The system initiates large report processing with continuation logic, otherwise uses standard single-message processing
Context: An AEI report contains 699 lines or fewer
GIVEN
An AEI report contains 699 lines or fewer
Applied to: Process Standard AEI Report
WHEN
The system processes the report for email transmission
THEN
The system prepares the entire report as a single email message without continuation headers
Context: An AEI report contains more than 699 lines
GIVEN
An AEI report contains more than 699 lines
Applied to: Process Large Report with Continuation
WHEN
The system processes the report for email transmission
THEN
The system splits the report into multiple email messages, each containing up to 699 lines with appropriate continuation headers
Context: An AEI report message batch is prepared for transmission
GIVEN
An AEI report message batch is prepared for transmission
Applied to: Send Current Batch via EMCSEND3
WHEN
The system initiates email sending
THEN
The system calls EMCSEND3 service to transmit the email message to the configured recipients
Context: A batch of AEI report lines has been sent via email
GIVEN
A batch of AEI report lines has been sent via email
Applied to: Reset Message Buffer
WHEN
More lines remain to be processed in a large report
THEN
The system clears the current message buffer to prepare for the next continuation segment
Context: A large AEI report requires multiple email messages
GIVEN
A large AEI report requires multiple email messages
Applied to: Add Continuation Header
WHEN
The system prepares continuation messages after the first message
THEN
The system adds 'CONTINUATION OF REPORT....' header to identify the message as part of a multi-part report
Context: A batch of lines from a large AEI report has been processed
GIVEN
A batch of lines from a large AEI report has been processed
Applied to: More Lines to Process?
WHEN
The system checks for remaining content
THEN
If more lines exist beyond the current batch, the system continues processing with the next batch, otherwise completes the report transmission
Context: An AEI report email has been sent via EMCSEND3
GIVEN
An AEI report email has been sent via EMCSEND3
Applied to: Check Email Transmission Status
WHEN
The system receives the transmission response
THEN
The system evaluates the response to determine if the email was successfully delivered or if fallback procedures are needed
Context: An AEI report email transmission attempt has completed
GIVEN
An AEI report email transmission attempt has completed
Applied to: Email Successful?
WHEN
The system evaluates the transmission status
THEN
If transmission failed, the system initiates fallback email procedures, otherwise proceeds with normal AEI logging activities
Context: Primary AEI report email transmission has failed
GIVEN
Primary AEI report email transmission has failed
Applied to: Use Fallback Email OM01247/AEI9999
WHEN
The system needs to ensure report delivery
THEN
The system sends the AEI report to fallback email addresses OM01247 and AEI9999 to ensure delivery to support personnel
Context: An AEI report transmission has been completed (successfully or via fallback)
GIVEN
An AEI report transmission has been completed (successfully or via fallback)
Applied to: Log AEI Transmission Activity
WHEN
The system finalizes the transmission process
THEN
The system creates audit log entries recording the AEI transmission activity, including transmission status and recipient information
Context: AEI transmission activities have been logged
GIVEN
AEI transmission activities have been logged
Applied to: Update AEI Send Status
WHEN
The system completes the AEI send process
THEN
The system updates the AEI send status in the relevant system records to reflect the completion of the transmission process
R-GCX146-cbl-00683 (+16) File: GCX146.cbl Trip Sheet Distribution Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Trip Sheet Distribution':
  • Context - a trip sheet needs to be distributed:
    For Check Distribution Configuration:
    When the system checks the distribution configuration, then the system identifies whether auto-fax is enabled based on station configuration.
  • Context - auto-fax distribution is enabled:
    For Setup FAX Routing Parameters:
    When the system sets up fax routing, then fax routing parameters are configured from station configuration data.
  • Context - trip sheet distribution is required:
    For Configure Merlin Transmission:
    When the system configures merlin transmission, then merlin transmission parameters are set up for report delivery.
  • Context - a canadian trip sheet is ready for distribution and merlin is configured:
    For Send Canadian Trip Sheet via Merlin:
    When the system sends the trip sheet via merlin, then the canadian trip sheet is transmitted to customs and authorized recipients through merlin system.
  • Context - a trip sheet distribution is in progress:
    For US Trip Sheet Required?:
    When the system evaluates if us trip sheet is required, then the system determines us trip sheet requirement based on cargo destination being us territory.
  • Context - us trip sheet is required:
    For Prepare US Trip Sheet Data:
    When the system prepares us trip sheet data, then us-specific trip sheet data is formatted with appropriate customs and regulatory information.
  • Context - us trip sheet data is prepared and merlin is configured:
    For Send US Trip Sheet via Merlin:
    When the system sends the us trip sheet via merlin, then the us trip sheet is transmitted to us customs and authorized recipients through merlin system.
  • Context - trip sheet distribution is in progress:
    For Check AEI Report Distribution:
    When the system checks for aei report distribution requirements, then the system identifies if aei report distribution is needed based on train type and configuration.
  • Context - aei report distribution is being processed:
    For Email Distribution Required?:
    When the system evaluates email distribution requirements, then the system determines if email distribution is required based on station configuration and recipient preferences.
  • Context - email distribution is required:
    For Get Email User Lists from Station Config:
    When the system retrieves email user lists, then email distribution lists are obtained from station configuration data including authorized recipients.
  • Context - email user lists are retrieved and aei report is ready:
    For Send AEI Report via Email:
    When the system sends the aei report via email, then the aei report is distributed via email to all configured recipients with proper formatting.
  • Context - an aei report is being sent via email:
    For Large Report?:
    When the system checks the report size, then the system determines if the report exceeds 699 lines requiring continuation message handling.
  • Context - a report exceeds the maximum line limit of 699 lines:
    For Handle Report Continuation:
    When the system handles report continuation, then the system creates multiple email messages with continuation headers and distributes the complete report across multiple messages.
  • Context - fax routing parameters are configured:
    For Setup External FAX Addressing:
    When the system sets up external fax addressing, then external fax addresses are configured for customs and authorized recipients based on routing parameters.
  • Context - external fax addressing is set up:
    For Route to Copy IDs:
    When the system routes to copy ids, then trip sheets are routed to all configured copy recipients based on distribution configuration.
  • Context - trip sheets are prepared and routing is configured:
    For Transmit to Customs Systems:
    When the system transmits to customs systems, then trip sheets are transmitted to appropriate customs systems (canadian and/or us) for regulatory processing.
  • Context - customs systems transmission is complete:
    For Transmit to Authorized Recipients:
    When the system transmits to authorized recipients, then trip sheets are transmitted to all authorized recipients including brokers, agents, and other stakeholders.
👨‍💻 Technical ACs (Gherkin)
Context: A trip sheet needs to be distributed
GIVEN
A trip sheet needs to be distributed
Applied to: Check Distribution Configuration
WHEN
The system checks the distribution configuration
THEN
The system identifies whether auto-FAX is enabled based on station configuration
Context: Auto-FAX distribution is enabled
GIVEN
Auto-FAX distribution is enabled
Applied to: Setup FAX Routing Parameters
WHEN
The system sets up FAX routing
THEN
FAX routing parameters are configured from station configuration data
Context: Trip sheet distribution is required
GIVEN
Trip sheet distribution is required
Applied to: Configure Merlin Transmission
WHEN
The system configures Merlin transmission
THEN
Merlin transmission parameters are set up for report delivery
Context: A Canadian trip sheet is ready for distribution and Merlin is configured
GIVEN
A Canadian trip sheet is ready for distribution and Merlin is configured
Applied to: Send Canadian Trip Sheet via Merlin
WHEN
The system sends the trip sheet via Merlin
THEN
The Canadian trip sheet is transmitted to customs and authorized recipients through Merlin system
Context: A trip sheet distribution is in progress
GIVEN
A trip sheet distribution is in progress
Applied to: US Trip Sheet Required?
WHEN
The system evaluates if US trip sheet is required
THEN
The system determines US trip sheet requirement based on cargo destination being US territory
Context: US trip sheet is required
GIVEN
US trip sheet is required
Applied to: Prepare US Trip Sheet Data
WHEN
The system prepares US trip sheet data
THEN
US-specific trip sheet data is formatted with appropriate customs and regulatory information
Context: US trip sheet data is prepared and Merlin is configured
GIVEN
US trip sheet data is prepared and Merlin is configured
Applied to: Send US Trip Sheet via Merlin
WHEN
The system sends the US trip sheet via Merlin
THEN
The US trip sheet is transmitted to US customs and authorized recipients through Merlin system
Context: Trip sheet distribution is in progress
GIVEN
Trip sheet distribution is in progress
Applied to: Check AEI Report Distribution
WHEN
The system checks for AEI report distribution requirements
THEN
The system identifies if AEI report distribution is needed based on train type and configuration
Context: AEI report distribution is being processed
GIVEN
AEI report distribution is being processed
Applied to: Email Distribution Required?
WHEN
The system evaluates email distribution requirements
THEN
The system determines if email distribution is required based on station configuration and recipient preferences
Context: Email distribution is required
GIVEN
Email distribution is required
Applied to: Get Email User Lists from Station Config
WHEN
The system retrieves email user lists
THEN
Email distribution lists are obtained from station configuration data including authorized recipients
Context: Email user lists are retrieved and AEI report is ready
GIVEN
Email user lists are retrieved and AEI report is ready
Applied to: Send AEI Report via Email
WHEN
The system sends the AEI report via email
THEN
The AEI report is distributed via email to all configured recipients with proper formatting
Context: An AEI report is being sent via email
GIVEN
An AEI report is being sent via email
Applied to: Large Report?
WHEN
The system checks the report size
THEN
The system determines if the report exceeds 699 lines requiring continuation message handling
Context: A report exceeds the maximum line limit of 699 lines
GIVEN
A report exceeds the maximum line limit of 699 lines
Applied to: Handle Report Continuation
WHEN
The system handles report continuation
THEN
The system creates multiple email messages with continuation headers and distributes the complete report across multiple messages
Context: FAX routing parameters are configured
GIVEN
FAX routing parameters are configured
Applied to: Setup External FAX Addressing
WHEN
The system sets up external FAX addressing
THEN
External FAX addresses are configured for customs and authorized recipients based on routing parameters
Context: External FAX addressing is set up
GIVEN
External FAX addressing is set up
Applied to: Route to Copy IDs
WHEN
The system routes to copy IDs
THEN
Trip sheets are routed to all configured copy recipients based on distribution configuration
Context: Trip sheets are prepared and routing is configured
GIVEN
Trip sheets are prepared and routing is configured
Applied to: Transmit to Customs Systems
WHEN
The system transmits to customs systems
THEN
Trip sheets are transmitted to appropriate customs systems (Canadian and/or US) for regulatory processing
Context: Customs systems transmission is complete
GIVEN
Customs systems transmission is complete
Applied to: Transmit to Authorized Recipients
WHEN
The system transmits to authorized recipients
THEN
Trip sheets are transmitted to all authorized recipients including brokers, agents, and other stakeholders
R-GCX146-cbl-00700 (+10) File: GCX146.cbl Status Report Distribution Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Report Distribution':
  • Context - a status report needs to be distributed:
    For Check Distribution Configuration:
    When the system checks if this is an aei train send operation, then email distribution is enabled for aei train sends and disabled for regular operations.
  • Context - email distribution is required for a status report:
    For Prepare Email Recipients List:
    When the system looks up email addresses using the station code from cusemail table, then if email addresses are found, use them for distribution, otherwise use default support addresses om01247 and aei9999.
  • Context - a status report is being sent via email:
    For Send Status Report via Email:
    When the report exceeds 699 lines, then split the report into multiple email messages with continuation headers 'continuation of report....' for subsequent messages.
  • Context - a status report has been processed for email distribution:
    For Merlin Distribution Required?:
    When the system checks station configuration for merlin distribution requirements, then enable merlin distribution if required by customs processing rules or station settings.
  • Context - merlin distribution is required for a status report:
    For Prepare Merlin Message Format:
    When the system prepares the message format using validated merlin ids from emtz table, then format the report content according to merlin communication standards with proper headers and routing information.
  • Context - a status report is formatted for merlin transmission:
    For Send Status Report via Merlin:
    When the system sends the report through merlin communication channels, then transmit the report to designated merlin terminals with proper routing and confirmation handling.
  • Context - a status report has been processed for merlin distribution:
    For FAX Distribution Required?:
    When the system checks station configuration for auto-fax settings, then enable fax distribution if auto-fax is configured for the station.
  • Context - fax distribution is required for a status report:
    For Setup FAX Routing Information:
    When the system retrieves fax configuration from station settings, then setup routing information including fax numbers, transmission parameters, and delivery options from station configuration.
  • Context - fax routing information is configured for a status report:
    For Send Status Report via FAX:
    When the system initiates fax transmission, then send the status report via fax to configured recipients with proper formatting and delivery confirmation.
  • Context - primary distribution channels have been processed:
    For Additional Recipients?:
    When the system checks for additional recipients in the distribution configuration, then if additional recipients exist, continue processing them, otherwise proceed to logging.
  • Context - status report distribution has been completed to all configured recipients:
    For Log Distribution Activity:
    When the system finalizes the distribution process, then log all distribution activities including transmission methods used, recipients contacted, success/failure status, and timestamps for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A status report needs to be distributed
GIVEN
A status report needs to be distributed
Applied to: Check Distribution Configuration
WHEN
The system checks if this is an AEI train send operation
THEN
Email distribution is enabled for AEI train sends and disabled for regular operations
Context: Email distribution is required for a status report
GIVEN
Email distribution is required for a status report
Applied to: Prepare Email Recipients List
WHEN
The system looks up email addresses using the station code from CUSEMAIL table
THEN
If email addresses are found, use them for distribution, otherwise use default support addresses OM01247 and AEI9999
Context: A status report is being sent via email
GIVEN
A status report is being sent via email
Applied to: Send Status Report via Email
WHEN
The report exceeds 699 lines
THEN
Split the report into multiple email messages with continuation headers 'CONTINUATION OF REPORT....' for subsequent messages
Context: A status report has been processed for email distribution
GIVEN
A status report has been processed for email distribution
Applied to: Merlin Distribution Required?
WHEN
The system checks station configuration for Merlin distribution requirements
THEN
Enable Merlin distribution if required by customs processing rules or station settings
Context: Merlin distribution is required for a status report
GIVEN
Merlin distribution is required for a status report
Applied to: Prepare Merlin Message Format
WHEN
The system prepares the message format using validated Merlin IDs from EMTZ table
THEN
Format the report content according to Merlin communication standards with proper headers and routing information
Context: A status report is formatted for Merlin transmission
GIVEN
A status report is formatted for Merlin transmission
Applied to: Send Status Report via Merlin
WHEN
The system sends the report through Merlin communication channels
THEN
Transmit the report to designated Merlin terminals with proper routing and confirmation handling
Context: A status report has been processed for Merlin distribution
GIVEN
A status report has been processed for Merlin distribution
Applied to: FAX Distribution Required?
WHEN
The system checks station configuration for auto-FAX settings
THEN
Enable FAX distribution if auto-FAX is configured for the station
Context: FAX distribution is required for a status report
GIVEN
FAX distribution is required for a status report
Applied to: Setup FAX Routing Information
WHEN
The system retrieves FAX configuration from station settings
THEN
Setup routing information including FAX numbers, transmission parameters, and delivery options from station configuration
Context: FAX routing information is configured for a status report
GIVEN
FAX routing information is configured for a status report
Applied to: Send Status Report via FAX
WHEN
The system initiates FAX transmission
THEN
Send the status report via FAX to configured recipients with proper formatting and delivery confirmation
Context: Primary distribution channels have been processed
GIVEN
Primary distribution channels have been processed
Applied to: Additional Recipients?
WHEN
The system checks for additional recipients in the distribution configuration
THEN
If additional recipients exist, continue processing them, otherwise proceed to logging
Context: Status report distribution has been completed to all configured recipients
GIVEN
Status report distribution has been completed to all configured recipients
Applied to: Log Distribution Activity
WHEN
The system finalizes the distribution process
THEN
Log all distribution activities including transmission methods used, recipients contacted, success/failure status, and timestamps for audit trail
R-GCX146-cbl-00711 (+13) File: GCX146.cbl Error Message Distribution Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Message Distribution':
  • Context - a processing error has been detected during train processing operations:
    For Set Error Code in WS-ERROR-NB:
    When the system identifies the specific type of error that occurred, then the system assigns the corresponding error code to ws-error-nb field for tracking and reporting purposes.
  • Context - an error has been detected and error code has been assigned:
    For Set Rollback Flag WS-ROLB:
    When the system determines that the error requires transaction rollback to maintain data consistency, then the system sets the rollback flag ws-rolb to indicate that all changes should be reversed.
  • Context - an error code has been assigned and the error processing section is invoked:
    For Generate Error Message Content:
    When the system needs to create a human-readable error message, then the system generates error message content that describes the error condition in business terms including relevant context information.
  • Context - an error message has been generated with specific error content:
    For Identify Distribution Recipients:
    When the system needs to determine who should receive the error notification, then the system identifies the appropriate recipients including supervisors and designated personnel based on the error type and current user context.
  • Context - error distribution recipients have been identified:
    For Supervisor Notification Required?:
    When the system evaluates the error severity and type against notification policies, then the system determines if supervisor notification is required and routes accordingly to supervisor communication channels or proceeds to other notification methods.
  • Context - the system has determined that supervisor notification is required:
    For Route to Supervisor via ALT-PCB:
    When error message routing to supervisor is initiated, then the system routes the error message to supervisors using the alt-pcb communication channel with supervisor contact information from gcstbrt.
  • Context - supervisor notification processing has been completed or bypassed:
    For Designated Personnel Notification?:
    When the system evaluates whether additional designated personnel require notification, then the system determines if designated personnel notification is needed and either routes to merlin communication system or proceeds to message queuing.
  • Context - the system has determined that designated personnel notification is required:
    For Route to Merlin Communication System:
    When error message routing to designated personnel is initiated, then the system routes the error message through the merlin communication system using communication ids from emtz-root.
  • Context - error message routing decisions have been completed:
    For Queue Error Message for Distribution:
    When the system prepares to distribute the error message, then the system queues the error message for distribution through the messaging infrastructure.
  • Context - error messages have been queued for distribution:
    For Send via IMS Message Queues:
    When the system initiates message distribution, then the system sends the error messages via ims message queues to ensure reliable delivery to all identified recipients.
  • Context - a user with supervisor privileges ('s' type) is submitting an eta date:
    For Error 25: ETA Date Range - Special Users:
    When the system validates the eta date against the allowed range, then the system generates error 25 if the eta date is not between 30 days before and 5 days after the current date.
  • Context - a standard user (non-supervisor) is submitting an eta date:
    For Error 35: ETA Date Range - Standard Users:
    When the system validates the eta date against the allowed range, then the system generates error 35 if the eta date is not between 2 days before and 2 days after the current date.
  • Context - a user is attempting to perform an operation that requires scac access validation:
    For Error 36: SCAC Access Violation:
    When the system determines that scac access is invalid and the operation is not an aei train send, then the system generates error 36 for scac access violation and initiates error distribution process.
  • Context - a processing failure occurs during transaction execution:
    For Error 38: Processing Failures:
    When the system detects that a spawned transaction or critical process has failed, then the system generates error 38 for processing failures and initiates the error distribution workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A processing error has been detected during train processing operations
GIVEN
A processing error has been detected during train processing operations
Applied to: Set Error Code in WS-ERROR-NB
WHEN
The system identifies the specific type of error that occurred
THEN
The system assigns the corresponding error code to WS-ERROR-NB field for tracking and reporting purposes
Context: An error has been detected and error code has been assigned
GIVEN
An error has been detected and error code has been assigned
Applied to: Set Rollback Flag WS-ROLB
WHEN
The system determines that the error requires transaction rollback to maintain data consistency
THEN
The system sets the rollback flag WS-ROLB to indicate that all changes should be reversed
Context: An error code has been assigned and the error processing section is invoked
GIVEN
An error code has been assigned and the error processing section is invoked
Applied to: Generate Error Message Content
WHEN
The system needs to create a human-readable error message
THEN
The system generates error message content that describes the error condition in business terms including relevant context information
Context: An error message has been generated with specific error content
GIVEN
An error message has been generated with specific error content
Applied to: Identify Distribution Recipients
WHEN
The system needs to determine who should receive the error notification
THEN
The system identifies the appropriate recipients including supervisors and designated personnel based on the error type and current user context
Context: Error distribution recipients have been identified
GIVEN
Error distribution recipients have been identified
Applied to: Supervisor Notification Required?
WHEN
The system evaluates the error severity and type against notification policies
THEN
The system determines if supervisor notification is required and routes accordingly to supervisor communication channels or proceeds to other notification methods
Context: The system has determined that supervisor notification is required
GIVEN
The system has determined that supervisor notification is required
Applied to: Route to Supervisor via ALT-PCB
WHEN
Error message routing to supervisor is initiated
THEN
The system routes the error message to supervisors using the ALT-PCB communication channel with supervisor contact information from GCSTBRT
Context: Supervisor notification processing has been completed or bypassed
GIVEN
Supervisor notification processing has been completed or bypassed
Applied to: Designated Personnel Notification?
WHEN
The system evaluates whether additional designated personnel require notification
THEN
The system determines if designated personnel notification is needed and either routes to Merlin communication system or proceeds to message queuing
Context: The system has determined that designated personnel notification is required
GIVEN
The system has determined that designated personnel notification is required
Applied to: Route to Merlin Communication System
WHEN
Error message routing to designated personnel is initiated
THEN
The system routes the error message through the Merlin communication system using communication IDs from EMTZ-ROOT
Context: Error message routing decisions have been completed
GIVEN
Error message routing decisions have been completed
Applied to: Queue Error Message for Distribution
WHEN
The system prepares to distribute the error message
THEN
The system queues the error message for distribution through the messaging infrastructure
Context: Error messages have been queued for distribution
GIVEN
Error messages have been queued for distribution
Applied to: Send via IMS Message Queues
WHEN
The system initiates message distribution
THEN
The system sends the error messages via IMS message queues to ensure reliable delivery to all identified recipients
Context: A user with supervisor privileges ('S' type) is submitting an ETA date
GIVEN
A user with supervisor privileges ('S' type) is submitting an ETA date
Applied to: Error 25: ETA Date Range - Special Users
WHEN
The system validates the ETA date against the allowed range
THEN
The system generates Error 25 if the ETA date is not between 30 days before and 5 days after the current date
Context: A standard user (non-supervisor) is submitting an ETA date
GIVEN
A standard user (non-supervisor) is submitting an ETA date
Applied to: Error 35: ETA Date Range - Standard Users
WHEN
The system validates the ETA date against the allowed range
THEN
The system generates Error 35 if the ETA date is not between 2 days before and 2 days after the current date
Context: A user is attempting to perform an operation that requires SCAC access validation
GIVEN
A user is attempting to perform an operation that requires SCAC access validation
Applied to: Error 36: SCAC Access Violation
WHEN
The system determines that SCAC access is invalid AND the operation is not an AEI train send
THEN
The system generates Error 36 for SCAC access violation and initiates error distribution process
Context: A processing failure occurs during transaction execution
GIVEN
A processing failure occurs during transaction execution
Applied to: Error 38: Processing Failures
WHEN
The system detects that a spawned transaction or critical process has failed
THEN
The system generates Error 38 for processing failures and initiates the error distribution workflow
R-GCX146-cbl-00733 (+7) File: GCX146.cbl Special Manifest Transaction Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Manifest Transaction Processing':
  • Context - a cargo item with a ccn (customs control number) exists in the system:
    For Identify Cargo with Specific Routing Codes:
    When the ccn key starts with '6105' prefix, then the cargo is flagged as requiring special manifest processing.
  • Context - cargo has been identified as requiring special manifest processing:
    For Set Security Processing Flag:
    When the special manifest processing is initiated, then the security processing flag is set to active status.
  • Context - a special manifest transaction is being created:
    For Assign CA Record Type Code:
    When the record type needs to be assigned, then the record type is set to 'ca' indicating canadian processing.
    For Increment Spawn Counter:
    When the transaction is queued for processing, then the spawn counter is incremented by one to track the new transaction.
  • Context - train data contains border segment information in gcwb4tl:
    For Extract Border Information:
    When special manifest processing requires border details, then border code and station name are extracted from the train border segments.
  • Context - a ccn exists for cargo requiring special manifest processing:
    For Store CCN Key Information:
    When the special manifest transaction is being prepared, then the ccn key information is stored for transaction processing.
  • Context - border information, ccn key data, and record type are available:
    For Build Special Manifest Input:
    When a special manifest transaction needs to be created, then the system builds the complete input structure with all required manifest data.
  • Context - a complete special manifest input structure has been built:
    For Queue Special Manifest Transaction:
    When the transaction is ready for processing, then the transaction is queued in the special manifest processing queue for execution.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo item with a CCN (Customs Control Number) exists in the system
GIVEN
A cargo item with a CCN (Customs Control Number) exists in the system
Applied to: Identify Cargo with Specific Routing Codes
WHEN
The CCN key starts with '6105' prefix
THEN
The cargo is flagged as requiring special manifest processing
Context: Cargo has been identified as requiring special manifest processing
GIVEN
Cargo has been identified as requiring special manifest processing
Applied to: Set Security Processing Flag
WHEN
The special manifest processing is initiated
THEN
The security processing flag is set to active status
Context: A special manifest transaction is being created
GIVEN
A special manifest transaction is being created
Applied to: Assign CA Record Type Code
WHEN
The record type needs to be assigned
THEN
The record type is set to 'CA' indicating Canadian processing
Applied to: Increment Spawn Counter
WHEN
The transaction is queued for processing
THEN
The spawn counter is incremented by one to track the new transaction
Context: Train data contains border segment information in GCWB4TL
GIVEN
Train data contains border segment information in GCWB4TL
Applied to: Extract Border Information
WHEN
Special manifest processing requires border details
THEN
Border code and station name are extracted from the train border segments
Context: A CCN exists for cargo requiring special manifest processing
GIVEN
A CCN exists for cargo requiring special manifest processing
Applied to: Store CCN Key Information
WHEN
The special manifest transaction is being prepared
THEN
The CCN key information is stored for transaction processing
Context: Border information, CCN key data, and record type are available
GIVEN
Border information, CCN key data, and record type are available
Applied to: Build Special Manifest Input
WHEN
A special manifest transaction needs to be created
THEN
The system builds the complete input structure with all required manifest data
Context: A complete special manifest input structure has been built
GIVEN
A complete special manifest input structure has been built
Applied to: Queue Special Manifest Transaction
WHEN
The transaction is ready for processing
THEN
The transaction is queued in the special manifest processing queue for execution
R-GCX146-cbl-00741 File: GCX146.cbl Port Fix Message Generation
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Port Fix Message Generation':
  • Context - a request to extract business rules for port fix message generation:
    For Port Fix Message Generation Not Found:
    When the provided cobol code summary is analyzed for port fix message generation logic, then no specific port fix message generation business process can be identified in the available code.
👨‍💻 Technical ACs (Gherkin)
Context: A request to extract business rules for port fix message generation
GIVEN
A request to extract business rules for port fix message generation
Applied to: Port Fix Message Generation Not Found
WHEN
The provided COBOL code summary is analyzed for port fix message generation logic
THEN
No specific port fix message generation business process can be identified in the available code
R-GCX146-cbl-00742 (+9) File: GCX146.cbl Equipment Totals Summary Generation Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Totals Summary Generation':
  • Context - equipment totals summary generation process is starting:
    For Initialize Equipment Status Counters:
    When the system begins processing equipment records for summary totals, then all equipment status counters (total-release, total-haulage, total-held-ccra, total-proceed, total-held-docs, total-equip, total-docs-nr) are initialized to zero.
  • Context - an equipment record is being processed for totals calculation:
    For Increment TOTAL-RELEASE Counter:
    When the equipment status is 'release' or 'csa-dlv', then the total-release counter is incremented by 1.
    For Increment TOTAL-HAULAGE Counter:
    When the equipment has haulage flag set to 'y' or manual haulage flag set to 'y', then the total-haulage counter is incremented by 1.
    For Increment TOTAL-HELD-CCRA Counter:
    When the equipment status is 'hold' or 'agi-hold', then the total-held-ccra counter is incremented by 1.
    For Increment TOTAL-PROCEED Counter:
    When the equipment has 'return' status or has different manifest from and to stations and the status is not error, reject, or deleted, then the total-proceed counter is incremented by 1.
    For Increment TOTAL-HELD-DOCS Counter:
    When the equipment manifest from station equals manifest to station and the broker entry is empty, then the total-held-docs counter is incremented by 1.
  • Context - all equipment records have been processed and individual counters updated:
    For Calculate Summary Totals:
    When the system completes processing all equipment in the train, then final summary totals are calculated including total-equip as the sum of all equipment processed.
  • Context - equipment summary totals have been calculated:
    For Format Totals for Trip Sheet Display:
    When a trip sheet report is being generated, then equipment totals are formatted with appropriate labels and numeric formatting for trip sheet display.
    For Format Totals for Status Report Display:
    When a status report is being generated, then equipment totals are formatted with appropriate labels and descriptions for status report display.
  • Context - equipment totals have been formatted for display:
    For Generate Equipment Summary Lines:
    When report generation requires equipment summary information, then formatted summary lines are generated showing totals for released, held, proceeding, and other equipment categories.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment totals summary generation process is starting
GIVEN
Equipment totals summary generation process is starting
Applied to: Initialize Equipment Status Counters
WHEN
The system begins processing equipment records for summary totals
THEN
All equipment status counters (TOTAL-RELEASE, TOTAL-HAULAGE, TOTAL-HELD-CCRA, TOTAL-PROCEED, TOTAL-HELD-DOCS, TOTAL-EQUIP, TOTAL-DOCS-NR) are initialized to zero
Context: An equipment record is being processed for totals calculation
GIVEN
An equipment record is being processed for totals calculation
Applied to: Increment TOTAL-RELEASE Counter
WHEN
The equipment status is 'RELEASE' or 'CSA-DLV'
THEN
The TOTAL-RELEASE counter is incremented by 1
Applied to: Increment TOTAL-HAULAGE Counter
WHEN
The equipment has haulage flag set to 'Y' or manual haulage flag set to 'Y'
THEN
The TOTAL-HAULAGE counter is incremented by 1
Applied to: Increment TOTAL-HELD-CCRA Counter
WHEN
The equipment status is 'HOLD' or 'AGI-HOLD'
THEN
The TOTAL-HELD-CCRA counter is incremented by 1
Applied to: Increment TOTAL-PROCEED Counter
WHEN
The equipment has 'RETURN' status or has different manifest from and to stations and the status is not error, reject, or deleted
THEN
The TOTAL-PROCEED counter is incremented by 1
Applied to: Increment TOTAL-HELD-DOCS Counter
WHEN
The equipment manifest from station equals manifest to station and the broker entry is empty
THEN
The TOTAL-HELD-DOCS counter is incremented by 1
Context: All equipment records have been processed and individual counters updated
GIVEN
All equipment records have been processed and individual counters updated
Applied to: Calculate Summary Totals
WHEN
The system completes processing all equipment in the train
THEN
Final summary totals are calculated including TOTAL-EQUIP as the sum of all equipment processed
Context: Equipment summary totals have been calculated
GIVEN
Equipment summary totals have been calculated
Applied to: Format Totals for Trip Sheet Display
WHEN
A trip sheet report is being generated
THEN
Equipment totals are formatted with appropriate labels and numeric formatting for trip sheet display
Applied to: Format Totals for Status Report Display
WHEN
A status report is being generated
THEN
Equipment totals are formatted with appropriate labels and descriptions for status report display
Context: Equipment totals have been formatted for display
GIVEN
Equipment totals have been formatted for display
Applied to: Generate Equipment Summary Lines
WHEN
Report generation requires equipment summary information
THEN
Formatted summary lines are generated showing totals for released, held, proceeding, and other equipment categories
R-GCX146-cbl-00752 (+12) File: GCX146.cbl EDI Train Data Transmission Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI Train Data Transmission':
  • Context - a train manifest requires edi transmission to customs systems:
    For Initialize EDI Header Setup:
    When the edi transmission process begins, then the system initializes edi header with train id, timestamp, and transmission control information.
  • Context - equipment records exist in the train manifest:
    For Set Equipment Type Codes:
    When processing equipment for edi transmission, then the system invokes gcccartp module to determine and assign appropriate equipment type codes for each piece of equipment.
  • Context - equipment records with cargo information are available:
    For Assign Load/Empty Status:
    When processing equipment status for edi transmission, then the system assigns 'l' for loaded equipment with cargo and 'e' for empty equipment without cargo.
  • Context - equipment records require customs tracking numbers:
    For Set CCN Keys for Manifest:
    When processing equipment for customs manifest transmission, then the system assigns valid ccn keys to each equipment record for customs identification and tracking.
  • Context - equipment type is identified as container:
    For Process Container Equipment:
    When processing container equipment for edi transmission, then the system extracts container-specific data including container ids, cross-references, and formats them according to edi container standards.
  • Context - equipment type is identified as trailer:
    For Process Trailer Equipment:
    When processing trailer equipment for edi transmission, then the system extracts trailer-specific data and formats it according to edi trailer equipment standards.
  • Context - equipment type is identified as rail car:
    For Process Rail Car Equipment:
    When processing rail car equipment for edi transmission, then the system extracts rail car specific data including car type, specifications, and formats them according to edi rail car standards.
  • Context - equipment data has been processed and classified:
    For Build EDI Equipment Record:
    When building individual edi equipment records, then the system constructs complete edi records with equipment id, type, status, ccn, and all required customs fields in proper edi format.
  • Context - edi equipment records are constructed and validated:
    For Add to EDI Transmission Buffer:
    When adding records to transmission buffer, then the system adds each completed equipment record to the edi transmission buffer maintaining proper sequence and format.
  • Context - equipment records are being processed for edi transmission:
    For More Equipment?:
    When checking for remaining equipment to process, then the system continues processing if more equipment records exist, otherwise proceeds to finalize the edi message.
  • Context - all equipment records have been processed and added to transmission buffer:
    For Finalize EDI Message:
    When finalizing the edi message for transmission, then the system adds edi trailer records, calculates control totals, and prepares the complete message for customs transmission.
  • Context - edi message is finalized and ready for transmission:
    For Transmit to Customs Systems:
    When transmitting to customs systems, then the system sends the complete edi message to the designated customs systems using established communication protocols.
  • Context - edi transmission to customs systems has been completed:
    For Log EDI Transmission:
    When logging transmission activity, then the system records transmission timestamp, message identifier, equipment count, and transmission status in audit logs.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest requires EDI transmission to customs systems
GIVEN
A train manifest requires EDI transmission to customs systems
Applied to: Initialize EDI Header Setup
WHEN
The EDI transmission process begins
THEN
The system initializes EDI header with train ID, timestamp, and transmission control information
Context: Equipment records exist in the train manifest
GIVEN
Equipment records exist in the train manifest
Applied to: Set Equipment Type Codes
WHEN
Processing equipment for EDI transmission
THEN
The system invokes GCCCARTP module to determine and assign appropriate equipment type codes for each piece of equipment
Context: Equipment records with cargo information are available
GIVEN
Equipment records with cargo information are available
Applied to: Assign Load/Empty Status
WHEN
Processing equipment status for EDI transmission
THEN
The system assigns 'L' for loaded equipment with cargo and 'E' for empty equipment without cargo
Context: Equipment records require customs tracking numbers
GIVEN
Equipment records require customs tracking numbers
Applied to: Set CCN Keys for Manifest
WHEN
Processing equipment for customs manifest transmission
THEN
The system assigns valid CCN keys to each equipment record for customs identification and tracking
Context: Equipment type is identified as container
GIVEN
Equipment type is identified as container
Applied to: Process Container Equipment
WHEN
Processing container equipment for EDI transmission
THEN
The system extracts container-specific data including container IDs, cross-references, and formats them according to EDI container standards
Context: Equipment type is identified as trailer
GIVEN
Equipment type is identified as trailer
Applied to: Process Trailer Equipment
WHEN
Processing trailer equipment for EDI transmission
THEN
The system extracts trailer-specific data and formats it according to EDI trailer equipment standards
Context: Equipment type is identified as rail car
GIVEN
Equipment type is identified as rail car
Applied to: Process Rail Car Equipment
WHEN
Processing rail car equipment for EDI transmission
THEN
The system extracts rail car specific data including car type, specifications, and formats them according to EDI rail car standards
Context: Equipment data has been processed and classified
GIVEN
Equipment data has been processed and classified
Applied to: Build EDI Equipment Record
WHEN
Building individual EDI equipment records
THEN
The system constructs complete EDI records with equipment ID, type, status, CCN, and all required customs fields in proper EDI format
Context: EDI equipment records are constructed and validated
GIVEN
EDI equipment records are constructed and validated
Applied to: Add to EDI Transmission Buffer
WHEN
Adding records to transmission buffer
THEN
The system adds each completed equipment record to the EDI transmission buffer maintaining proper sequence and format
Context: Equipment records are being processed for EDI transmission
GIVEN
Equipment records are being processed for EDI transmission
Applied to: More Equipment?
WHEN
Checking for remaining equipment to process
THEN
The system continues processing if more equipment records exist, otherwise proceeds to finalize the EDI message
Context: All equipment records have been processed and added to transmission buffer
GIVEN
All equipment records have been processed and added to transmission buffer
Applied to: Finalize EDI Message
WHEN
Finalizing the EDI message for transmission
THEN
The system adds EDI trailer records, calculates control totals, and prepares the complete message for customs transmission
Context: EDI message is finalized and ready for transmission
GIVEN
EDI message is finalized and ready for transmission
Applied to: Transmit to Customs Systems
WHEN
Transmitting to customs systems
THEN
The system sends the complete EDI message to the designated customs systems using established communication protocols
Context: EDI transmission to customs systems has been completed
GIVEN
EDI transmission to customs systems has been completed
Applied to: Log EDI Transmission
WHEN
Logging transmission activity
THEN
The system records transmission timestamp, message identifier, equipment count, and transmission status in audit logs
R-GCX146-cbl-00765 (+12) File: GCX146.cbl Train Processing Confirmation Generation Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Processing Confirmation Generation':
  • Context - a train has completed processing:
    For Check Processing Status:
    When the system checks the processing status, then the system determines if confirmation generation should proceed based on processing success.
  • Context - train processing has completed and equipment processing status needs verification:
    For All Equipment Processed Successfully?:
    When the system evaluates equipment processing results, then if all equipment processed successfully, proceed to confirmation generation, otherwise skip confirmation due to processing errors.
  • Context - train processing completed successfully and confirmation generation is approved:
    For Gather Train Summary Data:
    When the system gathers train summary data, then train identification, station information, and processing details are collected for message formatting.
  • Context - train summary data has been gathered successfully:
    For Compile Equipment Totals:
    When the system compiles equipment totals, then equipment counts are calculated by status (released, held, proceeding, haulage, documents not required) for confirmation reporting.
  • Context - train summary data and equipment totals have been compiled:
    For Format Confirmation Message:
    When the system formats the confirmation message, then message is structured with proper headers, train details, equipment summaries, and processing timestamps in standard confirmation format.
  • Context - confirmation message formatting has begun:
    For Include Train Identification:
    When the system includes train identification, then train id, origin station, destination station, and customs train id are included in the confirmation message.
  • Context - train identification has been included in confirmation message:
    For Include Equipment Count Summary:
    When the system includes equipment count summary, then equipment totals by status (total equipment, released, held by ccra, held for documents, proceeding, haulage, documents not required) are included in confirmation message.
  • Context - equipment count summary has been included in confirmation message:
    For Include Processing Timestamp:
    When the system includes processing timestamp, then current processing date, time, and user identification are included in confirmation message for tracking and audit purposes.
  • Context - confirmation message content has been formatted with all required information:
    For Set Message Priority:
    When the system sets message priority, then message priority is assigned based on confirmation message type and distribution requirements.
  • Context - confirmation message has been formatted and priority assigned:
    For Queue Confirmation Message:
    When the system queues the confirmation message, then message is placed in distribution queue for delivery to originating terminal and other designated recipients.
  • Context - confirmation message has been queued for distribution:
    For Send to Message Distribution:
    When the system sends to message distribution, then message is processed through distribution system and delivered to designated terminals and recipients.
  • Context - confirmation message has been sent to distribution system:
    For Log Confirmation Activity:
    When the system logs confirmation activity, then confirmation generation, message content summary, distribution status, and timestamp are recorded in system audit log.
  • Context - train processing has completed but equipment processing errors were detected:
    For Skip Confirmation - Errors Exist:
    When the system evaluates confirmation generation eligibility, then confirmation message generation is skipped and processing proceeds to completion without sending confirmation due to processing errors.
👨‍💻 Technical ACs (Gherkin)
Context: A train has completed processing
GIVEN
A train has completed processing
Applied to: Check Processing Status
WHEN
The system checks the processing status
THEN
The system determines if confirmation generation should proceed based on processing success
Context: Train processing has completed and equipment processing status needs verification
GIVEN
Train processing has completed and equipment processing status needs verification
Applied to: All Equipment Processed Successfully?
WHEN
The system evaluates equipment processing results
THEN
If all equipment processed successfully, proceed to confirmation generation, otherwise skip confirmation due to processing errors
Context: Train processing completed successfully and confirmation generation is approved
GIVEN
Train processing completed successfully and confirmation generation is approved
Applied to: Gather Train Summary Data
WHEN
The system gathers train summary data
THEN
Train identification, station information, and processing details are collected for message formatting
Context: Train summary data has been gathered successfully
GIVEN
Train summary data has been gathered successfully
Applied to: Compile Equipment Totals
WHEN
The system compiles equipment totals
THEN
Equipment counts are calculated by status (released, held, proceeding, haulage, documents not required) for confirmation reporting
Context: Train summary data and equipment totals have been compiled
GIVEN
Train summary data and equipment totals have been compiled
Applied to: Format Confirmation Message
WHEN
The system formats the confirmation message
THEN
Message is structured with proper headers, train details, equipment summaries, and processing timestamps in standard confirmation format
Context: Confirmation message formatting has begun
GIVEN
Confirmation message formatting has begun
Applied to: Include Train Identification
WHEN
The system includes train identification
THEN
Train ID, origin station, destination station, and customs train ID are included in the confirmation message
Context: Train identification has been included in confirmation message
GIVEN
Train identification has been included in confirmation message
Applied to: Include Equipment Count Summary
WHEN
The system includes equipment count summary
THEN
Equipment totals by status (total equipment, released, held by CCRA, held for documents, proceeding, haulage, documents not required) are included in confirmation message
Context: Equipment count summary has been included in confirmation message
GIVEN
Equipment count summary has been included in confirmation message
Applied to: Include Processing Timestamp
WHEN
The system includes processing timestamp
THEN
Current processing date, time, and user identification are included in confirmation message for tracking and audit purposes
Context: Confirmation message content has been formatted with all required information
GIVEN
Confirmation message content has been formatted with all required information
Applied to: Set Message Priority
WHEN
The system sets message priority
THEN
Message priority is assigned based on confirmation message type and distribution requirements
Context: Confirmation message has been formatted and priority assigned
GIVEN
Confirmation message has been formatted and priority assigned
Applied to: Queue Confirmation Message
WHEN
The system queues the confirmation message
THEN
Message is placed in distribution queue for delivery to originating terminal and other designated recipients
Context: Confirmation message has been queued for distribution
GIVEN
Confirmation message has been queued for distribution
Applied to: Send to Message Distribution
WHEN
The system sends to message distribution
THEN
Message is processed through distribution system and delivered to designated terminals and recipients
Context: Confirmation message has been sent to distribution system
GIVEN
Confirmation message has been sent to distribution system
Applied to: Log Confirmation Activity
WHEN
The system logs confirmation activity
THEN
Confirmation generation, message content summary, distribution status, and timestamp are recorded in system audit log
Context: Train processing has completed but equipment processing errors were detected
GIVEN
Train processing has completed but equipment processing errors were detected
Applied to: Skip Confirmation - Errors Exist
WHEN
The system evaluates confirmation generation eligibility
THEN
Confirmation message generation is skipped and processing proceeds to completion without sending confirmation due to processing errors
R-GCX146-cbl-00778 (+7) File: GCX146.cbl Equipment Type Code Assignment Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Type Code Assignment':
  • Context - equipment information is retrieved from equipment records:
    For Determine Equipment Category:
    When the system analyzes the equipment identification and characteristics, then the equipment is categorized as container, trailer, or car for subsequent type code processing.
  • Context - equipment is categorized as a container:
    For Container Equipment Processing:
    When container equipment processing is initiated, then container-specific type code determination logic is applied before calling gcccartp module.
  • Context - equipment is categorized as a trailer:
    For Trailer Equipment Processing:
    When trailer equipment processing is initiated, then trailer-specific type code determination logic is applied before calling gcccartp module.
  • Context - equipment is categorized as a car:
    For Car Equipment Processing:
    When car equipment processing is initiated, then car-specific type code determination logic is applied before calling gcccartp module.
  • Context - equipment has been processed according to its category (container, trailer, or car):
    For Call GCCCARTP Module:
    When type code assignment is required, then gcccartp module is called to determine and assign the appropriate equipment type code.
  • Context - an equipment type code has been assigned by the gcccartp module:
    For Validate Type Code Assignment:
    When type code validation is performed, then the system verifies the type code is valid according to business rules and data constraints.
  • Context - equipment type code has been validated successfully:
    For Set Equipment Type for EDI:
    When edi processing is required, then the validated equipment type code is set for edi transmission.
  • Context - equipment type code validation fails:
    For Handle Type Code Error:
    When an invalid type code is detected, then error handling procedures are initiated to address the type code assignment failure.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment information is retrieved from equipment records
GIVEN
Equipment information is retrieved from equipment records
Applied to: Determine Equipment Category
WHEN
The system analyzes the equipment identification and characteristics
THEN
The equipment is categorized as Container, Trailer, or Car for subsequent type code processing
Context: Equipment is categorized as a container
GIVEN
Equipment is categorized as a container
Applied to: Container Equipment Processing
WHEN
Container equipment processing is initiated
THEN
Container-specific type code determination logic is applied before calling GCCCARTP module
Context: Equipment is categorized as a trailer
GIVEN
Equipment is categorized as a trailer
Applied to: Trailer Equipment Processing
WHEN
Trailer equipment processing is initiated
THEN
Trailer-specific type code determination logic is applied before calling GCCCARTP module
Context: Equipment is categorized as a car
GIVEN
Equipment is categorized as a car
Applied to: Car Equipment Processing
WHEN
Car equipment processing is initiated
THEN
Car-specific type code determination logic is applied before calling GCCCARTP module
Context: Equipment has been processed according to its category (Container, Trailer, or Car)
GIVEN
Equipment has been processed according to its category (Container, Trailer, or Car)
Applied to: Call GCCCARTP Module
WHEN
Type code assignment is required
THEN
GCCCARTP module is called to determine and assign the appropriate equipment type code
Context: An equipment type code has been assigned by the GCCCARTP module
GIVEN
An equipment type code has been assigned by the GCCCARTP module
Applied to: Validate Type Code Assignment
WHEN
Type code validation is performed
THEN
The system verifies the type code is valid according to business rules and data constraints
Context: Equipment type code has been validated successfully
GIVEN
Equipment type code has been validated successfully
Applied to: Set Equipment Type for EDI
WHEN
EDI processing is required
THEN
The validated equipment type code is set for EDI transmission
Context: Equipment type code validation fails
GIVEN
Equipment type code validation fails
Applied to: Handle Type Code Error
WHEN
An invalid type code is detected
THEN
Error handling procedures are initiated to address the type code assignment failure
R-GCX146-cbl-00786 (+8) File: GCX146.cbl Load/Empty Status Assignment Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Load/Empty Status Assignment':
  • Context - equipment record is being processed and waybill data has been retrieved:
    For Extract Load Status from Waybill:
    When the waybill contains load/empty status indicator in the waybill record, then extract the load/empty status from waybill and assign it to the equipment record.
  • Context - equipment record is being processed and waybill does not contain load status:
    For Use Input Load/Empty Flag:
    When input specifications contain a load/empty flag indicator, then use the input load/empty flag to assign status to the equipment.
  • Context - equipment record has no explicit load/empty indicators from waybill or input:
    For Determine Load Status from Routing:
    When equipment has both origin and destination information available, then analyze the routing information to determine if equipment is loaded or empty based on cargo movement patterns.
  • Context - equipment has been classified as container type:
    For Container Load/Empty Assignment:
    When load/empty status needs to be assigned to the container, then apply container-specific rules to determine and assign load or empty status.
  • Context - equipment has been classified as trailer type:
    For Trailer Load/Empty Assignment:
    When load/empty status needs to be assigned to the trailer, then apply trailer-specific rules to determine and assign load or empty status.
  • Context - equipment has been classified as rail car type:
    For Rail Car Load/Empty Assignment:
    When load/empty status needs to be assigned to the rail car, then apply rail car-specific rules to determine and assign load or empty status.
  • Context - load/empty status has been determined for equipment:
    For Validate Status Against Equipment Type:
    When status assignment is validated against equipment type constraints, then verify that the assigned status is valid for the specific equipment type and reject invalid combinations.
  • Context - final load/empty status has been assigned to equipment:
    For Set EDI Load/Empty Indicator:
    When edi transmission requires load/empty indicator, then convert the internal status to the appropriate edi load/empty indicator format.
  • Context - load/empty status assignment process encounters an error condition:
    For Status Assignment Error:
    When status cannot be determined or is invalid for the equipment type, then generate appropriate error message and handle the equipment record according to error processing rules.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment record is being processed and waybill data has been retrieved
GIVEN
Equipment record is being processed and waybill data has been retrieved
Applied to: Extract Load Status from Waybill
WHEN
The waybill contains load/empty status indicator in the waybill record
THEN
Extract the load/empty status from waybill and assign it to the equipment record
Context: Equipment record is being processed and waybill does not contain load status
GIVEN
Equipment record is being processed and waybill does not contain load status
Applied to: Use Input Load/Empty Flag
WHEN
Input specifications contain a load/empty flag indicator
THEN
Use the input load/empty flag to assign status to the equipment
Context: Equipment record has no explicit load/empty indicators from waybill or input
GIVEN
Equipment record has no explicit load/empty indicators from waybill or input
Applied to: Determine Load Status from Routing
WHEN
Equipment has both origin and destination information available
THEN
Analyze the routing information to determine if equipment is loaded or empty based on cargo movement patterns
Context: Equipment has been classified as container type
GIVEN
Equipment has been classified as container type
Applied to: Container Load/Empty Assignment
WHEN
Load/empty status needs to be assigned to the container
THEN
Apply container-specific rules to determine and assign load or empty status
Context: Equipment has been classified as trailer type
GIVEN
Equipment has been classified as trailer type
Applied to: Trailer Load/Empty Assignment
WHEN
Load/empty status needs to be assigned to the trailer
THEN
Apply trailer-specific rules to determine and assign load or empty status
Context: Equipment has been classified as rail car type
GIVEN
Equipment has been classified as rail car type
Applied to: Rail Car Load/Empty Assignment
WHEN
Load/empty status needs to be assigned to the rail car
THEN
Apply rail car-specific rules to determine and assign load or empty status
Context: Load/empty status has been determined for equipment
GIVEN
Load/empty status has been determined for equipment
Applied to: Validate Status Against Equipment Type
WHEN
Status assignment is validated against equipment type constraints
THEN
Verify that the assigned status is valid for the specific equipment type and reject invalid combinations
Context: Final load/empty status has been assigned to equipment
GIVEN
Final load/empty status has been assigned to equipment
Applied to: Set EDI Load/Empty Indicator
WHEN
EDI transmission requires load/empty indicator
THEN
Convert the internal status to the appropriate EDI load/empty indicator format
Context: Load/empty status assignment process encounters an error condition
GIVEN
Load/empty status assignment process encounters an error condition
Applied to: Status Assignment Error
WHEN
Status cannot be determined or is invalid for the equipment type
THEN
Generate appropriate error message and handle the equipment record according to error processing rules
R-GCX146-cbl-00795 (+17) File: GCX146.cbl CCN Transit Status Processing Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Transit Status Processing':
  • Context - a ccn key is provided for lookup:
    For Access CCN Database Record:
    When the system attempts to access the ccn database record, then the system retrieves the ccn record from the gcccrt database if it exists.
  • Context - a ccn database lookup has been performed:
    For CCN Record Found?:
    When the system checks if the ccn record was found, then the system proceeds with transit status processing if record exists, otherwise handles the not found condition.
  • Context - a valid ccn record exists in the database:
    For Read Current Transit Status:
    When the system reads the current transit status field, then the system retrieves the transit status code for further processing.
  • Context - a transit status code has been retrieved from the ccn record:
    For Check Transit Status Code:
    When the system evaluates the transit status code, then the system determines the appropriate status classification based on the code value.
  • Context - a transit status code is available for evaluation:
    For Status = 'T' Transit?:
    When the transit status code equals 't', then the system classifies the cargo as in transit status.
  • Context - a transit status code is available for evaluation and is not 't':
    For Status = 'R' Return?:
    When the transit status code equals 'r', then the system classifies the cargo as return status.
  • Context - a transit status code is available for evaluation and is not 't' or 'r':
    For Status = 'E' Export?:
    When the transit status code equals 'e', then the system classifies the cargo as export status.
  • Context - a transit status code is available for evaluation and is not 't', 'r', or 'e':
    For Status = 'Z' Export?:
    When the transit status code equals 'z', then the system classifies the cargo as export status.
  • Context - the transit status code has been evaluated as 't':
    For Set Status to 'TRANSIT':
    When the system processes the transit classification, then the system sets the status to 'transit'.
  • Context - the transit status code has been evaluated as 'r':
    For Set Status to 'RETURN':
    When the system processes the return classification, then the system sets the status to 'return'.
  • Context - the transit status code has been evaluated as 'e' or 'z':
    For Set Status to 'EXPORT':
    When the system processes the export classification, then the system sets the status to 'export'.
  • Context - the transit status code is not 't', 'r', 'e', or 'z':
    For Check S.A.R. Release Flag:
    When the system evaluates the s.a.r. release flag, then the system determines if cargo has special administrative release authorization.
  • Context - the s.a.r. release flag has been evaluated:
    For S.A.R. Release?:
    When the cargo has s.a.r. release authorization, then the system classifies the cargo for s.a.r. release processing.
  • Context - the cargo has been determined to have s.a.r. release authorization:
    For Set Status to 'S.A.R.':
    When the system processes the s.a.r. classification, then the system sets the status to 's.a.r.'.
  • Context - the cargo has been determined to not have s.a.r. release authorization:
    For Set Status to 'RELEASE':
    When the system processes the release classification, then the system sets the status to 'release'.
  • Context - a transit status has been determined and assigned:
    For Update CCN Transit Status:
    When the system updates the ccn transit status, then the ccn record is updated with the new transit status in the database.
  • Context - the ccn transit status has been updated:
    For Track Cargo Movement:
    When the system processes cargo movement tracking, then the system records the cargo movement information for tracking purposes.
  • Context - a ccn lookup has been performed:
    For Handle CCN Not Found:
    When no ccn record is found in the database, then the system handles the not found condition and completes processing.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN key is provided for lookup
GIVEN
A CCN key is provided for lookup
Applied to: Access CCN Database Record
WHEN
The system attempts to access the CCN database record
THEN
The system retrieves the CCN record from the GCCCRT database if it exists
Context: A CCN database lookup has been performed
GIVEN
A CCN database lookup has been performed
Applied to: CCN Record Found?
WHEN
The system checks if the CCN record was found
THEN
The system proceeds with transit status processing if record exists, otherwise handles the not found condition
Context: A valid CCN record exists in the database
GIVEN
A valid CCN record exists in the database
Applied to: Read Current Transit Status
WHEN
The system reads the current transit status field
THEN
The system retrieves the transit status code for further processing
Context: A transit status code has been retrieved from the CCN record
GIVEN
A transit status code has been retrieved from the CCN record
Applied to: Check Transit Status Code
WHEN
The system evaluates the transit status code
THEN
The system determines the appropriate status classification based on the code value
Context: A transit status code is available for evaluation
GIVEN
A transit status code is available for evaluation
Applied to: Status = 'T' Transit?
WHEN
The transit status code equals 'T'
THEN
The system classifies the cargo as in transit status
Context: A transit status code is available for evaluation and is not 'T'
GIVEN
A transit status code is available for evaluation and is not 'T'
Applied to: Status = 'R' Return?
WHEN
The transit status code equals 'R'
THEN
The system classifies the cargo as return status
Context: A transit status code is available for evaluation and is not 'T' or 'R'
GIVEN
A transit status code is available for evaluation and is not 'T' or 'R'
Applied to: Status = 'E' Export?
WHEN
The transit status code equals 'E'
THEN
The system classifies the cargo as export status
Context: A transit status code is available for evaluation and is not 'T', 'R', or 'E'
GIVEN
A transit status code is available for evaluation and is not 'T', 'R', or 'E'
Applied to: Status = 'Z' Export?
WHEN
The transit status code equals 'Z'
THEN
The system classifies the cargo as export status
Context: The transit status code has been evaluated as 'T'
GIVEN
The transit status code has been evaluated as 'T'
Applied to: Set Status to 'TRANSIT'
WHEN
The system processes the transit classification
THEN
The system sets the status to 'TRANSIT'
Context: The transit status code has been evaluated as 'R'
GIVEN
The transit status code has been evaluated as 'R'
Applied to: Set Status to 'RETURN'
WHEN
The system processes the return classification
THEN
The system sets the status to 'RETURN'
Context: The transit status code has been evaluated as 'E' or 'Z'
GIVEN
The transit status code has been evaluated as 'E' or 'Z'
Applied to: Set Status to 'EXPORT'
WHEN
The system processes the export classification
THEN
The system sets the status to 'EXPORT'
Context: The transit status code is not 'T', 'R', 'E', or 'Z'
GIVEN
The transit status code is not 'T', 'R', 'E', or 'Z'
Applied to: Check S.A.R. Release Flag
WHEN
The system evaluates the S.A.R. release flag
THEN
The system determines if cargo has special administrative release authorization
Context: The S.A.R. release flag has been evaluated
GIVEN
The S.A.R. release flag has been evaluated
Applied to: S.A.R. Release?
WHEN
The cargo has S.A.R. release authorization
THEN
The system classifies the cargo for S.A.R. release processing
Context: The cargo has been determined to have S.A.R. release authorization
GIVEN
The cargo has been determined to have S.A.R. release authorization
Applied to: Set Status to 'S.A.R.'
WHEN
The system processes the S.A.R. classification
THEN
The system sets the status to 'S.A.R.'
Context: The cargo has been determined to not have S.A.R. release authorization
GIVEN
The cargo has been determined to not have S.A.R. release authorization
Applied to: Set Status to 'RELEASE'
WHEN
The system processes the release classification
THEN
The system sets the status to 'RELEASE'
Context: A transit status has been determined and assigned
GIVEN
A transit status has been determined and assigned
Applied to: Update CCN Transit Status
WHEN
The system updates the CCN transit status
THEN
The CCN record is updated with the new transit status in the database
Context: The CCN transit status has been updated
GIVEN
The CCN transit status has been updated
Applied to: Track Cargo Movement
WHEN
The system processes cargo movement tracking
THEN
The system records the cargo movement information for tracking purposes
Context: A CCN lookup has been performed
GIVEN
A CCN lookup has been performed
Applied to: Handle CCN Not Found
WHEN
No CCN record is found in the database
THEN
The system handles the not found condition and completes processing
R-GCX146-cbl-00813 (+7) File: GCX146.cbl Equipment Car ID Formatting Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Car ID Formatting':
  • Context - an equipment car id is provided for processing:
    For Apply Standard Formatting Rules:
    When the car id has a valid format, then standard formatting rules are applied to normalize the car id.
  • Context - an equipment car id contains spaces or special characters:
    For Remove Spaces and Special Characters:
    When the car id is being formatted for train manifest, then all spaces and special characters are removed from the car id.
  • Context - an equipment car id is shorter than the required length:
    For Pad with Zeros if Needed:
    When the car id is being formatted for train manifest display, then the car id is padded with leading zeros to meet the standard length requirement.
  • Context - an equipment car id contains lowercase characters:
    For Convert to Uppercase:
    When the car id is being processed for train manifest, then all characters in the car id are converted to uppercase.
  • Context - an equipment car id has been formatted:
    For Validate Length Requirements:
    When the length validation is performed, then the car id length must meet the standard requirements for valid processing.
  • Context - an equipment car id has passed length validation:
    For Format for Train Manifest Display:
    When the car id is prepared for train manifest display, then the car id is formatted according to train manifest display standards.
  • Context - an equipment car id has been formatted for train manifest display:
    For Set Equipment Type Code:
    When equipment type classification is required, then the appropriate equipment type code is assigned based on car id characteristics.
  • Context - an equipment car id fails format validation or length requirements:
    For Format Error - Use Default:
    When standard formatting cannot be applied successfully, then a default format is used to ensure the car id can still be processed.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment car ID is provided for processing
GIVEN
An equipment car ID is provided for processing
Applied to: Apply Standard Formatting Rules
WHEN
The car ID has a valid format
THEN
Standard formatting rules are applied to normalize the car ID
Context: An equipment car ID contains spaces or special characters
GIVEN
An equipment car ID contains spaces or special characters
Applied to: Remove Spaces and Special Characters
WHEN
The car ID is being formatted for train manifest
THEN
All spaces and special characters are removed from the car ID
Context: An equipment car ID is shorter than the required length
GIVEN
An equipment car ID is shorter than the required length
Applied to: Pad with Zeros if Needed
WHEN
The car ID is being formatted for train manifest display
THEN
The car ID is padded with leading zeros to meet the standard length requirement
Context: An equipment car ID contains lowercase characters
GIVEN
An equipment car ID contains lowercase characters
Applied to: Convert to Uppercase
WHEN
The car ID is being processed for train manifest
THEN
All characters in the car ID are converted to uppercase
Context: An equipment car ID has been formatted
GIVEN
An equipment car ID has been formatted
Applied to: Validate Length Requirements
WHEN
The length validation is performed
THEN
The car ID length must meet the standard requirements for valid processing
Context: An equipment car ID has passed length validation
GIVEN
An equipment car ID has passed length validation
Applied to: Format for Train Manifest Display
WHEN
The car ID is prepared for train manifest display
THEN
The car ID is formatted according to train manifest display standards
Context: An equipment car ID has been formatted for train manifest display
GIVEN
An equipment car ID has been formatted for train manifest display
Applied to: Set Equipment Type Code
WHEN
Equipment type classification is required
THEN
The appropriate equipment type code is assigned based on car ID characteristics
Context: An equipment car ID fails format validation or length requirements
GIVEN
An equipment car ID fails format validation or length requirements
Applied to: Format Error - Use Default
WHEN
Standard formatting cannot be applied successfully
THEN
A default format is used to ensure the car ID can still be processed
R-GCX146-cbl-00821 (+17) File: GCX146.cbl AEI Report Email Distribution Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AEI Report Email Distribution':
  • Context - an aei report needs to be distributed via email:
    For Start AEI Report Email Distribution:
    When the email distribution process is initiated, then the system should prepare for email processing and set up the distribution workflow.
  • Context - a station code is available for email distribution:
    For Get Email User Lists from Station Configuration:
    When the system needs to determine email recipients, then the system should lookup email addresses from cusemail table using the station code and retrieve the configured user email lists.
  • Context - email recipients have been identified:
    For Initialize Report Message Buffer:
    When the system prepares to format the report for email, then the system should initialize the message buffer and prepare report content for processing.
  • Context - a report is ready for email distribution:
    For Check Report Size:
    When the system checks the report size, then the system should count the total number of lines in the report to determine processing approach.
  • Context - a report has been sized and is ready for email transmission:
    For Report Exceeds 699 Lines?:
    When the system evaluates if the report exceeds 699 lines, then if the report has more than 699 lines, the system should initiate batch processing, otherwise proceed with single email transmission.
  • Context - a report batch is prepared and ready for transmission:
    For Send Current Report Batch via Email:
    When the system sends the current report batch via email, then the system should transmit the current batch using emcsend3 email service to the configured recipients.
  • Context - a report batch has been successfully sent via email:
    For Reset Message Buffer:
    When the system needs to prepare for the next batch, then the system should reset the message buffer and clear previous content to prepare for continuation processing.
  • Context - a report has been split into multiple email batches:
    For Add Continuation Header Message:
    When the system prepares a continuation email message, then the system should add the header 'continuation of report....' to indicate this is a continuation of the previous message.
  • Context - the initial report batch has been sent and continuation header added:
    For Continue Processing Remaining Lines:
    When the system continues processing the remaining report lines, then the system should continue processing the remaining lines from where the previous batch ended.
  • Context - there are remaining report lines to process:
    For Process Next Line Batch:
    When the system processes the next line batch, then the system should process up to 699 lines for the next email batch while maintaining report formatting.
  • Context - a batch of report lines has been processed:
    For More Lines to Process?:
    When the system checks for additional lines to process, then if there are more lines remaining, continue batch processing, otherwise proceed to send the final email batch.
  • Context - all report lines have been processed and the final batch is ready:
    For Send Final Email Batch:
    When the system sends the final email batch, then the system should transmit the final batch using emcsend3 email service to complete the report distribution.
  • Context - an email has been sent via the primary email service:
    For Email Send Successful?:
    When the system checks the email transmission status, then if the email was successful, proceed to log the transmission, otherwise initiate fallback email procedures.
  • Context - the primary email transmission has failed:
    For Use Fallback Email Recipients:
    When the system activates fallback email recipients, then the system should prepare to use the fallback email addresses om01247 and aei9999 for report delivery.
  • Context - primary email delivery has failed and fallback recipients are activated:
    For Send via OM01247/AEI9999:
    When the system sends via fallback email addresses, then the system should transmit the report to om01247 and aei9999 using the fallback email service.
  • Context - an email has been successfully transmitted (either primary or fallback):
    For Log Email Transmission:
    When the system logs the email transmission, then the system should record the transmission details including recipients, timestamp, and delivery status for audit purposes.
  • Context - all email transmissions have been completed and logged:
    For AEI Report Distribution Complete:
    When the aei report distribution process concludes, then the system should mark the distribution as complete and finalize the process.
  • Context - both primary and fallback email transmissions have failed:
    For Email Distribution Failed:
    When the email distribution fails completely, then the system should mark the distribution as failed and handle the error condition appropriately.
👨‍💻 Technical ACs (Gherkin)
Context: An AEI report needs to be distributed via email
GIVEN
An AEI report needs to be distributed via email
Applied to: Start AEI Report Email Distribution
WHEN
The email distribution process is initiated
THEN
The system should prepare for email processing and set up the distribution workflow
Context: A station code is available for email distribution
GIVEN
A station code is available for email distribution
Applied to: Get Email User Lists from Station Configuration
WHEN
The system needs to determine email recipients
THEN
The system should lookup email addresses from CUSEMAIL table using the station code and retrieve the configured user email lists
Context: Email recipients have been identified
GIVEN
Email recipients have been identified
Applied to: Initialize Report Message Buffer
WHEN
The system prepares to format the report for email
THEN
The system should initialize the message buffer and prepare report content for processing
Context: A report is ready for email distribution
GIVEN
A report is ready for email distribution
Applied to: Check Report Size
WHEN
The system checks the report size
THEN
The system should count the total number of lines in the report to determine processing approach
Context: A report has been sized and is ready for email transmission
GIVEN
A report has been sized and is ready for email transmission
Applied to: Report Exceeds 699 Lines?
WHEN
The system evaluates if the report exceeds 699 lines
THEN
If the report has more than 699 lines, the system should initiate batch processing, otherwise proceed with single email transmission
Context: A report batch is prepared and ready for transmission
GIVEN
A report batch is prepared and ready for transmission
Applied to: Send Current Report Batch via Email
WHEN
The system sends the current report batch via email
THEN
The system should transmit the current batch using EMCSEND3 email service to the configured recipients
Context: A report batch has been successfully sent via email
GIVEN
A report batch has been successfully sent via email
Applied to: Reset Message Buffer
WHEN
The system needs to prepare for the next batch
THEN
The system should reset the message buffer and clear previous content to prepare for continuation processing
Context: A report has been split into multiple email batches
GIVEN
A report has been split into multiple email batches
Applied to: Add Continuation Header Message
WHEN
The system prepares a continuation email message
THEN
The system should add the header 'CONTINUATION OF REPORT....' to indicate this is a continuation of the previous message
Context: The initial report batch has been sent and continuation header added
GIVEN
The initial report batch has been sent and continuation header added
Applied to: Continue Processing Remaining Lines
WHEN
The system continues processing the remaining report lines
THEN
The system should continue processing the remaining lines from where the previous batch ended
Context: There are remaining report lines to process
GIVEN
There are remaining report lines to process
Applied to: Process Next Line Batch
WHEN
The system processes the next line batch
THEN
The system should process up to 699 lines for the next email batch while maintaining report formatting
Context: A batch of report lines has been processed
GIVEN
A batch of report lines has been processed
Applied to: More Lines to Process?
WHEN
The system checks for additional lines to process
THEN
If there are more lines remaining, continue batch processing, otherwise proceed to send the final email batch
Context: All report lines have been processed and the final batch is ready
GIVEN
All report lines have been processed and the final batch is ready
Applied to: Send Final Email Batch
WHEN
The system sends the final email batch
THEN
The system should transmit the final batch using EMCSEND3 email service to complete the report distribution
Context: An email has been sent via the primary email service
GIVEN
An email has been sent via the primary email service
Applied to: Email Send Successful?
WHEN
The system checks the email transmission status
THEN
If the email was successful, proceed to log the transmission, otherwise initiate fallback email procedures
Context: The primary email transmission has failed
GIVEN
The primary email transmission has failed
Applied to: Use Fallback Email Recipients
WHEN
The system activates fallback email recipients
THEN
The system should prepare to use the fallback email addresses OM01247 and AEI9999 for report delivery
Context: Primary email delivery has failed and fallback recipients are activated
GIVEN
Primary email delivery has failed and fallback recipients are activated
Applied to: Send via OM01247/AEI9999
WHEN
The system sends via fallback email addresses
THEN
The system should transmit the report to OM01247 and AEI9999 using the fallback email service
Context: An email has been successfully transmitted (either primary or fallback)
GIVEN
An email has been successfully transmitted (either primary or fallback)
Applied to: Log Email Transmission
WHEN
The system logs the email transmission
THEN
The system should record the transmission details including recipients, timestamp, and delivery status for audit purposes
Context: All email transmissions have been completed and logged
GIVEN
All email transmissions have been completed and logged
Applied to: AEI Report Distribution Complete
WHEN
The AEI report distribution process concludes
THEN
The system should mark the distribution as complete and finalize the process
Context: Both primary and fallback email transmissions have failed
GIVEN
Both primary and fallback email transmissions have failed
Applied to: Email Distribution Failed
WHEN
The email distribution fails completely
THEN
The system should mark the distribution as failed and handle the error condition appropriately
R-GCX146-cbl-00839 (+13) File: GCX146.cbl Merlin Message Transmission Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Message Transmission':
  • Context - a merlin message transmission is initiated for a specific station:
    For Check Auto-FAX Configuration:
    When the system checks the station configuration in gcstbrt, then the auto-fax capability flag is retrieved and evaluated to determine if fax routing should be enabled.
  • Context - auto-fax is enabled for the current station:
    For Setup FAX Routing Parameters:
    When the system prepares for message transmission, then fax routing parameters are configured including destination settings and transmission options.
  • Context - fax routing parameters are configured:
    For Set Copy IDs for FAX Distribution:
    When the system prepares copy distribution settings, then copy ids are assigned based on station configuration to enable multi-recipient fax delivery.
  • Context - copy ids are configured for fax distribution:
    For Configure External FAX Addressing:
    When the system sets up external addressing, then external fax addresses and routing information are configured for customs authority delivery.
  • Context - a merlin message is prepared for transmission:
    For Check Message Size:
    When the system counts the total number of message lines, then if message exceeds 699 lines, it is flagged for continuation processing, otherwise it proceeds as standard transmission.
  • Context - a merlin message is prepared and is 699 lines or fewer:
    For Send Standard Merlin Message:
    When the system initiates transmission, then the complete message is sent as a single transmission unit.
  • Context - a merlin message exceeds 699 lines:
    For Split Message for Continuation:
    When the system processes the oversized message, then the message is divided into multiple batches with the first batch containing up to 699 lines.
  • Context - a message has been split into multiple batches:
    For Send First Message Batch:
    When the system transmits the first batch, then the first 699 lines are sent as the initial message segment.
  • Context - a message has remaining batches after the first transmission:
    For Add Continuation Header:
    When the system prepares subsequent message batches, then each remaining batch is prefixed with 'continuation of report....' header.
  • Context - message batches with continuation headers are prepared:
    For Send Remaining Message Batches:
    When the system processes remaining batches, then each batch is transmitted sequentially until all message content is delivered.
  • Context - a message or message batch is ready for transmission:
    For Call EMCSEND3 for Transmission:
    When the system calls emcsend3 service, then the message is transmitted through the merlin communication channel.
  • Context - emcsend3 service has been called for message transmission:
    For Transmission Successful?:
    When the system receives transmission response, then if transmission is successful, proceed to logging, otherwise handle transmission error.
  • Context - message transmission is confirmed successful:
    For Log Successful Transmission:
    When the system processes the success response, then transmission details are logged including timestamp and delivery confirmation.
  • Context - message transmission fails:
    For Handle Transmission Error:
    When the system receives error response from emcsend3, then error details are logged and appropriate error handling procedures are initiated.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin message transmission is initiated for a specific station
GIVEN
A Merlin message transmission is initiated for a specific station
Applied to: Check Auto-FAX Configuration
WHEN
The system checks the station configuration in GCSTBRT
THEN
The auto-FAX capability flag is retrieved and evaluated to determine if FAX routing should be enabled
Context: Auto-FAX is enabled for the current station
GIVEN
Auto-FAX is enabled for the current station
Applied to: Setup FAX Routing Parameters
WHEN
The system prepares for message transmission
THEN
FAX routing parameters are configured including destination settings and transmission options
Context: FAX routing parameters are configured
GIVEN
FAX routing parameters are configured
Applied to: Set Copy IDs for FAX Distribution
WHEN
The system prepares copy distribution settings
THEN
Copy IDs are assigned based on station configuration to enable multi-recipient FAX delivery
Context: Copy IDs are configured for FAX distribution
GIVEN
Copy IDs are configured for FAX distribution
Applied to: Configure External FAX Addressing
WHEN
The system sets up external addressing
THEN
External FAX addresses and routing information are configured for customs authority delivery
Context: A Merlin message is prepared for transmission
GIVEN
A Merlin message is prepared for transmission
Applied to: Check Message Size
WHEN
The system counts the total number of message lines
THEN
If message exceeds 699 lines, it is flagged for continuation processing, otherwise it proceeds as standard transmission
Context: A Merlin message is prepared and is 699 lines or fewer
GIVEN
A Merlin message is prepared and is 699 lines or fewer
Applied to: Send Standard Merlin Message
WHEN
The system initiates transmission
THEN
The complete message is sent as a single transmission unit
Context: A Merlin message exceeds 699 lines
GIVEN
A Merlin message exceeds 699 lines
Applied to: Split Message for Continuation
WHEN
The system processes the oversized message
THEN
The message is divided into multiple batches with the first batch containing up to 699 lines
Context: A message has been split into multiple batches
GIVEN
A message has been split into multiple batches
Applied to: Send First Message Batch
WHEN
The system transmits the first batch
THEN
The first 699 lines are sent as the initial message segment
Context: A message has remaining batches after the first transmission
GIVEN
A message has remaining batches after the first transmission
Applied to: Add Continuation Header
WHEN
The system prepares subsequent message batches
THEN
Each remaining batch is prefixed with 'CONTINUATION OF REPORT....' header
Context: Message batches with continuation headers are prepared
GIVEN
Message batches with continuation headers are prepared
Applied to: Send Remaining Message Batches
WHEN
The system processes remaining batches
THEN
Each batch is transmitted sequentially until all message content is delivered
Context: A message or message batch is ready for transmission
GIVEN
A message or message batch is ready for transmission
Applied to: Call EMCSEND3 for Transmission
WHEN
The system calls EMCSEND3 service
THEN
The message is transmitted through the Merlin communication channel
Context: EMCSEND3 service has been called for message transmission
GIVEN
EMCSEND3 service has been called for message transmission
Applied to: Transmission Successful?
WHEN
The system receives transmission response
THEN
If transmission is successful, proceed to logging, otherwise handle transmission error
Context: Message transmission is confirmed successful
GIVEN
Message transmission is confirmed successful
Applied to: Log Successful Transmission
WHEN
The system processes the success response
THEN
Transmission details are logged including timestamp and delivery confirmation
Context: Message transmission fails
GIVEN
Message transmission fails
Applied to: Handle Transmission Error
WHEN
The system receives error response from EMCSEND3
THEN
Error details are logged and appropriate error handling procedures are initiated
R-GCX146-cbl-00853 (+13) File: GCX146.cbl Equipment Waybill Lookup Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Waybill Lookup':
  • Context - an equipment id is provided for waybill lookup:
    For Format Equipment ID for Search:
    When the system prepares to search for waybill information, then the equipment id is formatted by removing spaces and standardized to proper search format.
  • Context - a formatted equipment id is available for search:
    For Search Primary Waybill Database FWIIROOT:
    When the system searches the primary waybill database fwiiroot, then the system retrieves waybill record if equipment id exists in the database.
  • Context - a search has been performed in the primary waybill database:
    For Waybill Record Found?:
    When the system evaluates the search results, then the system determines if a waybill record was found and proceeds to extract information or searches alternative sources.
  • Context - no waybill record was found in the primary database fwiiroot:
    For Search Enhanced Waybill SHIPROOT:
    When the system performs a fallback search, then the system searches the enhanced waybill database shiproot using multi-criteria search parameters.
  • Context - a search has been performed in the enhanced waybill database shiproot:
    For Enhanced Record Found?:
    When the system evaluates the enhanced database search results, then the system determines if an enhanced waybill record was found and proceeds accordingly.
  • Context - no waybill records were found in both primary fwiiroot and enhanced shiproot databases:
    For Search Inquiry Database FW-IQ:
    When the system performs the final fallback search, then the system searches the inquiry database fw-iq as the last resort for waybill information.
  • Context - a search has been performed in the inquiry database fw-iq:
    For Inquiry Record Found?:
    When the system evaluates the inquiry database search results, then the system determines if any inquiry records were found or if waybill lookup has failed completely.
  • Context - all database searches (primary, enhanced, and inquiry) have been exhausted without finding waybill records:
    For Set Waybill Not Found Flag:
    When the system completes the comprehensive waybill search process, then the system sets a waybill not found flag to indicate unsuccessful lookup.
  • Context - a waybill record has been found in any of the searched databases:
    For Extract Waybill Information:
    When the system processes the located waybill record, then the system extracts all relevant waybill information including shipment details and equipment data.
  • Context - waybill information has been extracted from a database record:
    For Validate Waybill Data Quality:
    When the system validates the extracted data, then the system verifies data completeness, format correctness, and business rule compliance.
  • Context - waybill data has been validated for quality:
    For Extract Equipment Details:
    When the system processes equipment-specific information, then the system extracts equipment details including car type, status, and identification information.
  • Context - equipment details have been successfully extracted:
    For Extract Shipment Information:
    When the system processes shipment-specific data, then the system extracts shipment information including shipper, consignee, origin station, destination station, and cargo details.
  • Context - all waybill and shipment information has been successfully extracted:
    For Set Waybill Found Flag:
    When the system completes the waybill lookup process, then the system sets a waybill found flag to indicate successful completion of the lookup process.
  • Context - the waybill lookup process has been completed with either success or failure:
    For Return Waybill Results:
    When the system finalizes the lookup operation, then the system returns the waybill lookup results including extracted data if found or failure indication if not found.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID is provided for waybill lookup
GIVEN
An equipment ID is provided for waybill lookup
Applied to: Format Equipment ID for Search
WHEN
The system prepares to search for waybill information
THEN
The equipment ID is formatted by removing spaces and standardized to proper search format
Context: A formatted equipment ID is available for search
GIVEN
A formatted equipment ID is available for search
Applied to: Search Primary Waybill Database FWIIROOT
WHEN
The system searches the primary waybill database FWIIROOT
THEN
The system retrieves waybill record if equipment ID exists in the database
Context: A search has been performed in the primary waybill database
GIVEN
A search has been performed in the primary waybill database
Applied to: Waybill Record Found?
WHEN
The system evaluates the search results
THEN
The system determines if a waybill record was found and proceeds to extract information or searches alternative sources
Context: No waybill record was found in the primary database FWIIROOT
GIVEN
No waybill record was found in the primary database FWIIROOT
Applied to: Search Enhanced Waybill SHIPROOT
WHEN
The system performs a fallback search
THEN
The system searches the enhanced waybill database SHIPROOT using multi-criteria search parameters
Context: A search has been performed in the enhanced waybill database SHIPROOT
GIVEN
A search has been performed in the enhanced waybill database SHIPROOT
Applied to: Enhanced Record Found?
WHEN
The system evaluates the enhanced database search results
THEN
The system determines if an enhanced waybill record was found and proceeds accordingly
Context: No waybill records were found in both primary FWIIROOT and enhanced SHIPROOT databases
GIVEN
No waybill records were found in both primary FWIIROOT and enhanced SHIPROOT databases
Applied to: Search Inquiry Database FW-IQ
WHEN
The system performs the final fallback search
THEN
The system searches the inquiry database FW-IQ as the last resort for waybill information
Context: A search has been performed in the inquiry database FW-IQ
GIVEN
A search has been performed in the inquiry database FW-IQ
Applied to: Inquiry Record Found?
WHEN
The system evaluates the inquiry database search results
THEN
The system determines if any inquiry records were found or if waybill lookup has failed completely
Context: All database searches (primary, enhanced, and inquiry) have been exhausted without finding waybill records
GIVEN
All database searches (primary, enhanced, and inquiry) have been exhausted without finding waybill records
Applied to: Set Waybill Not Found Flag
WHEN
The system completes the comprehensive waybill search process
THEN
The system sets a waybill not found flag to indicate unsuccessful lookup
Context: A waybill record has been found in any of the searched databases
GIVEN
A waybill record has been found in any of the searched databases
Applied to: Extract Waybill Information
WHEN
The system processes the located waybill record
THEN
The system extracts all relevant waybill information including shipment details and equipment data
Context: Waybill information has been extracted from a database record
GIVEN
Waybill information has been extracted from a database record
Applied to: Validate Waybill Data Quality
WHEN
The system validates the extracted data
THEN
The system verifies data completeness, format correctness, and business rule compliance
Context: Waybill data has been validated for quality
GIVEN
Waybill data has been validated for quality
Applied to: Extract Equipment Details
WHEN
The system processes equipment-specific information
THEN
The system extracts equipment details including car type, status, and identification information
Context: Equipment details have been successfully extracted
GIVEN
Equipment details have been successfully extracted
Applied to: Extract Shipment Information
WHEN
The system processes shipment-specific data
THEN
The system extracts shipment information including shipper, consignee, origin station, destination station, and cargo details
Context: All waybill and shipment information has been successfully extracted
GIVEN
All waybill and shipment information has been successfully extracted
Applied to: Set Waybill Found Flag
WHEN
The system completes the waybill lookup process
THEN
The system sets a waybill found flag to indicate successful completion of the lookup process
Context: The waybill lookup process has been completed with either success or failure
GIVEN
The waybill lookup process has been completed with either success or failure
Applied to: Return Waybill Results
WHEN
The system finalizes the lookup operation
THEN
The system returns the waybill lookup results including extracted data if found or failure indication if not found
R-GCX146-cbl-00867 (+12) File: GCX146.cbl Container Equipment Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Equipment Processing':
  • Context - a container equipment processing request is initiated:
    For Access Container Records via FWSWRWR:
    When the system attempts to access container records via fwswrwr database, then container equipment records are retrieved for further processing.
  • Context - container records have been accessed from fwswrwr database:
    For Container Record Found?:
    When the system checks for the existence of container records, then if container records are found, proceed to extract container information, otherwise access container inquiry database.
  • Context - container records exist in the fwswrwr database:
    For Extract Container Information:
    When the system processes the container records, then container information is extracted and made available for further processing.
  • Context - container information has been successfully extracted:
    For Set Flat Car Processing Flag:
    When the system processes container equipment on flat cars, then the flat car processing flag is set to indicate active container processing.
  • Context - container records are not found in fwswrwr database:
    For Access Container Inquiry Database:
    When the system needs to locate container information, then the system accesses the fw-iq container inquiry database as an alternative source.
  • Context - container inquiry database has been accessed:
    For Retrieve T/C XREF Records:
    When the system processes container cross-reference requirements, then t/c xref records are retrieved to establish container id relationships.
  • Context - t/c xref records have been retrieved:
    For Container ID Available?:
    When the system checks for container id availability, then if container id is available, extract it from xref records, otherwise report container processing error.
  • Context - container id is available in t/c xref records:
    For Extract Container ID from XREF:
    When the system processes container identification requirements, then container id is extracted from xref records for subsequent waybill information retrieval.
  • Context - container id has been extracted or container information is available:
    For Retrieve Associated Waybill Information:
    When the system needs waybill data for container processing, then associated waybill information is retrieved for the container.
  • Context - waybill information retrieval has been attempted for the container:
    For Waybill Data Found?:
    When the system checks for waybill data availability, then if waybill data is found, process container waybill data, otherwise report container processing error.
  • Context - waybill data has been found for the container:
    For Process Container Waybill Data:
    When the system processes container waybill information, then container waybill data is processed according to business requirements.
  • Context - container waybill data has been successfully processed:
    For Set Container Processing Complete:
    When the system completes container processing operations, then container processing status is set to complete.
  • Context - container id is not available from xref records or waybill data is not found for the container:
    For Container Processing Error:
    When the system encounters container processing failures, then container processing error is reported and processing terminates.
👨‍💻 Technical ACs (Gherkin)
Context: A container equipment processing request is initiated
GIVEN
A container equipment processing request is initiated
Applied to: Access Container Records via FWSWRWR
WHEN
The system attempts to access container records via FWSWRWR database
THEN
Container equipment records are retrieved for further processing
Context: Container records have been accessed from FWSWRWR database
GIVEN
Container records have been accessed from FWSWRWR database
Applied to: Container Record Found?
WHEN
The system checks for the existence of container records
THEN
If container records are found, proceed to extract container information, otherwise access container inquiry database
Context: Container records exist in the FWSWRWR database
GIVEN
Container records exist in the FWSWRWR database
Applied to: Extract Container Information
WHEN
The system processes the container records
THEN
Container information is extracted and made available for further processing
Context: Container information has been successfully extracted
GIVEN
Container information has been successfully extracted
Applied to: Set Flat Car Processing Flag
WHEN
The system processes container equipment on flat cars
THEN
The flat car processing flag is set to indicate active container processing
Context: Container records are not found in FWSWRWR database
GIVEN
Container records are not found in FWSWRWR database
Applied to: Access Container Inquiry Database
WHEN
The system needs to locate container information
THEN
The system accesses the FW-IQ container inquiry database as an alternative source
Context: Container inquiry database has been accessed
GIVEN
Container inquiry database has been accessed
Applied to: Retrieve T/C XREF Records
WHEN
The system processes container cross-reference requirements
THEN
T/C XREF records are retrieved to establish container ID relationships
Context: T/C XREF records have been retrieved
GIVEN
T/C XREF records have been retrieved
Applied to: Container ID Available?
WHEN
The system checks for container ID availability
THEN
If container ID is available, extract it from XREF records, otherwise report container processing error
Context: Container ID is available in T/C XREF records
GIVEN
Container ID is available in T/C XREF records
Applied to: Extract Container ID from XREF
WHEN
The system processes container identification requirements
THEN
Container ID is extracted from XREF records for subsequent waybill information retrieval
Context: Container ID has been extracted or container information is available
GIVEN
Container ID has been extracted or container information is available
Applied to: Retrieve Associated Waybill Information
WHEN
The system needs waybill data for container processing
THEN
Associated waybill information is retrieved for the container
Context: Waybill information retrieval has been attempted for the container
GIVEN
Waybill information retrieval has been attempted for the container
Applied to: Waybill Data Found?
WHEN
The system checks for waybill data availability
THEN
If waybill data is found, process container waybill data, otherwise report container processing error
Context: Waybill data has been found for the container
GIVEN
Waybill data has been found for the container
Applied to: Process Container Waybill Data
WHEN
The system processes container waybill information
THEN
Container waybill data is processed according to business requirements
Context: Container waybill data has been successfully processed
GIVEN
Container waybill data has been successfully processed
Applied to: Set Container Processing Complete
WHEN
The system completes container processing operations
THEN
Container processing status is set to complete
Context: Container ID is not available from XREF records OR waybill data is not found for the container
GIVEN
Container ID is not available from XREF records OR waybill data is not found for the container
Applied to: Container Processing Error
WHEN
The system encounters container processing failures
THEN
Container processing error is reported and processing terminates
R-GCX146-cbl-00880 (+8) File: GCX146.cbl Equipment Segment Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Segment Processing':
  • Context - equipment segment processing is starting:
    For Initialize Equipment Sequence Counter:
    When the system begins processing equipment records, then the equipment sequence counter is set to 1 to track the first equipment position.
  • Context - an equipment sequence counter is set:
    For Retrieve Current Equipment Record:
    When the system needs to access equipment data, then the system retrieves the equipment record from fwiiroot database using fwcmsget call with the current sequence number.
  • Context - a database call has been made to retrieve equipment data:
    For Equipment Record Found?:
    When the system checks the return status from the database call, then if the return code is zero, the equipment record exists and processing continues, otherwise an equipment segment error occurs.
  • Context - a valid equipment record has been retrieved from the database:
    For Process Current Equipment Data:
    When the system processes the equipment data, then equipment details are extracted and stored for further processing including equipment id, car type, and status information.
  • Context - current equipment data has been processed and stored:
    For Increment Sequence Counter:
    When the system completes processing of the current equipment record, then the equipment sequence counter is incremented by 1 to point to the next equipment position.
  • Context - the equipment sequence counter has been incremented:
    For Call FWCMSGET for Next Record:
    When the system needs to access the next equipment record, then fwcmsget is called with the new sequence number to retrieve the next equipment record from fwiiroot.
  • Context - a call has been made to retrieve the next equipment record:
    For More Equipment in Sequence?:
    When the system evaluates the return status from the database call, then if return code is zero, more equipment exists and processing continues with the next record, otherwise check for additional cars in bunch bill.
  • Context - no more equipment records exist in the current sequence:
    For Additional Cars in Bunch Bill?:
    When the system checks for bunch bill processing requirements, then if additional cars exist in the bunch bill, processing continues with the additional car sequence, otherwise equipment segment processing is complete.
  • Context - additional cars exist in a bunch bill arrangement:
    For Process Additional Car Sequence:
    When the system processes the additional car sequence, then the sequence counter is reset and processing continues with the next group of cars in the bunch bill.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment segment processing is starting
GIVEN
Equipment segment processing is starting
Applied to: Initialize Equipment Sequence Counter
WHEN
The system begins processing equipment records
THEN
The equipment sequence counter is set to 1 to track the first equipment position
Context: An equipment sequence counter is set
GIVEN
An equipment sequence counter is set
Applied to: Retrieve Current Equipment Record
WHEN
The system needs to access equipment data
THEN
The system retrieves the equipment record from FWIIROOT database using FWCMSGET call with the current sequence number
Context: A database call has been made to retrieve equipment data
GIVEN
A database call has been made to retrieve equipment data
Applied to: Equipment Record Found?
WHEN
The system checks the return status from the database call
THEN
If the return code is zero, the equipment record exists and processing continues, otherwise an equipment segment error occurs
Context: A valid equipment record has been retrieved from the database
GIVEN
A valid equipment record has been retrieved from the database
Applied to: Process Current Equipment Data
WHEN
The system processes the equipment data
THEN
Equipment details are extracted and stored for further processing including equipment ID, car type, and status information
Context: Current equipment data has been processed and stored
GIVEN
Current equipment data has been processed and stored
Applied to: Increment Sequence Counter
WHEN
The system completes processing of the current equipment record
THEN
The equipment sequence counter is incremented by 1 to point to the next equipment position
Context: The equipment sequence counter has been incremented
GIVEN
The equipment sequence counter has been incremented
Applied to: Call FWCMSGET for Next Record
WHEN
The system needs to access the next equipment record
THEN
FWCMSGET is called with the new sequence number to retrieve the next equipment record from FWIIROOT
Context: A call has been made to retrieve the next equipment record
GIVEN
A call has been made to retrieve the next equipment record
Applied to: More Equipment in Sequence?
WHEN
The system evaluates the return status from the database call
THEN
If return code is zero, more equipment exists and processing continues with the next record, otherwise check for additional cars in bunch bill
Context: No more equipment records exist in the current sequence
GIVEN
No more equipment records exist in the current sequence
Applied to: Additional Cars in Bunch Bill?
WHEN
The system checks for bunch bill processing requirements
THEN
If additional cars exist in the bunch bill, processing continues with the additional car sequence, otherwise equipment segment processing is complete
Context: Additional cars exist in a bunch bill arrangement
GIVEN
Additional cars exist in a bunch bill arrangement
Applied to: Process Additional Car Sequence
WHEN
The system processes the additional car sequence
THEN
The sequence counter is reset and processing continues with the next group of cars in the bunch bill
R-GCX146-cbl-00889 (+17) File: GCX146.cbl Train Equipment List Building Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Equipment List Building':
  • Context - a train processing request is received:
    For Initialize Equipment Records:
    When equipment list building begins, then equipment counters are reset to zero and processing flags are initialized.
  • Context - equipment segments exist in the train consist:
    For Process Equipment Segment:
    When processing equipment for manifest building, then each equipment segment is processed sequentially with proper error handling.
  • Context - equipment processing is in progress:
    For Retrieve Next Equipment Record:
    When retrieving equipment records from the database, then the next equipment record is retrieved and continuation status is determined.
  • Context - equipment records are being processed sequentially:
    For More Equipment?:
    When checking for additional equipment records, then processing continues if more equipment exists, otherwise moves to list completion.
  • Context - raw equipment car id data is available:
    For Format Equipment Car ID:
    When formatting car identifiers for manifest display, then spaces are removed and standard 12-character format is applied to car ids.
  • Context - equipment record with type indicators is available:
    For Assign Equipment Type Code:
    When assigning equipment type codes for manifest, then appropriate type code is assigned based on equipment classification (container/trailer/car) with corresponding type messages.
  • Context - equipment record and associated waybill information:
    For Set Load/Empty Status:
    When determining equipment load status, then load/empty flags are set correctly and validated against waybill data.
  • Context - formatted equipment id, type code, and status information:
    For Build Equipment Line Entry:
    When building equipment line for manifest display, then complete equipment line entry is constructed with id, type, and status information in proper format.
  • Context - formatted equipment line entry is ready:
    For Add to Equipment List:
    When adding equipment to the train manifest list, then equipment entry is added to the list maintaining proper sequence and format.
  • Context - equipment record with container indicators:
    For Container on Flat Car?:
    When checking for container on flat car configuration, then container processing is initiated if equipment is identified as container on flat car, otherwise standard processing continues.
  • Context - flat car equipment with associated container cross-reference records:
    For Extract Container IDs:
    When processing container information, then container ids are extracted from t/c xref records with proper sequence identification for multiple containers.
  • Context - extracted container ids and position information:
    For Format Container Information:
    When formatting container information for display, then container information is formatted with container id, position on flat car, and flat car association details.
  • Context - waybill information with bunch bill indicators:
    For Bunch Bill Present?:
    When checking for bunch bill configuration, then additional car retrieval is initiated if bunch bill is present, otherwise processing continues with single car.
  • Context - bunch bill waybill with multiple associated cars:
    For Retrieve Additional Cars:
    When retrieving additional cars from bunch bill, then additional cars are retrieved using fwcmsget with sequential retrieval maintaining waybill association.
  • Context - multiple cars from bunch bill waybill:
    For Format Sequential Car IDs:
    When formatting sequential car identifiers, then car sequence is formatted maintaining waybill association with proper sequential numbering.
  • Context - all individual equipment entries have been processed:
    For Build Comprehensive List:
    When building the comprehensive equipment list, then all equipment entries are compiled into a complete list maintaining proper order and associations.
  • Context - complete equipment list with all entries:
    For Apply Proper Formatting:
    When applying final formatting standards, then proper formatting is applied to ensure consistent presentation across all equipment entries.
  • Context - formatted equipment list ready for validation:
    For Validate List Completeness:
    When validating list completeness, then equipment list completeness is verified ensuring all required equipment is included and properly formatted.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request is received
GIVEN
A train processing request is received
Applied to: Initialize Equipment Records
WHEN
Equipment list building begins
THEN
Equipment counters are reset to zero and processing flags are initialized
Context: Equipment segments exist in the train consist
GIVEN
Equipment segments exist in the train consist
Applied to: Process Equipment Segment
WHEN
Processing equipment for manifest building
THEN
Each equipment segment is processed sequentially with proper error handling
Context: Equipment processing is in progress
GIVEN
Equipment processing is in progress
Applied to: Retrieve Next Equipment Record
WHEN
Retrieving equipment records from the database
THEN
The next equipment record is retrieved and continuation status is determined
Context: Equipment records are being processed sequentially
GIVEN
Equipment records are being processed sequentially
Applied to: More Equipment?
WHEN
Checking for additional equipment records
THEN
Processing continues if more equipment exists, otherwise moves to list completion
Context: Raw equipment car ID data is available
GIVEN
Raw equipment car ID data is available
Applied to: Format Equipment Car ID
WHEN
Formatting car identifiers for manifest display
THEN
Spaces are removed and standard 12-character format is applied to car IDs
Context: Equipment record with type indicators is available
GIVEN
Equipment record with type indicators is available
Applied to: Assign Equipment Type Code
WHEN
Assigning equipment type codes for manifest
THEN
Appropriate type code is assigned based on equipment classification (container/trailer/car) with corresponding type messages
Context: Equipment record and associated waybill information
GIVEN
Equipment record and associated waybill information
Applied to: Set Load/Empty Status
WHEN
Determining equipment load status
THEN
Load/empty flags are set correctly and validated against waybill data
Context: Formatted equipment ID, type code, and status information
GIVEN
Formatted equipment ID, type code, and status information
Applied to: Build Equipment Line Entry
WHEN
Building equipment line for manifest display
THEN
Complete equipment line entry is constructed with ID, type, and status information in proper format
Context: Formatted equipment line entry is ready
GIVEN
Formatted equipment line entry is ready
Applied to: Add to Equipment List
WHEN
Adding equipment to the train manifest list
THEN
Equipment entry is added to the list maintaining proper sequence and format
Context: Equipment record with container indicators
GIVEN
Equipment record with container indicators
Applied to: Container on Flat Car?
WHEN
Checking for container on flat car configuration
THEN
Container processing is initiated if equipment is identified as container on flat car, otherwise standard processing continues
Context: Flat car equipment with associated container cross-reference records
GIVEN
Flat car equipment with associated container cross-reference records
Applied to: Extract Container IDs
WHEN
Processing container information
THEN
Container IDs are extracted from T/C XREF records with proper sequence identification for multiple containers
Context: Extracted container IDs and position information
GIVEN
Extracted container IDs and position information
Applied to: Format Container Information
WHEN
Formatting container information for display
THEN
Container information is formatted with container ID, position on flat car, and flat car association details
Context: Waybill information with bunch bill indicators
GIVEN
Waybill information with bunch bill indicators
Applied to: Bunch Bill Present?
WHEN
Checking for bunch bill configuration
THEN
Additional car retrieval is initiated if bunch bill is present, otherwise processing continues with single car
Context: Bunch bill waybill with multiple associated cars
GIVEN
Bunch bill waybill with multiple associated cars
Applied to: Retrieve Additional Cars
WHEN
Retrieving additional cars from bunch bill
THEN
Additional cars are retrieved using FWCMSGET with sequential retrieval maintaining waybill association
Context: Multiple cars from bunch bill waybill
GIVEN
Multiple cars from bunch bill waybill
Applied to: Format Sequential Car IDs
WHEN
Formatting sequential car identifiers
THEN
Car sequence is formatted maintaining waybill association with proper sequential numbering
Context: All individual equipment entries have been processed
GIVEN
All individual equipment entries have been processed
Applied to: Build Comprehensive List
WHEN
Building the comprehensive equipment list
THEN
All equipment entries are compiled into a complete list maintaining proper order and associations
Context: Complete equipment list with all entries
GIVEN
Complete equipment list with all entries
Applied to: Apply Proper Formatting
WHEN
Applying final formatting standards
THEN
Proper formatting is applied to ensure consistent presentation across all equipment entries
Context: Formatted equipment list ready for validation
GIVEN
Formatted equipment list ready for validation
Applied to: Validate List Completeness
WHEN
Validating list completeness
THEN
Equipment list completeness is verified ensuring all required equipment is included and properly formatted
R-GCX146-cbl-00907 (+23) File: GCX146.cbl Cargo Control Number Database Operations Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Control Number Database Operations':
  • Context - an equipment id is provided for ccn lookup:
    For Search CCN by Equipment ID:
    When the system searches the ccn database using the equipment id, then the system retrieves any existing ccn records associated with that equipment.
  • Context - a ccn database search has been performed for an equipment id:
    For CCN Record Found?:
    When the system evaluates the search results, then the system determines if a ccn record was found and routes processing accordingly.
  • Context - a ccn record exists in the database for the equipment:
    For Retrieve CCN Details:
    When the system processes the found ccn record, then the system extracts all relevant ccn details including status, waybill information, and customs control data.
  • Context - a ccn record has been retrieved with its details:
    For Check CCN Usability:
    When the system validates ccn usability against current transaction requirements, then the system determines if the ccn is usable based on equipment id matching and waybill consistency.
  • Context - ccn usability assessment has been completed:
    For CCN Usable?:
    When the system evaluates the usability results, then the system determines if the ccn is usable and routes to appropriate processing path.
  • Context - a usable ccn record has been identified:
    For Validate CCN Status:
    When the system validates the current ccn status, then the system confirms the ccn status is valid for customs operations (sent, return, manual, release, ack, or csa-dlv).
  • Context - ccn status validation has been completed:
    For Check Bond Creation Flag:
    When the system examines the bond creation indicator, then the system determines if a new bond has been created (y flag) for the ccn.
  • Context - the bond creation flag has been checked:
    For Bond Created = Y?:
    When the system evaluates if the bond created flag equals 'y', then the system routes processing based on whether a new bond has been created.
  • Context - a ccn has failed usability validation or bond creation requirements:
    For Mark CCN as Unusable:
    When the system processes the unusable ccn, then the system marks the ccn as unusable and reports 'ccn found not usable' for verify operations.
  • Context - a usable ccn with valid bond creation status has been identified:
    For Set CCN Status Values:
    When the system processes ccn status assignment, then the system sets appropriate ccn status values for customs processing.
  • Context - ccn status values have been set:
    For Assign Status Based on Transit:
    When the system evaluates transit status and release conditions, then the system assigns the final status based on transit state (e/z for export, s.a.r. for special release, t for transit, r for return).
  • Context - ccn is ready for status assignment based on transit conditions:
    For Transit Status?:
    When the system evaluates the current transit status code, then the system determines the appropriate status path based on transit conditions (e/z, s.a.r., t, r, or other).
  • Context - ccn has release status and transit status is e (export) or z (export zone):
    For Set Status: EXPORT:
    When the system processes status assignment, then the system sets the ccn status to 'export'.
  • Context - ccn has release status and is released by 's.a.r.' authority:
    For Set Status: S.A.R.:
    When the system processes status assignment, then the system sets the ccn status to 's.a.r.'.
  • Context - ccn has release status but does not meet export or s.a.r. conditions:
    For Set Status: RELEASE:
    When the system processes status assignment, then the system sets the ccn status to 'release'.
  • Context - ccn has in-transit status code 't':
    For Set Status: TRANSIT:
    When the system processes status assignment, then the system sets the ccn status to 'transit'.
  • Context - ccn has in-transit status code 'r':
    For Set Status: RETURN:
    When the system processes status assignment, then the system sets the ccn status to 'return'.
  • Context - a status has been assigned to the ccn requiring return processing:
    For Create Return CCN:
    When the system processes return ccn creation, then the system creates a new ccn record with return status and populates shipper, consignee, and station data.
  • Context - a return ccn needs to be created:
    For Build CCN with 6105E Prefix:
    When the system builds the ccn key, then the system constructs ccn key with format: type(6) + carrier(105) + e + equipment_id + waybill_date + sequence.
  • Context - a ccn key has been built with 6105e prefix:
    For Set Return Status:
    When the system sets the ccn status, then the system sets the ccn status to 'return' and application type to '33' for canadian customs.
  • Context - a new ccn record has been created with return status:
    For Insert New CCN Record:
    When the system processes the database insertion, then the system inserts the new ccn record into the gcccrt database.
  • Context - ccn processing has been completed with status assignments:
    For Update CCN Database:
    When the system performs database updates, then the system updates the ccn database with current status, train information, and transaction details.
  • Context - all ccn database operations have been performed:
    For CCN Operations Complete:
    When the system finalizes ccn processing, then the system confirms successful completion of all ccn operations.
  • Context - ccn record is not found or ccn is marked as unusable:
    For CCN Not Found/Error:
    When the system processes the error condition, then the system handles the ccn not found condition and routes to appropriate error processing.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID is provided for CCN lookup
GIVEN
An equipment ID is provided for CCN lookup
Applied to: Search CCN by Equipment ID
WHEN
The system searches the CCN database using the equipment ID
THEN
The system retrieves any existing CCN records associated with that equipment
Context: A CCN database search has been performed for an equipment ID
GIVEN
A CCN database search has been performed for an equipment ID
Applied to: CCN Record Found?
WHEN
The system evaluates the search results
THEN
The system determines if a CCN record was found and routes processing accordingly
Context: A CCN record exists in the database for the equipment
GIVEN
A CCN record exists in the database for the equipment
Applied to: Retrieve CCN Details
WHEN
The system processes the found CCN record
THEN
The system extracts all relevant CCN details including status, waybill information, and customs control data
Context: A CCN record has been retrieved with its details
GIVEN
A CCN record has been retrieved with its details
Applied to: Check CCN Usability
WHEN
The system validates CCN usability against current transaction requirements
THEN
The system determines if the CCN is usable based on equipment ID matching and waybill consistency
Context: CCN usability assessment has been completed
GIVEN
CCN usability assessment has been completed
Applied to: CCN Usable?
WHEN
The system evaluates the usability results
THEN
The system determines if the CCN is usable and routes to appropriate processing path
Context: A usable CCN record has been identified
GIVEN
A usable CCN record has been identified
Applied to: Validate CCN Status
WHEN
The system validates the current CCN status
THEN
The system confirms the CCN status is valid for customs operations (SENT, RETURN, MANUAL, RELEASE, ACK, or CSA-DLV)
Context: CCN status validation has been completed
GIVEN
CCN status validation has been completed
Applied to: Check Bond Creation Flag
WHEN
The system examines the bond creation indicator
THEN
The system determines if a new bond has been created (Y flag) for the CCN
Context: The bond creation flag has been checked
GIVEN
The bond creation flag has been checked
Applied to: Bond Created = Y?
WHEN
The system evaluates if the bond created flag equals 'Y'
THEN
The system routes processing based on whether a new bond has been created
Context: A CCN has failed usability validation or bond creation requirements
GIVEN
A CCN has failed usability validation or bond creation requirements
Applied to: Mark CCN as Unusable
WHEN
The system processes the unusable CCN
THEN
The system marks the CCN as unusable and reports 'CCN FOUND NOT USABLE' for verify operations
Context: A usable CCN with valid bond creation status has been identified
GIVEN
A usable CCN with valid bond creation status has been identified
Applied to: Set CCN Status Values
WHEN
The system processes CCN status assignment
THEN
The system sets appropriate CCN status values for customs processing
Context: CCN status values have been set
GIVEN
CCN status values have been set
Applied to: Assign Status Based on Transit
WHEN
The system evaluates transit status and release conditions
THEN
The system assigns the final status based on transit state (E/Z for export, S.A.R. for special release, T for transit, R for return)
Context: CCN is ready for status assignment based on transit conditions
GIVEN
CCN is ready for status assignment based on transit conditions
Applied to: Transit Status?
WHEN
The system evaluates the current transit status code
THEN
The system determines the appropriate status path based on transit conditions (E/Z, S.A.R., T, R, or other)
Context: CCN has RELEASE status and transit status is E (export) or Z (export zone)
GIVEN
CCN has RELEASE status and transit status is E (export) or Z (export zone)
Applied to: Set Status: EXPORT
WHEN
The system processes status assignment
THEN
The system sets the CCN status to 'EXPORT'
Context: CCN has RELEASE status and is released by 'S.A.R.' authority
GIVEN
CCN has RELEASE status and is released by 'S.A.R.' authority
Applied to: Set Status: S.A.R.
WHEN
The system processes status assignment
THEN
The system sets the CCN status to 'S.A.R.'
Context: CCN has RELEASE status but does not meet export or S.A.R. conditions
GIVEN
CCN has RELEASE status but does not meet export or S.A.R. conditions
Applied to: Set Status: RELEASE
WHEN
The system processes status assignment
THEN
The system sets the CCN status to 'RELEASE'
Context: CCN has in-transit status code 'T'
GIVEN
CCN has in-transit status code 'T'
Applied to: Set Status: TRANSIT
WHEN
The system processes status assignment
THEN
The system sets the CCN status to 'TRANSIT'
Context: CCN has in-transit status code 'R'
GIVEN
CCN has in-transit status code 'R'
Applied to: Set Status: RETURN
WHEN
The system processes status assignment
THEN
The system sets the CCN status to 'RETURN'
Context: A status has been assigned to the CCN requiring return processing
GIVEN
A status has been assigned to the CCN requiring return processing
Applied to: Create Return CCN
WHEN
The system processes return CCN creation
THEN
The system creates a new CCN record with return status and populates shipper, consignee, and station data
Context: A return CCN needs to be created
GIVEN
A return CCN needs to be created
Applied to: Build CCN with 6105E Prefix
WHEN
The system builds the CCN key
THEN
The system constructs CCN key with format: type(6) + carrier(105) + E + equipment_id + waybill_date + sequence
Context: A CCN key has been built with 6105E prefix
GIVEN
A CCN key has been built with 6105E prefix
Applied to: Set Return Status
WHEN
The system sets the CCN status
THEN
The system sets the CCN status to 'RETURN' and application type to '33' for Canadian customs
Context: A new CCN record has been created with return status
GIVEN
A new CCN record has been created with return status
Applied to: Insert New CCN Record
WHEN
The system processes the database insertion
THEN
The system inserts the new CCN record into the GCCCRT database
Context: CCN processing has been completed with status assignments
GIVEN
CCN processing has been completed with status assignments
Applied to: Update CCN Database
WHEN
The system performs database updates
THEN
The system updates the CCN database with current status, train information, and transaction details
Context: All CCN database operations have been performed
GIVEN
All CCN database operations have been performed
Applied to: CCN Operations Complete
WHEN
The system finalizes CCN processing
THEN
The system confirms successful completion of all CCN operations
Context: CCN record is not found or CCN is marked as unusable
GIVEN
CCN record is not found or CCN is marked as unusable
Applied to: CCN Not Found/Error
WHEN
The system processes the error condition
THEN
The system handles the CCN not found condition and routes to appropriate error processing
R-GCX146-cbl-00931 (+11) File: GCX146.cbl Customer Report Database Operations Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customer Report Database Operations':
  • Context - a customer report generation request is received:
    For Initialize Customer Report Message:
    When the system begins customer report database operations, then the customer report message structure is initialized with default values.
  • Context - customer report message is initialized:
    For Set Message Format to GCT1401E:
    When the system configures message format, then the message format is set to gct1401e transaction type.
  • Context - message format is set to gct1401e:
    For Configure ALT-PCB2 for Message Queuing:
    When the system configures message queuing, then alt-pcb2 is configured for customer report message control and queuing.
  • Context - alt-pcb2 is configured for message queuing and report content exists in gcx140-input:
    For Move Report Content to Message Buffer:
    When the system transfers report content, then report content is moved from gcx140-input to the message buffer.
  • Context - report content is in message buffer:
    For Execute CIMS CHNG Operation:
    When the system executes cims chng operation, then database change operation is performed for customer report update.
  • Context - cims chng operation is executed:
    For CHNG Operation Successful?:
    When the system checks operation status, then if chng operation is successful, proceed to message write operation, otherwise handle database operation error.
  • Context - chng operation completed successfully:
    For Execute CIMS WRITMSGL Operation:
    When the system executes cims writmsgl operation, then customer report message is written to the message queue.
  • Context - cims writmsgl operation is executed:
    For WRITMSGL Operation Successful?:
    When the system checks operation status, then if writmsgl operation is successful, proceed to purge operation, otherwise handle database operation error.
  • Context - writmsgl operation completed successfully:
    For Execute CIMS PURG Operation:
    When the system executes cims purg operation, then temporary message data is purged from the system.
  • Context - cims purg operation is executed:
    For PURG Operation Successful?:
    When the system checks operation status, then if purg operation is successful, customer report is successfully created, otherwise handle database operation error.
  • Context - all database operations (chng, writmsgl, purg) completed successfully:
    For Customer Report Successfully Created:
    When the system confirms report creation, then customer report is marked as successfully created and process completes normally.
  • Context - any database operation (chng, writmsgl, or purg) fails:
    For Handle Database Operation Error:
    When the system detects operation failure, then database operation error is handled and process terminates with error status.
👨‍💻 Technical ACs (Gherkin)
Context: A customer report generation request is received
GIVEN
A customer report generation request is received
Applied to: Initialize Customer Report Message
WHEN
The system begins customer report database operations
THEN
The customer report message structure is initialized with default values
Context: Customer report message is initialized
GIVEN
Customer report message is initialized
Applied to: Set Message Format to GCT1401E
WHEN
The system configures message format
THEN
The message format is set to GCT1401E transaction type
Context: Message format is set to GCT1401E
GIVEN
Message format is set to GCT1401E
Applied to: Configure ALT-PCB2 for Message Queuing
WHEN
The system configures message queuing
THEN
ALT-PCB2 is configured for customer report message control and queuing
Context: ALT-PCB2 is configured for message queuing AND report content exists in GCX140-INPUT
GIVEN
ALT-PCB2 is configured for message queuing AND report content exists in GCX140-INPUT
Applied to: Move Report Content to Message Buffer
WHEN
The system transfers report content
THEN
Report content is moved from GCX140-INPUT to the message buffer
Context: Report content is in message buffer
GIVEN
Report content is in message buffer
Applied to: Execute CIMS CHNG Operation
WHEN
The system executes CIMS CHNG operation
THEN
Database change operation is performed for customer report update
Context: CIMS CHNG operation is executed
GIVEN
CIMS CHNG operation is executed
Applied to: CHNG Operation Successful?
WHEN
The system checks operation status
THEN
If CHNG operation is successful, proceed to message write operation, otherwise handle database operation error
Context: CHNG operation completed successfully
GIVEN
CHNG operation completed successfully
Applied to: Execute CIMS WRITMSGL Operation
WHEN
The system executes CIMS WRITMSGL operation
THEN
Customer report message is written to the message queue
Context: CIMS WRITMSGL operation is executed
GIVEN
CIMS WRITMSGL operation is executed
Applied to: WRITMSGL Operation Successful?
WHEN
The system checks operation status
THEN
If WRITMSGL operation is successful, proceed to purge operation, otherwise handle database operation error
Context: WRITMSGL operation completed successfully
GIVEN
WRITMSGL operation completed successfully
Applied to: Execute CIMS PURG Operation
WHEN
The system executes CIMS PURG operation
THEN
Temporary message data is purged from the system
Context: CIMS PURG operation is executed
GIVEN
CIMS PURG operation is executed
Applied to: PURG Operation Successful?
WHEN
The system checks operation status
THEN
If PURG operation is successful, customer report is successfully created, otherwise handle database operation error
Context: All database operations (CHNG, WRITMSGL, PURG) completed successfully
GIVEN
All database operations (CHNG, WRITMSGL, PURG) completed successfully
Applied to: Customer Report Successfully Created
WHEN
The system confirms report creation
THEN
Customer report is marked as successfully created and process completes normally
Context: Any database operation (CHNG, WRITMSGL, or PURG) fails
GIVEN
Any database operation (CHNG, WRITMSGL, or PURG) fails
Applied to: Handle Database Operation Error
WHEN
The system detects operation failure
THEN
Database operation error is handled and process terminates with error status
R-GCX146-cbl-00943 (+7) File: GCX146.cbl Equipment Car Formatting Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Car Formatting':
  • Context - an equipment car identifier contains spaces:
    For Remove Spaces from Car ID:
    When the system processes the car identifier for formatting, then all spaces are removed from the car identifier.
  • Context - a train number contains spaces:
    For Remove Spaces from Car ID:
    When the system builds the customs train identifier, then all spaces in the train number are replaced with zeros.
  • Context - a day component contains spaces:
    For Remove Spaces from Car ID:
    When the system builds the customs train identifier, then all spaces in the day component are replaced with zeros.
  • Context - a from station code contains spaces:
    For Remove Spaces from Car ID:
    When the system builds the customs train identifier, then all spaces in the from station code are replaced with zeros.
  • Context - a to station code contains spaces:
    For Remove Spaces from Car ID:
    When the system builds the customs train identifier, then all spaces in the to station code are replaced with zeros.
  • Context - a consist number contains spaces:
    For Remove Spaces from Car ID:
    When the system builds the customs train identifier, then all spaces in the consist number are replaced with zeros.
  • Context - equipment is identified as a container:
    For Apply Standard Formatting Rules:
    When the system processes the container for formatting, then the container identifier is formatted to 12-character standard format using gcccarfm utility.
  • Context - an equipment identifier is provided for processing:
    For Validate Car ID Format:
    When the system validates the identifier format, then the identifier must meet the required format standards to proceed with processing.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment car identifier contains spaces
GIVEN
An equipment car identifier contains spaces
Applied to: Remove Spaces from Car ID
WHEN
The system processes the car identifier for formatting
THEN
All spaces are removed from the car identifier
Context: A train number contains spaces
GIVEN
A train number contains spaces
Applied to: Remove Spaces from Car ID
WHEN
The system builds the customs train identifier
THEN
All spaces in the train number are replaced with zeros
Context: A day component contains spaces
GIVEN
A day component contains spaces
Applied to: Remove Spaces from Car ID
WHEN
The system builds the customs train identifier
THEN
All spaces in the day component are replaced with zeros
Context: A from station code contains spaces
GIVEN
A from station code contains spaces
Applied to: Remove Spaces from Car ID
WHEN
The system builds the customs train identifier
THEN
All spaces in the from station code are replaced with zeros
Context: A to station code contains spaces
GIVEN
A to station code contains spaces
Applied to: Remove Spaces from Car ID
WHEN
The system builds the customs train identifier
THEN
All spaces in the to station code are replaced with zeros
Context: A consist number contains spaces
GIVEN
A consist number contains spaces
Applied to: Remove Spaces from Car ID
WHEN
The system builds the customs train identifier
THEN
All spaces in the consist number are replaced with zeros
Context: Equipment is identified as a container
GIVEN
Equipment is identified as a container
Applied to: Apply Standard Formatting Rules
WHEN
The system processes the container for formatting
THEN
The container identifier is formatted to 12-character standard format using GCCCARFM utility
Context: An equipment identifier is provided for processing
GIVEN
An equipment identifier is provided for processing
Applied to: Validate Car ID Format
WHEN
The system validates the identifier format
THEN
The identifier must meet the required format standards to proceed with processing
R-GCX146-cbl-00951 (+9) File: GCX146.cbl Bunch Bill Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bunch Bill Processing':
  • Context - a waybill record exists in the system:
    For Identify Single Waybill with Multiple Cars:
    When the waybill contains multiple car equipment records associated with it, then the system identifies this as a bunch bill and prepares for sequential car processing.
  • Context - a bunch bill has been identified with multiple cars:
    For Initialize Sequential Car Processing:
    When sequential processing needs to be established, then the system initializes the car processing sequence to handle each car record systematically.
  • Context - a bunch bill requires processing:
    For Call Z980-PROCESS-BUNCHBILL:
    When sequential car processing has been initialized, then the system calls the z980-process-bunchbill module to execute bunch bill processing logic.
  • Context - the bunch bill processing module has been invoked:
    For Execute D2554A-BUNCH-BILL-RTN:
    When core bunch bill processing needs to be executed, then the system executes the d2554a-bunch-bill-rtn routine to process the bunch bill.
  • Context - a bunch bill processing routine is active:
    For Use FWCMSGET to Retrieve Next Car Record:
    When the next car record needs to be retrieved for processing, then the system uses fwcmsget to retrieve the next sequential car equipment record.
  • Context - a car record has been processed within a bunch bill:
    For More Cars Under This Waybill?:
    When the system needs to determine if more cars exist under the same waybill, then the system checks if additional car records remain for processing under this waybill.
  • Context - a car equipment record has been retrieved from the bunch bill:
    For Process Current Car Equipment Record:
    When the car record requires processing, then the system processes the current car equipment record applying all standard equipment processing rules.
  • Context - a car has been processed within a bunch bill:
    For Move to Next Car in Sequence:
    When more cars remain to be processed under the same waybill, then the system moves to the next car in the processing sequence.
  • Context - all cars under a bunch bill waybill have been processed:
    For Complete Bunch Bill Processing:
    When no more cars remain for processing under the current waybill, then the system completes the bunch bill processing and prepares to return to main processing.
  • Context - bunch bill processing has been completed:
    For Return to Main Equipment Processing:
    When all cars under the bunch bill have been processed, then the system returns control to the main equipment processing flow to continue with overall train processing.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill record exists in the system
GIVEN
A waybill record exists in the system
Applied to: Identify Single Waybill with Multiple Cars
WHEN
The waybill contains multiple car equipment records associated with it
THEN
The system identifies this as a bunch bill and prepares for sequential car processing
Context: A bunch bill has been identified with multiple cars
GIVEN
A bunch bill has been identified with multiple cars
Applied to: Initialize Sequential Car Processing
WHEN
Sequential processing needs to be established
THEN
The system initializes the car processing sequence to handle each car record systematically
Context: A bunch bill requires processing
GIVEN
A bunch bill requires processing
Applied to: Call Z980-PROCESS-BUNCHBILL
WHEN
Sequential car processing has been initialized
THEN
The system calls the Z980-PROCESS-BUNCHBILL module to execute bunch bill processing logic
Context: The bunch bill processing module has been invoked
GIVEN
The bunch bill processing module has been invoked
Applied to: Execute D2554A-BUNCH-BILL-RTN
WHEN
Core bunch bill processing needs to be executed
THEN
The system executes the D2554A-BUNCH-BILL-RTN routine to process the bunch bill
Context: A bunch bill processing routine is active
GIVEN
A bunch bill processing routine is active
Applied to: Use FWCMSGET to Retrieve Next Car Record
WHEN
The next car record needs to be retrieved for processing
THEN
The system uses FWCMSGET to retrieve the next sequential car equipment record
Context: A car record has been processed within a bunch bill
GIVEN
A car record has been processed within a bunch bill
Applied to: More Cars Under This Waybill?
WHEN
The system needs to determine if more cars exist under the same waybill
THEN
The system checks if additional car records remain for processing under this waybill
Context: A car equipment record has been retrieved from the bunch bill
GIVEN
A car equipment record has been retrieved from the bunch bill
Applied to: Process Current Car Equipment Record
WHEN
The car record requires processing
THEN
The system processes the current car equipment record applying all standard equipment processing rules
Context: A car has been processed within a bunch bill
GIVEN
A car has been processed within a bunch bill
Applied to: Move to Next Car in Sequence
WHEN
More cars remain to be processed under the same waybill
THEN
The system moves to the next car in the processing sequence
Context: All cars under a bunch bill waybill have been processed
GIVEN
All cars under a bunch bill waybill have been processed
Applied to: Complete Bunch Bill Processing
WHEN
No more cars remain for processing under the current waybill
THEN
The system completes the bunch bill processing and prepares to return to main processing
Context: Bunch bill processing has been completed
GIVEN
Bunch bill processing has been completed
Applied to: Return to Main Equipment Processing
WHEN
All cars under the bunch bill have been processed
THEN
The system returns control to the main equipment processing flow to continue with overall train processing
R-GCX146-cbl-00961 (+12) File: GCX146.cbl Additional Car Sequence Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Additional Car Sequence Processing':
  • Context - a waybill contains multiple cars in a bunch bill arrangement:
    For Initialize Bunch Bill Processing:
    When the system begins processing additional car sequences, then the bunch bill processing parameters are initialized and ready for car sequence processing.
  • Context - bunch bill processing has been initialized:
    For Call D2554A-BUNCH-BILL-RTN:
    When the system needs to process cars in a bunch bill sequence, then the d2554a-bunch-bill-rtn routine is called to handle the bunch bill processing.
  • Context - a bunch bill contains multiple equipment records:
    For Use FWCMSGET to Get Next Equipment Record:
    When the system processes each car in the sequence, then the fwcmsget function retrieves the next equipment record from the shiproot waybill data.
  • Context - the system attempts to retrieve an equipment record from waybill data:
    For Equipment Record Found?:
    When the fwcmsget function is executed, then the system validates whether an equipment record was found and continues processing if found, or completes processing if no more records exist.
  • Context - an equipment record has been successfully retrieved from waybill data:
    For Extract Car Identification Data:
    When the system processes the equipment record, then car identification data is extracted from the equipment record for validation and processing.
  • Context - car identification data has been extracted from an equipment record:
    For Validate Car ID Format:
    When the system validates the car id format, then the car id format is checked against required standards and marked as valid or invalid.
  • Context - a car id has been validated against format requirements:
    For Car ID Valid?:
    When the system evaluates car id validity, then the system determines if the car id is valid for processing or requires error handling.
  • Context - a car id has been validated as meeting format requirements:
    For Process Car in Sequence:
    When the car id is determined to be valid, then the car is processed as part of the bunch bill sequence.
  • Context - a car has been successfully processed in the bunch bill sequence:
    For Increment Car Sequence Counter:
    When the car processing is completed, then the car sequence counter is incremented to track the number of processed cars.
  • Context - a car has been processed and the sequence counter has been incremented:
    For More Cars in Bunch Bill?:
    When the system checks for remaining cars in the bunch bill, then the system determines whether more cars exist for processing or if the bunch bill is complete.
  • Context - a car id has been extracted from an equipment record:
    For Log Invalid Car ID Error:
    When the car id fails format validation, then an invalid car id error is logged for tracking and audit purposes.
  • Context - a car id has been determined to be invalid and an error has been logged:
    For Skip Invalid Car Record:
    When the system continues bunch bill processing, then the invalid car record is skipped and processing continues with the next car in the sequence.
  • Context - all cars in the bunch bill have been processed or no more equipment records are available:
    For Complete Additional Car Processing:
    When the bunch bill processing reaches completion, then the additional car processing is completed and the system is ready for the next processing step.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill contains multiple cars in a bunch bill arrangement
GIVEN
A waybill contains multiple cars in a bunch bill arrangement
Applied to: Initialize Bunch Bill Processing
WHEN
The system begins processing additional car sequences
THEN
The bunch bill processing parameters are initialized and ready for car sequence processing
Context: Bunch bill processing has been initialized
GIVEN
Bunch bill processing has been initialized
Applied to: Call D2554A-BUNCH-BILL-RTN
WHEN
The system needs to process cars in a bunch bill sequence
THEN
The D2554A-BUNCH-BILL-RTN routine is called to handle the bunch bill processing
Context: A bunch bill contains multiple equipment records
GIVEN
A bunch bill contains multiple equipment records
Applied to: Use FWCMSGET to Get Next Equipment Record
WHEN
The system processes each car in the sequence
THEN
The FWCMSGET function retrieves the next equipment record from the SHIPROOT waybill data
Context: The system attempts to retrieve an equipment record from waybill data
GIVEN
The system attempts to retrieve an equipment record from waybill data
Applied to: Equipment Record Found?
WHEN
The FWCMSGET function is executed
THEN
The system validates whether an equipment record was found and continues processing if found, or completes processing if no more records exist
Context: An equipment record has been successfully retrieved from waybill data
GIVEN
An equipment record has been successfully retrieved from waybill data
Applied to: Extract Car Identification Data
WHEN
The system processes the equipment record
THEN
Car identification data is extracted from the equipment record for validation and processing
Context: Car identification data has been extracted from an equipment record
GIVEN
Car identification data has been extracted from an equipment record
Applied to: Validate Car ID Format
WHEN
The system validates the car ID format
THEN
The car ID format is checked against required standards and marked as valid or invalid
Context: A car ID has been validated against format requirements
GIVEN
A car ID has been validated against format requirements
Applied to: Car ID Valid?
WHEN
The system evaluates car ID validity
THEN
The system determines if the car ID is valid for processing or requires error handling
Context: A car ID has been validated as meeting format requirements
GIVEN
A car ID has been validated as meeting format requirements
Applied to: Process Car in Sequence
WHEN
The car ID is determined to be valid
THEN
The car is processed as part of the bunch bill sequence
Context: A car has been successfully processed in the bunch bill sequence
GIVEN
A car has been successfully processed in the bunch bill sequence
Applied to: Increment Car Sequence Counter
WHEN
The car processing is completed
THEN
The car sequence counter is incremented to track the number of processed cars
Context: A car has been processed and the sequence counter has been incremented
GIVEN
A car has been processed and the sequence counter has been incremented
Applied to: More Cars in Bunch Bill?
WHEN
The system checks for remaining cars in the bunch bill
THEN
The system determines whether more cars exist for processing or if the bunch bill is complete
Context: A car ID has been extracted from an equipment record
GIVEN
A car ID has been extracted from an equipment record
Applied to: Log Invalid Car ID Error
WHEN
The car ID fails format validation
THEN
An invalid car ID error is logged for tracking and audit purposes
Context: A car ID has been determined to be invalid and an error has been logged
GIVEN
A car ID has been determined to be invalid and an error has been logged
Applied to: Skip Invalid Car Record
WHEN
The system continues bunch bill processing
THEN
The invalid car record is skipped and processing continues with the next car in the sequence
Context: All cars in the bunch bill have been processed or no more equipment records are available
GIVEN
All cars in the bunch bill have been processed or no more equipment records are available
Applied to: Complete Additional Car Processing
WHEN
The bunch bill processing reaches completion
THEN
The additional car processing is completed and the system is ready for the next processing step
R-GCX146-cbl-00974 (+16) File: GCX146.cbl US Trip Sheet Data Preparation Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US Trip Sheet Data Preparation':
  • Context - a us trip sheet generation process is starting:
    For Initialize US Trip Sheet Equipment Records:
    When the system begins processing equipment records, then equipment counters are reset to zero and processing flags are initialized.
  • Context - a train consist record exists with equipment information:
    For Extract Equipment Information:
    When the system processes each equipment entry, then equipment id, type, status, and associated data are extracted for further processing.
  • Context - equipment information has been extracted from train records:
    For Determine Equipment Type:
    When the system analyzes equipment characteristics, then equipment is classified as idler, unit, van, etu, or other type based on its properties.
  • Context - equipment is classified as idler type:
    For Process IDLER Equipment:
    When the system processes the idler equipment, then idler equipment data is formatted according to us customs requirements with appropriate status indicators.
  • Context - equipment is classified as unit type (locomotives, power units):
    For Process UNIT Equipment:
    When the system processes the unit equipment, then unit equipment data is formatted with proper identification and status information for us customs reporting.
  • Context - equipment is classified as van type:
    For Process VAN Equipment:
    When the system processes the van equipment, then van equipment data is formatted with cargo information and customs status for trip sheet reporting.
  • Context - equipment is classified as etu type:
    For Process ETU Equipment:
    When the system processes the etu equipment, then etu equipment data is formatted with appropriate technical specifications and status for customs reporting.
  • Context - equipment is classified as other type (not idler, unit, van, or etu):
    For Process Other Equipment Types:
    When the system processes the other equipment type, then equipment data is formatted using standard default rules for us customs trip sheet reporting.
  • Context - equipment has been processed according to its type classification:
    For Format Equipment Data for US Customs:
    When the system formats the equipment data for us customs, then equipment information is structured in compliance with us customs trip sheet format requirements including proper field positioning and data validation.
  • Context - equipment data has been formatted for us customs requirements:
    For Build Merlin Transmission Lines:
    When the system builds merlin transmission lines, then message lines are constructed with proper formatting, sequencing, and transmission headers for merlin system delivery.
  • Context - merlin transmission lines have been built for equipment:
    For Prepare Equipment Type Messages:
    When the system prepares equipment type messages, then messages are customized with equipment-specific information, status codes, and regulatory data appropriate for each equipment type.
  • Context - equipment type messages have been prepared:
    For Format Equipment Car IDs:
    When the system formats equipment car ids, then car identification numbers are standardized with proper length, character formatting, and validation according to railroad and customs standards.
  • Context - equipment car ids have been formatted:
    For Compile Equipment Status Information:
    When the system compiles equipment status information, then complete status records are created including customs status, transit information, cargo details, and regulatory compliance data.
  • Context - equipment status information has been compiled into trip sheet format:
    For Segment Message for Transmission:
    When the message exceeds transmission system limits, then the message is segmented into multiple parts with proper continuation headers and sequence numbering to ensure complete delivery.
  • Context - current equipment record has been processed and segmented for transmission:
    For More Equipment?:
    When the system checks for additional equipment in the train consist, then if more equipment exists, processing continues with the next equipment record; otherwise, processing moves to finalization.
  • Context - all equipment records have been processed and no more equipment remains:
    For Finalize US Trip Sheet Data:
    When the system finalizes the us trip sheet data, then trip sheet is completed with summary totals, final formatting, and all required regulatory information for us customs submission.
  • Context - us trip sheet data has been finalized with all equipment and summary information:
    For Ready for Merlin Transmission:
    When the system prepares for merlin transmission, then trip sheet is formatted for merlin system delivery with proper transmission headers, routing information, and delivery confirmation requirements.
👨‍💻 Technical ACs (Gherkin)
Context: A US trip sheet generation process is starting
GIVEN
A US trip sheet generation process is starting
Applied to: Initialize US Trip Sheet Equipment Records
WHEN
The system begins processing equipment records
THEN
Equipment counters are reset to zero and processing flags are initialized
Context: A train consist record exists with equipment information
GIVEN
A train consist record exists with equipment information
Applied to: Extract Equipment Information
WHEN
The system processes each equipment entry
THEN
Equipment ID, type, status, and associated data are extracted for further processing
Context: Equipment information has been extracted from train records
GIVEN
Equipment information has been extracted from train records
Applied to: Determine Equipment Type
WHEN
The system analyzes equipment characteristics
THEN
Equipment is classified as IDLER, UNIT, VAN, ETU, or Other type based on its properties
Context: Equipment is classified as IDLER type
GIVEN
Equipment is classified as IDLER type
Applied to: Process IDLER Equipment
WHEN
The system processes the IDLER equipment
THEN
IDLER equipment data is formatted according to US customs requirements with appropriate status indicators
Context: Equipment is classified as UNIT type (locomotives, power units)
GIVEN
Equipment is classified as UNIT type (locomotives, power units)
Applied to: Process UNIT Equipment
WHEN
The system processes the UNIT equipment
THEN
UNIT equipment data is formatted with proper identification and status information for US customs reporting
Context: Equipment is classified as VAN type
GIVEN
Equipment is classified as VAN type
Applied to: Process VAN Equipment
WHEN
The system processes the VAN equipment
THEN
VAN equipment data is formatted with cargo information and customs status for trip sheet reporting
Context: Equipment is classified as ETU type
GIVEN
Equipment is classified as ETU type
Applied to: Process ETU Equipment
WHEN
The system processes the ETU equipment
THEN
ETU equipment data is formatted with appropriate technical specifications and status for customs reporting
Context: Equipment is classified as Other type (not IDLER, UNIT, VAN, or ETU)
GIVEN
Equipment is classified as Other type (not IDLER, UNIT, VAN, or ETU)
Applied to: Process Other Equipment Types
WHEN
The system processes the other equipment type
THEN
Equipment data is formatted using standard default rules for US customs trip sheet reporting
Context: Equipment has been processed according to its type classification
GIVEN
Equipment has been processed according to its type classification
Applied to: Format Equipment Data for US Customs
WHEN
The system formats the equipment data for US customs
THEN
Equipment information is structured in compliance with US customs trip sheet format requirements including proper field positioning and data validation
Context: Equipment data has been formatted for US customs requirements
GIVEN
Equipment data has been formatted for US customs requirements
Applied to: Build Merlin Transmission Lines
WHEN
The system builds Merlin transmission lines
THEN
Message lines are constructed with proper formatting, sequencing, and transmission headers for Merlin system delivery
Context: Merlin transmission lines have been built for equipment
GIVEN
Merlin transmission lines have been built for equipment
Applied to: Prepare Equipment Type Messages
WHEN
The system prepares equipment type messages
THEN
Messages are customized with equipment-specific information, status codes, and regulatory data appropriate for each equipment type
Context: Equipment type messages have been prepared
GIVEN
Equipment type messages have been prepared
Applied to: Format Equipment Car IDs
WHEN
The system formats equipment car IDs
THEN
Car identification numbers are standardized with proper length, character formatting, and validation according to railroad and customs standards
Context: Equipment car IDs have been formatted
GIVEN
Equipment car IDs have been formatted
Applied to: Compile Equipment Status Information
WHEN
The system compiles equipment status information
THEN
Complete status records are created including customs status, transit information, cargo details, and regulatory compliance data
Context: Equipment status information has been compiled into trip sheet format
GIVEN
Equipment status information has been compiled into trip sheet format
Applied to: Segment Message for Transmission
WHEN
The message exceeds transmission system limits
THEN
The message is segmented into multiple parts with proper continuation headers and sequence numbering to ensure complete delivery
Context: Current equipment record has been processed and segmented for transmission
GIVEN
Current equipment record has been processed and segmented for transmission
Applied to: More Equipment?
WHEN
The system checks for additional equipment in the train consist
THEN
If more equipment exists, processing continues with the next equipment record; otherwise, processing moves to finalization
Context: All equipment records have been processed and no more equipment remains
GIVEN
All equipment records have been processed and no more equipment remains
Applied to: Finalize US Trip Sheet Data
WHEN
The system finalizes the US trip sheet data
THEN
Trip sheet is completed with summary totals, final formatting, and all required regulatory information for US customs submission
Context: US trip sheet data has been finalized with all equipment and summary information
GIVEN
US trip sheet data has been finalized with all equipment and summary information
Applied to: Ready for Merlin Transmission
WHEN
The system prepares for Merlin transmission
THEN
Trip sheet is formatted for Merlin system delivery with proper transmission headers, routing information, and delivery confirmation requirements
R-GCX146-cbl-00991 (+17) File: GCX146.cbl Merlin Report Line Processing Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Report Line Processing':
  • Context - a merlin report needs to be processed for transmission:
    For Initialize Line Counter:
    When the system starts processing report lines, then the line counter is set to zero and message buffer is initialized.
  • Context - report lines are available for processing:
    For Get Next Report Line:
    When the system requests the next report line, then the next sequential report line is retrieved from the report data.
  • Context - the system is processing report lines:
    For Line Available?:
    When the system checks for line availability, then if lines are available, continue processing; if no lines available, finalize current message.
  • Context - a report line is available for processing:
    For Format Line for Merlin Transmission:
    When the system formats the line for merlin transmission, then the line is formatted according to merlin protocol specifications.
  • Context - a formatted report line is ready to be added to the message buffer:
    For Check Line Length Limits:
    When the system checks the current line count in the message, then if the message has 699 or more lines, create a continuation message; otherwise add line to current message.
  • Context - a formatted report line is ready and message buffer has not exceeded line limits:
    For Add Line to Current Message Buffer:
    When the system adds the line to the message buffer, then the line is appended to the current message buffer.
  • Context - a report line has been added to the message buffer:
    For Increment Line Counter:
    When the system updates the line counter, then the line counter is incremented by one.
  • Context - the current message has reached or exceeded 699 lines:
    For Create Continuation Message:
    When the system needs to add more lines, then a new continuation message is created to handle additional lines.
  • Context - a continuation message needs to be created:
    For Reset Message Buffer:
    When the system resets the message buffer, then the message buffer is cleared and line counter is reset to zero.
  • Context - a continuation message has been created:
    For Add Continuation Header:
    When the system adds the continuation header, then the header 'continuation of report....' is added to the beginning of the new message.
  • Context - equipment data is available for processing:
    For Process Equipment Type Messages:
    When the system processes equipment type messages, then each equipment type (idler, unit, van, etu) is processed according to its specific requirements.
  • Context - idler equipment data is available:
    For Process IDLER Equipment:
    When the system processes idler equipment, then idler equipment information is formatted and included in the report.
  • Context - unit equipment data is available:
    For Process UNIT Equipment:
    When the system processes unit equipment, then unit equipment information is formatted and included in the report.
  • Context - van equipment data is available:
    For Process VAN Equipment:
    When the system processes van equipment, then van equipment information is formatted and included in the report.
  • Context - etu equipment data is available:
    For Process ETU Equipment:
    When the system processes etu equipment, then etu equipment information is formatted and included in the report.
  • Context - equipment type processing has been completed for current line:
    For More Lines to Process?:
    When the system checks for more lines to process, then if more lines exist, continue processing; if no more lines, finalize the current message.
  • Context - all available lines have been processed or message is complete:
    For Finalize Current Message:
    When the system finalizes the current message, then the message buffer is prepared for transmission with proper formatting and headers.
  • Context - a message has been finalized and is ready for transmission:
    For Send Message via Merlin:
    When the system sends the message via merlin, then the message is transmitted through the merlin system to the intended recipients.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin report needs to be processed for transmission
GIVEN
A Merlin report needs to be processed for transmission
Applied to: Initialize Line Counter
WHEN
The system starts processing report lines
THEN
The line counter is set to zero and message buffer is initialized
Context: Report lines are available for processing
GIVEN
Report lines are available for processing
Applied to: Get Next Report Line
WHEN
The system requests the next report line
THEN
The next sequential report line is retrieved from the report data
Context: The system is processing report lines
GIVEN
The system is processing report lines
Applied to: Line Available?
WHEN
The system checks for line availability
THEN
If lines are available, continue processing; if no lines available, finalize current message
Context: A report line is available for processing
GIVEN
A report line is available for processing
Applied to: Format Line for Merlin Transmission
WHEN
The system formats the line for Merlin transmission
THEN
The line is formatted according to Merlin protocol specifications
Context: A formatted report line is ready to be added to the message buffer
GIVEN
A formatted report line is ready to be added to the message buffer
Applied to: Check Line Length Limits
WHEN
The system checks the current line count in the message
THEN
If the message has 699 or more lines, create a continuation message; otherwise add line to current message
Context: A formatted report line is ready and message buffer has not exceeded line limits
GIVEN
A formatted report line is ready and message buffer has not exceeded line limits
Applied to: Add Line to Current Message Buffer
WHEN
The system adds the line to the message buffer
THEN
The line is appended to the current message buffer
Context: A report line has been added to the message buffer
GIVEN
A report line has been added to the message buffer
Applied to: Increment Line Counter
WHEN
The system updates the line counter
THEN
The line counter is incremented by one
Context: The current message has reached or exceeded 699 lines
GIVEN
The current message has reached or exceeded 699 lines
Applied to: Create Continuation Message
WHEN
The system needs to add more lines
THEN
A new continuation message is created to handle additional lines
Context: A continuation message needs to be created
GIVEN
A continuation message needs to be created
Applied to: Reset Message Buffer
WHEN
The system resets the message buffer
THEN
The message buffer is cleared and line counter is reset to zero
Context: A continuation message has been created
GIVEN
A continuation message has been created
Applied to: Add Continuation Header
WHEN
The system adds the continuation header
THEN
The header 'CONTINUATION OF REPORT....' is added to the beginning of the new message
Context: Equipment data is available for processing
GIVEN
Equipment data is available for processing
Applied to: Process Equipment Type Messages
WHEN
The system processes equipment type messages
THEN
Each equipment type (IDLER, UNIT, VAN, ETU) is processed according to its specific requirements
Context: IDLER equipment data is available
GIVEN
IDLER equipment data is available
Applied to: Process IDLER Equipment
WHEN
The system processes IDLER equipment
THEN
IDLER equipment information is formatted and included in the report
Context: UNIT equipment data is available
GIVEN
UNIT equipment data is available
Applied to: Process UNIT Equipment
WHEN
The system processes UNIT equipment
THEN
UNIT equipment information is formatted and included in the report
Context: VAN equipment data is available
GIVEN
VAN equipment data is available
Applied to: Process VAN Equipment
WHEN
The system processes VAN equipment
THEN
VAN equipment information is formatted and included in the report
Context: ETU equipment data is available
GIVEN
ETU equipment data is available
Applied to: Process ETU Equipment
WHEN
The system processes ETU equipment
THEN
ETU equipment information is formatted and included in the report
Context: Equipment type processing has been completed for current line
GIVEN
Equipment type processing has been completed for current line
Applied to: More Lines to Process?
WHEN
The system checks for more lines to process
THEN
If more lines exist, continue processing; if no more lines, finalize the current message
Context: All available lines have been processed or message is complete
GIVEN
All available lines have been processed or message is complete
Applied to: Finalize Current Message
WHEN
The system finalizes the current message
THEN
The message buffer is prepared for transmission with proper formatting and headers
Context: A message has been finalized and is ready for transmission
GIVEN
A message has been finalized and is ready for transmission
Applied to: Send Message via Merlin
WHEN
The system sends the message via Merlin
THEN
The message is transmitted through the Merlin system to the intended recipients
R-GCX146-cbl-01009 (+19) File: GCX146.cbl Equipment Information Message Assignment Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Information Message Assignment':
  • Context - an equipment record with a specific car type code:
    For Equipment Type?:
    When the system evaluates the equipment type for message assignment, then the system classifies the equipment as idler, unit, van, etu, container, trailer, or standard car based on the car type code patterns.
  • Context - equipment has been classified as idler type:
    For Assign IDLER Message:
    When the system processes the equipment for message assignment, then the system assigns the appropriate idler equipment message format.
  • Context - equipment has been classified as unit type with car type codes l, p, d, or u:
    For Assign UNIT Message:
    When the system processes the equipment for message assignment, then the system assigns the appropriate unit equipment message format.
  • Context - equipment has been classified as van type with car type code v:
    For Assign VAN Message:
    When the system processes the equipment for message assignment, then the system assigns the appropriate van equipment message format.
  • Context - equipment has been classified as etu type with car type code e:
    For Assign ETU Message:
    When the system processes the equipment for message assignment, then the system assigns the appropriate etu equipment message format.
  • Context - equipment has been identified as a container type:
    For Assign Container Message:
    When the system processes the equipment for message assignment, then the system assigns the appropriate container equipment message format.
  • Context - equipment has been identified as a trailer type:
    For Assign Trailer Message:
    When the system processes the equipment for message assignment, then the system assigns the appropriate trailer equipment message format.
  • Context - equipment does not match idler, unit, van, etu, container, or trailer classifications:
    For Assign Car Message:
    When the system processes the equipment for message assignment, then the system assigns the standard car equipment message format.
  • Context - equipment has been assigned a type classification:
    For Equipment Status?:
    When the system evaluates the equipment status for message assignment, then the system determines if the equipment is load, empty, transit, release, or held status.
  • Context - equipment status indicates loaded condition:
    For Assign Load Status Message:
    When the system processes the equipment status for message assignment, then the system assigns the appropriate load status message.
  • Context - equipment status indicates empty condition:
    For Assign Empty Status Message:
    When the system processes the equipment status for message assignment, then the system assigns the appropriate empty status message.
  • Context - equipment status indicates transit condition:
    For Assign Transit Status Message:
    When the system processes the equipment status for message assignment, then the system assigns the appropriate transit status message.
  • Context - equipment status indicates released condition:
    For Assign Release Status Message:
    When the system processes the equipment status for message assignment, then the system assigns the appropriate release status message.
  • Context - equipment status indicates held condition:
    For Assign Held Status Message:
    When the system processes the equipment status for message assignment, then the system assigns the appropriate held status message.
  • Context - equipment has been assigned type and status messages:
    For Special Processing Required?:
    When the system evaluates special processing requirements, then the system determines if equipment needs bunch bill, flat car container, return ccn, or standard processing.
  • Context - equipment requires bunch bill special processing:
    For Assign Bunch Bill Message:
    When the system processes the equipment for bunch bill message assignment, then the system assigns the appropriate bunch bill message format.
  • Context - equipment requires flat car container special processing:
    For Assign Flat Car Container Message:
    When the system processes the equipment for flat car container message assignment, then the system assigns the appropriate flat car container message format.
  • Context - equipment requires return ccn special processing:
    For Assign Return CCN Message:
    When the system processes the equipment for return ccn message assignment, then the system assigns the appropriate return ccn message format.
  • Context - equipment has been assigned appropriate type, status, and special processing messages:
    For Format Equipment Information:
    When the system formats the equipment information, then the system creates properly formatted equipment information message ready for storage.
  • Context - equipment information has been properly formatted:
    For Store Message Assignment:
    When the system stores the message assignment, then the system saves the equipment message assignment data for subsequent processing steps.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record with a specific car type code
GIVEN
An equipment record with a specific car type code
Applied to: Equipment Type?
WHEN
The system evaluates the equipment type for message assignment
THEN
The system classifies the equipment as IDLER, UNIT, VAN, ETU, Container, Trailer, or standard Car based on the car type code patterns
Context: Equipment has been classified as IDLER type
GIVEN
Equipment has been classified as IDLER type
Applied to: Assign IDLER Message
WHEN
The system processes the equipment for message assignment
THEN
The system assigns the appropriate IDLER equipment message format
Context: Equipment has been classified as UNIT type with car type codes L, P, D, or U
GIVEN
Equipment has been classified as UNIT type with car type codes L, P, D, or U
Applied to: Assign UNIT Message
WHEN
The system processes the equipment for message assignment
THEN
The system assigns the appropriate UNIT equipment message format
Context: Equipment has been classified as VAN type with car type code V
GIVEN
Equipment has been classified as VAN type with car type code V
Applied to: Assign VAN Message
WHEN
The system processes the equipment for message assignment
THEN
The system assigns the appropriate VAN equipment message format
Context: Equipment has been classified as ETU type with car type code E
GIVEN
Equipment has been classified as ETU type with car type code E
Applied to: Assign ETU Message
WHEN
The system processes the equipment for message assignment
THEN
The system assigns the appropriate ETU equipment message format
Context: Equipment has been identified as a container type
GIVEN
Equipment has been identified as a container type
Applied to: Assign Container Message
WHEN
The system processes the equipment for message assignment
THEN
The system assigns the appropriate container equipment message format
Context: Equipment has been identified as a trailer type
GIVEN
Equipment has been identified as a trailer type
Applied to: Assign Trailer Message
WHEN
The system processes the equipment for message assignment
THEN
The system assigns the appropriate trailer equipment message format
Context: Equipment does not match IDLER, UNIT, VAN, ETU, Container, or Trailer classifications
GIVEN
Equipment does not match IDLER, UNIT, VAN, ETU, Container, or Trailer classifications
Applied to: Assign Car Message
WHEN
The system processes the equipment for message assignment
THEN
The system assigns the standard car equipment message format
Context: Equipment has been assigned a type classification
GIVEN
Equipment has been assigned a type classification
Applied to: Equipment Status?
WHEN
The system evaluates the equipment status for message assignment
THEN
The system determines if the equipment is Load, Empty, Transit, Release, or Held status
Context: Equipment status indicates loaded condition
GIVEN
Equipment status indicates loaded condition
Applied to: Assign Load Status Message
WHEN
The system processes the equipment status for message assignment
THEN
The system assigns the appropriate load status message
Context: Equipment status indicates empty condition
GIVEN
Equipment status indicates empty condition
Applied to: Assign Empty Status Message
WHEN
The system processes the equipment status for message assignment
THEN
The system assigns the appropriate empty status message
Context: Equipment status indicates transit condition
GIVEN
Equipment status indicates transit condition
Applied to: Assign Transit Status Message
WHEN
The system processes the equipment status for message assignment
THEN
The system assigns the appropriate transit status message
Context: Equipment status indicates released condition
GIVEN
Equipment status indicates released condition
Applied to: Assign Release Status Message
WHEN
The system processes the equipment status for message assignment
THEN
The system assigns the appropriate release status message
Context: Equipment status indicates held condition
GIVEN
Equipment status indicates held condition
Applied to: Assign Held Status Message
WHEN
The system processes the equipment status for message assignment
THEN
The system assigns the appropriate held status message
Context: Equipment has been assigned type and status messages
GIVEN
Equipment has been assigned type and status messages
Applied to: Special Processing Required?
WHEN
The system evaluates special processing requirements
THEN
The system determines if equipment needs Bunch Bill, Flat Car Container, Return CCN, or standard processing
Context: Equipment requires bunch bill special processing
GIVEN
Equipment requires bunch bill special processing
Applied to: Assign Bunch Bill Message
WHEN
The system processes the equipment for bunch bill message assignment
THEN
The system assigns the appropriate bunch bill message format
Context: Equipment requires flat car container special processing
GIVEN
Equipment requires flat car container special processing
Applied to: Assign Flat Car Container Message
WHEN
The system processes the equipment for flat car container message assignment
THEN
The system assigns the appropriate flat car container message format
Context: Equipment requires return CCN special processing
GIVEN
Equipment requires return CCN special processing
Applied to: Assign Return CCN Message
WHEN
The system processes the equipment for return CCN message assignment
THEN
The system assigns the appropriate return CCN message format
Context: Equipment has been assigned appropriate type, status, and special processing messages
GIVEN
Equipment has been assigned appropriate type, status, and special processing messages
Applied to: Format Equipment Information
WHEN
The system formats the equipment information
THEN
The system creates properly formatted equipment information message ready for storage
Context: Equipment information has been properly formatted
GIVEN
Equipment information has been properly formatted
Applied to: Store Message Assignment
WHEN
The system stores the message assignment
THEN
The system saves the equipment message assignment data for subsequent processing steps
R-GCX146-cbl-01029 (+14) File: GCX146.cbl Bunch Bill Waybill Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bunch Bill Waybill Processing':
  • Context - a waybill record exists in the system:
    For Initialize Bunch Bill Sequence:
    When the system begins bunch bill processing, then the bunch bill sequence counter is set to 1 and processing flags are initialized.
  • Context - a waybill number is provided for processing:
    For Retrieve Primary Waybill Record:
    When the system attempts to retrieve the waybill record, then the primary waybill record is retrieved from fwiiroot database.
  • Context - a waybill record has been retrieved:
    For Waybill Has Multiple Cars?:
    When the system examines the waybill structure, then if the waybill contains multiple cars, sequential processing is initiated, otherwise processing ends.
  • Context - a bunch bill with multiple cars has been identified:
    For Set Sequential Car Counter:
    When sequential processing begins, then the car counter is initialized to track each car in the sequence.
  • Context - a car position in the bunch bill sequence is identified:
    For Process Current Car Equipment:
    When the system processes the current car, then equipment details for the current car are extracted and prepared for validation.
  • Context - an equipment id has been extracted from the waybill:
    For Validate Equipment ID:
    When the system validates the equipment id, then the equipment id is verified against shiproot equipment records for existence and format compliance.
  • Context - an equipment id has been validated successfully:
    For Extract Car Details:
    When the system extracts car details, then complete car information including type, status, and specifications are extracted from the equipment records.
  • Context - car details have been successfully extracted:
    For Store Car Information:
    When the system stores the car information, then car information is stored in the processing queue for subsequent operations.
  • Context - a car has been successfully processed:
    For Increment Car Counter:
    When the system completes processing of the current car, then the car counter is incremented to move to the next car in the sequence.
  • Context - the car counter has been incremented:
    For Retrieve Next Car in Sequence:
    When the system retrieves the next car in sequence, then the next car record is retrieved from fwiiroot database using the sequential position.
  • Context - a car has been processed and counter incremented:
    For More Cars in Bunch Bill?:
    When the system checks for more cars, then if additional cars exist in the bunch bill, processing continues with the next car, otherwise processing finalizes.
  • Context - all cars in the bunch bill have been processed:
    For Finalize Bunch Bill Processing:
    When the system finalizes bunch bill processing, then processing results are consolidated and prepared for final output.
  • Context - bunch bill processing has been finalized:
    For Update Equipment Totals:
    When the system updates equipment totals, then total equipment counts, status summaries, and processing statistics are updated with bunch bill results.
  • Context - an equipment id fails validation:
    For Handle Equipment Error:
    When the system handles the equipment error, then error handling procedures are initiated and the invalid equipment is flagged for review.
  • Context - invalid equipment has been identified:
    For Log Invalid Equipment:
    When the system logs the invalid equipment, then equipment details and error information are logged for subsequent review and correction.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill record exists in the system
GIVEN
A waybill record exists in the system
Applied to: Initialize Bunch Bill Sequence
WHEN
The system begins bunch bill processing
THEN
The bunch bill sequence counter is set to 1 and processing flags are initialized
Context: A waybill number is provided for processing
GIVEN
A waybill number is provided for processing
Applied to: Retrieve Primary Waybill Record
WHEN
The system attempts to retrieve the waybill record
THEN
The primary waybill record is retrieved from FWIIROOT database
Context: A waybill record has been retrieved
GIVEN
A waybill record has been retrieved
Applied to: Waybill Has Multiple Cars?
WHEN
The system examines the waybill structure
THEN
If the waybill contains multiple cars, sequential processing is initiated, otherwise processing ends
Context: A bunch bill with multiple cars has been identified
GIVEN
A bunch bill with multiple cars has been identified
Applied to: Set Sequential Car Counter
WHEN
Sequential processing begins
THEN
The car counter is initialized to track each car in the sequence
Context: A car position in the bunch bill sequence is identified
GIVEN
A car position in the bunch bill sequence is identified
Applied to: Process Current Car Equipment
WHEN
The system processes the current car
THEN
Equipment details for the current car are extracted and prepared for validation
Context: An equipment ID has been extracted from the waybill
GIVEN
An equipment ID has been extracted from the waybill
Applied to: Validate Equipment ID
WHEN
The system validates the equipment ID
THEN
The equipment ID is verified against SHIPROOT equipment records for existence and format compliance
Context: An equipment ID has been validated successfully
GIVEN
An equipment ID has been validated successfully
Applied to: Extract Car Details
WHEN
The system extracts car details
THEN
Complete car information including type, status, and specifications are extracted from the equipment records
Context: Car details have been successfully extracted
GIVEN
Car details have been successfully extracted
Applied to: Store Car Information
WHEN
The system stores the car information
THEN
Car information is stored in the processing queue for subsequent operations
Context: A car has been successfully processed
GIVEN
A car has been successfully processed
Applied to: Increment Car Counter
WHEN
The system completes processing of the current car
THEN
The car counter is incremented to move to the next car in the sequence
Context: The car counter has been incremented
GIVEN
The car counter has been incremented
Applied to: Retrieve Next Car in Sequence
WHEN
The system retrieves the next car in sequence
THEN
The next car record is retrieved from FWIIROOT database using the sequential position
Context: A car has been processed and counter incremented
GIVEN
A car has been processed and counter incremented
Applied to: More Cars in Bunch Bill?
WHEN
The system checks for more cars
THEN
If additional cars exist in the bunch bill, processing continues with the next car, otherwise processing finalizes
Context: All cars in the bunch bill have been processed
GIVEN
All cars in the bunch bill have been processed
Applied to: Finalize Bunch Bill Processing
WHEN
The system finalizes bunch bill processing
THEN
Processing results are consolidated and prepared for final output
Context: Bunch bill processing has been finalized
GIVEN
Bunch bill processing has been finalized
Applied to: Update Equipment Totals
WHEN
The system updates equipment totals
THEN
Total equipment counts, status summaries, and processing statistics are updated with bunch bill results
Context: An equipment ID fails validation
GIVEN
An equipment ID fails validation
Applied to: Handle Equipment Error
WHEN
The system handles the equipment error
THEN
Error handling procedures are initiated and the invalid equipment is flagged for review
Context: Invalid equipment has been identified
GIVEN
Invalid equipment has been identified
Applied to: Log Invalid Equipment
WHEN
The system logs the invalid equipment
THEN
Equipment details and error information are logged for subsequent review and correction
R-GCX146-cbl-01044 (+19) File: GCX146.cbl US Trip Sheet Merlin Transmission Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US Trip Sheet Merlin Transmission':
  • Context - a us trip sheet transmission is being prepared:
    For Initialize US Trip Sheet Equipment Records:
    When the system begins processing equipment records, then equipment counters are reset to zero and processing flags are initialized.
  • Context - equipment records exist for the train:
    For Build Equipment List for US Customs:
    When the system processes each equipment record for us customs reporting, then valid equipment records are added to the trip sheet processing list.
  • Context - an equipment record needs to be formatted for transmission:
    For Format Equipment Type Messages:
    When the system processes the equipment record, then equipment details are formatted according to us customs requirements including car type, waybill information, and cargo details.
  • Context - an equipment record with car type information:
    For Equipment Type?:
    When the system evaluates the equipment type, then equipment is classified as idler, unit, van, etu, or other based on car type codes.
  • Context - an equipment record classified as idler type:
    For Format IDLER Equipment Message:
    When the system formats the equipment message, then idler equipment is formatted with car identification and basic details without cargo information.
  • Context - an equipment record classified as unit type (l, p, d, u car types):
    For Format UNIT Equipment Message:
    When the system formats the equipment message, then unit equipment is formatted with complete details including car id, waybill number, shipper, consignee, origin, destination, and cargo description.
  • Context - an equipment record classified as van type:
    For Format VAN Equipment Message:
    When the system formats the equipment message, then van equipment is formatted with van identification and cargo details appropriate for van shipments.
  • Context - an equipment record classified as etu type:
    For Format ETU Equipment Message:
    When the system formats the equipment message, then etu equipment is formatted with tank unit identification and empty status indication.
  • Context - an equipment record that does not match idler, unit, van, or etu classifications:
    For Format Other Equipment Message:
    When the system formats the equipment message, then equipment is formatted using standard formatting rules with available car and cargo information.
  • Context - a formatted equipment message:
    For Add Equipment to Merlin Message Buffer:
    When the system adds the equipment to the message buffer, then equipment information is appended to the current message buffer and line counters are updated.
  • Context - equipment processing is in progress:
    For More Equipment?:
    When the system checks for remaining equipment records, then processing continues if more equipment exists, otherwise proceeds to message finalization.
  • Context - equipment has been added to the message buffer:
    For Check Message Size Limits:
    When the system checks the current message size, then message line count and size are validated against maximum transmission limits.
  • Context - a message buffer with accumulated equipment data:
    For Message Size Exceeded?:
    When the system evaluates the message size against limits, then message segmentation is triggered if size exceeds limits, otherwise processing continues normally.
  • Context - a message buffer that has exceeded size limits:
    For Segment Message for Transmission:
    When the system segments the message, then current message content is prepared for transmission as a complete segment.
  • Context - a prepared message segment ready for transmission:
    For Send Current Message Segment:
    When the system sends the message segment, then message segment is transmitted to us customs through merlin communication system.
  • Context - a message segment has been transmitted:
    For Initialize New Message Segment:
    When the system initializes a new message segment, then message buffer is reset and prepared for additional equipment data with appropriate headers.
  • Context - a new message segment has been initialized:
    For Continue with Remaining Equipment:
    When the system continues equipment processing, then remaining equipment records are processed and added to the new message segment.
  • Context - all equipment has been processed and message size is within limits:
    For Finalize Complete Message:
    When the system finalizes the message, then message is prepared for final transmission with appropriate headers and footers.
  • Context - a finalized message ready for transmission:
    For Transmit Final Message to US Customs:
    When the system transmits the final message, then complete trip sheet data is sent to us customs via merlin communication system.
  • Context - a message has been transmitted to us customs:
    For Log Transmission Activity:
    When the system logs the transmission, then transmission details including timestamp, message count, and status are recorded for audit trail.
👨‍💻 Technical ACs (Gherkin)
Context: A US trip sheet transmission is being prepared
GIVEN
A US trip sheet transmission is being prepared
Applied to: Initialize US Trip Sheet Equipment Records
WHEN
The system begins processing equipment records
THEN
Equipment counters are reset to zero and processing flags are initialized
Context: Equipment records exist for the train
GIVEN
Equipment records exist for the train
Applied to: Build Equipment List for US Customs
WHEN
The system processes each equipment record for US customs reporting
THEN
Valid equipment records are added to the trip sheet processing list
Context: An equipment record needs to be formatted for transmission
GIVEN
An equipment record needs to be formatted for transmission
Applied to: Format Equipment Type Messages
WHEN
The system processes the equipment record
THEN
Equipment details are formatted according to US customs requirements including car type, waybill information, and cargo details
Context: An equipment record with car type information
GIVEN
An equipment record with car type information
Applied to: Equipment Type?
WHEN
The system evaluates the equipment type
THEN
Equipment is classified as IDLER, UNIT, VAN, ETU, or Other based on car type codes
Context: An equipment record classified as IDLER type
GIVEN
An equipment record classified as IDLER type
Applied to: Format IDLER Equipment Message
WHEN
The system formats the equipment message
THEN
IDLER equipment is formatted with car identification and basic details without cargo information
Context: An equipment record classified as UNIT type (L, P, D, U car types)
GIVEN
An equipment record classified as UNIT type (L, P, D, U car types)
Applied to: Format UNIT Equipment Message
WHEN
The system formats the equipment message
THEN
UNIT equipment is formatted with complete details including car ID, waybill number, shipper, consignee, origin, destination, and cargo description
Context: An equipment record classified as VAN type
GIVEN
An equipment record classified as VAN type
Applied to: Format VAN Equipment Message
WHEN
The system formats the equipment message
THEN
VAN equipment is formatted with van identification and cargo details appropriate for van shipments
Context: An equipment record classified as ETU type
GIVEN
An equipment record classified as ETU type
Applied to: Format ETU Equipment Message
WHEN
The system formats the equipment message
THEN
ETU equipment is formatted with tank unit identification and empty status indication
Context: An equipment record that does not match IDLER, UNIT, VAN, or ETU classifications
GIVEN
An equipment record that does not match IDLER, UNIT, VAN, or ETU classifications
Applied to: Format Other Equipment Message
WHEN
The system formats the equipment message
THEN
Equipment is formatted using standard formatting rules with available car and cargo information
Context: A formatted equipment message
GIVEN
A formatted equipment message
Applied to: Add Equipment to Merlin Message Buffer
WHEN
The system adds the equipment to the message buffer
THEN
Equipment information is appended to the current message buffer and line counters are updated
Context: Equipment processing is in progress
GIVEN
Equipment processing is in progress
Applied to: More Equipment?
WHEN
The system checks for remaining equipment records
THEN
Processing continues if more equipment exists, otherwise proceeds to message finalization
Context: Equipment has been added to the message buffer
GIVEN
Equipment has been added to the message buffer
Applied to: Check Message Size Limits
WHEN
The system checks the current message size
THEN
Message line count and size are validated against maximum transmission limits
Context: A message buffer with accumulated equipment data
GIVEN
A message buffer with accumulated equipment data
Applied to: Message Size Exceeded?
WHEN
The system evaluates the message size against limits
THEN
Message segmentation is triggered if size exceeds limits, otherwise processing continues normally
Context: A message buffer that has exceeded size limits
GIVEN
A message buffer that has exceeded size limits
Applied to: Segment Message for Transmission
WHEN
The system segments the message
THEN
Current message content is prepared for transmission as a complete segment
Context: A prepared message segment ready for transmission
GIVEN
A prepared message segment ready for transmission
Applied to: Send Current Message Segment
WHEN
The system sends the message segment
THEN
Message segment is transmitted to US customs through Merlin communication system
Context: A message segment has been transmitted
GIVEN
A message segment has been transmitted
Applied to: Initialize New Message Segment
WHEN
The system initializes a new message segment
THEN
Message buffer is reset and prepared for additional equipment data with appropriate headers
Context: A new message segment has been initialized
GIVEN
A new message segment has been initialized
Applied to: Continue with Remaining Equipment
WHEN
The system continues equipment processing
THEN
Remaining equipment records are processed and added to the new message segment
Context: All equipment has been processed and message size is within limits
GIVEN
All equipment has been processed and message size is within limits
Applied to: Finalize Complete Message
WHEN
The system finalizes the message
THEN
Message is prepared for final transmission with appropriate headers and footers
Context: A finalized message ready for transmission
GIVEN
A finalized message ready for transmission
Applied to: Transmit Final Message to US Customs
WHEN
The system transmits the final message
THEN
Complete trip sheet data is sent to US customs via Merlin communication system
Context: A message has been transmitted to US customs
GIVEN
A message has been transmitted to US customs
Applied to: Log Transmission Activity
WHEN
The system logs the transmission
THEN
Transmission details including timestamp, message count, and status are recorded for audit trail
R-GCX146-cbl-01064 (+6) File: GCX146.cbl Cargo Arrival Detection Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Arrival Detection Processing':
  • Context - a ccn record exists with transit status information:
    For Check Transit Status = 'D' for Delivered?:
    When the system checks the transit status field, then if transit status equals 'd' (delivered), the cargo is identified as arrived, otherwise continue processing next equipment.
  • Context - cargo has transit status 'd' and manifest contains destination station information:
    For Current Station = Final Destination?:
    When the system compares current station location with final destination station from manifest, then if current station matches final destination station, cargo is confirmed as arrived at correct location, otherwise skip arrival processing.
  • Context - cargo has been identified as arrived at final destination:
    For Update Cargo Status to Arrived:
    When the system processes the arrival confirmation, then the cargo status is updated to 'arrived' in the ccn database.
  • Context - cargo status has been updated to arrived:
    For Trigger Arrival Notification Process:
    When the system completes the arrival status update, then arrival notification process is triggered to send notifications to brokers, customs, and other stakeholders.
  • Context - cargo arrival has been detected and processed:
    For Log Arrival Detection:
    When the system completes arrival notification triggering, then an audit log entry is created recording the arrival detection event with timestamp and relevant cargo details.
  • Context - a ccn record exists in the database:
    For Retrieve CCN Transit Status:
    When the system begins cargo arrival detection processing, then transit status information is retrieved from the gcccrt ccn database for evaluation.
  • Context - ccn transit status has been retrieved:
    For Check Manifest Codes:
    When the system processes arrival detection, then manifest station codes are checked from gcsb4rt train records to identify destination information.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN record exists with transit status information
GIVEN
A CCN record exists with transit status information
Applied to: Check Transit Status = 'D' for Delivered?
WHEN
The system checks the transit status field
THEN
If transit status equals 'D' (Delivered), the cargo is identified as arrived, otherwise continue processing next equipment
Context: Cargo has transit status 'D' and manifest contains destination station information
GIVEN
Cargo has transit status 'D' and manifest contains destination station information
Applied to: Current Station = Final Destination?
WHEN
The system compares current station location with final destination station from manifest
THEN
If current station matches final destination station, cargo is confirmed as arrived at correct location, otherwise skip arrival processing
Context: Cargo has been identified as arrived at final destination
GIVEN
Cargo has been identified as arrived at final destination
Applied to: Update Cargo Status to Arrived
WHEN
The system processes the arrival confirmation
THEN
The cargo status is updated to 'Arrived' in the CCN database
Context: Cargo status has been updated to arrived
GIVEN
Cargo status has been updated to arrived
Applied to: Trigger Arrival Notification Process
WHEN
The system completes the arrival status update
THEN
Arrival notification process is triggered to send notifications to brokers, customs, and other stakeholders
Context: Cargo arrival has been detected and processed
GIVEN
Cargo arrival has been detected and processed
Applied to: Log Arrival Detection
WHEN
The system completes arrival notification triggering
THEN
An audit log entry is created recording the arrival detection event with timestamp and relevant cargo details
Context: A CCN record exists in the database
GIVEN
A CCN record exists in the database
Applied to: Retrieve CCN Transit Status
WHEN
The system begins cargo arrival detection processing
THEN
Transit status information is retrieved from the GCCCRT CCN database for evaluation
Context: CCN transit status has been retrieved
GIVEN
CCN transit status has been retrieved
Applied to: Check Manifest Codes
WHEN
The system processes arrival detection
THEN
Manifest station codes are checked from GCSB4RT train records to identify destination information
R-GCX146-cbl-01071 (+5) File: GCX146.cbl Return CCN Creation Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Return CCN Creation Processing':
  • Context - a cargo shipment with origin and destination information:
    For Identify Canadian Goods Returning from US:
    When the system analyzes the cargo movement pattern, then the system determines if the cargo represents canadian goods returning from us territory.
  • Context - equipment id and waybill date information are available:
    For Build Return CCN Number:
    When a return ccn needs to be created for canadian goods, then the system builds ccn with format: '6105e' + equipment_id + waybill_date + sequence_number.
  • Context - a new return ccn record is being created:
    For Set CCN Status to 'RETURN':
    When the ccn status needs to be established, then the system sets ccn status to 'return' and transit status to 'r'.
  • Context - waybill data contains shipper and consignee information:
    For Populate Complete Shipment Data:
    When creating a return ccn record, then the system populates shipper name, consignee name, origin station, destination station, and application type '33' for canadian customs.
  • Context - all return ccn data has been prepared and validated:
    For Insert Return CCN Record into Database:
    When the system needs to persist the return ccn information, then the system inserts the ccn record into gcccrt database and spawns gcx105 transaction for audit trail creation.
  • Context - a return ccn creation attempt has been made:
    For CCN Creation Successful?:
    When the system checks the creation result, then if successful, the system continues processing; if failed, the system handles the error condition.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment with origin and destination information
GIVEN
A cargo shipment with origin and destination information
Applied to: Identify Canadian Goods Returning from US
WHEN
The system analyzes the cargo movement pattern
THEN
The system determines if the cargo represents Canadian goods returning from US territory
Context: Equipment ID and waybill date information are available
GIVEN
Equipment ID and waybill date information are available
Applied to: Build Return CCN Number
WHEN
A return CCN needs to be created for Canadian goods
THEN
The system builds CCN with format: '6105E' + equipment_id + waybill_date + sequence_number
Context: A new return CCN record is being created
GIVEN
A new return CCN record is being created
Applied to: Set CCN Status to 'RETURN'
WHEN
The CCN status needs to be established
THEN
The system sets CCN status to 'RETURN' and transit status to 'R'
Context: Waybill data contains shipper and consignee information
GIVEN
Waybill data contains shipper and consignee information
Applied to: Populate Complete Shipment Data
WHEN
Creating a return CCN record
THEN
The system populates shipper name, consignee name, origin station, destination station, and application type '33' for Canadian customs
Context: All return CCN data has been prepared and validated
GIVEN
All return CCN data has been prepared and validated
Applied to: Insert Return CCN Record into Database
WHEN
The system needs to persist the return CCN information
THEN
The system inserts the CCN record into GCCCRT database and spawns GCX105 transaction for audit trail creation
Context: A return CCN creation attempt has been made
GIVEN
A return CCN creation attempt has been made
Applied to: CCN Creation Successful?
WHEN
The system checks the creation result
THEN
If successful, the system continues processing; if failed, the system handles the error condition
R-GCX146-cbl-01077 (+11) File: GCX146.cbl Broker Notification Multi Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Notification Multi':
  • Context - a ccn requires broker notification and primary broker exists and broker communication preference is x12 edi:
    For Send X12 EDI Notification via GCCS309C:
    When the system processes broker notification distribution, then the system invokes gccs309c program to send x12 edi notification to the primary broker.
  • Context - a ccn requires broker notification and primary broker exists and broker communication preference is merlin:
    For Send Merlin Notification via GCX019:
    When the system processes broker notification distribution, then the system invokes gcx019 program to send merlin notification to the primary broker.
  • Context - a ccn requires broker notification and primary broker exists and broker communication preference is internet:
    For Send Internet Notification via GCX019:
    When the system processes broker notification distribution, then the system invokes gcx019 program to send internet notification to the primary broker.
  • Context - a ccn requires broker notification and primary broker exists and broker communication preference is fax:
    For Send FAX Notification via GCX019:
    When the system processes broker notification distribution, then the system invokes gcx019 program to send fax notification to the primary broker.
  • Context - a ccn requires broker notification and primary broker exists and broker communication preference is paper:
    For Send Paper Notification via Batch Print Call Letters:
    When the system processes broker notification distribution, then the system generates paper notification through batch print call letters process.
  • Context - primary broker notification has been processed:
    For Secondary Broker Configured?:
    When the system checks for secondary broker configuration, then if secondary broker exists then proceed with secondary broker notifications else complete broker notification process.
  • Context - secondary broker is configured and secondary broker communication preference is x12 edi:
    For Send X12 EDI to Secondary Broker via GCCS309C:
    When the system processes secondary broker notification distribution, then the system invokes gccs309c program to send x12 edi notification to the secondary broker.
  • Context - secondary broker is configured and secondary broker communication preference is merlin:
    For Send Merlin to Secondary Broker via GCX019:
    When the system processes secondary broker notification distribution, then the system invokes gcx019 program to send merlin notification to the secondary broker.
  • Context - secondary broker is configured and secondary broker communication preference is internet:
    For Send Internet to Secondary Broker via GCX019:
    When the system processes secondary broker notification distribution, then the system invokes gcx019 program to send internet notification to the secondary broker.
  • Context - secondary broker is configured and secondary broker communication preference is fax:
    For Send FAX to Secondary Broker via GCX019:
    When the system processes secondary broker notification distribution, then the system invokes gcx019 program to send fax notification to the secondary broker.
  • Context - secondary broker is configured and secondary broker communication preference is paper:
    For Send Paper to Secondary Broker via Batch Print:
    When the system processes secondary broker notification distribution, then the system generates paper notification through batch print process for the secondary broker.
  • Context - a broker notification needs to be sent:
    For Broker Communication Preference Available?:
    When the system evaluates broker communication preferences, then the system selects the appropriate channel (x12 edi, merlin, internet, fax, or paper) based on broker configuration.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN requires broker notification AND primary broker exists AND broker communication preference is X12 EDI
GIVEN
A CCN requires broker notification AND primary broker exists AND broker communication preference is X12 EDI
Applied to: Send X12 EDI Notification via GCCS309C
WHEN
The system processes broker notification distribution
THEN
The system invokes GCCS309C program to send X12 EDI notification to the primary broker
Context: A CCN requires broker notification AND primary broker exists AND broker communication preference is Merlin
GIVEN
A CCN requires broker notification AND primary broker exists AND broker communication preference is Merlin
Applied to: Send Merlin Notification via GCX019
WHEN
The system processes broker notification distribution
THEN
The system invokes GCX019 program to send Merlin notification to the primary broker
Context: A CCN requires broker notification AND primary broker exists AND broker communication preference is Internet
GIVEN
A CCN requires broker notification AND primary broker exists AND broker communication preference is Internet
Applied to: Send Internet Notification via GCX019
WHEN
The system processes broker notification distribution
THEN
The system invokes GCX019 program to send Internet notification to the primary broker
Context: A CCN requires broker notification AND primary broker exists AND broker communication preference is FAX
GIVEN
A CCN requires broker notification AND primary broker exists AND broker communication preference is FAX
Applied to: Send FAX Notification via GCX019
WHEN
The system processes broker notification distribution
THEN
The system invokes GCX019 program to send FAX notification to the primary broker
Context: A CCN requires broker notification AND primary broker exists AND broker communication preference is Paper
GIVEN
A CCN requires broker notification AND primary broker exists AND broker communication preference is Paper
Applied to: Send Paper Notification via Batch Print Call Letters
WHEN
The system processes broker notification distribution
THEN
The system generates paper notification through batch print call letters process
Context: Primary broker notification has been processed
GIVEN
Primary broker notification has been processed
Applied to: Secondary Broker Configured?
WHEN
The system checks for secondary broker configuration
THEN
IF secondary broker exists THEN proceed with secondary broker notifications ELSE complete broker notification process
Context: Secondary broker is configured AND secondary broker communication preference is X12 EDI
GIVEN
Secondary broker is configured AND secondary broker communication preference is X12 EDI
Applied to: Send X12 EDI to Secondary Broker via GCCS309C
WHEN
The system processes secondary broker notification distribution
THEN
The system invokes GCCS309C program to send X12 EDI notification to the secondary broker
Context: Secondary broker is configured AND secondary broker communication preference is Merlin
GIVEN
Secondary broker is configured AND secondary broker communication preference is Merlin
Applied to: Send Merlin to Secondary Broker via GCX019
WHEN
The system processes secondary broker notification distribution
THEN
The system invokes GCX019 program to send Merlin notification to the secondary broker
Context: Secondary broker is configured AND secondary broker communication preference is Internet
GIVEN
Secondary broker is configured AND secondary broker communication preference is Internet
Applied to: Send Internet to Secondary Broker via GCX019
WHEN
The system processes secondary broker notification distribution
THEN
The system invokes GCX019 program to send Internet notification to the secondary broker
Context: Secondary broker is configured AND secondary broker communication preference is FAX
GIVEN
Secondary broker is configured AND secondary broker communication preference is FAX
Applied to: Send FAX to Secondary Broker via GCX019
WHEN
The system processes secondary broker notification distribution
THEN
The system invokes GCX019 program to send FAX notification to the secondary broker
Context: Secondary broker is configured AND secondary broker communication preference is Paper
GIVEN
Secondary broker is configured AND secondary broker communication preference is Paper
Applied to: Send Paper to Secondary Broker via Batch Print
WHEN
The system processes secondary broker notification distribution
THEN
The system generates paper notification through batch print process for the secondary broker
Context: A broker notification needs to be sent
GIVEN
A broker notification needs to be sent
Applied to: Broker Communication Preference Available?
WHEN
The system evaluates broker communication preferences
THEN
The system selects the appropriate channel (X12 EDI, Merlin, Internet, FAX, or Paper) based on broker configuration
R-GCX146-cbl-01089 (+11) File: GCX146.cbl CCN Compression Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Compression Processing':
  • Context - a ccn number containing space characters:
    For W400-COMPRESS-CCN: Remove Spaces from CCN:
    When the system processes the ccn for compression, then all space characters are removed from the ccn number while preserving all non-space characters in their original sequence.
  • Context - a ccn number with mixed characters and spaces:
    For Scan CCN Character by Character:
    When the system scans the ccn character by character, then each character position is evaluated to determine if it contains a space or non-space character.
  • Context - a character being examined during ccn compression:
    For Is Character a Space?:
    When the character is identified as a space, then the space character is skipped and not included in the compressed ccn output.
    For Keep Non-Space Character:
    When the character is identified as a non-space character, then the character is retained and included in the compressed ccn output in its sequential position.
  • Context - an equipment identifier containing numeric sequences:
    For W400A-COMPRESS-EQUIP: Organize Numeric Sequences:
    When the system processes the equipment number for compression, then numeric sequences are identified, formatted, and reorganized according to standard equipment numbering conventions.
  • Context - an equipment identifier with mixed alphanumeric characters:
    For Identify Numeric Sequences:
    When the system analyzes the identifier structure, then all consecutive numeric character sequences are identified and marked for formatting.
  • Context - identified numeric sequences within an equipment identifier:
    For Format Numeric Components:
    When the system formats the numeric components, then numeric sequences are formatted according to equipment numbering standards with proper padding and alignment.
  • Context - a ccn with formatted numeric components and preserved characters:
    For Reorganize CCN Structure:
    When the system reorganizes the ccn structure, then ccn components are arranged in the standard format with proper sequencing and positioning.
  • Context - reorganized ccn components with formatted numeric sequences:
    For Build Compressed CCN Format:
    When the system builds the compressed ccn format, then all components are combined into a single compressed ccn string without spaces and with standardized formatting.
  • Context - a compressed ccn format constructed from processed components:
    For Validate Compressed CCN:
    When the system validates the compressed ccn, then the ccn format is verified against business rules for length, character composition, and structural requirements.
  • Context - a compressed ccn that has undergone format validation:
    For CCN Format Valid?:
    When the ccn format validation is successful, then the system returns the compressed ccn for further processing.
  • Context - a compressed ccn that fails format validation:
    For Handle Format Error:
    When the ccn format validation is unsuccessful, then the system initiates error handling procedures and does not return the invalid ccn format.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN number containing space characters
GIVEN
A CCN number containing space characters
Applied to: W400-COMPRESS-CCN: Remove Spaces from CCN
WHEN
The system processes the CCN for compression
THEN
All space characters are removed from the CCN number while preserving all non-space characters in their original sequence
Context: A CCN number with mixed characters and spaces
GIVEN
A CCN number with mixed characters and spaces
Applied to: Scan CCN Character by Character
WHEN
The system scans the CCN character by character
THEN
Each character position is evaluated to determine if it contains a space or non-space character
Context: A character being examined during CCN compression
GIVEN
A character being examined during CCN compression
Applied to: Is Character a Space?
WHEN
The character is identified as a space
THEN
The space character is skipped and not included in the compressed CCN output
Applied to: Keep Non-Space Character
WHEN
The character is identified as a non-space character
THEN
The character is retained and included in the compressed CCN output in its sequential position
Context: An equipment identifier containing numeric sequences
GIVEN
An equipment identifier containing numeric sequences
Applied to: W400A-COMPRESS-EQUIP: Organize Numeric Sequences
WHEN
The system processes the equipment number for compression
THEN
Numeric sequences are identified, formatted, and reorganized according to standard equipment numbering conventions
Context: An equipment identifier with mixed alphanumeric characters
GIVEN
An equipment identifier with mixed alphanumeric characters
Applied to: Identify Numeric Sequences
WHEN
The system analyzes the identifier structure
THEN
All consecutive numeric character sequences are identified and marked for formatting
Context: Identified numeric sequences within an equipment identifier
GIVEN
Identified numeric sequences within an equipment identifier
Applied to: Format Numeric Components
WHEN
The system formats the numeric components
THEN
Numeric sequences are formatted according to equipment numbering standards with proper padding and alignment
Context: A CCN with formatted numeric components and preserved characters
GIVEN
A CCN with formatted numeric components and preserved characters
Applied to: Reorganize CCN Structure
WHEN
The system reorganizes the CCN structure
THEN
CCN components are arranged in the standard format with proper sequencing and positioning
Context: Reorganized CCN components with formatted numeric sequences
GIVEN
Reorganized CCN components with formatted numeric sequences
Applied to: Build Compressed CCN Format
WHEN
The system builds the compressed CCN format
THEN
All components are combined into a single compressed CCN string without spaces and with standardized formatting
Context: A compressed CCN format constructed from processed components
GIVEN
A compressed CCN format constructed from processed components
Applied to: Validate Compressed CCN
WHEN
The system validates the compressed CCN
THEN
The CCN format is verified against business rules for length, character composition, and structural requirements
Context: A compressed CCN that has undergone format validation
GIVEN
A compressed CCN that has undergone format validation
Applied to: CCN Format Valid?
WHEN
The CCN format validation is successful
THEN
The system returns the compressed CCN for further processing
Context: A compressed CCN that fails format validation
GIVEN
A compressed CCN that fails format validation
Applied to: Handle Format Error
WHEN
The CCN format validation is unsuccessful
THEN
The system initiates error handling procedures and does not return the invalid CCN format
R-GCX146-cbl-01101 (+16) File: GCX146.cbl US Customs Status Validation Processing Merged 17 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US Customs Status Validation Processing':
  • Context - a cargo shipment requires us customs validation:
    For Access US Customs Route Information:
    When the system attempts to access us route data using the cargo's customs control number, then the system retrieves us customs route segment data if it exists.
  • Context - the system has attempted to access us route data for a cargo shipment:
    For US Route Data Found?:
    When the system checks if us route segment data was successfully retrieved, then if us route data exists, proceed with bond type validation, otherwise skip us customs validation.
  • Context - us route data exists for a cargo shipment:
    For Validate Bond Type:
    When the system examines the bond type field in the us route data, then the bond type must be one of: it (in-transit), tr (transportation), te (temporary export), or mt (merchandise in transit).
  • Context - a cargo shipment has us route data with bond type 'it':
    For IT Bond Type:
    When the system processes the it bond type cargo, then generate appropriate warning messages for in-transit bond requirements and restrictions.
  • Context - a cargo shipment has us route data with bond type 'tr':
    For TR Bond Type:
    When the system processes the tr bond type cargo, then apply transportation bond specific validation rules and generate appropriate status messages.
  • Context - a cargo shipment has us route data with bond type 'te':
    For TE Bond Type:
    When the system processes the te bond type cargo, then apply temporary export bond validation rules and generate export-related status messages.
  • Context - a cargo shipment has us route data with bond type 'mt':
    For MT Bond Type:
    When the system processes the mt bond type cargo, then apply merchandise in transit bond validation rules and generate transit-related status messages.
  • Context - a cargo shipment has valid us route data with a recognized bond type:
    For Cargo In-Transit?:
    When the system checks the in-transit status indicator in the us route data, then if cargo is marked as in-transit, proceed with location validation, otherwise proceed with vessel validation.
  • Context - a cargo shipment is marked as in-transit in us route data:
    For Location Valid?:
    When the system validates the current location information against expected transit locations, then if location is valid, proceed with vessel validation, otherwise generate location warning message.
  • Context - a cargo shipment has completed location validation (if applicable):
    For Vessel = 'TRAIN'?:
    When the system examines the vessel name field in the us route data, then if vessel name equals 'train', generate train-specific warning, otherwise generate other vessel warning.
  • Context - a cargo shipment has vessel name designated as 'train':
    For Generate Train Vessel Warning:
    When the system processes train vessel cargo, then generate train-specific warning messages related to rail transportation requirements and restrictions.
  • Context - a cargo shipment has vessel name that is not 'train':
    For Generate Other Vessel Warning:
    When the system processes non-train vessel cargo, then generate vessel-specific warning messages appropriate for the transportation method.
  • Context - a cargo shipment has us route data with an invalid or unrecognized bond type:
    For Generate Bond Type Warning Message:
    When the system encounters a bond type that is not it, tr, te, or mt, then generate a warning message indicating invalid bond type and potential compliance issues.
  • Context - a cargo shipment is marked as in-transit but has invalid location information:
    For Generate Location Warning Message:
    When the system detects location validation failure, then generate a warning message indicating location mismatch or invalid transit location.
  • Context - a cargo shipment has in-transit status issues or validation failures:
    For Generate In-Transit Warning Message:
    When the system processes in-transit cargo with identified problems, then generate comprehensive warning messages covering all in-transit related issues and compliance requirements.
  • Context - the system has processed us customs validation and generated various warning messages:
    For Compile All Warning Messages:
    When all individual warning messages have been created, then compile all warning messages into a single comprehensive report for the cargo shipment.
  • Context - a cargo shipment has no us route data available:
    For No US Route Data - Skip Validation:
    When the system attempts to perform us customs validation, then skip all us customs validation processes and proceed with normal cargo processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment requires US customs validation
GIVEN
A cargo shipment requires US customs validation
Applied to: Access US Customs Route Information
WHEN
The system attempts to access US route data using the cargo's customs control number
THEN
The system retrieves US customs route segment data if it exists
Context: The system has attempted to access US route data for a cargo shipment
GIVEN
The system has attempted to access US route data for a cargo shipment
Applied to: US Route Data Found?
WHEN
The system checks if US route segment data was successfully retrieved
THEN
If US route data exists, proceed with bond type validation, otherwise skip US customs validation
Context: US route data exists for a cargo shipment
GIVEN
US route data exists for a cargo shipment
Applied to: Validate Bond Type
WHEN
The system examines the bond type field in the US route data
THEN
The bond type must be one of: IT (In-Transit), TR (Transportation), TE (Temporary Export), or MT (Merchandise in Transit)
Context: A cargo shipment has US route data with bond type 'IT'
GIVEN
A cargo shipment has US route data with bond type 'IT'
Applied to: IT Bond Type
WHEN
The system processes the IT bond type cargo
THEN
Generate appropriate warning messages for in-transit bond requirements and restrictions
Context: A cargo shipment has US route data with bond type 'TR'
GIVEN
A cargo shipment has US route data with bond type 'TR'
Applied to: TR Bond Type
WHEN
The system processes the TR bond type cargo
THEN
Apply transportation bond specific validation rules and generate appropriate status messages
Context: A cargo shipment has US route data with bond type 'TE'
GIVEN
A cargo shipment has US route data with bond type 'TE'
Applied to: TE Bond Type
WHEN
The system processes the TE bond type cargo
THEN
Apply temporary export bond validation rules and generate export-related status messages
Context: A cargo shipment has US route data with bond type 'MT'
GIVEN
A cargo shipment has US route data with bond type 'MT'
Applied to: MT Bond Type
WHEN
The system processes the MT bond type cargo
THEN
Apply merchandise in transit bond validation rules and generate transit-related status messages
Context: A cargo shipment has valid US route data with a recognized bond type
GIVEN
A cargo shipment has valid US route data with a recognized bond type
Applied to: Cargo In-Transit?
WHEN
The system checks the in-transit status indicator in the US route data
THEN
If cargo is marked as in-transit, proceed with location validation, otherwise proceed with vessel validation
Context: A cargo shipment is marked as in-transit in US route data
GIVEN
A cargo shipment is marked as in-transit in US route data
Applied to: Location Valid?
WHEN
The system validates the current location information against expected transit locations
THEN
If location is valid, proceed with vessel validation, otherwise generate location warning message
Context: A cargo shipment has completed location validation (if applicable)
GIVEN
A cargo shipment has completed location validation (if applicable)
Applied to: Vessel = 'TRAIN'?
WHEN
The system examines the vessel name field in the US route data
THEN
If vessel name equals 'TRAIN', generate train-specific warning, otherwise generate other vessel warning
Context: A cargo shipment has vessel name designated as 'TRAIN'
GIVEN
A cargo shipment has vessel name designated as 'TRAIN'
Applied to: Generate Train Vessel Warning
WHEN
The system processes train vessel cargo
THEN
Generate train-specific warning messages related to rail transportation requirements and restrictions
Context: A cargo shipment has vessel name that is not 'TRAIN'
GIVEN
A cargo shipment has vessel name that is not 'TRAIN'
Applied to: Generate Other Vessel Warning
WHEN
The system processes non-train vessel cargo
THEN
Generate vessel-specific warning messages appropriate for the transportation method
Context: A cargo shipment has US route data with an invalid or unrecognized bond type
GIVEN
A cargo shipment has US route data with an invalid or unrecognized bond type
Applied to: Generate Bond Type Warning Message
WHEN
The system encounters a bond type that is not IT, TR, TE, or MT
THEN
Generate a warning message indicating invalid bond type and potential compliance issues
Context: A cargo shipment is marked as in-transit but has invalid location information
GIVEN
A cargo shipment is marked as in-transit but has invalid location information
Applied to: Generate Location Warning Message
WHEN
The system detects location validation failure
THEN
Generate a warning message indicating location mismatch or invalid transit location
Context: A cargo shipment has in-transit status issues or validation failures
GIVEN
A cargo shipment has in-transit status issues or validation failures
Applied to: Generate In-Transit Warning Message
WHEN
The system processes in-transit cargo with identified problems
THEN
Generate comprehensive warning messages covering all in-transit related issues and compliance requirements
Context: The system has processed US customs validation and generated various warning messages
GIVEN
The system has processed US customs validation and generated various warning messages
Applied to: Compile All Warning Messages
WHEN
All individual warning messages have been created
THEN
Compile all warning messages into a single comprehensive report for the cargo shipment
Context: A cargo shipment has no US route data available
GIVEN
A cargo shipment has no US route data available
Applied to: No US Route Data - Skip Validation
WHEN
The system attempts to perform US customs validation
THEN
Skip all US customs validation processes and proceed with normal cargo processing
R-GCX146-cbl-01118 (+5) File: GCX146.cbl Equipment Car ID Formatting and Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Car ID Formatting and Validation':
  • Context - a train identification component contains space characters:
    For Replace Spaces with Zeros:
    When the system processes the train component for customs id building, then all space characters in the component are replaced with zero characters.
  • Context - train number, day, from station, to station, consist number, and system date are available:
    For Build Customs Train ID Components:
    When the system needs to create a customs train identifier, then the system concatenates all components with spaces replaced by zeros to form ws-customs-train-id.
  • Context - an equipment car identifier needs to be formatted:
    For Format Equipment Car Identifier:
    When the system processes the car identifier for display or storage, then the system applies standard 12-character formatting using gcccarfm utility.
  • Context - a formatted equipment car identifier:
    For Validate Car ID Format:
    When the system validates the car id format, then the system confirms the car id meets required format standards or flags format errors.
  • Context - a validated and formatted car identifier:
    For Store in Equipment Record:
    When the system completes car id formatting process, then the formatted car id is stored in the equipment record and made available for processing.
  • Context - a validated car identifier:
    For Set Formatted Car ID for Display:
    When the system prepares the car id for display purposes, then the car id is formatted according to display standards and stored in appropriate display fields.
👨‍💻 Technical ACs (Gherkin)
Context: A train identification component contains space characters
GIVEN
A train identification component contains space characters
Applied to: Replace Spaces with Zeros
WHEN
The system processes the train component for customs ID building
THEN
All space characters in the component are replaced with zero characters
Context: Train number, day, from station, to station, consist number, and system date are available
GIVEN
Train number, day, from station, to station, consist number, and system date are available
Applied to: Build Customs Train ID Components
WHEN
The system needs to create a customs train identifier
THEN
The system concatenates all components with spaces replaced by zeros to form WS-CUSTOMS-TRAIN-ID
Context: An equipment car identifier needs to be formatted
GIVEN
An equipment car identifier needs to be formatted
Applied to: Format Equipment Car Identifier
WHEN
The system processes the car identifier for display or storage
THEN
The system applies standard 12-character formatting using GCCCARFM utility
Context: A formatted equipment car identifier
GIVEN
A formatted equipment car identifier
Applied to: Validate Car ID Format
WHEN
The system validates the car ID format
THEN
The system confirms the car ID meets required format standards or flags format errors
Context: A validated and formatted car identifier
GIVEN
A validated and formatted car identifier
Applied to: Store in Equipment Record
WHEN
The system completes car ID formatting process
THEN
The formatted car ID is stored in the equipment record and made available for processing
Context: A validated car identifier
GIVEN
A validated car identifier
Applied to: Set Formatted Car ID for Display
WHEN
The system prepares the car ID for display purposes
THEN
The car ID is formatted according to display standards and stored in appropriate display fields
R-GCX146-cbl-01142 (+6) File: GCX146.cbl AEI Report Email Distribution with Continuation Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AEI Report Email Distribution with Continuation':
  • Context - an aei report is being prepared for email distribution:
    For Line Count > 699?:
    When the system counts the number of lines in the current email message, then if the line count exceeds 699 lines, the system must send the current batch and prepare for continuation.
  • Context - an email message has reached the 699 line limit and needs to be continued:
    For Add Continuation Header Message:
    When the system prepares the next email message segment, then the system must add a continuation header message 'continuation of report....' to identify it as a follow-up message.
  • Context - primary email distribution has failed for an aei report:
    For Use Fallback Email Recipients:
    When the system detects email send failure, then the system must use fallback email recipients om01247 and aei9999 to ensure report delivery.
  • Context - an aei report needs to be distributed via email:
    For Get Email User List from Station Configuration:
    When the system determines email recipients, then the system must retrieve email user lists from gcstbrt station email configuration and aecwrktb email user lists based on the station code.
  • Context - an email message has been sent due to line limit being reached:
    For Reset Message Buffer:
    When the system needs to prepare for the next message segment, then the system must reset the message buffer to prepare for additional report content.
  • Context - the system is processing report lines for email distribution:
    For More Lines to Process?:
    When the system checks for remaining content after sending a message batch, then if more lines exist to be processed, the system must continue adding lines to the email buffer, otherwise proceed to send the final email batch.
  • Context - an email message has been sent via the primary email system:
    For Email Send Successful?:
    When the system receives the email send response, then if the email send is successful, complete the distribution process, otherwise activate fallback email recipients.
👨‍💻 Technical ACs (Gherkin)
Context: An AEI report is being prepared for email distribution
GIVEN
An AEI report is being prepared for email distribution
Applied to: Line Count > 699?
WHEN
The system counts the number of lines in the current email message
THEN
If the line count exceeds 699 lines, the system must send the current batch and prepare for continuation
Context: An email message has reached the 699 line limit and needs to be continued
GIVEN
An email message has reached the 699 line limit and needs to be continued
Applied to: Add Continuation Header Message
WHEN
The system prepares the next email message segment
THEN
The system must add a continuation header message 'CONTINUATION OF REPORT....' to identify it as a follow-up message
Context: Primary email distribution has failed for an AEI report
GIVEN
Primary email distribution has failed for an AEI report
Applied to: Use Fallback Email Recipients
WHEN
The system detects email send failure
THEN
The system must use fallback email recipients OM01247 and AEI9999 to ensure report delivery
Context: An AEI report needs to be distributed via email
GIVEN
An AEI report needs to be distributed via email
Applied to: Get Email User List from Station Configuration
WHEN
The system determines email recipients
THEN
The system must retrieve email user lists from GCSTBRT station email configuration and AECWRKTB email user lists based on the station code
Context: An email message has been sent due to line limit being reached
GIVEN
An email message has been sent due to line limit being reached
Applied to: Reset Message Buffer
WHEN
The system needs to prepare for the next message segment
THEN
The system must reset the message buffer to prepare for additional report content
Context: The system is processing report lines for email distribution
GIVEN
The system is processing report lines for email distribution
Applied to: More Lines to Process?
WHEN
The system checks for remaining content after sending a message batch
THEN
If more lines exist to be processed, the system must continue adding lines to the email buffer, otherwise proceed to send the final email batch
Context: An email message has been sent via the primary email system
GIVEN
An email message has been sent via the primary email system
Applied to: Email Send Successful?
WHEN
The system receives the email send response
THEN
If the email send is successful, complete the distribution process, otherwise activate fallback email recipients
R-GCX146-cbl-01149 (+3) File: GCX146.cbl Equipment Car Type Description Retrieval Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Car Type Description Retrieval':
  • Context - a piece of equipment with a car type code needs to be displayed on a trip sheet:
    For Equipment Car Type Description Retrieval:
    When the system processes the equipment for trip sheet generation, then the system should lookup the car type description from the equipment type reference table and populate it in the trip sheet detail, or use a default description if lookup fails.
  • Context - a car type code exists for equipment being processed:
    For Access GCSTBRT VI Segment:
    When the system needs to retrieve the corresponding car type description, then the system should access the vi segment of the gcstbrt table using the car type as the lookup key.
  • Context - a car type description has been successfully retrieved from the reference table:
    For Move Description to Trip Sheet Detail:
    When the description data is available for assignment, then the system should move the retrieved description to the appropriate field in the trip sheet detail record.
  • Context - a car type code does not have a corresponding description in the reference table:
    For Set Default Description:
    When the car type description lookup fails to find a match, then the system should assign a default description value to ensure the trip sheet field is populated.
👨‍💻 Technical ACs (Gherkin)
Context: A piece of equipment with a car type code needs to be displayed on a trip sheet
GIVEN
A piece of equipment with a car type code needs to be displayed on a trip sheet
Applied to: Equipment Car Type Description Retrieval
WHEN
The system processes the equipment for trip sheet generation
THEN
The system should lookup the car type description from the equipment type reference table and populate it in the trip sheet detail, or use a default description if lookup fails
Context: A car type code exists for equipment being processed
GIVEN
A car type code exists for equipment being processed
Applied to: Access GCSTBRT VI Segment
WHEN
The system needs to retrieve the corresponding car type description
THEN
The system should access the VI segment of the GCSTBRT table using the car type as the lookup key
Context: A car type description has been successfully retrieved from the reference table
GIVEN
A car type description has been successfully retrieved from the reference table
Applied to: Move Description to Trip Sheet Detail
WHEN
The description data is available for assignment
THEN
The system should move the retrieved description to the appropriate field in the trip sheet detail record
Context: A car type code does not have a corresponding description in the reference table
GIVEN
A car type code does not have a corresponding description in the reference table
Applied to: Set Default Description
WHEN
The car type description lookup fails to find a match
THEN
The system should assign a default description value to ensure the trip sheet field is populated
R-GCX146-cbl-01153 (+5) File: GCX146.cbl CCN Status Assignment Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Status Assignment Processing':
  • Context - a ccn record has current status of 'release':
    For Check Transit Status:
    When the transit status is 'e' (export) or 'z' (export zone), then assign the trip sheet status as 'export'.
  • Context - a ccn record has current status of 'release' and transit status is not 'e' or 'z':
    For Has S.A.R. Release?:
    When the release-by field contains 's.a.r.', then assign the trip sheet status as 's.a.r.'.
    For Assign Status = 'RELEASE':
    When the release-by field does not contain 's.a.r.', then assign the trip sheet status as 'release'.
  • Context - a ccn record has current status other than 'release':
    For Transit Status = 'T'?:
    When the transit status is 't' (transit), then assign the trip sheet status as 'transit'.
    For Keep Current Status:
    When the transit status is neither 't' nor 'r', then assign the trip sheet status as the current ccn status without modification.
  • Context - a ccn record has current status other than 'release' and transit status is not 't':
    For Transit Status = 'R'?:
    When the transit status is 'r' (return), then assign the trip sheet status as 'return'.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN record has current status of 'RELEASE'
GIVEN
A CCN record has current status of 'RELEASE'
Applied to: Check Transit Status
WHEN
The transit status is 'E' (Export) or 'Z' (Export Zone)
THEN
Assign the trip sheet status as 'EXPORT'
Context: A CCN record has current status of 'RELEASE' and transit status is not 'E' or 'Z'
GIVEN
A CCN record has current status of 'RELEASE' and transit status is not 'E' or 'Z'
Applied to: Has S.A.R. Release?
WHEN
The release-by field contains 'S.A.R.'
THEN
Assign the trip sheet status as 'S.A.R.'
Applied to: Assign Status = 'RELEASE'
WHEN
The release-by field does not contain 'S.A.R.'
THEN
Assign the trip sheet status as 'RELEASE'
Context: A CCN record has current status other than 'RELEASE'
GIVEN
A CCN record has current status other than 'RELEASE'
Applied to: Transit Status = 'T'?
WHEN
The transit status is 'T' (Transit)
THEN
Assign the trip sheet status as 'TRANSIT'
Applied to: Keep Current Status
WHEN
The transit status is neither 'T' nor 'R'
THEN
Assign the trip sheet status as the current CCN status without modification
Context: A CCN record has current status other than 'RELEASE' and transit status is not 'T'
GIVEN
A CCN record has current status other than 'RELEASE' and transit status is not 'T'
Applied to: Transit Status = 'R'?
WHEN
The transit status is 'R' (Return)
THEN
Assign the trip sheet status as 'RETURN'
R-GCX146-cbl-01159 (+7) File: GCX146.cbl Train Record Database Operations Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Record Database Operations':
  • Context - a train id is provided for processing:
    For Retrieve Existing Train Record:
    When the system attempts to retrieve the existing train record from the gcsb4rt database, then the system should successfully locate and retrieve the train record if it exists, or return a not found status if no record exists.
  • Context - a database retrieval operation has been performed for a train record:
    For Train Record Exists?:
    When the system evaluates the retrieval result status, then if the train record exists, proceed to delete the existing record; if no train record exists, proceed directly to insert new record.
  • Context - an existing train record has been found in the gcsb4rt database:
    For Delete Existing Train Record:
    When the system performs a delete operation on the existing train record, then the existing train record should be successfully removed from the database to prepare for the new record insertion.
  • Context - a delete operation has been performed on an existing train record:
    For Deletion Successful?:
    When the system evaluates the deletion operation result, then if deletion was successful, proceed to insert new train record; if deletion failed, report database operation error.
  • Context - either no existing train record was found or existing record was successfully deleted:
    For Insert New Train Record with Equipment Details:
    When the system performs an insert operation for the new train record with equipment details, then a new train record should be created in the gcsb4rt database with status set to sent and all equipment details included.
  • Context - an insert operation has been performed for a new train record:
    For Insert Successful?:
    When the system evaluates the insertion operation result, then if insertion was successful, complete train record operations; if insertion failed, report database operation error.
  • Context - all required database operations for train record processing have been performed:
    For Train Record Operations Complete:
    When the new train record has been successfully inserted into the database, then the train record operations should be marked as complete and processing can continue to next step.
  • Context - a database operation (delete or insert) has been attempted on train records:
    For Database Operation Error:
    When the database operation fails to complete successfully, then the system should report a database operation error and halt further processing of the train record.
👨‍💻 Technical ACs (Gherkin)
Context: A train ID is provided for processing
GIVEN
A train ID is provided for processing
Applied to: Retrieve Existing Train Record
WHEN
The system attempts to retrieve the existing train record from the GCSB4RT database
THEN
The system should successfully locate and retrieve the train record if it exists, or return a not found status if no record exists
Context: A database retrieval operation has been performed for a train record
GIVEN
A database retrieval operation has been performed for a train record
Applied to: Train Record Exists?
WHEN
The system evaluates the retrieval result status
THEN
If the train record exists, proceed to delete the existing record; if no train record exists, proceed directly to insert new record
Context: An existing train record has been found in the GCSB4RT database
GIVEN
An existing train record has been found in the GCSB4RT database
Applied to: Delete Existing Train Record
WHEN
The system performs a delete operation on the existing train record
THEN
The existing train record should be successfully removed from the database to prepare for the new record insertion
Context: A delete operation has been performed on an existing train record
GIVEN
A delete operation has been performed on an existing train record
Applied to: Deletion Successful?
WHEN
The system evaluates the deletion operation result
THEN
If deletion was successful, proceed to insert new train record; if deletion failed, report database operation error
Context: Either no existing train record was found or existing record was successfully deleted
GIVEN
Either no existing train record was found or existing record was successfully deleted
Applied to: Insert New Train Record with Equipment Details
WHEN
The system performs an insert operation for the new train record with equipment details
THEN
A new train record should be created in the GCSB4RT database with status set to SENT and all equipment details included
Context: An insert operation has been performed for a new train record
GIVEN
An insert operation has been performed for a new train record
Applied to: Insert Successful?
WHEN
The system evaluates the insertion operation result
THEN
If insertion was successful, complete train record operations; if insertion failed, report database operation error
Context: All required database operations for train record processing have been performed
GIVEN
All required database operations for train record processing have been performed
Applied to: Train Record Operations Complete
WHEN
The new train record has been successfully inserted into the database
THEN
The train record operations should be marked as complete and processing can continue to next step
Context: A database operation (delete or insert) has been attempted on train records
GIVEN
A database operation (delete or insert) has been attempted on train records
Applied to: Database Operation Error
WHEN
The database operation fails to complete successfully
THEN
The system should report a database operation error and halt further processing of the train record
R-GCX146-cbl-01167 (+7) File: GCX146.cbl Customer Report Message Generation Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customer Report Message Generation':
  • Context - a customer report needs to be generated:
    For Initialize Report Message Format:
    When the system begins report message creation process, then the report message format is initialized and ready to receive content.
  • Context - a customer report message is being prepared:
    For Set Message Type to GCT1401E:
    When the system sets up the message structure, then the message type is configured as gct1401e for proper routing and processing.
  • Context - a customer report message type has been set:
    For Configure Message Queue Routing:
    When the system configures message routing, then the message queue is configured to use alt-pcb2 for proper distribution routing.
  • Context - customer report content exists in gcx140-input and message routing is configured:
    For Move Report Content to Message Buffer:
    When the system prepares to queue the message, then the report content is moved to the message buffer for distribution.
  • Context - customer report content has been moved to message buffer:
    For Queue Message for Distribution:
    When the system processes the message for distribution, then the message is queued in the distribution system for delivery to recipients.
  • Context - customer report message has been queued for distribution:
    For Process Message Queue Commands:
    When the system executes queue processing commands, then the queued message commands are processed to complete the distribution.
  • Context - customer report message queue commands have been processed:
    For Purge Temporary Message Data:
    When the system completes message distribution, then temporary message data is purged to clean up system resources.
  • Context - customer report message has been processed and temporary data purged:
    For Customer Report Message Ready for Distribution:
    When the system completes all message preparation steps, then the customer report message is confirmed ready for distribution to designated recipients.
👨‍💻 Technical ACs (Gherkin)
Context: A customer report needs to be generated
GIVEN
A customer report needs to be generated
Applied to: Initialize Report Message Format
WHEN
The system begins report message creation process
THEN
The report message format is initialized and ready to receive content
Context: A customer report message is being prepared
GIVEN
A customer report message is being prepared
Applied to: Set Message Type to GCT1401E
WHEN
The system sets up the message structure
THEN
The message type is configured as GCT1401E for proper routing and processing
Context: A customer report message type has been set
GIVEN
A customer report message type has been set
Applied to: Configure Message Queue Routing
WHEN
The system configures message routing
THEN
The message queue is configured to use ALT-PCB2 for proper distribution routing
Context: Customer report content exists in GCX140-INPUT and message routing is configured
GIVEN
Customer report content exists in GCX140-INPUT and message routing is configured
Applied to: Move Report Content to Message Buffer
WHEN
The system prepares to queue the message
THEN
The report content is moved to the message buffer for distribution
Context: Customer report content has been moved to message buffer
GIVEN
Customer report content has been moved to message buffer
Applied to: Queue Message for Distribution
WHEN
The system processes the message for distribution
THEN
The message is queued in the distribution system for delivery to recipients
Context: Customer report message has been queued for distribution
GIVEN
Customer report message has been queued for distribution
Applied to: Process Message Queue Commands
WHEN
The system executes queue processing commands
THEN
The queued message commands are processed to complete the distribution
Context: Customer report message queue commands have been processed
GIVEN
Customer report message queue commands have been processed
Applied to: Purge Temporary Message Data
WHEN
The system completes message distribution
THEN
Temporary message data is purged to clean up system resources
Context: Customer report message has been processed and temporary data purged
GIVEN
Customer report message has been processed and temporary data purged
Applied to: Customer Report Message Ready for Distribution
WHEN
The system completes all message preparation steps
THEN
The customer report message is confirmed ready for distribution to designated recipients
R-GCX146-cbl-01175 (+12) File: GCX146.cbl Primary Waybill Lookup Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Primary Waybill Lookup':
  • Context - an equipment id is provided for waybill lookup:
    For Primary Waybill Lookup - Search FWIIROOT using Equipment ID & Primary Waybill Lookup - FWIIROOT:
    When the system searches the fwiiroot waybill database using the equipment id as the search key, then the system retrieves the waybill record if it exists and sets the waybill found flag, or sets the waybill not found flag if no record exists and the system retrieves the waybill record and sets the waybill found flag if successful, or sets the waybill not found flag if unsuccessful.
  • Context - raw equipment id data is available:
    For Prepare Equipment ID for Search:
    When the system needs to perform a waybill database search, then the equipment id is formatted and prepared as the search key for database access.
  • Context - a database search has been performed using equipment id:
    For Waybill Record Found?:
    When the system evaluates the search results, then the system determines if a waybill record was found and sets the appropriate status flag.
  • Context - a waybill record exists for the equipment id:
    For Set WS-WAYBILL-FOUND Flag:
    When the database search successfully locates the record, then the system sets the ws-waybill-found flag to indicate successful lookup.
  • Context - a waybill record has been found in the database:
    For Extract Waybill Information:
    When the system processes the retrieved record, then all relevant waybill information is extracted from the database record.
  • Context - waybill information has been extracted from the database record:
    For Move Waybill Data to Work Areas:
    When the system needs to make the data available for processing, then the waybill data is moved to appropriate work areas for subsequent business operations.
  • Context - no waybill record exists for the equipment id:
    For Set WS-WAYBILL-NOT-FOUND Flag:
    When the database search fails to locate any matching record, then the system sets the ws-waybill-not-found flag to indicate unsuccessful lookup.
  • Context - a waybill lookup request is initiated:
    For Set Equipment ID as Search Key:
    When the system prepares database search parameters, then the equipment id is set as the search key for the fwiiroot database query.
  • Context - a database call to fwiiroot has been executed:
    For Database Call Successful?:
    When the system evaluates the database call result, then if the call is successful, the system proceeds to retrieve waybill data; if unsuccessful, the system sets failure indicators.
  • Context - a waybill record has been successfully retrieved from fwiiroot database:
    For Set WS-WAYBILL-FOUND Flag:
    When the system processes the successful database response, then the ws-waybill-found flag is set to indicate successful waybill retrieval.
  • Context - a database call to fwiiroot has failed to retrieve a waybill record:
    For Set WS-WAYBILL-NOT-FOUND Flag:
    When the system processes the unsuccessful database response, then the ws-waybill-not-found flag is set to indicate failed waybill retrieval.
  • Context - a waybill record has been successfully retrieved and the waybill found flag is set:
    For Extract Waybill Information:
    When the system processes the waybill record data, then relevant waybill information is extracted and made available for subsequent business operations.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID is provided for waybill lookup
GIVEN
An equipment ID is provided for waybill lookup
Applied to: Primary Waybill Lookup - Search FWIIROOT using Equipment ID & Primary Waybill Lookup - FWIIROOT
WHEN
The system searches the FWIIROOT waybill database using the equipment ID as the search key
THEN
The system retrieves the waybill record if it exists and sets the waybill found flag, or sets the waybill not found flag if no record exists AND The system retrieves the waybill record and sets the waybill found flag if successful, or sets the waybill not found flag if unsuccessful
Context: Raw equipment ID data is available
GIVEN
Raw equipment ID data is available
Applied to: Prepare Equipment ID for Search
WHEN
The system needs to perform a waybill database search
THEN
The equipment ID is formatted and prepared as the search key for database access
Context: A database search has been performed using equipment ID
GIVEN
A database search has been performed using equipment ID
Applied to: Waybill Record Found?
WHEN
The system evaluates the search results
THEN
The system determines if a waybill record was found and sets the appropriate status flag
Context: A waybill record exists for the equipment ID
GIVEN
A waybill record exists for the equipment ID
Applied to: Set WS-WAYBILL-FOUND Flag
WHEN
The database search successfully locates the record
THEN
The system sets the WS-WAYBILL-FOUND flag to indicate successful lookup
Context: A waybill record has been found in the database
GIVEN
A waybill record has been found in the database
Applied to: Extract Waybill Information
WHEN
The system processes the retrieved record
THEN
All relevant waybill information is extracted from the database record
Context: Waybill information has been extracted from the database record
GIVEN
Waybill information has been extracted from the database record
Applied to: Move Waybill Data to Work Areas
WHEN
The system needs to make the data available for processing
THEN
The waybill data is moved to appropriate work areas for subsequent business operations
Context: No waybill record exists for the equipment ID
GIVEN
No waybill record exists for the equipment ID
Applied to: Set WS-WAYBILL-NOT-FOUND Flag
WHEN
The database search fails to locate any matching record
THEN
The system sets the WS-WAYBILL-NOT-FOUND flag to indicate unsuccessful lookup
Context: A waybill lookup request is initiated
GIVEN
A waybill lookup request is initiated
Applied to: Set Equipment ID as Search Key
WHEN
The system prepares database search parameters
THEN
The equipment ID is set as the search key for the FWIIROOT database query
Context: A database call to FWIIROOT has been executed
GIVEN
A database call to FWIIROOT has been executed
Applied to: Database Call Successful?
WHEN
The system evaluates the database call result
THEN
If the call is successful, the system proceeds to retrieve waybill data; if unsuccessful, the system sets failure indicators
Context: A waybill record has been successfully retrieved from FWIIROOT database
GIVEN
A waybill record has been successfully retrieved from FWIIROOT database
Applied to: Set WS-WAYBILL-FOUND Flag
WHEN
The system processes the successful database response
THEN
The WS-WAYBILL-FOUND flag is set to indicate successful waybill retrieval
Context: A database call to FWIIROOT has failed to retrieve a waybill record
GIVEN
A database call to FWIIROOT has failed to retrieve a waybill record
Applied to: Set WS-WAYBILL-NOT-FOUND Flag
WHEN
The system processes the unsuccessful database response
THEN
The WS-WAYBILL-NOT-FOUND flag is set to indicate failed waybill retrieval
Context: A waybill record has been successfully retrieved and the waybill found flag is set
GIVEN
A waybill record has been successfully retrieved and the waybill found flag is set
Applied to: Extract Waybill Information
WHEN
The system processes the waybill record data
THEN
Relevant waybill information is extracted and made available for subsequent business operations
R-GCX146-cbl-01182 (+21) File: GCX146.cbl Enhanced Waybill Search Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Enhanced Waybill Search':
  • Context - a waybill search request is initiated for equipment:
    For Prepare FWCARGET Search Parameters:
    When the system prepares fwcarget search parameters, then search parameters are initialized and prepared for database query execution.
  • Context - equipment information is available for waybill search:
    For Set Equipment ID as Primary Search Key:
    When the system sets the primary search key, then equipment id is assigned as the primary search criterion for fwcarget lookup.
  • Context - primary search key is established with equipment id:
    For Add Additional Search Criteria:
    When the system adds additional search criteria, then supplementary search parameters are configured to improve search effectiveness.
  • Context - search parameters are prepared with equipment id and additional criteria:
    For Execute FWCARGET Database Call:
    When the system executes fwcarget database call, then database query is performed against shiproot shipment database to locate waybill records.
  • Context - fwcarget database call has been executed:
    For Waybill Record Found?:
    When the system checks for waybill record existence, then system determines if a matching waybill record was found and proceeds accordingly.
  • Context - a waybill record has been found in the database:
    For Extract Waybill Information:
    When the system extracts waybill information, then relevant waybill data is retrieved from the database record for processing.
  • Context - waybill information has been extracted from the database record:
    For Validate Waybill Data Quality:
    When the system validates waybill data quality, then system verifies that extracted waybill data is complete and meets quality standards.
  • Context - waybill data quality validation has been performed:
    For Data Complete?:
    When the system assesses data completeness, then system determines if waybill data is complete and suitable for processing or if it should be treated as not found.
  • Context - waybill data is determined to be complete and valid:
    For Set Waybill Found Flag:
    When the system sets the waybill found flag, then waybill found indicator is set to true to indicate successful waybill location.
  • Context - waybill found flag has been set indicating successful waybill location:
    For Populate Equipment Waybill Fields:
    When the system populates equipment waybill fields, then equipment record is updated with waybill information for subsequent processing.
  • Context - either no waybill record was found or waybill data is determined to be incomplete:
    For Set Waybill Not Found Flag:
    When the system sets the waybill not found flag, then waybill not found indicator is set to indicate unsuccessful waybill location for appropriate error handling.
  • Context - a request to find waybill information for specific equipment:
    For Set Equipment ID Search Criteria:
    When the system prepares to search the shipment database, then equipment id is configured as the primary search criterion for fwcarget lookup.
  • Context - equipment id search criteria is established:
    For Call FWCARGET with Equipment ID:
    When the system calls fwcarget function with the equipment identifier, then database query is executed against shiproot shipment database using multi-criteria search capabilities.
  • Context - fwcarget database query has been executed for equipment id:
    For Waybill Record Found?:
    When the system evaluates the query results, then system determines if waybill record exists and routes processing accordingly - to record retrieval if found or to not-found handling if absent.
  • Context - a valid waybill record has been found in the shipment database:
    For Retrieve Waybill Details:
    When the system processes the located record, then complete waybill details are extracted from the shipment record for further processing.
  • Context - waybill details have been successfully retrieved from the shipment record:
    For Set WS-WAYBILL-FOUND Flag:
    When the system completes waybill information extraction, then ws-waybill-found flag is set to indicate successful waybill location and retrieval.
  • Context - waybill record has been retrieved and waybill-found flag is set:
    For Extract Shipment Information:
    When the system processes the waybill data, then relevant shipment information is extracted and organized for business use.
  • Context - shipment information has been extracted from the waybill record:
    For Validate Waybill Data Quality:
    When the system validates the extracted data, then data quality is assessed to determine if the waybill information is complete and usable.
  • Context - waybill data quality has been assessed:
    For Data Complete?:
    When the system evaluates data completeness, then system determines if data is complete for immediate use or requires fallback to inquiry database.
  • Context - waybill data has been validated as complete and usable:
    For Return Waybill Information:
    When the system finalizes waybill processing, then complete waybill information is returned for business operations.
  • Context - fwcarget query did not locate a waybill record for the equipment id:
    For Set WS-WAYBILL-NOT-FOUND Flag:
    When the system processes the unsuccessful search result, then ws-waybill-not-found flag is set to indicate waybill was not located in shipment database.
  • Context - either no waybill record was found or retrieved data is incomplete:
    For Prepare for Inquiry Database Fallback:
    When the system determines primary search was unsuccessful, then system prepares to use inquiry database as fallback search method.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill search request is initiated for equipment
GIVEN
A waybill search request is initiated for equipment
Applied to: Prepare FWCARGET Search Parameters
WHEN
The system prepares FWCARGET search parameters
THEN
Search parameters are initialized and prepared for database query execution
Context: Equipment information is available for waybill search
GIVEN
Equipment information is available for waybill search
Applied to: Set Equipment ID as Primary Search Key
WHEN
The system sets the primary search key
THEN
Equipment ID is assigned as the primary search criterion for FWCARGET lookup
Context: Primary search key is established with equipment ID
GIVEN
Primary search key is established with equipment ID
Applied to: Add Additional Search Criteria
WHEN
The system adds additional search criteria
THEN
Supplementary search parameters are configured to improve search effectiveness
Context: Search parameters are prepared with equipment ID and additional criteria
GIVEN
Search parameters are prepared with equipment ID and additional criteria
Applied to: Execute FWCARGET Database Call
WHEN
The system executes FWCARGET database call
THEN
Database query is performed against SHIPROOT shipment database to locate waybill records
Context: FWCARGET database call has been executed
GIVEN
FWCARGET database call has been executed
Applied to: Waybill Record Found?
WHEN
The system checks for waybill record existence
THEN
System determines if a matching waybill record was found and proceeds accordingly
Context: A waybill record has been found in the database
GIVEN
A waybill record has been found in the database
Applied to: Extract Waybill Information
WHEN
The system extracts waybill information
THEN
Relevant waybill data is retrieved from the database record for processing
Context: Waybill information has been extracted from the database record
GIVEN
Waybill information has been extracted from the database record
Applied to: Validate Waybill Data Quality
WHEN
The system validates waybill data quality
THEN
System verifies that extracted waybill data is complete and meets quality standards
Context: Waybill data quality validation has been performed
GIVEN
Waybill data quality validation has been performed
Applied to: Data Complete?
WHEN
The system assesses data completeness
THEN
System determines if waybill data is complete and suitable for processing or if it should be treated as not found
Context: Waybill data is determined to be complete and valid
GIVEN
Waybill data is determined to be complete and valid
Applied to: Set Waybill Found Flag
WHEN
The system sets the waybill found flag
THEN
Waybill found indicator is set to true to indicate successful waybill location
Context: Waybill found flag has been set indicating successful waybill location
GIVEN
Waybill found flag has been set indicating successful waybill location
Applied to: Populate Equipment Waybill Fields
WHEN
The system populates equipment waybill fields
THEN
Equipment record is updated with waybill information for subsequent processing
Context: Either no waybill record was found OR waybill data is determined to be incomplete
GIVEN
Either no waybill record was found OR waybill data is determined to be incomplete
Applied to: Set Waybill Not Found Flag
WHEN
The system sets the waybill not found flag
THEN
Waybill not found indicator is set to indicate unsuccessful waybill location for appropriate error handling
Context: A request to find waybill information for specific equipment
GIVEN
A request to find waybill information for specific equipment
Applied to: Set Equipment ID Search Criteria
WHEN
The system prepares to search the shipment database
THEN
Equipment ID is configured as the primary search criterion for FWCARGET lookup
Context: Equipment ID search criteria is established
GIVEN
Equipment ID search criteria is established
Applied to: Call FWCARGET with Equipment ID
WHEN
The system calls FWCARGET function with the equipment identifier
THEN
Database query is executed against SHIPROOT shipment database using multi-criteria search capabilities
Context: FWCARGET database query has been executed for equipment ID
GIVEN
FWCARGET database query has been executed for equipment ID
Applied to: Waybill Record Found?
WHEN
The system evaluates the query results
THEN
System determines if waybill record exists and routes processing accordingly - to record retrieval if found or to not-found handling if absent
Context: A valid waybill record has been found in the shipment database
GIVEN
A valid waybill record has been found in the shipment database
Applied to: Retrieve Waybill Details
WHEN
The system processes the located record
THEN
Complete waybill details are extracted from the shipment record for further processing
Context: Waybill details have been successfully retrieved from the shipment record
GIVEN
Waybill details have been successfully retrieved from the shipment record
Applied to: Set WS-WAYBILL-FOUND Flag
WHEN
The system completes waybill information extraction
THEN
WS-WAYBILL-FOUND flag is set to indicate successful waybill location and retrieval
Context: Waybill record has been retrieved and waybill-found flag is set
GIVEN
Waybill record has been retrieved and waybill-found flag is set
Applied to: Extract Shipment Information
WHEN
The system processes the waybill data
THEN
Relevant shipment information is extracted and organized for business use
Context: Shipment information has been extracted from the waybill record
GIVEN
Shipment information has been extracted from the waybill record
Applied to: Validate Waybill Data Quality
WHEN
The system validates the extracted data
THEN
Data quality is assessed to determine if the waybill information is complete and usable
Context: Waybill data quality has been assessed
GIVEN
Waybill data quality has been assessed
Applied to: Data Complete?
WHEN
The system evaluates data completeness
THEN
System determines if data is complete for immediate use or requires fallback to inquiry database
Context: Waybill data has been validated as complete and usable
GIVEN
Waybill data has been validated as complete and usable
Applied to: Return Waybill Information
WHEN
The system finalizes waybill processing
THEN
Complete waybill information is returned for business operations
Context: FWCARGET query did not locate a waybill record for the equipment ID
GIVEN
FWCARGET query did not locate a waybill record for the equipment ID
Applied to: Set WS-WAYBILL-NOT-FOUND Flag
WHEN
The system processes the unsuccessful search result
THEN
WS-WAYBILL-NOT-FOUND flag is set to indicate waybill was not located in shipment database
Context: Either no waybill record was found OR retrieved data is incomplete
GIVEN
Either no waybill record was found OR retrieved data is incomplete
Applied to: Prepare for Inquiry Database Fallback
WHEN
The system determines primary search was unsuccessful
THEN
System prepares to use inquiry database as fallback search method
R-GCX146-cbl-01193 (+14) File: GCX146.cbl Inquiry Database Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Inquiry Database Processing':
  • Context - primary waybill search has failed to locate equipment information:
    For Initialize FW-IQ Inquiry Search:
    When the system initiates fw-iq inquiry search process, then fw-iq inquiry parameters are initialized and search is prepared for equipment lookup.
  • Context - fw-iq inquiry search is initialized with valid equipment id:
    For Search FW-IQ Database by Equipment ID:
    When the system performs database lookup in fw-iq using equipment identifier, then database search is executed and inquiry record status is determined.
  • Context - fw-iq database search has been completed for equipment id:
    For Inquiry Record Found?:
    When the system evaluates the search results, then if inquiry record exists, proceed with data extraction; otherwise set waybill not found flag.
  • Context - valid inquiry record has been found in fw-iq database:
    For Extract Waybill Information from Inquiry:
    When the system extracts waybill information from inquiry record, then waybill data including numbers, dates, and related details are retrieved for processing.
  • Context - waybill information has been extracted from fw-iq inquiry record:
    For Data Complete?:
    When the system validates the completeness and quality of extracted data, then if data is complete and valid, set waybill found flag; otherwise treat as waybill not found.
  • Context - inquiry data has been validated and found to be complete:
    For Set Waybill Found Flag:
    When the system confirms successful waybill information retrieval, then waybill found flag is set to indicate valid waybill data is available for equipment processing.
  • Context - waybill found flag has been set and inquiry record is valid:
    For Extract Equipment Details:
    When the system extracts equipment-specific details from inquiry data, then equipment type, status, dimensions, and other relevant details are retrieved for processing.
  • Context - equipment details have been extracted from inquiry record:
    For Get Container Information if Flat Car:
    When the system evaluates if equipment is a flat car type that may carry containers, then if equipment is flat car, initiate container information lookup; otherwise continue with standard equipment processing.
  • Context - equipment has been identified as flat car requiring container processing:
    For Container Records Available?:
    When the system searches for associated container records, then if container records are available, proceed with container processing; otherwise continue with equipment processing.
  • Context - container records are available for flat car equipment:
    For Process Container Sequence:
    When the system processes container sequence information, then each container in sequence is identified and prepared for detailed processing.
  • Context - container sequence processing is active for flat car:
    For Extract Container IDs from T/C XREF:
    When the system accesses trailer/container cross-reference (t/c xref) data, then container ids are extracted and validated for each container associated with the flat car.
  • Context - container ids have been successfully extracted from cross-reference data:
    For Set Container Processing Flags:
    When the system sets container processing indicators, then container processing flags are activated to enable proper handling of containerized cargo.
  • Context - either no inquiry record was found or extracted data failed validation:
    For Set Waybill Not Found Flag:
    When the system determines waybill information is not available, then waybill not found flag is set to indicate equipment lacks valid waybill data.
  • Context - waybill not found flag has been set due to inquiry search failure:
    For Log Inquiry Search Failure:
    When the system logs the unsuccessful search attempt, then inquiry search failure is recorded with equipment id and search details for audit trail.
  • Context - inquiry search failure has been logged and waybill not found flag is set:
    For Proceed with Empty Equipment Processing:
    When the system continues with equipment processing, then equipment is processed using empty equipment business rules and validation criteria.
👨‍💻 Technical ACs (Gherkin)
Context: Primary waybill search has failed to locate equipment information
GIVEN
Primary waybill search has failed to locate equipment information
Applied to: Initialize FW-IQ Inquiry Search
WHEN
The system initiates FW-IQ inquiry search process
THEN
FW-IQ inquiry parameters are initialized and search is prepared for equipment lookup
Context: FW-IQ inquiry search is initialized with valid equipment ID
GIVEN
FW-IQ inquiry search is initialized with valid equipment ID
Applied to: Search FW-IQ Database by Equipment ID
WHEN
The system performs database lookup in FW-IQ using equipment identifier
THEN
Database search is executed and inquiry record status is determined
Context: FW-IQ database search has been completed for equipment ID
GIVEN
FW-IQ database search has been completed for equipment ID
Applied to: Inquiry Record Found?
WHEN
The system evaluates the search results
THEN
If inquiry record exists, proceed with data extraction; otherwise set waybill not found flag
Context: Valid inquiry record has been found in FW-IQ database
GIVEN
Valid inquiry record has been found in FW-IQ database
Applied to: Extract Waybill Information from Inquiry
WHEN
The system extracts waybill information from inquiry record
THEN
Waybill data including numbers, dates, and related details are retrieved for processing
Context: Waybill information has been extracted from FW-IQ inquiry record
GIVEN
Waybill information has been extracted from FW-IQ inquiry record
Applied to: Data Complete?
WHEN
The system validates the completeness and quality of extracted data
THEN
If data is complete and valid, set waybill found flag; otherwise treat as waybill not found
Context: Inquiry data has been validated and found to be complete
GIVEN
Inquiry data has been validated and found to be complete
Applied to: Set Waybill Found Flag
WHEN
The system confirms successful waybill information retrieval
THEN
Waybill found flag is set to indicate valid waybill data is available for equipment processing
Context: Waybill found flag has been set and inquiry record is valid
GIVEN
Waybill found flag has been set and inquiry record is valid
Applied to: Extract Equipment Details
WHEN
The system extracts equipment-specific details from inquiry data
THEN
Equipment type, status, dimensions, and other relevant details are retrieved for processing
Context: Equipment details have been extracted from inquiry record
GIVEN
Equipment details have been extracted from inquiry record
Applied to: Get Container Information if Flat Car
WHEN
The system evaluates if equipment is a flat car type that may carry containers
THEN
If equipment is flat car, initiate container information lookup; otherwise continue with standard equipment processing
Context: Equipment has been identified as flat car requiring container processing
GIVEN
Equipment has been identified as flat car requiring container processing
Applied to: Container Records Available?
WHEN
The system searches for associated container records
THEN
If container records are available, proceed with container processing; otherwise continue with equipment processing
Context: Container records are available for flat car equipment
GIVEN
Container records are available for flat car equipment
Applied to: Process Container Sequence
WHEN
The system processes container sequence information
THEN
Each container in sequence is identified and prepared for detailed processing
Context: Container sequence processing is active for flat car
GIVEN
Container sequence processing is active for flat car
Applied to: Extract Container IDs from T/C XREF
WHEN
The system accesses trailer/container cross-reference (T/C XREF) data
THEN
Container IDs are extracted and validated for each container associated with the flat car
Context: Container IDs have been successfully extracted from cross-reference data
GIVEN
Container IDs have been successfully extracted from cross-reference data
Applied to: Set Container Processing Flags
WHEN
The system sets container processing indicators
THEN
Container processing flags are activated to enable proper handling of containerized cargo
Context: Either no inquiry record was found OR extracted data failed validation
GIVEN
Either no inquiry record was found OR extracted data failed validation
Applied to: Set Waybill Not Found Flag
WHEN
The system determines waybill information is not available
THEN
Waybill not found flag is set to indicate equipment lacks valid waybill data
Context: Waybill not found flag has been set due to inquiry search failure
GIVEN
Waybill not found flag has been set due to inquiry search failure
Applied to: Log Inquiry Search Failure
WHEN
The system logs the unsuccessful search attempt
THEN
Inquiry search failure is recorded with equipment ID and search details for audit trail
Context: Inquiry search failure has been logged and waybill not found flag is set
GIVEN
Inquiry search failure has been logged and waybill not found flag is set
Applied to: Proceed with Empty Equipment Processing
WHEN
The system continues with equipment processing
THEN
Equipment is processed using empty equipment business rules and validation criteria
R-GCX146-cbl-01208 (+13) File: GCX146.cbl Container Record Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Record Processing':
  • Context - a flat car equipment id is provided for container lookup:
    For Access Flat Car Container Records Z510-GU-FWSWRWR:
    When the system accesses the flat car container records database, then container records associated with the flat car are retrieved for processing.
  • Context - a flat car container database lookup has been performed:
    For Container Records Found?:
    When the system checks for the presence of container records, then processing continues if records are found, otherwise container processing is skipped.
  • Context - container records exist for a flat car:
    For Extract Container IDs from Flat Car Records:
    When the system processes the flat car container records, then individual container ids are extracted from the records for validation and processing.
  • Context - container records have been found for equipment:
    For Set Flat Car Processing Flag WS-FLAT-CAR = TRUE:
    When the system identifies the equipment as carrying containers, then the flat car processing flag is set to indicate special container handling is required.
  • Context - container ids have been extracted from flat car records:
    For Access Container Inquiry Database Z530-GU-FW-IQ:
    When the system needs detailed container information, then container inquiry database is accessed to retrieve comprehensive container data.
  • Context - container inquiry database has been accessed:
    For Container Inquiry Records Available?:
    When the system checks for available container inquiry records, then processing continues with record retrieval if available, otherwise container processing completes.
  • Context - container inquiry records are available in the database:
    For Retrieve Next Container Record Z540-GNP-FWIQ:
    When the system processes containers sequentially, then each container record is retrieved in sequence for individual processing.
  • Context - container inquiry records contain t/c xref data:
    For Extract Container ID from T/C XREF Records:
    When the system processes cross-reference information, then container ids are extracted from the cross-reference records for validation.
  • Context - a container id has been extracted from cross-reference records:
    For Validate Container ID Format:
    When the system validates the container id format, then container id is accepted if format is valid, otherwise marked as invalid.
  • Context - container id format validation has been performed:
    For Container ID Valid?:
    When the system evaluates validation results, then valid container ids are stored for processing, invalid ids are marked and processing continues.
  • Context - a container id has passed format validation:
    For Store Valid Container ID for Processing:
    When the system processes valid container information, then the valid container id is stored in the processing queue for further business operations.
  • Context - a container id has failed format validation:
    For Mark Container as Invalid:
    When the system encounters an invalid container id, then the container is marked as invalid and excluded from further processing.
  • Context - a container has been processed from a flat car:
    For More Containers on Flat Car?:
    When the system checks for additional containers on the same flat car, then processing continues with next container if more exist, otherwise container processing completes.
  • Context - all containers on a flat car have been processed or no containers were found:
    For Container Processing Complete:
    When the system reaches the end of container processing, then container processing is marked as complete and control returns to main equipment processing.
👨‍💻 Technical ACs (Gherkin)
Context: A flat car equipment ID is provided for container lookup
GIVEN
A flat car equipment ID is provided for container lookup
Applied to: Access Flat Car Container Records Z510-GU-FWSWRWR
WHEN
The system accesses the flat car container records database
THEN
Container records associated with the flat car are retrieved for processing
Context: A flat car container database lookup has been performed
GIVEN
A flat car container database lookup has been performed
Applied to: Container Records Found?
WHEN
The system checks for the presence of container records
THEN
Processing continues if records are found, otherwise container processing is skipped
Context: Container records exist for a flat car
GIVEN
Container records exist for a flat car
Applied to: Extract Container IDs from Flat Car Records
WHEN
The system processes the flat car container records
THEN
Individual container IDs are extracted from the records for validation and processing
Context: Container records have been found for equipment
GIVEN
Container records have been found for equipment
Applied to: Set Flat Car Processing Flag WS-FLAT-CAR = TRUE
WHEN
The system identifies the equipment as carrying containers
THEN
The flat car processing flag is set to indicate special container handling is required
Context: Container IDs have been extracted from flat car records
GIVEN
Container IDs have been extracted from flat car records
Applied to: Access Container Inquiry Database Z530-GU-FW-IQ
WHEN
The system needs detailed container information
THEN
Container inquiry database is accessed to retrieve comprehensive container data
Context: Container inquiry database has been accessed
GIVEN
Container inquiry database has been accessed
Applied to: Container Inquiry Records Available?
WHEN
The system checks for available container inquiry records
THEN
Processing continues with record retrieval if available, otherwise container processing completes
Context: Container inquiry records are available in the database
GIVEN
Container inquiry records are available in the database
Applied to: Retrieve Next Container Record Z540-GNP-FWIQ
WHEN
The system processes containers sequentially
THEN
Each container record is retrieved in sequence for individual processing
Context: Container inquiry records contain T/C XREF data
GIVEN
Container inquiry records contain T/C XREF data
Applied to: Extract Container ID from T/C XREF Records
WHEN
The system processes cross-reference information
THEN
Container IDs are extracted from the cross-reference records for validation
Context: A container ID has been extracted from cross-reference records
GIVEN
A container ID has been extracted from cross-reference records
Applied to: Validate Container ID Format
WHEN
The system validates the container ID format
THEN
Container ID is accepted if format is valid, otherwise marked as invalid
Context: Container ID format validation has been performed
GIVEN
Container ID format validation has been performed
Applied to: Container ID Valid?
WHEN
The system evaluates validation results
THEN
Valid container IDs are stored for processing, invalid IDs are marked and processing continues
Context: A container ID has passed format validation
GIVEN
A container ID has passed format validation
Applied to: Store Valid Container ID for Processing
WHEN
The system processes valid container information
THEN
The valid container ID is stored in the processing queue for further business operations
Context: A container ID has failed format validation
GIVEN
A container ID has failed format validation
Applied to: Mark Container as Invalid
WHEN
The system encounters an invalid container ID
THEN
The container is marked as invalid and excluded from further processing
Context: A container has been processed from a flat car
GIVEN
A container has been processed from a flat car
Applied to: More Containers on Flat Car?
WHEN
The system checks for additional containers on the same flat car
THEN
Processing continues with next container if more exist, otherwise container processing completes
Context: All containers on a flat car have been processed or no containers were found
GIVEN
All containers on a flat car have been processed or no containers were found
Applied to: Container Processing Complete
WHEN
The system reaches the end of container processing
THEN
Container processing is marked as complete and control returns to main equipment processing
R-GCX146-cbl-01222 (+22) File: GCX146.cbl Container Sequence Processing Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Sequence Processing':
  • Context - a flat car equipment requires container processing:
    For Access Flat Car Container Records:
    When the system initiates container sequence processing, then the system accesses the flat car's container records from the container database.
  • Context - the system has accessed container records for a flat car:
    For Container Record Found?:
    When the system checks for container record availability, then the system determines if valid container records exist or if container processing should terminate with error.
  • Context - a valid container record has been found for the flat car:
    For Extract Container ID from Record:
    When the system processes the container record, then the system extracts the container id from the record for further validation and processing.
  • Context - a container id has been extracted from the container record:
    For Validate Container Information:
    When the system validates the container information, then the system verifies the container data meets all validation criteria and business requirements.
  • Context - container information has been validated successfully:
    For Process Container Waybill Data:
    When the system processes the container's waybill data, then the system retrieves and processes all relevant waybill information for the container.
  • Context - one container has been processed for a flat car:
    For More Containers on Flat Car?:
    When the system checks for additional containers on the same flat car, then the system determines whether more containers exist that need to be processed or if container sequence processing is complete.
  • Context - multiple containers exist on a flat car and one has been processed:
    For Get Next Container Record:
    When the system needs to process the next container, then the system retrieves the next sequential container record for processing.
  • Context - all containers on a flat car have been processed successfully:
    For Set Flat Car Processing Flag:
    When the system completes container sequence processing, then the system sets the flat car processing flag to indicate completion.
  • Context - the flat car processing flag has been set:
    For Complete Container Sequence:
    When the system finalizes container processing, then the system completes the container sequence processing and prepares for next equipment processing.
  • Context - container records are not found for a flat car:
    For Container Processing Error:
    When the system encounters container processing errors, then the system terminates container processing and handles the error condition appropriately.
  • Context - a flat car equipment record is being processed:
    For Access Flat Car Container Records:
    When the system needs to process containers on the flat car, then the system accesses fwswrwr container records using the flat car identification.
  • Context - container records have been accessed for a flat car:
    For Container Records Found?:
    When the system checks for container record availability, then the system determines if container records exist and routes processing accordingly.
  • Context - container records exist for a flat car:
    For Extract Container ID from T/C XREF:
    When the system processes container identification, then the system extracts container id from t/c xref records for further processing.
  • Context - container id has been extracted from t/c xref:
    For Set Flat Car Processing Flag:
    When the system begins flat car container processing, then the system sets the flat car processing flag to indicate active container processing.
  • Context - container id has been extracted and flat car processing flag is set:
    For Validate Container Identification:
    When the system validates container identification, then the system verifies container id format and validity for business processing.
  • Context - container identification has been validated:
    For Individual Container Validation:
    When the system processes individual container validation, then the system applies business rules specific to container processing requirements.
  • Context - individual container validation has been completed:
    For Update Container Processing Status:
    When the system updates container processing status, then the system records the current processing status for the container.
  • Context - container processing status has been updated:
    For Process Next Container in Sequence:
    When the system continues sequential processing, then the system moves to process the next container in the sequence.
  • Context - a container has been processed in sequence:
    For More Containers on Flat Car?:
    When the system checks for additional containers, then the system determines if more containers exist on the flat car for processing.
  • Context - no more containers exist on the flat car:
    For Complete Container Sequence:
    When the system completes container sequence processing, then the system finalizes all container processing for the flat car.
  • Context - no container records were found in primary lookup:
    For Container Inquiry Database Lookup:
    When the system performs inquiry database lookup, then the system accesses fw-iq inquiry database for container information.
  • Context - inquiry database lookup has been performed:
    For Inquiry Data Available?:
    When the system checks inquiry data availability, then the system determines if container data exists in the inquiry database.
  • Context - container data is available in inquiry database:
    For Use Inquiry Container Data:
    When the system processes inquiry container data, then the system uses inquiry database container data for validation processing.
👨‍💻 Technical ACs (Gherkin)
Context: A flat car equipment requires container processing
GIVEN
A flat car equipment requires container processing
Applied to: Access Flat Car Container Records
WHEN
The system initiates container sequence processing
THEN
The system accesses the flat car's container records from the container database
Context: The system has accessed container records for a flat car
GIVEN
The system has accessed container records for a flat car
Applied to: Container Record Found?
WHEN
The system checks for container record availability
THEN
The system determines if valid container records exist or if container processing should terminate with error
Context: A valid container record has been found for the flat car
GIVEN
A valid container record has been found for the flat car
Applied to: Extract Container ID from Record
WHEN
The system processes the container record
THEN
The system extracts the container ID from the record for further validation and processing
Context: A container ID has been extracted from the container record
GIVEN
A container ID has been extracted from the container record
Applied to: Validate Container Information
WHEN
The system validates the container information
THEN
The system verifies the container data meets all validation criteria and business requirements
Context: Container information has been validated successfully
GIVEN
Container information has been validated successfully
Applied to: Process Container Waybill Data
WHEN
The system processes the container's waybill data
THEN
The system retrieves and processes all relevant waybill information for the container
Context: One container has been processed for a flat car
GIVEN
One container has been processed for a flat car
Applied to: More Containers on Flat Car?
WHEN
The system checks for additional containers on the same flat car
THEN
The system determines whether more containers exist that need to be processed or if container sequence processing is complete
Context: Multiple containers exist on a flat car and one has been processed
GIVEN
Multiple containers exist on a flat car and one has been processed
Applied to: Get Next Container Record
WHEN
The system needs to process the next container
THEN
The system retrieves the next sequential container record for processing
Context: All containers on a flat car have been processed successfully
GIVEN
All containers on a flat car have been processed successfully
Applied to: Set Flat Car Processing Flag
WHEN
The system completes container sequence processing
THEN
The system sets the flat car processing flag to indicate completion
Context: The flat car processing flag has been set
GIVEN
The flat car processing flag has been set
Applied to: Complete Container Sequence
WHEN
The system finalizes container processing
THEN
The system completes the container sequence processing and prepares for next equipment processing
Context: Container records are not found for a flat car
GIVEN
Container records are not found for a flat car
Applied to: Container Processing Error
WHEN
The system encounters container processing errors
THEN
The system terminates container processing and handles the error condition appropriately
Context: A flat car equipment record is being processed
GIVEN
A flat car equipment record is being processed
Applied to: Access Flat Car Container Records
WHEN
The system needs to process containers on the flat car
THEN
The system accesses FWSWRWR container records using the flat car identification
Context: Container records have been accessed for a flat car
GIVEN
Container records have been accessed for a flat car
Applied to: Container Records Found?
WHEN
The system checks for container record availability
THEN
The system determines if container records exist and routes processing accordingly
Context: Container records exist for a flat car
GIVEN
Container records exist for a flat car
Applied to: Extract Container ID from T/C XREF
WHEN
The system processes container identification
THEN
The system extracts container ID from T/C XREF records for further processing
Context: Container ID has been extracted from T/C XREF
GIVEN
Container ID has been extracted from T/C XREF
Applied to: Set Flat Car Processing Flag
WHEN
The system begins flat car container processing
THEN
The system sets the flat car processing flag to indicate active container processing
Context: Container ID has been extracted and flat car processing flag is set
GIVEN
Container ID has been extracted and flat car processing flag is set
Applied to: Validate Container Identification
WHEN
The system validates container identification
THEN
The system verifies container ID format and validity for business processing
Context: Container identification has been validated
GIVEN
Container identification has been validated
Applied to: Individual Container Validation
WHEN
The system processes individual container validation
THEN
The system applies business rules specific to container processing requirements
Context: Individual container validation has been completed
GIVEN
Individual container validation has been completed
Applied to: Update Container Processing Status
WHEN
The system updates container processing status
THEN
The system records the current processing status for the container
Context: Container processing status has been updated
GIVEN
Container processing status has been updated
Applied to: Process Next Container in Sequence
WHEN
The system continues sequential processing
THEN
The system moves to process the next container in the sequence
Context: A container has been processed in sequence
GIVEN
A container has been processed in sequence
Applied to: More Containers on Flat Car?
WHEN
The system checks for additional containers
THEN
The system determines if more containers exist on the flat car for processing
Context: No more containers exist on the flat car
GIVEN
No more containers exist on the flat car
Applied to: Complete Container Sequence
WHEN
The system completes container sequence processing
THEN
The system finalizes all container processing for the flat car
Context: No container records were found in primary lookup
GIVEN
No container records were found in primary lookup
Applied to: Container Inquiry Database Lookup
WHEN
The system performs inquiry database lookup
THEN
The system accesses FW-IQ inquiry database for container information
Context: Inquiry database lookup has been performed
GIVEN
Inquiry database lookup has been performed
Applied to: Inquiry Data Available?
WHEN
The system checks inquiry data availability
THEN
The system determines if container data exists in the inquiry database
Context: Container data is available in inquiry database
GIVEN
Container data is available in inquiry database
Applied to: Use Inquiry Container Data
WHEN
The system processes inquiry container data
THEN
The system uses inquiry database container data for validation processing
R-GCX146-cbl-01232 (+12) File: GCX146.cbl Equipment Status Classification Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Status Classification':
  • Context - equipment is being processed for status classification:
    For Check CCN Current Status:
    When the system checks for ccn existence for the equipment, then if ccn is found, retrieve and use the current ccn status for further classification, otherwise proceed to alternative classification logic.
  • Context - equipment has a ccn with current status available:
    For Status = RELEASE?:
    When the ccn current status equals 'release' or 'csa-dlv', then proceed to evaluate transit status for further sub-classification of release status equipment.
  • Context - equipment has ccn status of 'release' or 'csa-dlv':
    For Classify as EXPORT Status:
    When the transit status is 'e' (export) or 'z', then classify the equipment status as 'export' for reporting purposes.
    For Classify as RELEASE Status:
    When transit status is not 'e' or 'z' and release-by field does not contain 's.a.r.', then classify the equipment status as 'release' for reporting purposes.
  • Context - equipment has ccn status of 'release' or 'csa-dlv' and transit status is not 'e' or 'z':
    For Classify as S.A.R. Status:
    When the release-by field contains 's.a.r.', then classify the equipment status as 's.a.r.' for reporting purposes.
  • Context - equipment has ccn with status other than 'release' or 'csa-dlv':
    For Classify as TRANSIT Status:
    When the in-transit status equals 't', then classify the equipment status as 'transit' for reporting purposes.
    For Use Current CCN Status:
    When in-transit status is neither 't' nor 'r', then use the current ccn status as-is for equipment classification.
  • Context - equipment has ccn with status other than 'release' or 'csa-dlv' and in-transit status is not 't':
    For Classify as RETURN Status:
    When the in-transit status equals 'r', then classify the equipment status as 'return' for reporting purposes.
  • Context - equipment does not have a ccn record:
    For Classify as PROCEED Status:
    When equipment is marked as empty (le = 'e') or is exempted from ccn requirements, then classify the equipment status as 'proceed' and increment total-proceed counter.
  • Context - equipment does not have ccn and is not empty or exempted:
    For Classify as HELD-CCRA Status:
    When equipment has status 'hold' or 'agi-hold', then classify the equipment status as 'held-ccra' and increment total-held-ccra counter.
  • Context - equipment does not have ccn, is not empty/exempted, and is not held by ccra:
    For Classify as HELD-DOCS Status:
    When manifest from station equals manifest to station and broker entry is empty, then classify the equipment status as 'held-docs' and increment total-held-docs counter.
  • Context - equipment does not meet other classification criteria:
    For Classify as HAULAGE Status:
    When manual haulage flag is set to 'y' or haulage flag is set, then classify the equipment status as 'haulage' and increment total-haulage counter.
  • Context - equipment has been classified into a specific status category:
    For Update Equipment Status Totals:
    When status classification is complete, then increment the appropriate total counter (total-release, total-haulage, total-proceed, total-held-ccra, total-held-docs, or total-equip) based on the classified status.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment is being processed for status classification
GIVEN
Equipment is being processed for status classification
Applied to: Check CCN Current Status
WHEN
The system checks for CCN existence for the equipment
THEN
If CCN is found, retrieve and use the current CCN status for further classification, otherwise proceed to alternative classification logic
Context: Equipment has a CCN with current status available
GIVEN
Equipment has a CCN with current status available
Applied to: Status = RELEASE?
WHEN
The CCN current status equals 'RELEASE' or 'CSA-DLV'
THEN
Proceed to evaluate transit status for further sub-classification of RELEASE status equipment
Context: Equipment has CCN status of 'RELEASE' or 'CSA-DLV'
GIVEN
Equipment has CCN status of 'RELEASE' or 'CSA-DLV'
Applied to: Classify as EXPORT Status
WHEN
The transit status is 'E' (Export) or 'Z'
THEN
Classify the equipment status as 'EXPORT' for reporting purposes
Applied to: Classify as RELEASE Status
WHEN
Transit status is not 'E' or 'Z' and release-by field does not contain 'S.A.R.'
THEN
Classify the equipment status as 'RELEASE' for reporting purposes
Context: Equipment has CCN status of 'RELEASE' or 'CSA-DLV' and transit status is not 'E' or 'Z'
GIVEN
Equipment has CCN status of 'RELEASE' or 'CSA-DLV' and transit status is not 'E' or 'Z'
Applied to: Classify as S.A.R. Status
WHEN
The release-by field contains 'S.A.R.'
THEN
Classify the equipment status as 'S.A.R.' for reporting purposes
Context: Equipment has CCN with status other than 'RELEASE' or 'CSA-DLV'
GIVEN
Equipment has CCN with status other than 'RELEASE' or 'CSA-DLV'
Applied to: Classify as TRANSIT Status
WHEN
The in-transit status equals 'T'
THEN
Classify the equipment status as 'TRANSIT' for reporting purposes
Applied to: Use Current CCN Status
WHEN
In-transit status is neither 'T' nor 'R'
THEN
Use the current CCN status as-is for equipment classification
Context: Equipment has CCN with status other than 'RELEASE' or 'CSA-DLV' and in-transit status is not 'T'
GIVEN
Equipment has CCN with status other than 'RELEASE' or 'CSA-DLV' and in-transit status is not 'T'
Applied to: Classify as RETURN Status
WHEN
The in-transit status equals 'R'
THEN
Classify the equipment status as 'RETURN' for reporting purposes
Context: Equipment does not have a CCN record
GIVEN
Equipment does not have a CCN record
Applied to: Classify as PROCEED Status
WHEN
Equipment is marked as empty (LE = 'E') or is exempted from CCN requirements
THEN
Classify the equipment status as 'PROCEED' and increment TOTAL-PROCEED counter
Context: Equipment does not have CCN and is not empty or exempted
GIVEN
Equipment does not have CCN and is not empty or exempted
Applied to: Classify as HELD-CCRA Status
WHEN
Equipment has status 'HOLD' or 'AGI-HOLD'
THEN
Classify the equipment status as 'HELD-CCRA' and increment TOTAL-HELD-CCRA counter
Context: Equipment does not have CCN, is not empty/exempted, and is not held by CCRA
GIVEN
Equipment does not have CCN, is not empty/exempted, and is not held by CCRA
Applied to: Classify as HELD-DOCS Status
WHEN
Manifest from station equals manifest to station and broker entry is empty
THEN
Classify the equipment status as 'HELD-DOCS' and increment TOTAL-HELD-DOCS counter
Context: Equipment does not meet other classification criteria
GIVEN
Equipment does not meet other classification criteria
Applied to: Classify as HAULAGE Status
WHEN
Manual haulage flag is set to 'Y' or haulage flag is set
THEN
Classify the equipment status as 'HAULAGE' and increment TOTAL-HAULAGE counter
Context: Equipment has been classified into a specific status category
GIVEN
Equipment has been classified into a specific status category
Applied to: Update Equipment Status Totals
WHEN
Status classification is complete
THEN
Increment the appropriate total counter (TOTAL-RELEASE, TOTAL-HAULAGE, TOTAL-PROCEED, TOTAL-HELD-CCRA, TOTAL-HELD-DOCS, or TOTAL-EQUIP) based on the classified status
R-GCX146-cbl-01245 (+8) File: GCX146.cbl Status Counter Management Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Counter Management':
  • Context - an equipment item is being processed for status totals:
    For Increment TOTAL-RELEASE Counter:
    When the ccn status is 'release' or 'csa-dlv', then the total-release counter should be incremented by 1.
    For Increment TOTAL-HAULAGE Counter:
    When the equipment has haulage rights flag set or manual haulage flag is set, then the total-haulage counter should be incremented by 1.
    For Increment TOTAL-HELD-CCRA Counter:
    When the ccn status is 'hold' or 'agi-hold', then the total-held-ccra counter should be incremented by 1.
    For Increment TOTAL-PROCEED Counter:
    When the ccn status is 'return' or the manifest from station is different from the manifest to station and the status is not error, reject, or deleted, then the total-proceed counter should be incremented by 1.
    For Increment TOTAL-HELD-DOCS Counter:
    When the manifest from station equals the manifest to station and the broker entry is empty, then the total-held-docs counter should be incremented by 1.
    For Increment TOTAL-TRANSIT Counter:
    When the in-transit status is 't', then the total-transit counter should be incremented by 1.
    For Increment TOTAL-EXPORT Counter:
    When the in-transit status is 'e' or 'z', then the total-export counter should be incremented by 1.
    For Increment TOTAL-RETURN Counter:
    When the in-transit status is 'r', then the total-return counter should be incremented by 1.
  • Context - all status-specific counters have been evaluated for an equipment item:
    For Update Equipment Status Totals:
    When the equipment processing is complete, then all applicable status counters should be updated and the total equipment count should be incremented by 1.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed for status totals
GIVEN
An equipment item is being processed for status totals
Applied to: Increment TOTAL-RELEASE Counter
WHEN
The CCN status is 'RELEASE' or 'CSA-DLV'
THEN
The TOTAL-RELEASE counter should be incremented by 1
Applied to: Increment TOTAL-HAULAGE Counter
WHEN
The equipment has haulage rights flag set or manual haulage flag is set
THEN
The TOTAL-HAULAGE counter should be incremented by 1
Applied to: Increment TOTAL-HELD-CCRA Counter
WHEN
The CCN status is 'HOLD' or 'AGI-HOLD'
THEN
The TOTAL-HELD-CCRA counter should be incremented by 1
Applied to: Increment TOTAL-PROCEED Counter
WHEN
The CCN status is 'RETURN' or the manifest from station is different from the manifest to station and the status is not error, reject, or deleted
THEN
The TOTAL-PROCEED counter should be incremented by 1
Applied to: Increment TOTAL-HELD-DOCS Counter
WHEN
The manifest from station equals the manifest to station and the broker entry is empty
THEN
The TOTAL-HELD-DOCS counter should be incremented by 1
Applied to: Increment TOTAL-TRANSIT Counter
WHEN
The in-transit status is 'T'
THEN
The TOTAL-TRANSIT counter should be incremented by 1
Applied to: Increment TOTAL-EXPORT Counter
WHEN
The in-transit status is 'E' or 'Z'
THEN
The TOTAL-EXPORT counter should be incremented by 1
Applied to: Increment TOTAL-RETURN Counter
WHEN
The in-transit status is 'R'
THEN
The TOTAL-RETURN counter should be incremented by 1
Context: All status-specific counters have been evaluated for an equipment item
GIVEN
All status-specific counters have been evaluated for an equipment item
Applied to: Update Equipment Status Totals
WHEN
The equipment processing is complete
THEN
All applicable status counters should be updated and the total equipment count should be incremented by 1
R-GCX146-cbl-01254 (+10) File: GCX146.cbl Trip Sheet Header Generation Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Trip Sheet Header Generation':
  • Context - a trip sheet report needs to be generated:
    For Initialize Trip Sheet Header Fields:
    When the system begins trip sheet header generation, then all header fields are cleared and initialized to spaces or zeros.
  • Context - an input message contains train identification data:
    For Extract Train Components from Input:
    When the system processes the train information, then train number, day, from station, to station, and consist number are extracted from the input message.
  • Context - train identification components may contain spaces:
    For Replace Spaces with Zeros:
    When the system formats train components, then all spaces in train number, day, from station, to station, and consist number are replaced with zeros.
  • Context - individual train components have been formatted:
    For Build Customs Train ID:
    When the system builds the customs train id, then the customs train id is constructed by concatenating train number, day, from station, to station, and consist number.
  • Context - train has from and to station codes:
    For Retrieve From Station Code:
    When the system formats station information, then station codes are retrieved and corresponding station names are formatted for display.
  • Context - a trip sheet report is being generated:
    For Capture Current System Date:
    When the system needs to timestamp the report, then current system date and time are captured and formatted for report display.
    For Set Report Type Indicator:
    When the system sets report identification, then report type indicator is set to identify this as a trip sheet report.
    For Set Page Number and Line Counter:
    When the system sets up report pagination, then page number is set to 1 and line counter is initialized to track report lines.
  • Context - train has an estimated time of arrival:
    For Validate ETA Date Format:
    When the system formats eta information, then eta date format is validated and formatted appropriately for trip sheet display.
  • Context - a trip sheet report is for canadian customs:
    For Set Canadian Customs Header Text:
    When the system sets report headers, then canadian customs header text and report title are set with appropriate description.
  • Context - a trip sheet report includes equipment totals:
    For Initialize Equipment Count Fields:
    When the system initializes the totals section, then all equipment count fields are set to zero and status category headers are established.
👨‍💻 Technical ACs (Gherkin)
Context: A trip sheet report needs to be generated
GIVEN
A trip sheet report needs to be generated
Applied to: Initialize Trip Sheet Header Fields
WHEN
The system begins trip sheet header generation
THEN
All header fields are cleared and initialized to spaces or zeros
Context: An input message contains train identification data
GIVEN
An input message contains train identification data
Applied to: Extract Train Components from Input
WHEN
The system processes the train information
THEN
Train number, day, from station, to station, and consist number are extracted from the input message
Context: Train identification components may contain spaces
GIVEN
Train identification components may contain spaces
Applied to: Replace Spaces with Zeros
WHEN
The system formats train components
THEN
All spaces in train number, day, from station, to station, and consist number are replaced with zeros
Context: Individual train components have been formatted
GIVEN
Individual train components have been formatted
Applied to: Build Customs Train ID
WHEN
The system builds the customs train ID
THEN
The customs train ID is constructed by concatenating train number, day, from station, to station, and consist number
Context: Train has from and to station codes
GIVEN
Train has from and to station codes
Applied to: Retrieve From Station Code
WHEN
The system formats station information
THEN
Station codes are retrieved and corresponding station names are formatted for display
Context: A trip sheet report is being generated
GIVEN
A trip sheet report is being generated
Applied to: Capture Current System Date
WHEN
The system needs to timestamp the report
THEN
Current system date and time are captured and formatted for report display
Applied to: Set Report Type Indicator
WHEN
The system sets report identification
THEN
Report type indicator is set to identify this as a trip sheet report
Applied to: Set Page Number and Line Counter
WHEN
The system sets up report pagination
THEN
Page number is set to 1 and line counter is initialized to track report lines
Context: Train has an estimated time of arrival
GIVEN
Train has an estimated time of arrival
Applied to: Validate ETA Date Format
WHEN
The system formats ETA information
THEN
ETA date format is validated and formatted appropriately for trip sheet display
Context: A trip sheet report is for Canadian customs
GIVEN
A trip sheet report is for Canadian customs
Applied to: Set Canadian Customs Header Text
WHEN
The system sets report headers
THEN
Canadian customs header text and report title are set with appropriate description
Context: A trip sheet report includes equipment totals
GIVEN
A trip sheet report includes equipment totals
Applied to: Initialize Equipment Count Fields
WHEN
The system initializes the totals section
THEN
All equipment count fields are set to zero and status category headers are established
R-GCX146-cbl-01265 (+15) File: GCX146.cbl Equipment List Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment List Processing':
  • Context - an equipment record is being processed for formatting:
    For Determine Equipment Type:
    When the equipment is identified as a container type, then the system sets the equipment type code to 'c' for container and applies container-specific formatting rules.
    For Determine Equipment Type:
    When the equipment is identified as a trailer type, then the system sets the equipment type code to 't' for trailer and applies trailer-specific formatting rules.
    For Determine Equipment Type:
    When the equipment is identified as a rail car type, then the system sets the equipment type code to 'r' for rail car and applies rail car-specific formatting rules.
  • Context - an equipment record has been classified as container type:
    For Format Container Entry:
    When the container id needs to be formatted for display, then the system applies container-specific id formatting using gcccarfm utility to create 12-character standardized format.
  • Context - an equipment record has been classified as trailer type:
    For Format Trailer Entry:
    When the trailer id needs to be formatted for display, then the system applies trailer-specific id formatting rules to create standardized trailer identification format.
  • Context - an equipment record has been classified as rail car type:
    For Format Rail Car Entry:
    When the rail car id needs to be formatted for display, then the system applies rail car-specific id formatting rules to create standardized car number format.
  • Context - an equipment record is being processed with load/empty indicator available:
    For Determine Load/Empty Status:
    When the system evaluates the load status indicator field, then the system determines if equipment is loaded or empty and sets corresponding status flags for further processing.
  • Context - equipment has been evaluated for load status:
    For Set LOADED Status:
    When the equipment is determined to be carrying cargo (loaded), then the system sets the equipment status to 'loaded' and applies loaded equipment processing rules.
    For Set EMPTY Status:
    When the equipment is determined to be not carrying cargo (empty), then the system sets the equipment status to 'empty' and applies empty equipment processing rules.
  • Context - equipment has been classified by type and load status:
    For Format Equipment ID:
    When the equipment id needs to be formatted for processing, then the system removes spaces from the equipment id and applies standardized formatting rules based on equipment type.
  • Context - equipment id has been initially formatted:
    For Apply Car ID Formatting:
    When car-specific formatting is required, then the system applies car id formatting rules to create standardized car number representation with proper spacing and character positioning.
  • Context - equipment has been formatted and classified:
    For Set IDLER Message:
    When the equipment is identified as idler equipment (non-revenue generating), then the system sets the equipment message to 'idler' to indicate special handling requirements.
    For Set UNIT Message:
    When the equipment is identified as unit equipment (part of unit train), then the system sets the equipment message to 'unit' to indicate unit train handling requirements.
    For Set Standard Message:
    When the equipment is not identified as idler or unit equipment, then the system sets a standard equipment message for normal processing and handling.
  • Context - equipment has been classified, formatted, and assigned appropriate status messages:
    For Build Equipment Entry Line:
    When a complete equipment entry line needs to be constructed, then the system combines equipment id, type code, load status, and status messages into a single formatted equipment entry line.
  • Context - a complete equipment entry line has been constructed:
    For Add to Equipment List:
    When the equipment entry needs to be added to the train's equipment list, then the system adds the formatted equipment entry to the master equipment list maintaining proper sequence and organization.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record is being processed for formatting
GIVEN
An equipment record is being processed for formatting
Applied to: Determine Equipment Type
WHEN
The equipment is identified as a container type
THEN
The system sets the equipment type code to 'C' for container and applies container-specific formatting rules
Applied to: Determine Equipment Type
WHEN
The equipment is identified as a trailer type
THEN
The system sets the equipment type code to 'T' for trailer and applies trailer-specific formatting rules
Applied to: Determine Equipment Type
WHEN
The equipment is identified as a rail car type
THEN
The system sets the equipment type code to 'R' for rail car and applies rail car-specific formatting rules
Context: An equipment record has been classified as container type
GIVEN
An equipment record has been classified as container type
Applied to: Format Container Entry
WHEN
The container ID needs to be formatted for display
THEN
The system applies container-specific ID formatting using GCCCARFM utility to create 12-character standardized format
Context: An equipment record has been classified as trailer type
GIVEN
An equipment record has been classified as trailer type
Applied to: Format Trailer Entry
WHEN
The trailer ID needs to be formatted for display
THEN
The system applies trailer-specific ID formatting rules to create standardized trailer identification format
Context: An equipment record has been classified as rail car type
GIVEN
An equipment record has been classified as rail car type
Applied to: Format Rail Car Entry
WHEN
The rail car ID needs to be formatted for display
THEN
The system applies rail car-specific ID formatting rules to create standardized car number format
Context: An equipment record is being processed with load/empty indicator available
GIVEN
An equipment record is being processed with load/empty indicator available
Applied to: Determine Load/Empty Status
WHEN
The system evaluates the load status indicator field
THEN
The system determines if equipment is loaded or empty and sets corresponding status flags for further processing
Context: Equipment has been evaluated for load status
GIVEN
Equipment has been evaluated for load status
Applied to: Set LOADED Status
WHEN
The equipment is determined to be carrying cargo (loaded)
THEN
The system sets the equipment status to 'LOADED' and applies loaded equipment processing rules
Applied to: Set EMPTY Status
WHEN
The equipment is determined to be not carrying cargo (empty)
THEN
The system sets the equipment status to 'EMPTY' and applies empty equipment processing rules
Context: Equipment has been classified by type and load status
GIVEN
Equipment has been classified by type and load status
Applied to: Format Equipment ID
WHEN
The equipment ID needs to be formatted for processing
THEN
The system removes spaces from the equipment ID and applies standardized formatting rules based on equipment type
Context: Equipment ID has been initially formatted
GIVEN
Equipment ID has been initially formatted
Applied to: Apply Car ID Formatting
WHEN
Car-specific formatting is required
THEN
The system applies car ID formatting rules to create standardized car number representation with proper spacing and character positioning
Context: Equipment has been formatted and classified
GIVEN
Equipment has been formatted and classified
Applied to: Set IDLER Message
WHEN
The equipment is identified as idler equipment (non-revenue generating)
THEN
The system sets the equipment message to 'IDLER' to indicate special handling requirements
Applied to: Set UNIT Message
WHEN
The equipment is identified as unit equipment (part of unit train)
THEN
The system sets the equipment message to 'UNIT' to indicate unit train handling requirements
Applied to: Set Standard Message
WHEN
The equipment is not identified as idler or unit equipment
THEN
The system sets a standard equipment message for normal processing and handling
Context: Equipment has been classified, formatted, and assigned appropriate status messages
GIVEN
Equipment has been classified, formatted, and assigned appropriate status messages
Applied to: Build Equipment Entry Line
WHEN
A complete equipment entry line needs to be constructed
THEN
The system combines equipment ID, type code, load status, and status messages into a single formatted equipment entry line
Context: A complete equipment entry line has been constructed
GIVEN
A complete equipment entry line has been constructed
Applied to: Add to Equipment List
WHEN
The equipment entry needs to be added to the train's equipment list
THEN
The system adds the formatted equipment entry to the master equipment list maintaining proper sequence and organization
R-GCX146-cbl-01281 (+11) File: GCX146.cbl Summary Totals Generation Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Summary Totals Generation':
  • Context - a summary totals generation process is starting:
    For Initialize Total Counters:
    When the system begins calculating equipment totals, then all total counters (total-equip, total-release, total-haulage, total-held-ccra, total-proceed, total-held-docs, total-docs-nr) are set to zero.
  • Context - equipment records with various status values exist:
    For Calculate Released Cargo Total:
    When the system processes equipment with status equal to 'release' or 'csa-dlv', then the total-release counter is incremented by one for each qualifying equipment piece.
  • Context - equipment records with haulage and manual haulage indicators exist:
    For Calculate Haulage Rights Total:
    When the system processes equipment where haulage flag is 'y' or manual haulage flag is 'y', then the total-haulage counter is incremented by one for each qualifying equipment piece.
  • Context - equipment records with various hold status values exist:
    For Calculate CCRA Held Total:
    When the system processes equipment with status equal to 'hold' or 'agi-hold', then the total-held-ccra counter is incremented by one for each qualifying equipment piece.
  • Context - equipment records with manifest from/to stations and status information exist:
    For Calculate Proceeding Cargo Total:
    When the system processes equipment with status 'return' or where manifest from station differs from manifest to station and status is not error, reject, or deleted, then the total-proceed counter is incremented by one for each qualifying equipment piece.
  • Context - equipment records with manifest station information and broker entry data exist:
    For Calculate Documentation Held Total:
    When the system processes equipment where manifest from station equals manifest to station and broker entry is empty or spaces, then the total-held-docs counter is incremented by one for each qualifying equipment piece.
  • Context - calculated total counter values exist as numeric fields:
    For Format Total Values for Display:
    When the system prepares totals for report display, then each total value is formatted with leading zeros suppressed and right-justified in display fields.
  • Context - formatted total values for all equipment categories exist:
    For Generate Equipment Summary Lines:
    When the system generates summary report lines, then summary lines are created showing 'total equipment', 'total release', 'total haulage', 'total held ccra', 'total proceed', 'total held docs', and 'total docs n/r' with their respective counts.
  • Context - a trip sheet report is being generated for an add operation and equipment summary lines exist:
    For Add Totals to Trip Sheet:
    When the system adds totals to the trip sheet, then equipment summary lines are appended to the trip sheet report with proper formatting and line spacing.
  • Context - a status report is being generated for a verify operation and equipment summary lines exist:
    For Add Totals to Status Report:
    When the system adds totals to the status report, then equipment summary lines are appended to the status report with proper formatting and line spacing.
  • Context - all equipment totals have been calculated:
    For Validate Total Calculations:
    When the system validates the total calculations, then the sum of all category totals (release + haulage + held-ccra + proceed + held-docs + docs-nr) equals or is less than total-equip.
  • Context - total calculations have been validated and found to be inconsistent:
    For Report Total Calculation Error:
    When the validation fails, then an error message is generated indicating total calculation inconsistency and the summary generation continues with available totals.
👨‍💻 Technical ACs (Gherkin)
Context: A summary totals generation process is starting
GIVEN
A summary totals generation process is starting
Applied to: Initialize Total Counters
WHEN
The system begins calculating equipment totals
THEN
All total counters (TOTAL-EQUIP, TOTAL-RELEASE, TOTAL-HAULAGE, TOTAL-HELD-CCRA, TOTAL-PROCEED, TOTAL-HELD-DOCS, TOTAL-DOCS-NR) are set to zero
Context: Equipment records with various status values exist
GIVEN
Equipment records with various status values exist
Applied to: Calculate Released Cargo Total
WHEN
The system processes equipment with status equal to 'RELEASE' or 'CSA-DLV'
THEN
The TOTAL-RELEASE counter is incremented by one for each qualifying equipment piece
Context: Equipment records with haulage and manual haulage indicators exist
GIVEN
Equipment records with haulage and manual haulage indicators exist
Applied to: Calculate Haulage Rights Total
WHEN
The system processes equipment where haulage flag is 'Y' or manual haulage flag is 'Y'
THEN
The TOTAL-HAULAGE counter is incremented by one for each qualifying equipment piece
Context: Equipment records with various hold status values exist
GIVEN
Equipment records with various hold status values exist
Applied to: Calculate CCRA Held Total
WHEN
The system processes equipment with status equal to 'HOLD' or 'AGI-HOLD'
THEN
The TOTAL-HELD-CCRA counter is incremented by one for each qualifying equipment piece
Context: Equipment records with manifest from/to stations and status information exist
GIVEN
Equipment records with manifest from/to stations and status information exist
Applied to: Calculate Proceeding Cargo Total
WHEN
The system processes equipment with status 'RETURN' or where manifest from station differs from manifest to station and status is not error, reject, or deleted
THEN
The TOTAL-PROCEED counter is incremented by one for each qualifying equipment piece
Context: Equipment records with manifest station information and broker entry data exist
GIVEN
Equipment records with manifest station information and broker entry data exist
Applied to: Calculate Documentation Held Total
WHEN
The system processes equipment where manifest from station equals manifest to station and broker entry is empty or spaces
THEN
The TOTAL-HELD-DOCS counter is incremented by one for each qualifying equipment piece
Context: Calculated total counter values exist as numeric fields
GIVEN
Calculated total counter values exist as numeric fields
Applied to: Format Total Values for Display
WHEN
The system prepares totals for report display
THEN
Each total value is formatted with leading zeros suppressed and right-justified in display fields
Context: Formatted total values for all equipment categories exist
GIVEN
Formatted total values for all equipment categories exist
Applied to: Generate Equipment Summary Lines
WHEN
The system generates summary report lines
THEN
Summary lines are created showing 'TOTAL EQUIPMENT', 'TOTAL RELEASE', 'TOTAL HAULAGE', 'TOTAL HELD CCRA', 'TOTAL PROCEED', 'TOTAL HELD DOCS', and 'TOTAL DOCS N/R' with their respective counts
Context: A trip sheet report is being generated for an ADD operation and equipment summary lines exist
GIVEN
A trip sheet report is being generated for an ADD operation and equipment summary lines exist
Applied to: Add Totals to Trip Sheet
WHEN
The system adds totals to the trip sheet
THEN
Equipment summary lines are appended to the trip sheet report with proper formatting and line spacing
Context: A status report is being generated for a VERIFY operation and equipment summary lines exist
GIVEN
A status report is being generated for a VERIFY operation and equipment summary lines exist
Applied to: Add Totals to Status Report
WHEN
The system adds totals to the status report
THEN
Equipment summary lines are appended to the status report with proper formatting and line spacing
Context: All equipment totals have been calculated
GIVEN
All equipment totals have been calculated
Applied to: Validate Total Calculations
WHEN
The system validates the total calculations
THEN
The sum of all category totals (RELEASE + HAULAGE + HELD-CCRA + PROCEED + HELD-DOCS + DOCS-NR) equals or is less than TOTAL-EQUIP
Context: Total calculations have been validated and found to be inconsistent
GIVEN
Total calculations have been validated and found to be inconsistent
Applied to: Report Total Calculation Error
WHEN
The validation fails
THEN
An error message is generated indicating total calculation inconsistency and the summary generation continues with available totals
R-GCX146-cbl-01293 (+8) File: GCX146.cbl Return CCN Number Construction Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Return CCN Number Construction':
  • Context - a return cargo ccn needs to be created for canadian customs:
    For Set CCN Prefix to '6105E':
    When the system constructs the ccn number, then the ccn must start with the prefix '6105e' followed by the equipment identifier.
  • Context - a current equipment record is being processed for return ccn creation:
    For Extract Equipment ID from Current Record:
    When the system needs to build the ccn identifier, then the equipment id must be extracted from the current record and used in ccn construction.
  • Context - a waybill record exists for the equipment being processed:
    For Extract Waybill Date from Waybill Record:
    When the system constructs a return ccn, then the waybill date must be extracted from the waybill record and appended to the ccn identifier.
  • Context - a ccn has been constructed with prefix, equipment id, and waybill date:
    For Validate CCN Format:
    When the system validates the ccn format, then the ccn format must be valid according to customs requirements or the construction process must be rejected.
  • Context - a valid ccn has been constructed for return cargo:
    For Set CCN Status to 'RETURN':
    When the system sets the ccn processing status, then the ccn status must be set to 'return' to indicate return cargo processing.
  • Context - a ccn is being created for return cargo processing:
    For Set Transit Status to 'R':
    When the system assigns transit status, then the transit status must be set to 'r' to indicate return movement.
  • Context - a waybill record contains shipper information for the equipment:
    For Populate Shipper Data from Waybill:
    When the system creates a return ccn record, then all relevant shipper data must be extracted from the waybill and populated into the ccn record.
  • Context - a waybill record contains consignee information for the equipment:
    For Populate Consignee Data from Waybill:
    When the system creates a return ccn record, then all relevant consignee data must be extracted from the waybill and populated into the ccn record.
  • Context - ccn identifier, status, transit status, shipper data, and consignee data have been populated:
    For Complete Return CCN Record:
    When the system finalizes the return ccn record, then the ccn record must be marked as complete with all required fields populated for customs processing.
👨‍💻 Technical ACs (Gherkin)
Context: A return cargo CCN needs to be created for Canadian customs
GIVEN
A return cargo CCN needs to be created for Canadian customs
Applied to: Set CCN Prefix to '6105E'
WHEN
The system constructs the CCN number
THEN
The CCN must start with the prefix '6105E' followed by the equipment identifier
Context: A current equipment record is being processed for return CCN creation
GIVEN
A current equipment record is being processed for return CCN creation
Applied to: Extract Equipment ID from Current Record
WHEN
The system needs to build the CCN identifier
THEN
The equipment ID must be extracted from the current record and used in CCN construction
Context: A waybill record exists for the equipment being processed
GIVEN
A waybill record exists for the equipment being processed
Applied to: Extract Waybill Date from Waybill Record
WHEN
The system constructs a return CCN
THEN
The waybill date must be extracted from the waybill record and appended to the CCN identifier
Context: A CCN has been constructed with prefix, equipment ID, and waybill date
GIVEN
A CCN has been constructed with prefix, equipment ID, and waybill date
Applied to: Validate CCN Format
WHEN
The system validates the CCN format
THEN
The CCN format must be valid according to customs requirements or the construction process must be rejected
Context: A valid CCN has been constructed for return cargo
GIVEN
A valid CCN has been constructed for return cargo
Applied to: Set CCN Status to 'RETURN'
WHEN
The system sets the CCN processing status
THEN
The CCN status must be set to 'RETURN' to indicate return cargo processing
Context: A CCN is being created for return cargo processing
GIVEN
A CCN is being created for return cargo processing
Applied to: Set Transit Status to 'R'
WHEN
The system assigns transit status
THEN
The transit status must be set to 'R' to indicate return movement
Context: A waybill record contains shipper information for the equipment
GIVEN
A waybill record contains shipper information for the equipment
Applied to: Populate Shipper Data from Waybill
WHEN
The system creates a return CCN record
THEN
All relevant shipper data must be extracted from the waybill and populated into the CCN record
Context: A waybill record contains consignee information for the equipment
GIVEN
A waybill record contains consignee information for the equipment
Applied to: Populate Consignee Data from Waybill
WHEN
The system creates a return CCN record
THEN
All relevant consignee data must be extracted from the waybill and populated into the CCN record
Context: CCN identifier, status, transit status, shipper data, and consignee data have been populated
GIVEN
CCN identifier, status, transit status, shipper data, and consignee data have been populated
Applied to: Complete Return CCN Record
WHEN
The system finalizes the return CCN record
THEN
The CCN record must be marked as complete with all required fields populated for customs processing
R-GCX146-cbl-01302 (+9) File: GCX146.cbl Return CCN Data Population Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Return CCN Data Population':
  • Context - a return ccn requires data population from waybill records:
    For Waybill Data Available?:
    When the system accesses the waybill database for the specified equipment, then the system must verify waybill data exists before proceeding with shipper and consignee information extraction.
  • Context - valid waybill data exists for the equipment:
    For Extract Shipper Information:
    When the system processes shipper information from the waybill record, then the system must extract shipper name, address, and identification details from the waybill.
    For Extract Consignee Information:
    When the system processes consignee information from the waybill record, then the system must extract consignee name, address, and identification details from the waybill.
    For Extract Shipment Details:
    When the system processes shipment details from the waybill record, then the system must extract commodity information, weight, origin station, destination station, and other shipment-specific data.
  • Context - shipper information has been extracted from the waybill:
    For Populate CCN Shipper Fields:
    When the system updates the return ccn record with shipper data, then the ccn record must be populated with shipper name, address, and identification in the appropriate ccn shipper fields.
  • Context - consignee information has been extracted from the waybill:
    For Populate CCN Consignee Fields:
    When the system updates the return ccn record with consignee data, then the ccn record must be populated with consignee name, address, and identification in the appropriate ccn consignee fields.
  • Context - shipment details have been extracted from the waybill:
    For Populate Additional Shipment Data:
    When the system updates the return ccn record with shipment data, then the ccn record must be populated with commodity information, weight, origin/destination stations, and other relevant shipment data.
  • Context - ccn record has been populated with waybill data:
    For All Required Data Present?:
    When the system validates data completeness for the return ccn, then the system must verify that all required shipper, consignee, and shipment fields contain valid data before marking the population process as complete.
  • Context - all required data fields have been validated as complete in the return ccn:
    For Set Data Population Complete Flag:
    When the system completes the data population process, then the system must set the data population complete flag to indicate successful completion of the return ccn data population.
  • Context - waybill data is unavailable or required ccn data fields are incomplete:
    For Log Missing Data Warning:
    When the system encounters missing or incomplete data during population, then the system must log a warning message indicating which data elements are missing and continue processing.
👨‍💻 Technical ACs (Gherkin)
Context: A return CCN requires data population from waybill records
GIVEN
A return CCN requires data population from waybill records
Applied to: Waybill Data Available?
WHEN
The system accesses the waybill database for the specified equipment
THEN
The system must verify waybill data exists before proceeding with shipper and consignee information extraction
Context: Valid waybill data exists for the equipment
GIVEN
Valid waybill data exists for the equipment
Applied to: Extract Shipper Information
WHEN
The system processes shipper information from the waybill record
THEN
The system must extract shipper name, address, and identification details from the waybill
Applied to: Extract Consignee Information
WHEN
The system processes consignee information from the waybill record
THEN
The system must extract consignee name, address, and identification details from the waybill
Applied to: Extract Shipment Details
WHEN
The system processes shipment details from the waybill record
THEN
The system must extract commodity information, weight, origin station, destination station, and other shipment-specific data
Context: Shipper information has been extracted from the waybill
GIVEN
Shipper information has been extracted from the waybill
Applied to: Populate CCN Shipper Fields
WHEN
The system updates the return CCN record with shipper data
THEN
The CCN record must be populated with shipper name, address, and identification in the appropriate CCN shipper fields
Context: Consignee information has been extracted from the waybill
GIVEN
Consignee information has been extracted from the waybill
Applied to: Populate CCN Consignee Fields
WHEN
The system updates the return CCN record with consignee data
THEN
The CCN record must be populated with consignee name, address, and identification in the appropriate CCN consignee fields
Context: Shipment details have been extracted from the waybill
GIVEN
Shipment details have been extracted from the waybill
Applied to: Populate Additional Shipment Data
WHEN
The system updates the return CCN record with shipment data
THEN
The CCN record must be populated with commodity information, weight, origin/destination stations, and other relevant shipment data
Context: CCN record has been populated with waybill data
GIVEN
CCN record has been populated with waybill data
Applied to: All Required Data Present?
WHEN
The system validates data completeness for the return CCN
THEN
The system must verify that all required shipper, consignee, and shipment fields contain valid data before marking the population process as complete
Context: All required data fields have been validated as complete in the return CCN
GIVEN
All required data fields have been validated as complete in the return CCN
Applied to: Set Data Population Complete Flag
WHEN
The system completes the data population process
THEN
The system must set the data population complete flag to indicate successful completion of the return CCN data population
Context: Waybill data is unavailable or required CCN data fields are incomplete
GIVEN
Waybill data is unavailable or required CCN data fields are incomplete
Applied to: Log Missing Data Warning
WHEN
The system encounters missing or incomplete data during population
THEN
The system must log a warning message indicating which data elements are missing and continue processing
R-GCX146-cbl-01312 (+9) File: GCX146.cbl Primary Broker Notification Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Primary Broker Notification':
  • Context - a ccn record requires broker notification:
    For Check Broker Configuration:
    When the system checks for primary broker configuration, then the system should verify if a primary broker exists and is configured for notifications.
    For Skip Notification:
    When no primary broker is configured in the system, then the system should skip the primary broker notification process and continue with other processing.
  • Context - a primary broker exists and is configured for notifications:
    For Determine Notification Channels:
    When the system evaluates available notification channels, then the system should identify all configured channels including x12 edi, merlin, internet, fax, and paper based on broker preferences.
  • Context - primary broker has x12 edi channel configured:
    For Call GCCS309C for X12:
    When the system processes x12 notifications, then the system should call gccs309c program to send x12 edi notifications to the primary broker.
  • Context - primary broker has merlin channel configured:
    For Call GCX019 for Merlin:
    When the system processes merlin notifications, then the system should call gcx019 program to send merlin notifications to the primary broker.
  • Context - primary broker has internet channel configured:
    For Call GCX019 for Internet:
    When the system processes internet notifications, then the system should call gcx019 program to send internet notifications to the primary broker.
  • Context - primary broker has fax channel configured:
    For Call GCX019 for FAX:
    When the system processes fax notifications, then the system should call gcx019 program to send fax notifications to the primary broker.
  • Context - primary broker has paper channel configured:
    For Generate Print Call Letters:
    When the system processes paper notifications, then the system should generate print call letters for physical delivery to the primary broker.
  • Context - multiple notification channels are configured for the primary broker:
    For All Channels Processed?:
    When the system processes each notification channel, then the system should verify that all configured channels have been processed before completing the notification workflow.
  • Context - all configured notification channels have been processed for the primary broker:
    For Log Notification Success:
    When the notification process completes successfully, then the system should log the successful completion of primary broker notifications for audit and tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN record requires broker notification
GIVEN
A CCN record requires broker notification
Applied to: Check Broker Configuration
WHEN
The system checks for primary broker configuration
THEN
The system should verify if a primary broker exists and is configured for notifications
Applied to: Skip Notification
WHEN
No primary broker is configured in the system
THEN
The system should skip the primary broker notification process and continue with other processing
Context: A primary broker exists and is configured for notifications
GIVEN
A primary broker exists and is configured for notifications
Applied to: Determine Notification Channels
WHEN
The system evaluates available notification channels
THEN
The system should identify all configured channels including X12 EDI, Merlin, Internet, FAX, and Paper based on broker preferences
Context: Primary broker has X12 EDI channel configured
GIVEN
Primary broker has X12 EDI channel configured
Applied to: Call GCCS309C for X12
WHEN
The system processes X12 notifications
THEN
The system should call GCCS309C program to send X12 EDI notifications to the primary broker
Context: Primary broker has Merlin channel configured
GIVEN
Primary broker has Merlin channel configured
Applied to: Call GCX019 for Merlin
WHEN
The system processes Merlin notifications
THEN
The system should call GCX019 program to send Merlin notifications to the primary broker
Context: Primary broker has Internet channel configured
GIVEN
Primary broker has Internet channel configured
Applied to: Call GCX019 for Internet
WHEN
The system processes Internet notifications
THEN
The system should call GCX019 program to send Internet notifications to the primary broker
Context: Primary broker has FAX channel configured
GIVEN
Primary broker has FAX channel configured
Applied to: Call GCX019 for FAX
WHEN
The system processes FAX notifications
THEN
The system should call GCX019 program to send FAX notifications to the primary broker
Context: Primary broker has paper channel configured
GIVEN
Primary broker has paper channel configured
Applied to: Generate Print Call Letters
WHEN
The system processes paper notifications
THEN
The system should generate print call letters for physical delivery to the primary broker
Context: Multiple notification channels are configured for the primary broker
GIVEN
Multiple notification channels are configured for the primary broker
Applied to: All Channels Processed?
WHEN
The system processes each notification channel
THEN
The system should verify that all configured channels have been processed before completing the notification workflow
Context: All configured notification channels have been processed for the primary broker
GIVEN
All configured notification channels have been processed for the primary broker
Applied to: Log Notification Success
WHEN
The notification process completes successfully
THEN
The system should log the successful completion of primary broker notifications for audit and tracking purposes
R-GCX146-cbl-01322 (+12) File: GCX146.cbl Secondary Broker Notification Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Secondary Broker Notification':
  • Context - a cargo notification process is initiated:
    For Secondary Broker ID Available?:
    When the system checks for secondary broker configuration, then the process continues to notification channel determination if secondary broker id exists, otherwise completes without secondary broker notification.
  • Context - a secondary broker notification is required:
    For X12 EDI Channel?:
    When the notification channel is evaluated, then x12 edi notification is sent via gccs309c if x12 edi channel is selected, otherwise check next available channel.
  • Context - x12 edi channel is selected for secondary broker notification:
    For Send X12 EDI Notification via GCCS309C:
    When the notification transmission is initiated, then the system invokes gccs309c program to send x12 edi notification and returns success or failure status.
  • Context - x12 edi channel is not selected for secondary broker notification:
    For Merlin Channel?:
    When the notification channel is evaluated for merlin, then merlin notification is sent via gcx019 if merlin channel is selected, otherwise check next available channel.
  • Context - merlin channel is selected for secondary broker notification:
    For Send Merlin Notification via GCX019:
    When the notification transmission is initiated, then the system invokes gcx019 program to send merlin notification and returns success or failure status.
  • Context - neither x12 edi nor merlin channels are selected for secondary broker notification:
    For Internet Channel?:
    When the notification channel is evaluated for internet, then internet notification is sent via gcx019 if internet channel is selected, otherwise check next available channel.
  • Context - internet channel is selected for secondary broker notification:
    For Send Internet Notification via GCX019:
    When the notification transmission is initiated, then the system invokes gcx019 program to send internet notification and returns success or failure status.
  • Context - x12 edi, merlin, and internet channels are not selected for secondary broker notification:
    For FAX Channel?:
    When the notification channel is evaluated for fax, then fax notification is sent via gcx019 if fax channel is selected, otherwise check next available channel.
  • Context - fax channel is selected for secondary broker notification:
    For Send FAX Notification via GCX019:
    When the notification transmission is initiated, then the system invokes gcx019 program to send fax notification and returns success or failure status.
  • Context - electronic notification channels (x12 edi, merlin, internet, fax) are not selected for secondary broker notification:
    For Paper Channel?:
    When the notification channel is evaluated for paper, then paper notification is generated via batch print if paper channel is selected, otherwise complete notification process.
  • Context - paper channel is selected for secondary broker notification:
    For Generate Paper Notification via Batch Print:
    When the notification generation is initiated, then the system generates paper notification via batch print process and returns success or failure status.
  • Context - a secondary broker notification transmission is completed successfully:
    For Log Notification Success:
    When the notification result is processed, then the system logs the successful notification transmission for audit and tracking purposes.
  • Context - a secondary broker notification transmission fails:
    For Log Notification Failure:
    When the notification result is processed, then the system logs the failed notification transmission for audit and error tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo notification process is initiated
GIVEN
A cargo notification process is initiated
Applied to: Secondary Broker ID Available?
WHEN
The system checks for secondary broker configuration
THEN
The process continues to notification channel determination if secondary broker ID exists, otherwise completes without secondary broker notification
Context: A secondary broker notification is required
GIVEN
A secondary broker notification is required
Applied to: X12 EDI Channel?
WHEN
The notification channel is evaluated
THEN
X12 EDI notification is sent via GCCS309C if X12 EDI channel is selected, otherwise check next available channel
Context: X12 EDI channel is selected for secondary broker notification
GIVEN
X12 EDI channel is selected for secondary broker notification
Applied to: Send X12 EDI Notification via GCCS309C
WHEN
The notification transmission is initiated
THEN
The system invokes GCCS309C program to send X12 EDI notification and returns success or failure status
Context: X12 EDI channel is not selected for secondary broker notification
GIVEN
X12 EDI channel is not selected for secondary broker notification
Applied to: Merlin Channel?
WHEN
The notification channel is evaluated for Merlin
THEN
Merlin notification is sent via GCX019 if Merlin channel is selected, otherwise check next available channel
Context: Merlin channel is selected for secondary broker notification
GIVEN
Merlin channel is selected for secondary broker notification
Applied to: Send Merlin Notification via GCX019
WHEN
The notification transmission is initiated
THEN
The system invokes GCX019 program to send Merlin notification and returns success or failure status
Context: Neither X12 EDI nor Merlin channels are selected for secondary broker notification
GIVEN
Neither X12 EDI nor Merlin channels are selected for secondary broker notification
Applied to: Internet Channel?
WHEN
The notification channel is evaluated for Internet
THEN
Internet notification is sent via GCX019 if Internet channel is selected, otherwise check next available channel
Context: Internet channel is selected for secondary broker notification
GIVEN
Internet channel is selected for secondary broker notification
Applied to: Send Internet Notification via GCX019
WHEN
The notification transmission is initiated
THEN
The system invokes GCX019 program to send Internet notification and returns success or failure status
Context: X12 EDI, Merlin, and Internet channels are not selected for secondary broker notification
GIVEN
X12 EDI, Merlin, and Internet channels are not selected for secondary broker notification
Applied to: FAX Channel?
WHEN
The notification channel is evaluated for FAX
THEN
FAX notification is sent via GCX019 if FAX channel is selected, otherwise check next available channel
Context: FAX channel is selected for secondary broker notification
GIVEN
FAX channel is selected for secondary broker notification
Applied to: Send FAX Notification via GCX019
WHEN
The notification transmission is initiated
THEN
The system invokes GCX019 program to send FAX notification and returns success or failure status
Context: Electronic notification channels (X12 EDI, Merlin, Internet, FAX) are not selected for secondary broker notification
GIVEN
Electronic notification channels (X12 EDI, Merlin, Internet, FAX) are not selected for secondary broker notification
Applied to: Paper Channel?
WHEN
The notification channel is evaluated for Paper
THEN
Paper notification is generated via batch print if Paper channel is selected, otherwise complete notification process
Context: Paper channel is selected for secondary broker notification
GIVEN
Paper channel is selected for secondary broker notification
Applied to: Generate Paper Notification via Batch Print
WHEN
The notification generation is initiated
THEN
The system generates paper notification via batch print process and returns success or failure status
Context: A secondary broker notification transmission is completed successfully
GIVEN
A secondary broker notification transmission is completed successfully
Applied to: Log Notification Success
WHEN
The notification result is processed
THEN
The system logs the successful notification transmission for audit and tracking purposes
Context: A secondary broker notification transmission fails
GIVEN
A secondary broker notification transmission fails
Applied to: Log Notification Failure
WHEN
The notification result is processed
THEN
The system logs the failed notification transmission for audit and error tracking purposes
R-GCX146-cbl-01335 (+15) File: GCX146.cbl Email Report Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email Report Processing':
  • Context - a station code is provided for email report processing:
    For Get Email User List from Station Configuration:
    When the system looks up email configuration for the station, then the system retrieves the list of email users configured for that station from the station configuration table.
  • Context - email user lookup has been performed for a station:
    For Email Users Found?:
    When the system checks if any email users were found in the configuration, then if email users are found, proceed with email processing, otherwise skip email processing and mark as no users configured.
  • Context - email users are configured for the station:
    For Initialize Email Message Buffer:
    When the system begins email report processing, then initialize email message buffer, clear previous content, and prepare for new report data.
  • Context - email message buffer is initialized:
    For Add Report Header Lines:
    When the system begins building the email report content, then add report header lines including report identification, date, time, and relevant train or processing information.
  • Context - report header has been added to email message:
    For Process Equipment Report Lines:
    When the system processes equipment data for the report, then generate detailed report lines for each equipment item including status, location, and relevant business information.
  • Context - equipment report lines are being processed for email:
    For Within Line Limit ≤ 699 lines?:
    When the system checks the current line count in the email message, then if line count is 699 or less, continue adding equipment details, otherwise finalize current message and prepare for continuation.
  • Context - email message is within the 699 line limit:
    For Add Equipment Details to Email:
    When the system processes equipment details for inclusion, then add equipment details including car id, status, location, and other relevant business information to the email message.
  • Context - current equipment item has been processed:
    For More Equipment?:
    When the system checks for additional equipment in the report queue, then if more equipment exists, continue processing next item, otherwise proceed to finalize the email message.
  • Context - all equipment processing is complete or line limit reached:
    For Finalize Email Message:
    When the system finalizes the email message, then add any closing information, format the message properly, and prepare for email transmission.
  • Context - email message is finalized and ready for transmission:
    For Send Email via EMCSEND3:
    When the system calls emcsend3 to send the email, then attempt to transmit the email to configured recipients using the email service.
  • Context - email transmission attempt has been made via emcsend3:
    For Email Send Successful?:
    When the system checks the transmission result, then if email send was successful, log successful transmission, otherwise attempt fallback email delivery.
  • Context - email has been successfully transmitted:
    For Log Successful Email Transmission:
    When the system processes the successful transmission, then log the successful email transmission with timestamp, recipient information, and report details for audit trail.
  • Context - primary email transmission has failed:
    For Try Fallback Email Address OM01247/AEI9999:
    When the system attempts fallback email delivery, then send the email report to fallback support addresses om01247 and aei9999 to ensure report delivery.
  • Context - fallback email transmission attempt has been made:
    For Fallback Send Successful?:
    When the system checks the fallback transmission result, then if fallback send was successful, log successful transmission, otherwise log email failure.
  • Context - both primary and fallback email transmissions have failed:
    For Log Email Failure:
    When the system processes the failed transmission attempts, then log the email failure with error details, attempted recipients, and report information for troubleshooting.
  • Context - email user lookup found no configured users for the station:
    For No Email Users Configured:
    When the system processes the no-users scenario, then skip email processing, log that no email users are configured, and proceed to complete email processing.
👨‍💻 Technical ACs (Gherkin)
Context: A station code is provided for email report processing
GIVEN
A station code is provided for email report processing
Applied to: Get Email User List from Station Configuration
WHEN
The system looks up email configuration for the station
THEN
The system retrieves the list of email users configured for that station from the station configuration table
Context: Email user lookup has been performed for a station
GIVEN
Email user lookup has been performed for a station
Applied to: Email Users Found?
WHEN
The system checks if any email users were found in the configuration
THEN
If email users are found, proceed with email processing, otherwise skip email processing and mark as no users configured
Context: Email users are configured for the station
GIVEN
Email users are configured for the station
Applied to: Initialize Email Message Buffer
WHEN
The system begins email report processing
THEN
Initialize email message buffer, clear previous content, and prepare for new report data
Context: Email message buffer is initialized
GIVEN
Email message buffer is initialized
Applied to: Add Report Header Lines
WHEN
The system begins building the email report content
THEN
Add report header lines including report identification, date, time, and relevant train or processing information
Context: Report header has been added to email message
GIVEN
Report header has been added to email message
Applied to: Process Equipment Report Lines
WHEN
The system processes equipment data for the report
THEN
Generate detailed report lines for each equipment item including status, location, and relevant business information
Context: Equipment report lines are being processed for email
GIVEN
Equipment report lines are being processed for email
Applied to: Within Line Limit ≤ 699 lines?
WHEN
The system checks the current line count in the email message
THEN
If line count is 699 or less, continue adding equipment details, otherwise finalize current message and prepare for continuation
Context: Email message is within the 699 line limit
GIVEN
Email message is within the 699 line limit
Applied to: Add Equipment Details to Email
WHEN
The system processes equipment details for inclusion
THEN
Add equipment details including car ID, status, location, and other relevant business information to the email message
Context: Current equipment item has been processed
GIVEN
Current equipment item has been processed
Applied to: More Equipment?
WHEN
The system checks for additional equipment in the report queue
THEN
If more equipment exists, continue processing next item, otherwise proceed to finalize the email message
Context: All equipment processing is complete or line limit reached
GIVEN
All equipment processing is complete or line limit reached
Applied to: Finalize Email Message
WHEN
The system finalizes the email message
THEN
Add any closing information, format the message properly, and prepare for email transmission
Context: Email message is finalized and ready for transmission
GIVEN
Email message is finalized and ready for transmission
Applied to: Send Email via EMCSEND3
WHEN
The system calls EMCSEND3 to send the email
THEN
Attempt to transmit the email to configured recipients using the email service
Context: Email transmission attempt has been made via EMCSEND3
GIVEN
Email transmission attempt has been made via EMCSEND3
Applied to: Email Send Successful?
WHEN
The system checks the transmission result
THEN
If email send was successful, log successful transmission, otherwise attempt fallback email delivery
Context: Email has been successfully transmitted
GIVEN
Email has been successfully transmitted
Applied to: Log Successful Email Transmission
WHEN
The system processes the successful transmission
THEN
Log the successful email transmission with timestamp, recipient information, and report details for audit trail
Context: Primary email transmission has failed
GIVEN
Primary email transmission has failed
Applied to: Try Fallback Email Address OM01247/AEI9999
WHEN
The system attempts fallback email delivery
THEN
Send the email report to fallback support addresses OM01247 and AEI9999 to ensure report delivery
Context: Fallback email transmission attempt has been made
GIVEN
Fallback email transmission attempt has been made
Applied to: Fallback Send Successful?
WHEN
The system checks the fallback transmission result
THEN
If fallback send was successful, log successful transmission, otherwise log email failure
Context: Both primary and fallback email transmissions have failed
GIVEN
Both primary and fallback email transmissions have failed
Applied to: Log Email Failure
WHEN
The system processes the failed transmission attempts
THEN
Log the email failure with error details, attempted recipients, and report information for troubleshooting
Context: Email user lookup found no configured users for the station
GIVEN
Email user lookup found no configured users for the station
Applied to: No Email Users Configured
WHEN
The system processes the no-users scenario
THEN
Skip email processing, log that no email users are configured, and proceed to complete email processing
R-GCX146-cbl-01351 (+9) File: GCX146.cbl Continuation Report Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Continuation Report Processing':
  • Context - an email report is being generated with multiple lines of content:
    For Line Counter > 699?:
    When the line counter exceeds 699 lines in the current email message, then the system should trigger continuation processing to send the current batch and prepare for the next message segment.
  • Context - an email message has reached its maximum line capacity of 699 lines:
    For Send Current Email Batch:
    When the continuation processing is triggered, then the system should send the current email batch using the email delivery service.
  • Context - an email batch has been successfully sent:
    For Reset Message Buffer:
    When preparing for continuation message processing, then the system should reset the message buffer to empty state.
  • Context - a new continuation email message is being prepared:
    For Add Continuation Header Message:
    When the message buffer has been reset for continuation processing, then the system should add the header message 'continuation of report ....' to identify this as a continuation message.
  • Context - a continuation message is being prepared with header added:
    For Reset Line Counter:
    When starting to process remaining report lines for the new message, then the system should reset the line counter to zero to begin counting lines for the new message segment.
  • Context - continuation processing has been completed with buffer reset and counter reset:
    For Continue Processing Remaining Lines:
    When there are remaining report lines to be processed, then the system should continue processing the remaining lines in the new message segment.
  • Context - a report line is being processed for email transmission:
    For Add Line to Email Buffer:
    When the line is ready to be included in the email message, then the system should add the line to the current email message buffer.
  • Context - a line has been successfully added to the email message buffer:
    For Increment Line Counter:
    When the line addition is complete, then the system should increment the line counter by one to maintain accurate count of lines in current message.
  • Context - a report line has been processed and added to the email buffer:
    For More Lines to Process?:
    When checking for continuation of report processing, then the system should evaluate whether there are more lines remaining in the report to be processed.
  • Context - all report lines have been processed and no more lines remain:
    For Send Final Email Batch:
    When the final email message batch is ready for transmission, then the system should send the final email batch containing the remaining report content.
👨‍💻 Technical ACs (Gherkin)
Context: An email report is being generated with multiple lines of content
GIVEN
An email report is being generated with multiple lines of content
Applied to: Line Counter > 699?
WHEN
The line counter exceeds 699 lines in the current email message
THEN
The system should trigger continuation processing to send the current batch and prepare for the next message segment
Context: An email message has reached its maximum line capacity of 699 lines
GIVEN
An email message has reached its maximum line capacity of 699 lines
Applied to: Send Current Email Batch
WHEN
The continuation processing is triggered
THEN
The system should send the current email batch using the email delivery service
Context: An email batch has been successfully sent
GIVEN
An email batch has been successfully sent
Applied to: Reset Message Buffer
WHEN
Preparing for continuation message processing
THEN
The system should reset the message buffer to empty state
Context: A new continuation email message is being prepared
GIVEN
A new continuation email message is being prepared
Applied to: Add Continuation Header Message
WHEN
The message buffer has been reset for continuation processing
THEN
The system should add the header message 'CONTINUATION OF REPORT ....' to identify this as a continuation message
Context: A continuation message is being prepared with header added
GIVEN
A continuation message is being prepared with header added
Applied to: Reset Line Counter
WHEN
Starting to process remaining report lines for the new message
THEN
The system should reset the line counter to zero to begin counting lines for the new message segment
Context: Continuation processing has been completed with buffer reset and counter reset
GIVEN
Continuation processing has been completed with buffer reset and counter reset
Applied to: Continue Processing Remaining Lines
WHEN
There are remaining report lines to be processed
THEN
The system should continue processing the remaining lines in the new message segment
Context: A report line is being processed for email transmission
GIVEN
A report line is being processed for email transmission
Applied to: Add Line to Email Buffer
WHEN
The line is ready to be included in the email message
THEN
The system should add the line to the current email message buffer
Context: A line has been successfully added to the email message buffer
GIVEN
A line has been successfully added to the email message buffer
Applied to: Increment Line Counter
WHEN
The line addition is complete
THEN
The system should increment the line counter by one to maintain accurate count of lines in current message
Context: A report line has been processed and added to the email buffer
GIVEN
A report line has been processed and added to the email buffer
Applied to: More Lines to Process?
WHEN
Checking for continuation of report processing
THEN
The system should evaluate whether there are more lines remaining in the report to be processed
Context: All report lines have been processed and no more lines remain
GIVEN
All report lines have been processed and no more lines remain
Applied to: Send Final Email Batch
WHEN
The final email message batch is ready for transmission
THEN
The system should send the final email batch containing the remaining report content
R-GCX146-cbl-01361 (+3) File: GCX146.cbl FAX Configuration Setup Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FAX Configuration Setup':
  • Context - a station configuration record exists with auto-fax settings:
    For Check Auto-FAX Configuration Flag:
    When the system checks the auto-fax configuration flag in the station record, then the system should proceed to station fax flag validation if auto-fax is enabled, otherwise skip fax configuration entirely.
  • Context - auto-fax configuration is enabled and a station configuration record exists:
    For Check Station FAX Flag:
    When the system checks the station fax flag in the station configuration record, then the system should proceed with fax routing setup if the station fax flag is active, otherwise skip fax configuration.
  • Context - both auto-fax configuration flag and station fax flag are enabled:
    For Set Up FAX Routing Parameters:
    When the system sets up fax routing parameters, then the system should configure copy ids for distribution, set external fax addressing, prepare merlin transmission parameters, and call emcsend for fax routing.
  • Context - fax routing parameters are properly configured with copy ids and external addressing:
    For Call EMCSEND for FAX Routing:
    When the system calls the emcsend service for fax routing, then the external fax routing service should be invoked to handle the transmission.
👨‍💻 Technical ACs (Gherkin)
Context: A station configuration record exists with auto-FAX settings
GIVEN
A station configuration record exists with auto-FAX settings
Applied to: Check Auto-FAX Configuration Flag
WHEN
The system checks the auto-FAX configuration flag in the station record
THEN
The system should proceed to station FAX flag validation if auto-FAX is enabled, otherwise skip FAX configuration entirely
Context: Auto-FAX configuration is enabled and a station configuration record exists
GIVEN
Auto-FAX configuration is enabled and a station configuration record exists
Applied to: Check Station FAX Flag
WHEN
The system checks the station FAX flag in the station configuration record
THEN
The system should proceed with FAX routing setup if the station FAX flag is active, otherwise skip FAX configuration
Context: Both auto-FAX configuration flag and station FAX flag are enabled
GIVEN
Both auto-FAX configuration flag and station FAX flag are enabled
Applied to: Set Up FAX Routing Parameters
WHEN
The system sets up FAX routing parameters
THEN
The system should configure copy IDs for distribution, set external FAX addressing, prepare Merlin transmission parameters, and call EMCSEND for FAX routing
Context: FAX routing parameters are properly configured with copy IDs and external addressing
GIVEN
FAX routing parameters are properly configured with copy IDs and external addressing
Applied to: Call EMCSEND for FAX Routing
WHEN
The system calls the EMCSEND service for FAX routing
THEN
The external FAX routing service should be invoked to handle the transmission
R-GCX146-cbl-01365 (+20) File: GCX146.cbl Merlin Message Preparation Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Merlin Message Preparation':
  • Context - a merlin message needs to be prepared for transmission:
    For Initialize Message Buffer:
    When the message preparation process begins, then the message buffer is cleared and initialized with default values.
  • Context - a message buffer has been initialized for merlin transmission:
    For Set Message Type and Headers:
    When the system determines the message type and required headers, then the appropriate message type identifier and standard headers are set in the message buffer.
  • Context - message headers have been established:
    For Format Train Information:
    When train information needs to be formatted for the message, then train id, date/time, and operational details are formatted and added to the message content.
  • Context - train information has been formatted in the message:
    For Add Station Names to Message:
    When station information needs to be included, then from and to station codes and names are added to the message content.
  • Context - station information has been added to the message:
    For Format Equipment Details:
    When equipment details need to be formatted, then equipment ids, car types, and related information are formatted for inclusion in the message.
  • Context - equipment details are being formatted:
    For Container Equipment?:
    When the system evaluates the equipment type, then if the equipment is container equipment, container-specific formatting is applied, otherwise standard equipment formatting is used.
  • Context - equipment has been identified as container equipment:
    For Format Container Information:
    When container information needs to be formatted, then container-specific details including container ids and attributes are formatted for the message.
  • Context - equipment has been identified as standard (non-container) equipment:
    For Format Standard Equipment:
    When standard equipment information needs to be formatted, then standard equipment details are formatted using regular equipment formatting rules.
  • Context - equipment information has been formatted (either container or standard):
    For Add Load/Empty Status:
    When load status needs to be added to equipment details, then the appropriate load/empty indicator is added to each equipment entry.
  • Context - load/empty status has been added to equipment:
    For Add CCN Information:
    When ccn information exists for the equipment, then ccn numbers and associated customs status information are added to the equipment details.
  • Context - ccn information has been processed for equipment:
    For Format Equipment Type Messages:
    When equipment type messages need to be formatted, then car type descriptions and related equipment type messages are formatted and added to the message.
  • Context - equipment type messages have been formatted:
    For Message Line Limit Reached?:
    When the system checks the current message line count, then if the line limit has been reached, the message is prepared for segmentation, otherwise formatting continues.
  • Context - the message line limit has been reached:
    For Segment Message for Transmission:
    When message segmentation is required, then the message is divided into appropriate segments for separate transmission.
  • Context - a message has been segmented for transmission:
    For Add Continuation Headers:
    When continuation headers need to be added, then appropriate continuation headers are added to indicate the message sequence and relationship.
  • Context - message content has been prepared (with continuation headers if segmented):
    For Format Message Lines for Merlin:
    When final message line formatting is applied, then message lines are formatted according to merlin system specifications.
  • Context - message lines have been formatted for merlin:
    For Set FAX Routing Information:
    When fax routing information needs to be configured, then station-specific fax routing parameters are set based on system configuration.
  • Context - fax routing information has been configured:
    For Auto-FAX Enabled?:
    When the system evaluates auto-fax settings, then if auto-fax is enabled, fax copy ids are added, otherwise external fax addressing is configured.
  • Context - auto-fax has been determined to be enabled:
    For Add FAX Copy IDs:
    When fax copy ids need to be added, then appropriate fax copy identifiers are added to enable automatic fax distribution.
  • Context - fax configuration is being finalized (either after adding copy ids or when auto-fax is disabled):
    For Set External FAX Addressing:
    When external fax addressing needs to be configured, then external fax numbers and addressing parameters are set based on station configuration.
  • Context - external fax addressing has been configured:
    For Prepare Final Message Buffer:
    When the final message buffer needs to be prepared, then all message components are assembled into the final transmission-ready buffer.
  • Context - the final message buffer has been prepared:
    For Message Ready for Transmission:
    When message preparation is complete, then the message is marked as ready for transmission with all required components properly formatted.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin message needs to be prepared for transmission
GIVEN
A Merlin message needs to be prepared for transmission
Applied to: Initialize Message Buffer
WHEN
The message preparation process begins
THEN
The message buffer is cleared and initialized with default values
Context: A message buffer has been initialized for Merlin transmission
GIVEN
A message buffer has been initialized for Merlin transmission
Applied to: Set Message Type and Headers
WHEN
The system determines the message type and required headers
THEN
The appropriate message type identifier and standard headers are set in the message buffer
Context: Message headers have been established
GIVEN
Message headers have been established
Applied to: Format Train Information
WHEN
Train information needs to be formatted for the message
THEN
Train ID, date/time, and operational details are formatted and added to the message content
Context: Train information has been formatted in the message
GIVEN
Train information has been formatted in the message
Applied to: Add Station Names to Message
WHEN
Station information needs to be included
THEN
From and to station codes and names are added to the message content
Context: Station information has been added to the message
GIVEN
Station information has been added to the message
Applied to: Format Equipment Details
WHEN
Equipment details need to be formatted
THEN
Equipment IDs, car types, and related information are formatted for inclusion in the message
Context: Equipment details are being formatted
GIVEN
Equipment details are being formatted
Applied to: Container Equipment?
WHEN
The system evaluates the equipment type
THEN
If the equipment is container equipment, container-specific formatting is applied, otherwise standard equipment formatting is used
Context: Equipment has been identified as container equipment
GIVEN
Equipment has been identified as container equipment
Applied to: Format Container Information
WHEN
Container information needs to be formatted
THEN
Container-specific details including container IDs and attributes are formatted for the message
Context: Equipment has been identified as standard (non-container) equipment
GIVEN
Equipment has been identified as standard (non-container) equipment
Applied to: Format Standard Equipment
WHEN
Standard equipment information needs to be formatted
THEN
Standard equipment details are formatted using regular equipment formatting rules
Context: Equipment information has been formatted (either container or standard)
GIVEN
Equipment information has been formatted (either container or standard)
Applied to: Add Load/Empty Status
WHEN
Load status needs to be added to equipment details
THEN
The appropriate load/empty indicator is added to each equipment entry
Context: Load/empty status has been added to equipment
GIVEN
Load/empty status has been added to equipment
Applied to: Add CCN Information
WHEN
CCN information exists for the equipment
THEN
CCN numbers and associated customs status information are added to the equipment details
Context: CCN information has been processed for equipment
GIVEN
CCN information has been processed for equipment
Applied to: Format Equipment Type Messages
WHEN
Equipment type messages need to be formatted
THEN
Car type descriptions and related equipment type messages are formatted and added to the message
Context: Equipment type messages have been formatted
GIVEN
Equipment type messages have been formatted
Applied to: Message Line Limit Reached?
WHEN
The system checks the current message line count
THEN
If the line limit has been reached, the message is prepared for segmentation, otherwise formatting continues
Context: The message line limit has been reached
GIVEN
The message line limit has been reached
Applied to: Segment Message for Transmission
WHEN
Message segmentation is required
THEN
The message is divided into appropriate segments for separate transmission
Context: A message has been segmented for transmission
GIVEN
A message has been segmented for transmission
Applied to: Add Continuation Headers
WHEN
Continuation headers need to be added
THEN
Appropriate continuation headers are added to indicate the message sequence and relationship
Context: Message content has been prepared (with continuation headers if segmented)
GIVEN
Message content has been prepared (with continuation headers if segmented)
Applied to: Format Message Lines for Merlin
WHEN
Final message line formatting is applied
THEN
Message lines are formatted according to Merlin system specifications
Context: Message lines have been formatted for Merlin
GIVEN
Message lines have been formatted for Merlin
Applied to: Set FAX Routing Information
WHEN
FAX routing information needs to be configured
THEN
Station-specific FAX routing parameters are set based on system configuration
Context: FAX routing information has been configured
GIVEN
FAX routing information has been configured
Applied to: Auto-FAX Enabled?
WHEN
The system evaluates auto-FAX settings
THEN
If auto-FAX is enabled, FAX copy IDs are added, otherwise external FAX addressing is configured
Context: Auto-FAX has been determined to be enabled
GIVEN
Auto-FAX has been determined to be enabled
Applied to: Add FAX Copy IDs
WHEN
FAX copy IDs need to be added
THEN
Appropriate FAX copy identifiers are added to enable automatic FAX distribution
Context: FAX configuration is being finalized (either after adding copy IDs or when auto-FAX is disabled)
GIVEN
FAX configuration is being finalized (either after adding copy IDs or when auto-FAX is disabled)
Applied to: Set External FAX Addressing
WHEN
External FAX addressing needs to be configured
THEN
External FAX numbers and addressing parameters are set based on station configuration
Context: External FAX addressing has been configured
GIVEN
External FAX addressing has been configured
Applied to: Prepare Final Message Buffer
WHEN
The final message buffer needs to be prepared
THEN
All message components are assembled into the final transmission-ready buffer
Context: The final message buffer has been prepared
GIVEN
The final message buffer has been prepared
Applied to: Message Ready for Transmission
WHEN
Message preparation is complete
THEN
The message is marked as ready for transmission with all required components properly formatted
R-GCX146-cbl-01386 (+7) File: GCX146.cbl Return CCN Identification Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Return CCN Identification':
  • Context - a cargo shipment with origin province/state information:
    For Is Cargo Canadian Origin?:
    When the system evaluates the origin location, then the cargo is classified as canadian origin if the origin province code matches any canadian province (nf, pe, ns, nb, pq, on, mb, sk, ab, bc, yt, nt), otherwise it is classified as non-canadian origin.
  • Context - a canadian origin cargo shipment with destination information:
    For Has US Destination History?:
    When the system checks the destination province/state codes, then the cargo is identified as having us destination history if the destination province/state code is not in the canadian province list (nf, pe, ns, nb, pq, on, mb, sk, ab, bc, yt, nt).
  • Context - a cargo shipment identified as canadian origin with us destination history:
    For Valid Return Pattern?:
    When the system validates the return movement pattern, then the movement is valid for return ccn creation if it represents canadian goods that went to us and are now returning to canada.
  • Context - valid return cargo with equipment id, waybill date, and carrier information:
    For Build Return CCN Format:
    When the system creates a return ccn record, then the ccn key is built using format: type '6' + carrier '105' + 'e' + equipment id + waybill date + sequence number.
  • Context - a return ccn record being created:
    For Set Return Status Indicators:
    When the system sets status indicators, then the ccn status is set to 'return' and application type is set to '33' for canadian customs processing.
  • Context - valid return cargo with complete shipment details including shipper, consignee, origin and destination station data:
    For Create Return CCN Record:
    When the system creates the return ccn record, then a new ccn record is inserted with status 'return', populated shipper/consignee information, origin/destination stations, and application type '33'.
  • Context - a return ccn record successfully created:
    For Update Transit Status to 'R':
    When the system updates transit status, then the equipment transit status is set to 'r' to indicate return movement.
    For Log Return CCN Creation:
    When the system logs the creation activity, then an audit trail entry is created by spawning gcx105 transaction with the return ccn details.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment with origin province/state information
GIVEN
A cargo shipment with origin province/state information
Applied to: Is Cargo Canadian Origin?
WHEN
The system evaluates the origin location
THEN
The cargo is classified as Canadian origin if the origin province code matches any Canadian province (NF, PE, NS, NB, PQ, ON, MB, SK, AB, BC, YT, NT), otherwise it is classified as non-Canadian origin
Context: A Canadian origin cargo shipment with destination information
GIVEN
A Canadian origin cargo shipment with destination information
Applied to: Has US Destination History?
WHEN
The system checks the destination province/state codes
THEN
The cargo is identified as having US destination history if the destination province/state code is not in the Canadian province list (NF, PE, NS, NB, PQ, ON, MB, SK, AB, BC, YT, NT)
Context: A cargo shipment identified as Canadian origin with US destination history
GIVEN
A cargo shipment identified as Canadian origin with US destination history
Applied to: Valid Return Pattern?
WHEN
The system validates the return movement pattern
THEN
The movement is valid for return CCN creation if it represents Canadian goods that went to US and are now returning to Canada
Context: Valid return cargo with equipment ID, waybill date, and carrier information
GIVEN
Valid return cargo with equipment ID, waybill date, and carrier information
Applied to: Build Return CCN Format
WHEN
The system creates a return CCN record
THEN
The CCN key is built using format: type '6' + carrier '105' + 'E' + equipment ID + waybill date + sequence number
Context: A return CCN record being created
GIVEN
A return CCN record being created
Applied to: Set Return Status Indicators
WHEN
The system sets status indicators
THEN
The CCN status is set to 'RETURN' and application type is set to '33' for Canadian customs processing
Context: Valid return cargo with complete shipment details including shipper, consignee, origin and destination station data
GIVEN
Valid return cargo with complete shipment details including shipper, consignee, origin and destination station data
Applied to: Create Return CCN Record
WHEN
The system creates the return CCN record
THEN
A new CCN record is inserted with status 'RETURN', populated shipper/consignee information, origin/destination stations, and application type '33'
Context: A return CCN record successfully created
GIVEN
A return CCN record successfully created
Applied to: Update Transit Status to 'R'
WHEN
The system updates transit status
THEN
The equipment transit status is set to 'R' to indicate return movement
Applied to: Log Return CCN Creation
WHEN
The system logs the creation activity
THEN
An audit trail entry is created by spawning GCX105 transaction with the return CCN details
R-GCX146-cbl-01394 (+13) File: GCX146.cbl Return CCN Construction Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Return CCN Construction':
  • Context - a return ccn needs to be created for cargo processing:
    For Build CCN Prefix '6105E':
    When the system builds the ccn identifier, then the ccn prefix must be set to '6105e' to identify it as return cargo.
  • Context - a waybill record exists with equipment information:
    For Extract Equipment ID from Waybill:
    When the system processes return ccn creation, then the equipment id must be extracted from the waybill record and used in ccn construction.
  • Context - a waybill record contains date information:
    For Extract Waybill Date:
    When the system creates a return ccn, then the waybill date must be extracted and included in the ccn identifier for uniqueness.
  • Context - ccn prefix '6105e', equipment id, and waybill date are available:
    For Concatenate: '6105E' + Equipment ID + Waybill Date:
    When the system constructs the return ccn, then the ccn must be formed by concatenating '6105e' + equipment id + waybill date in that exact sequence.
  • Context - a ccn string may contain spaces from concatenation:
    For Compress CCN - Remove Spaces:
    When the system finalizes the ccn format, then all spaces must be removed from the ccn string to create a continuous identifier.
  • Context - a ccn contains numeric sequences from equipment id and date:
    For Organize Numeric Sequences:
    When the system processes ccn formatting, then numeric sequences must be properly organized to maintain ccn integrity and uniqueness.
  • Context - a new ccn is being created for return cargo:
    For Set CCN Status to 'RETURN':
    When the system sets the ccn status, then the ccn status must be set to 'return' to indicate return cargo processing.
  • Context - a return ccn is being processed:
    For Set Transit Status to 'R':
    When the system sets transit status, then the transit status must be set to 'r' to indicate return movement status.
  • Context - a waybill contains shipper information:
    For Populate Shipper Data from Waybill:
    When the system creates a return ccn record, then shipper data must be extracted from the waybill and populated in the return ccn record.
  • Context - a waybill contains consignee information:
    For Populate Consignee Data from Waybill:
    When the system creates a return ccn record, then consignee data must be extracted from the waybill and populated in the return ccn record.
  • Context - a ccn has been constructed with all required components:
    For Validate CCN Format:
    When the system validates the ccn format, then the ccn must meet all format requirements including proper length, character composition, and structure.
  • Context - a ccn has undergone format validation:
    For CCN Format Valid?:
    When the system evaluates validation results, then if ccn format is valid, proceed to store the record; if invalid, handle format error.
  • Context - a return ccn has passed all format validations:
    For Store Return CCN Record:
    When the system processes the validated ccn, then the return ccn record must be stored in the database with all populated data.
  • Context - a ccn has failed format validation:
    For CCN Format Error:
    When the system processes the validation failure, then a format error must be generated and the ccn construction process must be terminated.
👨‍💻 Technical ACs (Gherkin)
Context: A return CCN needs to be created for cargo processing
GIVEN
A return CCN needs to be created for cargo processing
Applied to: Build CCN Prefix '6105E'
WHEN
The system builds the CCN identifier
THEN
The CCN prefix must be set to '6105E' to identify it as return cargo
Context: A waybill record exists with equipment information
GIVEN
A waybill record exists with equipment information
Applied to: Extract Equipment ID from Waybill
WHEN
The system processes return CCN creation
THEN
The equipment ID must be extracted from the waybill record and used in CCN construction
Context: A waybill record contains date information
GIVEN
A waybill record contains date information
Applied to: Extract Waybill Date
WHEN
The system creates a return CCN
THEN
The waybill date must be extracted and included in the CCN identifier for uniqueness
Context: CCN prefix '6105E', equipment ID, and waybill date are available
GIVEN
CCN prefix '6105E', equipment ID, and waybill date are available
Applied to: Concatenate: '6105E' + Equipment ID + Waybill Date
WHEN
The system constructs the return CCN
THEN
The CCN must be formed by concatenating '6105E' + equipment ID + waybill date in that exact sequence
Context: A CCN string may contain spaces from concatenation
GIVEN
A CCN string may contain spaces from concatenation
Applied to: Compress CCN - Remove Spaces
WHEN
The system finalizes the CCN format
THEN
All spaces must be removed from the CCN string to create a continuous identifier
Context: A CCN contains numeric sequences from equipment ID and date
GIVEN
A CCN contains numeric sequences from equipment ID and date
Applied to: Organize Numeric Sequences
WHEN
The system processes CCN formatting
THEN
Numeric sequences must be properly organized to maintain CCN integrity and uniqueness
Context: A new CCN is being created for return cargo
GIVEN
A new CCN is being created for return cargo
Applied to: Set CCN Status to 'RETURN'
WHEN
The system sets the CCN status
THEN
The CCN status must be set to 'RETURN' to indicate return cargo processing
Context: A return CCN is being processed
GIVEN
A return CCN is being processed
Applied to: Set Transit Status to 'R'
WHEN
The system sets transit status
THEN
The transit status must be set to 'R' to indicate return movement status
Context: A waybill contains shipper information
GIVEN
A waybill contains shipper information
Applied to: Populate Shipper Data from Waybill
WHEN
The system creates a return CCN record
THEN
Shipper data must be extracted from the waybill and populated in the return CCN record
Context: A waybill contains consignee information
GIVEN
A waybill contains consignee information
Applied to: Populate Consignee Data from Waybill
WHEN
The system creates a return CCN record
THEN
Consignee data must be extracted from the waybill and populated in the return CCN record
Context: A CCN has been constructed with all required components
GIVEN
A CCN has been constructed with all required components
Applied to: Validate CCN Format
WHEN
The system validates the CCN format
THEN
The CCN must meet all format requirements including proper length, character composition, and structure
Context: A CCN has undergone format validation
GIVEN
A CCN has undergone format validation
Applied to: CCN Format Valid?
WHEN
The system evaluates validation results
THEN
If CCN format is valid, proceed to store the record; if invalid, handle format error
Context: A return CCN has passed all format validations
GIVEN
A return CCN has passed all format validations
Applied to: Store Return CCN Record
WHEN
The system processes the validated CCN
THEN
The return CCN record must be stored in the database with all populated data
Context: A CCN has failed format validation
GIVEN
A CCN has failed format validation
Applied to: CCN Format Error
WHEN
The system processes the validation failure
THEN
A format error must be generated and the CCN construction process must be terminated
R-GCX146-cbl-01408 (+13) File: GCX146.cbl Return CCN Data Assembly Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Return CCN Data Assembly':
  • Context - a waybill record exists with equipment information:
    For Extract Equipment ID from Waybill:
    When the system processes return ccn data assembly, then the equipment id is extracted from the waybill record and stored for ccn creation.
  • Context - a waybill record contains date information:
    For Extract Waybill Date Information:
    When the system processes return ccn data assembly, then the waybill date is extracted and formatted for use in ccn key generation.
  • Context - equipment id and waybill date have been extracted:
    For Build Return CCN Number:
    When the system builds the return ccn number, then the ccn number is constructed with format '6105e' + equipment id + waybill date + sequence number.
  • Context - a return ccn record is being created:
    For Set CCN Status to 'RETURN':
    When the system sets the ccn status, then the ccn status is set to 'return' to indicate return cargo processing.
  • Context - a return ccn record is being processed:
    For Set Transit Status to 'R':
    When the system sets the transit status, then the transit status is set to 'r' to indicate return transit movement.
  • Context - a waybill record contains shipper information in the ship segment:
    For Extract Shipper Information from Waybill:
    When the system processes return ccn data assembly, then the shipper name and address information is extracted and populated in the ccn record.
  • Context - a waybill record contains consignee information in the cons segment:
    For Extract Consignee Information from Waybill:
    When the system processes return ccn data assembly, then the consignee name and address information is extracted and populated in the ccn record.
  • Context - station codes are available from waybill or train information:
    For Populate Origin Station Data:
    When the system populates origin station data, then the origin station information is populated in the ccn record using the appropriate station codes.
    For Populate Destination Station Data:
    When the system populates destination station data, then the destination station information is populated in the ccn record using the appropriate station codes.
  • Context - a waybill record contains commodity information:
    For Set Commodity Code Information:
    When the system sets commodity code information, then the commodity description and code are extracted from the waybill and populated in the ccn record.
  • Context - a waybill record contains weight and quantity information:
    For Assign Weight and Quantity Data:
    When the system assigns weight and quantity data, then the shipment weight and quantity are extracted from the waybill and populated in the ccn record.
  • Context - a return ccn record is being assembled:
    For Set Return Processing Flags:
    When the system sets return processing flags, then the appropriate flags are set to indicate return cargo processing requirements and handling instructions.
  • Context - all individual data elements have been extracted and populated:
    For Complete CCN Record Assembly:
    When the system completes ccn record assembly, then the ccn record is finalized with all required data elements populated and ready for database insertion.
  • Context - the ccn record assembly is complete with all required data:
    For Return CCN Data Ready for Insert:
    When the system prepares the data for insert, then the return ccn data is ready for database insertion with all business rules satisfied and data integrity validated.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill record exists with equipment information
GIVEN
A waybill record exists with equipment information
Applied to: Extract Equipment ID from Waybill
WHEN
The system processes return CCN data assembly
THEN
The equipment ID is extracted from the waybill record and stored for CCN creation
Context: A waybill record contains date information
GIVEN
A waybill record contains date information
Applied to: Extract Waybill Date Information
WHEN
The system processes return CCN data assembly
THEN
The waybill date is extracted and formatted for use in CCN key generation
Context: Equipment ID and waybill date have been extracted
GIVEN
Equipment ID and waybill date have been extracted
Applied to: Build Return CCN Number
WHEN
The system builds the return CCN number
THEN
The CCN number is constructed with format '6105E' + equipment ID + waybill date + sequence number
Context: A return CCN record is being created
GIVEN
A return CCN record is being created
Applied to: Set CCN Status to 'RETURN'
WHEN
The system sets the CCN status
THEN
The CCN status is set to 'RETURN' to indicate return cargo processing
Context: A return CCN record is being processed
GIVEN
A return CCN record is being processed
Applied to: Set Transit Status to 'R'
WHEN
The system sets the transit status
THEN
The transit status is set to 'R' to indicate return transit movement
Context: A waybill record contains shipper information in the SHIP segment
GIVEN
A waybill record contains shipper information in the SHIP segment
Applied to: Extract Shipper Information from Waybill
WHEN
The system processes return CCN data assembly
THEN
The shipper name and address information is extracted and populated in the CCN record
Context: A waybill record contains consignee information in the CONS segment
GIVEN
A waybill record contains consignee information in the CONS segment
Applied to: Extract Consignee Information from Waybill
WHEN
The system processes return CCN data assembly
THEN
The consignee name and address information is extracted and populated in the CCN record
Context: Station codes are available from waybill or train information
GIVEN
Station codes are available from waybill or train information
Applied to: Populate Origin Station Data
WHEN
The system populates origin station data
THEN
The origin station information is populated in the CCN record using the appropriate station codes
Applied to: Populate Destination Station Data
WHEN
The system populates destination station data
THEN
The destination station information is populated in the CCN record using the appropriate station codes
Context: A waybill record contains commodity information
GIVEN
A waybill record contains commodity information
Applied to: Set Commodity Code Information
WHEN
The system sets commodity code information
THEN
The commodity description and code are extracted from the waybill and populated in the CCN record
Context: A waybill record contains weight and quantity information
GIVEN
A waybill record contains weight and quantity information
Applied to: Assign Weight and Quantity Data
WHEN
The system assigns weight and quantity data
THEN
The shipment weight and quantity are extracted from the waybill and populated in the CCN record
Context: A return CCN record is being assembled
GIVEN
A return CCN record is being assembled
Applied to: Set Return Processing Flags
WHEN
The system sets return processing flags
THEN
The appropriate flags are set to indicate return cargo processing requirements and handling instructions
Context: All individual data elements have been extracted and populated
GIVEN
All individual data elements have been extracted and populated
Applied to: Complete CCN Record Assembly
WHEN
The system completes CCN record assembly
THEN
The CCN record is finalized with all required data elements populated and ready for database insertion
Context: The CCN record assembly is complete with all required data
GIVEN
The CCN record assembly is complete with all required data
Applied to: Return CCN Data Ready for Insert
WHEN
The system prepares the data for insert
THEN
The return CCN data is ready for database insertion with all business rules satisfied and data integrity validated
R-GCX146-cbl-01422 (+8) File: GCX146.cbl Equipment ID Preparation and Validation Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment ID Preparation and Validation':
  • Context - an equipment id is received from the input message:
    For Check Equipment ID Format:
    When the system checks the equipment id format for valid characters, then the equipment id should contain only alphanumeric characters and be properly formatted.
  • Context - an equipment id has been formatted and cleaned:
    For Validate Equipment ID Length:
    When the system validates the equipment id length, then the equipment id length should be within acceptable limits for database operations.
  • Context - an equipment id has passed initial format validation:
    For Apply Padding Rules:
    When the system applies padding rules to the equipment id, then the equipment id should be padded with appropriate characters to meet standard length requirements.
  • Context - an equipment id contains spaces or special characters:
    For Remove Spaces and Special Characters:
    When the system processes the equipment id for cleanup, then all spaces and invalid special characters should be removed from the equipment id.
  • Context - an equipment id has been validated and cleaned:
    For Format for Database Search:
    When the system formats the equipment id for database operations, then the equipment id should be formatted according to database search requirements.
  • Context - an equipment id has been formatted for database use:
    For Compress Equipment ID:
    When the system compresses the equipment id, then the equipment id should be compressed while maintaining its integrity and searchability.
  • Context - an equipment id contains numeric sequences:
    For Organize Numeric Sequences:
    When the system organizes the numeric portions, then numeric sequences should be properly aligned and formatted for consistent processing.
  • Context - an equipment id fails format validation:
    For Generate Format Error:
    When the system detects invalid format, then a format error should be generated indicating the equipment id does not meet format requirements.
  • Context - an equipment id fails length validation:
    For Generate Length Error:
    When the system detects invalid length, then a length error should be generated indicating the equipment id does not meet length requirements.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID is received from the input message
GIVEN
An equipment ID is received from the input message
Applied to: Check Equipment ID Format
WHEN
The system checks the equipment ID format for valid characters
THEN
The equipment ID should contain only alphanumeric characters and be properly formatted
Context: An equipment ID has been formatted and cleaned
GIVEN
An equipment ID has been formatted and cleaned
Applied to: Validate Equipment ID Length
WHEN
The system validates the equipment ID length
THEN
The equipment ID length should be within acceptable limits for database operations
Context: An equipment ID has passed initial format validation
GIVEN
An equipment ID has passed initial format validation
Applied to: Apply Padding Rules
WHEN
The system applies padding rules to the equipment ID
THEN
The equipment ID should be padded with appropriate characters to meet standard length requirements
Context: An equipment ID contains spaces or special characters
GIVEN
An equipment ID contains spaces or special characters
Applied to: Remove Spaces and Special Characters
WHEN
The system processes the equipment ID for cleanup
THEN
All spaces and invalid special characters should be removed from the equipment ID
Context: An equipment ID has been validated and cleaned
GIVEN
An equipment ID has been validated and cleaned
Applied to: Format for Database Search
WHEN
The system formats the equipment ID for database operations
THEN
The equipment ID should be formatted according to database search requirements
Context: An equipment ID has been formatted for database use
GIVEN
An equipment ID has been formatted for database use
Applied to: Compress Equipment ID
WHEN
The system compresses the equipment ID
THEN
The equipment ID should be compressed while maintaining its integrity and searchability
Context: An equipment ID contains numeric sequences
GIVEN
An equipment ID contains numeric sequences
Applied to: Organize Numeric Sequences
WHEN
The system organizes the numeric portions
THEN
Numeric sequences should be properly aligned and formatted for consistent processing
Context: An equipment ID fails format validation
GIVEN
An equipment ID fails format validation
Applied to: Generate Format Error
WHEN
The system detects invalid format
THEN
A format error should be generated indicating the equipment ID does not meet format requirements
Context: An equipment ID fails length validation
GIVEN
An equipment ID fails length validation
Applied to: Generate Length Error
WHEN
The system detects invalid length
THEN
A length error should be generated indicating the equipment ID does not meet length requirements
R-GCX146-cbl-01431 (+9) File: GCX146.cbl Multiple Search Criteria Configuration Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Multiple Search Criteria Configuration':
  • Context - a search operation is being initiated for equipment lookup:
    For Initialize Search Parameters:
    When the system begins parameter configuration, then all search parameter fields are cleared and set to initial default values.
  • Context - equipment search parameters are being configured:
    For Set Equipment Type Criteria:
    When equipment type criteria needs to be established, then car type code and equipment category are set based on the search requirements.
  • Context - equipment search is being configured with temporal constraints:
    For Configure Date Range Parameters:
    When date range parameters are being set, then waybill date range and system date parameters are established to define the search time window.
  • Context - equipment search requires geographic filtering:
    For Set Station Code Filters:
    When station code filters are being configured, then origin station code and destination station code are set to limit search to specific locations.
  • Context - equipment search needs to reference specific waybill documents:
    For Set Waybill Key Parameters:
    When waybill key parameters are being set, then primary waybill key and secondary key index are configured for document reference.
  • Context - equipment search requires ordered sequence processing:
    For Configure Car Type Sequence:
    When car type sequence is being configured, then car sequence number and type sequence id are set to define retrieval order.
  • Context - search targets specific equipment pieces:
    For Set Equipment ID Criteria:
    When equipment id criteria are being set, then equipment id format and car number parameters are configured for precise equipment identification.
  • Context - all search parameters have been configured:
    For Validate Search Parameter Combination:
    When parameter combination validation is performed, then system verifies that the parameter combination is valid and compatible for search execution.
  • Context - search parameters are validated and confirmed as compatible:
    For Execute Enhanced Search with FWCARGET:
    When enhanced search execution is initiated, then fwcarget service is called with all configured search parameters to retrieve equipment records.
  • Context - search parameters have been configured:
    For Search Configuration Error:
    When parameter validation fails due to incompatible combination, then system sets search configuration error status and prevents search execution.
👨‍💻 Technical ACs (Gherkin)
Context: A search operation is being initiated for equipment lookup
GIVEN
A search operation is being initiated for equipment lookup
Applied to: Initialize Search Parameters
WHEN
The system begins parameter configuration
THEN
All search parameter fields are cleared and set to initial default values
Context: Equipment search parameters are being configured
GIVEN
Equipment search parameters are being configured
Applied to: Set Equipment Type Criteria
WHEN
Equipment type criteria needs to be established
THEN
Car type code and equipment category are set based on the search requirements
Context: Equipment search is being configured with temporal constraints
GIVEN
Equipment search is being configured with temporal constraints
Applied to: Configure Date Range Parameters
WHEN
Date range parameters are being set
THEN
Waybill date range and system date parameters are established to define the search time window
Context: Equipment search requires geographic filtering
GIVEN
Equipment search requires geographic filtering
Applied to: Set Station Code Filters
WHEN
Station code filters are being configured
THEN
Origin station code and destination station code are set to limit search to specific locations
Context: Equipment search needs to reference specific waybill documents
GIVEN
Equipment search needs to reference specific waybill documents
Applied to: Set Waybill Key Parameters
WHEN
Waybill key parameters are being set
THEN
Primary waybill key and secondary key index are configured for document reference
Context: Equipment search requires ordered sequence processing
GIVEN
Equipment search requires ordered sequence processing
Applied to: Configure Car Type Sequence
WHEN
Car type sequence is being configured
THEN
Car sequence number and type sequence ID are set to define retrieval order
Context: Search targets specific equipment pieces
GIVEN
Search targets specific equipment pieces
Applied to: Set Equipment ID Criteria
WHEN
Equipment ID criteria are being set
THEN
Equipment ID format and car number parameters are configured for precise equipment identification
Context: All search parameters have been configured
GIVEN
All search parameters have been configured
Applied to: Validate Search Parameter Combination
WHEN
Parameter combination validation is performed
THEN
System verifies that the parameter combination is valid and compatible for search execution
Context: Search parameters are validated and confirmed as compatible
GIVEN
Search parameters are validated and confirmed as compatible
Applied to: Execute Enhanced Search with FWCARGET
WHEN
Enhanced search execution is initiated
THEN
FWCARGET service is called with all configured search parameters to retrieve equipment records
Context: Search parameters have been configured
GIVEN
Search parameters have been configured
Applied to: Search Configuration Error
WHEN
Parameter validation fails due to incompatible combination
THEN
System sets search configuration error status and prevents search execution
R-GCX146-cbl-01441 (+10) File: GCX146.cbl Container XREF Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container XREF Processing':
  • Context - a flat car equipment record exists in the system:
    For Search for T/C XREF Records:
    When the system processes the flat car for container identification, then the system searches the fw-iq inquiry database for t/c xref records matching the flat car.
  • Context - the system has searched for t/c xref records for a flat car:
    For XREF Record Found?:
    When the search is completed, then the system determines if any cross-reference records were found and proceeds with container processing if found, or handles the no-record scenario if not found.
  • Context - valid t/c xref records exist for a flat car:
    For Extract Container ID from XREF:
    When the system processes each cross-reference record, then the system extracts the container id from each xref record for further validation and processing.
  • Context - a container id has been extracted from a cross-reference record:
    For Validate Container ID Format:
    When the system validates the container id format, then the system verifies the container id meets format requirements and is valid for processing.
  • Context - a container id has undergone format validation:
    For Container ID Valid?:
    When the validation process is complete, then the system determines if the container id is valid and proceeds with sequence assignment if valid, or handles the invalid id error if not valid.
  • Context - a container id has been validated as having correct format:
    For Set Container Sequence Number:
    When the system processes the valid container, then the system assigns a sequence number to the container for proper ordering and identification within the flat car's container list.
  • Context - a container has been validated and assigned a sequence number:
    For Store Container Information:
    When the system completes container validation, then the system stores the container information including id and sequence number for subsequent processing steps.
  • Context - the system has processed one container from a flat car's cross-reference records:
    For More Containers?:
    When the system checks for additional containers, then the system determines if more containers exist for the same flat car and continues processing if more exist, or completes container processing if no more exist.
  • Context - multiple containers exist on a flat car and one has been processed:
    For Process Next Container in Sequence:
    When the system identifies additional containers to process, then the system processes the next container in sequence, extracting and validating its id following the same validation rules.
  • Context - a flat car is being processed for container identification:
    For Handle XREF Not Found Error:
    When no t/c xref records are found in the inquiry database, then the system handles the no cross-reference scenario and completes processing without container data.
  • Context - a container id has been extracted from cross-reference records:
    For Handle Invalid Container ID Error:
    When the container id fails format validation requirements, then the system handles the invalid container id error and continues processing remaining containers or completes processing.
👨‍💻 Technical ACs (Gherkin)
Context: A flat car equipment record exists in the system
GIVEN
A flat car equipment record exists in the system
Applied to: Search for T/C XREF Records
WHEN
The system processes the flat car for container identification
THEN
The system searches the FW-IQ inquiry database for T/C XREF records matching the flat car
Context: The system has searched for T/C XREF records for a flat car
GIVEN
The system has searched for T/C XREF records for a flat car
Applied to: XREF Record Found?
WHEN
The search is completed
THEN
The system determines if any cross-reference records were found and proceeds with container processing if found, or handles the no-record scenario if not found
Context: Valid T/C XREF records exist for a flat car
GIVEN
Valid T/C XREF records exist for a flat car
Applied to: Extract Container ID from XREF
WHEN
The system processes each cross-reference record
THEN
The system extracts the container ID from each XREF record for further validation and processing
Context: A container ID has been extracted from a cross-reference record
GIVEN
A container ID has been extracted from a cross-reference record
Applied to: Validate Container ID Format
WHEN
The system validates the container ID format
THEN
The system verifies the container ID meets format requirements and is valid for processing
Context: A container ID has undergone format validation
GIVEN
A container ID has undergone format validation
Applied to: Container ID Valid?
WHEN
The validation process is complete
THEN
The system determines if the container ID is valid and proceeds with sequence assignment if valid, or handles the invalid ID error if not valid
Context: A container ID has been validated as having correct format
GIVEN
A container ID has been validated as having correct format
Applied to: Set Container Sequence Number
WHEN
The system processes the valid container
THEN
The system assigns a sequence number to the container for proper ordering and identification within the flat car's container list
Context: A container has been validated and assigned a sequence number
GIVEN
A container has been validated and assigned a sequence number
Applied to: Store Container Information
WHEN
The system completes container validation
THEN
The system stores the container information including ID and sequence number for subsequent processing steps
Context: The system has processed one container from a flat car's cross-reference records
GIVEN
The system has processed one container from a flat car's cross-reference records
Applied to: More Containers?
WHEN
The system checks for additional containers
THEN
The system determines if more containers exist for the same flat car and continues processing if more exist, or completes container processing if no more exist
Context: Multiple containers exist on a flat car and one has been processed
GIVEN
Multiple containers exist on a flat car and one has been processed
Applied to: Process Next Container in Sequence
WHEN
The system identifies additional containers to process
THEN
The system processes the next container in sequence, extracting and validating its ID following the same validation rules
Context: A flat car is being processed for container identification
GIVEN
A flat car is being processed for container identification
Applied to: Handle XREF Not Found Error
WHEN
No T/C XREF records are found in the inquiry database
THEN
The system handles the no cross-reference scenario and completes processing without container data
Context: A container ID has been extracted from cross-reference records
GIVEN
A container ID has been extracted from cross-reference records
Applied to: Handle Invalid Container ID Error
WHEN
The container ID fails format validation requirements
THEN
The system handles the invalid container ID error and continues processing remaining containers or completes processing
R-GCX146-cbl-01452 (+11) File: GCX146.cbl Flat Car Container Sequence Management Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Flat Car Container Sequence Management':
  • Context - an equipment record is being processed:
    For Set Flat Car Flag:
    When the equipment type indicates it is a flat car capable of carrying containers, then the system sets the flat car processing flag to enable container sequence management.
  • Context - a flat car is being processed for container handling:
    For Initialize Container Sequence Counter:
    When container sequence processing begins, then the container sequence counter is initialized to zero to track container positions on the flat car.
  • Context - a flat car requires container processing:
    For Access Container Records via Z510-GU-FWSWRWR:
    When the system needs to identify containers on the flat car, then the system accesses the fwswrwr container records database using the z510-gu-fwswrwr procedure.
  • Context - the system has attempted to retrieve container records for a flat car:
    For Container Record Found?:
    When the database lookup is completed, then the system determines if valid container records were found and branches processing accordingly.
  • Context - a valid container record has been retrieved from the database:
    For Extract Container ID from Record:
    When container identification is required for processing, then the system extracts the container id from the container record for further processing.
  • Context - a container id has been extracted from a container record:
    For Set Container Position Tracking:
    When container position management is required, then the system establishes position tracking for the container including its sequential placement on the flat car.
  • Context - a container has been identified and positioned on the flat car:
    For Process Current Container:
    When container processing is required, then the system processes the current container including status updates and detail recording.
  • Context - a container has been successfully processed:
    For Increment Sequence Counter:
    When moving to the next container in sequence, then the system increments the container sequence counter to maintain proper position tracking.
  • Context - the current container has been processed and the sequence counter incremented:
    For Get Next Container in Sequence:
    When additional containers may exist on the flat car, then the system retrieves the next container record in the sequential order.
  • Context - a container has been processed and the next container record has been attempted:
    For More Containers on Flat Car?:
    When determining if container processing should continue, then the system evaluates whether more containers exist on the flat car and branches processing accordingly.
  • Context - all containers on the flat car have been processed or no containers were found:
    For Complete Container Sequence Processing:
    When container sequence processing reaches completion, then the system completes the container sequence processing and finalizes all container-related activities for the flat car.
  • Context - a flat car has been identified for container processing:
    For Handle Container Not Found:
    When no container records are found in the fwswrwr database, then the system handles the container not found condition and proceeds to complete processing.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record is being processed
GIVEN
An equipment record is being processed
Applied to: Set Flat Car Flag
WHEN
The equipment type indicates it is a flat car capable of carrying containers
THEN
The system sets the flat car processing flag to enable container sequence management
Context: A flat car is being processed for container handling
GIVEN
A flat car is being processed for container handling
Applied to: Initialize Container Sequence Counter
WHEN
Container sequence processing begins
THEN
The container sequence counter is initialized to zero to track container positions on the flat car
Context: A flat car requires container processing
GIVEN
A flat car requires container processing
Applied to: Access Container Records via Z510-GU-FWSWRWR
WHEN
The system needs to identify containers on the flat car
THEN
The system accesses the FWSWRWR container records database using the Z510-GU-FWSWRWR procedure
Context: The system has attempted to retrieve container records for a flat car
GIVEN
The system has attempted to retrieve container records for a flat car
Applied to: Container Record Found?
WHEN
The database lookup is completed
THEN
The system determines if valid container records were found and branches processing accordingly
Context: A valid container record has been retrieved from the database
GIVEN
A valid container record has been retrieved from the database
Applied to: Extract Container ID from Record
WHEN
Container identification is required for processing
THEN
The system extracts the container ID from the container record for further processing
Context: A container ID has been extracted from a container record
GIVEN
A container ID has been extracted from a container record
Applied to: Set Container Position Tracking
WHEN
Container position management is required
THEN
The system establishes position tracking for the container including its sequential placement on the flat car
Context: A container has been identified and positioned on the flat car
GIVEN
A container has been identified and positioned on the flat car
Applied to: Process Current Container
WHEN
Container processing is required
THEN
The system processes the current container including status updates and detail recording
Context: A container has been successfully processed
GIVEN
A container has been successfully processed
Applied to: Increment Sequence Counter
WHEN
Moving to the next container in sequence
THEN
The system increments the container sequence counter to maintain proper position tracking
Context: The current container has been processed and the sequence counter incremented
GIVEN
The current container has been processed and the sequence counter incremented
Applied to: Get Next Container in Sequence
WHEN
Additional containers may exist on the flat car
THEN
The system retrieves the next container record in the sequential order
Context: A container has been processed and the next container record has been attempted
GIVEN
A container has been processed and the next container record has been attempted
Applied to: More Containers on Flat Car?
WHEN
Determining if container processing should continue
THEN
The system evaluates whether more containers exist on the flat car and branches processing accordingly
Context: All containers on the flat car have been processed OR no containers were found
GIVEN
All containers on the flat car have been processed OR no containers were found
Applied to: Complete Container Sequence Processing
WHEN
Container sequence processing reaches completion
THEN
The system completes the container sequence processing and finalizes all container-related activities for the flat car
Context: A flat car has been identified for container processing
GIVEN
A flat car has been identified for container processing
Applied to: Handle Container Not Found
WHEN
No container records are found in the FWSWRWR database
THEN
The system handles the container not found condition and proceeds to complete processing
R-GCX146-cbl-01464 (+5) File: GCX146.cbl CCN Status and Transit Status Cross Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Status and Transit Status Cross':
  • Context - equipment has ccn status of 'release' and transit status is either 'e' (export) or 'z' (export zone):
    For Set Status to 'EXPORT':
    When the system processes equipment status for trip sheet generation, then the equipment status should be classified as 'export' on the trip sheet.
  • Context - equipment has ccn status of 'release' and transit status is not 'e' or 'z' and the release is designated as s.a.r. release:
    For Set Status to 'S.A.R.':
    When the system processes equipment status for trip sheet generation, then the equipment status should be classified as 's.a.r.' on the trip sheet.
  • Context - equipment has ccn status of 'release' and transit status is not 'e' or 'z' and does not have s.a.r. release designation:
    For Set Status to 'RELEASE':
    When the system processes equipment status for trip sheet generation, then the equipment status should be classified as 'release' on the trip sheet.
  • Context - equipment has transit status of 't' (transit) and ccn status is not 'release':
    For Set Status to 'TRANSIT':
    When the system processes equipment status for trip sheet generation, then the equipment status should be classified as 'transit' on the trip sheet.
  • Context - equipment has transit status of 'r' (return) and ccn status is not 'release' and transit status is not 't':
    For Set Status to 'RETURN':
    When the system processes equipment status for trip sheet generation, then the equipment status should be classified as 'return' on the trip sheet.
  • Context - equipment ccn status is not 'release' and transit status is not 't' or 'r':
    For Maintain Current Status:
    When the system processes equipment status for trip sheet generation, then the equipment status should remain as the current ccn status on the trip sheet.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment has CCN status of 'RELEASE' and transit status is either 'E' (Export) or 'Z' (Export Zone)
GIVEN
Equipment has CCN status of 'RELEASE' and transit status is either 'E' (Export) or 'Z' (Export Zone)
Applied to: Set Status to 'EXPORT'
WHEN
The system processes equipment status for trip sheet generation
THEN
The equipment status should be classified as 'EXPORT' on the trip sheet
Context: Equipment has CCN status of 'RELEASE' and transit status is not 'E' or 'Z' and the release is designated as S.A.R. release
GIVEN
Equipment has CCN status of 'RELEASE' and transit status is not 'E' or 'Z' and the release is designated as S.A.R. release
Applied to: Set Status to 'S.A.R.'
WHEN
The system processes equipment status for trip sheet generation
THEN
The equipment status should be classified as 'S.A.R.' on the trip sheet
Context: Equipment has CCN status of 'RELEASE' and transit status is not 'E' or 'Z' and does not have S.A.R. release designation
GIVEN
Equipment has CCN status of 'RELEASE' and transit status is not 'E' or 'Z' and does not have S.A.R. release designation
Applied to: Set Status to 'RELEASE'
WHEN
The system processes equipment status for trip sheet generation
THEN
The equipment status should be classified as 'RELEASE' on the trip sheet
Context: Equipment has transit status of 'T' (Transit) and CCN status is not 'RELEASE'
GIVEN
Equipment has transit status of 'T' (Transit) and CCN status is not 'RELEASE'
Applied to: Set Status to 'TRANSIT'
WHEN
The system processes equipment status for trip sheet generation
THEN
The equipment status should be classified as 'TRANSIT' on the trip sheet
Context: Equipment has transit status of 'R' (Return) and CCN status is not 'RELEASE' and transit status is not 'T'
GIVEN
Equipment has transit status of 'R' (Return) and CCN status is not 'RELEASE' and transit status is not 'T'
Applied to: Set Status to 'RETURN'
WHEN
The system processes equipment status for trip sheet generation
THEN
The equipment status should be classified as 'RETURN' on the trip sheet
Context: Equipment CCN status is not 'RELEASE' and transit status is not 'T' or 'R'
GIVEN
Equipment CCN status is not 'RELEASE' and transit status is not 'T' or 'R'
Applied to: Maintain Current Status
WHEN
The system processes equipment status for trip sheet generation
THEN
The equipment status should remain as the current CCN status on the trip sheet
R-GCX146-cbl-01470 (+6) File: GCX146.cbl Train ID Component Extraction and Formatting Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train ID Component Extraction and Formatting':
  • Context - a train number component has been extracted from the input message:
    For Replace Spaces with Zeros in Train Number:
    When the train number component contains one or more space characters, then all space characters in the train number component are replaced with zero characters.
  • Context - a train day component has been extracted from the input message:
    For Replace Spaces with Zeros in Train Day:
    When the train day component contains one or more space characters, then all space characters in the train day component are replaced with zero characters.
  • Context - a from station component has been extracted from the input message:
    For Replace Spaces with Zeros in From Station:
    When the from station component contains one or more space characters, then all space characters in the from station component are replaced with zero characters.
  • Context - a to station component has been extracted from the input message:
    For Replace Spaces with Zeros in To Station:
    When the to station component contains one or more space characters, then all space characters in the to station component are replaced with zero characters.
  • Context - a consist number component has been extracted from the input message:
    For Replace Spaces with Zeros in Consist Number:
    When the consist number component contains one or more space characters, then all space characters in the consist number component are replaced with zero characters.
  • Context - all train components have been extracted and formatted with spaces replaced by zeros:
    For Build WS-CUSTOMS-TRAIN-ID:
    When building the customs train id, then the customs train id is constructed by concatenating train number, train day, from station, to station, consist number, and system date components in sequence.
    For Build GCWB4TL-CP-TRAIN-ID:
    When building the cp train id, then the cp train id is constructed using the same concatenated components as the customs train id.
👨‍💻 Technical ACs (Gherkin)
Context: A train number component has been extracted from the input message
GIVEN
A train number component has been extracted from the input message
Applied to: Replace Spaces with Zeros in Train Number
WHEN
The train number component contains one or more space characters
THEN
All space characters in the train number component are replaced with zero characters
Context: A train day component has been extracted from the input message
GIVEN
A train day component has been extracted from the input message
Applied to: Replace Spaces with Zeros in Train Day
WHEN
The train day component contains one or more space characters
THEN
All space characters in the train day component are replaced with zero characters
Context: A from station component has been extracted from the input message
GIVEN
A from station component has been extracted from the input message
Applied to: Replace Spaces with Zeros in From Station
WHEN
The from station component contains one or more space characters
THEN
All space characters in the from station component are replaced with zero characters
Context: A to station component has been extracted from the input message
GIVEN
A to station component has been extracted from the input message
Applied to: Replace Spaces with Zeros in To Station
WHEN
The to station component contains one or more space characters
THEN
All space characters in the to station component are replaced with zero characters
Context: A consist number component has been extracted from the input message
GIVEN
A consist number component has been extracted from the input message
Applied to: Replace Spaces with Zeros in Consist Number
WHEN
The consist number component contains one or more space characters
THEN
All space characters in the consist number component are replaced with zero characters
Context: All train components have been extracted and formatted with spaces replaced by zeros
GIVEN
All train components have been extracted and formatted with spaces replaced by zeros
Applied to: Build WS-CUSTOMS-TRAIN-ID
WHEN
Building the customs train ID
THEN
The customs train ID is constructed by concatenating train number, train day, from station, to station, consist number, and system date components in sequence
Applied to: Build GCWB4TL-CP-TRAIN-ID
WHEN
Building the CP train ID
THEN
The CP train ID is constructed using the same concatenated components as the customs train ID
R-GCX146-cbl-01477 (+12) File: GCX146.cbl Equipment Type Code Assignment Logic Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Type Code Assignment Logic':
  • Context - equipment record with car type and container indicators are available:
    For Is Container Equipment?:
    When equipment is identified as container equipment, then system checks container load status and assigns container-specific type code.
  • Context - equipment is confirmed as container equipment:
    For Container Loaded?:
    When container load status indicates loaded condition, then system assigns loaded container type code.
    For Assign Empty Container Code:
    When container load status indicates empty condition, then system assigns empty container type code.
  • Context - equipment is not container equipment:
    For Is Trailer Equipment?:
    When equipment type indicators are evaluated for trailer classification, then system identifies equipment as trailer or proceeds to rail car classification.
  • Context - equipment is confirmed as trailer equipment:
    For Trailer Loaded?:
    When trailer load status indicates loaded condition, then system assigns loaded trailer type code.
    For Assign Empty Trailer Code:
    When trailer load status indicates empty condition, then system assigns empty trailer type code.
  • Context - equipment is rail car type (not container or trailer):
    For Is Flat Car?:
    When car type indicates flat car classification, then system assigns flat car type code.
  • Context - equipment is rail car type and not a flat car:
    For Is Tank Car?:
    When car type indicates tank car classification, then system assigns tank car type code.
  • Context - equipment is rail car type and not flat car or tank car:
    For Is Box Car?:
    When car type indicates box car classification, then system assigns box car type code.
  • Context - equipment is rail car type:
    For Assign General Car Code:
    When car type does not match flat car, tank car, or box car classifications, then system assigns general car type code.
  • Context - equipment type code has been assigned:
    For Equipment Loaded?:
    When equipment load status is evaluated, then system sets appropriate load status flag (loaded or empty).
  • Context - equipment load status has been determined:
    For Set Load Status Flag:
    When equipment is confirmed as loaded, then system sets load status flag to indicate loaded condition.
    For Set Empty Status Flag:
    When equipment is confirmed as empty, then system sets empty status flag to indicate empty condition.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment record with car type and container indicators are available
GIVEN
Equipment record with car type and container indicators are available
Applied to: Is Container Equipment?
WHEN
Equipment is identified as container equipment
THEN
System checks container load status and assigns container-specific type code
Context: Equipment is confirmed as container equipment
GIVEN
Equipment is confirmed as container equipment
Applied to: Container Loaded?
WHEN
Container load status indicates loaded condition
THEN
System assigns loaded container type code
Applied to: Assign Empty Container Code
WHEN
Container load status indicates empty condition
THEN
System assigns empty container type code
Context: Equipment is not container equipment
GIVEN
Equipment is not container equipment
Applied to: Is Trailer Equipment?
WHEN
Equipment type indicators are evaluated for trailer classification
THEN
System identifies equipment as trailer or proceeds to rail car classification
Context: Equipment is confirmed as trailer equipment
GIVEN
Equipment is confirmed as trailer equipment
Applied to: Trailer Loaded?
WHEN
Trailer load status indicates loaded condition
THEN
System assigns loaded trailer type code
Applied to: Assign Empty Trailer Code
WHEN
Trailer load status indicates empty condition
THEN
System assigns empty trailer type code
Context: Equipment is rail car type (not container or trailer)
GIVEN
Equipment is rail car type (not container or trailer)
Applied to: Is Flat Car?
WHEN
Car type indicates flat car classification
THEN
System assigns flat car type code
Context: Equipment is rail car type and not a flat car
GIVEN
Equipment is rail car type and not a flat car
Applied to: Is Tank Car?
WHEN
Car type indicates tank car classification
THEN
System assigns tank car type code
Context: Equipment is rail car type and not flat car or tank car
GIVEN
Equipment is rail car type and not flat car or tank car
Applied to: Is Box Car?
WHEN
Car type indicates box car classification
THEN
System assigns box car type code
Context: Equipment is rail car type
GIVEN
Equipment is rail car type
Applied to: Assign General Car Code
WHEN
Car type does not match flat car, tank car, or box car classifications
THEN
System assigns general car type code
Context: Equipment type code has been assigned
GIVEN
Equipment type code has been assigned
Applied to: Equipment Loaded?
WHEN
Equipment load status is evaluated
THEN
System sets appropriate load status flag (loaded or empty)
Context: Equipment load status has been determined
GIVEN
Equipment load status has been determined
Applied to: Set Load Status Flag
WHEN
Equipment is confirmed as loaded
THEN
System sets load status flag to indicate loaded condition
Applied to: Set Empty Status Flag
WHEN
Equipment is confirmed as empty
THEN
System sets empty status flag to indicate empty condition
R-GCX146-cbl-01490 (+9) File: GCX146.cbl CCN Format Validation and Construction Rules Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Format Validation and Construction Rules':
  • Context - a return cargo ccn needs to be created:
    For Construct CCN Prefix '6105E':
    When the system constructs the ccn identifier, then the ccn must start with the standard prefix '6105e'.
  • Context - an equipment id from waybill data:
    For Build Equipment ID Component:
    When the equipment id is being formatted for ccn construction, then the equipment id must be exactly 10 characters in length and padded with spaces if necessary.
  • Context - an equipment id extracted from waybill:
    For Equipment ID Length Valid?:
    When the system validates the equipment id length, then if the equipment id is less than 10 characters, it must be padded with spaces to reach exactly 10 characters.
  • Context - waybill date components (year, month, day):
    For Format Date Component YYMMDD:
    When the date is being formatted for ccn construction, then the date must be formatted as yymmdd with 2-digit year, 2-digit month, and 2-digit day.
  • Context - ccn prefix '6105e', formatted equipment id, and formatted date:
    For Concatenate CCN Components:
    When the system constructs the complete ccn, then the ccn must be formed by concatenating prefix + equipment id + date in that exact order.
  • Context - a constructed ccn string:
    For Validate CCN Format Structure:
    When the system validates the ccn format, then the ccn must have exactly 22 characters total length, start with '6105e', contain valid equipment id, and end with valid yymmdd date.
  • Context - a constructed ccn with all components:
    For CCN Format Valid?:
    When the system checks format compliance, then if the ccn format is invalid, processing must stop with format error; if valid, processing continues to status assignment.
  • Context - a valid ccn format has been constructed:
    For Set CCN Status to 'RETURN':
    When the system assigns status to the ccn, then the ccn status must be set to 'return' to indicate return cargo processing.
  • Context - a ccn with return status assigned:
    For Set Transit Status to 'R':
    When the system sets transit status, then the transit status must be set to 'r' to indicate return movement.
  • Context - a ccn with valid format, return status, and transit status:
    For Assign CCN Key Fields:
    When the system assigns key fields, then all ccn key fields including equipment id, waybill date, and sequence must be properly assigned for database storage.
👨‍💻 Technical ACs (Gherkin)
Context: A return cargo CCN needs to be created
GIVEN
A return cargo CCN needs to be created
Applied to: Construct CCN Prefix '6105E'
WHEN
The system constructs the CCN identifier
THEN
The CCN must start with the standard prefix '6105E'
Context: An equipment ID from waybill data
GIVEN
An equipment ID from waybill data
Applied to: Build Equipment ID Component
WHEN
The equipment ID is being formatted for CCN construction
THEN
The equipment ID must be exactly 10 characters in length and padded with spaces if necessary
Context: An equipment ID extracted from waybill
GIVEN
An equipment ID extracted from waybill
Applied to: Equipment ID Length Valid?
WHEN
The system validates the equipment ID length
THEN
If the equipment ID is less than 10 characters, it must be padded with spaces to reach exactly 10 characters
Context: Waybill date components (year, month, day)
GIVEN
Waybill date components (year, month, day)
Applied to: Format Date Component YYMMDD
WHEN
The date is being formatted for CCN construction
THEN
The date must be formatted as YYMMDD with 2-digit year, 2-digit month, and 2-digit day
Context: CCN prefix '6105E', formatted equipment ID, and formatted date
GIVEN
CCN prefix '6105E', formatted equipment ID, and formatted date
Applied to: Concatenate CCN Components
WHEN
The system constructs the complete CCN
THEN
The CCN must be formed by concatenating prefix + equipment ID + date in that exact order
Context: A constructed CCN string
GIVEN
A constructed CCN string
Applied to: Validate CCN Format Structure
WHEN
The system validates the CCN format
THEN
The CCN must have exactly 22 characters total length, start with '6105E', contain valid equipment ID, and end with valid YYMMDD date
Context: A constructed CCN with all components
GIVEN
A constructed CCN with all components
Applied to: CCN Format Valid?
WHEN
The system checks format compliance
THEN
If the CCN format is invalid, processing must stop with format error; if valid, processing continues to status assignment
Context: A valid CCN format has been constructed
GIVEN
A valid CCN format has been constructed
Applied to: Set CCN Status to 'RETURN'
WHEN
The system assigns status to the CCN
THEN
The CCN status must be set to 'RETURN' to indicate return cargo processing
Context: A CCN with return status assigned
GIVEN
A CCN with return status assigned
Applied to: Set Transit Status to 'R'
WHEN
The system sets transit status
THEN
The transit status must be set to 'R' to indicate return movement
Context: A CCN with valid format, return status, and transit status
GIVEN
A CCN with valid format, return status, and transit status
Applied to: Assign CCN Key Fields
WHEN
The system assigns key fields
THEN
All CCN key fields including equipment ID, waybill date, and sequence must be properly assigned for database storage
R-GCX146-cbl-01500 (+16) File: GCX146.cbl Broker Channel Priority and Fallback Logic Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Channel Priority and Fallback Logic':
  • Context - a broker notification needs to be sent and primary broker configuration is checked:
    For X12 EDI Channel Available?:
    When the system evaluates available notification channels, then x12 edi channel is selected as the first priority if available.
  • Context - x12 edi channel is available and selected for broker notification:
    For Send via X12 EDI - GCCS309C:
    When the system initiates x12 edi transmission, then gccs309c program is invoked to process the x12 edi notification.
  • Context - x12 edi transmission has been attempted via gccs309c:
    For X12 Transmission Successful?:
    When the system checks the transmission result, then if successful, primary notification is marked complete, otherwise fallback to next channel.
  • Context - x12 edi channel is either unavailable or transmission failed:
    For Merlin Channel Available?:
    When the system evaluates the next available notification channel, then merlin channel is selected if available as the second priority option.
  • Context - merlin channel is available and selected for broker notification:
    For Send via Merlin - GCX019:
    When the system initiates merlin transmission, then gcx019 program is invoked to process the merlin notification.
  • Context - merlin transmission has been attempted via gcx019:
    For Merlin Transmission Successful?:
    When the system checks the transmission result, then if successful, primary notification is marked complete, otherwise fallback to next channel.
  • Context - both x12 edi and merlin channels are either unavailable or transmissions failed:
    For Internet Channel Available?:
    When the system evaluates the next available notification channel, then internet channel is selected if available as the third priority option.
  • Context - internet channel is available and selected for broker notification:
    For Send via Internet - GCX019:
    When the system initiates internet transmission, then gcx019 program is invoked to process the internet notification.
  • Context - internet transmission has been attempted via gcx019:
    For Internet Transmission Successful?:
    When the system checks the transmission result, then if successful, primary notification is marked complete, otherwise fallback to next channel.
  • Context - x12 edi, merlin, and internet channels are either unavailable or transmissions failed:
    For FAX Channel Available?:
    When the system evaluates the next available notification channel, then fax channel is selected if available as the fourth priority option.
  • Context - fax channel is available and selected for broker notification:
    For Send via FAX - GCX019:
    When the system initiates fax transmission, then gcx019 program is invoked to process the fax notification.
  • Context - fax transmission has been attempted via gcx019:
    For FAX Transmission Successful?:
    When the system checks the transmission result, then if successful, primary notification is marked complete, otherwise fallback to paper notification.
  • Context - all electronic notification channels (x12 edi, merlin, internet, fax) are either unavailable or failed:
    For Generate Paper Notification:
    When the system needs to complete broker notification, then paper notification is generated as the final fallback option.
  • Context - paper notification has been selected as the delivery method:
    For Call Batch Print Letters:
    When the system processes the paper notification request, then batch print letters program is called to generate physical notification documents.
  • Context - primary broker notification has been completed (successfully or via paper):
    For Secondary Broker Exists?:
    When the system checks for additional broker notification requirements, then if secondary broker exists, the same channel priority process is repeated for secondary broker.
  • Context - secondary broker exists and requires notification:
    For Repeat Channel Priority for Secondary Broker:
    When the system processes secondary broker notification, then the same channel priority sequence (x12 edi, merlin, internet, fax, paper) is applied for secondary broker.
  • Context - any notification channel transmission fails (x12 edi, merlin, internet, or fax):
    For Log Failed Transmission:
    When the system detects the transmission failure, then the failed transmission is logged before attempting the next fallback channel.
👨‍💻 Technical ACs (Gherkin)
Context: A broker notification needs to be sent and primary broker configuration is checked
GIVEN
A broker notification needs to be sent and primary broker configuration is checked
Applied to: X12 EDI Channel Available?
WHEN
The system evaluates available notification channels
THEN
X12 EDI channel is selected as the first priority if available
Context: X12 EDI channel is available and selected for broker notification
GIVEN
X12 EDI channel is available and selected for broker notification
Applied to: Send via X12 EDI - GCCS309C
WHEN
The system initiates X12 EDI transmission
THEN
GCCS309C program is invoked to process the X12 EDI notification
Context: X12 EDI transmission has been attempted via GCCS309C
GIVEN
X12 EDI transmission has been attempted via GCCS309C
Applied to: X12 Transmission Successful?
WHEN
The system checks the transmission result
THEN
If successful, primary notification is marked complete, otherwise fallback to next channel
Context: X12 EDI channel is either unavailable or transmission failed
GIVEN
X12 EDI channel is either unavailable or transmission failed
Applied to: Merlin Channel Available?
WHEN
The system evaluates the next available notification channel
THEN
Merlin channel is selected if available as the second priority option
Context: Merlin channel is available and selected for broker notification
GIVEN
Merlin channel is available and selected for broker notification
Applied to: Send via Merlin - GCX019
WHEN
The system initiates Merlin transmission
THEN
GCX019 program is invoked to process the Merlin notification
Context: Merlin transmission has been attempted via GCX019
GIVEN
Merlin transmission has been attempted via GCX019
Applied to: Merlin Transmission Successful?
WHEN
The system checks the transmission result
THEN
If successful, primary notification is marked complete, otherwise fallback to next channel
Context: Both X12 EDI and Merlin channels are either unavailable or transmissions failed
GIVEN
Both X12 EDI and Merlin channels are either unavailable or transmissions failed
Applied to: Internet Channel Available?
WHEN
The system evaluates the next available notification channel
THEN
Internet channel is selected if available as the third priority option
Context: Internet channel is available and selected for broker notification
GIVEN
Internet channel is available and selected for broker notification
Applied to: Send via Internet - GCX019
WHEN
The system initiates Internet transmission
THEN
GCX019 program is invoked to process the Internet notification
Context: Internet transmission has been attempted via GCX019
GIVEN
Internet transmission has been attempted via GCX019
Applied to: Internet Transmission Successful?
WHEN
The system checks the transmission result
THEN
If successful, primary notification is marked complete, otherwise fallback to next channel
Context: X12 EDI, Merlin, and Internet channels are either unavailable or transmissions failed
GIVEN
X12 EDI, Merlin, and Internet channels are either unavailable or transmissions failed
Applied to: FAX Channel Available?
WHEN
The system evaluates the next available notification channel
THEN
FAX channel is selected if available as the fourth priority option
Context: FAX channel is available and selected for broker notification
GIVEN
FAX channel is available and selected for broker notification
Applied to: Send via FAX - GCX019
WHEN
The system initiates FAX transmission
THEN
GCX019 program is invoked to process the FAX notification
Context: FAX transmission has been attempted via GCX019
GIVEN
FAX transmission has been attempted via GCX019
Applied to: FAX Transmission Successful?
WHEN
The system checks the transmission result
THEN
If successful, primary notification is marked complete, otherwise fallback to paper notification
Context: All electronic notification channels (X12 EDI, Merlin, Internet, FAX) are either unavailable or failed
GIVEN
All electronic notification channels (X12 EDI, Merlin, Internet, FAX) are either unavailable or failed
Applied to: Generate Paper Notification
WHEN
The system needs to complete broker notification
THEN
Paper notification is generated as the final fallback option
Context: Paper notification has been selected as the delivery method
GIVEN
Paper notification has been selected as the delivery method
Applied to: Call Batch Print Letters
WHEN
The system processes the paper notification request
THEN
Batch print letters program is called to generate physical notification documents
Context: Primary broker notification has been completed (successfully or via paper)
GIVEN
Primary broker notification has been completed (successfully or via paper)
Applied to: Secondary Broker Exists?
WHEN
The system checks for additional broker notification requirements
THEN
If secondary broker exists, the same channel priority process is repeated for secondary broker
Context: Secondary broker exists and requires notification
GIVEN
Secondary broker exists and requires notification
Applied to: Repeat Channel Priority for Secondary Broker
WHEN
The system processes secondary broker notification
THEN
The same channel priority sequence (X12 EDI, Merlin, Internet, FAX, Paper) is applied for secondary broker
Context: Any notification channel transmission fails (X12 EDI, Merlin, Internet, or FAX)
GIVEN
Any notification channel transmission fails (X12 EDI, Merlin, Internet, or FAX)
Applied to: Log Failed Transmission
WHEN
The system detects the transmission failure
THEN
The failed transmission is logged before attempting the next fallback channel
R-GCX146-cbl-01517 (+12) File: GCX146.cbl Email User List Processing and Validation Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email User List Processing and Validation':
  • Context - a station code is provided for email configuration lookup:
    For Access Station Configuration Table:
    When the system accesses the station configuration table, then the station's email configuration data is retrieved for processing.
  • Context - station configuration data is available:
    For Retrieve AECWRKTB Email Configuration:
    When the system queries aecwrktb email configuration table, then email user configuration data is retrieved for the station.
  • Context - email configuration data has been retrieved from aecwrktb table:
    For Email Users Found?:
    When the system checks for the presence of email users, then processing continues if email users are found, otherwise an email configuration error is raised.
  • Context - email users are found in the configuration:
    For Extract First Email User ID:
    When the system processes the email user list, then the first email user id is extracted for validation.
  • Context - an email user id has been extracted from the configuration:
    For Validate Email User ID Format:
    When the system validates the email user id format, then the user id is accepted if it meets format requirements, otherwise it is rejected.
  • Context - an email user id has passed format validation:
    For Add User to Email Distribution List:
    When the system processes the valid email user, then the user is added to the email distribution list.
  • Context - an email user has been processed (valid or invalid):
    For Check for Additional Email Users:
    When the system checks for additional email users in the configuration, then processing continues with next user if available, otherwise proceeds to finalize the list.
  • Context - additional email users are available in the configuration:
    For Extract Next Email User ID:
    When the system processes the next email user, then the next email user id is extracted for validation.
  • Context - all email users have been processed and validated:
    For Set Primary Email Distribution:
    When the system sets up the primary email distribution, then a primary email distribution list is established with all valid users.
  • Context - primary email distribution has been attempted:
    For Primary Email Failed?:
    When the system checks the success of primary email setup, then fallback procedures are initiated if primary email failed, otherwise processing continues normally.
  • Context - primary email distribution has failed:
    For Set Fallback Email Recipients:
    When the system sets up fallback email recipients, then alternative email recipients are configured to ensure message delivery.
  • Context - fallback email recipients are being configured:
    For Use OM01247/AEI9999 as Backup:
    When the system assigns backup email addresses, then om01247 and aei9999 are set as backup email recipients.
  • Context - email distribution setup is complete (either primary or fallback):
    For Finalize Email User List:
    When the system finalizes the email user list, then the email user list is prepared and ready for message distribution.
👨‍💻 Technical ACs (Gherkin)
Context: A station code is provided for email configuration lookup
GIVEN
A station code is provided for email configuration lookup
Applied to: Access Station Configuration Table
WHEN
The system accesses the station configuration table
THEN
The station's email configuration data is retrieved for processing
Context: Station configuration data is available
GIVEN
Station configuration data is available
Applied to: Retrieve AECWRKTB Email Configuration
WHEN
The system queries AECWRKTB email configuration table
THEN
Email user configuration data is retrieved for the station
Context: Email configuration data has been retrieved from AECWRKTB table
GIVEN
Email configuration data has been retrieved from AECWRKTB table
Applied to: Email Users Found?
WHEN
The system checks for the presence of email users
THEN
Processing continues if email users are found, otherwise an email configuration error is raised
Context: Email users are found in the configuration
GIVEN
Email users are found in the configuration
Applied to: Extract First Email User ID
WHEN
The system processes the email user list
THEN
The first email user ID is extracted for validation
Context: An email user ID has been extracted from the configuration
GIVEN
An email user ID has been extracted from the configuration
Applied to: Validate Email User ID Format
WHEN
The system validates the email user ID format
THEN
The user ID is accepted if it meets format requirements, otherwise it is rejected
Context: An email user ID has passed format validation
GIVEN
An email user ID has passed format validation
Applied to: Add User to Email Distribution List
WHEN
The system processes the valid email user
THEN
The user is added to the email distribution list
Context: An email user has been processed (valid or invalid)
GIVEN
An email user has been processed (valid or invalid)
Applied to: Check for Additional Email Users
WHEN
The system checks for additional email users in the configuration
THEN
Processing continues with next user if available, otherwise proceeds to finalize the list
Context: Additional email users are available in the configuration
GIVEN
Additional email users are available in the configuration
Applied to: Extract Next Email User ID
WHEN
The system processes the next email user
THEN
The next email user ID is extracted for validation
Context: All email users have been processed and validated
GIVEN
All email users have been processed and validated
Applied to: Set Primary Email Distribution
WHEN
The system sets up the primary email distribution
THEN
A primary email distribution list is established with all valid users
Context: Primary email distribution has been attempted
GIVEN
Primary email distribution has been attempted
Applied to: Primary Email Failed?
WHEN
The system checks the success of primary email setup
THEN
Fallback procedures are initiated if primary email failed, otherwise processing continues normally
Context: Primary email distribution has failed
GIVEN
Primary email distribution has failed
Applied to: Set Fallback Email Recipients
WHEN
The system sets up fallback email recipients
THEN
Alternative email recipients are configured to ensure message delivery
Context: Fallback email recipients are being configured
GIVEN
Fallback email recipients are being configured
Applied to: Use OM01247/AEI9999 as Backup
WHEN
The system assigns backup email addresses
THEN
OM01247 and AEI9999 are set as backup email recipients
Context: Email distribution setup is complete (either primary or fallback)
GIVEN
Email distribution setup is complete (either primary or fallback)
Applied to: Finalize Email User List
WHEN
The system finalizes the email user list
THEN
The email user list is prepared and ready for message distribution
R-GCX146-cbl-01530 (+8) File: GCX146.cbl Report Line Segmentation and Buffer Management Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Line Segmentation and Buffer Management':
  • Context - an email report processing session is starting:
    For Initialize Line Counter WS-LINE-SUB:
    When the system begins processing report lines for email transmission, then the line counter should be initialized to zero to start counting from the beginning.
  • Context - an email report is being processed with accumulated lines:
    For Line Counter > 699?:
    When the line counter exceeds 699 lines in the current email segment, then the current email batch should be sent and a new email segment should be prepared.
  • Context - an email report batch has reached the maximum line limit of 699 lines:
    For Call X280-CALL-EMCSEND3 to Send Current Batch:
    When the system needs to send the current batch, then the email sending service should be invoked to transmit the current batch.
  • Context - an email batch has been sent successfully:
    For Reset Message Buffer:
    When the system needs to prepare for additional report lines, then the message buffer should be cleared and reset for the next email segment.
  • Context - an email report has been split into multiple segments due to line limits:
    For Add CONTINUATION OF REPORT Header:
    When a new email segment is being prepared after the first segment, then a 'continuation of report' header should be added to identify the segment as a continuation.
  • Context - a new email segment is being prepared after sending a previous batch:
    For Reset Line Counter:
    When the system starts processing lines for the new segment, then the line counter should be reset to zero to track lines in the new segment.
  • Context - an email report is being processed with multiple segments:
    For Reached Maximum 1981 Lines?:
    When the total number of lines processed reaches 1981 lines, then the maximum lines reached flag should be set and no additional lines should be processed.
  • Context - the email report processing has reached the maximum limit of 1981 lines:
    For Set MAX-LINES-REACHED Flag:
    When the system detects the line limit has been exceeded, then the max-lines-reached flag should be set to prevent further line processing.
  • Context - all available report lines have been processed for email transmission:
    For Set NO-MORE-EMAIL Flag:
    When there are no more lines to process in the report, then the no-more-email flag should be set to indicate completion of email processing.
👨‍💻 Technical ACs (Gherkin)
Context: An email report processing session is starting
GIVEN
An email report processing session is starting
Applied to: Initialize Line Counter WS-LINE-SUB
WHEN
The system begins processing report lines for email transmission
THEN
The line counter should be initialized to zero to start counting from the beginning
Context: An email report is being processed with accumulated lines
GIVEN
An email report is being processed with accumulated lines
Applied to: Line Counter > 699?
WHEN
The line counter exceeds 699 lines in the current email segment
THEN
The current email batch should be sent and a new email segment should be prepared
Context: An email report batch has reached the maximum line limit of 699 lines
GIVEN
An email report batch has reached the maximum line limit of 699 lines
Applied to: Call X280-CALL-EMCSEND3 to Send Current Batch
WHEN
The system needs to send the current batch
THEN
The email sending service should be invoked to transmit the current batch
Context: An email batch has been sent successfully
GIVEN
An email batch has been sent successfully
Applied to: Reset Message Buffer
WHEN
The system needs to prepare for additional report lines
THEN
The message buffer should be cleared and reset for the next email segment
Context: An email report has been split into multiple segments due to line limits
GIVEN
An email report has been split into multiple segments due to line limits
Applied to: Add CONTINUATION OF REPORT Header
WHEN
A new email segment is being prepared after the first segment
THEN
A 'CONTINUATION OF REPORT' header should be added to identify the segment as a continuation
Context: A new email segment is being prepared after sending a previous batch
GIVEN
A new email segment is being prepared after sending a previous batch
Applied to: Reset Line Counter
WHEN
The system starts processing lines for the new segment
THEN
The line counter should be reset to zero to track lines in the new segment
Context: An email report is being processed with multiple segments
GIVEN
An email report is being processed with multiple segments
Applied to: Reached Maximum 1981 Lines?
WHEN
The total number of lines processed reaches 1981 lines
THEN
The maximum lines reached flag should be set and no additional lines should be processed
Context: The email report processing has reached the maximum limit of 1981 lines
GIVEN
The email report processing has reached the maximum limit of 1981 lines
Applied to: Set MAX-LINES-REACHED Flag
WHEN
The system detects the line limit has been exceeded
THEN
The MAX-LINES-REACHED flag should be set to prevent further line processing
Context: All available report lines have been processed for email transmission
GIVEN
All available report lines have been processed for email transmission
Applied to: Set NO-MORE-EMAIL Flag
WHEN
There are no more lines to process in the report
THEN
The NO-MORE-EMAIL flag should be set to indicate completion of email processing
R-GCX146-cbl-01539 (+10) File: GCX146.cbl FAX Routing Parameter Configuration Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'FAX Routing Parameter Configuration':
  • Context - a station configuration record exists in gcstbrt:
    For Check Auto-FAX Setting:
    When the system checks the auto-fax setting, then the system reads the gcstbrt-ad-auto-fax field to determine if automatic fax is enabled.
  • Context - the auto-fax setting has been retrieved from station configuration:
    For Auto-FAX Enabled?:
    When the gcstbrt-ad-auto-fax field equals 'y', then the system proceeds to set fax routing flag, otherwise skips fax configuration.
  • Context - auto-fax is enabled (gcstbrt-ad-auto-fax = 'y'):
    For Set FAX Routing Flag:
    When the system processes fax routing configuration, then the system sets ws-fax-routing to 'y' to enable fax routing functionality.
  • Context - fax routing flag has been set to 'y':
    For Configure Copy Distribution IDs:
    When the system configures copy distribution parameters, then the system sets up copy distribution ids for proper fax message routing.
  • Context - copy distribution ids have been configured:
    For Set External FAX Addressing:
    When the system sets up external fax addressing, then the system configures external fax address parameters for proper message delivery.
  • Context - external fax addressing has been configured:
    For Apply Station FAX Configuration:
    When the system applies station fax configuration, then the system retrieves and applies station-specific fax settings from gcstbrt configuration.
  • Context - station fax configuration has been applied:
    For Station FAX Flag Set?:
    When the system checks the station fax flag (gcstbrt-sc-fax-flag), then the system determines whether to enable fax routing based on the flag setting.
  • Context - station fax flag is set in the configuration:
    For Enable FAX Routing:
    When the system enables fax routing, then the system activates fax routing capabilities for the station.
  • Context - fax routing has been enabled:
    For Configure FAX Parameters:
    When the system configures fax parameters, then the system applies final fax routing settings and completes the configuration process.
  • Context - fax configuration process has been executed (either enabled or skipped):
    For Complete FAX Configuration:
    When the system completes fax configuration, then the system finalizes the fax routing configuration and continues with normal processing.
  • Context - either auto-fax is disabled (gcstbrt-ad-auto-fax ≠ 'y') or station fax flag is not set:
    For Skip FAX Configuration:
    When the system processes fax configuration, then the system skips all fax routing configuration steps and proceeds to completion.
👨‍💻 Technical ACs (Gherkin)
Context: A station configuration record exists in GCSTBRT
GIVEN
A station configuration record exists in GCSTBRT
Applied to: Check Auto-FAX Setting
WHEN
The system checks the Auto-FAX setting
THEN
The system reads the GCSTBRT-AD-AUTO-FAX field to determine if automatic FAX is enabled
Context: The Auto-FAX setting has been retrieved from station configuration
GIVEN
The Auto-FAX setting has been retrieved from station configuration
Applied to: Auto-FAX Enabled?
WHEN
The GCSTBRT-AD-AUTO-FAX field equals 'Y'
THEN
The system proceeds to set FAX routing flag, otherwise skips FAX configuration
Context: Auto-FAX is enabled (GCSTBRT-AD-AUTO-FAX = 'Y')
GIVEN
Auto-FAX is enabled (GCSTBRT-AD-AUTO-FAX = 'Y')
Applied to: Set FAX Routing Flag
WHEN
The system processes FAX routing configuration
THEN
The system sets WS-FAX-ROUTING to 'Y' to enable FAX routing functionality
Context: FAX routing flag has been set to 'Y'
GIVEN
FAX routing flag has been set to 'Y'
Applied to: Configure Copy Distribution IDs
WHEN
The system configures copy distribution parameters
THEN
The system sets up copy distribution IDs for proper FAX message routing
Context: Copy distribution IDs have been configured
GIVEN
Copy distribution IDs have been configured
Applied to: Set External FAX Addressing
WHEN
The system sets up external FAX addressing
THEN
The system configures external FAX address parameters for proper message delivery
Context: External FAX addressing has been configured
GIVEN
External FAX addressing has been configured
Applied to: Apply Station FAX Configuration
WHEN
The system applies station FAX configuration
THEN
The system retrieves and applies station-specific FAX settings from GCSTBRT configuration
Context: Station FAX configuration has been applied
GIVEN
Station FAX configuration has been applied
Applied to: Station FAX Flag Set?
WHEN
The system checks the station FAX flag (GCSTBRT-SC-FAX-FLAG)
THEN
The system determines whether to enable FAX routing based on the flag setting
Context: Station FAX flag is set in the configuration
GIVEN
Station FAX flag is set in the configuration
Applied to: Enable FAX Routing
WHEN
The system enables FAX routing
THEN
The system activates FAX routing capabilities for the station
Context: FAX routing has been enabled
GIVEN
FAX routing has been enabled
Applied to: Configure FAX Parameters
WHEN
The system configures FAX parameters
THEN
The system applies final FAX routing settings and completes the configuration process
Context: FAX configuration process has been executed (either enabled or skipped)
GIVEN
FAX configuration process has been executed (either enabled or skipped)
Applied to: Complete FAX Configuration
WHEN
The system completes FAX configuration
THEN
The system finalizes the FAX routing configuration and continues with normal processing
Context: Either Auto-FAX is disabled (GCSTBRT-AD-AUTO-FAX ≠ 'Y') or station FAX flag is not set
GIVEN
Either Auto-FAX is disabled (GCSTBRT-AD-AUTO-FAX ≠ 'Y') or station FAX flag is not set
Applied to: Skip FAX Configuration
WHEN
The system processes FAX configuration
THEN
The system skips all FAX routing configuration steps and proceeds to completion
R-GCX146-cbl-01550 (+7) File: GCX146.cbl Message Line Formatting and Segmentation Rules Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Line Formatting and Segmentation Rules':
  • Context - an email message is being prepared for transmission:
    For Line Count > 699?:
    When the system counts the number of lines in the message, then if line count exceeds 699 lines, the system triggers message segmentation process.
  • Context - an email message exceeds 699 lines:
    For Apply Line Segmentation:
    When the system applies line segmentation, then the message is split into segments of maximum 699 lines each for separate transmission.
  • Context - a message has been segmented due to line count exceeding 699:
    For Add Continuation Header:
    When the system processes continuation segments, then each continuation segment includes header 'continuation of report ....' to identify it as part of original message.
  • Context - a message segment has been sent for transmission:
    For Reset Message Buffer:
    When the system prepares for the next message segment, then the message buffer is reset to prepare for new content.
  • Context - a message batch is ready for transmission:
    For Send Current Message Batch:
    When the system initiates transmission process, then the emcsend3 email service is invoked to deliver the message.
  • Context - message content is ready for formatting:
    For Apply Merlin Transmission Rules:
    When the system applies merlin transmission rules, then message is formatted according to merlin system requirements for proper transmission.
  • Context - report lines are being processed for message formatting:
    For More Lines to Process?:
    When the system checks for remaining unprocessed lines, then if more lines exist, processing continues; otherwise, message formatting is finalized.
  • Context - all report lines have been processed and formatted:
    For Finalize Message Format:
    When no more lines remain to be processed, then the system finalizes the message format and prepares it for transmission.
👨‍💻 Technical ACs (Gherkin)
Context: An email message is being prepared for transmission
GIVEN
An email message is being prepared for transmission
Applied to: Line Count > 699?
WHEN
The system counts the number of lines in the message
THEN
If line count exceeds 699 lines, the system triggers message segmentation process
Context: An email message exceeds 699 lines
GIVEN
An email message exceeds 699 lines
Applied to: Apply Line Segmentation
WHEN
The system applies line segmentation
THEN
The message is split into segments of maximum 699 lines each for separate transmission
Context: A message has been segmented due to line count exceeding 699
GIVEN
A message has been segmented due to line count exceeding 699
Applied to: Add Continuation Header
WHEN
The system processes continuation segments
THEN
Each continuation segment includes header 'CONTINUATION OF REPORT ....' to identify it as part of original message
Context: A message segment has been sent for transmission
GIVEN
A message segment has been sent for transmission
Applied to: Reset Message Buffer
WHEN
The system prepares for the next message segment
THEN
The message buffer is reset to prepare for new content
Context: A message batch is ready for transmission
GIVEN
A message batch is ready for transmission
Applied to: Send Current Message Batch
WHEN
The system initiates transmission process
THEN
The EMCSEND3 email service is invoked to deliver the message
Context: Message content is ready for formatting
GIVEN
Message content is ready for formatting
Applied to: Apply Merlin Transmission Rules
WHEN
The system applies Merlin transmission rules
THEN
Message is formatted according to Merlin system requirements for proper transmission
Context: Report lines are being processed for message formatting
GIVEN
Report lines are being processed for message formatting
Applied to: More Lines to Process?
WHEN
The system checks for remaining unprocessed lines
THEN
If more lines exist, processing continues; otherwise, message formatting is finalized
Context: All report lines have been processed and formatted
GIVEN
All report lines have been processed and formatted
Applied to: Finalize Message Format
WHEN
No more lines remain to be processed
THEN
The system finalizes the message format and prepares it for transmission
R-GCX146-cbl-01558 (+11) File: GCX146.cbl Return Movement Pattern Analysis Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Return Movement Pattern Analysis':
  • Context - a cargo shipment with origin and destination information:
    For Analyze Cargo Movement Patterns to Identify Valid Return Scenarios from US to Canada:
    When the system analyzes the movement pattern, then the system determines if this represents a valid us to canada return movement based on origin/destination codes.
  • Context - cargo with origin and destination location codes:
    For Cargo Moving from US to Canada?:
    When the origin is a us state code and destination is a canadian province code, then the system identifies this as a us to canada movement eligible for return processing.
  • Context - equipment identified for potential return movement:
    For Check Equipment Waybill Data:
    When the system checks for associated waybill data, then the system retrieves waybill information including shipper, consignee, and routing details.
  • Context - a destination location code from waybill data:
    For Validate Canadian Destination:
    When the destination code is checked against canadian province list (nf, pe, ns, nb, pq, on, mb, sk, ab, bc, yt, nt), then the system confirms if the destination is a valid canadian location.
  • Context - cargo movement from us to canada with valid waybill and destination data:
    For Valid Return Scenario?:
    When all return movement criteria are evaluated, then the system determines if this qualifies as a valid return scenario for ccn processing.
  • Context - valid waybill data for return movement:
    For Extract Shipper/Consignee Information:
    When the system processes the waybill information, then the system extracts shipper name, consignee name, and related party information for ccn record creation.
  • Context - valid return movement with equipment and waybill data:
    For Build Return CCN with 6105E Prefix:
    When a return ccn needs to be created, then the system builds ccn key with format: '6' + '105' + 'e' + equipment_id + waybill_date + sequence_number.
  • Context - valid return movement scenario:
    For Set Transit Status to 'R' for Return:
    When transit status needs to be set for the cargo, then the system assigns transit status 'r' to indicate return movement.
  • Context - ccn record being created for return movement:
    For Set CCN Status to 'RETURN':
    When ccn status needs to be assigned, then the system sets ccn status to 'return' to indicate return cargo processing.
  • Context - return ccn record structure and extracted waybill data:
    For Populate Return Movement Data:
    When return movement data needs to be populated, then the system populates shipper, consignee, origin station, destination station, and sets application type to '33' for canadian customs.
  • Context - fully populated return movement data:
    For Create Return CCN Record:
    When return ccn record needs to be persisted, then the system creates the ccn database record with return status and all associated movement data.
  • Context - successfully created return ccn record:
    For Log Return Movement Pattern:
    When return movement processing is complete, then the system creates audit trail entry via gcx105 spawning to log the return movement pattern.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment with origin and destination information
GIVEN
A cargo shipment with origin and destination information
Applied to: Analyze Cargo Movement Patterns to Identify Valid Return Scenarios from US to Canada
WHEN
The system analyzes the movement pattern
THEN
The system determines if this represents a valid US to Canada return movement based on origin/destination codes
Context: Cargo with origin and destination location codes
GIVEN
Cargo with origin and destination location codes
Applied to: Cargo Moving from US to Canada?
WHEN
The origin is a US state code and destination is a Canadian province code
THEN
The system identifies this as a US to Canada movement eligible for return processing
Context: Equipment identified for potential return movement
GIVEN
Equipment identified for potential return movement
Applied to: Check Equipment Waybill Data
WHEN
The system checks for associated waybill data
THEN
The system retrieves waybill information including shipper, consignee, and routing details
Context: A destination location code from waybill data
GIVEN
A destination location code from waybill data
Applied to: Validate Canadian Destination
WHEN
The destination code is checked against Canadian province list (NF, PE, NS, NB, PQ, ON, MB, SK, AB, BC, YT, NT)
THEN
The system confirms if the destination is a valid Canadian location
Context: Cargo movement from US to Canada with valid waybill and destination data
GIVEN
Cargo movement from US to Canada with valid waybill and destination data
Applied to: Valid Return Scenario?
WHEN
All return movement criteria are evaluated
THEN
The system determines if this qualifies as a valid return scenario for CCN processing
Context: Valid waybill data for return movement
GIVEN
Valid waybill data for return movement
Applied to: Extract Shipper/Consignee Information
WHEN
The system processes the waybill information
THEN
The system extracts shipper name, consignee name, and related party information for CCN record creation
Context: Valid return movement with equipment and waybill data
GIVEN
Valid return movement with equipment and waybill data
Applied to: Build Return CCN with 6105E Prefix
WHEN
A return CCN needs to be created
THEN
The system builds CCN key with format: '6' + '105' + 'E' + equipment_id + waybill_date + sequence_number
Context: Valid return movement scenario
GIVEN
Valid return movement scenario
Applied to: Set Transit Status to 'R' for Return
WHEN
Transit status needs to be set for the cargo
THEN
The system assigns transit status 'R' to indicate return movement
Context: CCN record being created for return movement
GIVEN
CCN record being created for return movement
Applied to: Set CCN Status to 'RETURN'
WHEN
CCN status needs to be assigned
THEN
The system sets CCN status to 'RETURN' to indicate return cargo processing
Context: Return CCN record structure and extracted waybill data
GIVEN
Return CCN record structure and extracted waybill data
Applied to: Populate Return Movement Data
WHEN
Return movement data needs to be populated
THEN
The system populates shipper, consignee, origin station, destination station, and sets application type to '33' for Canadian customs
Context: Fully populated return movement data
GIVEN
Fully populated return movement data
Applied to: Create Return CCN Record
WHEN
Return CCN record needs to be persisted
THEN
The system creates the CCN database record with return status and all associated movement data
Context: Successfully created return CCN record
GIVEN
Successfully created return CCN record
Applied to: Log Return Movement Pattern
WHEN
Return movement processing is complete
THEN
The system creates audit trail entry via GCX105 spawning to log the return movement pattern
R-GCX146-cbl-01570 (+11) File: GCX146.cbl CCN Number Compression and Formatting Rules Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Number Compression and Formatting Rules':
  • Context - a ccn number needs to be compressed:
    For Initialize CCN Compression Variables:
    When the compression process begins, then all compression variables are initialized to their default values and workspace areas are cleared.
  • Context - a ccn number contains space characters:
    For Remove Spaces from CCN Number:
    When space removal processing is performed, then all spaces are removed from the ccn number and the result is stored for further processing.
  • Context - a ccn number without spaces exists:
    For Scan CCN Character by Character:
    When character-by-character scanning is performed, then each character is examined and categorized for appropriate processing.
  • Context - a character from the ccn number is being examined:
    For Character is Numeric?:
    When character type validation is performed, then the character is identified as either numeric (0-9) or non-numeric.
  • Context - a character has been identified as numeric:
    For Add to Numeric Sequence:
    When numeric sequence processing occurs, then the numeric character is added to the current numeric sequence.
  • Context - a character has been identified as non-numeric:
    For Process Non-Numeric Character:
    When non-numeric character processing occurs, then the character is processed according to ccn compression rules for non-numeric elements.
  • Context - numeric sequences have been collected from the ccn number:
    For Organize Numeric Sequences:
    When sequence organization processing occurs, then numeric sequences are organized according to ccn compression algorithm requirements.
  • Context - numeric sequences have been organized and characters processed:
    For Apply CCN Formatting Rules:
    When ccn formatting rules are applied, then the ccn is formatted according to standard compression formatting requirements.
  • Context - a ccn has been compressed and formatted:
    For Validate Compressed CCN Format:
    When format validation is performed, then the compressed ccn format is validated against business rules and either accepted or rejected.
  • Context - a ccn has passed compression format validation:
    For Store Compressed CCN:
    When ccn storage processing occurs, then the compressed ccn is stored and made available for subsequent business operations.
  • Context - a ccn has failed compression format validation:
    For Set Compression Error Flag:
    When error handling processing occurs, then compression error flags are set to indicate the failure condition.
  • Context - ccn compression processing has been performed:
    For Complete CCN Compression:
    When process completion occurs, then the ccn compression process is finalized with either successful compression or error status.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN number needs to be compressed
GIVEN
A CCN number needs to be compressed
Applied to: Initialize CCN Compression Variables
WHEN
The compression process begins
THEN
All compression variables are initialized to their default values and workspace areas are cleared
Context: A CCN number contains space characters
GIVEN
A CCN number contains space characters
Applied to: Remove Spaces from CCN Number
WHEN
Space removal processing is performed
THEN
All spaces are removed from the CCN number and the result is stored for further processing
Context: A CCN number without spaces exists
GIVEN
A CCN number without spaces exists
Applied to: Scan CCN Character by Character
WHEN
Character-by-character scanning is performed
THEN
Each character is examined and categorized for appropriate processing
Context: A character from the CCN number is being examined
GIVEN
A character from the CCN number is being examined
Applied to: Character is Numeric?
WHEN
Character type validation is performed
THEN
The character is identified as either numeric (0-9) or non-numeric
Context: A character has been identified as numeric
GIVEN
A character has been identified as numeric
Applied to: Add to Numeric Sequence
WHEN
Numeric sequence processing occurs
THEN
The numeric character is added to the current numeric sequence
Context: A character has been identified as non-numeric
GIVEN
A character has been identified as non-numeric
Applied to: Process Non-Numeric Character
WHEN
Non-numeric character processing occurs
THEN
The character is processed according to CCN compression rules for non-numeric elements
Context: Numeric sequences have been collected from the CCN number
GIVEN
Numeric sequences have been collected from the CCN number
Applied to: Organize Numeric Sequences
WHEN
Sequence organization processing occurs
THEN
Numeric sequences are organized according to CCN compression algorithm requirements
Context: Numeric sequences have been organized and characters processed
GIVEN
Numeric sequences have been organized and characters processed
Applied to: Apply CCN Formatting Rules
WHEN
CCN formatting rules are applied
THEN
The CCN is formatted according to standard compression formatting requirements
Context: A CCN has been compressed and formatted
GIVEN
A CCN has been compressed and formatted
Applied to: Validate Compressed CCN Format
WHEN
Format validation is performed
THEN
The compressed CCN format is validated against business rules and either accepted or rejected
Context: A CCN has passed compression format validation
GIVEN
A CCN has passed compression format validation
Applied to: Store Compressed CCN
WHEN
CCN storage processing occurs
THEN
The compressed CCN is stored and made available for subsequent business operations
Context: A CCN has failed compression format validation
GIVEN
A CCN has failed compression format validation
Applied to: Set Compression Error Flag
WHEN
Error handling processing occurs
THEN
Compression error flags are set to indicate the failure condition
Context: CCN compression processing has been performed
GIVEN
CCN compression processing has been performed
Applied to: Complete CCN Compression
WHEN
Process completion occurs
THEN
The CCN compression process is finalized with either successful compression or error status
R-GCX146-cbl-01582 (+4) File: GCX146.cbl Execute Enhanced Search with FWCARGET Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Enhanced Search with FWCARGET':
  • Context - an equipment id is available for waybill lookup:
    For Call FWCARGET Module:
    When the system calls fwcarget module with the equipment id as search key, then the system should attempt to retrieve waybill data from the shipment database.
  • Context - fwcarget module has completed the search operation:
    For Search Successful?:
    When the system checks the search result status, then the system should determine whether the search was successful or failed based on the return status.
  • Context - fwcarget search operation was successful:
    For Set WS-WAYBILL-FOUND Flag:
    When valid waybill data is available from the search result, then the system should set the waybill found flag to indicate successful data retrieval.
  • Context - waybill data has been successfully retrieved from fwcarget:
    For Extract Waybill Information:
    When the system processes the retrieved waybill record, then the system should extract and store the waybill information in working storage variables.
  • Context - fwcarget search operation failed to find waybill data:
    For Set WS-WAYBILL-NOT-FOUND Flag:
    When no valid waybill record is returned from the search, then the system should set the waybill not found flag and prepare for inquiry database fallback search.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID is available for waybill lookup
GIVEN
An equipment ID is available for waybill lookup
Applied to: Call FWCARGET Module
WHEN
The system calls FWCARGET module with the equipment ID as search key
THEN
The system should attempt to retrieve waybill data from the shipment database
Context: FWCARGET module has completed the search operation
GIVEN
FWCARGET module has completed the search operation
Applied to: Search Successful?
WHEN
The system checks the search result status
THEN
The system should determine whether the search was successful or failed based on the return status
Context: FWCARGET search operation was successful
GIVEN
FWCARGET search operation was successful
Applied to: Set WS-WAYBILL-FOUND Flag
WHEN
Valid waybill data is available from the search result
THEN
The system should set the waybill found flag to indicate successful data retrieval
Context: Waybill data has been successfully retrieved from FWCARGET
GIVEN
Waybill data has been successfully retrieved from FWCARGET
Applied to: Extract Waybill Information
WHEN
The system processes the retrieved waybill record
THEN
The system should extract and store the waybill information in working storage variables
Context: FWCARGET search operation failed to find waybill data
GIVEN
FWCARGET search operation failed to find waybill data
Applied to: Set WS-WAYBILL-NOT-FOUND Flag
WHEN
No valid waybill record is returned from the search
THEN
The system should set the waybill not found flag and prepare for inquiry database fallback search
R-GCX146-cbl-01587 (+12) File: GCX146.cbl Process Individual Container Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Individual Container':
  • Context - a flat car is being processed for containers:
    For Access Container Record on Flat Car:
    When the system attempts to access container records on the flat car, then container records are retrieved from the container database for further processing.
  • Context - container record access has been attempted for a flat car:
    For Container Record Found?:
    When the system checks for container record existence, then processing continues if container records are found, otherwise container processing terminates with error.
  • Context - a valid container record has been found:
    For Extract Container ID from Record:
    When the system processes the container record, then the container id is extracted from the record for validation and further processing.
  • Context - a container id has been extracted from the container record:
    For Validate Container ID Format:
    When the system validates the container id format, then processing continues if the container id format is valid, otherwise container processing terminates with error.
  • Context - a container id has been validated as having correct format:
    For Perform Container Waybill Lookup:
    When the system performs waybill lookup for the container, then waybill information is retrieved from the waybill database for the container.
  • Context - waybill lookup has been performed for a container:
    For Container Waybill Found?:
    When the system checks for waybill existence, then if waybill is found, container details are extracted; if not found, system attempts inquiry database lookup.
  • Context - container waybill was not found in primary lookup:
    For Access Container Inquiry Database:
    When the system accesses the container inquiry database, then alternative container information is retrieved from the inquiry database.
  • Context - container inquiry database has been accessed:
    For Inquiry Data Available?:
    When the system checks for inquiry data availability, then if inquiry data is available, container details are extracted; otherwise container processing terminates with error.
  • Context - container information is available from either waybill or inquiry database:
    For Extract Container Equipment Details:
    When the system extracts container equipment details, then complete container equipment information including specifications and characteristics is retrieved.
  • Context - container equipment details have been extracted:
    For Set Container Processing Flags:
    When the system sets container processing flags, then processing flags are assigned to indicate container status, type, and processing requirements.
  • Context - container processing flags have been set:
    For Determine Container Load/Empty Status:
    When the system determines container load status, then container is classified as either loaded or empty based on cargo information and processing flags.
  • Context - container load/empty status has been determined:
    For Assign Container to Equipment List:
    When the system assigns the container to equipment list, then container is added to the train's equipment list with all relevant details and status information.
  • Context - current container has been assigned to equipment list:
    For Move to Next Container on Flat Car:
    When the system moves to next container on flat car, then processing continues with the next container on the same flat car, or completes if no more containers exist.
👨‍💻 Technical ACs (Gherkin)
Context: A flat car is being processed for containers
GIVEN
A flat car is being processed for containers
Applied to: Access Container Record on Flat Car
WHEN
The system attempts to access container records on the flat car
THEN
Container records are retrieved from the container database for further processing
Context: Container record access has been attempted for a flat car
GIVEN
Container record access has been attempted for a flat car
Applied to: Container Record Found?
WHEN
The system checks for container record existence
THEN
Processing continues if container records are found, otherwise container processing terminates with error
Context: A valid container record has been found
GIVEN
A valid container record has been found
Applied to: Extract Container ID from Record
WHEN
The system processes the container record
THEN
The container ID is extracted from the record for validation and further processing
Context: A container ID has been extracted from the container record
GIVEN
A container ID has been extracted from the container record
Applied to: Validate Container ID Format
WHEN
The system validates the container ID format
THEN
Processing continues if the container ID format is valid, otherwise container processing terminates with error
Context: A container ID has been validated as having correct format
GIVEN
A container ID has been validated as having correct format
Applied to: Perform Container Waybill Lookup
WHEN
The system performs waybill lookup for the container
THEN
Waybill information is retrieved from the waybill database for the container
Context: Waybill lookup has been performed for a container
GIVEN
Waybill lookup has been performed for a container
Applied to: Container Waybill Found?
WHEN
The system checks for waybill existence
THEN
If waybill is found, container details are extracted; if not found, system attempts inquiry database lookup
Context: Container waybill was not found in primary lookup
GIVEN
Container waybill was not found in primary lookup
Applied to: Access Container Inquiry Database
WHEN
The system accesses the container inquiry database
THEN
Alternative container information is retrieved from the inquiry database
Context: Container inquiry database has been accessed
GIVEN
Container inquiry database has been accessed
Applied to: Inquiry Data Available?
WHEN
The system checks for inquiry data availability
THEN
If inquiry data is available, container details are extracted; otherwise container processing terminates with error
Context: Container information is available from either waybill or inquiry database
GIVEN
Container information is available from either waybill or inquiry database
Applied to: Extract Container Equipment Details
WHEN
The system extracts container equipment details
THEN
Complete container equipment information including specifications and characteristics is retrieved
Context: Container equipment details have been extracted
GIVEN
Container equipment details have been extracted
Applied to: Set Container Processing Flags
WHEN
The system sets container processing flags
THEN
Processing flags are assigned to indicate container status, type, and processing requirements
Context: Container processing flags have been set
GIVEN
Container processing flags have been set
Applied to: Determine Container Load/Empty Status
WHEN
The system determines container load status
THEN
Container is classified as either loaded or empty based on cargo information and processing flags
Context: Container load/empty status has been determined
GIVEN
Container load/empty status has been determined
Applied to: Assign Container to Equipment List
WHEN
The system assigns the container to equipment list
THEN
Container is added to the train's equipment list with all relevant details and status information
Context: Current container has been assigned to equipment list
GIVEN
Current container has been assigned to equipment list
Applied to: Move to Next Container on Flat Car
WHEN
The system moves to next container on flat car
THEN
Processing continues with the next container on the same flat car, or completes if no more containers exist
R-GCX146-cbl-01600 (+17) File: GCX146.cbl Retrieve Current CCN Status Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Current CCN Status':
  • Context - an equipment id is provided for ccn status lookup:
    For Access CCN Database Using Equipment ID:
    When the system accesses the gcccrt ccn database using the equipment id, then the system retrieves the ccn record if it exists in the database.
  • Context - a database lookup has been performed for an equipment id:
    For CCN Record Found?:
    When the system checks if a ccn record was found, then the system determines whether to proceed with status retrieval or handle missing ccn scenario.
  • Context - a valid ccn record exists for the equipment:
    For Retrieve Current CCN Status:
    When the system accesses the ccn record, then the current ccn status is retrieved from the record.
  • Context - a valid ccn record exists with current status retrieved:
    For Retrieve Transit Status Code:
    When the system accesses the transit status field in the ccn record, then the transit status code is retrieved for further processing.
  • Context - a ccn record with current status and transit status code:
    For Status = RELEASE?:
    When the system evaluates if the current status equals release, then the system branches to release-specific status determination logic or continues to other status checks.
  • Context - equipment has release status:
    For Transit Status = E or Z?:
    When the transit status code is e (export) or z (export zone), then the system sets the equipment status to export.
  • Context - equipment has release status and transit status is e or z:
    For Set Status to EXPORT:
    When the system processes the status assignment, then the equipment status is set to export.
  • Context - equipment has release status and transit status is not e or z:
    For S.A.R. Release?:
    When the system checks if the release is by s.a.r., then the system determines whether to set s.a.r. status or keep standard release status.
  • Context - equipment has release status and is identified as s.a.r. release:
    For Set Status to S.A.R.:
    When the system processes the s.a.r. status assignment, then the equipment status is set to s.a.r..
  • Context - equipment has release status but is not export transit and not s.a.r. release:
    For Keep Status as RELEASE:
    When the system processes the status assignment, then the equipment status remains as release.
  • Context - equipment does not have release status:
    For Transit Status = T?:
    When the transit status code is t (transit), then the system sets the equipment status to transit.
  • Context - equipment has transit status code t:
    For Set Status to TRANSIT:
    When the system processes the status assignment, then the equipment status is set to transit.
  • Context - equipment does not have release status and transit status is not t:
    For Transit Status = R?:
    When the transit status code is r (return), then the system sets the equipment status to return.
  • Context - equipment has transit status code r:
    For Set Status to RETURN:
    When the system processes the status assignment, then the equipment status is set to return.
  • Context - equipment does not qualify for release, transit, or return status mapping:
    For Keep Current Status:
    When the system processes the status assignment, then the equipment retains its original ccn status.
  • Context - a status has been determined through the status mapping logic:
    For Update Equipment Status Record:
    When the system updates the equipment record, then the equipment status record is updated with the final determined status.
  • Context - the equipment status has been determined and record updated:
    For Return Current CCN Status:
    When the system completes the ccn status retrieval process, then the final ccn status is returned to the calling process.
  • Context - no ccn record exists for the equipment id:
    For CCN Not Found - Set Empty Status:
    When the system processes the missing ccn scenario, then the system sets an empty or default status and returns it.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID is provided for CCN status lookup
GIVEN
An equipment ID is provided for CCN status lookup
Applied to: Access CCN Database Using Equipment ID
WHEN
The system accesses the GCCCRT CCN database using the equipment ID
THEN
The system retrieves the CCN record if it exists in the database
Context: A database lookup has been performed for an equipment ID
GIVEN
A database lookup has been performed for an equipment ID
Applied to: CCN Record Found?
WHEN
The system checks if a CCN record was found
THEN
The system determines whether to proceed with status retrieval or handle missing CCN scenario
Context: A valid CCN record exists for the equipment
GIVEN
A valid CCN record exists for the equipment
Applied to: Retrieve Current CCN Status
WHEN
The system accesses the CCN record
THEN
The current CCN status is retrieved from the record
Context: A valid CCN record exists with current status retrieved
GIVEN
A valid CCN record exists with current status retrieved
Applied to: Retrieve Transit Status Code
WHEN
The system accesses the transit status field in the CCN record
THEN
The transit status code is retrieved for further processing
Context: A CCN record with current status and transit status code
GIVEN
A CCN record with current status and transit status code
Applied to: Status = RELEASE?
WHEN
The system evaluates if the current status equals RELEASE
THEN
The system branches to release-specific status determination logic or continues to other status checks
Context: Equipment has RELEASE status
GIVEN
Equipment has RELEASE status
Applied to: Transit Status = E or Z?
WHEN
The transit status code is E (Export) or Z (Export Zone)
THEN
The system sets the equipment status to EXPORT
Context: Equipment has RELEASE status and transit status is E or Z
GIVEN
Equipment has RELEASE status and transit status is E or Z
Applied to: Set Status to EXPORT
WHEN
The system processes the status assignment
THEN
The equipment status is set to EXPORT
Context: Equipment has RELEASE status and transit status is not E or Z
GIVEN
Equipment has RELEASE status and transit status is not E or Z
Applied to: S.A.R. Release?
WHEN
The system checks if the release is by S.A.R.
THEN
The system determines whether to set S.A.R. status or keep standard RELEASE status
Context: Equipment has RELEASE status and is identified as S.A.R. release
GIVEN
Equipment has RELEASE status and is identified as S.A.R. release
Applied to: Set Status to S.A.R.
WHEN
The system processes the S.A.R. status assignment
THEN
The equipment status is set to S.A.R.
Context: Equipment has RELEASE status but is not export transit and not S.A.R. release
GIVEN
Equipment has RELEASE status but is not export transit and not S.A.R. release
Applied to: Keep Status as RELEASE
WHEN
The system processes the status assignment
THEN
The equipment status remains as RELEASE
Context: Equipment does not have RELEASE status
GIVEN
Equipment does not have RELEASE status
Applied to: Transit Status = T?
WHEN
The transit status code is T (Transit)
THEN
The system sets the equipment status to TRANSIT
Context: Equipment has transit status code T
GIVEN
Equipment has transit status code T
Applied to: Set Status to TRANSIT
WHEN
The system processes the status assignment
THEN
The equipment status is set to TRANSIT
Context: Equipment does not have RELEASE status and transit status is not T
GIVEN
Equipment does not have RELEASE status and transit status is not T
Applied to: Transit Status = R?
WHEN
The transit status code is R (Return)
THEN
The system sets the equipment status to RETURN
Context: Equipment has transit status code R
GIVEN
Equipment has transit status code R
Applied to: Set Status to RETURN
WHEN
The system processes the status assignment
THEN
The equipment status is set to RETURN
Context: Equipment does not qualify for RELEASE, TRANSIT, or RETURN status mapping
GIVEN
Equipment does not qualify for RELEASE, TRANSIT, or RETURN status mapping
Applied to: Keep Current Status
WHEN
The system processes the status assignment
THEN
The equipment retains its original CCN status
Context: A status has been determined through the status mapping logic
GIVEN
A status has been determined through the status mapping logic
Applied to: Update Equipment Status Record
WHEN
The system updates the equipment record
THEN
The equipment status record is updated with the final determined status
Context: The equipment status has been determined and record updated
GIVEN
The equipment status has been determined and record updated
Applied to: Return Current CCN Status
WHEN
The system completes the CCN status retrieval process
THEN
The final CCN status is returned to the calling process
Context: No CCN record exists for the equipment ID
GIVEN
No CCN record exists for the equipment ID
Applied to: CCN Not Found - Set Empty Status
WHEN
The system processes the missing CCN scenario
THEN
The system sets an empty or default status and returns it
R-GCX146-cbl-01618 (+4) File: GCX146.cbl Check Container Load Status Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Container Load Status':
  • Context - equipment record exists with load/empty indicator:
    For Check Container Load Status:
    When processing equipment for container identification, then system categorizes equipment as loaded (l) or empty (e) based on the load/empty indicator field.
  • Context - equipment is identified as a flat car that may contain containers:
    For Check Container Load Status:
    When checking container load status, then system processes containers only if waybill is found for the equipment.
  • Context - flat car equipment record with potential multiple containers:
    For Check Container Load Status:
    When processing container load status, then system extracts and processes each container id from cross-reference records associated with the flat car.
  • Context - equipment is marked as loaded and operation type is add:
    For Check Container Load Status:
    When checking container load status, then system generates error 21 if no waybill is found for loaded equipment.
  • Context - equipment load/empty indicator shows 'e' (empty) and operation type is add:
    For Check Container Load Status:
    When checking container load status, then system allows processing to continue without requiring waybill documentation.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment record exists with load/empty indicator
GIVEN
Equipment record exists with load/empty indicator
Applied to: Check Container Load Status
WHEN
Processing equipment for container identification
THEN
System categorizes equipment as loaded (L) or empty (E) based on the load/empty indicator field
Context: Equipment is identified as a flat car that may contain containers
GIVEN
Equipment is identified as a flat car that may contain containers
Applied to: Check Container Load Status
WHEN
Checking container load status
THEN
System processes containers only if waybill is found for the equipment
Context: Flat car equipment record with potential multiple containers
GIVEN
Flat car equipment record with potential multiple containers
Applied to: Check Container Load Status
WHEN
Processing container load status
THEN
System extracts and processes each container ID from cross-reference records associated with the flat car
Context: Equipment is marked as loaded and operation type is ADD
GIVEN
Equipment is marked as loaded and operation type is ADD
Applied to: Check Container Load Status
WHEN
Checking container load status
THEN
System generates Error 21 if no waybill is found for loaded equipment
Context: Equipment load/empty indicator shows 'E' (empty) and operation type is ADD
GIVEN
Equipment load/empty indicator shows 'E' (empty) and operation type is ADD
Applied to: Check Container Load Status
WHEN
Checking container load status
THEN
System allows processing to continue without requiring waybill documentation
R-GCX146-cbl-01623 (+13) File: GCX146.cbl Check Trailer Load Status Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Trailer Load Status':
  • Context - equipment waybill data is available with equipment type information:
    For Extract Equipment Type from Waybill Data:
    When system extracts equipment type from waybill data, then equipment type is classified to determine if it is a trailer requiring load status processing.
  • Context - equipment type has been extracted from waybill data:
    For Is Equipment a Trailer?:
    When system checks if equipment type indicates a trailer, then equipment is identified as trailer or non-trailer for appropriate processing path.
  • Context - equipment is identified as a trailer type:
    For Retrieve Waybill Load/Empty Indicator:
    When system accesses waybill data for load/empty indicator, then load/empty status indicator is retrieved from waybill record.
  • Context - input load status is provided and waybill load status is retrieved:
    For Compare Input Load Status vs Waybill Status:
    When system compares input load status with waybill load status, then status comparison result is determined for validation processing.
  • Context - input load status and waybill load status have been compared:
    For Status Match?:
    When system evaluates if the statuses match, then status match result determines whether to proceed with cargo analysis or set validation error.
  • Context - input load status matches waybill load status:
    For Analyze Cargo Origin/Destination:
    When system analyzes cargo origin and destination data, then origin and destination information is evaluated for load status determination.
  • Context - cargo origin and destination have been analyzed:
    For Origin = Destination?:
    When system compares origin location with destination location, then load status flag is set to empty if origin equals destination, otherwise set to load.
  • Context - cargo origin equals destination:
    For Set Load Status Flag = Empty:
    When system assigns load status flag, then load status flag is set to empty.
  • Context - cargo origin does not equal destination:
    For Set Load Status Flag = Load:
    When system assigns load status flag, then load status flag is set to load.
  • Context - load status flag has been set based on origin/destination analysis:
    For Validate Load Status Requirements:
    When system validates load status against business requirements, then load status is determined as valid or invalid for further processing.
  • Context - load status has been validated against requirements:
    For Load Status Valid?:
    When system checks load status validity, then processing continues with status update if valid, or validation error is set if invalid.
  • Context - load status is determined as valid:
    For Update Equipment Load/Empty Status:
    When system updates equipment load/empty status, then equipment record is updated with the validated load/empty status.
  • Context - load status is invalid or input status does not match waybill status:
    For Set Status Validation Error:
    When system encounters validation failure, then status validation error is set for the equipment.
  • Context - load status validation is complete (either successful update or error set):
    For Continue Equipment Processing:
    When system proceeds to next processing phase, then equipment processing continues to subsequent validation or processing steps.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment waybill data is available with equipment type information
GIVEN
Equipment waybill data is available with equipment type information
Applied to: Extract Equipment Type from Waybill Data
WHEN
System extracts equipment type from waybill data
THEN
Equipment type is classified to determine if it is a trailer requiring load status processing
Context: Equipment type has been extracted from waybill data
GIVEN
Equipment type has been extracted from waybill data
Applied to: Is Equipment a Trailer?
WHEN
System checks if equipment type indicates a trailer
THEN
Equipment is identified as trailer or non-trailer for appropriate processing path
Context: Equipment is identified as a trailer type
GIVEN
Equipment is identified as a trailer type
Applied to: Retrieve Waybill Load/Empty Indicator
WHEN
System accesses waybill data for load/empty indicator
THEN
Load/empty status indicator is retrieved from waybill record
Context: Input load status is provided and waybill load status is retrieved
GIVEN
Input load status is provided and waybill load status is retrieved
Applied to: Compare Input Load Status vs Waybill Status
WHEN
System compares input load status with waybill load status
THEN
Status comparison result is determined for validation processing
Context: Input load status and waybill load status have been compared
GIVEN
Input load status and waybill load status have been compared
Applied to: Status Match?
WHEN
System evaluates if the statuses match
THEN
Status match result determines whether to proceed with cargo analysis or set validation error
Context: Input load status matches waybill load status
GIVEN
Input load status matches waybill load status
Applied to: Analyze Cargo Origin/Destination
WHEN
System analyzes cargo origin and destination data
THEN
Origin and destination information is evaluated for load status determination
Context: Cargo origin and destination have been analyzed
GIVEN
Cargo origin and destination have been analyzed
Applied to: Origin = Destination?
WHEN
System compares origin location with destination location
THEN
Load status flag is set to Empty if origin equals destination, otherwise set to Load
Context: Cargo origin equals destination
GIVEN
Cargo origin equals destination
Applied to: Set Load Status Flag = Empty
WHEN
System assigns load status flag
THEN
Load status flag is set to Empty
Context: Cargo origin does not equal destination
GIVEN
Cargo origin does not equal destination
Applied to: Set Load Status Flag = Load
WHEN
System assigns load status flag
THEN
Load status flag is set to Load
Context: Load status flag has been set based on origin/destination analysis
GIVEN
Load status flag has been set based on origin/destination analysis
Applied to: Validate Load Status Requirements
WHEN
System validates load status against business requirements
THEN
Load status is determined as valid or invalid for further processing
Context: Load status has been validated against requirements
GIVEN
Load status has been validated against requirements
Applied to: Load Status Valid?
WHEN
System checks load status validity
THEN
Processing continues with status update if valid, or validation error is set if invalid
Context: Load status is determined as valid
GIVEN
Load status is determined as valid
Applied to: Update Equipment Load/Empty Status
WHEN
System updates equipment load/empty status
THEN
Equipment record is updated with the validated load/empty status
Context: Load status is invalid or input status does not match waybill status
GIVEN
Load status is invalid or input status does not match waybill status
Applied to: Set Status Validation Error
WHEN
System encounters validation failure
THEN
Status validation error is set for the equipment
Context: Load status validation is complete (either successful update or error set)
GIVEN
Load status validation is complete (either successful update or error set)
Applied to: Continue Equipment Processing
WHEN
System proceeds to next processing phase
THEN
Equipment processing continues to subsequent validation or processing steps
R-GCX146-cbl-01637 File: GCX146.cbl Validate CCN Format Structure
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate CCN Format Structure':
  • Context - a ccn is being processed in the system:
    For CCN Format Structure Validation Not Found:
    When the system attempts to validate the ccn format structure, then no specific format validation logic is executed and the ccn is accepted based on existence alone.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN is being processed in the system
GIVEN
A CCN is being processed in the system
Applied to: CCN Format Structure Validation Not Found
WHEN
The system attempts to validate the CCN format structure
THEN
No specific format validation logic is executed and the CCN is accepted based on existence alone
R-GCX146-cbl-01638 (+7) File: GCX146.cbl Send via X12 EDI Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send via X12 EDI':
  • Context - a valid ccn record exists with equipment id, status updates, and transit information:
    For Prepare CCN Data for X12 Format:
    When the system needs to send broker notification via x12 edi, then the ccn data is formatted according to x12 edi message structure with broker-specific routing information.
  • Context - ccn data has been prepared in x12 edi format:
    For Call GCCS309C Module:
    When the system is ready to transmit the broker notification, then the gccs309c module is called to process the x12 edi transmission.
  • Context - the gccs309c module has been called for x12 edi transmission:
    For X12 EDI Transmission Successful?:
    When the transmission process completes, then the system determines if the transmission was successful or failed based on the module response.
  • Context - x12 edi transmission was successful:
    For Log Successful X12 Transmission:
    When the transmission completes successfully, then the system logs the successful transmission details including timestamp and broker information.
  • Context - x12 edi transmission was successful and logged:
    For Set Broker Notification Complete Flag:
    When the notification process completes, then the broker notification complete flag is set to indicate successful delivery.
  • Context - x12 edi transmission failed:
    For Handle X12 Transmission Failure:
    When the gccs309c module returns a failure status, then the system initiates failure handling procedures to manage the unsuccessful transmission.
    For Log X12 Error Details:
    When error handling is initiated, then the system logs detailed error information including failure reason and transmission details.
  • Context - x12 edi transmission failed and error details were logged:
    For Continue to Next Notification Channel:
    When the current notification attempt is complete, then the system continues processing to attempt notification through the next available channel (merlin, internet, fax, or paper).
👨‍💻 Technical ACs (Gherkin)
Context: A valid CCN record exists with equipment ID, status updates, and transit information
GIVEN
A valid CCN record exists with equipment ID, status updates, and transit information
Applied to: Prepare CCN Data for X12 Format
WHEN
The system needs to send broker notification via X12 EDI
THEN
The CCN data is formatted according to X12 EDI message structure with broker-specific routing information
Context: CCN data has been prepared in X12 EDI format
GIVEN
CCN data has been prepared in X12 EDI format
Applied to: Call GCCS309C Module
WHEN
The system is ready to transmit the broker notification
THEN
The GCCS309C module is called to process the X12 EDI transmission
Context: The GCCS309C module has been called for X12 EDI transmission
GIVEN
The GCCS309C module has been called for X12 EDI transmission
Applied to: X12 EDI Transmission Successful?
WHEN
The transmission process completes
THEN
The system determines if the transmission was successful or failed based on the module response
Context: X12 EDI transmission was successful
GIVEN
X12 EDI transmission was successful
Applied to: Log Successful X12 Transmission
WHEN
The transmission completes successfully
THEN
The system logs the successful transmission details including timestamp and broker information
Context: X12 EDI transmission was successful and logged
GIVEN
X12 EDI transmission was successful and logged
Applied to: Set Broker Notification Complete Flag
WHEN
The notification process completes
THEN
The broker notification complete flag is set to indicate successful delivery
Context: X12 EDI transmission failed
GIVEN
X12 EDI transmission failed
Applied to: Handle X12 Transmission Failure
WHEN
The GCCS309C module returns a failure status
THEN
The system initiates failure handling procedures to manage the unsuccessful transmission
Applied to: Log X12 Error Details
WHEN
Error handling is initiated
THEN
The system logs detailed error information including failure reason and transmission details
Context: X12 EDI transmission failed and error details were logged
GIVEN
X12 EDI transmission failed and error details were logged
Applied to: Continue to Next Notification Channel
WHEN
The current notification attempt is complete
THEN
The system continues processing to attempt notification through the next available channel (Merlin, Internet, FAX, or Paper)
R-GCX146-cbl-01646 (+8) File: GCX146.cbl Send via Merlin Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send via Merlin':
  • Context - a broker notification needs to be sent via merlin system:
    For Prepare GCX019 Input Parameters:
    When the system prepares gcx019 input parameters, then the broker merlin id, notification message content, and message type are configured for the gcx019 module call.
  • Context - broker configuration data exists in gcstbrt and broker merlin ids are available:
    For Set Broker Merlin ID:
    When the system needs to identify the broker's merlin id for notification, then the correct merlin id is retrieved from broker configuration and set for the notification.
  • Context - broker notification data is available and message content needs to be prepared:
    For Set Notification Message Content:
    When the system sets up notification message content, then the appropriate message content is formatted and configured for broker notification.
  • Context - a broker notification is being prepared:
    For Set Message Type for Broker:
    When the system needs to classify the message type, then the correct message type is determined and set for the broker notification.
  • Context - all gcx019 input parameters are prepared and configured:
    For Call GCX019 Module:
    When the system calls the gcx019 module, then the gcx019 module is invoked to process the merlin broker notification.
  • Context - the gcx019 module has been called for merlin broker notification:
    For GCX019 Call Successful?:
    When the system checks the call result, then the system determines if the gcx019 call was successful or failed.
  • Context - the gcx019 call was successful:
    For Log Successful Merlin Send:
    When the system processes the successful result, then a log entry is created documenting the successful merlin broker notification.
  • Context - the gcx019 call failed:
    For Log Merlin Send Failure:
    When the system processes the failure result, then a log entry is created documenting the failed merlin broker notification attempt.
  • Context - the merlin broker notification has failed:
    For Try Alternative Notification Method:
    When the system needs to ensure broker notification delivery, then an alternative notification method is selected and attempted for the broker.
👨‍💻 Technical ACs (Gherkin)
Context: A broker notification needs to be sent via Merlin system
GIVEN
A broker notification needs to be sent via Merlin system
Applied to: Prepare GCX019 Input Parameters
WHEN
The system prepares GCX019 input parameters
THEN
The broker Merlin ID, notification message content, and message type are configured for the GCX019 module call
Context: Broker configuration data exists in GCSTBRT and broker Merlin IDs are available
GIVEN
Broker configuration data exists in GCSTBRT and broker Merlin IDs are available
Applied to: Set Broker Merlin ID
WHEN
The system needs to identify the broker's Merlin ID for notification
THEN
The correct Merlin ID is retrieved from broker configuration and set for the notification
Context: Broker notification data is available and message content needs to be prepared
GIVEN
Broker notification data is available and message content needs to be prepared
Applied to: Set Notification Message Content
WHEN
The system sets up notification message content
THEN
The appropriate message content is formatted and configured for broker notification
Context: A broker notification is being prepared
GIVEN
A broker notification is being prepared
Applied to: Set Message Type for Broker
WHEN
The system needs to classify the message type
THEN
The correct message type is determined and set for the broker notification
Context: All GCX019 input parameters are prepared and configured
GIVEN
All GCX019 input parameters are prepared and configured
Applied to: Call GCX019 Module
WHEN
The system calls the GCX019 module
THEN
The GCX019 module is invoked to process the Merlin broker notification
Context: The GCX019 module has been called for Merlin broker notification
GIVEN
The GCX019 module has been called for Merlin broker notification
Applied to: GCX019 Call Successful?
WHEN
The system checks the call result
THEN
The system determines if the GCX019 call was successful or failed
Context: The GCX019 call was successful
GIVEN
The GCX019 call was successful
Applied to: Log Successful Merlin Send
WHEN
The system processes the successful result
THEN
A log entry is created documenting the successful Merlin broker notification
Context: The GCX019 call failed
GIVEN
The GCX019 call failed
Applied to: Log Merlin Send Failure
WHEN
The system processes the failure result
THEN
A log entry is created documenting the failed Merlin broker notification attempt
Context: The Merlin broker notification has failed
GIVEN
The Merlin broker notification has failed
Applied to: Try Alternative Notification Method
WHEN
The system needs to ensure broker notification delivery
THEN
An alternative notification method is selected and attempted for the broker
R-GCX146-cbl-01655 File: GCX146.cbl Send via Internet
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send via Internet':
  • Context - a broker notification requires internet transmission method:
    For GCX019 Module Reference Found:
    When the system attempts to process internet notification, then the system references gcx019 module but cannot execute the internet transmission logic due to missing implementation.
👨‍💻 Technical ACs (Gherkin)
Context: A broker notification requires internet transmission method
GIVEN
A broker notification requires internet transmission method
Applied to: GCX019 Module Reference Found
WHEN
The system attempts to process internet notification
THEN
The system references GCX019 module but cannot execute the internet transmission logic due to missing implementation
R-GCX146-cbl-01656 (+9) File: GCX146.cbl Send via FAX Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send via FAX':
  • Context - a broker notification request requires fax transmission:
    For Check Broker FAX Configuration:
    When the system checks the broker's fax configuration, then the system should verify fax number is available and valid before proceeding.
  • Context - a valid fax number is available for the broker:
    For Prepare FAX Message Content:
    When the system prepares the fax message content, then the system should format the notification data into appropriate fax message format.
  • Context - fax message content is prepared:
    For Set FAX Routing Parameters:
    When the system sets fax routing parameters, then the system should configure transmission settings including destination fax number and routing information.
  • Context - fax routing parameters are configured:
    For Call GCX019 for FAX Transmission:
    When the system calls gcx019 for fax transmission, then the system should invoke gcx019 program to handle the actual fax transmission.
  • Context - gcx019 fax transmission has been executed:
    For FAX Send Successful?:
    When the system evaluates the transmission result, then the system should determine success or failure based on gcx019 return status.
  • Context - fax transmission was successful:
    For Log FAX Transmission Success:
    When the system logs the transmission success, then the system should create audit trail entry recording successful fax delivery.
  • Context - fax transmission success has been logged:
    For Update Broker Notification Status:
    When the system updates broker notification status, then the system should mark the broker notification as successfully delivered via fax.
  • Context - fax transmission failed:
    For Handle FAX Transmission Error:
    When the system handles the transmission error, then the system should process the error and determine if alternative fax methods are available.
  • Context - primary fax transmission failed:
    For Alternative Available?:
    When the system checks for alternative fax methods, then the system should determine if backup fax numbers or alternative transmission methods are configured.
  • Context - fax transmission failed and no alternatives are available:
    For Mark FAX Notification Failed:
    When the system marks fax notification as failed, then the system should update broker notification status to indicate fax delivery failure.
👨‍💻 Technical ACs (Gherkin)
Context: A broker notification request requires FAX transmission
GIVEN
A broker notification request requires FAX transmission
Applied to: Check Broker FAX Configuration
WHEN
The system checks the broker's FAX configuration
THEN
The system should verify FAX number is available and valid before proceeding
Context: A valid FAX number is available for the broker
GIVEN
A valid FAX number is available for the broker
Applied to: Prepare FAX Message Content
WHEN
The system prepares the FAX message content
THEN
The system should format the notification data into appropriate FAX message format
Context: FAX message content is prepared
GIVEN
FAX message content is prepared
Applied to: Set FAX Routing Parameters
WHEN
The system sets FAX routing parameters
THEN
The system should configure transmission settings including destination FAX number and routing information
Context: FAX routing parameters are configured
GIVEN
FAX routing parameters are configured
Applied to: Call GCX019 for FAX Transmission
WHEN
The system calls GCX019 for FAX transmission
THEN
The system should invoke GCX019 program to handle the actual FAX transmission
Context: GCX019 FAX transmission has been executed
GIVEN
GCX019 FAX transmission has been executed
Applied to: FAX Send Successful?
WHEN
The system evaluates the transmission result
THEN
The system should determine success or failure based on GCX019 return status
Context: FAX transmission was successful
GIVEN
FAX transmission was successful
Applied to: Log FAX Transmission Success
WHEN
The system logs the transmission success
THEN
The system should create audit trail entry recording successful FAX delivery
Context: FAX transmission success has been logged
GIVEN
FAX transmission success has been logged
Applied to: Update Broker Notification Status
WHEN
The system updates broker notification status
THEN
The system should mark the broker notification as successfully delivered via FAX
Context: FAX transmission failed
GIVEN
FAX transmission failed
Applied to: Handle FAX Transmission Error
WHEN
The system handles the transmission error
THEN
The system should process the error and determine if alternative FAX methods are available
Context: Primary FAX transmission failed
GIVEN
Primary FAX transmission failed
Applied to: Alternative Available?
WHEN
The system checks for alternative FAX methods
THEN
The system should determine if backup FAX numbers or alternative transmission methods are configured
Context: FAX transmission failed and no alternatives are available
GIVEN
FAX transmission failed and no alternatives are available
Applied to: Mark FAX Notification Failed
WHEN
The system marks FAX notification as failed
THEN
The system should update broker notification status to indicate FAX delivery failure
R-GCX146-cbl-01666 (+6) File: GCX146.cbl Validate Email User ID Format Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Email User ID Format':
  • Context - a station code exists in the system:
    For Retrieve Email User List from Station Configuration:
    When the system needs to retrieve email user configuration for that station, then the system should lookup and retrieve the email user list from the station configuration table.
  • Context - an email address is provided for validation:
    For Check Email User ID Format:
    When the system checks the email format, then the email address must contain an @ symbol and have valid domain format to be considered valid.
  • Context - an email address needs structural validation:
    For Validate Email Address Structure:
    When the system validates the email structure, then the email must contain exactly one @ symbol and the domain portion must follow valid domain naming conventions.
  • Context - primary email validation has failed:
    For Check for Fallback Email IDs:
    When the system checks for available fallback options, then the system should identify if alternative email addresses are configured and available for use.
  • Context - no valid email addresses are found in configuration and fallback options are available:
    For Use Default Email OM01247/AEI9999:
    When the system needs to assign a default email for notifications, then the system should use the default email addresses om01247 and aei9999 as recipients.
  • Context - email validation has failed and no fallback email addresses are available:
    For Mark Email ID as Invalid:
    When the system processes the validation result, then the system should mark the email id as invalid and prevent its use for notifications.
  • Context - a valid email address has been identified through validation or fallback assignment:
    For Continue with Valid Email ID:
    When the system is ready to proceed with email operations, then the system should continue processing using the validated email address for notifications.
👨‍💻 Technical ACs (Gherkin)
Context: A station code exists in the system
GIVEN
A station code exists in the system
Applied to: Retrieve Email User List from Station Configuration
WHEN
The system needs to retrieve email user configuration for that station
THEN
The system should lookup and retrieve the email user list from the station configuration table
Context: An email address is provided for validation
GIVEN
An email address is provided for validation
Applied to: Check Email User ID Format
WHEN
The system checks the email format
THEN
The email address must contain an @ symbol and have valid domain format to be considered valid
Context: An email address needs structural validation
GIVEN
An email address needs structural validation
Applied to: Validate Email Address Structure
WHEN
The system validates the email structure
THEN
The email must contain exactly one @ symbol and the domain portion must follow valid domain naming conventions
Context: Primary email validation has failed
GIVEN
Primary email validation has failed
Applied to: Check for Fallback Email IDs
WHEN
The system checks for available fallback options
THEN
The system should identify if alternative email addresses are configured and available for use
Context: No valid email addresses are found in configuration and fallback options are available
GIVEN
No valid email addresses are found in configuration and fallback options are available
Applied to: Use Default Email OM01247/AEI9999
WHEN
The system needs to assign a default email for notifications
THEN
The system should use the default email addresses OM01247 and AEI9999 as recipients
Context: Email validation has failed and no fallback email addresses are available
GIVEN
Email validation has failed and no fallback email addresses are available
Applied to: Mark Email ID as Invalid
WHEN
The system processes the validation result
THEN
The system should mark the email ID as invalid and prevent its use for notifications
Context: A valid email address has been identified through validation or fallback assignment
GIVEN
A valid email address has been identified through validation or fallback assignment
Applied to: Continue with Valid Email ID
WHEN
The system is ready to proceed with email operations
THEN
The system should continue processing using the validated email address for notifications
R-GCX146-cbl-01673 (+17) File: GCX146.cbl Apply Merlin Transmission Rules Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Merlin Transmission Rules':
  • Context - a merlin transmission is being prepared:
    For Check Auto-FAX Configuration:
    When the system checks the auto-fax configuration settings, then the system identifies whether auto-fax is enabled or disabled for routing decisions.
  • Context - auto-fax is enabled for the transmission:
    For Set FAX Routing Parameters:
    When the system prepares fax routing parameters, then fax-specific routing configuration is applied to the message.
  • Context - fax routing parameters are being set:
    For Configure Copy IDs for FAX:
    When the system configures copy distribution, then appropriate copy ids are assigned for fax recipients.
  • Context - copy ids for fax have been configured:
    For Set External FAX Addressing:
    When the system sets up external addressing, then external fax addresses are properly configured for message delivery.
  • Context - a message needs to be transmitted via merlin:
    For Prepare Merlin Message Format:
    When the system prepares the message format, then the message is formatted according to merlin transmission specifications.
  • Context - a merlin message format has been prepared:
    For Set Message Type and Routing:
    When the system configures message type and routing, then appropriate message type classification and routing information is assigned.
  • Context - message type and routing have been configured:
    For Apply Line Segmentation Rules:
    When the system applies line segmentation rules, then message content is properly segmented according to transmission line limits.
  • Context - line segmentation rules have been applied to a message:
    For Message Exceeds Line Limit?:
    When the system checks if the message exceeds the line limit, then the system determines whether message segmentation is required based on line count limits.
  • Context - a message exceeds the maximum line limit:
    For Create Message Segments:
    When the system creates message segments, then the message is divided into multiple segments that each comply with line limit requirements.
  • Context - message segments have been created for a multi-part transmission:
    For Add Continuation Headers:
    When the system adds continuation headers, then each continuation segment includes appropriate headers indicating it is part of a multi-part message.
  • Context - message formatting and segmentation is complete:
    For Set Merlin Transmission Parameters:
    When the system sets merlin transmission parameters, then all necessary transmission parameters are configured for merlin delivery.
  • Context - merlin transmission parameters have been set:
    For Route to Primary Merlin ID:
    When the system routes to the primary merlin id, then the message is directed to the primary merlin id for delivery.
  • Context - a message has been routed to the primary merlin id:
    For Primary Routing Success?:
    When the system checks primary routing success, then the system determines whether the primary routing succeeded or failed.
  • Context - primary merlin id routing has failed:
    For Route to Backup Merlin ID:
    When the system routes to backup merlin id, then the message is redirected to the backup merlin id for delivery.
  • Context - message routing has been established (either primary or backup):
    For Apply Message Priority Rules:
    When the system applies message priority rules, then appropriate priority level is assigned to the message for transmission scheduling.
  • Context - message priority rules have been applied:
    For Set Delivery Confirmation:
    When the system sets delivery confirmation, then delivery confirmation requirements are configured according to message priority and business rules.
  • Context - all transmission parameters and confirmation settings are configured:
    For Execute Merlin Transmission:
    When the system executes merlin transmission, then the message is transmitted via merlin with the configured parameters and routing.
  • Context - merlin transmission has been executed:
    For Log Transmission Activity:
    When the system logs transmission activity, then transmission details are recorded in the system log for audit trail and monitoring.
👨‍💻 Technical ACs (Gherkin)
Context: A Merlin transmission is being prepared
GIVEN
A Merlin transmission is being prepared
Applied to: Check Auto-FAX Configuration
WHEN
The system checks the Auto-FAX configuration settings
THEN
The system identifies whether Auto-FAX is enabled or disabled for routing decisions
Context: Auto-FAX is enabled for the transmission
GIVEN
Auto-FAX is enabled for the transmission
Applied to: Set FAX Routing Parameters
WHEN
The system prepares FAX routing parameters
THEN
FAX-specific routing configuration is applied to the message
Context: FAX routing parameters are being set
GIVEN
FAX routing parameters are being set
Applied to: Configure Copy IDs for FAX
WHEN
The system configures copy distribution
THEN
Appropriate copy IDs are assigned for FAX recipients
Context: Copy IDs for FAX have been configured
GIVEN
Copy IDs for FAX have been configured
Applied to: Set External FAX Addressing
WHEN
The system sets up external addressing
THEN
External FAX addresses are properly configured for message delivery
Context: A message needs to be transmitted via Merlin
GIVEN
A message needs to be transmitted via Merlin
Applied to: Prepare Merlin Message Format
WHEN
The system prepares the message format
THEN
The message is formatted according to Merlin transmission specifications
Context: A Merlin message format has been prepared
GIVEN
A Merlin message format has been prepared
Applied to: Set Message Type and Routing
WHEN
The system configures message type and routing
THEN
Appropriate message type classification and routing information is assigned
Context: Message type and routing have been configured
GIVEN
Message type and routing have been configured
Applied to: Apply Line Segmentation Rules
WHEN
The system applies line segmentation rules
THEN
Message content is properly segmented according to transmission line limits
Context: Line segmentation rules have been applied to a message
GIVEN
Line segmentation rules have been applied to a message
Applied to: Message Exceeds Line Limit?
WHEN
The system checks if the message exceeds the line limit
THEN
The system determines whether message segmentation is required based on line count limits
Context: A message exceeds the maximum line limit
GIVEN
A message exceeds the maximum line limit
Applied to: Create Message Segments
WHEN
The system creates message segments
THEN
The message is divided into multiple segments that each comply with line limit requirements
Context: Message segments have been created for a multi-part transmission
GIVEN
Message segments have been created for a multi-part transmission
Applied to: Add Continuation Headers
WHEN
The system adds continuation headers
THEN
Each continuation segment includes appropriate headers indicating it is part of a multi-part message
Context: Message formatting and segmentation is complete
GIVEN
Message formatting and segmentation is complete
Applied to: Set Merlin Transmission Parameters
WHEN
The system sets Merlin transmission parameters
THEN
All necessary transmission parameters are configured for Merlin delivery
Context: Merlin transmission parameters have been set
GIVEN
Merlin transmission parameters have been set
Applied to: Route to Primary Merlin ID
WHEN
The system routes to the primary Merlin ID
THEN
The message is directed to the primary Merlin ID for delivery
Context: A message has been routed to the primary Merlin ID
GIVEN
A message has been routed to the primary Merlin ID
Applied to: Primary Routing Success?
WHEN
The system checks primary routing success
THEN
The system determines whether the primary routing succeeded or failed
Context: Primary Merlin ID routing has failed
GIVEN
Primary Merlin ID routing has failed
Applied to: Route to Backup Merlin ID
WHEN
The system routes to backup Merlin ID
THEN
The message is redirected to the backup Merlin ID for delivery
Context: Message routing has been established (either primary or backup)
GIVEN
Message routing has been established (either primary or backup)
Applied to: Apply Message Priority Rules
WHEN
The system applies message priority rules
THEN
Appropriate priority level is assigned to the message for transmission scheduling
Context: Message priority rules have been applied
GIVEN
Message priority rules have been applied
Applied to: Set Delivery Confirmation
WHEN
The system sets delivery confirmation
THEN
Delivery confirmation requirements are configured according to message priority and business rules
Context: All transmission parameters and confirmation settings are configured
GIVEN
All transmission parameters and confirmation settings are configured
Applied to: Execute Merlin Transmission
WHEN
The system executes Merlin transmission
THEN
The message is transmitted via Merlin with the configured parameters and routing
Context: Merlin transmission has been executed
GIVEN
Merlin transmission has been executed
Applied to: Log Transmission Activity
WHEN
The system logs transmission activity
THEN
Transmission details are recorded in the system log for audit trail and monitoring
R-GCX146-cbl-01691 (+7) File: GCX146.cbl Check Equipment Waybill Data Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Equipment Waybill Data':
  • Context - an equipment id is provided for waybill lookup:
    For Primary Waybill Lookup - FWIIROOT:
    When the system searches the fwiiroot database using the equipment id, then the system retrieves waybill data if it exists or marks as not found for fallback processing.
  • Context - primary waybill lookup in fwiiroot has failed to find waybill data:
    For Enhanced Waybill Search - SHIPROOT:
    When the system performs enhanced search in shiproot database using expanded search criteria, then the system retrieves waybill data if found or proceeds to inquiry database fallback.
  • Context - both primary fwiiroot lookup and enhanced shiproot search have failed:
    For Inquiry Database Fallback - FW-IQ:
    When the system performs fallback search in fw-iq inquiry database, then the system retrieves waybill data if available or marks waybill as not found.
  • Context - any waybill lookup method (primary, enhanced, or inquiry) has successfully found waybill data:
    For Set Waybill Found Flag:
    When the system processes the successful lookup result, then the system sets the waybill found flag to indicate successful retrieval.
  • Context - waybill data has been successfully found and waybill found flag is set:
    For Extract Waybill Details:
    When the system processes the retrieved waybill record, then the system extracts all relevant waybill details for further processing.
  • Context - waybill details have been extracted from the retrieved record:
    For Validate Waybill Data Quality:
    When the system validates the completeness and quality of the waybill data, then the system confirms data quality meets requirements for continued processing.
  • Context - all waybill lookup methods (primary, enhanced, and inquiry) have failed to find waybill data:
    For Set Waybill Not Found Flag:
    When the system processes the failed lookup results, then the system sets the waybill not found flag to indicate no waybill data is available.
  • Context - waybill not found flag has been set after all lookup methods failed:
    For Log Waybill Lookup Failure:
    When the system processes the complete lookup failure, then the system logs the waybill lookup failure with relevant equipment and search details.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID is provided for waybill lookup
GIVEN
An equipment ID is provided for waybill lookup
Applied to: Primary Waybill Lookup - FWIIROOT
WHEN
The system searches the FWIIROOT database using the equipment ID
THEN
The system retrieves waybill data if it exists or marks as not found for fallback processing
Context: Primary waybill lookup in FWIIROOT has failed to find waybill data
GIVEN
Primary waybill lookup in FWIIROOT has failed to find waybill data
Applied to: Enhanced Waybill Search - SHIPROOT
WHEN
The system performs enhanced search in SHIPROOT database using expanded search criteria
THEN
The system retrieves waybill data if found or proceeds to inquiry database fallback
Context: Both primary FWIIROOT lookup and enhanced SHIPROOT search have failed
GIVEN
Both primary FWIIROOT lookup and enhanced SHIPROOT search have failed
Applied to: Inquiry Database Fallback - FW-IQ
WHEN
The system performs fallback search in FW-IQ inquiry database
THEN
The system retrieves waybill data if available or marks waybill as not found
Context: Any waybill lookup method (primary, enhanced, or inquiry) has successfully found waybill data
GIVEN
Any waybill lookup method (primary, enhanced, or inquiry) has successfully found waybill data
Applied to: Set Waybill Found Flag
WHEN
The system processes the successful lookup result
THEN
The system sets the waybill found flag to indicate successful retrieval
Context: Waybill data has been successfully found and waybill found flag is set
GIVEN
Waybill data has been successfully found and waybill found flag is set
Applied to: Extract Waybill Details
WHEN
The system processes the retrieved waybill record
THEN
The system extracts all relevant waybill details for further processing
Context: Waybill details have been extracted from the retrieved record
GIVEN
Waybill details have been extracted from the retrieved record
Applied to: Validate Waybill Data Quality
WHEN
The system validates the completeness and quality of the waybill data
THEN
The system confirms data quality meets requirements for continued processing
Context: All waybill lookup methods (primary, enhanced, and inquiry) have failed to find waybill data
GIVEN
All waybill lookup methods (primary, enhanced, and inquiry) have failed to find waybill data
Applied to: Set Waybill Not Found Flag
WHEN
The system processes the failed lookup results
THEN
The system sets the waybill not found flag to indicate no waybill data is available
Context: Waybill not found flag has been set after all lookup methods failed
GIVEN
Waybill not found flag has been set after all lookup methods failed
Applied to: Log Waybill Lookup Failure
WHEN
The system processes the complete lookup failure
THEN
The system logs the waybill lookup failure with relevant equipment and search details
R-GCX146-cbl-01699 (+12) File: GCX146.cbl Apply CCN Formatting Rules Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply CCN Formatting Rules':
  • Context - a ccn formatting process needs to begin:
    For Initialize CCN Compression Variables:
    When the system starts ccn formatting, then all ccn compression variables are initialized to their default values.
  • Context - a ccn value exists in the input data:
    For Move CCN to Working Storage:
    When the system begins ccn formatting, then the ccn value is moved to working storage for manipulation.
  • Context - a ccn contains spaces within its structure:
    For Remove Spaces from CCN:
    When the system processes the ccn for formatting, then all spaces are removed from the ccn value.
  • Context - a ccn has been processed to remove spaces:
    For Check for Numeric Sequences:
    When the system examines the ccn structure, then numeric sequences within the ccn are identified and flagged.
  • Context - a ccn has been analyzed for numeric sequences:
    For Contains Numeric Characters?:
    When the system evaluates the ccn content, then the system determines whether numeric characters are present and routes processing accordingly.
  • Context - the ccn contains numeric characters:
    For Organize Numeric Sequences:
    When the system processes the numeric sequences, then numeric sequences are organized according to ccn formatting standards.
  • Context - numeric sequences have been organized within the ccn:
    For Format Equipment ID Component:
    When the system formats the equipment id component, then the equipment id portion is formatted according to standard ccn structure requirements.
  • Context - ccn components have been individually formatted:
    For Apply Standard CCN Structure:
    When the system applies standard ccn structure, then the ccn is formatted according to standard structure requirements regardless of whether it contains numeric characters.
  • Context - a ccn has been formatted according to standard structure:
    For Validate Formatted CCN Length:
    When the system validates the formatted ccn, then the ccn length is checked against acceptable length criteria.
  • Context - the formatted ccn length has been validated:
    For CCN Length Valid?:
    When the system evaluates length compliance, then the system determines whether the ccn length is valid and routes processing to either storage or error handling.
  • Context - the ccn has passed length validation:
    For Store Compressed CCN:
    When the system stores the formatted ccn, then the compressed ccn is stored for further processing.
  • Context - the ccn has been successfully stored in compressed format:
    For Set Formatting Complete Flag:
    When the system completes ccn formatting, then the formatting complete flag is set to indicate successful processing.
  • Context - the ccn fails length validation or other formatting requirements:
    For CCN Formatting Error:
    When the system encounters a formatting error, then an error condition is set and appropriate error handling is initiated.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN formatting process needs to begin
GIVEN
A CCN formatting process needs to begin
Applied to: Initialize CCN Compression Variables
WHEN
The system starts CCN formatting
THEN
All CCN compression variables are initialized to their default values
Context: A CCN value exists in the input data
GIVEN
A CCN value exists in the input data
Applied to: Move CCN to Working Storage
WHEN
The system begins CCN formatting
THEN
The CCN value is moved to working storage for manipulation
Context: A CCN contains spaces within its structure
GIVEN
A CCN contains spaces within its structure
Applied to: Remove Spaces from CCN
WHEN
The system processes the CCN for formatting
THEN
All spaces are removed from the CCN value
Context: A CCN has been processed to remove spaces
GIVEN
A CCN has been processed to remove spaces
Applied to: Check for Numeric Sequences
WHEN
The system examines the CCN structure
THEN
Numeric sequences within the CCN are identified and flagged
Context: A CCN has been analyzed for numeric sequences
GIVEN
A CCN has been analyzed for numeric sequences
Applied to: Contains Numeric Characters?
WHEN
The system evaluates the CCN content
THEN
The system determines whether numeric characters are present and routes processing accordingly
Context: The CCN contains numeric characters
GIVEN
The CCN contains numeric characters
Applied to: Organize Numeric Sequences
WHEN
The system processes the numeric sequences
THEN
Numeric sequences are organized according to CCN formatting standards
Context: Numeric sequences have been organized within the CCN
GIVEN
Numeric sequences have been organized within the CCN
Applied to: Format Equipment ID Component
WHEN
The system formats the equipment ID component
THEN
The equipment ID portion is formatted according to standard CCN structure requirements
Context: CCN components have been individually formatted
GIVEN
CCN components have been individually formatted
Applied to: Apply Standard CCN Structure
WHEN
The system applies standard CCN structure
THEN
The CCN is formatted according to standard structure requirements regardless of whether it contains numeric characters
Context: A CCN has been formatted according to standard structure
GIVEN
A CCN has been formatted according to standard structure
Applied to: Validate Formatted CCN Length
WHEN
The system validates the formatted CCN
THEN
The CCN length is checked against acceptable length criteria
Context: The formatted CCN length has been validated
GIVEN
The formatted CCN length has been validated
Applied to: CCN Length Valid?
WHEN
The system evaluates length compliance
THEN
The system determines whether the CCN length is valid and routes processing to either storage or error handling
Context: The CCN has passed length validation
GIVEN
The CCN has passed length validation
Applied to: Store Compressed CCN
WHEN
The system stores the formatted CCN
THEN
The compressed CCN is stored for further processing
Context: The CCN has been successfully stored in compressed format
GIVEN
The CCN has been successfully stored in compressed format
Applied to: Set Formatting Complete Flag
WHEN
The system completes CCN formatting
THEN
The formatting complete flag is set to indicate successful processing
Context: The CCN fails length validation or other formatting requirements
GIVEN
The CCN fails length validation or other formatting requirements
Applied to: CCN Formatting Error
WHEN
The system encounters a formatting error
THEN
An error condition is set and appropriate error handling is initiated
R-GCX146-cbl-01712 (+5) File: GCX146.cbl Set Equipment ID as Search Key Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Equipment ID as Search Key':
  • Context - an input message containing equipment information is received:
    For Extract Equipment ID from Input:
    When the system processes the equipment data from the input message, then the equipment id is extracted from the input message and made available for further processing.
  • Context - an equipment id has been extracted from the input message:
    For Format Equipment ID for Database Search:
    When the system needs to prepare database search keys, then the equipment id is formatted and assigned to search key fields for fwiiroot, shiproot, and inquiry database lookups.
  • Context - an equipment id has been extracted and formatted:
    For Validate Equipment ID Format:
    When the system validates the equipment id format, then if the equipment id format is valid, processing continues; if invalid, an error condition is set.
  • Context - a valid equipment id is available for database search:
    For Set Search Key for FWIIROOT Lookup:
    When the system prepares to search the fwiiroot database, then the equipment id is set as the search key for the waybill root database lookup.
    For Set Search Key for SHIPROOT Lookup:
    When the system prepares to search the shiproot database, then the equipment id is set as the search key for the shipment root database lookup.
    For Set Search Key for Inquiry Database:
    When the system prepares to search the inquiry database, then the equipment id is set as the search key for the inquiry database lookup.
👨‍💻 Technical ACs (Gherkin)
Context: An input message containing equipment information is received
GIVEN
An input message containing equipment information is received
Applied to: Extract Equipment ID from Input
WHEN
The system processes the equipment data from the input message
THEN
The equipment ID is extracted from the input message and made available for further processing
Context: An equipment ID has been extracted from the input message
GIVEN
An equipment ID has been extracted from the input message
Applied to: Format Equipment ID for Database Search
WHEN
The system needs to prepare database search keys
THEN
The equipment ID is formatted and assigned to search key fields for FWIIROOT, SHIPROOT, and inquiry database lookups
Context: An equipment ID has been extracted and formatted
GIVEN
An equipment ID has been extracted and formatted
Applied to: Validate Equipment ID Format
WHEN
The system validates the equipment ID format
THEN
If the equipment ID format is valid, processing continues; if invalid, an error condition is set
Context: A valid equipment ID is available for database search
GIVEN
A valid equipment ID is available for database search
Applied to: Set Search Key for FWIIROOT Lookup
WHEN
The system prepares to search the FWIIROOT database
THEN
The equipment ID is set as the search key for the waybill root database lookup
Applied to: Set Search Key for SHIPROOT Lookup
WHEN
The system prepares to search the SHIPROOT database
THEN
The equipment ID is set as the search key for the shipment root database lookup
Applied to: Set Search Key for Inquiry Database
WHEN
The system prepares to search the inquiry database
THEN
The equipment ID is set as the search key for the inquiry database lookup
R-GCX146-cbl-01718 (+10) File: GCX146.cbl Call FWCARGET Module Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call FWCARGET Module':
  • Context - an equipment id is provided for waybill lookup:
    For Call FWCARGET Module:
    When the fwcarget module is called with the equipment id parameter, then the system should retrieve enhanced waybill data from the shiproot database and return comprehensive equipment and shipment details.
  • Context - a waybill lookup request is initiated for specific equipment:
    For Prepare Search Criteria:
    When the system prepares search criteria for the fwcarget module call, then all required search parameters should be properly formatted and validated before the module call.
  • Context - an equipment id is available for waybill search:
    For Set Equipment ID Parameter:
    When the system sets the equipment id parameter for fwcarget module, then the equipment id should be properly formatted and assigned as the primary search key.
  • Context - primary equipment id parameter is set and additional search refinement is needed:
    For Set Additional Search Criteria:
    When the system configures additional search criteria for fwcarget module, then all supplementary search parameters should be properly configured to optimize waybill retrieval results.
  • Context - fwcarget module has been called with proper search criteria:
    For FWCARGET Successful?:
    When the system evaluates the success status of the fwcarget module call, then if the call is successful, the system should proceed to retrieve enhanced waybill data, otherwise set waybill not found flag.
  • Context - fwcarget module call was successful and returned valid data:
    For Retrieve Enhanced Waybill Data:
    When the system retrieves enhanced waybill data from the module response, then all available waybill information should be extracted and made available for equipment processing.
  • Context - enhanced waybill data has been successfully retrieved:
    For Extract Equipment Details:
    When the system extracts equipment details from the waybill data, then all relevant equipment information should be parsed and structured for subsequent business rule processing.
  • Context - equipment details have been successfully extracted from enhanced waybill data:
    For Set Waybill Found Flag:
    When the system sets the waybill found flag, then the waybill found indicator should be set to true to indicate successful waybill retrieval.
  • Context - waybill found flag has been set and equipment details are available:
    For Return Enhanced Waybill Information:
    When the system returns enhanced waybill information, then all processed waybill and equipment data should be made available to the calling business process.
  • Context - fwcarget module call was unsuccessful or returned no valid data:
    For Set Waybill Not Found Flag:
    When the system sets the waybill not found flag, then the waybill not found indicator should be set to indicate unsuccessful waybill retrieval.
  • Context - waybill not found flag has been set due to fwcarget failure:
    For Continue to Inquiry Database:
    When the system continues to inquiry database lookup, then the process should proceed to alternative waybill lookup methods using inquiry database.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID is provided for waybill lookup
GIVEN
An equipment ID is provided for waybill lookup
Applied to: Call FWCARGET Module
WHEN
The FWCARGET module is called with the equipment ID parameter
THEN
The system should retrieve enhanced waybill data from the SHIPROOT database and return comprehensive equipment and shipment details
Context: A waybill lookup request is initiated for specific equipment
GIVEN
A waybill lookup request is initiated for specific equipment
Applied to: Prepare Search Criteria
WHEN
The system prepares search criteria for the FWCARGET module call
THEN
All required search parameters should be properly formatted and validated before the module call
Context: An equipment ID is available for waybill search
GIVEN
An equipment ID is available for waybill search
Applied to: Set Equipment ID Parameter
WHEN
The system sets the equipment ID parameter for FWCARGET module
THEN
The equipment ID should be properly formatted and assigned as the primary search key
Context: Primary equipment ID parameter is set and additional search refinement is needed
GIVEN
Primary equipment ID parameter is set and additional search refinement is needed
Applied to: Set Additional Search Criteria
WHEN
The system configures additional search criteria for FWCARGET module
THEN
All supplementary search parameters should be properly configured to optimize waybill retrieval results
Context: FWCARGET module has been called with proper search criteria
GIVEN
FWCARGET module has been called with proper search criteria
Applied to: FWCARGET Successful?
WHEN
The system evaluates the success status of the FWCARGET module call
THEN
If the call is successful, the system should proceed to retrieve enhanced waybill data, otherwise set waybill not found flag
Context: FWCARGET module call was successful and returned valid data
GIVEN
FWCARGET module call was successful and returned valid data
Applied to: Retrieve Enhanced Waybill Data
WHEN
The system retrieves enhanced waybill data from the module response
THEN
All available waybill information should be extracted and made available for equipment processing
Context: Enhanced waybill data has been successfully retrieved
GIVEN
Enhanced waybill data has been successfully retrieved
Applied to: Extract Equipment Details
WHEN
The system extracts equipment details from the waybill data
THEN
All relevant equipment information should be parsed and structured for subsequent business rule processing
Context: Equipment details have been successfully extracted from enhanced waybill data
GIVEN
Equipment details have been successfully extracted from enhanced waybill data
Applied to: Set Waybill Found Flag
WHEN
The system sets the waybill found flag
THEN
The waybill found indicator should be set to true to indicate successful waybill retrieval
Context: Waybill found flag has been set and equipment details are available
GIVEN
Waybill found flag has been set and equipment details are available
Applied to: Return Enhanced Waybill Information
WHEN
The system returns enhanced waybill information
THEN
All processed waybill and equipment data should be made available to the calling business process
Context: FWCARGET module call was unsuccessful or returned no valid data
GIVEN
FWCARGET module call was unsuccessful or returned no valid data
Applied to: Set Waybill Not Found Flag
WHEN
The system sets the waybill not found flag
THEN
The waybill not found indicator should be set to indicate unsuccessful waybill retrieval
Context: Waybill not found flag has been set due to FWCARGET failure
GIVEN
Waybill not found flag has been set due to FWCARGET failure
Applied to: Continue to Inquiry Database
WHEN
The system continues to inquiry database lookup
THEN
The process should proceed to alternative waybill lookup methods using inquiry database
R-GCX146-cbl-01729 (+9) File: GCX146.cbl Extract Container ID from Record Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Container ID from Record':
  • Context - a waybill inquiry request is being processed:
    For Access Container Record:
    When the system needs to access container records, then the system retrieves container records from the fw-iq inquiry database.
  • Context - a container record has been accessed from the database:
    For Record Type Check:
    When the system checks the record type, then the system identifies if the record is a t/c xref record type or another record type.
  • Context - a t/c xref record has been identified:
    For Extract from T/C XREF Record:
    When the system processes the t/c xref record, then the system extracts container id information from the t/c xref record.
  • Context - container information has been extracted from a t/c xref record:
    For Parse Container ID Field:
    When the system processes the container data, then the system parses the container id field to extract the container identifier.
  • Context - a container id has been parsed from the record:
    For Container ID Valid?:
    When the system validates the container id, then the system determines if the container id is valid based on format and content requirements.
  • Context - a valid container id has been identified:
    For Format Container ID:
    When the system processes the valid container id, then the system formats the container id according to standard container identification format.
  • Context - a container id has been formatted according to standards:
    For Store Container ID:
    When the system completes container id formatting, then the system stores the formatted container id for processing.
  • Context - a container id has been successfully stored:
    For Set Container Found Flag:
    When the container processing is completed successfully, then the system sets the container found flag to indicate successful container identification.
  • Context - container processing has been attempted:
    For Set Container Not Found Flag:
    When the record is not a t/c xref record type or container id is invalid, then the system sets the container not found flag to indicate unsuccessful container identification.
  • Context - container id parsing has been attempted:
    For Log Extraction Error:
    When the container id is determined to be invalid, then the system logs an extraction error for the invalid container id.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill inquiry request is being processed
GIVEN
A waybill inquiry request is being processed
Applied to: Access Container Record
WHEN
The system needs to access container records
THEN
The system retrieves container records from the FW-IQ inquiry database
Context: A container record has been accessed from the database
GIVEN
A container record has been accessed from the database
Applied to: Record Type Check
WHEN
The system checks the record type
THEN
The system identifies if the record is a T/C XREF record type or another record type
Context: A T/C XREF record has been identified
GIVEN
A T/C XREF record has been identified
Applied to: Extract from T/C XREF Record
WHEN
The system processes the T/C XREF record
THEN
The system extracts container ID information from the T/C XREF record
Context: Container information has been extracted from a T/C XREF record
GIVEN
Container information has been extracted from a T/C XREF record
Applied to: Parse Container ID Field
WHEN
The system processes the container data
THEN
The system parses the container ID field to extract the container identifier
Context: A container ID has been parsed from the record
GIVEN
A container ID has been parsed from the record
Applied to: Container ID Valid?
WHEN
The system validates the container ID
THEN
The system determines if the container ID is valid based on format and content requirements
Context: A valid container ID has been identified
GIVEN
A valid container ID has been identified
Applied to: Format Container ID
WHEN
The system processes the valid container ID
THEN
The system formats the container ID according to standard container identification format
Context: A container ID has been formatted according to standards
GIVEN
A container ID has been formatted according to standards
Applied to: Store Container ID
WHEN
The system completes container ID formatting
THEN
The system stores the formatted container ID for processing
Context: A container ID has been successfully stored
GIVEN
A container ID has been successfully stored
Applied to: Set Container Found Flag
WHEN
The container processing is completed successfully
THEN
The system sets the container found flag to indicate successful container identification
Context: Container processing has been attempted
GIVEN
Container processing has been attempted
Applied to: Set Container Not Found Flag
WHEN
The record is not a T/C XREF record type OR container ID is invalid
THEN
The system sets the container not found flag to indicate unsuccessful container identification
Context: Container ID parsing has been attempted
GIVEN
Container ID parsing has been attempted
Applied to: Log Extraction Error
WHEN
The container ID is determined to be invalid
THEN
The system logs an extraction error for the invalid container ID
R-GCX146-cbl-01739 File: GCX146.cbl Validate Container ID Format
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Container ID Format':
  • Context - a container processing operation is being performed:
    For Container ID Format Validation Not Found:
    When the system attempts to validate container id format, then no specific container id format validation is executed as this functionality is not implemented in the current system.
👨‍💻 Technical ACs (Gherkin)
Context: A container processing operation is being performed
GIVEN
A container processing operation is being performed
Applied to: Container ID Format Validation Not Found
WHEN
The system attempts to validate container ID format
THEN
No specific container ID format validation is executed as this functionality is not implemented in the current system
R-GCX146-cbl-01740 (+8) File: GCX146.cbl Perform Container Waybill Lookup Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Perform Container Waybill Lookup':
  • Context - a container waybill lookup process is initiated:
    For Access FW-IQ Inquiry Database:
    When the system needs to access container information, then the fw-iq inquiry database is accessed to retrieve container records.
  • Context - the fw-iq inquiry database has been accessed for a specific container:
    For Container Record Found?:
    When the system searches for container records, then the system determines if a valid container record exists and proceeds accordingly.
  • Context - a container record has been found in the inquiry database:
    For Extract Container ID from T/C XREF:
    When the system processes the container record, then the container id is extracted from the t/c xref data for further processing.
  • Context - a container id has been extracted from the cross-reference records:
    For Retrieve Container Waybill Data:
    When the system needs waybill information for the container, then the associated waybill data is retrieved from the inquiry database.
  • Context - waybill data has been retrieved for a container:
    For Waybill Data Valid?:
    When the system evaluates the waybill information, then the system determines if the waybill data is valid and complete for further processing.
  • Context - valid waybill data has been confirmed for a container:
    For Set Container Information:
    When the system processes the validated information, then the container information is set and assigned to appropriate processing variables.
  • Context - container information has been successfully set with valid waybill data:
    For Mark Waybill Found Flag:
    When the system completes the container processing, then the waybill found flag is marked to indicate successful waybill retrieval.
  • Context - a container has been processed in the waybill lookup:
    For More Containers?:
    When the system checks for additional containers to process, then the system determines if more containers exist and continues processing or completes the operation.
  • Context - a container record was not found or waybill data was invalid:
    For Set Waybill Not Found Flag:
    When the system cannot retrieve valid waybill information, then the waybill not found flag is set to indicate unsuccessful waybill retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: A container waybill lookup process is initiated
GIVEN
A container waybill lookup process is initiated
Applied to: Access FW-IQ Inquiry Database
WHEN
The system needs to access container information
THEN
The FW-IQ inquiry database is accessed to retrieve container records
Context: The FW-IQ inquiry database has been accessed for a specific container
GIVEN
The FW-IQ inquiry database has been accessed for a specific container
Applied to: Container Record Found?
WHEN
The system searches for container records
THEN
The system determines if a valid container record exists and proceeds accordingly
Context: A container record has been found in the inquiry database
GIVEN
A container record has been found in the inquiry database
Applied to: Extract Container ID from T/C XREF
WHEN
The system processes the container record
THEN
The container ID is extracted from the T/C XREF data for further processing
Context: A container ID has been extracted from the cross-reference records
GIVEN
A container ID has been extracted from the cross-reference records
Applied to: Retrieve Container Waybill Data
WHEN
The system needs waybill information for the container
THEN
The associated waybill data is retrieved from the inquiry database
Context: Waybill data has been retrieved for a container
GIVEN
Waybill data has been retrieved for a container
Applied to: Waybill Data Valid?
WHEN
The system evaluates the waybill information
THEN
The system determines if the waybill data is valid and complete for further processing
Context: Valid waybill data has been confirmed for a container
GIVEN
Valid waybill data has been confirmed for a container
Applied to: Set Container Information
WHEN
The system processes the validated information
THEN
The container information is set and assigned to appropriate processing variables
Context: Container information has been successfully set with valid waybill data
GIVEN
Container information has been successfully set with valid waybill data
Applied to: Mark Waybill Found Flag
WHEN
The system completes the container processing
THEN
The waybill found flag is marked to indicate successful waybill retrieval
Context: A container has been processed in the waybill lookup
GIVEN
A container has been processed in the waybill lookup
Applied to: More Containers?
WHEN
The system checks for additional containers to process
THEN
The system determines if more containers exist and continues processing or completes the operation
Context: A container record was not found OR waybill data was invalid
GIVEN
A container record was not found OR waybill data was invalid
Applied to: Set Waybill Not Found Flag
WHEN
The system cannot retrieve valid waybill information
THEN
The waybill not found flag is set to indicate unsuccessful waybill retrieval
R-GCX146-cbl-01749 (+5) File: GCX146.cbl Check Release Status Conditions Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Release Status Conditions':
  • Context - equipment has current status of release:
    For Set Status to EXPORT:
    When the transit status is either e (export) or z (export zone), then the trip sheet status is set to export.
  • Context - equipment has current status of release and transit status is not e or z:
    For Set Status to S.A.R.:
    When the equipment has s.a.r. (special administrative release) designation, then the trip sheet status is set to s.a.r..
    For Set Status to RELEASE:
    When the equipment does not have s.a.r. designation, then the trip sheet status is set to release.
  • Context - equipment does not have current status of release:
    For Set Status to TRANSIT:
    When the transit status is t (transit), then the trip sheet status is set to transit.
  • Context - equipment does not have current status of release and transit status is not t:
    For Set Status to RETURN:
    When the transit status is r (return), then the trip sheet status is set to return.
  • Context - equipment does not have current status of release and transit status is not t or r:
    For Keep Current Status:
    When no special status conditions are met, then the trip sheet status remains as the current status.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment has current status of RELEASE
GIVEN
Equipment has current status of RELEASE
Applied to: Set Status to EXPORT
WHEN
The transit status is either E (Export) or Z (Export Zone)
THEN
The trip sheet status is set to EXPORT
Context: Equipment has current status of RELEASE and transit status is not E or Z
GIVEN
Equipment has current status of RELEASE and transit status is not E or Z
Applied to: Set Status to S.A.R.
WHEN
The equipment has S.A.R. (Special Administrative Release) designation
THEN
The trip sheet status is set to S.A.R.
Applied to: Set Status to RELEASE
WHEN
The equipment does not have S.A.R. designation
THEN
The trip sheet status is set to RELEASE
Context: Equipment does not have current status of RELEASE
GIVEN
Equipment does not have current status of RELEASE
Applied to: Set Status to TRANSIT
WHEN
The transit status is T (Transit)
THEN
The trip sheet status is set to TRANSIT
Context: Equipment does not have current status of RELEASE and transit status is not T
GIVEN
Equipment does not have current status of RELEASE and transit status is not T
Applied to: Set Status to RETURN
WHEN
The transit status is R (Return)
THEN
The trip sheet status is set to RETURN
Context: Equipment does not have current status of RELEASE and transit status is not T or R
GIVEN
Equipment does not have current status of RELEASE and transit status is not T or R
Applied to: Keep Current Status
WHEN
No special status conditions are met
THEN
The trip sheet status remains as the current status
R-GCX146-cbl-01755 (+10) File: GCX146.cbl Analyze Cargo Origin/Destination Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Analyze Cargo Origin/Destination':
  • Context - a cargo equipment piece requires origin/destination analysis:
    For Retrieve Waybill Data:
    When the system attempts to retrieve waybill data for the equipment, then the system should locate and extract the associated waybill information from the equipment records.
  • Context - waybill retrieval has been attempted for a cargo equipment piece:
    For Waybill Available?:
    When the system checks if waybill data is available, then the system should determine if valid waybill information exists and route processing accordingly.
  • Context - valid waybill data is available for a cargo equipment piece:
    For Extract Origin Station Code:
    When the system processes the waybill to extract origin information, then the system should identify and extract the origin station code from the waybill data.
  • Context - valid waybill data is available and origin station code has been extracted:
    For Extract Destination Station Code:
    When the system processes the waybill to extract destination information, then the system should identify and extract the destination station code from the waybill data.
  • Context - an origin station code has been extracted from waybill data:
    For Validate Origin Code Format:
    When the system validates the origin code format, then the system should verify the origin code conforms to valid station code format requirements.
  • Context - a destination station code has been extracted from waybill data:
    For Validate Destination Code Format:
    When the system validates the destination code format, then the system should verify the destination code conforms to valid station code format requirements.
  • Context - origin and destination station codes have been extracted and format validated:
    For Origin/Destination Valid?:
    When the system evaluates the overall validity of origin and destination information, then the system should confirm both codes are valid and complete for cargo processing or route to default handling.
  • Context - valid origin and destination codes exist for cargo equipment:
    For Determine Load/Empty Status:
    When the system analyzes the cargo to determine load status, then the system should classify the equipment as either loaded or empty based on waybill indicators and equipment characteristics.
  • Context - load/empty status has been determined for cargo equipment:
    For Set Equipment Status Flags:
    When the system sets equipment status flags, then the system should assign relevant status indicators that reflect the equipment's current operational state.
  • Context - equipment status flags have been set based on origin/destination analysis:
    For Update Cargo Classification:
    When the system updates cargo classification, then the system should assign appropriate cargo classification categories based on the complete analysis results.
  • Context - either no waybill data is available or origin/destination codes are invalid:
    For Set Default Status:
    When the system cannot complete normal cargo analysis, then the system should assign default status values to allow processing to continue.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo equipment piece requires origin/destination analysis
GIVEN
A cargo equipment piece requires origin/destination analysis
Applied to: Retrieve Waybill Data
WHEN
The system attempts to retrieve waybill data for the equipment
THEN
The system should locate and extract the associated waybill information from the equipment records
Context: Waybill retrieval has been attempted for a cargo equipment piece
GIVEN
Waybill retrieval has been attempted for a cargo equipment piece
Applied to: Waybill Available?
WHEN
The system checks if waybill data is available
THEN
The system should determine if valid waybill information exists and route processing accordingly
Context: Valid waybill data is available for a cargo equipment piece
GIVEN
Valid waybill data is available for a cargo equipment piece
Applied to: Extract Origin Station Code
WHEN
The system processes the waybill to extract origin information
THEN
The system should identify and extract the origin station code from the waybill data
Context: Valid waybill data is available and origin station code has been extracted
GIVEN
Valid waybill data is available and origin station code has been extracted
Applied to: Extract Destination Station Code
WHEN
The system processes the waybill to extract destination information
THEN
The system should identify and extract the destination station code from the waybill data
Context: An origin station code has been extracted from waybill data
GIVEN
An origin station code has been extracted from waybill data
Applied to: Validate Origin Code Format
WHEN
The system validates the origin code format
THEN
The system should verify the origin code conforms to valid station code format requirements
Context: A destination station code has been extracted from waybill data
GIVEN
A destination station code has been extracted from waybill data
Applied to: Validate Destination Code Format
WHEN
The system validates the destination code format
THEN
The system should verify the destination code conforms to valid station code format requirements
Context: Origin and destination station codes have been extracted and format validated
GIVEN
Origin and destination station codes have been extracted and format validated
Applied to: Origin/Destination Valid?
WHEN
The system evaluates the overall validity of origin and destination information
THEN
The system should confirm both codes are valid and complete for cargo processing or route to default handling
Context: Valid origin and destination codes exist for cargo equipment
GIVEN
Valid origin and destination codes exist for cargo equipment
Applied to: Determine Load/Empty Status
WHEN
The system analyzes the cargo to determine load status
THEN
The system should classify the equipment as either loaded or empty based on waybill indicators and equipment characteristics
Context: Load/empty status has been determined for cargo equipment
GIVEN
Load/empty status has been determined for cargo equipment
Applied to: Set Equipment Status Flags
WHEN
The system sets equipment status flags
THEN
The system should assign relevant status indicators that reflect the equipment's current operational state
Context: Equipment status flags have been set based on origin/destination analysis
GIVEN
Equipment status flags have been set based on origin/destination analysis
Applied to: Update Cargo Classification
WHEN
The system updates cargo classification
THEN
The system should assign appropriate cargo classification categories based on the complete analysis results
Context: Either no waybill data is available or origin/destination codes are invalid
GIVEN
Either no waybill data is available or origin/destination codes are invalid
Applied to: Set Default Status
WHEN
The system cannot complete normal cargo analysis
THEN
The system should assign default status values to allow processing to continue
R-GCX146-cbl-01766 (+8) File: GCX146.cbl Validate Load Status Requirements Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Load Status Requirements':
  • Context - an equipment record exists in the system with waybill data available:
    For Retrieve Equipment Record:
    When the system processes equipment for load status validation, then the equipment record is successfully retrieved for further validation.
  • Context - an equipment record is being processed for load status validation:
    For Check Waybill Data Available:
    When the system checks for associated waybill data, then the system determines whether waybill data is available or not available for the equipment.
  • Context - waybill data exists for the equipment:
    For Extract Load/Empty Indicator from Waybill:
    When the system processes the waybill record, then the load or empty indicator is extracted from the waybill data for comparison.
  • Context - both input load status and waybill load status are available:
    For Compare Input Load Status vs Waybill Status:
    When the system performs load status comparison, then the system determines if the input load status matches the waybill load status.
  • Context - input load status and waybill load status have been compared:
    For Status Match?:
    When the system evaluates the comparison result, then the system determines if the statuses match or do not match and proceeds accordingly.
  • Context - either no waybill data exists or the input load status matches the waybill load status:
    For Validate Load Requirements Met:
    When the system processes load requirements validation, then the system validates that all load requirements are properly met.
  • Context - load requirements validation has been completed successfully:
    For Set Load Status Flag:
    When the system processes the validation result, then the appropriate load status flag is set to indicate successful validation.
  • Context - the input load status does not match the waybill load status:
    For Generate Load Status Mismatch Error:
    When the system detects the mismatch condition, then a load status mismatch error is generated to indicate the validation failure.
  • Context - a load status mismatch error has been generated:
    For Set Error Flag:
    When the system processes the error condition, then an error flag is set to indicate that load status validation has failed.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record exists in the system with waybill data available
GIVEN
An equipment record exists in the system with waybill data available
Applied to: Retrieve Equipment Record
WHEN
The system processes equipment for load status validation
THEN
The equipment record is successfully retrieved for further validation
Context: An equipment record is being processed for load status validation
GIVEN
An equipment record is being processed for load status validation
Applied to: Check Waybill Data Available
WHEN
The system checks for associated waybill data
THEN
The system determines whether waybill data is available or not available for the equipment
Context: Waybill data exists for the equipment
GIVEN
Waybill data exists for the equipment
Applied to: Extract Load/Empty Indicator from Waybill
WHEN
The system processes the waybill record
THEN
The load or empty indicator is extracted from the waybill data for comparison
Context: Both input load status and waybill load status are available
GIVEN
Both input load status and waybill load status are available
Applied to: Compare Input Load Status vs Waybill Status
WHEN
The system performs load status comparison
THEN
The system determines if the input load status matches the waybill load status
Context: Input load status and waybill load status have been compared
GIVEN
Input load status and waybill load status have been compared
Applied to: Status Match?
WHEN
The system evaluates the comparison result
THEN
The system determines if the statuses match or do not match and proceeds accordingly
Context: Either no waybill data exists or the input load status matches the waybill load status
GIVEN
Either no waybill data exists or the input load status matches the waybill load status
Applied to: Validate Load Requirements Met
WHEN
The system processes load requirements validation
THEN
The system validates that all load requirements are properly met
Context: Load requirements validation has been completed successfully
GIVEN
Load requirements validation has been completed successfully
Applied to: Set Load Status Flag
WHEN
The system processes the validation result
THEN
The appropriate load status flag is set to indicate successful validation
Context: The input load status does not match the waybill load status
GIVEN
The input load status does not match the waybill load status
Applied to: Generate Load Status Mismatch Error
WHEN
The system detects the mismatch condition
THEN
A load status mismatch error is generated to indicate the validation failure
Context: A load status mismatch error has been generated
GIVEN
A load status mismatch error has been generated
Applied to: Set Error Flag
WHEN
The system processes the error condition
THEN
An error flag is set to indicate that load status validation has failed
R-GCX146-cbl-01775 (+14) File: GCX146.cbl Prepare CCN Data for X12 Format Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare CCN Data for X12 Format':
  • Context - a ccn number exists in the system:
    For Retrieve CCN Record from Database:
    When the system needs to prepare ccn data for x12 transmission, then the system retrieves the complete ccn record from the gcccrt database.
  • Context - a ccn record has been retrieved from the database:
    For Extract CCN Number:
    When the system processes the ccn record, then the system extracts the ccn number field from the record structure.
  • Context - a ccn number has been extracted from the database record:
    For Format CCN for X12 Structure:
    When the system prepares the ccn for x12 transmission, then the system formats the ccn data according to x12 edi structure specifications.
  • Context - a ccn number is formatted for x12 structure:
    For Compress CCN Number:
    When the system processes the ccn for compression, then the system compresses the ccn number by removing redundant characters and formatting.
  • Context - a ccn number contains spaces or padding characters:
    For Remove Spaces from CCN:
    When the system compresses the ccn number, then the system removes all spaces and padding characters from the ccn.
  • Context - a ccn contains numeric sequences that need organization:
    For Organize Numeric Sequences:
    When the system processes the compressed ccn, then the system organizes numeric sequences according to x12 format requirements.
  • Context - a ccn has been processed and organized for x12 format:
    For Validate CCN Format:
    When the system validates the ccn format, then the system checks that the ccn format complies with x12 edi standards.
  • Context - a ccn format has been validated against x12 standards:
    For CCN Format Valid?:
    When the system evaluates the validation results, then the system determines if the ccn format is valid for transmission or if format errors exist.
  • Context - a ccn format has been validated as correct for x12 transmission:
    For Set X12 CCN Field:
    When the system processes the valid ccn, then the system assigns the ccn to the appropriate x12 message field.
  • Context - equipment information is available in the system:
    For Prepare Equipment ID for X12:
    When the system prepares x12 message data, then the system formats equipment id according to x12 requirements.
  • Context - waybill data is available for the ccn:
    For Format Waybill Information:
    When the system prepares x12 message components, then the system formats waybill information according to x12 edi standards.
  • Context - cargo status information is available in the ccn record:
    For Set Cargo Status Code:
    When the system prepares x12 message data, then the system assigns the appropriate cargo status code for x12 transmission.
  • Context - shipper and consignee information exists in the system:
    For Prepare Shipper/Consignee Data:
    When the system builds x12 message components, then the system formats shipper and consignee data according to x12 requirements.
  • Context - all x12 message components have been prepared and validated:
    For Build X12 Message Structure:
    When the system builds the complete x12 message, then the system assembles all components into proper x12 edi message structure.
  • Context - a ccn format validation has failed:
    For Log Format Error:
    When the system encounters invalid ccn format, then the system logs the format error for troubleshooting and audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN number exists in the system
GIVEN
A CCN number exists in the system
Applied to: Retrieve CCN Record from Database
WHEN
The system needs to prepare CCN data for X12 transmission
THEN
The system retrieves the complete CCN record from the GCCCRT database
Context: A CCN record has been retrieved from the database
GIVEN
A CCN record has been retrieved from the database
Applied to: Extract CCN Number
WHEN
The system processes the CCN record
THEN
The system extracts the CCN number field from the record structure
Context: A CCN number has been extracted from the database record
GIVEN
A CCN number has been extracted from the database record
Applied to: Format CCN for X12 Structure
WHEN
The system prepares the CCN for X12 transmission
THEN
The system formats the CCN data according to X12 EDI structure specifications
Context: A CCN number is formatted for X12 structure
GIVEN
A CCN number is formatted for X12 structure
Applied to: Compress CCN Number
WHEN
The system processes the CCN for compression
THEN
The system compresses the CCN number by removing redundant characters and formatting
Context: A CCN number contains spaces or padding characters
GIVEN
A CCN number contains spaces or padding characters
Applied to: Remove Spaces from CCN
WHEN
The system compresses the CCN number
THEN
The system removes all spaces and padding characters from the CCN
Context: A CCN contains numeric sequences that need organization
GIVEN
A CCN contains numeric sequences that need organization
Applied to: Organize Numeric Sequences
WHEN
The system processes the compressed CCN
THEN
The system organizes numeric sequences according to X12 format requirements
Context: A CCN has been processed and organized for X12 format
GIVEN
A CCN has been processed and organized for X12 format
Applied to: Validate CCN Format
WHEN
The system validates the CCN format
THEN
The system checks that the CCN format complies with X12 EDI standards
Context: A CCN format has been validated against X12 standards
GIVEN
A CCN format has been validated against X12 standards
Applied to: CCN Format Valid?
WHEN
The system evaluates the validation results
THEN
The system determines if the CCN format is valid for transmission or if format errors exist
Context: A CCN format has been validated as correct for X12 transmission
GIVEN
A CCN format has been validated as correct for X12 transmission
Applied to: Set X12 CCN Field
WHEN
The system processes the valid CCN
THEN
The system assigns the CCN to the appropriate X12 message field
Context: Equipment information is available in the system
GIVEN
Equipment information is available in the system
Applied to: Prepare Equipment ID for X12
WHEN
The system prepares X12 message data
THEN
The system formats equipment ID according to X12 requirements
Context: Waybill data is available for the CCN
GIVEN
Waybill data is available for the CCN
Applied to: Format Waybill Information
WHEN
The system prepares X12 message components
THEN
The system formats waybill information according to X12 EDI standards
Context: Cargo status information is available in the CCN record
GIVEN
Cargo status information is available in the CCN record
Applied to: Set Cargo Status Code
WHEN
The system prepares X12 message data
THEN
The system assigns the appropriate cargo status code for X12 transmission
Context: Shipper and consignee information exists in the system
GIVEN
Shipper and consignee information exists in the system
Applied to: Prepare Shipper/Consignee Data
WHEN
The system builds X12 message components
THEN
The system formats shipper and consignee data according to X12 requirements
Context: All X12 message components have been prepared and validated
GIVEN
All X12 message components have been prepared and validated
Applied to: Build X12 Message Structure
WHEN
The system builds the complete X12 message
THEN
The system assembles all components into proper X12 EDI message structure
Context: A CCN format validation has failed
GIVEN
A CCN format validation has failed
Applied to: Log Format Error
WHEN
The system encounters invalid CCN format
THEN
The system logs the format error for troubleshooting and audit purposes
R-GCX146-cbl-01790 (+12) File: GCX146.cbl Prepare GCX019 Input Parameters Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare GCX019 Input Parameters':
  • Context - a broker notification needs to be sent:
    For Initialize GCX019 Input Structure:
    When the system prepares gcx019 input parameters, then the gcx019 input structure is initialized with spaces and default values.
  • Context - a broker notification is configured for merlin delivery:
    For Set Merlin Parameters:
    When the communication method is merlin, then the system sets merlin id and communication type to 'm' in gcx019 parameters.
  • Context - a broker notification is configured for internet delivery:
    For Set Internet Parameters:
    When the communication method is internet, then the system sets internet address and communication type to 'i' in gcx019 parameters.
  • Context - a broker notification is configured for fax delivery:
    For Set FAX Parameters:
    When the communication method is fax, then the system sets fax number and communication type to 'f' in gcx019 parameters.
  • Context - a broker notification is configured for paper delivery:
    For Set Paper Parameters:
    When the communication method is paper, then the system sets mailing address and communication type to 'p' in gcx019 parameters.
  • Context - a broker notification is being prepared with valid ccn data:
    For Populate CCN Information:
    When ccn information is available, then the system populates ccn number, status, and related customs information in gcx019 parameters.
  • Context - equipment information is available for the ccn:
    For Set Equipment Details:
    When equipment details are being added to the notification, then the system populates equipment id, type, and status in gcx019 parameters.
  • Context - waybill information exists for the equipment:
    For Add Waybill Information:
    When waybill details are being added to the notification, then the system populates shipper, consignee, and commodity information in gcx019 parameters.
  • Context - station information is available from the manifest or waybill:
    For Set Station Codes:
    When station codes are being set in the notification, then the system populates origin station, destination station, and border crossing codes in gcx019 parameters.
  • Context - date and time information is available for the shipment:
    For Add Date/Time Information:
    When temporal data is being added to the notification, then the system populates estimated arrival date, processing date, and current timestamp in gcx019 parameters.
  • Context - a broker notification is being prepared:
    For Set Message Priority:
    When message priority needs to be determined, then the system sets priority level based on cargo characteristics and delivery requirements in gcx019 parameters.
  • Context - gcx019 parameters have been populated:
    For Validate Required Fields:
    When the system validates required fields, then all mandatory fields including communication method, ccn, equipment id, and contact information must be present and valid.
  • Context - gcx019 parameters are being validated:
    For Parameter Error:
    When required fields are missing or contain invalid data, then the system reports parameter error and does not proceed with broker notification.
👨‍💻 Technical ACs (Gherkin)
Context: A broker notification needs to be sent
GIVEN
A broker notification needs to be sent
Applied to: Initialize GCX019 Input Structure
WHEN
The system prepares GCX019 input parameters
THEN
The GCX019 input structure is initialized with spaces and default values
Context: A broker notification is configured for Merlin delivery
GIVEN
A broker notification is configured for Merlin delivery
Applied to: Set Merlin Parameters
WHEN
The communication method is Merlin
THEN
The system sets Merlin ID and communication type to 'M' in GCX019 parameters
Context: A broker notification is configured for Internet delivery
GIVEN
A broker notification is configured for Internet delivery
Applied to: Set Internet Parameters
WHEN
The communication method is Internet
THEN
The system sets Internet address and communication type to 'I' in GCX019 parameters
Context: A broker notification is configured for FAX delivery
GIVEN
A broker notification is configured for FAX delivery
Applied to: Set FAX Parameters
WHEN
The communication method is FAX
THEN
The system sets FAX number and communication type to 'F' in GCX019 parameters
Context: A broker notification is configured for Paper delivery
GIVEN
A broker notification is configured for Paper delivery
Applied to: Set Paper Parameters
WHEN
The communication method is Paper
THEN
The system sets mailing address and communication type to 'P' in GCX019 parameters
Context: A broker notification is being prepared with valid CCN data
GIVEN
A broker notification is being prepared with valid CCN data
Applied to: Populate CCN Information
WHEN
CCN information is available
THEN
The system populates CCN number, status, and related customs information in GCX019 parameters
Context: Equipment information is available for the CCN
GIVEN
Equipment information is available for the CCN
Applied to: Set Equipment Details
WHEN
Equipment details are being added to the notification
THEN
The system populates equipment ID, type, and status in GCX019 parameters
Context: Waybill information exists for the equipment
GIVEN
Waybill information exists for the equipment
Applied to: Add Waybill Information
WHEN
Waybill details are being added to the notification
THEN
The system populates shipper, consignee, and commodity information in GCX019 parameters
Context: Station information is available from the manifest or waybill
GIVEN
Station information is available from the manifest or waybill
Applied to: Set Station Codes
WHEN
Station codes are being set in the notification
THEN
The system populates origin station, destination station, and border crossing codes in GCX019 parameters
Context: Date and time information is available for the shipment
GIVEN
Date and time information is available for the shipment
Applied to: Add Date/Time Information
WHEN
Temporal data is being added to the notification
THEN
The system populates estimated arrival date, processing date, and current timestamp in GCX019 parameters
Context: A broker notification is being prepared
GIVEN
A broker notification is being prepared
Applied to: Set Message Priority
WHEN
Message priority needs to be determined
THEN
The system sets priority level based on cargo characteristics and delivery requirements in GCX019 parameters
Context: GCX019 parameters have been populated
GIVEN
GCX019 parameters have been populated
Applied to: Validate Required Fields
WHEN
The system validates required fields
THEN
All mandatory fields including communication method, CCN, equipment ID, and contact information must be present and valid
Context: GCX019 parameters are being validated
GIVEN
GCX019 parameters are being validated
Applied to: Parameter Error
WHEN
Required fields are missing or contain invalid data
THEN
The system reports parameter error and does not proceed with broker notification
R-GCX146-cbl-01803 (+11) File: GCX146.cbl Prepare FAX Message Content Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare FAX Message Content':
  • Context - a station has fax configuration settings in the system:
    For Check Auto-FAX Configuration:
    When the system checks the auto-fax configuration status, then the system should verify if auto-fax is enabled based on station settings and user permissions.
  • Context - auto-fax configuration has been checked and fax flag status is available:
    For Auto-FAX Enabled?:
    When the system evaluates if auto-fax is enabled, then if auto-fax is enabled, proceed with fax routing setup, otherwise skip fax preparation.
  • Context - auto-fax is enabled for the current operation:
    For Set FAX Routing Parameters:
    When the system sets up fax routing parameters, then the system should configure destination routing, delivery options, and transmission parameters for the fax.
  • Context - fax routing parameters have been established:
    For Configure Copy IDs for FAX:
    When the system configures copy ids for the fax transmission, then the system should assign unique copy identifiers for tracking and distribution management.
  • Context - copy ids have been configured for the fax:
    For Set External FAX Addressing:
    When the system sets up external fax addressing, then the system should configure external fax numbers, recipient information, and delivery addressing.
  • Context - external fax addressing has been configured:
    For Prepare FAX Header Information:
    When the system prepares fax header information, then the system should format sender information, recipient details, transmission date/time, and document identification in the fax header.
  • Context - fax header information has been prepared:
    For Format Message Content for FAX:
    When the system formats message content for fax transmission, then the system should format the message content to meet fax layout requirements, character limitations, and transmission standards.
  • Context - message content has been formatted for fax:
    For Set FAX Transmission Flags:
    When the system sets fax transmission flags, then the system should configure transmission priority, delivery confirmation requirements, and retry options.
  • Context - fax transmission flags have been set:
    For Validate FAX Configuration:
    When the system validates the fax configuration, then the system should verify that all required fax parameters are present, valid, and compatible for successful transmission.
  • Context - fax configuration validation has been performed:
    For FAX Config Valid?:
    When the system evaluates fax configuration validity, then if configuration is valid, mark fax message as ready; if invalid, prepare alternative routing options.
  • Context - fax configuration is determined to be invalid:
    For Prepare Alternative Routing:
    When the system prepares alternative routing, then the system should configure alternative delivery methods such as email, print queue, or manual processing.
  • Context - auto-fax is determined to be disabled:
    For Skip FAX Preparation:
    When the system processes the skip fax preparation path, then the system should bypass all fax configuration steps and proceed to message completion.
👨‍💻 Technical ACs (Gherkin)
Context: A station has FAX configuration settings in the system
GIVEN
A station has FAX configuration settings in the system
Applied to: Check Auto-FAX Configuration
WHEN
The system checks the auto-FAX configuration status
THEN
The system should verify if auto-FAX is enabled based on station settings and user permissions
Context: Auto-FAX configuration has been checked and FAX flag status is available
GIVEN
Auto-FAX configuration has been checked and FAX flag status is available
Applied to: Auto-FAX Enabled?
WHEN
The system evaluates if auto-FAX is enabled
THEN
If auto-FAX is enabled, proceed with FAX routing setup, otherwise skip FAX preparation
Context: Auto-FAX is enabled for the current operation
GIVEN
Auto-FAX is enabled for the current operation
Applied to: Set FAX Routing Parameters
WHEN
The system sets up FAX routing parameters
THEN
The system should configure destination routing, delivery options, and transmission parameters for the FAX
Context: FAX routing parameters have been established
GIVEN
FAX routing parameters have been established
Applied to: Configure Copy IDs for FAX
WHEN
The system configures copy IDs for the FAX transmission
THEN
The system should assign unique copy identifiers for tracking and distribution management
Context: Copy IDs have been configured for the FAX
GIVEN
Copy IDs have been configured for the FAX
Applied to: Set External FAX Addressing
WHEN
The system sets up external FAX addressing
THEN
The system should configure external FAX numbers, recipient information, and delivery addressing
Context: External FAX addressing has been configured
GIVEN
External FAX addressing has been configured
Applied to: Prepare FAX Header Information
WHEN
The system prepares FAX header information
THEN
The system should format sender information, recipient details, transmission date/time, and document identification in the FAX header
Context: FAX header information has been prepared
GIVEN
FAX header information has been prepared
Applied to: Format Message Content for FAX
WHEN
The system formats message content for FAX transmission
THEN
The system should format the message content to meet FAX layout requirements, character limitations, and transmission standards
Context: Message content has been formatted for FAX
GIVEN
Message content has been formatted for FAX
Applied to: Set FAX Transmission Flags
WHEN
The system sets FAX transmission flags
THEN
The system should configure transmission priority, delivery confirmation requirements, and retry options
Context: FAX transmission flags have been set
GIVEN
FAX transmission flags have been set
Applied to: Validate FAX Configuration
WHEN
The system validates the FAX configuration
THEN
The system should verify that all required FAX parameters are present, valid, and compatible for successful transmission
Context: FAX configuration validation has been performed
GIVEN
FAX configuration validation has been performed
Applied to: FAX Config Valid?
WHEN
The system evaluates FAX configuration validity
THEN
If configuration is valid, mark FAX message as ready; if invalid, prepare alternative routing options
Context: FAX configuration is determined to be invalid
GIVEN
FAX configuration is determined to be invalid
Applied to: Prepare Alternative Routing
WHEN
The system prepares alternative routing
THEN
The system should configure alternative delivery methods such as email, print queue, or manual processing
Context: Auto-FAX is determined to be disabled
GIVEN
Auto-FAX is determined to be disabled
Applied to: Skip FAX Preparation
WHEN
The system processes the skip FAX preparation path
THEN
The system should bypass all FAX configuration steps and proceed to message completion
R-GCX146-cbl-01815 (+7) File: GCX146.cbl Check Email User ID Format Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Email User ID Format':
  • Context - a station code exists in the system:
    For Retrieve Email User ID from Station Configuration:
    When the system needs to retrieve email user configuration for that station, then the system should access the station configuration table and extract the email user id associated with the station.
  • Context - station configuration data has been retrieved:
    For Email User ID Present?:
    When the system checks for email user id configuration, then the system should determine if an email user id is present and not empty in the configuration.
  • Context - an email user id is present in the station configuration:
    For Validate Email Format Structure:
    When the system validates the email format structure, then the system should verify the email follows standard email format conventions including proper domain and address structure.
  • Context - email format structure validation has been performed:
    For Valid Email Format?:
    When the system evaluates the validation results, then the system should determine if the email format is valid based on standard email formatting rules.
  • Context - the email user id has passed format validation:
    For Set Email User ID as Valid:
    When the system processes the validation success, then the system should set the email user id status as valid and enable email operations for the station.
  • Context - the email user id is either not present or has failed format validation:
    For Set Email User ID as Invalid:
    When the system processes the validation failure, then the system should set the email user id status as invalid and prevent email operations for the station.
  • Context - email validation process has been completed with either valid or invalid result:
    For Log Format Validation Result:
    When the system logs the validation outcome, then the system should record the validation result including station code and email status for audit trail.
  • Context - email validation and logging have been completed:
    For Return Validation Status:
    When the system returns the validation status, then the system should provide the final validation result indicating whether email operations can proceed for the station.
👨‍💻 Technical ACs (Gherkin)
Context: A station code exists in the system
GIVEN
A station code exists in the system
Applied to: Retrieve Email User ID from Station Configuration
WHEN
The system needs to retrieve email user configuration for that station
THEN
The system should access the station configuration table and extract the email user ID associated with the station
Context: Station configuration data has been retrieved
GIVEN
Station configuration data has been retrieved
Applied to: Email User ID Present?
WHEN
The system checks for email user ID configuration
THEN
The system should determine if an email user ID is present and not empty in the configuration
Context: An email user ID is present in the station configuration
GIVEN
An email user ID is present in the station configuration
Applied to: Validate Email Format Structure
WHEN
The system validates the email format structure
THEN
The system should verify the email follows standard email format conventions including proper domain and address structure
Context: Email format structure validation has been performed
GIVEN
Email format structure validation has been performed
Applied to: Valid Email Format?
WHEN
The system evaluates the validation results
THEN
The system should determine if the email format is valid based on standard email formatting rules
Context: The email user ID has passed format validation
GIVEN
The email user ID has passed format validation
Applied to: Set Email User ID as Valid
WHEN
The system processes the validation success
THEN
The system should set the email user ID status as valid and enable email operations for the station
Context: The email user ID is either not present or has failed format validation
GIVEN
The email user ID is either not present or has failed format validation
Applied to: Set Email User ID as Invalid
WHEN
The system processes the validation failure
THEN
The system should set the email user ID status as invalid and prevent email operations for the station
Context: Email validation process has been completed with either valid or invalid result
GIVEN
Email validation process has been completed with either valid or invalid result
Applied to: Log Format Validation Result
WHEN
The system logs the validation outcome
THEN
The system should record the validation result including station code and email status for audit trail
Context: Email validation and logging have been completed
GIVEN
Email validation and logging have been completed
Applied to: Return Validation Status
WHEN
The system returns the validation status
THEN
The system should provide the final validation result indicating whether email operations can proceed for the station
R-GCX146-cbl-01823 (+7) File: GCX146.cbl Check Auto Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Auto':
  • Context - a station configuration record exists in gcstbrt:
    For Check GCSTBRT-AD-AUTO-FAX Setting:
    When the system checks the auto-fax setting in the station configuration, then the system reads the gcstbrt-ad-auto-fax field value to determine if auto-fax is enabled.
  • Context - the auto-fax setting has been retrieved from station configuration:
    For Auto-FAX = 'Y'?:
    When the auto-fax setting equals 'y', then the system proceeds to check the fax flag configuration, otherwise it disables auto-fax and uses standard routing.
  • Context - auto-fax is enabled with setting 'y':
    For Check GCSTBRT-SC-FAX-FLAG:
    When the system checks the fax flag configuration, then the system reads the gcstbrt-sc-fax-flag field value.
  • Context - auto-fax is enabled and fax flag has been retrieved:
    For FAX Flag = 'Y'?:
    When the fax flag equals 'y', then the system enables auto-fax functionality and proceeds with fax routing configuration, otherwise it disables auto-fax.
  • Context - both auto-fax setting and fax flag are set to 'y':
    For Set Auto-FAX Enabled:
    When the system processes the configuration, then the system sets auto-fax as enabled and prepares for fax routing configuration.
  • Context - auto-fax functionality is enabled:
    For Configure FAX Routing with Copy IDs:
    When the system configures fax routing, then the system sets up fax routing parameters with appropriate copy ids for message distribution.
  • Context - fax routing has been configured with copy ids:
    For Set External FAX Addressing:
    When the system sets up external addressing, then the system configures external fax addressing parameters for proper message delivery.
  • Context - either auto-fax setting is not 'y' or fax flag is not 'y':
    For Auto-FAX Disabled - Use Standard Routing:
    When auto-fax cannot be enabled, then the system disables auto-fax functionality and uses standard routing procedures.
👨‍💻 Technical ACs (Gherkin)
Context: A station configuration record exists in GCSTBRT
GIVEN
A station configuration record exists in GCSTBRT
Applied to: Check GCSTBRT-AD-AUTO-FAX Setting
WHEN
The system checks the Auto-FAX setting in the station configuration
THEN
The system reads the GCSTBRT-AD-AUTO-FAX field value to determine if Auto-FAX is enabled
Context: The Auto-FAX setting has been retrieved from station configuration
GIVEN
The Auto-FAX setting has been retrieved from station configuration
Applied to: Auto-FAX = 'Y'?
WHEN
The Auto-FAX setting equals 'Y'
THEN
The system proceeds to check the FAX flag configuration, otherwise it disables Auto-FAX and uses standard routing
Context: Auto-FAX is enabled with setting 'Y'
GIVEN
Auto-FAX is enabled with setting 'Y'
Applied to: Check GCSTBRT-SC-FAX-FLAG
WHEN
The system checks the FAX flag configuration
THEN
The system reads the GCSTBRT-SC-FAX-FLAG field value
Context: Auto-FAX is enabled and FAX flag has been retrieved
GIVEN
Auto-FAX is enabled and FAX flag has been retrieved
Applied to: FAX Flag = 'Y'?
WHEN
The FAX flag equals 'Y'
THEN
The system enables Auto-FAX functionality and proceeds with FAX routing configuration, otherwise it disables Auto-FAX
Context: Both Auto-FAX setting and FAX flag are set to 'Y'
GIVEN
Both Auto-FAX setting and FAX flag are set to 'Y'
Applied to: Set Auto-FAX Enabled
WHEN
The system processes the configuration
THEN
The system sets Auto-FAX as enabled and prepares for FAX routing configuration
Context: Auto-FAX functionality is enabled
GIVEN
Auto-FAX functionality is enabled
Applied to: Configure FAX Routing with Copy IDs
WHEN
The system configures FAX routing
THEN
The system sets up FAX routing parameters with appropriate copy IDs for message distribution
Context: FAX routing has been configured with copy IDs
GIVEN
FAX routing has been configured with copy IDs
Applied to: Set External FAX Addressing
WHEN
The system sets up external addressing
THEN
The system configures external FAX addressing parameters for proper message delivery
Context: Either Auto-FAX setting is not 'Y' or FAX flag is not 'Y'
GIVEN
Either Auto-FAX setting is not 'Y' or FAX flag is not 'Y'
Applied to: Auto-FAX Disabled - Use Standard Routing
WHEN
Auto-FAX cannot be enabled
THEN
The system disables Auto-FAX functionality and uses standard routing procedures
R-GCX146-cbl-01831 (+10) File: GCX146.cbl Apply Line Segmentation Rules Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Line Segmentation Rules':
  • Context - an email report needs to be sent with multiple lines of content:
    For Apply Line Segmentation Rules:
    When the system processes the email content for transmission, then the content is segmented into batches of maximum 699 lines each with proper continuation headers for subsequent segments.
  • Context - email segmentation processing is starting:
    For Initialize Line Counter WS-LINE-SUB = 1:
    When the system begins processing email content, then the line counter is set to 1 to begin tracking from the first line.
  • Context - email content is being processed line by line:
    For Line Counter > 699?:
    When the line counter exceeds 699 lines in the current segment, then the current segment must be sent and a new segment must be started.
  • Context - an email segment has reached the maximum line limit of 699 lines:
    For Call X280-CALL-EMCSEND3 to Send Current Batch:
    When the segment transmission is triggered, then the emcsend3 service is invoked to send the current email batch.
  • Context - a completed email segment has been sent:
    For Reset Message Buffer:
    When the system prepares for the next segment, then the message buffer is reset to empty state for new content.
  • Context - a new email segment is being prepared after the first segment:
    For Add CONTINUATION OF REPORT Header:
    When the message buffer is reset for continuation, then a 'continuation of report' header is added to indicate this is a follow-up segment.
  • Context - a continuation segment is being prepared with header added:
    For Reset Line Counter for Next Batch:
    When the system starts processing the next batch of lines, then the line counter is reset to account for the continuation header and begin fresh counting.
  • Context - email content is being processed in segments:
    For More Lines to Process?:
    When the system completes processing a portion of content, then the system checks if more lines remain to be processed for continuation or completion.
  • Context - email content lines are being processed sequentially:
    For Increment Line Counter:
    When a line is processed and more lines remain, then the line counter is incremented by 1 to track progress within current segment.
  • Context - all email content has been processed and no more lines remain:
    For Send Final Batch:
    When the final segment is ready for transmission, then the final email batch is sent containing the remaining content.
  • Context - all email segments have been processed and sent:
    For Set NO-MORE-EMAIL Flag:
    When the final segment transmission is complete, then the no-more-email flag is set to indicate processing completion.
👨‍💻 Technical ACs (Gherkin)
Context: An email report needs to be sent with multiple lines of content
GIVEN
An email report needs to be sent with multiple lines of content
Applied to: Apply Line Segmentation Rules
WHEN
The system processes the email content for transmission
THEN
The content is segmented into batches of maximum 699 lines each with proper continuation headers for subsequent segments
Context: Email segmentation processing is starting
GIVEN
Email segmentation processing is starting
Applied to: Initialize Line Counter WS-LINE-SUB = 1
WHEN
The system begins processing email content
THEN
The line counter is set to 1 to begin tracking from the first line
Context: Email content is being processed line by line
GIVEN
Email content is being processed line by line
Applied to: Line Counter > 699?
WHEN
The line counter exceeds 699 lines in the current segment
THEN
The current segment must be sent and a new segment must be started
Context: An email segment has reached the maximum line limit of 699 lines
GIVEN
An email segment has reached the maximum line limit of 699 lines
Applied to: Call X280-CALL-EMCSEND3 to Send Current Batch
WHEN
The segment transmission is triggered
THEN
The EMCSEND3 service is invoked to send the current email batch
Context: A completed email segment has been sent
GIVEN
A completed email segment has been sent
Applied to: Reset Message Buffer
WHEN
The system prepares for the next segment
THEN
The message buffer is reset to empty state for new content
Context: A new email segment is being prepared after the first segment
GIVEN
A new email segment is being prepared after the first segment
Applied to: Add CONTINUATION OF REPORT Header
WHEN
The message buffer is reset for continuation
THEN
A 'CONTINUATION OF REPORT' header is added to indicate this is a follow-up segment
Context: A continuation segment is being prepared with header added
GIVEN
A continuation segment is being prepared with header added
Applied to: Reset Line Counter for Next Batch
WHEN
The system starts processing the next batch of lines
THEN
The line counter is reset to account for the continuation header and begin fresh counting
Context: Email content is being processed in segments
GIVEN
Email content is being processed in segments
Applied to: More Lines to Process?
WHEN
The system completes processing a portion of content
THEN
The system checks if more lines remain to be processed for continuation or completion
Context: Email content lines are being processed sequentially
GIVEN
Email content lines are being processed sequentially
Applied to: Increment Line Counter
WHEN
A line is processed and more lines remain
THEN
The line counter is incremented by 1 to track progress within current segment
Context: All email content has been processed and no more lines remain
GIVEN
All email content has been processed and no more lines remain
Applied to: Send Final Batch
WHEN
The final segment is ready for transmission
THEN
The final email batch is sent containing the remaining content
Context: All email segments have been processed and sent
GIVEN
All email segments have been processed and sent
Applied to: Set NO-MORE-EMAIL Flag
WHEN
The final segment transmission is complete
THEN
The NO-MORE-EMAIL flag is set to indicate processing completion
R-GCX146-cbl-01859 (+3) File: GCX146.cbl Remove Spaces from CCN Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Remove Spaces from CCN':
  • Context - a ccn contains space characters within the number:
    For Skip Space Character:
    When the system processes the ccn for compression, then all space characters are identified and excluded from the compressed ccn output.
  • Context - a ccn contains both space and non-space characters:
    For Copy Character to Compressed CCN:
    When the system encounters a non-space character during compression, then the character is copied to the compressed ccn maintaining the original sequence.
  • Context - a ccn requires space removal processing:
    For Scan CCN Character by Character:
    When the system begins compression, then each character position in the ccn is examined individually from start to end.
  • Context - all characters in the ccn have been processed and spaces removed:
    For Format Compressed CCN:
    When the compression process reaches completion, then the compressed ccn is formatted and prepared for return to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN contains space characters within the number
GIVEN
A CCN contains space characters within the number
Applied to: Skip Space Character
WHEN
The system processes the CCN for compression
THEN
All space characters are identified and excluded from the compressed CCN output
Context: A CCN contains both space and non-space characters
GIVEN
A CCN contains both space and non-space characters
Applied to: Copy Character to Compressed CCN
WHEN
The system encounters a non-space character during compression
THEN
The character is copied to the compressed CCN maintaining the original sequence
Context: A CCN requires space removal processing
GIVEN
A CCN requires space removal processing
Applied to: Scan CCN Character by Character
WHEN
The system begins compression
THEN
Each character position in the CCN is examined individually from start to end
Context: All characters in the CCN have been processed and spaces removed
GIVEN
All characters in the CCN have been processed and spaces removed
Applied to: Format Compressed CCN
WHEN
The compression process reaches completion
THEN
The compressed CCN is formatted and prepared for return to the calling process
R-GCX146-cbl-01863 (+9) File: GCX146.cbl Organize Numeric Sequences Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Organize Numeric Sequences':
  • Context - a ccn input data is provided to the system:
    For Receive CCN Input Data:
    When the organize numeric sequences process is initiated, then the system accepts the ccn input data for further processing.
  • Context - a ccn contains spaces within the string:
    For Remove Spaces from CCN:
    When the space removal process is executed, then all spaces are removed from the ccn string to create a continuous character sequence.
  • Context - the ccn processing is about to begin:
    For Initialize Sequence Counter:
    When the sequence counter initialization is performed, then the sequence counter is set to its starting value for character position tracking.
  • Context - a ccn string is ready for character-by-character analysis:
    For Scan CCN Characters:
    When the character scanning process is executed, then each character in the ccn string is examined in sequence.
  • Context - a character from the ccn string is being examined:
    For Character is Numeric?:
    When the character type validation is performed, then the system identifies whether the character is numeric (0-9) or non-numeric.
  • Context - a character has been identified as numeric:
    For Add to Numeric Sequence:
    When the numeric sequence building process is executed, then the numeric character is added to the current numeric sequence being organized.
  • Context - a character has been identified as non-numeric:
    For Process Non-Numeric Character:
    When the non-numeric character processing is executed, then the non-numeric character is handled according to the ccn organization rules.
  • Context - characters are being processed from the ccn string:
    For End of CCN String?:
    When the string completion check is performed, then the system determines if there are more characters to process or if the end of the string has been reached.
  • Context - all characters in the ccn have been processed and organized:
    For Format Organized Sequence:
    When the sequence formatting process is executed, then the organized sequence is formatted according to the specified business format requirements.
  • Context - the ccn has been organized and formatted:
    For Store Compressed CCN:
    When the storage process is executed, then the compressed ccn is stored in the designated location for further business processing.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN input data is provided to the system
GIVEN
A CCN input data is provided to the system
Applied to: Receive CCN Input Data
WHEN
The organize numeric sequences process is initiated
THEN
The system accepts the CCN input data for further processing
Context: A CCN contains spaces within the string
GIVEN
A CCN contains spaces within the string
Applied to: Remove Spaces from CCN
WHEN
The space removal process is executed
THEN
All spaces are removed from the CCN string to create a continuous character sequence
Context: The CCN processing is about to begin
GIVEN
The CCN processing is about to begin
Applied to: Initialize Sequence Counter
WHEN
The sequence counter initialization is performed
THEN
The sequence counter is set to its starting value for character position tracking
Context: A CCN string is ready for character-by-character analysis
GIVEN
A CCN string is ready for character-by-character analysis
Applied to: Scan CCN Characters
WHEN
The character scanning process is executed
THEN
Each character in the CCN string is examined in sequence
Context: A character from the CCN string is being examined
GIVEN
A character from the CCN string is being examined
Applied to: Character is Numeric?
WHEN
The character type validation is performed
THEN
The system identifies whether the character is numeric (0-9) or non-numeric
Context: A character has been identified as numeric
GIVEN
A character has been identified as numeric
Applied to: Add to Numeric Sequence
WHEN
The numeric sequence building process is executed
THEN
The numeric character is added to the current numeric sequence being organized
Context: A character has been identified as non-numeric
GIVEN
A character has been identified as non-numeric
Applied to: Process Non-Numeric Character
WHEN
The non-numeric character processing is executed
THEN
The non-numeric character is handled according to the CCN organization rules
Context: Characters are being processed from the CCN string
GIVEN
Characters are being processed from the CCN string
Applied to: End of CCN String?
WHEN
The string completion check is performed
THEN
The system determines if there are more characters to process or if the end of the string has been reached
Context: All characters in the CCN have been processed and organized
GIVEN
All characters in the CCN have been processed and organized
Applied to: Format Organized Sequence
WHEN
The sequence formatting process is executed
THEN
The organized sequence is formatted according to the specified business format requirements
Context: The CCN has been organized and formatted
GIVEN
The CCN has been organized and formatted
Applied to: Store Compressed CCN
WHEN
The storage process is executed
THEN
The compressed CCN is stored in the designated location for further business processing