Bits In Glass
BIG Pega COE Team

Detailed Acceptance Criteria (ACs)

Category: GCX015E

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.

🎯 GCX015E Scope Detected: Extracted 550 rules, Optimally Merged into 69 Feature Scenarios.
R-GCX015E-cbl-00001 (+21) File: GCX015E.cbl Overview Rules Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Overview Rules':
  • Context - the customs message processing system is starting up:
    For 1:Initialize Processing Fields:
    When the initialization process begins, then all processing switches are reset to initial state, counters are set to 1, table keys are cleared, function codes are set to 'gu', table id is set to 'ad', sequence id is set to 'adminid', accept status is set to 'ge', and admin configuration data is loaded from gcstbrt-ad-segment or default value 'om01247' is used if loading fails.
  • Context - a message is available in the queue:
    For 2:Load Message Table:
    When the system attempts to load the message, then if completion code is ok and message entries are less than 1, system abends with 'message too short' error; if completion code is ok and backout count is not 0, message is marked as skip; if completion code is ok and backout count is 0, message is marked as good; if completion code is failed and reason is no-msg-available or other, system abends with mqget failed error.
  • Context - an m10 segment is present in the message:
    For 3:Determine Train or Cargo Processing:
    When the system examines the m10-12-ref-num field, then if reference number key equals 'train', processing type is set to train; if reference number key equals 'cargo', processing type is set to cargo; if neither condition is met and m11 segment exists, processing type is set to cargo using m11 data; otherwise processing type remains unknown.
  • Context - an m10 segment with manifest type code is being processed:
    For 4:Set Status Update Decision:
    When the system evaluates the m10-09-manifest-typ-cde, then if manifest type is 'p' or 'y' or 's', status should be updated; if manifest type is 'h' and processing type is train, status should be deleted and updated; if manifest type is 'h' and processing type is cargo, status should not be updated; otherwise status should not be updated.
  • Context - a message table entry with id 'm10' is encountered:
    For 5:Process M10 Manifest Segment:
    When the system processes the m10 segment, then the m10 segment found flag is set to true and the table entry data is moved to the m10 segment structure.
  • Context - a message table entry with id 'p4 ' is encountered:
    For 6:Process P4 Segment:
    When the system processes the p4 segment, then the p4 segment found flag is set to true and the table entry data is moved to the p4 segment structure.
  • Context - a message table entry with id 'n10' is encountered:
    For 7:Process N10 Line Release Numbers:
    When the system processes the n10 segment, then the table entry data is moved to n10 segment structure and the line release number (n10-09) is stored in working storage hold field.
  • Context - a message table entry with id 'k1 ' is encountered:
    For 8:Process K1 Error Messages:
    When the system evaluates the k1-02-msg-number, then if message number is '000', severity is set to informational and status to ack; if message number is '009', '017', '038', '040', '291', or '630', severity is set to fatal and status to error; if message number is '631', '632', '633', '634', '695', '696', '697', '698', or '699', severity is set to warning and status to ack; if message number is '695', '697', or '699', email warning is sent; for all other message numbers, severity is set to unknown and status to ack; free form message content is logged if present.
  • Context - a k3 segment is being processed:
    For 9:Process K3 Accept/Reject Counts:
    When the system evaluates k3-01-total-reject and k3-01-total-accept counts, then if total reject is zero and total accept is greater than zero and train is pre-arrived, status is set to pre-arrival; if total reject is zero and total accept is greater than zero and train is review complete, status is set to review-completed; if total reject is zero and total accept is greater than zero for other cases, status is set to ack; if total reject is zero and total accept is zero, 'uscs k3 record has zero counts' is logged and status is set to ack; if total reject is greater than zero, status is set to error.
  • Context - a customs transaction message has been processed:
    For 10:Validate Required Segments Present:
    When the system validates required segments, then if m10 segment is not found, 'm10 segment not found on 355 transaction' is logged; if p4 segment is not found, 'p4 segment not found on 355 transaction' is logged; if k3 segment is not found, 'k3 segment not found on 355 transaction' is logged and a default k3 segment is processed.
  • Context - processing type is determined as cargo:
    For 11:Retrieve Cargo Root Information:
    When the system attempts to retrieve cargo root data using the us ccn key, then if cargo record is found, the cargo data is loaded and cargo/train found flag is set to true with equipment car number as sub-key; if cargo record is not found, cargo/train not found flag is set to true and 'this us-ccn-key was not found' message is logged.
  • Context - processing type is determined as train:
    For 12:Retrieve Train Root Information:
    When the system attempts to retrieve train root data using the us customer train id, then if train record is found, the train data is loaded and cargo/train found flag is set to true with us train id as sub-key; if train record is not found, cargo/train not found flag is set to true and 'this us-train-id was not found' message is logged.
  • Context - processing type is train and status update is required:
    For 13:Update Train Status:
    When the system evaluates train status conditions, then if train is deleted and status is ack, current status is set to 'deleted'; if train is delete pending and status is ack, current status is set to 'deleted'; if train is not deleted and not delete pending, current status is set to working status; after status update, aei train send conditions are checked and if train is ack and arrived pending, train arrival process is triggered.
  • Context - processing type is cargo and status update is required:
    For 14:Update Cargo Status:
    When the system evaluates cargo status conditions, then if status is ack and no saved status description exists, uscargo status is set to ack; if status is ack and saved status description exists, saved status and description are restored; if status is error and current status is not error/ack/ack-r, current status is saved and uscargo status is set to error; if status is error and cargo is not deleted, cpcargo status is set to error.
  • Context - a train status has been updated:
    For 15:Check AEI Train Send Conditions:
    When the system checks aei send conditions, then if train status is ack and aei send flag is set and enroute is not reported and train id ends with 't', customs transaction gct1461e is generated, car information is loaded, and customs system is notified; if aei send flag is set, aei status message is sent.
  • Context - aei customs transaction needs to be sent:
    For 16:Load Car Information for Customs:
    When the system loads car information from train equipment list, then for each equipment item, if container indicator is not 'c', car initial and number are loaded, car length/empty indicator is determined based on next equipment or current equipment container status, car kind is set to 'l' for lo type or 'e' for et type or spaces for others; containers are excluded from the customs output.
  • Context - aei processing is required for a train:
    For 17:Send AEI Status Message:
    When the system sends aei status message, then aei merlin id is retrieved, message subject is formatted with train id and current status, and message is sent via merlin system.
  • Context - train status is ack and train is in arrived pending state:
    For 18:Process Train Arrival:
    When the system processes train arrival, then arrival transaction gct1121e is generated with action code 'tar', current machine date and time as event date/time, us customer train id, and train type flag set to true.
  • Context - k1 message number is '695', '697', or '699':
    For 19:Send Email Warning Notifications:
    When the system processes the warning message, then freight forwarder information is retrieved, broker contact details are obtained if available, shipment root data is loaded, comprehensive email is formatted with ccn, equipment details, waybill information, load/empty indicator, content description, origin/destination stations, consignee information, cbp warning message, and occurrence timestamp, and email is sent to appropriate recipients.
  • Context - a customs transaction has been processed:
    For 23:Log Customs Response Information:
    When the system logs the transaction information, then log message is prepared with train or cargo ccn, processing type flag, action code 'zzz', status message content, sending transaction code, acf2 user id, current date from k3 segment, and current time from k3 segment, and log entry is spawned via gct1051e transaction.
  • Context - a special test transaction with specific reference numbers is being processed:
    For 24:Update Manifest Type Timestamps:
    When the system updates manifest type timestamps, then t1 control table segment is retrieved, if manifest type is 'p', 309-ack timestamp is updated with current date and time; if manifest type is 'h', 353-ack timestamp is updated with current date and time; if manifest type is 's', 358-ack timestamp is updated with current date and time; updated segment is written back to control table.
  • Context - a customs transaction has been prepared with car information:
    For 25:Send Customs Transaction:
    When the system sends the transaction to customs system, then transaction is sent via cims call with customs transaction code, message is written using writmsgl with customs message length and module name, and transaction is purged after sending.
👨‍💻 Technical ACs (Gherkin)
Context: The customs message processing system is starting up
GIVEN
The customs message processing system is starting up
Applied to: 1:Initialize Processing Fields
WHEN
The initialization process begins
THEN
All processing switches are reset to initial state, counters are set to 1, table keys are cleared, function codes are set to 'GU', table ID is set to 'AD', sequence ID is set to 'ADMINID', accept status is set to 'GE', and admin configuration data is loaded from GCSTBRT-AD-SEGMENT or default value 'OM01247' is used if loading fails
Context: A message is available in the queue
GIVEN
A message is available in the queue
Applied to: 2:Load Message Table
WHEN
The system attempts to load the message
THEN
If completion code is OK and message entries are less than 1, system abends with 'MESSAGE TOO SHORT' error; if completion code is OK and backout count is not 0, message is marked as SKIP; if completion code is OK and backout count is 0, message is marked as GOOD; if completion code is FAILED and reason is NO-MSG-AVAILABLE or OTHER, system abends with MQGET FAILED error
Context: An M10 segment is present in the message
GIVEN
An M10 segment is present in the message
Applied to: 3:Determine Train or Cargo Processing
WHEN
The system examines the M10-12-REF-NUM field
THEN
If reference number key equals 'TRAIN', processing type is set to TRAIN; if reference number key equals 'CARGO', processing type is set to CARGO; if neither condition is met and M11 segment exists, processing type is set to CARGO using M11 data; otherwise processing type remains UNKNOWN
Context: An M10 segment with manifest type code is being processed
GIVEN
An M10 segment with manifest type code is being processed
Applied to: 4:Set Status Update Decision
WHEN
The system evaluates the M10-09-MANIFEST-TYP-CDE
THEN
If manifest type is 'P' or 'Y' or 'S', status should be updated; if manifest type is 'H' and processing type is TRAIN, status should be deleted and updated; if manifest type is 'H' and processing type is CARGO, status should not be updated; otherwise status should not be updated
Context: A message table entry with ID 'M10' is encountered
GIVEN
A message table entry with ID 'M10' is encountered
Applied to: 5:Process M10 Manifest Segment
WHEN
The system processes the M10 segment
THEN
The M10 segment found flag is set to true and the table entry data is moved to the M10 segment structure
Context: A message table entry with ID 'P4 ' is encountered
GIVEN
A message table entry with ID 'P4 ' is encountered
Applied to: 6:Process P4 Segment
WHEN
The system processes the P4 segment
THEN
The P4 segment found flag is set to true and the table entry data is moved to the P4 segment structure
Context: A message table entry with ID 'N10' is encountered
GIVEN
A message table entry with ID 'N10' is encountered
Applied to: 7:Process N10 Line Release Numbers
WHEN
The system processes the N10 segment
THEN
The table entry data is moved to N10 segment structure and the line release number (N10-09) is stored in working storage hold field
Context: A message table entry with ID 'K1 ' is encountered
GIVEN
A message table entry with ID 'K1 ' is encountered
Applied to: 8:Process K1 Error Messages
WHEN
The system evaluates the K1-02-MSG-NUMBER
THEN
If message number is '000', severity is set to Informational and status to ACK; if message number is '009', '017', '038', '040', '291', or '630', severity is set to Fatal and status to ERROR; if message number is '631', '632', '633', '634', '695', '696', '697', '698', or '699', severity is set to Warning and status to ACK; if message number is '695', '697', or '699', email warning is sent; for all other message numbers, severity is set to Unknown and status to ACK; free form message content is logged if present
Context: A K3 segment is being processed
GIVEN
A K3 segment is being processed
Applied to: 9:Process K3 Accept/Reject Counts
WHEN
The system evaluates K3-01-TOTAL-REJECT and K3-01-TOTAL-ACCEPT counts
THEN
If total reject is zero and total accept is greater than zero and train is pre-arrived, status is set to PRE-ARRIVAL; if total reject is zero and total accept is greater than zero and train is review complete, status is set to REVIEW-COMPLETED; if total reject is zero and total accept is greater than zero for other cases, status is set to ACK; if total reject is zero and total accept is zero, 'USCS K3 RECORD HAS ZERO COUNTS' is logged and status is set to ACK; if total reject is greater than zero, status is set to ERROR
Context: A customs transaction message has been processed
GIVEN
A customs transaction message has been processed
Applied to: 10:Validate Required Segments Present
WHEN
The system validates required segments
THEN
If M10 segment is not found, 'M10 SEGMENT NOT FOUND ON 355 TRANSACTION' is logged; if P4 segment is not found, 'P4 SEGMENT NOT FOUND ON 355 TRANSACTION' is logged; if K3 segment is not found, 'K3 SEGMENT NOT FOUND ON 355 TRANSACTION' is logged and a default K3 segment is processed
Context: Processing type is determined as CARGO
GIVEN
Processing type is determined as CARGO
Applied to: 11:Retrieve Cargo Root Information
WHEN
The system attempts to retrieve cargo root data using the US CCN key
THEN
If cargo record is found, the cargo data is loaded and cargo/train found flag is set to true with equipment car number as sub-key; if cargo record is not found, cargo/train not found flag is set to true and 'THIS US-CCN-KEY WAS NOT FOUND' message is logged
Context: Processing type is determined as TRAIN
GIVEN
Processing type is determined as TRAIN
Applied to: 12:Retrieve Train Root Information
WHEN
The system attempts to retrieve train root data using the US customer train ID
THEN
If train record is found, the train data is loaded and cargo/train found flag is set to true with US train ID as sub-key; if train record is not found, cargo/train not found flag is set to true and 'THIS US-TRAIN-ID WAS NOT FOUND' message is logged
Context: Processing type is TRAIN and status update is required
GIVEN
Processing type is TRAIN and status update is required
Applied to: 13:Update Train Status
WHEN
The system evaluates train status conditions
THEN
If train is deleted and status is ACK, current status is set to 'DELETED'; if train is delete pending and status is ACK, current status is set to 'DELETED'; if train is not deleted and not delete pending, current status is set to working status; after status update, AEI train send conditions are checked and if train is ACK and arrived pending, train arrival process is triggered
Context: Processing type is CARGO and status update is required
GIVEN
Processing type is CARGO and status update is required
Applied to: 14:Update Cargo Status
WHEN
The system evaluates cargo status conditions
THEN
If status is ACK and no saved status description exists, USCARGO status is set to ACK; if status is ACK and saved status description exists, saved status and description are restored; if status is ERROR and current status is not ERROR/ACK/ACK-R, current status is saved and USCARGO status is set to ERROR; if status is ERROR and cargo is not deleted, CPCARGO status is set to ERROR
Context: A train status has been updated
GIVEN
A train status has been updated
Applied to: 15:Check AEI Train Send Conditions
WHEN
The system checks AEI send conditions
THEN
If train status is ACK and AEI send flag is set and enroute is not reported and train ID ends with 'T', customs transaction GCT1461E is generated, car information is loaded, and customs system is notified; if AEI send flag is set, AEI status message is sent
Context: AEI customs transaction needs to be sent
GIVEN
AEI customs transaction needs to be sent
Applied to: 16:Load Car Information for Customs
WHEN
The system loads car information from train equipment list
THEN
For each equipment item, if container indicator is not 'C', car initial and number are loaded, car length/empty indicator is determined based on next equipment or current equipment container status, car kind is set to 'L' for LO type or 'E' for ET type or spaces for others; containers are excluded from the customs output
Context: AEI processing is required for a train
GIVEN
AEI processing is required for a train
Applied to: 17:Send AEI Status Message
WHEN
The system sends AEI status message
THEN
AEI Merlin ID is retrieved, message subject is formatted with train ID and current status, and message is sent via Merlin system
Context: Train status is ACK and train is in arrived pending state
GIVEN
Train status is ACK and train is in arrived pending state
Applied to: 18:Process Train Arrival
WHEN
The system processes train arrival
THEN
Arrival transaction GCT1121E is generated with action code 'TAR', current machine date and time as event date/time, US customer train ID, and train type flag set to true
Context: K1 message number is '695', '697', or '699'
GIVEN
K1 message number is '695', '697', or '699'
Applied to: 19:Send Email Warning Notifications
WHEN
The system processes the warning message
THEN
Freight forwarder information is retrieved, broker contact details are obtained if available, shipment root data is loaded, comprehensive email is formatted with CCN, equipment details, waybill information, load/empty indicator, content description, origin/destination stations, consignee information, CBP warning message, and occurrence timestamp, and email is sent to appropriate recipients
Context: A customs transaction has been processed
GIVEN
A customs transaction has been processed
Applied to: 23:Log Customs Response Information
WHEN
The system logs the transaction information
THEN
Log message is prepared with train or cargo CCN, processing type flag, action code 'ZZZ', status message content, sending transaction code, ACF2 user ID, current date from K3 segment, and current time from K3 segment, and log entry is spawned via GCT1051E transaction
Context: A special test transaction with specific reference numbers is being processed
GIVEN
A special test transaction with specific reference numbers is being processed
Applied to: 24:Update Manifest Type Timestamps
WHEN
The system updates manifest type timestamps
THEN
T1 control table segment is retrieved, if manifest type is 'P', 309-ACK timestamp is updated with current date and time; if manifest type is 'H', 353-ACK timestamp is updated with current date and time; if manifest type is 'S', 358-ACK timestamp is updated with current date and time; updated segment is written back to control table
Context: A customs transaction has been prepared with car information
GIVEN
A customs transaction has been prepared with car information
Applied to: 25:Send Customs Transaction
WHEN
The system sends the transaction to customs system
THEN
Transaction is sent via CIMS call with customs transaction code, message is written using WRITMSGL with customs message length and module name, and transaction is purged after sending
R-GCX015E-cbl-00023 (+12) File: GCX015E.cbl Initialize Processing Fields Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Processing Fields':
  • Context - message processing is starting:
    For Clear Working Variables & Initialize K1 Error Message Table & Set Database Function Codes:
    When the system initializes processing fields, then all working variables for train/cargo switches and hold areas are cleared to spaces and k1 counter is set to 1 and k1 table is initialized to collect error messages and database function code is set to 'gu', table id is set to 'ad', sequence id is set to 'adminid', and accept status is set to 'ge'.
  • Context - database access parameters are configured:
    For Retrieve Admin Configuration:
    When the system retrieves admin configuration, then the system calls the table segment retrieval function to get administrative settings.
  • Context - administrative configuration retrieval is attempted:
    For Load Admin Settings:
    When the table segment return flag equals '0' indicating successful retrieval, then the retrieved table segment is moved to the administrative segment working area.
    For Set Default Admin ID:
    When the table segment return flag is not equal to '0' indicating retrieval failure, then the default administrative id 'om01247' is set in the administrative configuration area.
  • Context - administrative configuration is processed:
    For Initialize Email Subject Fields:
    When the system initializes email fields, then email subject area and error report area are initialized to spaces.
  • Context - email fields are initialized:
    For Calculate Message Length Parameters:
    When the system calculates message parameters, then message header length is set to the length of mqs message header, unused length is set to zero, and single entry length is set to the length of one mqs table entry.
  • Context - message length parameters are calculated:
    For Set Processing Status Flags:
    When the system sets processing status flags, then us cargo/train not found flag is set to true, m10/p4/k3 segment not found flags are set to true, end not found flag is set to true.
  • Context - processing status flags are set:
    For Initialize Line Counter:
    When the system initializes the line counter, then the error report line counter is set to 1 and error report area is cleared to spaces.
  • Context - line counter is initialized:
    For Set Database Accept Status:
    When the system configures database status, then database accept status is set to 'ge' for subsequent operations.
  • Context - database accept status is configured:
    For Connect to Message Queue System:
    When the system connects to message queue, then message queue connection is established by calling the queue read function and mq connection function.
  • Context - message queue connection is established:
    For Open Message Queue for Reading:
    When the system opens the message queue, then message queue is opened for reading by calling the mq open function.
👨‍💻 Technical ACs (Gherkin)
Context: Message processing is starting
GIVEN
Message processing is starting
Applied to: Clear Working Variables & Initialize K1 Error Message Table & Set Database Function Codes
WHEN
The system initializes processing fields
THEN
All working variables for train/cargo switches and hold areas are cleared to spaces AND K1 counter is set to 1 and K1 table is initialized to collect error messages AND Database function code is set to 'GU', table ID is set to 'AD', sequence ID is set to 'ADMINID', and accept status is set to 'GE'
Context: Database access parameters are configured
GIVEN
Database access parameters are configured
Applied to: Retrieve Admin Configuration
WHEN
The system retrieves admin configuration
THEN
The system calls the table segment retrieval function to get administrative settings
Context: Administrative configuration retrieval is attempted
GIVEN
Administrative configuration retrieval is attempted
Applied to: Load Admin Settings
WHEN
The table segment return flag equals '0' indicating successful retrieval
THEN
The retrieved table segment is moved to the administrative segment working area
Applied to: Set Default Admin ID
WHEN
The table segment return flag is not equal to '0' indicating retrieval failure
THEN
The default administrative ID 'OM01247' is set in the administrative configuration area
Context: Administrative configuration is processed
GIVEN
Administrative configuration is processed
Applied to: Initialize Email Subject Fields
WHEN
The system initializes email fields
THEN
Email subject area and error report area are initialized to spaces
Context: Email fields are initialized
GIVEN
Email fields are initialized
Applied to: Calculate Message Length Parameters
WHEN
The system calculates message parameters
THEN
Message header length is set to the length of MQS message header, unused length is set to zero, and single entry length is set to the length of one MQS table entry
Context: Message length parameters are calculated
GIVEN
Message length parameters are calculated
Applied to: Set Processing Status Flags
WHEN
The system sets processing status flags
THEN
US cargo/train not found flag is set to true, M10/P4/K3 segment not found flags are set to true, end not found flag is set to true
Context: Processing status flags are set
GIVEN
Processing status flags are set
Applied to: Initialize Line Counter
WHEN
The system initializes the line counter
THEN
The error report line counter is set to 1 and error report area is cleared to spaces
Context: Line counter is initialized
GIVEN
Line counter is initialized
Applied to: Set Database Accept Status
WHEN
The system configures database status
THEN
Database accept status is set to 'GE' for subsequent operations
Context: Database accept status is configured
GIVEN
Database accept status is configured
Applied to: Connect to Message Queue System
WHEN
The system connects to message queue
THEN
Message queue connection is established by calling the queue read function and MQ connection function
Context: Message queue connection is established
GIVEN
Message queue connection is established
Applied to: Open Message Queue for Reading
WHEN
The system opens the message queue
THEN
Message queue is opened for reading by calling the MQ open function
R-GCX015E-cbl-00036 (+5) File: GCX015E.cbl Load Message Table Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Load Message Table':
  • Context - the system is connected to the message queue:
    For Read Message from MQ Queue:
    When a message read operation is initiated, then the system attempts to retrieve the next available message from the queue.
  • Context - a message has been successfully read from the queue:
    For Message Too Short?:
    When the message contains less than one complete message entry, then the system flags the message as too short and terminates processing with error gct0152e.
  • Context - a message has been read successfully and is not too short:
    For Message Previously Failed?:
    When the message backout count is greater than zero, then the system skips the message and sets skip message flag to prevent reprocessing.
  • Context - a message has been read successfully, is not too short, and has not previously failed:
    For Accept Message - Set Good Message Flag:
    When the message backout count equals zero, then the system accepts the message and sets good message flag for further processing.
  • Context - the system attempts to read from the message queue:
    For MQ Queue Empty?:
    When the queue returns reason code 2033 indicating no messages available, then the system sets finished processing flag and completes the load operation.
  • Context - the system encounters an error while reading from the message queue:
    For Other MQ Error?:
    When the error is not a 'no messages available' condition and completion code indicates failure, then the system sets end of queue flag and terminates processing with appropriate error message.
👨‍💻 Technical ACs (Gherkin)
Context: The system is connected to the message queue
GIVEN
The system is connected to the message queue
Applied to: Read Message from MQ Queue
WHEN
A message read operation is initiated
THEN
The system attempts to retrieve the next available message from the queue
Context: A message has been successfully read from the queue
GIVEN
A message has been successfully read from the queue
Applied to: Message Too Short?
WHEN
The message contains less than one complete message entry
THEN
The system flags the message as too short and terminates processing with error GCT0152E
Context: A message has been read successfully and is not too short
GIVEN
A message has been read successfully and is not too short
Applied to: Message Previously Failed?
WHEN
The message backout count is greater than zero
THEN
The system skips the message and sets skip message flag to prevent reprocessing
Context: A message has been read successfully, is not too short, and has not previously failed
GIVEN
A message has been read successfully, is not too short, and has not previously failed
Applied to: Accept Message - Set Good Message Flag
WHEN
The message backout count equals zero
THEN
The system accepts the message and sets good message flag for further processing
Context: The system attempts to read from the message queue
GIVEN
The system attempts to read from the message queue
Applied to: MQ Queue Empty?
WHEN
The queue returns reason code 2033 indicating no messages available
THEN
The system sets finished processing flag and completes the load operation
Context: The system encounters an error while reading from the message queue
GIVEN
The system encounters an error while reading from the message queue
Applied to: Other MQ Error?
WHEN
The error is not a 'no messages available' condition and completion code indicates failure
THEN
The system sets end of queue flag and terminates processing with appropriate error message
R-GCX015E-cbl-00042 (+16) File: GCX015E.cbl Determine Train or Cargo Processing Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Train or Cargo Processing':
  • Context - a message line is being processed:
    For Is Current Line M10 Segment?:
    When the system checks if the current line contains an m10 segment identifier, then the system proceeds to extract m10 data if identified, otherwise continues to next segment.
  • Context - an m10 segment has been identified in the current message line:
    For Get M10-12 Reference Number:
    When the system processes the m10 segment, then the m10-12 reference number is extracted and stored for shipment type determination.
  • Context - an m10-12 reference number has been extracted from the segment:
    For Reference Number Key = 'TRAIN'?:
    When the reference number key portion equals 'train', then the system sets the train processing flag to true.
  • Context - the reference number key has been identified as 'train':
    For Set Train Processing Flag:
    When the system determines the shipment type, then the train processing flag is set to true.
  • Context - an m10-12 reference number has been extracted and does not contain 'train':
    For Reference Number Key = 'CARGO'?:
    When the reference number key portion equals 'cargo', then the system sets the cargo processing flag to true.
  • Context - the reference number key has been identified as 'cargo':
    For Set Cargo Processing Flag:
    When the system determines the shipment type, then the cargo processing flag is set to true.
  • Context - a shipment type has been determined and manifest type code is available:
    For Manifest Type = P/Y/S?:
    When the manifest type code is 'p' (preliminary), 'y' (yard), or 's' (special), then the system sets the should update status flag to true.
  • Context - the manifest type is identified as p, y, or s:
    For Set Should Update Status Flag:
    When the system evaluates update requirements, then the should update status flag is set to true.
  • Context - the manifest type is not p, y, or s:
    For Manifest Type = H?:
    When the manifest type code is 'h' (hold), then the system proceeds to evaluate train versus cargo processing for hold manifests.
  • Context - the manifest type is 'h' (hold):
    For Processing Train?:
    When the shipment is being processed as a train, then the system sets both delete status and update status flags to true.
  • Context - a hold manifest is being processed for a train shipment:
    For Set Should Delete Status Flag:
    When the system determines processing requirements, then both should delete status and should update status flags are set to true.
  • Context - the manifest type is 'h' for cargo shipments or the manifest type is not p, y, s, or h:
    For Set Should Not Update Status Flag:
    When the system evaluates update requirements, then the should not update status flag is set to true.
  • Context - m10 segment processing is complete:
    For Type Still Unknown?:
    When neither train nor cargo flags have been set, then the system proceeds to check for m11 segment as alternative data source.
  • Context - shipment type remains unknown after m10 processing:
    For Is Current Line M11 Segment?:
    When the current line contains an m11 segment identifier, then the system extracts m11 segment data for cargo identification.
  • Context - an m11 segment has been identified:
    For Extract M11 Segment Data:
    When the system processes the m11 segment, then m11 segment data is extracted including scac and bill of lading number.
  • Context - m11 segment data has been extracted:
    For Build Cargo Key from M11 Data:
    When the system builds the cargo identification key, then a cargo key is constructed using m11-12 scac and m11-01 bill of lading number.
  • Context - a cargo key has been successfully built from m11 data:
    For Set Cargo Processing Flag:
    When the system finalizes shipment type determination, then the cargo processing flag is set to true.
👨‍💻 Technical ACs (Gherkin)
Context: A message line is being processed
GIVEN
A message line is being processed
Applied to: Is Current Line M10 Segment?
WHEN
The system checks if the current line contains an M10 segment identifier
THEN
The system proceeds to extract M10 data if identified, otherwise continues to next segment
Context: An M10 segment has been identified in the current message line
GIVEN
An M10 segment has been identified in the current message line
Applied to: Get M10-12 Reference Number
WHEN
The system processes the M10 segment
THEN
The M10-12 reference number is extracted and stored for shipment type determination
Context: An M10-12 reference number has been extracted from the segment
GIVEN
An M10-12 reference number has been extracted from the segment
Applied to: Reference Number Key = 'TRAIN'?
WHEN
The reference number key portion equals 'TRAIN'
THEN
The system sets the train processing flag to true
Context: The reference number key has been identified as 'TRAIN'
GIVEN
The reference number key has been identified as 'TRAIN'
Applied to: Set Train Processing Flag
WHEN
The system determines the shipment type
THEN
The train processing flag is set to true
Context: An M10-12 reference number has been extracted and does not contain 'TRAIN'
GIVEN
An M10-12 reference number has been extracted and does not contain 'TRAIN'
Applied to: Reference Number Key = 'CARGO'?
WHEN
The reference number key portion equals 'CARGO'
THEN
The system sets the cargo processing flag to true
Context: The reference number key has been identified as 'CARGO'
GIVEN
The reference number key has been identified as 'CARGO'
Applied to: Set Cargo Processing Flag
WHEN
The system determines the shipment type
THEN
The cargo processing flag is set to true
Context: A shipment type has been determined and manifest type code is available
GIVEN
A shipment type has been determined and manifest type code is available
Applied to: Manifest Type = P/Y/S?
WHEN
The manifest type code is 'P' (Preliminary), 'Y' (Yard), or 'S' (Special)
THEN
The system sets the should update status flag to true
Context: The manifest type is identified as P, Y, or S
GIVEN
The manifest type is identified as P, Y, or S
Applied to: Set Should Update Status Flag
WHEN
The system evaluates update requirements
THEN
The should update status flag is set to true
Context: The manifest type is not P, Y, or S
GIVEN
The manifest type is not P, Y, or S
Applied to: Manifest Type = H?
WHEN
The manifest type code is 'H' (Hold)
THEN
The system proceeds to evaluate train versus cargo processing for hold manifests
Context: The manifest type is 'H' (Hold)
GIVEN
The manifest type is 'H' (Hold)
Applied to: Processing Train?
WHEN
The shipment is being processed as a train
THEN
The system sets both delete status and update status flags to true
Context: A hold manifest is being processed for a train shipment
GIVEN
A hold manifest is being processed for a train shipment
Applied to: Set Should Delete Status Flag
WHEN
The system determines processing requirements
THEN
Both should delete status and should update status flags are set to true
Context: The manifest type is 'H' for cargo shipments or the manifest type is not P, Y, S, or H
GIVEN
The manifest type is 'H' for cargo shipments or the manifest type is not P, Y, S, or H
Applied to: Set Should Not Update Status Flag
WHEN
The system evaluates update requirements
THEN
The should not update status flag is set to true
Context: M10 segment processing is complete
GIVEN
M10 segment processing is complete
Applied to: Type Still Unknown?
WHEN
Neither train nor cargo flags have been set
THEN
The system proceeds to check for M11 segment as alternative data source
Context: Shipment type remains unknown after M10 processing
GIVEN
Shipment type remains unknown after M10 processing
Applied to: Is Current Line M11 Segment?
WHEN
The current line contains an M11 segment identifier
THEN
The system extracts M11 segment data for cargo identification
Context: An M11 segment has been identified
GIVEN
An M11 segment has been identified
Applied to: Extract M11 Segment Data
WHEN
The system processes the M11 segment
THEN
M11 segment data is extracted including SCAC and bill of lading number
Context: M11 segment data has been extracted
GIVEN
M11 segment data has been extracted
Applied to: Build Cargo Key from M11 Data
WHEN
The system builds the cargo identification key
THEN
A cargo key is constructed using M11-12 SCAC and M11-01 bill of lading number
Context: A cargo key has been successfully built from M11 data
GIVEN
A cargo key has been successfully built from M11 data
Applied to: Set Cargo Processing Flag
WHEN
The system finalizes shipment type determination
THEN
The cargo processing flag is set to true
R-GCX015E-cbl-00059 (+3) File: GCX015E.cbl Set Status Update Decision Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Status Update Decision':
  • Context - a customs manifest message is being processed:
    For Set SHOULD-UPDATE-STATUS:
    When the m10 segment manifest type code is 'p' (primary), 'y' (yes), or 's' (supplemental), then the system sets the record to require status update.
    For Set SHOULD-NOT-UPDATE-STATUS:
    When the m10 segment manifest type code is not 'p', 'y', 's', or 'h', then the system sets the record to not require status update.
  • Context - a customs manifest message is being processed and the processing type is determined as train:
    For Set SHOULD-DELETE-STATUS and SHOULD-UPDATE-STATUS:
    When the m10 segment manifest type code is 'h' (hold), then the system sets the record to require both deletion and status update.
  • Context - a customs manifest message is being processed and the processing type is determined as cargo:
    For Set SHOULD-NOT-UPDATE-STATUS:
    When the m10 segment manifest type code is 'h' (hold), then the system sets the record to not require status update.
👨‍💻 Technical ACs (Gherkin)
Context: A customs manifest message is being processed
GIVEN
A customs manifest message is being processed
Applied to: Set SHOULD-UPDATE-STATUS
WHEN
The M10 segment manifest type code is 'P' (Primary), 'Y' (Yes), or 'S' (Supplemental)
THEN
The system sets the record to require status update
Applied to: Set SHOULD-NOT-UPDATE-STATUS
WHEN
The M10 segment manifest type code is not 'P', 'Y', 'S', or 'H'
THEN
The system sets the record to not require status update
Context: A customs manifest message is being processed AND the processing type is determined as train
GIVEN
A customs manifest message is being processed AND the processing type is determined as train
Applied to: Set SHOULD-DELETE-STATUS and SHOULD-UPDATE-STATUS
WHEN
The M10 segment manifest type code is 'H' (Hold)
THEN
The system sets the record to require both deletion and status update
Context: A customs manifest message is being processed AND the processing type is determined as cargo
GIVEN
A customs manifest message is being processed AND the processing type is determined as cargo
Applied to: Set SHOULD-NOT-UPDATE-STATUS
WHEN
The M10 segment manifest type code is 'H' (Hold)
THEN
The system sets the record to not require status update
R-GCX015E-cbl-00063 (+6) File: GCX015E.cbl Process M10 Manifest Segment Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process M10 Manifest Segment':
  • Context - an m10 segment is being processed with a reference number in m10-12-ref-num field:
    For Reference Number Type?:
    When the reference number contains the text 'train', then the system sets the processing type as train.
    For Reference Number Type?:
    When the reference number contains the text 'cargo', then the system sets the processing type as cargo.
  • Context - an m10 segment is being processed with a manifest type code in m10-09-manifest-typ-cde field:
    For Set UPDATE Status Decision:
    When the manifest type code is 'p' or 'y' or 's', then the system sets should-update-status to true.
    For Set NO UPDATE Status Decision:
    When the manifest type code is not 'p', 'y', 's', or 'h', then the system sets should-not-update-status to true.
  • Context - an m10 segment is being processed with manifest type code 'h' and the processing type is train:
    For Set DELETE Status Decision:
    When the manifest type code is 'h' and ws-train is true, then the system sets both should-delete-status and should-update-status to true.
  • Context - an m10 segment is being processed with manifest type code 'h' and the processing type is cargo:
    For Set NO UPDATE Status Decision:
    When the manifest type code is 'h' and ws-train is false, then the system sets should-not-update-status to true.
  • Context - an m10 segment has been processed successfully:
    For Mark M10 Segment as Found:
    When all m10 segment processing is complete, then the system sets ws-m10-segment-found to true.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 segment is being processed with a reference number in M10-12-REF-NUM field
GIVEN
An M10 segment is being processed with a reference number in M10-12-REF-NUM field
Applied to: Reference Number Type?
WHEN
The reference number contains the text 'TRAIN'
THEN
The system sets the processing type as TRAIN
Applied to: Reference Number Type?
WHEN
The reference number contains the text 'CARGO'
THEN
The system sets the processing type as CARGO
Context: An M10 segment is being processed with a manifest type code in M10-09-MANIFEST-TYP-CDE field
GIVEN
An M10 segment is being processed with a manifest type code in M10-09-MANIFEST-TYP-CDE field
Applied to: Set UPDATE Status Decision
WHEN
The manifest type code is 'P' or 'Y' or 'S'
THEN
The system sets SHOULD-UPDATE-STATUS to true
Applied to: Set NO UPDATE Status Decision
WHEN
The manifest type code is not 'P', 'Y', 'S', or 'H'
THEN
The system sets SHOULD-NOT-UPDATE-STATUS to true
Context: An M10 segment is being processed with manifest type code 'H' and the processing type is TRAIN
GIVEN
An M10 segment is being processed with manifest type code 'H' and the processing type is TRAIN
Applied to: Set DELETE Status Decision
WHEN
The manifest type code is 'H' and WS-TRAIN is true
THEN
The system sets both SHOULD-DELETE-STATUS and SHOULD-UPDATE-STATUS to true
Context: An M10 segment is being processed with manifest type code 'H' and the processing type is CARGO
GIVEN
An M10 segment is being processed with manifest type code 'H' and the processing type is CARGO
Applied to: Set NO UPDATE Status Decision
WHEN
The manifest type code is 'H' and WS-TRAIN is false
THEN
The system sets SHOULD-NOT-UPDATE-STATUS to true
Context: An M10 segment has been processed successfully
GIVEN
An M10 segment has been processed successfully
Applied to: Mark M10 Segment as Found
WHEN
All M10 segment processing is complete
THEN
The system sets WS-M10-SEGMENT-FOUND to true
R-GCX015E-cbl-00070 (+2) File: GCX015E.cbl Process P4 Segment Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process P4 Segment':
  • Context - a message table entry is being processed:
    For P4 Segment Found in Message?:
    When the table id equals 'p4 ' (p4 with trailing space), then the system sets p4 segment found flag to true and extracts the p4 segment data from the message table entry.
  • Context - a p4 segment has been identified in the message table:
    For Extract P4 Segment Data from Message Table:
    When the p4 segment processing is initiated, then the system moves the complete message table entry data to the p4 segment structure for processing.
  • Context - a p4 segment is being processed from the message table:
    For Set P4 Segment Found Flag:
    When the p4 segment data extraction begins, then the system sets the p4 segment found indicator to true to track successful p4 segment processing.
👨‍💻 Technical ACs (Gherkin)
Context: A message table entry is being processed
GIVEN
A message table entry is being processed
Applied to: P4 Segment Found in Message?
WHEN
The table ID equals 'P4 ' (P4 with trailing space)
THEN
The system sets P4 segment found flag to true and extracts the P4 segment data from the message table entry
Context: A P4 segment has been identified in the message table
GIVEN
A P4 segment has been identified in the message table
Applied to: Extract P4 Segment Data from Message Table
WHEN
The P4 segment processing is initiated
THEN
The system moves the complete message table entry data to the P4 segment structure for processing
Context: A P4 segment is being processed from the message table
GIVEN
A P4 segment is being processed from the message table
Applied to: Set P4 Segment Found Flag
WHEN
The P4 segment data extraction begins
THEN
The system sets the P4 segment found indicator to true to track successful P4 segment processing
R-GCX015E-cbl-00073 File: GCX015E.cbl Process N10 Line Release Numbers
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process N10 Line Release Numbers':
  • Context - a message segment is being processed during message iteration:
    For Extract Line Release Number from Position 09:
    When the segment identifier equals 'n10', then the system extracts the line release number from position 09 of the n10 segment and stores it in working storage for later use.
👨‍💻 Technical ACs (Gherkin)
Context: A message segment is being processed during message iteration
GIVEN
A message segment is being processed during message iteration
Applied to: Extract Line Release Number from Position 09
WHEN
The segment identifier equals 'N10'
THEN
The system extracts the line release number from position 09 of the N10 segment and stores it in working storage for later use
R-GCX015E-cbl-00074 (+8) File: GCX015E.cbl Process K1 Error Messages Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process K1 Error Messages':
  • Context - a k1 message segment is being processed with a specific message number:
    For Message Number Category?:
    When the system evaluates the k1-02-msg-number field, then the message is categorized as information (000), fatal (009,017,038,040,291,630), warning (631,632,633,634,695,696,697,698,699), or unknown (all other numbers).
  • Context - a k1 message with message number '000' is being processed:
    For Set Information Severity Message 000:
    When the message number equals '000', then the system sets message severity to information (msg-sev-i) and sets acknowledgment status (ws-ack-status).
  • Context - a k1 message with message number in the critical error range is being processed:
    For Set Fatal Severity Messages 009, 017, 038, 040, 291, 630:
    When the message number is '009' or '017' or '038' or '040' or '291' or '630', then the system sets message severity to fatal (msg-sev-f) and sets error status (ws-error-status).
  • Context - a k1 message with message number in the warning range is being processed:
    For Set Warning Severity Messages 631, 632, 633, 634, 695, 696, 697, 698, 699:
    When the message number is '631' or '632' or '633' or '634' or '695' or '696' or '697' or '698' or '699', then the system sets message severity to warning (msg-sev-w) and sets acknowledgment status (ws-ack-status).
  • Context - a k1 message with a message number not in any predefined category is being processed:
    For Set Unknown Severity All Other Messages:
    When the message number is not '000', not in fatal range (009,017,038,040,291,630), and not in warning range (631,632,633,634,695,696,697,698,699), then the system sets message severity to unknown (msg-sev-u) and sets acknowledgment status (ws-ack-status).
  • Context - a k1 message has been categorized as warning severity:
    For Warning Message 695, 697, or 699?:
    When the message number is '695' or '697' or '699', then the system triggers email warning notification process to freight forwarder.
  • Context - a k1 message with number '695', '697', or '699' requires email notification:
    For Send Email Warning to Freight Forwarder:
    When the email warning process is triggered, then the system calls email warning procedure (c100-send-email-warning) to notify freight forwarder with shipment details and warning message.
  • Context - a k1 message segment is being processed:
    For Extract Free Form Message Text:
    When the k1-02-free-form-message field contains text data, then the system extracts the message text and adds it to the processing log (mrln-lines) and prepares it for later logging (hold-k1-message).
  • Context - a k1 message segment is being processed for text extraction:
    For Message Text Available?:
    When the system evaluates k1-02-free-form-message field, then if the field is not spaces, the message text is processed; otherwise, processing continues without text extraction.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 message segment is being processed with a specific message number
GIVEN
A K1 message segment is being processed with a specific message number
Applied to: Message Number Category?
WHEN
The system evaluates the K1-02-MSG-NUMBER field
THEN
The message is categorized as Information (000), Fatal (009,017,038,040,291,630), Warning (631,632,633,634,695,696,697,698,699), or Unknown (all other numbers)
Context: A K1 message with message number '000' is being processed
GIVEN
A K1 message with message number '000' is being processed
Applied to: Set Information Severity Message 000
WHEN
The message number equals '000'
THEN
The system sets message severity to Information (MSG-SEV-I) and sets acknowledgment status (WS-ACK-STATUS)
Context: A K1 message with message number in the critical error range is being processed
GIVEN
A K1 message with message number in the critical error range is being processed
Applied to: Set Fatal Severity Messages 009, 017, 038, 040, 291, 630
WHEN
The message number is '009' OR '017' OR '038' OR '040' OR '291' OR '630'
THEN
The system sets message severity to Fatal (MSG-SEV-F) and sets error status (WS-ERROR-STATUS)
Context: A K1 message with message number in the warning range is being processed
GIVEN
A K1 message with message number in the warning range is being processed
Applied to: Set Warning Severity Messages 631, 632, 633, 634, 695, 696, 697, 698, 699
WHEN
The message number is '631' OR '632' OR '633' OR '634' OR '695' OR '696' OR '697' OR '698' OR '699'
THEN
The system sets message severity to Warning (MSG-SEV-W) and sets acknowledgment status (WS-ACK-STATUS)
Context: A K1 message with a message number not in any predefined category is being processed
GIVEN
A K1 message with a message number not in any predefined category is being processed
Applied to: Set Unknown Severity All Other Messages
WHEN
The message number is not '000', not in fatal range (009,017,038,040,291,630), and not in warning range (631,632,633,634,695,696,697,698,699)
THEN
The system sets message severity to Unknown (MSG-SEV-U) and sets acknowledgment status (WS-ACK-STATUS)
Context: A K1 message has been categorized as warning severity
GIVEN
A K1 message has been categorized as warning severity
Applied to: Warning Message 695, 697, or 699?
WHEN
The message number is '695' OR '697' OR '699'
THEN
The system triggers email warning notification process to freight forwarder
Context: A K1 message with number '695', '697', or '699' requires email notification
GIVEN
A K1 message with number '695', '697', or '699' requires email notification
Applied to: Send Email Warning to Freight Forwarder
WHEN
The email warning process is triggered
THEN
The system calls email warning procedure (C100-SEND-EMAIL-WARNING) to notify freight forwarder with shipment details and warning message
Context: A K1 message segment is being processed
GIVEN
A K1 message segment is being processed
Applied to: Extract Free Form Message Text
WHEN
The K1-02-FREE-FORM-MESSAGE field contains text data
THEN
The system extracts the message text and adds it to the processing log (MRLN-LINES) and prepares it for later logging (HOLD-K1-MESSAGE)
Context: A K1 message segment is being processed for text extraction
GIVEN
A K1 message segment is being processed for text extraction
Applied to: Message Text Available?
WHEN
The system evaluates K1-02-FREE-FORM-MESSAGE field
THEN
If the field is not spaces, the message text is processed; otherwise, processing continues without text extraction
R-GCX015E-cbl-00083 (+9) File: GCX015E.cbl Process K3 Accept/Reject Counts Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process K3 Accept/Reject Counts':
  • Context - a message is being processed for accept/reject count validation:
    For K3 Segment Found?:
    When the system checks for the presence of k3 segment in the message, then if k3 segment is found, extract the segment data for processing, otherwise create a default k3 segment with current date and time.
  • Context - a message is being processed and k3 segment is not found:
    For Create Default K3 with Current Date/Time:
    When the system needs to process accept/reject counts, then create a default k3 segment using current machine date and time, set k3 segment found flag to true.
  • Context - k3 segment data is available for processing:
    For Total Reject Count = 0?:
    When the system evaluates the total reject count field, then if total reject count equals zero, proceed to validate accept count, otherwise set error status.
  • Context - k3 segment has zero reject count:
    For Total Accept Count > 0?:
    When the system evaluates the total accept count field, then if total accept count is greater than zero, proceed to train status check, otherwise log zero counts message and set acknowledgment status.
  • Context - k3 segment has zero rejects and positive accept count:
    For Train Status Check:
    When the system evaluates the current train status, then if train is pre-arrived set pre-arrival status, if train is review complete set review completed status, otherwise set acknowledgment status.
  • Context - k3 segment has valid accept counts and train is in pre-arrived state:
    For Set Pre-Arrival Status:
    When the system determines the final processing status, then set the processing status to pre-arrival status.
  • Context - k3 segment has valid accept counts and train is in review complete state:
    For Set Review Completed Status:
    When the system determines the final processing status, then set the processing status to review completed status.
  • Context - k3 segment has valid accept counts and train is not in pre-arrived or review complete state, or k3 segment has zero counts:
    For Set Acknowledgment Status:
    When the system determines the final processing status, then set the processing status to acknowledgment status.
  • Context - k3 segment contains non-zero reject count:
    For Set Error Status:
    When the system processes the accept/reject counts, then set the processing status to error status.
  • Context - k3 segment has zero reject count and zero accept count:
    For Add Zero Counts Message to Log:
    When the system processes the count validation, then add message 'uscs k3 record has zero counts' to the log and increment log counter.
👨‍💻 Technical ACs (Gherkin)
Context: A message is being processed for accept/reject count validation
GIVEN
A message is being processed for accept/reject count validation
Applied to: K3 Segment Found?
WHEN
The system checks for the presence of K3 segment in the message
THEN
If K3 segment is found, extract the segment data for processing, otherwise create a default K3 segment with current date and time
Context: A message is being processed and K3 segment is not found
GIVEN
A message is being processed and K3 segment is not found
Applied to: Create Default K3 with Current Date/Time
WHEN
The system needs to process accept/reject counts
THEN
Create a default K3 segment using current machine date and time, set K3 segment found flag to true
Context: K3 segment data is available for processing
GIVEN
K3 segment data is available for processing
Applied to: Total Reject Count = 0?
WHEN
The system evaluates the total reject count field
THEN
If total reject count equals zero, proceed to validate accept count, otherwise set error status
Context: K3 segment has zero reject count
GIVEN
K3 segment has zero reject count
Applied to: Total Accept Count > 0?
WHEN
The system evaluates the total accept count field
THEN
If total accept count is greater than zero, proceed to train status check, otherwise log zero counts message and set acknowledgment status
Context: K3 segment has zero rejects and positive accept count
GIVEN
K3 segment has zero rejects and positive accept count
Applied to: Train Status Check
WHEN
The system evaluates the current train status
THEN
If train is pre-arrived set pre-arrival status, if train is review complete set review completed status, otherwise set acknowledgment status
Context: K3 segment has valid accept counts and train is in pre-arrived state
GIVEN
K3 segment has valid accept counts and train is in pre-arrived state
Applied to: Set Pre-Arrival Status
WHEN
The system determines the final processing status
THEN
Set the processing status to pre-arrival status
Context: K3 segment has valid accept counts and train is in review complete state
GIVEN
K3 segment has valid accept counts and train is in review complete state
Applied to: Set Review Completed Status
WHEN
The system determines the final processing status
THEN
Set the processing status to review completed status
Context: K3 segment has valid accept counts and train is not in pre-arrived or review complete state, or K3 segment has zero counts
GIVEN
K3 segment has valid accept counts and train is not in pre-arrived or review complete state, or K3 segment has zero counts
Applied to: Set Acknowledgment Status
WHEN
The system determines the final processing status
THEN
Set the processing status to acknowledgment status
Context: K3 segment contains non-zero reject count
GIVEN
K3 segment contains non-zero reject count
Applied to: Set Error Status
WHEN
The system processes the accept/reject counts
THEN
Set the processing status to error status
Context: K3 segment has zero reject count and zero accept count
GIVEN
K3 segment has zero reject count and zero accept count
Applied to: Add Zero Counts Message to Log
WHEN
The system processes the count validation
THEN
Add message 'USCS K3 RECORD HAS ZERO COUNTS' to the log and increment log counter
R-GCX015E-cbl-00093 (+2) File: GCX015E.cbl Validate Required Segments Present Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Required Segments Present':
  • Context - a message is being processed for segment validation:
    For M10 Segment Found?:
    When the system checks for the presence of m10 segment, then if m10 segment is not found, record an error message 'm10 segment not found on 355 transaction' and continue validation.
  • Context - a message is being processed for segment validation and m10 validation is complete:
    For P4 Segment Found?:
    When the system checks for the presence of p4 segment, then if p4 segment is not found, record an error message 'p4 segment not found on 355 transaction' and continue validation.
  • Context - a message is being processed for segment validation and m10 and p4 validations are complete:
    For K3 Segment Found?:
    When the system checks for the presence of k3 segment, then if k3 segment is not found, record an error message 'k3 segment not found on 355 transaction' and create a default k3 segment using current machine date and time, then set the k3 segment found flag to true.
👨‍💻 Technical ACs (Gherkin)
Context: A message is being processed for segment validation
GIVEN
A message is being processed for segment validation
Applied to: M10 Segment Found?
WHEN
The system checks for the presence of M10 segment
THEN
If M10 segment is not found, record an error message 'M10 SEGMENT NOT FOUND ON 355 TRANSACTION' and continue validation
Context: A message is being processed for segment validation and M10 validation is complete
GIVEN
A message is being processed for segment validation and M10 validation is complete
Applied to: P4 Segment Found?
WHEN
The system checks for the presence of P4 segment
THEN
If P4 segment is not found, record an error message 'P4 SEGMENT NOT FOUND ON 355 TRANSACTION' and continue validation
Context: A message is being processed for segment validation and M10 and P4 validations are complete
GIVEN
A message is being processed for segment validation and M10 and P4 validations are complete
Applied to: K3 Segment Found?
WHEN
The system checks for the presence of K3 segment
THEN
If K3 segment is not found, record an error message 'K3 SEGMENT NOT FOUND ON 355 TRANSACTION' and create a default K3 segment using current machine date and time, then set the K3 segment found flag to true
R-GCX015E-cbl-00096 (+9) File: GCX015E.cbl Retrieve Cargo Root Information Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Cargo Root Information':
  • Context - a cargo retrieval operation is initiated:
    For Initialize Cargo Segment:
    When the system prepares to query the cargo database, then the cargo segment data structure is cleared to spaces.
  • Context - a cargo record needs to be retrieved from the database:
    For Set Database Function to GET UNIQUE:
    When the system configures the database operation parameters, then the database function is set to get unique and the segment type is set to gcsusrt.
  • Context - m10 segment data contains a us-ccn-key value:
    For Use US-CCN-KEY from M10 Segment:
    When the system prepares to query the cargo database, then the us-ccn-key from the processed m10 data is used as the database query key.
  • Context - database parameters are configured with us-ccn-key and get unique function:
    For Call Database to Retrieve Cargo Record:
    When the system executes the database retrieval operation, then the gccusio program is called with the cargo segment parameters to retrieve the cargo record.
  • Context - a database retrieval operation has been executed for a cargo record:
    For Cargo Record Found?:
    When the system checks the database operation status code, then if the status code is spaces (successful), the cargo record is considered found, otherwise it is not found.
  • Context - a cargo record has been successfully retrieved from the database:
    For Set Cargo Found Flag:
    When the system updates the cargo processing status, then the cargo found flag (88-uscargo-train-found) is set to true.
    For Store Equipment/Car Information:
    When the system processes the cargo record data, then the equipment car id (gcusrt-rt081-equipment-car) is stored as the merlin sub-key.
  • Context - cargo record data has been successfully retrieved and equipment information extracted:
    For Set Merlin Key and Sub-Key:
    When the system sets up merlin identification keys, then the merlin key is set to the processed m10 data and the merlin sub-key is set to the equipment car id.
  • Context - a cargo database retrieval operation has failed to find a matching record:
    For Set Cargo Not Found Flag:
    When the system updates the cargo processing status, then the cargo not found flag (88-uscargo-train-notfnd) is set to true.
  • Context - a cargo record could not be found for the specified us-ccn-key:
    For Log Error Message - US-CCN-KEY Not Found:
    When the system logs the error condition, then an error message 'this us-ccn-key was not found: ' is written to the merlin error report and the line count is incremented.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo retrieval operation is initiated
GIVEN
A cargo retrieval operation is initiated
Applied to: Initialize Cargo Segment
WHEN
The system prepares to query the cargo database
THEN
The cargo segment data structure is cleared to spaces
Context: A cargo record needs to be retrieved from the database
GIVEN
A cargo record needs to be retrieved from the database
Applied to: Set Database Function to GET UNIQUE
WHEN
The system configures the database operation parameters
THEN
The database function is set to GET UNIQUE and the segment type is set to GCSUSRT
Context: M10 segment data contains a US-CCN-KEY value
GIVEN
M10 segment data contains a US-CCN-KEY value
Applied to: Use US-CCN-KEY from M10 Segment
WHEN
The system prepares to query the cargo database
THEN
The US-CCN-KEY from the processed M10 data is used as the database query key
Context: Database parameters are configured with US-CCN-KEY and GET UNIQUE function
GIVEN
Database parameters are configured with US-CCN-KEY and GET UNIQUE function
Applied to: Call Database to Retrieve Cargo Record
WHEN
The system executes the database retrieval operation
THEN
The GCCUSIO program is called with the cargo segment parameters to retrieve the cargo record
Context: A database retrieval operation has been executed for a cargo record
GIVEN
A database retrieval operation has been executed for a cargo record
Applied to: Cargo Record Found?
WHEN
The system checks the database operation status code
THEN
If the status code is spaces (successful), the cargo record is considered found, otherwise it is not found
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Set Cargo Found Flag
WHEN
The system updates the cargo processing status
THEN
The cargo found flag (88-USCARGO-TRAIN-FOUND) is set to true
Applied to: Store Equipment/Car Information
WHEN
The system processes the cargo record data
THEN
The equipment car ID (GCUSRT-RT081-EQUIPMENT-CAR) is stored as the Merlin sub-key
Context: Cargo record data has been successfully retrieved and equipment information extracted
GIVEN
Cargo record data has been successfully retrieved and equipment information extracted
Applied to: Set Merlin Key and Sub-Key
WHEN
The system sets up Merlin identification keys
THEN
The Merlin key is set to the processed M10 data and the Merlin sub-key is set to the equipment car ID
Context: A cargo database retrieval operation has failed to find a matching record
GIVEN
A cargo database retrieval operation has failed to find a matching record
Applied to: Set Cargo Not Found Flag
WHEN
The system updates the cargo processing status
THEN
The cargo not found flag (88-USCARGO-TRAIN-NOTFND) is set to true
Context: A cargo record could not be found for the specified US-CCN-KEY
GIVEN
A cargo record could not be found for the specified US-CCN-KEY
Applied to: Log Error Message - US-CCN-KEY Not Found
WHEN
The system logs the error condition
THEN
An error message 'THIS US-CCN-KEY WAS NOT FOUND: ' is written to the Merlin error report and the line count is incremented
R-GCX015E-cbl-00106 (+5) File: GCX015E.cbl Retrieve Train Root Information Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Train Root Information':
  • Context - a us train id is available from message processing:
    For Call Database to Get Train Record:
    When the system attempts to retrieve the train record from the train database, then the system should call the database access function with the us train id as the search key.
  • Context - a database call has been made to retrieve a train record:
    For Train Record Found?:
    When the database returns a response with a status code, then if the status code is blank/spaces, the train record is found, otherwise the train record is not found.
    For Set Train Not Found Flag:
    When the database returns a non-blank status code indicating the record was not found, then the system should set the train not found flag to indicate unsuccessful train record retrieval.
  • Context - a train record has been successfully found in the database:
    For Set Train Found Flag:
    When the database status indicates successful retrieval, then the system should set the train found flag to indicate successful train record retrieval.
  • Context - a train record has been successfully found and the train found flag is set:
    For Store Train ID in Processing Keys:
    When the system needs to prepare for further train processing, then the system should store the us train id in the merlin-key and the train id in merlin-sub-key for processing reference.
  • Context - a train record was not found in the database and the train not found flag is set:
    For Log Train ID Not Found Message:
    When the system needs to record the failure for audit purposes, then the system should log the message 'this us-train-id was not found: ' followed by the train id that was searched.
👨‍💻 Technical ACs (Gherkin)
Context: A US Train ID is available from message processing
GIVEN
A US Train ID is available from message processing
Applied to: Call Database to Get Train Record
WHEN
The system attempts to retrieve the train record from the train database
THEN
The system should call the database access function with the US Train ID as the search key
Context: A database call has been made to retrieve a train record
GIVEN
A database call has been made to retrieve a train record
Applied to: Train Record Found?
WHEN
The database returns a response with a status code
THEN
If the status code is blank/spaces, the train record is found, otherwise the train record is not found
Applied to: Set Train Not Found Flag
WHEN
The database returns a non-blank status code indicating the record was not found
THEN
The system should set the train not found flag to indicate unsuccessful train record retrieval
Context: A train record has been successfully found in the database
GIVEN
A train record has been successfully found in the database
Applied to: Set Train Found Flag
WHEN
The database status indicates successful retrieval
THEN
The system should set the train found flag to indicate successful train record retrieval
Context: A train record has been successfully found and the train found flag is set
GIVEN
A train record has been successfully found and the train found flag is set
Applied to: Store Train ID in Processing Keys
WHEN
The system needs to prepare for further train processing
THEN
The system should store the US Train ID in the MERLIN-KEY and the train ID in MERLIN-SUB-KEY for processing reference
Context: A train record was not found in the database and the train not found flag is set
GIVEN
A train record was not found in the database and the train not found flag is set
Applied to: Log Train ID Not Found Message
WHEN
The system needs to record the failure for audit purposes
THEN
The system should log the message 'THIS US-TRAIN-ID WAS NOT FOUND: ' followed by the train ID that was searched
R-GCX015E-cbl-00112 (+4) File: GCX015E.cbl Update Train Status Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Train Status':
  • Context - a train record exists with deleted status and acknowledgment status is received:
    For Train Status: DELETED Acknowledgment Received:
    When the system processes the train status update, then the train current status is set to 'deleted', security information is cleared, and the train record is updated in the database.
  • Context - a train record exists with delete-pending status and acknowledgment status is received:
    For Train Status: DELETE-PENDING Acknowledgment Received:
    When the system processes the train status update, then the train current status is set to 'deleted', security information is cleared, and the train record is updated in the database.
  • Context - a train record exists that is not in deleted status and not in delete-pending status:
    For Train Status: Other Not Deleted/Delete-Pending:
    When the system processes the train status update, then the train current status is set to the current response status and the train record is updated in the database.
  • Context - a train record has been updated with new status:
    For Check AEI Train Send Conditions:
    When the system evaluates aei send requirements, then the system performs aei train send check to determine if additional processing is needed.
  • Context - a train record has acknowledgment status and is in arrived-pending state:
    For Process Train Arrival:
    When the system checks for train arrival processing requirements, then the system triggers the train arrival process.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists with DELETED status and acknowledgment status is received
GIVEN
A train record exists with DELETED status and acknowledgment status is received
Applied to: Train Status: DELETED Acknowledgment Received
WHEN
The system processes the train status update
THEN
The train current status is set to 'DELETED', security information is cleared, and the train record is updated in the database
Context: A train record exists with DELETE-PENDING status and acknowledgment status is received
GIVEN
A train record exists with DELETE-PENDING status and acknowledgment status is received
Applied to: Train Status: DELETE-PENDING Acknowledgment Received
WHEN
The system processes the train status update
THEN
The train current status is set to 'DELETED', security information is cleared, and the train record is updated in the database
Context: A train record exists that is not in DELETED status and not in DELETE-PENDING status
GIVEN
A train record exists that is not in DELETED status and not in DELETE-PENDING status
Applied to: Train Status: Other Not Deleted/Delete-Pending
WHEN
The system processes the train status update
THEN
The train current status is set to the current response status and the train record is updated in the database
Context: A train record has been updated with new status
GIVEN
A train record has been updated with new status
Applied to: Check AEI Train Send Conditions
WHEN
The system evaluates AEI send requirements
THEN
The system performs AEI train send check to determine if additional processing is needed
Context: A train record has acknowledgment status and is in arrived-pending state
GIVEN
A train record has acknowledgment status and is in arrived-pending state
Applied to: Process Train Arrival
WHEN
The system checks for train arrival processing requirements
THEN
The system triggers the train arrival process
R-GCX015E-cbl-00117 (+6) File: GCX015E.cbl Update Cargo Status Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Cargo Status':
  • Context - a cargo record exists with acknowledgment status and saved status description is not spaces:
    For Restore Previous Cargo Status:
    When the system processes the cargo status update, then the saved cargo status is moved to current cargo status and saved status description is moved to current cargo short description.
  • Context - a cargo record exists with acknowledgment status and saved status description is spaces:
    For Set Status to Acknowledged:
    When the system processes the cargo status update, then the cargo status is set to uscargo-ack and cargo short description is set to uscargo-ack.
  • Context - a cargo record exists with error status and current cargo short description is uscargo-error or uscargo-ack or uscargo-ack-r:
    For Current Status is Error/Ack?:
    When the system processes the cargo status update, then the system continues processing without saving the current status.
  • Context - a cargo record exists with error status and current cargo short description is not uscargo-error and not uscargo-ack and not uscargo-ack-r:
    For Save Current Status for Future Restoration:
    When the system processes the cargo status update, then the current cargo status is saved to saved status field and current cargo short description is saved to saved status description field.
  • Context - a cargo record exists with error status and cp cargo status is not cpcargo-deleted:
    For Set Cargo Status to Error:
    When the system processes the cargo status update, then the cp cargo status is set to cpcargo-error.
  • Context - a cargo record exists with error status:
    For Set US Cargo Status to Error:
    When the system processes the cargo status update, then the us cargo status is set to uscargo-error and us cargo short description is set to uscargo-error.
  • Context - cargo status changes have been determined:
    For Update Cargo Record in Database:
    When the system needs to persist the cargo status updates, then the cargo segment is updated in the database using gccusio service with replace function for gcsusrt segment.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with acknowledgment status and saved status description is not spaces
GIVEN
A cargo record exists with acknowledgment status and saved status description is not spaces
Applied to: Restore Previous Cargo Status
WHEN
The system processes the cargo status update
THEN
The saved cargo status is moved to current cargo status and saved status description is moved to current cargo short description
Context: A cargo record exists with acknowledgment status and saved status description is spaces
GIVEN
A cargo record exists with acknowledgment status and saved status description is spaces
Applied to: Set Status to Acknowledged
WHEN
The system processes the cargo status update
THEN
The cargo status is set to USCARGO-ACK and cargo short description is set to USCARGO-ACK
Context: A cargo record exists with error status and current cargo short description is USCARGO-ERROR or USCARGO-ACK or USCARGO-ACK-R
GIVEN
A cargo record exists with error status and current cargo short description is USCARGO-ERROR or USCARGO-ACK or USCARGO-ACK-R
Applied to: Current Status is Error/Ack?
WHEN
The system processes the cargo status update
THEN
The system continues processing without saving the current status
Context: A cargo record exists with error status and current cargo short description is not USCARGO-ERROR and not USCARGO-ACK and not USCARGO-ACK-R
GIVEN
A cargo record exists with error status and current cargo short description is not USCARGO-ERROR and not USCARGO-ACK and not USCARGO-ACK-R
Applied to: Save Current Status for Future Restoration
WHEN
The system processes the cargo status update
THEN
The current cargo status is saved to saved status field and current cargo short description is saved to saved status description field
Context: A cargo record exists with error status and CP cargo status is not CPCARGO-DELETED
GIVEN
A cargo record exists with error status and CP cargo status is not CPCARGO-DELETED
Applied to: Set Cargo Status to Error
WHEN
The system processes the cargo status update
THEN
The CP cargo status is set to CPCARGO-ERROR
Context: A cargo record exists with error status
GIVEN
A cargo record exists with error status
Applied to: Set US Cargo Status to Error
WHEN
The system processes the cargo status update
THEN
The US cargo status is set to USCARGO-ERROR and US cargo short description is set to USCARGO-ERROR
Context: Cargo status changes have been determined
GIVEN
Cargo status changes have been determined
Applied to: Update Cargo Record in Database
WHEN
The system needs to persist the cargo status updates
THEN
The cargo segment is updated in the database using GCCUSIO service with replace function for GCSUSRT segment
R-GCX015E-cbl-00124 (+12) File: GCX015E.cbl Check AEI Train Send Conditions Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check AEI Train Send Conditions':
  • Context - a train record exists in the system:
    For Train Status = ACK?:
    When the system checks aei send eligibility, then the train must have ack status to proceed with aei processing.
  • Context - a train has ack status:
    For AEI Send Flag = Yes?:
    When the system evaluates aei send requirements, then the aei send flag must be set to yes to continue processing.
  • Context - a train has ack status and aei send flag is yes:
    For Train Status = Enroute Not Reported?:
    When the system checks enroute reporting status, then the train status must be 'enroute not reported' to qualify for aei processing.
  • Context - a train meets ack status, aei send flag, and enroute not reported criteria:
    For Train ID ends with 'T'?:
    When the system validates train id format, then the train id must end with character 't' at position 23 to proceed with customs transmission.
  • Context - a train passes all aei eligibility checks:
    For Set Customs Transaction Code to GCT1461E:
    When the system prepares customs transaction, then set transaction code to gct1461e, security to high values, customs code to 'a', and copy train identification and routing details.
  • Context - the system is processing train equipment for aei transmission:
    For Equipment Type is Container?:
    When an equipment item has container indicator set to 'c', then skip the container equipment and do not include it in the customs car data.
  • Context - equipment is not a container type:
    For Load Car Initial and Number:
    When the system loads car information, then copy equipment initial and convert equipment number to 6-digit format for customs car data.
  • Context - car identification has been loaded:
    For Set Car Load/Empty Indicator:
    When the system sets load/empty indicator, then if next equipment is container, set indicator to 'l', otherwise use the equipment's load/empty code.
  • Context - car load/empty indicator has been set:
    For Set Car Kind Based on Equipment Type:
    When the system determines car kind, then if equipment type is 'lo' set kind to 'l', if 'et' set to 'e', otherwise leave blank.
  • Context - all car information has been loaded and formatted:
    For Send Customs Transaction via CIMS:
    When the system sends customs transaction, then call cims program to transmit the customs transaction data.
  • Context - customs transaction has been sent via cims:
    For Send Transaction Message via WRITMSGL:
    When the system logs the transaction, then call writmsgl program with message code 's' to record the customs transaction.
  • Context - transaction message has been logged:
    For Purge Transaction via CIMS:
    When the system performs cleanup, then call cims program with purg function to purge transaction resources.
  • Context - aei processing has been attempted or aei send flag is set:
    For Send AEI Status Message:
    When the system completes aei processing, then send aei status message notification.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists in the system
GIVEN
A train record exists in the system
Applied to: Train Status = ACK?
WHEN
The system checks AEI send eligibility
THEN
The train must have ACK status to proceed with AEI processing
Context: A train has ACK status
GIVEN
A train has ACK status
Applied to: AEI Send Flag = Yes?
WHEN
The system evaluates AEI send requirements
THEN
The AEI send flag must be set to Yes to continue processing
Context: A train has ACK status and AEI send flag is Yes
GIVEN
A train has ACK status and AEI send flag is Yes
Applied to: Train Status = Enroute Not Reported?
WHEN
The system checks enroute reporting status
THEN
The train status must be 'Enroute Not Reported' to qualify for AEI processing
Context: A train meets ACK status, AEI send flag, and enroute not reported criteria
GIVEN
A train meets ACK status, AEI send flag, and enroute not reported criteria
Applied to: Train ID ends with 'T'?
WHEN
The system validates train ID format
THEN
The train ID must end with character 'T' at position 23 to proceed with customs transmission
Context: A train passes all AEI eligibility checks
GIVEN
A train passes all AEI eligibility checks
Applied to: Set Customs Transaction Code to GCT1461E
WHEN
The system prepares customs transaction
THEN
Set transaction code to GCT1461E, security to high values, customs code to 'A', and copy train identification and routing details
Context: The system is processing train equipment for AEI transmission
GIVEN
The system is processing train equipment for AEI transmission
Applied to: Equipment Type is Container?
WHEN
An equipment item has container indicator set to 'C'
THEN
Skip the container equipment and do not include it in the customs car data
Context: Equipment is not a container type
GIVEN
Equipment is not a container type
Applied to: Load Car Initial and Number
WHEN
The system loads car information
THEN
Copy equipment initial and convert equipment number to 6-digit format for customs car data
Context: Car identification has been loaded
GIVEN
Car identification has been loaded
Applied to: Set Car Load/Empty Indicator
WHEN
The system sets load/empty indicator
THEN
If next equipment is container, set indicator to 'L', otherwise use the equipment's load/empty code
Context: Car load/empty indicator has been set
GIVEN
Car load/empty indicator has been set
Applied to: Set Car Kind Based on Equipment Type
WHEN
The system determines car kind
THEN
If equipment type is 'LO' set kind to 'L', if 'ET' set to 'E', otherwise leave blank
Context: All car information has been loaded and formatted
GIVEN
All car information has been loaded and formatted
Applied to: Send Customs Transaction via CIMS
WHEN
The system sends customs transaction
THEN
Call CIMS program to transmit the customs transaction data
Context: Customs transaction has been sent via CIMS
GIVEN
Customs transaction has been sent via CIMS
Applied to: Send Transaction Message via WRITMSGL
WHEN
The system logs the transaction
THEN
Call WRITMSGL program with message code 'S' to record the customs transaction
Context: Transaction message has been logged
GIVEN
Transaction message has been logged
Applied to: Purge Transaction via CIMS
WHEN
The system performs cleanup
THEN
Call CIMS program with PURG function to purge transaction resources
Context: AEI processing has been attempted or AEI send flag is set
GIVEN
AEI processing has been attempted or AEI send flag is set
Applied to: Send AEI Status Message
WHEN
The system completes AEI processing
THEN
Send AEI status message notification
R-GCX015E-cbl-00137 (+8) File: GCX015E.cbl Load Car Information for Customs Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Load Car Information for Customs':
  • Context - a train equipment item is being processed for customs car loading:
    For Is Equipment a Container?:
    When the equipment container indicator is 'c', then the equipment should be skipped and not included in the customs car output table.
  • Context - a train equipment item is not a container:
    For Extract Car Initial from Train Equipment:
    When processing the equipment for customs car loading, then the equipment initial should be moved to customs car initial and the equipment number should be moved to car number field.
  • Context - a car number has been extracted from equipment data:
    For Format Car Number to 6 Digits:
    When preparing the car information for customs output, then the car number should be formatted as a 6-digit number in the customs car number field.
  • Context - a car is being processed and there is a next equipment item in the sequence:
    For Is Next Equipment Container?:
    When the next equipment item is a container (indicator 'c'), then the current car's load/empty indicator should be set to 'l', otherwise use the car's own load/empty indicator.
  • Context - an equipment item has been identified as non-container:
    For Equipment Type = 'LO'?:
    When the equipment type is 'lo', then the car kind should be set to 'l' for locomotive.
  • Context - an equipment item is not a locomotive (type not 'lo'):
    For Equipment Type = 'ET'?:
    When the equipment type is 'et', then the car kind should be set to 'e' for end of train device.
  • Context - an equipment item is not a locomotive and not an end of train device:
    For Set Car Kind as Spaces:
    When the equipment type is neither 'lo' nor 'et', then the car kind should be set to spaces (no classification).
  • Context - a car's details have been fully processed including initial, number, load/empty indicator, and car kind:
    For Add Car to Customs Output Table:
    When all car information is ready for customs reporting, then the car counter should be incremented by 1 and the equipment sequence counter should be incremented by 1.
  • Context - car loading is in progress for a train:
    For More Equipment to Process?:
    When the current equipment counter is less than or equal to the total equipment quantity and the car counter is less than or equal to 500, then processing should continue to the next equipment item, otherwise car loading should end.
👨‍💻 Technical ACs (Gherkin)
Context: A train equipment item is being processed for customs car loading
GIVEN
A train equipment item is being processed for customs car loading
Applied to: Is Equipment a Container?
WHEN
The equipment container indicator is 'C'
THEN
The equipment should be skipped and not included in the customs car output table
Context: A train equipment item is not a container
GIVEN
A train equipment item is not a container
Applied to: Extract Car Initial from Train Equipment
WHEN
Processing the equipment for customs car loading
THEN
The equipment initial should be moved to customs car initial and the equipment number should be moved to car number field
Context: A car number has been extracted from equipment data
GIVEN
A car number has been extracted from equipment data
Applied to: Format Car Number to 6 Digits
WHEN
Preparing the car information for customs output
THEN
The car number should be formatted as a 6-digit number in the customs car number field
Context: A car is being processed and there is a next equipment item in the sequence
GIVEN
A car is being processed and there is a next equipment item in the sequence
Applied to: Is Next Equipment Container?
WHEN
The next equipment item is a container (indicator 'C')
THEN
The current car's load/empty indicator should be set to 'L', otherwise use the car's own load/empty indicator
Context: An equipment item has been identified as non-container
GIVEN
An equipment item has been identified as non-container
Applied to: Equipment Type = 'LO'?
WHEN
The equipment type is 'LO'
THEN
The car kind should be set to 'L' for locomotive
Context: An equipment item is not a locomotive (type not 'LO')
GIVEN
An equipment item is not a locomotive (type not 'LO')
Applied to: Equipment Type = 'ET'?
WHEN
The equipment type is 'ET'
THEN
The car kind should be set to 'E' for end of train device
Context: An equipment item is not a locomotive and not an end of train device
GIVEN
An equipment item is not a locomotive and not an end of train device
Applied to: Set Car Kind as Spaces
WHEN
The equipment type is neither 'LO' nor 'ET'
THEN
The car kind should be set to spaces (no classification)
Context: A car's details have been fully processed including initial, number, load/empty indicator, and car kind
GIVEN
A car's details have been fully processed including initial, number, load/empty indicator, and car kind
Applied to: Add Car to Customs Output Table
WHEN
All car information is ready for customs reporting
THEN
The car counter should be incremented by 1 and the equipment sequence counter should be incremented by 1
Context: Car loading is in progress for a train
GIVEN
Car loading is in progress for a train
Applied to: More Equipment to Process?
WHEN
The current equipment counter is less than or equal to the total equipment quantity and the car counter is less than or equal to 500
THEN
Processing should continue to the next equipment item, otherwise car loading should end
R-GCX015E-cbl-00146 (+8) File: GCX015E.cbl Send AEI Status Message Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send AEI Status Message':
  • Context - a train with security exchange data containing port information:
    For Get AEI Merlin ID from Database:
    When the system needs to send aei status messages, then the system queries cusemail database using train port as key to retrieve email contacts.
  • Context - aei email contact lookup returns no entry found status:
    For AEI Contact Found?:
    When the system attempts to retrieve email contacts from database, then the system uses default merlin id for email recipient.
  • Context - database lookup for aei contacts fails or returns no entry:
    For Use Default Merlin ID:
    When the system needs to determine email recipients, then the system assigns default merlin id as the email recipient.
  • Context - database lookup successfully returns aei email contacts:
    For Set Multiple Recipients from Database:
    When the system processes the retrieved contact information, then the system assigns up to 10 user ids from database as email recipients until empty entry is found.
  • Context - a train with customer train id and current status information:
    For Format Train Status Message:
    When the system prepares aei status email message, then the system formats email subject as 'train: [train_id] status: [current_status]'.
  • Context - formatted email subject, recipients, and default email settings:
    For Send Merlin Email Message:
    When the system initiates email sending process, then the system calls merlin email service with specified parameters including 080 character width and inbox destination.
  • Context - email send operation completed with return status:
    For Email Send Successful?:
    When the system checks email send result, then if email send failed, the system initiates resend process to default recipients.
  • Context - primary email send operation failed:
    For Resend to Default Recipients:
    When the system executes retry mechanism, then the system sends email to default recipients aei9999 and om01247 with same message content.
  • Context - both primary and retry email send operations failed:
    For Log Email Send Failure:
    When the system completes all retry attempts, then the system logs 'send to file of om01247 failed' error message.
👨‍💻 Technical ACs (Gherkin)
Context: A train with security exchange data containing port information
GIVEN
A train with security exchange data containing port information
Applied to: Get AEI Merlin ID from Database
WHEN
The system needs to send AEI status messages
THEN
The system queries CUSEMAIL database using train port as key to retrieve email contacts
Context: AEI email contact lookup returns no entry found status
GIVEN
AEI email contact lookup returns no entry found status
Applied to: AEI Contact Found?
WHEN
The system attempts to retrieve email contacts from database
THEN
The system uses default Merlin ID for email recipient
Context: Database lookup for AEI contacts fails or returns no entry
GIVEN
Database lookup for AEI contacts fails or returns no entry
Applied to: Use Default Merlin ID
WHEN
The system needs to determine email recipients
THEN
The system assigns default Merlin ID as the email recipient
Context: Database lookup successfully returns AEI email contacts
GIVEN
Database lookup successfully returns AEI email contacts
Applied to: Set Multiple Recipients from Database
WHEN
The system processes the retrieved contact information
THEN
The system assigns up to 10 user IDs from database as email recipients until empty entry is found
Context: A train with customer train ID and current status information
GIVEN
A train with customer train ID and current status information
Applied to: Format Train Status Message
WHEN
The system prepares AEI status email message
THEN
The system formats email subject as 'TRAIN: [train_id] STATUS: [current_status]'
Context: Formatted email subject, recipients, and default email settings
GIVEN
Formatted email subject, recipients, and default email settings
Applied to: Send Merlin Email Message
WHEN
The system initiates email sending process
THEN
The system calls Merlin email service with specified parameters including 080 character width and inbox destination
Context: Email send operation completed with return status
GIVEN
Email send operation completed with return status
Applied to: Email Send Successful?
WHEN
The system checks email send result
THEN
If email send failed, the system initiates resend process to default recipients
Context: Primary email send operation failed
GIVEN
Primary email send operation failed
Applied to: Resend to Default Recipients
WHEN
The system executes retry mechanism
THEN
The system sends email to default recipients AEI9999 and OM01247 with same message content
Context: Both primary and retry email send operations failed
GIVEN
Both primary and retry email send operations failed
Applied to: Log Email Send Failure
WHEN
The system completes all retry attempts
THEN
The system logs 'SEND TO FILE OF OM01247 FAILED' error message
R-GCX015E-cbl-00155 (+9) File: GCX015E.cbl Process Train Arrival Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Train Arrival':
  • Context - a train record exists in the system:
    For Check Train Status Conditions:
    When the system checks train arrival processing eligibility, then the train must be acknowledged and have arrived-pending status to proceed with arrival processing.
  • Context - a train arrival message is being prepared:
    For Set Action Code to 'TAR':
    When the system sets up the transaction parameters, then the action code must be set to 'tar' to identify this as a train arrival transaction.
    For Set Train ID from US Custom Train ID:
    When the system assigns train identification, then the us custom train id from the train record must be used as the train identifier in the arrival message.
  • Context - a train arrival is being processed:
    For Get Current System Date/Time:
    When the system needs to record the arrival timestamp, then the current system date and time must be captured and formatted for the arrival event.
  • Context - system date and time have been captured:
    For Format Event Date and Time:
    When the arrival message is being constructed, then the date must be formatted as yymmdd and time as hhmm for the event timestamp.
  • Context - a train arrival transaction is being created:
    For Set Security Parameters:
    When security parameters are being set, then the security byte must be set to high-value and the transaction type must be marked as us-train.
  • Context - all train arrival parameters have been set:
    For Create Train Arrival Transaction Message:
    When the system creates the transaction message, then a complete gct1121e message must be generated with action code, event date/time, train id, and security parameters.
  • Context - a train arrival message has been created:
    For Send Message to IMS Queue:
    When the message needs to be queued for processing, then the message must be sent to the ims queue using cims with chng operation and alt-pcb.
  • Context - a train arrival message is queued in ims:
    For Write Train Arrival Message:
    When the message needs to be logged, then the message must be written using writmsgl with the message code, content, length, and module name.
  • Context - a train arrival message has been written to the log:
    For Purge IMS Message:
    When message processing is complete, then the ims message queue must be purged using cims with purg operation.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists in the system
GIVEN
A train record exists in the system
Applied to: Check Train Status Conditions
WHEN
The system checks train arrival processing eligibility
THEN
The train must be acknowledged AND have arrived-pending status to proceed with arrival processing
Context: A train arrival message is being prepared
GIVEN
A train arrival message is being prepared
Applied to: Set Action Code to 'TAR'
WHEN
The system sets up the transaction parameters
THEN
The action code must be set to 'TAR' to identify this as a train arrival transaction
Applied to: Set Train ID from US Custom Train ID
WHEN
The system assigns train identification
THEN
The US Custom Train ID from the train record must be used as the train identifier in the arrival message
Context: A train arrival is being processed
GIVEN
A train arrival is being processed
Applied to: Get Current System Date/Time
WHEN
The system needs to record the arrival timestamp
THEN
The current system date and time must be captured and formatted for the arrival event
Context: System date and time have been captured
GIVEN
System date and time have been captured
Applied to: Format Event Date and Time
WHEN
The arrival message is being constructed
THEN
The date must be formatted as YYMMDD and time as HHMM for the event timestamp
Context: A train arrival transaction is being created
GIVEN
A train arrival transaction is being created
Applied to: Set Security Parameters
WHEN
Security parameters are being set
THEN
The security byte must be set to HIGH-VALUE and the transaction type must be marked as US-TRAIN
Context: All train arrival parameters have been set
GIVEN
All train arrival parameters have been set
Applied to: Create Train Arrival Transaction Message
WHEN
The system creates the transaction message
THEN
A complete GCT1121E message must be generated with action code, event date/time, train ID, and security parameters
Context: A train arrival message has been created
GIVEN
A train arrival message has been created
Applied to: Send Message to IMS Queue
WHEN
The message needs to be queued for processing
THEN
The message must be sent to the IMS queue using CIMS with CHNG operation and ALT-PCB
Context: A train arrival message is queued in IMS
GIVEN
A train arrival message is queued in IMS
Applied to: Write Train Arrival Message
WHEN
The message needs to be logged
THEN
The message must be written using WRITMSGL with the message code, content, length, and module name
Context: A train arrival message has been written to the log
GIVEN
A train arrival message has been written to the log
Applied to: Purge IMS Message
WHEN
Message processing is complete
THEN
The IMS message queue must be purged using CIMS with PURG operation
R-GCX015E-cbl-00165 (+23) File: GCX015E.cbl Send Email Warning Notifications Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Email Warning Notifications':
  • Context - a cargo shipment requires email warning notification:
    For Retrieve Cargo Segment Data:
    When the system processes cargo segment data retrieval, then the system searches through cargo secondary segments to find freight forwarder (n101 type) and consignee (n101 type) information, and identifies segment 07 data.
  • Context - cargo segment data is being processed for email notifications:
    For Freight Forwarder Found?:
    When the system examines segment type 03 records, then if gcus-n101 field indicates forwarder type, set freight forwarder found flag to true.
  • Context - cargo segment data contains consignee information:
    For Retrieve Cargo Segment Data:
    When the system processes segment type 03 records with n101 consignee type, then the system captures the consignee name from gcus-n102-name field and sets consignee found flag.
  • Context - a freight forwarder name is available from cargo segments:
    For Get Freight Forwarder Broker Short Name:
    When the system constructs a lookup key with 'fw=' prefix and freight forwarder name, then the system retrieves broker short name from gcst2rt table, or initializes empty broker name segment if not found.
  • Context - freight forwarder broker lookup has been performed:
    For Broker Short Name Available?:
    When the system evaluates the retrieved broker information, then if gct2-broker-name-short is not spaces, proceed to get detailed broker contact information.
  • Context - broker short name is available and location id exists:
    For Get Freight Forwarder Broker Contact Information:
    When the system constructs lookup keys using broker short name with either m1203 location id or p401 location id, then the system retrieves broker segment (bk) and internet address segment (b1) from table, and if broker uses internet, sets email recipient to internet address.
  • Context - cargo information is available for email warning:
    For Retrieve Shipment Root Data:
    When the system needs shipment details for email content, then the system calls fwcwbio to retrieve shiproot segment using the waybill key from cargo data.
  • Context - email warning notification needs to be sent:
    For Format Email Subject Line:
    When the system prepares the email subject, then the system sets the email subject to the predefined warning email subject format.
  • Context - shipment data is available for email warning:
    For Format Email Content with Shipment Details:
    When the system constructs email content, then the system formats email with header lines, equipment details, waybill information, ccn data, load/empty indicator, content description, origin/destination stations, consignee info, cbp warning message, timestamp, and footer text.
  • Context - cargo equipment information is available:
    For Add Equipment Information:
    When the system formats email content, then the system adds equipment id number from gcusrt-rt071-car-id-num-index to the email text.
  • Context - waybill information is available from cargo data:
    For Add Waybill Information:
    When the system formats email content, then the system concatenates road index, station index, and waybill index from gcusrt-rt072 fields into waybill line data.
  • Context - ccn data is available from message processing:
    For Add CCN Information:
    When the system formats email content, then the system adds the ccn (container control number) from work-m10-12-data to the email text.
  • Context - load/empty indicator is available from cargo data:
    For Add Load/Empty Indicator:
    When the system formats email content, then the system adds the load/empty code from gcusrt-vid10-load-empty-cde to the email text.
  • Context - content description is available from cargo data:
    For Add Content Description:
    When the system formats email content, then the system adds the long description from gcus-n1002-long-desc to the email text.
  • Context - origin station information is available from shipment data:
    For Add Origin Station Information:
    When the system formats email content, then the system concatenates origin station name and province/state code into origin station data for the email.
  • Context - destination station information is available from shipment data:
    For Add Destination Station Information:
    When the system formats email content, then the system concatenates destination station name and province/state code into destination station data for the email.
  • Context - consignee information was found in cargo segments:
    For Add Consignee Information:
    When the system formats email content, then the system adds the consignee name to the email text.
  • Context - k1 segment contains a cbp warning message:
    For Add CBP Warning Message:
    When the system formats email content, then the system adds the free-form message from k1-02-free-form-message as the cbp warning message data.
  • Context - k3 segment contains date and time information:
    For Add Date and Time Information:
    When the system formats email content, then the system formats date from machine century, k3-01-date, and time from k3-01-time into a readable timestamp and adds it to the email.
  • Context - email content is being finalized:
    For Add Footer Text:
    When the system completes email formatting, then the system adds predefined footer text to the email content.
  • Context - broker contact information has been retrieved:
    For Send to Freight Forwarder?:
    When the system determines email recipient, then if broker uses internet (gcstbrt-bk-use-internet = 'y'), set email recipient to freight forwarder internet address, otherwise use default system address.
  • Context - freight forwarder uses internet communication and has valid internet address:
    For Set Email Recipient to Freight Forwarder Internet Address:
    When the system sets email recipient, then the system sets email destination to 'extmail' and includes freight forwarder internet address in email header, and sets freight forwarder email flag.
  • Context - freight forwarder does not use internet communication or internet address is not available:
    For Set Email Recipient to Default System Address:
    When the system sets email recipient, then the system sets email recipient to default system merlin id.
  • Context - email content is formatted and recipient is determined:
    For Send Email Message:
    When the system sends the email warning, then the system calls merlin email service to send the message and sets do-not-send-warning flag to prevent duplicate sends.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment requires email warning notification
GIVEN
A cargo shipment requires email warning notification
Applied to: Retrieve Cargo Segment Data
WHEN
The system processes cargo segment data retrieval
THEN
The system searches through cargo secondary segments to find freight forwarder (N101 type) and consignee (N101 type) information, and identifies segment 07 data
Context: Cargo segment data is being processed for email notifications
GIVEN
Cargo segment data is being processed for email notifications
Applied to: Freight Forwarder Found?
WHEN
The system examines segment type 03 records
THEN
If GCUS-N101 field indicates forwarder type, set freight forwarder found flag to true
Context: Cargo segment data contains consignee information
GIVEN
Cargo segment data contains consignee information
Applied to: Retrieve Cargo Segment Data
WHEN
The system processes segment type 03 records with N101 consignee type
THEN
The system captures the consignee name from GCUS-N102-NAME field and sets consignee found flag
Context: A freight forwarder name is available from cargo segments
GIVEN
A freight forwarder name is available from cargo segments
Applied to: Get Freight Forwarder Broker Short Name
WHEN
The system constructs a lookup key with 'FW=' prefix and freight forwarder name
THEN
The system retrieves broker short name from GCST2RT table, or initializes empty broker name segment if not found
Context: Freight forwarder broker lookup has been performed
GIVEN
Freight forwarder broker lookup has been performed
Applied to: Broker Short Name Available?
WHEN
The system evaluates the retrieved broker information
THEN
If GCT2-BROKER-NAME-SHORT is not spaces, proceed to get detailed broker contact information
Context: Broker short name is available and location ID exists
GIVEN
Broker short name is available and location ID exists
Applied to: Get Freight Forwarder Broker Contact Information
WHEN
The system constructs lookup keys using broker short name with either M1203 location ID or P401 location ID
THEN
The system retrieves broker segment (BK) and internet address segment (B1) from table, and if broker uses internet, sets email recipient to internet address
Context: Cargo information is available for email warning
GIVEN
Cargo information is available for email warning
Applied to: Retrieve Shipment Root Data
WHEN
The system needs shipment details for email content
THEN
The system calls FWCWBIO to retrieve SHIPROOT segment using the waybill key from cargo data
Context: Email warning notification needs to be sent
GIVEN
Email warning notification needs to be sent
Applied to: Format Email Subject Line
WHEN
The system prepares the email subject
THEN
The system sets the email subject to the predefined warning email subject format
Context: Shipment data is available for email warning
GIVEN
Shipment data is available for email warning
Applied to: Format Email Content with Shipment Details
WHEN
The system constructs email content
THEN
The system formats email with header lines, equipment details, waybill information, CCN data, load/empty indicator, content description, origin/destination stations, consignee info, CBP warning message, timestamp, and footer text
Context: Cargo equipment information is available
GIVEN
Cargo equipment information is available
Applied to: Add Equipment Information
WHEN
The system formats email content
THEN
The system adds equipment ID number from GCUSRT-RT071-CAR-ID-NUM-INDEX to the email text
Context: Waybill information is available from cargo data
GIVEN
Waybill information is available from cargo data
Applied to: Add Waybill Information
WHEN
The system formats email content
THEN
The system concatenates road index, station index, and waybill index from GCUSRT-RT072 fields into waybill line data
Context: CCN data is available from message processing
GIVEN
CCN data is available from message processing
Applied to: Add CCN Information
WHEN
The system formats email content
THEN
The system adds the CCN (Container Control Number) from WORK-M10-12-DATA to the email text
Context: Load/empty indicator is available from cargo data
GIVEN
Load/empty indicator is available from cargo data
Applied to: Add Load/Empty Indicator
WHEN
The system formats email content
THEN
The system adds the load/empty code from GCUSRT-VID10-LOAD-EMPTY-CDE to the email text
Context: Content description is available from cargo data
GIVEN
Content description is available from cargo data
Applied to: Add Content Description
WHEN
The system formats email content
THEN
The system adds the long description from GCUS-N1002-LONG-DESC to the email text
Context: Origin station information is available from shipment data
GIVEN
Origin station information is available from shipment data
Applied to: Add Origin Station Information
WHEN
The system formats email content
THEN
The system concatenates origin station name and province/state code into origin station data for the email
Context: Destination station information is available from shipment data
GIVEN
Destination station information is available from shipment data
Applied to: Add Destination Station Information
WHEN
The system formats email content
THEN
The system concatenates destination station name and province/state code into destination station data for the email
Context: Consignee information was found in cargo segments
GIVEN
Consignee information was found in cargo segments
Applied to: Add Consignee Information
WHEN
The system formats email content
THEN
The system adds the consignee name to the email text
Context: K1 segment contains a CBP warning message
GIVEN
K1 segment contains a CBP warning message
Applied to: Add CBP Warning Message
WHEN
The system formats email content
THEN
The system adds the free-form message from K1-02-FREE-FORM-MESSAGE as the CBP warning message data
Context: K3 segment contains date and time information
GIVEN
K3 segment contains date and time information
Applied to: Add Date and Time Information
WHEN
The system formats email content
THEN
The system formats date from machine century, K3-01-DATE, and time from K3-01-TIME into a readable timestamp and adds it to the email
Context: Email content is being finalized
GIVEN
Email content is being finalized
Applied to: Add Footer Text
WHEN
The system completes email formatting
THEN
The system adds predefined footer text to the email content
Context: Broker contact information has been retrieved
GIVEN
Broker contact information has been retrieved
Applied to: Send to Freight Forwarder?
WHEN
The system determines email recipient
THEN
If broker uses internet (GCSTBRT-BK-USE-INTERNET = 'Y'), set email recipient to freight forwarder internet address, otherwise use default system address
Context: Freight forwarder uses internet communication and has valid internet address
GIVEN
Freight forwarder uses internet communication and has valid internet address
Applied to: Set Email Recipient to Freight Forwarder Internet Address
WHEN
The system sets email recipient
THEN
The system sets email destination to 'EXTMAIL' and includes freight forwarder internet address in email header, and sets freight forwarder email flag
Context: Freight forwarder does not use internet communication or internet address is not available
GIVEN
Freight forwarder does not use internet communication or internet address is not available
Applied to: Set Email Recipient to Default System Address
WHEN
The system sets email recipient
THEN
The system sets email recipient to default system Merlin ID
Context: Email content is formatted and recipient is determined
GIVEN
Email content is formatted and recipient is determined
Applied to: Send Email Message
WHEN
The system sends the email warning
THEN
The system calls Merlin email service to send the message and sets do-not-send-warning flag to prevent duplicate sends
R-GCX015E-cbl-00189 (+9) File: GCX015E.cbl Retrieve Freight Forwarder Information Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Freight Forwarder Information':
  • Context - a us cargo ccn key is available for processing:
    For Initialize Search Parameters:
    When the system begins searching for freight forwarder information, then search parameters are initialized with freight forwarder not found status, consignee not found status, and additional data segment not found status.
  • Context - a valid us cargo ccn key exists:
    For Get First US Cargo Secondary Record:
    When the system searches for the first secondary record with record type '00' and sequence '00' using greater than operator, then the first available secondary record for the ccn is retrieved or no record found status is returned.
  • Context - a secondary record with type '03' is retrieved:
    For Check Record Type:
    When the n101 qualifier code is evaluated for forwarder identification, then if the n101 qualifier indicates forwarder, the freight forwarder found status is set to true.
    For Check Record Type:
    When the n101 qualifier code is evaluated for consignee identification, then if the n101 qualifier indicates consignee, the consignee name is extracted from n102 field and consignee found status is set to true.
  • Context - a record type 03 with forwarder n101 qualifier is found:
    For Extract Freight Forwarder Name:
    When the freight forwarder information is being extracted, then the n102 name field is captured and the freight forwarder found indicator is set.
  • Context - a record type 03 with consignee n101 qualifier is found:
    For Extract Consignee Name:
    When the consignee information is being extracted, then the n102 name field is stored as consignee data and the consignee found indicator is set.
  • Context - a secondary record is being processed:
    For Mark Additional Data Found:
    When the record type is '07', then the additional data segment found indicator is set to true.
  • Context - a secondary record has been processed and more records may exist:
    For Get Next US Cargo Secondary Record:
    When the system continues searching using get next function, then the next secondary record for the same ccn is retrieved or end of records is indicated.
  • Context - a secondary record is retrieved during the search process:
    For More Records for Same CCN?:
    When the record's ccn key is compared with the original search ccn, then if the ccn keys match, continue processing; if they don't match, stop the search process.
  • Context - the search process has completed for all secondary records of a ccn:
    For Both Freight Forwarder and Consignee Found?:
    When the system evaluates the search results, then if both freight forwarder and consignee are found, or if freight forwarder is found and additional data segment 07 is found, or if consignee is found, the search is considered complete.
👨‍💻 Technical ACs (Gherkin)
Context: A US Cargo CCN key is available for processing
GIVEN
A US Cargo CCN key is available for processing
Applied to: Initialize Search Parameters
WHEN
The system begins searching for freight forwarder information
THEN
Search parameters are initialized with freight forwarder not found status, consignee not found status, and additional data segment not found status
Context: A valid US Cargo CCN key exists
GIVEN
A valid US Cargo CCN key exists
Applied to: Get First US Cargo Secondary Record
WHEN
The system searches for the first secondary record with record type '00' and sequence '00' using greater than operator
THEN
The first available secondary record for the CCN is retrieved or no record found status is returned
Context: A secondary record with type '03' is retrieved
GIVEN
A secondary record with type '03' is retrieved
Applied to: Check Record Type
WHEN
The N101 qualifier code is evaluated for forwarder identification
THEN
If the N101 qualifier indicates forwarder, the freight forwarder found status is set to true
Applied to: Check Record Type
WHEN
The N101 qualifier code is evaluated for consignee identification
THEN
If the N101 qualifier indicates consignee, the consignee name is extracted from N102 field and consignee found status is set to true
Context: A record type 03 with forwarder N101 qualifier is found
GIVEN
A record type 03 with forwarder N101 qualifier is found
Applied to: Extract Freight Forwarder Name
WHEN
The freight forwarder information is being extracted
THEN
The N102 name field is captured and the freight forwarder found indicator is set
Context: A record type 03 with consignee N101 qualifier is found
GIVEN
A record type 03 with consignee N101 qualifier is found
Applied to: Extract Consignee Name
WHEN
The consignee information is being extracted
THEN
The N102 name field is stored as consignee data and the consignee found indicator is set
Context: A secondary record is being processed
GIVEN
A secondary record is being processed
Applied to: Mark Additional Data Found
WHEN
The record type is '07'
THEN
The additional data segment found indicator is set to true
Context: A secondary record has been processed and more records may exist
GIVEN
A secondary record has been processed and more records may exist
Applied to: Get Next US Cargo Secondary Record
WHEN
The system continues searching using get next function
THEN
The next secondary record for the same CCN is retrieved or end of records is indicated
Context: A secondary record is retrieved during the search process
GIVEN
A secondary record is retrieved during the search process
Applied to: More Records for Same CCN?
WHEN
The record's CCN key is compared with the original search CCN
THEN
If the CCN keys match, continue processing; if they don't match, stop the search process
Context: The search process has completed for all secondary records of a CCN
GIVEN
The search process has completed for all secondary records of a CCN
Applied to: Both Freight Forwarder and Consignee Found?
WHEN
The system evaluates the search results
THEN
If both freight forwarder and consignee are found, or if freight forwarder is found and additional data segment 07 is found, or if consignee is found, the search is considered complete
R-GCX015E-cbl-00199 (+8) File: GCX015E.cbl Get Freight Forwarder Contact Details Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Freight Forwarder Contact Details':
  • Context - a freight forwarder name exists in the cargo segment:
    For Build Freight Forwarder Key from Name:
    When the system needs to lookup freight forwarder contact details, then the system builds a lookup key by concatenating 'fw=' prefix with the freight forwarder name.
  • Context - a freight forwarder lookup key has been constructed:
    For Retrieve Freight Forwarder Short Name from GCST2RT:
    When the system queries the gcst2rt table with the lookup key, then the system retrieves the freight forwarder's short name if found, otherwise initializes empty broker information.
  • Context - the freight forwarder lookup in gcst2rt table returns no results:
    For Initialize Empty Broker Information:
    When the system cannot find a matching freight forwarder short name, then the system initializes the broker name segment to empty values.
  • Context - a freight forwarder short name exists and location information is available:
    For Build Broker Key using Short Name and Location:
    When the system needs to lookup broker contact information, then the system builds a broker key by concatenating the short name with the primary location id if available, otherwise uses the alternate location id.
  • Context - a broker lookup key has been constructed with short name and location:
    For Retrieve Broker Contact Information from BK Table:
    When the system queries the bk table segment with the broker key, then the system retrieves broker contact information if found, otherwise initializes empty broker contact data.
  • Context - the broker contact lookup in bk table returns no results:
    For Initialize Empty Broker Contact:
    When the system cannot find matching broker contact information, then the system initializes the bk segment to empty values and skips further processing.
  • Context - broker contact information exists in the bk segment:
    For Retrieve Internet Address from B1 Table:
    When the system queries the b1 table for internet address information, then the system retrieves internet address data if found, otherwise initializes empty internet address information.
  • Context - the internet address lookup in b1 table returns no results:
    For Initialize Empty Internet Address:
    When the system cannot find matching internet address information, then the system initializes the b1 segment to empty values and skips email configuration.
  • Context - broker contact information indicates internet usage is enabled ('y') and valid internet address exists:
    For Set Email Address for Freight Forwarder:
    When the system evaluates email delivery options for the freight forwarder, then the system sets the email text line with internet address, configures external mail delivery, and enables freight forwarder email flag.
👨‍💻 Technical ACs (Gherkin)
Context: A freight forwarder name exists in the cargo segment
GIVEN
A freight forwarder name exists in the cargo segment
Applied to: Build Freight Forwarder Key from Name
WHEN
The system needs to lookup freight forwarder contact details
THEN
The system builds a lookup key by concatenating 'FW=' prefix with the freight forwarder name
Context: A freight forwarder lookup key has been constructed
GIVEN
A freight forwarder lookup key has been constructed
Applied to: Retrieve Freight Forwarder Short Name from GCST2RT
WHEN
The system queries the GCST2RT table with the lookup key
THEN
The system retrieves the freight forwarder's short name if found, otherwise initializes empty broker information
Context: The freight forwarder lookup in GCST2RT table returns no results
GIVEN
The freight forwarder lookup in GCST2RT table returns no results
Applied to: Initialize Empty Broker Information
WHEN
The system cannot find a matching freight forwarder short name
THEN
The system initializes the broker name segment to empty values
Context: A freight forwarder short name exists and location information is available
GIVEN
A freight forwarder short name exists and location information is available
Applied to: Build Broker Key using Short Name and Location
WHEN
The system needs to lookup broker contact information
THEN
The system builds a broker key by concatenating the short name with the primary location ID if available, otherwise uses the alternate location ID
Context: A broker lookup key has been constructed with short name and location
GIVEN
A broker lookup key has been constructed with short name and location
Applied to: Retrieve Broker Contact Information from BK Table
WHEN
The system queries the BK table segment with the broker key
THEN
The system retrieves broker contact information if found, otherwise initializes empty broker contact data
Context: The broker contact lookup in BK table returns no results
GIVEN
The broker contact lookup in BK table returns no results
Applied to: Initialize Empty Broker Contact
WHEN
The system cannot find matching broker contact information
THEN
The system initializes the BK segment to empty values and skips further processing
Context: Broker contact information exists in the BK segment
GIVEN
Broker contact information exists in the BK segment
Applied to: Retrieve Internet Address from B1 Table
WHEN
The system queries the B1 table for internet address information
THEN
The system retrieves internet address data if found, otherwise initializes empty internet address information
Context: The internet address lookup in B1 table returns no results
GIVEN
The internet address lookup in B1 table returns no results
Applied to: Initialize Empty Internet Address
WHEN
The system cannot find matching internet address information
THEN
The system initializes the B1 segment to empty values and skips email configuration
Context: Broker contact information indicates internet usage is enabled ('Y') and valid internet address exists
GIVEN
Broker contact information indicates internet usage is enabled ('Y') and valid internet address exists
Applied to: Set Email Address for Freight Forwarder
WHEN
The system evaluates email delivery options for the freight forwarder
THEN
The system sets the email text line with internet address, configures external mail delivery, and enables freight forwarder email flag
R-GCX015E-cbl-00208 (+5) File: GCX015E.cbl Retrieve Shipment Root Data Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Shipment Root Data':
  • Context - a request to retrieve shipment root data is initiated:
    For Initialize Shipment Root Parameters:
    When the system begins the shipment root data retrieval process, then the shipment root work area is cleared and initialized to spaces.
  • Context - shipment root parameters are being configured:
    For Set Segment Type to SHIPROOT:
    When the system sets up the database query parameters, then the segment type is set to 'shiproot' to specify the data type being requested.
  • Context - database query parameters are being established:
    For Set Function Code to GU - Get Unique:
    When the system prepares to retrieve shipment root data, then the function code is set to 'gu' to perform a get unique operation.
  • Context - database retrieval parameters are being configured:
    For Set Accept Status to GE - Get Equal:
    When the system establishes query criteria, then the accept status is set to 'ge' to retrieve records with exact key match.
  • Context - a cargo record with waybill information exists:
    For Extract Waybill Key from Cargo Record:
    When the system needs to retrieve associated shipment root data, then the waybill key from field gcusrt-rt082-waybill-key is extracted and used as the root key for database lookup.
  • Context - all shipment root retrieval parameters are configured with waybill key, segment type, function code, and accept status:
    For Call FWCWBIO to Retrieve Shipment Root:
    When the system executes the database retrieval operation, then the fwcwbio program is called with the configured parameters to retrieve shipment root data from the shiproot database.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve shipment root data is initiated
GIVEN
A request to retrieve shipment root data is initiated
Applied to: Initialize Shipment Root Parameters
WHEN
The system begins the shipment root data retrieval process
THEN
The shipment root work area is cleared and initialized to spaces
Context: Shipment root parameters are being configured
GIVEN
Shipment root parameters are being configured
Applied to: Set Segment Type to SHIPROOT
WHEN
The system sets up the database query parameters
THEN
The segment type is set to 'SHIPROOT' to specify the data type being requested
Context: Database query parameters are being established
GIVEN
Database query parameters are being established
Applied to: Set Function Code to GU - Get Unique
WHEN
The system prepares to retrieve shipment root data
THEN
The function code is set to 'GU' to perform a get unique operation
Context: Database retrieval parameters are being configured
GIVEN
Database retrieval parameters are being configured
Applied to: Set Accept Status to GE - Get Equal
WHEN
The system establishes query criteria
THEN
The accept status is set to 'GE' to retrieve records with exact key match
Context: A cargo record with waybill information exists
GIVEN
A cargo record with waybill information exists
Applied to: Extract Waybill Key from Cargo Record
WHEN
The system needs to retrieve associated shipment root data
THEN
The waybill key from field GCUSRT-RT082-WAYBILL-KEY is extracted and used as the root key for database lookup
Context: All shipment root retrieval parameters are configured with waybill key, segment type, function code, and accept status
GIVEN
All shipment root retrieval parameters are configured with waybill key, segment type, function code, and accept status
Applied to: Call FWCWBIO to Retrieve Shipment Root
WHEN
The system executes the database retrieval operation
THEN
The FWCWBIO program is called with the configured parameters to retrieve shipment root data from the SHIPROOT database
R-GCX015E-cbl-00214 (+8) File: GCX015E.cbl Log Customs Response Information Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Log Customs Response Information':
  • Context - a customs response needs to be logged:
    For Prepare Log Information Structure:
    When the system prepares the log information structure, then the message field is cleared, action code is cleared, and security byte is set to high value.
  • Context - a customs response is being logged:
    For Capture Transaction Code:
    When the system captures transaction context, then the sending transaction code and acf2 user id are recorded in the log entry.
  • Context - a customs response log entry is being created:
    For Format Current Date:
    When the system formats the timestamp, then the date is formatted by concatenating machine century with k3-01-date and time is set from k3-01-time.
    For Set Action Code to 'ZZZ':
    When the system sets the action code, then the action code is set to 'zzz' to identify this as a customs response log entry.
  • Context - a customs response is being logged for either train or cargo:
    For Set Train or Cargo Indicator:
    When the system sets the entity type indicator, then if processing train data then train indicator is set, otherwise cargo indicator is set.
  • Context - a customs response log entry needs a status message:
    For Add Status Message:
    When the system adds the status message, then if entity is cargo then cargo log message is used, else if entity is train then train log message is used, else if status should not be updated then no-update log message is used.
  • Context - a complete customs response log entry is prepared:
    For Send Log Entry to GCT1051E:
    When the system sends the log entry, then the log entry is transmitted to gct1051e transaction via message queue for processing.
  • Context - multiple k1 messages exist for logging:
    For Process Next K1 Message:
    When the system processes additional k1 messages, then for each k1 message that is not empty and counter is less than or equal to 999, a separate log entry is created and sent.
  • Context - a non-empty k1 message needs to be logged:
    For Create Additional Log Entry:
    When the system creates an individual k1 log entry, then the log entry contains the same transaction context with train/cargo identifier, action code 'zzz', and the specific k1 message content.
👨‍💻 Technical ACs (Gherkin)
Context: A customs response needs to be logged
GIVEN
A customs response needs to be logged
Applied to: Prepare Log Information Structure
WHEN
The system prepares the log information structure
THEN
The message field is cleared, action code is cleared, and security byte is set to high value
Context: A customs response is being logged
GIVEN
A customs response is being logged
Applied to: Capture Transaction Code
WHEN
The system captures transaction context
THEN
The sending transaction code and ACF2 user ID are recorded in the log entry
Context: A customs response log entry is being created
GIVEN
A customs response log entry is being created
Applied to: Format Current Date
WHEN
The system formats the timestamp
THEN
The date is formatted by concatenating machine century with K3-01-DATE and time is set from K3-01-TIME
Applied to: Set Action Code to 'ZZZ'
WHEN
The system sets the action code
THEN
The action code is set to 'ZZZ' to identify this as a customs response log entry
Context: A customs response is being logged for either train or cargo
GIVEN
A customs response is being logged for either train or cargo
Applied to: Set Train or Cargo Indicator
WHEN
The system sets the entity type indicator
THEN
If processing train data then train indicator is set, otherwise cargo indicator is set
Context: A customs response log entry needs a status message
GIVEN
A customs response log entry needs a status message
Applied to: Add Status Message
WHEN
The system adds the status message
THEN
If entity is cargo then cargo log message is used, else if entity is train then train log message is used, else if status should not be updated then no-update log message is used
Context: A complete customs response log entry is prepared
GIVEN
A complete customs response log entry is prepared
Applied to: Send Log Entry to GCT1051E
WHEN
The system sends the log entry
THEN
The log entry is transmitted to GCT1051E transaction via message queue for processing
Context: Multiple K1 messages exist for logging
GIVEN
Multiple K1 messages exist for logging
Applied to: Process Next K1 Message
WHEN
The system processes additional K1 messages
THEN
For each K1 message that is not empty and counter is less than or equal to 999, a separate log entry is created and sent
Context: A non-empty K1 message needs to be logged
GIVEN
A non-empty K1 message needs to be logged
Applied to: Create Additional Log Entry
WHEN
The system creates an individual K1 log entry
THEN
The log entry contains the same transaction context with train/cargo identifier, action code 'ZZZ', and the specific K1 message content
R-GCX015E-cbl-00223 (+7) File: GCX015E.cbl Update Manifest Type Timestamps Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Manifest Type Timestamps':
  • Context - a manifest processing request is initiated:
    For Retrieve T1 Table Entry:
    When the system needs to update manifest acknowledgment timestamps, then the t1 table entry is retrieved using table id 't1' and empty sequence id.
  • Context - a request to retrieve t1 table entry has been made:
    For T1 Table Entry Found?:
    When the table lookup operation completes, then if the t1 table entry is not found, the system terminates processing with error message 't1 check table entry not found'.
  • Context - t1 table entry exists and timestamp update is required:
    For Get Current Date and Time:
    When the system prepares to update acknowledgment timestamps, then current machine date, century, and time are captured from the system.
  • Context - current date and time have been captured and manifest type code is available:
    For Manifest Type Code?:
    When the system evaluates the manifest type code from the message, then the system routes to appropriate timestamp update based on manifest type: 'p' for 309 acknowledgment, 'h' for 353 acknowledgment, or 's' for 358 acknowledgment.
  • Context - manifest type code is 'p' and current date/time are available:
    For Update 309 Acknowledgment Timestamp Type P - Manifest:
    When the system processes the manifest acknowledgment, then the 309 acknowledgment timestamp is updated with current machine date (yymmdd format starting at position 3), century (positions 1-2), and time (hhmm format starting at position 9).
  • Context - manifest type code is 'h' and current date/time are available:
    For Update 353 Acknowledgment Timestamp Type H - Delete Manifest:
    When the system processes the delete manifest acknowledgment, then the 353 acknowledgment timestamp is updated with current machine date (yymmdd format starting at position 3), century (positions 1-2), and time (hhmm format starting at position 9).
  • Context - manifest type code is 's' and current date/time are available:
    For Update 358 Acknowledgment Timestamp Type S - Status Manifest:
    When the system processes the status manifest acknowledgment, then the 358 acknowledgment timestamp is updated with current machine date (yymmdd format starting at position 3), century (positions 1-2), and time (hhmm format starting at position 9).
  • Context - the appropriate acknowledgment timestamp has been updated in the t1 table entry:
    For Save Updated T1 Table Entry:
    When the timestamp update is complete, then the updated t1 table entry is saved back to the table using replace function.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest processing request is initiated
GIVEN
A manifest processing request is initiated
Applied to: Retrieve T1 Table Entry
WHEN
The system needs to update manifest acknowledgment timestamps
THEN
The T1 table entry is retrieved using table ID 'T1' and empty sequence ID
Context: A request to retrieve T1 table entry has been made
GIVEN
A request to retrieve T1 table entry has been made
Applied to: T1 Table Entry Found?
WHEN
The table lookup operation completes
THEN
If the T1 table entry is not found, the system terminates processing with error message 'T1 CHECK TABLE ENTRY NOT FOUND'
Context: T1 table entry exists and timestamp update is required
GIVEN
T1 table entry exists and timestamp update is required
Applied to: Get Current Date and Time
WHEN
The system prepares to update acknowledgment timestamps
THEN
Current machine date, century, and time are captured from the system
Context: Current date and time have been captured and manifest type code is available
GIVEN
Current date and time have been captured and manifest type code is available
Applied to: Manifest Type Code?
WHEN
The system evaluates the manifest type code from the message
THEN
The system routes to appropriate timestamp update based on manifest type: 'P' for 309 acknowledgment, 'H' for 353 acknowledgment, or 'S' for 358 acknowledgment
Context: Manifest type code is 'P' and current date/time are available
GIVEN
Manifest type code is 'P' and current date/time are available
Applied to: Update 309 Acknowledgment Timestamp Type P - Manifest
WHEN
The system processes the manifest acknowledgment
THEN
The 309 acknowledgment timestamp is updated with current machine date (YYMMDD format starting at position 3), century (positions 1-2), and time (HHMM format starting at position 9)
Context: Manifest type code is 'H' and current date/time are available
GIVEN
Manifest type code is 'H' and current date/time are available
Applied to: Update 353 Acknowledgment Timestamp Type H - Delete Manifest
WHEN
The system processes the delete manifest acknowledgment
THEN
The 353 acknowledgment timestamp is updated with current machine date (YYMMDD format starting at position 3), century (positions 1-2), and time (HHMM format starting at position 9)
Context: Manifest type code is 'S' and current date/time are available
GIVEN
Manifest type code is 'S' and current date/time are available
Applied to: Update 358 Acknowledgment Timestamp Type S - Status Manifest
WHEN
The system processes the status manifest acknowledgment
THEN
The 358 acknowledgment timestamp is updated with current machine date (YYMMDD format starting at position 3), century (positions 1-2), and time (HHMM format starting at position 9)
Context: The appropriate acknowledgment timestamp has been updated in the T1 table entry
GIVEN
The appropriate acknowledgment timestamp has been updated in the T1 table entry
Applied to: Save Updated T1 Table Entry
WHEN
The timestamp update is complete
THEN
The updated T1 table entry is saved back to the table using replace function
R-GCX015E-cbl-00231 (+16) File: GCX015E.cbl Send Customs Transaction Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Customs Transaction':
  • Context - a train record exists in the system:
    For Check AEI Train Send Conditions:
    When the system evaluates aei send eligibility, then the train must be acknowledged, have aei send flag set, be en-route but not reported, and have a train id ending with 't' to proceed with aei processing.
  • Context - a train is eligible for aei processing:
    For Set Customs Transaction Code to GCT1461E:
    When the system prepares the customs transaction, then the customs transaction code must be set to 'gct1461e'.
  • Context - a customs transaction is being prepared:
    For Set Security to High Values:
    When the system sets security parameters, then the customs security must be set to high values.
  • Context - a customs transaction is being prepared for a train:
    For Set Customs Code to 'A':
    When the system assigns the customs code, then the customs code must be set to 'a' for arrival processing.
  • Context - a train record with a valid us customer train id exists:
    For Set Train ID from Train List:
    When the system prepares the customs transaction, then the customs train id must be set from the train list us customer train id.
  • Context - a train record contains station information:
    For Set Station Information:
    When the system prepares the customs transaction, then both the customs to-station and from-station must be set from the train's cp train from station.
  • Context - a train record contains a consist number:
    For Set Consist Number:
    When the system prepares the customs transaction, then the customs consist number must be set from the train's cp train consist number.
  • Context - a train record contains estimated arrival information:
    For Set Date and Time:
    When the system prepares the customs transaction, then the customs date must be set from the train's estimated date of arrival and the customs time must be set from the train's estimated time of arrival.
  • Context - the system is preparing to load car information:
    For Initialize Car Counter:
    When car processing begins, then the car counter must be initialized to 1 and the secondary counter must be initialized to 2.
  • Context - a car in the train has a container indicator:
    For Skip Container Car:
    When the system processes car information for customs, then cars with container indicator 'c' must be skipped and not included in the customs transaction.
  • Context - a non-container car exists in the train:
    For Load Car Initial and Number:
    When the system loads car information, then the car initial must be loaded from the equipment initial and the car number must be loaded from the equipment number converted to 6-digit format.
  • Context - a car is being processed for customs transaction:
    For Set Car Load/Empty Indicator:
    When the system determines the load/empty indicator, then if the car position exceeds the total equipment quantity, use the car's load/empty code; otherwise, if the next car is a container, set indicator to 'l', else use the current car's load/empty code.
  • Context - a car has an equipment type designation:
    For Set Car Type Information:
    When the system sets car type information, then if equipment type is 'lo', set car kind to 'l'; if equipment type is 'et', set car kind to 'e'; otherwise, set car kind to spaces.
  • Context - the system is processing cars in a train:
    For More Cars to Process?:
    When the system checks for more cars to process, then continue processing while the car counter is less than or equal to the equipment quantity and the secondary counter is less than or equal to 500.
  • Context - a complete customs transaction has been prepared:
    For Send Transaction via CIMS:
    When the system submits the transaction, then the transaction must be sent via cims using the change function and alternate pcb.
  • Context - a customs transaction has been submitted via cims:
    For Write Message to Queue:
    When the system writes to the message queue, then the message must be written using writmsgl with the transaction message, length, and module name.
  • Context - a customs transaction has been written to the message queue:
    For Purge Transaction:
    When the system completes transaction processing, then the transaction must be purged using cims with the purge function and alternate pcb.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists in the system
GIVEN
A train record exists in the system
Applied to: Check AEI Train Send Conditions
WHEN
The system evaluates AEI send eligibility
THEN
The train must be acknowledged, have AEI send flag set, be en-route but not reported, and have a train ID ending with 'T' to proceed with AEI processing
Context: A train is eligible for AEI processing
GIVEN
A train is eligible for AEI processing
Applied to: Set Customs Transaction Code to GCT1461E
WHEN
The system prepares the customs transaction
THEN
The customs transaction code must be set to 'GCT1461E'
Context: A customs transaction is being prepared
GIVEN
A customs transaction is being prepared
Applied to: Set Security to High Values
WHEN
The system sets security parameters
THEN
The customs security must be set to high values
Context: A customs transaction is being prepared for a train
GIVEN
A customs transaction is being prepared for a train
Applied to: Set Customs Code to 'A'
WHEN
The system assigns the customs code
THEN
The customs code must be set to 'A' for arrival processing
Context: A train record with a valid US customer train ID exists
GIVEN
A train record with a valid US customer train ID exists
Applied to: Set Train ID from Train List
WHEN
The system prepares the customs transaction
THEN
The customs train ID must be set from the train list US customer train ID
Context: A train record contains station information
GIVEN
A train record contains station information
Applied to: Set Station Information
WHEN
The system prepares the customs transaction
THEN
Both the customs to-station and from-station must be set from the train's CP train from station
Context: A train record contains a consist number
GIVEN
A train record contains a consist number
Applied to: Set Consist Number
WHEN
The system prepares the customs transaction
THEN
The customs consist number must be set from the train's CP train consist number
Context: A train record contains estimated arrival information
GIVEN
A train record contains estimated arrival information
Applied to: Set Date and Time
WHEN
The system prepares the customs transaction
THEN
The customs date must be set from the train's estimated date of arrival and the customs time must be set from the train's estimated time of arrival
Context: The system is preparing to load car information
GIVEN
The system is preparing to load car information
Applied to: Initialize Car Counter
WHEN
Car processing begins
THEN
The car counter must be initialized to 1 and the secondary counter must be initialized to 2
Context: A car in the train has a container indicator
GIVEN
A car in the train has a container indicator
Applied to: Skip Container Car
WHEN
The system processes car information for customs
THEN
Cars with container indicator 'C' must be skipped and not included in the customs transaction
Context: A non-container car exists in the train
GIVEN
A non-container car exists in the train
Applied to: Load Car Initial and Number
WHEN
The system loads car information
THEN
The car initial must be loaded from the equipment initial and the car number must be loaded from the equipment number converted to 6-digit format
Context: A car is being processed for customs transaction
GIVEN
A car is being processed for customs transaction
Applied to: Set Car Load/Empty Indicator
WHEN
The system determines the load/empty indicator
THEN
If the car position exceeds the total equipment quantity, use the car's load/empty code; otherwise, if the next car is a container, set indicator to 'L', else use the current car's load/empty code
Context: A car has an equipment type designation
GIVEN
A car has an equipment type designation
Applied to: Set Car Type Information
WHEN
The system sets car type information
THEN
If equipment type is 'LO', set car kind to 'L'; if equipment type is 'ET', set car kind to 'E'; otherwise, set car kind to spaces
Context: The system is processing cars in a train
GIVEN
The system is processing cars in a train
Applied to: More Cars to Process?
WHEN
The system checks for more cars to process
THEN
Continue processing while the car counter is less than or equal to the equipment quantity and the secondary counter is less than or equal to 500
Context: A complete customs transaction has been prepared
GIVEN
A complete customs transaction has been prepared
Applied to: Send Transaction via CIMS
WHEN
The system submits the transaction
THEN
The transaction must be sent via CIMS using the change function and alternate PCB
Context: A customs transaction has been submitted via CIMS
GIVEN
A customs transaction has been submitted via CIMS
Applied to: Write Message to Queue
WHEN
The system writes to the message queue
THEN
The message must be written using WRITMSGL with the transaction message, length, and module name
Context: A customs transaction has been written to the message queue
GIVEN
A customs transaction has been written to the message queue
Applied to: Purge Transaction
WHEN
The system completes transaction processing
THEN
The transaction must be purged using CIMS with the purge function and alternate PCB
R-GCX015E-cbl-00248 (+5) File: GCX015E.cbl Categorize Error Message Severity Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Categorize Error Message Severity':
  • Context - a k1 message segment is being processed:
    For Set Severity: Information:
    When the k1 message number equals '000', then the message severity is set to information and the processing status is set to acknowledged.
    For Set Severity: Fatal:
    When the k1 message number equals '009' or '017' or '038' or '040' or '291' or '630', then the message severity is set to fatal and the processing status is set to error.
    For Set Severity: Warning:
    When the k1 message number equals '631' or '632' or '633' or '634' or '695' or '696' or '697' or '698' or '699', then the message severity is set to warning and the processing status is set to acknowledged.
    For Set Severity: Unknown:
    When the k1 message number does not equal '000' and does not equal any of the fatal error numbers ('009', '017', '038', '040', '291', '630') and does not equal any of the warning numbers ('631', '632', '633', '634', '695', '696', '697', '698', '699'), then the message severity is set to unknown and the processing status is set to acknowledged.
    For Store Message for Logging:
    When the k1 free form message text field is not empty, then the message text is stored in the logging array and the message counter is incremented.
  • Context - a k1 message segment has been classified as warning severity:
    For Trigger Email Warning Process:
    When the k1 message number equals '695' or '697' or '699', then an email warning process is triggered to send notifications to freight forwarders and brokers.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 message segment is being processed
GIVEN
A K1 message segment is being processed
Applied to: Set Severity: Information
WHEN
The K1 message number equals '000'
THEN
The message severity is set to Information and the processing status is set to Acknowledged
Applied to: Set Severity: Fatal
WHEN
The K1 message number equals '009' OR '017' OR '038' OR '040' OR '291' OR '630'
THEN
The message severity is set to Fatal and the processing status is set to Error
Applied to: Set Severity: Warning
WHEN
The K1 message number equals '631' OR '632' OR '633' OR '634' OR '695' OR '696' OR '697' OR '698' OR '699'
THEN
The message severity is set to Warning and the processing status is set to Acknowledged
Applied to: Set Severity: Unknown
WHEN
The K1 message number does not equal '000' AND does not equal any of the fatal error numbers ('009', '017', '038', '040', '291', '630') AND does not equal any of the warning numbers ('631', '632', '633', '634', '695', '696', '697', '698', '699')
THEN
The message severity is set to Unknown and the processing status is set to Acknowledged
Applied to: Store Message for Logging
WHEN
The K1 free form message text field is not empty
THEN
The message text is stored in the logging array and the message counter is incremented
Context: A K1 message segment has been classified as Warning severity
GIVEN
A K1 message segment has been classified as Warning severity
Applied to: Trigger Email Warning Process
WHEN
The K1 message number equals '695' OR '697' OR '699'
THEN
An email warning process is triggered to send notifications to freight forwarders and brokers
R-GCX015E-cbl-00254 (+7) File: GCX015E.cbl Handle Message Queue Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Message Queue Processing':
  • Context - system needs to process customs messages from message queue:
    For Connect to MQ Manager:
    When connection to mq manager is attempted, then connection is established successfully or system terminates with connection error.
  • Context - mq manager connection is established:
    For Open Message Queue for Reading:
    When message queue is opened for reading with input-as-queue-defined options, then queue is opened successfully for message retrieval or system handles queue unavailable condition.
  • Context - message queue is open for reading:
    For Read Message from Queue:
    When system attempts to get message from queue, then message is retrieved successfully, or no message available condition is handled, or system terminates on retrieval failure.
  • Context - message is successfully retrieved from queue:
    For Check Message Backout Count:
    When message backout count is checked, then if backout count equals zero then message is marked as good for processing, otherwise message is marked to be skipped.
  • Context - message is retrieved and marked as good for processing:
    For Calculate Number of Message Entries:
    When system calculates maximum message entries based on message length, then if calculated entries is less than 1 then system terminates with message too short error, otherwise processing continues.
  • Context - message processing is complete or terminated:
    For Close Message Queue:
    When queue close operation is performed, then message queue is closed successfully or system terminates with close failure error.
  • Context - message queue is closed:
    For Disconnect from MQ Manager:
    When disconnection from mq manager is performed, then mq manager connection is terminated successfully or system terminates with disconnection failure error.
  • Context - system is attempting to retrieve messages from queue:
    For No More Messages:
    When no message available reason code 2033 is returned, then processing is marked as finished and system proceeds to cleanup.
👨‍💻 Technical ACs (Gherkin)
Context: System needs to process customs messages from message queue
GIVEN
System needs to process customs messages from message queue
Applied to: Connect to MQ Manager
WHEN
Connection to MQ manager is attempted
THEN
Connection is established successfully or system terminates with connection error
Context: MQ manager connection is established
GIVEN
MQ manager connection is established
Applied to: Open Message Queue for Reading
WHEN
Message queue is opened for reading with input-as-queue-defined options
THEN
Queue is opened successfully for message retrieval or system handles queue unavailable condition
Context: Message queue is open for reading
GIVEN
Message queue is open for reading
Applied to: Read Message from Queue
WHEN
System attempts to get message from queue
THEN
Message is retrieved successfully, or no message available condition is handled, or system terminates on retrieval failure
Context: Message is successfully retrieved from queue
GIVEN
Message is successfully retrieved from queue
Applied to: Check Message Backout Count
WHEN
Message backout count is checked
THEN
If backout count equals zero then message is marked as good for processing, otherwise message is marked to be skipped
Context: Message is retrieved and marked as good for processing
GIVEN
Message is retrieved and marked as good for processing
Applied to: Calculate Number of Message Entries
WHEN
System calculates maximum message entries based on message length
THEN
If calculated entries is less than 1 then system terminates with message too short error, otherwise processing continues
Context: Message processing is complete or terminated
GIVEN
Message processing is complete or terminated
Applied to: Close Message Queue
WHEN
Queue close operation is performed
THEN
Message queue is closed successfully or system terminates with close failure error
Context: Message queue is closed
GIVEN
Message queue is closed
Applied to: Disconnect from MQ Manager
WHEN
Disconnection from MQ manager is performed
THEN
MQ manager connection is terminated successfully or system terminates with disconnection failure error
Context: System is attempting to retrieve messages from queue
GIVEN
System is attempting to retrieve messages from queue
Applied to: No More Messages
WHEN
No message available reason code 2033 is returned
THEN
Processing is marked as finished and system proceeds to cleanup
R-GCX015E-cbl-00262 (+4) File: GCX015E.cbl Validate Customs Message Format Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Customs Message Format':
  • Context - a customs message has been retrieved from the message queue:
    For Check Message Length:
    When the system checks if the maximum message entries is less than 1, then the system should generate a user abend with error message 'message too short' and terminate processing.
  • Context - a customs message has been successfully retrieved with completion code ok:
    For Check Message Backout Count:
    When the message backout count is not equal to 0, then the system should mark the message as skip message and not process it further.
    For Mark as Good Message - Valid Format:
    When the message backout count equals 0, then the system should mark the message as good message and proceed with customs processing.
  • Context - the system attempts to retrieve a message from the customs queue:
    For Check if No Messages Available:
    When the completion code is failed and the reason code indicates no message available, then the system should generate an mq error message, set transaction code to 355, and abort processing with 'mqget failed' error.
  • Context - the system encounters an error while retrieving messages from the customs queue:
    For Set End of Queue Flag:
    When the completion code is not ok and the reason is not 'no message available', then the system should set end of queue flag, generate mq error message, set transaction code to 355, and abort processing with 'mqget failed' error.
👨‍💻 Technical ACs (Gherkin)
Context: A customs message has been retrieved from the message queue
GIVEN
A customs message has been retrieved from the message queue
Applied to: Check Message Length
WHEN
The system checks if the maximum message entries is less than 1
THEN
The system should generate a user abend with error message 'MESSAGE TOO SHORT' and terminate processing
Context: A customs message has been successfully retrieved with completion code OK
GIVEN
A customs message has been successfully retrieved with completion code OK
Applied to: Check Message Backout Count
WHEN
The message backout count is not equal to 0
THEN
The system should mark the message as skip message and not process it further
Applied to: Mark as Good Message - Valid Format
WHEN
The message backout count equals 0
THEN
The system should mark the message as good message and proceed with customs processing
Context: The system attempts to retrieve a message from the customs queue
GIVEN
The system attempts to retrieve a message from the customs queue
Applied to: Check if No Messages Available
WHEN
The completion code is FAILED and the reason code indicates no message available
THEN
The system should generate an MQ error message, set transaction code to 355, and abort processing with 'MQGET FAILED' error
Context: The system encounters an error while retrieving messages from the customs queue
GIVEN
The system encounters an error while retrieving messages from the customs queue
Applied to: Set End of Queue Flag
WHEN
The completion code is not OK and the reason is not 'no message available'
THEN
The system should set end of queue flag, generate MQ error message, set transaction code to 355, and abort processing with 'MQGET FAILED' error
R-GCX015E-cbl-00267 (+11) File: GCX015E.cbl Generate Audit Trail Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generate Audit Trail':
  • Context - an audit trail generation process is initiated:
    For Prepare Log Information:
    When the system prepares log information, then the message field is cleared, action code is cleared, and security byte is set to high value.
  • Context - audit log information is being prepared:
    For Set Transaction Details:
    When transaction details are being set, then the sending transaction is set to the current transaction code from cccom.
    For Set User ID Information:
    When user id information is being set, then the acf2 user id from cccom is recorded in the audit log.
  • Context - audit log information is being prepared and k3 segment data is available:
    For Set Date and Time Stamps:
    When date and time stamps are being set, then the date is set by concatenating machine century with k3-01-date and time is set to k3-01-time.
  • Context - audit log information is being prepared and processing type has been determined:
    For Determine Message Type:
    When message type is being determined for logging, then if ws-train flag is set, then gcx105-us-train is set to true, otherwise gcx105-us-cargo is set to true.
  • Context - audit log information is being prepared and work-m10-12-data contains the identifier:
    For Set Transaction Details:
    When transaction details are being set, then the train or us ccn identifier is set to work-m10-12-data value.
  • Context - a main status message is being formatted for audit logging:
    For Format Main Status Message:
    When action code is being set, then the action code is set to 'zzz'.
  • Context - a main status message is being formatted and processing type is determined:
    For Format Main Status Message:
    When status message is being formatted, then if processing cargo, then uscs-log-message1 is used; if processing train, then uscs-log-message2 is used; if should not update status, then uscs-log-message3 is used.
  • Context - k1 error messages are being processed and hold-k1-message contains content:
    For Format K1 Error Message:
    When k1 error message is being formatted, then if hold-k1-message is not spaces, then the message content is moved to gcx105-message for logging.
  • Context - audit log information has been formatted in gcx105-input:
    For Send Log Message to GCT1051E:
    When log message is being sent to transaction logger, then gct1051e transaction logging service is invoked with the formatted message.
  • Context - multiple k1 error messages exist in hold-k1-message array:
    For Log Multiple K1 Messages:
    When multiple k1 messages are being logged, then system processes each k1-cnt from 1 incrementing by 1 until hold-k1-message is spaces or k1-cnt exceeds 999.
  • Context - a system abend condition has occurred and error message exists in cccom:
    For Format Main Status Message:
    When abend audit log entry is being generated, then the message is set to the error message, train/cargo identifier is set to 'gcx015er-abend', cargo type is set, action code is set to 'zzz', and current date/time information is captured.
👨‍💻 Technical ACs (Gherkin)
Context: An audit trail generation process is initiated
GIVEN
An audit trail generation process is initiated
Applied to: Prepare Log Information
WHEN
The system prepares log information
THEN
The message field is cleared, action code is cleared, and security byte is set to high value
Context: Audit log information is being prepared
GIVEN
Audit log information is being prepared
Applied to: Set Transaction Details
WHEN
Transaction details are being set
THEN
The sending transaction is set to the current transaction code from CCCOM
Applied to: Set User ID Information
WHEN
User ID information is being set
THEN
The ACF2 user ID from CCCOM is recorded in the audit log
Context: Audit log information is being prepared and K3 segment data is available
GIVEN
Audit log information is being prepared and K3 segment data is available
Applied to: Set Date and Time Stamps
WHEN
Date and time stamps are being set
THEN
The date is set by concatenating machine century with K3-01-DATE and time is set to K3-01-TIME
Context: Audit log information is being prepared and processing type has been determined
GIVEN
Audit log information is being prepared and processing type has been determined
Applied to: Determine Message Type
WHEN
Message type is being determined for logging
THEN
If WS-TRAIN flag is set, then GCX105-US-TRAIN is set to true, otherwise GCX105-US-CARGO is set to true
Context: Audit log information is being prepared and WORK-M10-12-DATA contains the identifier
GIVEN
Audit log information is being prepared and WORK-M10-12-DATA contains the identifier
Applied to: Set Transaction Details
WHEN
Transaction details are being set
THEN
The train or US CCN identifier is set to WORK-M10-12-DATA value
Context: A main status message is being formatted for audit logging
GIVEN
A main status message is being formatted for audit logging
Applied to: Format Main Status Message
WHEN
Action code is being set
THEN
The action code is set to 'ZZZ'
Context: A main status message is being formatted and processing type is determined
GIVEN
A main status message is being formatted and processing type is determined
Applied to: Format Main Status Message
WHEN
Status message is being formatted
THEN
If processing cargo, then USCS-LOG-MESSAGE1 is used; if processing train, then USCS-LOG-MESSAGE2 is used; if should not update status, then USCS-LOG-MESSAGE3 is used
Context: K1 error messages are being processed and HOLD-K1-MESSAGE contains content
GIVEN
K1 error messages are being processed and HOLD-K1-MESSAGE contains content
Applied to: Format K1 Error Message
WHEN
K1 error message is being formatted
THEN
If HOLD-K1-MESSAGE is not spaces, then the message content is moved to GCX105-MESSAGE for logging
Context: Audit log information has been formatted in GCX105-INPUT
GIVEN
Audit log information has been formatted in GCX105-INPUT
Applied to: Send Log Message to GCT1051E
WHEN
Log message is being sent to transaction logger
THEN
GCT1051E transaction logging service is invoked with the formatted message
Context: Multiple K1 error messages exist in HOLD-K1-MESSAGE array
GIVEN
Multiple K1 error messages exist in HOLD-K1-MESSAGE array
Applied to: Log Multiple K1 Messages
WHEN
Multiple K1 messages are being logged
THEN
System processes each K1-CNT from 1 incrementing by 1 until HOLD-K1-MESSAGE is spaces or K1-CNT exceeds 999
Context: A system abend condition has occurred and error message exists in CCCOM
GIVEN
A system abend condition has occurred and error message exists in CCCOM
Applied to: Format Main Status Message
WHEN
Abend audit log entry is being generated
THEN
The message is set to the error message, train/cargo identifier is set to 'GCX015ER-ABEND', cargo type is set, action code is set to 'ZZZ', and current date/time information is captured
R-GCX015E-cbl-00279 (+5) File: GCX015E.cbl Process M11 Segment for Unknown Data Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process M11 Segment for Unknown Data':
  • Context - an m11 segment is present in the message and the current data type is marked as unknown:
    For M11 Segment Found:
    When the system processes the m11 segment, then the system should extract the m11 segment data and continue processing.
  • Context - an m11 segment needs to be processed for cargo identification:
    For Initialize Cargo Key Structure:
    When the system begins extracting cargo key information, then the cargo key work area should be initialized to spaces.
  • Context - an m11 segment contains cargo information:
    For Extract SCAC Code from M11-12:
    When the system extracts the scac code, then the m11-12-scac value should be moved to the work-scac field.
    For Extract Bill/Waybill Number from M11-01:
    When the system extracts the bill number, then the m11-01-bol-wb-num value should be moved to the work-bill-number field.
  • Context - scac code and bill number have been extracted from m11 segment:
    For Build Complete Cargo Key:
    When the system builds the complete cargo key, then the work-cargo-key should be moved to work-m10-12-data for further processing.
  • Context - m11 segment has been successfully processed and cargo key has been built:
    For Set Processing Type to Cargo:
    When the system determines the processing type, then the processing type should be set to cargo (ws-cargo).
👨‍💻 Technical ACs (Gherkin)
Context: An M11 segment is present in the message and the current data type is marked as unknown
GIVEN
An M11 segment is present in the message and the current data type is marked as unknown
Applied to: M11 Segment Found
WHEN
The system processes the M11 segment
THEN
The system should extract the M11 segment data and continue processing
Context: An M11 segment needs to be processed for cargo identification
GIVEN
An M11 segment needs to be processed for cargo identification
Applied to: Initialize Cargo Key Structure
WHEN
The system begins extracting cargo key information
THEN
The cargo key work area should be initialized to spaces
Context: An M11 segment contains cargo information
GIVEN
An M11 segment contains cargo information
Applied to: Extract SCAC Code from M11-12
WHEN
The system extracts the SCAC code
THEN
The M11-12-SCAC value should be moved to the WORK-SCAC field
Applied to: Extract Bill/Waybill Number from M11-01
WHEN
The system extracts the bill number
THEN
The M11-01-BOL-WB-NUM value should be moved to the WORK-BILL-NUMBER field
Context: SCAC code and bill number have been extracted from M11 segment
GIVEN
SCAC code and bill number have been extracted from M11 segment
Applied to: Build Complete Cargo Key
WHEN
The system builds the complete cargo key
THEN
The WORK-CARGO-KEY should be moved to WORK-M10-12-DATA for further processing
Context: M11 segment has been successfully processed and cargo key has been built
GIVEN
M11 segment has been successfully processed and cargo key has been built
Applied to: Set Processing Type to Cargo
WHEN
The system determines the processing type
THEN
The processing type should be set to cargo (WS-CARGO)
R-GCX015E-cbl-00285 (+6) File: GCX015E.cbl Update Manifest Acknowledgment Timestamps Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Manifest Acknowledgment Timestamps':
  • Context - a manifest processing request is initiated:
    For Get T1 Table Entry:
    When the system needs to update acknowledgment timestamps, then the t1 table entry must be retrieved from the configuration database.
  • Context - a request to retrieve t1 table entry has been made:
    For T1 Table Entry Found?:
    When the t1 table entry retrieval operation completes, then if the t1 table entry is not found, the system must terminate processing with an error message 't1 check table entry not found'.
  • Context - a valid t1 table entry exists and a manifest message is being processed:
    For Check Manifest Type Code:
    When the system needs to update acknowledgment timestamps, then the manifest type code from the message queue entry must be evaluated to determine the appropriate timestamp field.
  • Context - a t1 table entry exists and a manifest message is being processed:
    For Update 309 Acknowledgment Timestamp:
    When the manifest type code equals 'p', then the system must update the t1-309-ack field with current machine date (ccyymmdd format) and current machine time (hhmm format).
    For Update 353 Acknowledgment Timestamp:
    When the manifest type code equals 'h', then the system must update the t1-353-ack field with current machine date (ccyymmdd format) and current machine time (hhmm format).
    For Update 358 Acknowledgment Timestamp:
    When the manifest type code equals 's', then the system must update the t1-358-ack field with current machine date (ccyymmdd format) and current machine time (hhmm format).
  • Context - a t1 table entry has been updated with acknowledgment timestamp:
    For Save Updated T1 Table Entry:
    When the timestamp update is complete, then the updated t1 table entry must be saved back to the configuration database using replace function.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest processing request is initiated
GIVEN
A manifest processing request is initiated
Applied to: Get T1 Table Entry
WHEN
The system needs to update acknowledgment timestamps
THEN
The T1 table entry must be retrieved from the configuration database
Context: A request to retrieve T1 table entry has been made
GIVEN
A request to retrieve T1 table entry has been made
Applied to: T1 Table Entry Found?
WHEN
The T1 table entry retrieval operation completes
THEN
If the T1 table entry is not found, the system must terminate processing with an error message 'T1 CHECK TABLE ENTRY NOT FOUND'
Context: A valid T1 table entry exists and a manifest message is being processed
GIVEN
A valid T1 table entry exists and a manifest message is being processed
Applied to: Check Manifest Type Code
WHEN
The system needs to update acknowledgment timestamps
THEN
The manifest type code from the message queue entry must be evaluated to determine the appropriate timestamp field
Context: A T1 table entry exists and a manifest message is being processed
GIVEN
A T1 table entry exists and a manifest message is being processed
Applied to: Update 309 Acknowledgment Timestamp
WHEN
The manifest type code equals 'P'
THEN
The system must update the T1-309-ACK field with current machine date (CCYYMMDD format) and current machine time (HHMM format)
Applied to: Update 353 Acknowledgment Timestamp
WHEN
The manifest type code equals 'H'
THEN
The system must update the T1-353-ACK field with current machine date (CCYYMMDD format) and current machine time (HHMM format)
Applied to: Update 358 Acknowledgment Timestamp
WHEN
The manifest type code equals 'S'
THEN
The system must update the T1-358-ACK field with current machine date (CCYYMMDD format) and current machine time (HHMM format)
Context: A T1 table entry has been updated with acknowledgment timestamp
GIVEN
A T1 table entry has been updated with acknowledgment timestamp
Applied to: Save Updated T1 Table Entry
WHEN
The timestamp update is complete
THEN
The updated T1 table entry must be saved back to the configuration database using replace function
R-GCX015E-cbl-00292 (+5) File: GCX015E.cbl Handle Special Test Messages Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Special Test Messages':
  • Context - a message with m10 segment is being processed:
    For Check M10 Reference Number:
    When the m10 table reference number equals 'traincprstesttrain0000000000' or 'cargocprs940000000000', then the message is identified as a special test message.
  • Context - a special test message has been identified:
    For Clear Message Array:
    When the system processes the test message, then the message array is cleared to spaces and the end processing flag is set to true and processing returns immediately.
  • Context - a special test message is being processed and t1 table segment is retrieved:
    For Update 309 Acknowledgment Timestamp:
    When the manifest type code is 'p', then the t1-309-ack field is updated with current machine date (century + date) and time.
    For Update 353 Acknowledgment Timestamp:
    When the manifest type code is 'h', then the t1-353-ack field is updated with current machine date (century + date) and time.
    For Update 358 Acknowledgment Timestamp:
    When the manifest type code is 's', then the t1-358-ack field is updated with current machine date (century + date) and time.
  • Context - a special test message requires t1 table updates:
    For Update T1 Table Timestamps:
    When the system needs to access t1 table data, then t1 table segment is retrieved using table id 't1' with empty sequence id and if retrieval fails then system abends with error message 't1 check table entry not found'.
👨‍💻 Technical ACs (Gherkin)
Context: A message with M10 segment is being processed
GIVEN
A message with M10 segment is being processed
Applied to: Check M10 Reference Number
WHEN
The M10 table reference number equals 'TRAINCPRSTESTTRAIN0000000000' OR 'CARGOCPRS940000000000'
THEN
The message is identified as a special test message
Context: A special test message has been identified
GIVEN
A special test message has been identified
Applied to: Clear Message Array
WHEN
The system processes the test message
THEN
The message array is cleared to spaces AND the end processing flag is set to true AND processing returns immediately
Context: A special test message is being processed AND T1 table segment is retrieved
GIVEN
A special test message is being processed AND T1 table segment is retrieved
Applied to: Update 309 Acknowledgment Timestamp
WHEN
The manifest type code is 'P'
THEN
The T1-309-ACK field is updated with current machine date (century + date) and time
Applied to: Update 353 Acknowledgment Timestamp
WHEN
The manifest type code is 'H'
THEN
The T1-353-ACK field is updated with current machine date (century + date) and time
Applied to: Update 358 Acknowledgment Timestamp
WHEN
The manifest type code is 'S'
THEN
The T1-358-ACK field is updated with current machine date (century + date) and time
Context: A special test message requires T1 table updates
GIVEN
A special test message requires T1 table updates
Applied to: Update T1 Table Timestamps
WHEN
The system needs to access T1 table data
THEN
T1 table segment is retrieved using table ID 'T1' with empty sequence ID AND if retrieval fails then system abends with error message 'T1 CHECK TABLE ENTRY NOT FOUND'
R-GCX015E-cbl-00298 File: GCX015E.cbl Process Line Release Numbers
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Line Release Numbers':
  • Context - a message segment is being processed during customs transaction handling:
    For Extract Line Release Number from Position 09:
    When the segment identifier equals 'n10', then the system extracts the line release number from position 09 of the n10 segment and stores it in the hold area for subsequent customs processing.
👨‍💻 Technical ACs (Gherkin)
Context: A message segment is being processed during customs transaction handling
GIVEN
A message segment is being processed during customs transaction handling
Applied to: Extract Line Release Number from Position 09
WHEN
The segment identifier equals 'N10'
THEN
The system extracts the line release number from position 09 of the N10 segment and stores it in the hold area for subsequent customs processing
R-GCX015E-cbl-00299 (+4) File: GCX015E.cbl Set Train Status Based on Customs Response Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Train Status Based on Customs Response':
  • Context - a train record exists with current status of deleted and the processing type is train and the customs response indicates ack status:
    For Set Status to 'DELETED':
    When the train status update process is executed, then the train status should be set to 'deleted' and the train record should be updated with root-only replacement.
  • Context - a train record exists with current status of delete-pending and the processing type is train and the customs response indicates ack status:
    For Set Status to 'DELETED':
    When the train status update process is executed, then the train status should be changed from delete-pending to 'deleted' and the train record should be updated with root-only replacement.
  • Context - a train record exists with current status that is not deleted and not delete-pending and the processing type is train:
    For Set Status to Current Customs Status:
    When the train status update process is executed, then the train status should be updated to the current customs status value and the train record should be updated with root-only replacement.
  • Context - a train record has been updated with status that is not deleted and not delete-pending:
    For Update Train Record:
    When the train record update is completed, then the system should perform aei train send check processing.
  • Context - a train record has been updated and the train has ack status and the train is in arrived-pending state:
    For Update Train Record:
    When the train record update is completed, then the system should trigger the train arrival process.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists with current status of DELETED and the processing type is TRAIN and the customs response indicates ACK status
GIVEN
A train record exists with current status of DELETED and the processing type is TRAIN and the customs response indicates ACK status
Applied to: Set Status to 'DELETED'
WHEN
The train status update process is executed
THEN
The train status should be set to 'DELETED' and the train record should be updated with root-only replacement
Context: A train record exists with current status of DELETE-PENDING and the processing type is TRAIN and the customs response indicates ACK status
GIVEN
A train record exists with current status of DELETE-PENDING and the processing type is TRAIN and the customs response indicates ACK status
Applied to: Set Status to 'DELETED'
WHEN
The train status update process is executed
THEN
The train status should be changed from DELETE-PENDING to 'DELETED' and the train record should be updated with root-only replacement
Context: A train record exists with current status that is not DELETED and not DELETE-PENDING and the processing type is TRAIN
GIVEN
A train record exists with current status that is not DELETED and not DELETE-PENDING and the processing type is TRAIN
Applied to: Set Status to Current Customs Status
WHEN
The train status update process is executed
THEN
The train status should be updated to the current customs status value and the train record should be updated with root-only replacement
Context: A train record has been updated with status that is not DELETED and not DELETE-PENDING
GIVEN
A train record has been updated with status that is not DELETED and not DELETE-PENDING
Applied to: Update Train Record
WHEN
The train record update is completed
THEN
The system should perform AEI train send check processing
Context: A train record has been updated and the train has ACK status and the train is in ARRIVED-PENDING state
GIVEN
A train record has been updated and the train has ACK status and the train is in ARRIVED-PENDING state
Applied to: Update Train Record
WHEN
The train record update is completed
THEN
The system should trigger the train arrival process
R-GCX015E-cbl-00304 (+2) File: GCX015E.cbl Restore Previous Cargo Status Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Restore Previous Cargo Status':
  • Context - a cargo record is being processed with acknowledgment status:
    For Restore Previous Status from Save Fields:
    When the system checks for previously saved status information, then if saved status description exists, restore the saved status and description to current fields, otherwise set cargo status to acknowledgment.
  • Context - a cargo record is being processed with acknowledgment status and saved status description is empty:
    For Set Cargo Status to ACK:
    When the system processes the status update, then set both uscargo status fields to acknowledgment status.
  • Context - a cargo record has saved status and description information available:
    For Move Saved Status to Current Status:
    When the system processes status restoration, then move saved status to current uscargo status field and move saved description to current uscargo description field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed with acknowledgment status
GIVEN
A cargo record is being processed with acknowledgment status
Applied to: Restore Previous Status from Save Fields
WHEN
The system checks for previously saved status information
THEN
If saved status description exists, restore the saved status and description to current fields, otherwise set cargo status to acknowledgment
Context: A cargo record is being processed with acknowledgment status and saved status description is empty
GIVEN
A cargo record is being processed with acknowledgment status and saved status description is empty
Applied to: Set Cargo Status to ACK
WHEN
The system processes the status update
THEN
Set both USCARGO status fields to acknowledgment status
Context: A cargo record has saved status and description information available
GIVEN
A cargo record has saved status and description information available
Applied to: Move Saved Status to Current Status
WHEN
The system processes status restoration
THEN
Move saved status to current USCARGO status field and move saved description to current USCARGO description field
R-GCX015E-cbl-00307 (+2) File: GCX015E.cbl Save Current Cargo Status Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Save Current Cargo Status':
  • Context - a cargo record exists with current status and description:
    For Save Current Status to RT44-US-SAVE-STATUS:
    When an error status is being set and the current status is not already error, ack, or ack-r, then save the current status to rt44-us-save-status field.
  • Context - a cargo record exists with current status description:
    For Save Current Description to RT45-US-SAVE-STAT-DESC:
    When an error status is being set and the current status is not already error, ack, or ack-r, then save the current status description to rt45-us-save-stat-desc field.
  • Context - a cargo record has current status of error, ack, or ack-r:
    For Skip Save - Status Already Error/ACK:
    When an error status update is being processed, then skip saving the current status and description to preserve previously saved values.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with current status and description
GIVEN
A cargo record exists with current status and description
Applied to: Save Current Status to RT44-US-SAVE-STATUS
WHEN
An error status is being set AND the current status is not already ERROR, ACK, or ACK-R
THEN
Save the current status to RT44-US-SAVE-STATUS field
Context: A cargo record exists with current status description
GIVEN
A cargo record exists with current status description
Applied to: Save Current Description to RT45-US-SAVE-STAT-DESC
WHEN
An error status is being set AND the current status is not already ERROR, ACK, or ACK-R
THEN
Save the current status description to RT45-US-SAVE-STAT-DESC field
Context: A cargo record has current status of ERROR, ACK, or ACK-R
GIVEN
A cargo record has current status of ERROR, ACK, or ACK-R
Applied to: Skip Save - Status Already Error/ACK
WHEN
An error status update is being processed
THEN
Skip saving the current status and description to preserve previously saved values
R-GCX015E-cbl-00310 (+11) File: GCX015E.cbl Send Merlin Email Messages Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Merlin Email Messages':
  • Context - an email needs to be sent through the merlin system:
    For Set Default Merlin ID as From User:
    When the email sender is being configured, then the system sets the default merlin id as the from user code.
  • Context - an aei email needs to be sent and train security information is available:
    For Set Email Recipients:
    When the system looks up email recipients in the aei database using the train port information, then if the database lookup is successful, the system uses the retrieved user ids as recipients, otherwise it uses the default merlin id as the recipient.
  • Context - the system attempts to retrieve email recipients from the aei database:
    For Set Email Recipients:
    When the database lookup fails with an error other than 'no entry found', then the system triggers a database error notification process.
  • Context - a train status email needs to be sent:
    For Format Email Subject:
    When the email subject is being formatted, then the system creates a subject line containing 'train: [train_id] status: [current_status]'.
  • Context - an email is being prepared for sending:
    For Format Email Content:
    When the system determines that warning emails should not be sent, then the system clears the email text content to spaces.
  • Context - an email is being prepared for sending through merlin:
    For Set Email Parameters:
    When email parameters are being configured, then the system sets the destination filename to inbox, item width to 080, and clears copy usercode, keywords, and sequence numbers.
  • Context - email parameters and content have been configured:
    For Call EMCSEND3 to Send Email:
    When the system needs to send the email, then the system calls the emcsend3 service with all configured email parameters.
  • Context - an email send operation has been attempted through merlin:
    For Email Send Successful?:
    When the system checks the email send result, then if no errors are returned, the email is considered successfully sent, otherwise it requires retry processing.
  • Context - the primary email send operation has failed:
    For Set Backup Recipients - AEI9999, OM01247:
    When the system prepares to resend the email, then the system sets aei9999 as the first backup recipient and om01247 as the second backup recipient.
  • Context - the primary email send has failed and backup recipients have been configured:
    For Call EMCSEND3 for Backup Send:
    When the system attempts backup email delivery, then the system calls emcsend3 again with the backup recipient configuration.
  • Context - both primary and backup email send attempts have failed:
    For Log Email Send Failure:
    When the system processes the complete delivery failure, then the system logs the error message 'send to file of om01247 failed' and triggers error handling.
  • Context - email processing has completed either successfully or with failure:
    For Purge Message Queue:
    When the system performs cleanup operations, then the system purges the message queue and resets the accept status.
👨‍💻 Technical ACs (Gherkin)
Context: An email needs to be sent through the Merlin system
GIVEN
An email needs to be sent through the Merlin system
Applied to: Set Default Merlin ID as From User
WHEN
The email sender is being configured
THEN
The system sets the default Merlin ID as the from user code
Context: An AEI email needs to be sent and train security information is available
GIVEN
An AEI email needs to be sent and train security information is available
Applied to: Set Email Recipients
WHEN
The system looks up email recipients in the AEI database using the train port information
THEN
If the database lookup is successful, the system uses the retrieved user IDs as recipients, otherwise it uses the default Merlin ID as the recipient
Context: The system attempts to retrieve email recipients from the AEI database
GIVEN
The system attempts to retrieve email recipients from the AEI database
Applied to: Set Email Recipients
WHEN
The database lookup fails with an error other than 'no entry found'
THEN
The system triggers a database error notification process
Context: A train status email needs to be sent
GIVEN
A train status email needs to be sent
Applied to: Format Email Subject
WHEN
The email subject is being formatted
THEN
The system creates a subject line containing 'TRAIN: [train_id] STATUS: [current_status]'
Context: An email is being prepared for sending
GIVEN
An email is being prepared for sending
Applied to: Format Email Content
WHEN
The system determines that warning emails should not be sent
THEN
The system clears the email text content to spaces
Context: An email is being prepared for sending through Merlin
GIVEN
An email is being prepared for sending through Merlin
Applied to: Set Email Parameters
WHEN
Email parameters are being configured
THEN
The system sets the destination filename to inbox, item width to 080, and clears copy usercode, keywords, and sequence numbers
Context: Email parameters and content have been configured
GIVEN
Email parameters and content have been configured
Applied to: Call EMCSEND3 to Send Email
WHEN
The system needs to send the email
THEN
The system calls the EMCSEND3 service with all configured email parameters
Context: An email send operation has been attempted through Merlin
GIVEN
An email send operation has been attempted through Merlin
Applied to: Email Send Successful?
WHEN
The system checks the email send result
THEN
If no errors are returned, the email is considered successfully sent, otherwise it requires retry processing
Context: The primary email send operation has failed
GIVEN
The primary email send operation has failed
Applied to: Set Backup Recipients - AEI9999, OM01247
WHEN
The system prepares to resend the email
THEN
The system sets AEI9999 as the first backup recipient and OM01247 as the second backup recipient
Context: The primary email send has failed and backup recipients have been configured
GIVEN
The primary email send has failed and backup recipients have been configured
Applied to: Call EMCSEND3 for Backup Send
WHEN
The system attempts backup email delivery
THEN
The system calls EMCSEND3 again with the backup recipient configuration
Context: Both primary and backup email send attempts have failed
GIVEN
Both primary and backup email send attempts have failed
Applied to: Log Email Send Failure
WHEN
The system processes the complete delivery failure
THEN
The system logs the error message 'SEND TO FILE OF OM01247 FAILED' and triggers error handling
Context: Email processing has completed either successfully or with failure
GIVEN
Email processing has completed either successfully or with failure
Applied to: Purge Message Queue
WHEN
The system performs cleanup operations
THEN
The system purges the message queue and resets the accept status
R-GCX015E-cbl-00322 (+7) File: GCX015E.cbl Process Train Arrival Events Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Train Arrival Events':
  • Context - a train record exists with status indicators for acknowledgment and arrival pending:
    For Check Train Status Conditions:
    When the system checks if the train is both acknowledged and has arrived-pending status, then the system should proceed with arrival processing only if both conditions are met, otherwise skip arrival processing.
  • Context - a train arrival event is being processed:
    For Set Action Code to 'TAR':
    When the system prepares the arrival transaction message, then the action code should be set to 'tar' to indicate train arrival.
    For Mark as US Train Type:
    When the system sets the train type indicator, then the train should be marked as us train type.
  • Context - a train arrival event is being recorded:
    For Set Event Date from Machine Date:
    When the system sets the event date, then the event date should be populated with the current machine date including century.
    For Set Event Time from Machine Time:
    When the system sets the event time, then the event time should be populated with the first 4 digits of the current machine time.
  • Context - a train arrival event is being processed for a specific train:
    For Set Train ID from US Customer Train ID:
    When the system populates the train identifier in the arrival message, then the train id should be set to the us customer train id from the train record.
  • Context - a train arrival event message is being prepared:
    For Set Security Byte to High Value:
    When the system sets the security classification, then the security byte should be set to high value to ensure proper security handling.
  • Context - a complete train arrival message has been prepared with all required fields:
    For Write Train Arrival Message to Queue:
    When the system submits the message for processing, then the message should be written to the message queue using the gct1121e message format.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists with status indicators for acknowledgment and arrival pending
GIVEN
A train record exists with status indicators for acknowledgment and arrival pending
Applied to: Check Train Status Conditions
WHEN
The system checks if the train is both acknowledged AND has arrived-pending status
THEN
The system should proceed with arrival processing only if both conditions are met, otherwise skip arrival processing
Context: A train arrival event is being processed
GIVEN
A train arrival event is being processed
Applied to: Set Action Code to 'TAR'
WHEN
The system prepares the arrival transaction message
THEN
The action code should be set to 'TAR' to indicate train arrival
Applied to: Mark as US Train Type
WHEN
The system sets the train type indicator
THEN
The train should be marked as US train type
Context: A train arrival event is being recorded
GIVEN
A train arrival event is being recorded
Applied to: Set Event Date from Machine Date
WHEN
The system sets the event date
THEN
The event date should be populated with the current machine date including century
Applied to: Set Event Time from Machine Time
WHEN
The system sets the event time
THEN
The event time should be populated with the first 4 digits of the current machine time
Context: A train arrival event is being processed for a specific train
GIVEN
A train arrival event is being processed for a specific train
Applied to: Set Train ID from US Customer Train ID
WHEN
The system populates the train identifier in the arrival message
THEN
The train ID should be set to the US customer train ID from the train record
Context: A train arrival event message is being prepared
GIVEN
A train arrival event message is being prepared
Applied to: Set Security Byte to High Value
WHEN
The system sets the security classification
THEN
The security byte should be set to high value to ensure proper security handling
Context: A complete train arrival message has been prepared with all required fields
GIVEN
A complete train arrival message has been prepared with all required fields
Applied to: Write Train Arrival Message to Queue
WHEN
The system submits the message for processing
THEN
The message should be written to the message queue using the GCT1121E message format
R-GCX015E-cbl-00330 (+11) File: GCX015E.cbl Retrieve Broker Contact Information Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Broker Contact Information':
  • Context - a cargo shipment record exists with freight forwarder information in gcus-n102-name field:
    For Get Freight Forwarder Name from Cargo Data:
    When the system needs to retrieve broker contact information for the freight forwarder, then the freight forwarder name is extracted from gcus-n102-name and used to build the broker lookup key.
  • Context - a freight forwarder name is available from the cargo data:
    For Build Broker Key with FW= Prefix:
    When the system builds a broker lookup key for database retrieval, then the key is constructed by concatenating 'fw=' prefix with the freight forwarder name and stored in gcwusio-gcst2rt-key.
  • Context - a broker lookup key has been constructed with fw= prefix and freight forwarder name:
    For Retrieve Broker Short Name from GCST2RT:
    When the system queries the gcst2rt broker master table, then the broker short name is retrieved and stored in gct2-broker-name-short field.
  • Context - a broker lookup has been performed on the gcst2rt table:
    For Broker Short Name Found?:
    When the database query returns a status code indicating the broker was not found, then the broker name segment is initialized to empty values and processing continues.
  • Context - a valid broker short name exists and location information is available from cargo data:
    For Build Broker Info Key with Short Name and Location:
    When the system needs to retrieve detailed broker contact information, then a lookup key is built by concatenating broker short name with either m1203-location-id1 or p401-location-id and stored in gcstbrt-key-seqid.
  • Context - a broker detail lookup key has been constructed with short name and location:
    For Retrieve Broker Details from BK Table:
    When the system queries the bk table with table id 'bk', then the broker contact details are retrieved and stored in gcstbrt-bk-segment.
  • Context - a broker details lookup has been performed on the bk table:
    For Broker Details Found?:
    When the database query returns a non-zero status code indicating broker details were not found, then the broker details segment is initialized to empty values and processing terminates.
  • Context - valid broker contact details exist in gcstbrt-bk-segment:
    For Retrieve Internet Address from B1 Table:
    When the system queries the b1 table with table id 'b1' using the same lookup key, then the internet address information is retrieved and stored in gcstbrt-b1-segment.
  • Context - an internet address lookup has been performed on the b1 table:
    For Internet Address Found?:
    When the database query returns a non-zero status code indicating internet address was not found, then the internet address segment is initialized to empty values and processing terminates.
  • Context - valid broker details exist with internet communication preference setting:
    For Use Internet Communication?:
    When the system checks the gcstbrt-bk-use-internet field, then if the value equals 'y', internet communication is enabled; otherwise, standard communication methods are used.
  • Context - broker has internet communication enabled (gcstbrt-bk-use-internet = 'y') and valid internet address exists:
    For Set Email Address for External Mail:
    When the system configures email notification settings, then the email text line is populated with 'internet: ' prefix followed by the broker's internet address from gcstbrt-b1-internet-address, and email destination is set to 'extmail'.
  • Context - internet communication has been successfully configured for the broker:
    For Set Freight Forwarder Email Flag:
    When the system finalizes email notification setup, then the ws-email-to-freight-frwdr flag is set to true to indicate freight forwarder email notifications are enabled.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment record exists with freight forwarder information in GCUS-N102-NAME field
GIVEN
A cargo shipment record exists with freight forwarder information in GCUS-N102-NAME field
Applied to: Get Freight Forwarder Name from Cargo Data
WHEN
The system needs to retrieve broker contact information for the freight forwarder
THEN
The freight forwarder name is extracted from GCUS-N102-NAME and used to build the broker lookup key
Context: A freight forwarder name is available from the cargo data
GIVEN
A freight forwarder name is available from the cargo data
Applied to: Build Broker Key with FW= Prefix
WHEN
The system builds a broker lookup key for database retrieval
THEN
The key is constructed by concatenating 'FW=' prefix with the freight forwarder name and stored in GCWUSIO-GCST2RT-KEY
Context: A broker lookup key has been constructed with FW= prefix and freight forwarder name
GIVEN
A broker lookup key has been constructed with FW= prefix and freight forwarder name
Applied to: Retrieve Broker Short Name from GCST2RT
WHEN
The system queries the GCST2RT broker master table
THEN
The broker short name is retrieved and stored in GCT2-BROKER-NAME-SHORT field
Context: A broker lookup has been performed on the GCST2RT table
GIVEN
A broker lookup has been performed on the GCST2RT table
Applied to: Broker Short Name Found?
WHEN
The database query returns a status code indicating the broker was not found
THEN
The broker name segment is initialized to empty values and processing continues
Context: A valid broker short name exists and location information is available from cargo data
GIVEN
A valid broker short name exists and location information is available from cargo data
Applied to: Build Broker Info Key with Short Name and Location
WHEN
The system needs to retrieve detailed broker contact information
THEN
A lookup key is built by concatenating broker short name with either M1203-LOCATION-ID1 or P401-LOCATION-ID and stored in GCSTBRT-KEY-SEQID
Context: A broker detail lookup key has been constructed with short name and location
GIVEN
A broker detail lookup key has been constructed with short name and location
Applied to: Retrieve Broker Details from BK Table
WHEN
The system queries the BK table with table ID 'BK'
THEN
The broker contact details are retrieved and stored in GCSTBRT-BK-SEGMENT
Context: A broker details lookup has been performed on the BK table
GIVEN
A broker details lookup has been performed on the BK table
Applied to: Broker Details Found?
WHEN
The database query returns a non-zero status code indicating broker details were not found
THEN
The broker details segment is initialized to empty values and processing terminates
Context: Valid broker contact details exist in GCSTBRT-BK-SEGMENT
GIVEN
Valid broker contact details exist in GCSTBRT-BK-SEGMENT
Applied to: Retrieve Internet Address from B1 Table
WHEN
The system queries the B1 table with table ID 'B1' using the same lookup key
THEN
The internet address information is retrieved and stored in GCSTBRT-B1-SEGMENT
Context: An internet address lookup has been performed on the B1 table
GIVEN
An internet address lookup has been performed on the B1 table
Applied to: Internet Address Found?
WHEN
The database query returns a non-zero status code indicating internet address was not found
THEN
The internet address segment is initialized to empty values and processing terminates
Context: Valid broker details exist with internet communication preference setting
GIVEN
Valid broker details exist with internet communication preference setting
Applied to: Use Internet Communication?
WHEN
The system checks the GCSTBRT-BK-USE-INTERNET field
THEN
If the value equals 'Y', internet communication is enabled; otherwise, standard communication methods are used
Context: Broker has internet communication enabled (GCSTBRT-BK-USE-INTERNET = 'Y') and valid internet address exists
GIVEN
Broker has internet communication enabled (GCSTBRT-BK-USE-INTERNET = 'Y') and valid internet address exists
Applied to: Set Email Address for External Mail
WHEN
The system configures email notification settings
THEN
The email text line is populated with 'INTERNET: ' prefix followed by the broker's internet address from GCSTBRT-B1-INTERNET-ADDRESS, and email destination is set to 'EXTMAIL'
Context: Internet communication has been successfully configured for the broker
GIVEN
Internet communication has been successfully configured for the broker
Applied to: Set Freight Forwarder Email Flag
WHEN
The system finalizes email notification setup
THEN
The WS-EMAIL-TO-FREIGHT-FRWDR flag is set to TRUE to indicate freight forwarder email notifications are enabled
R-GCX015E-cbl-00342 (+12) File: GCX015E.cbl Format Email Content for Warnings Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Format Email Content for Warnings':
  • Context - a cargo record exists with secondary segments containing party information:
    For Get Freight Forwarder Data:
    When the system processes secondary segments with record type '03' for freight forwarder (n101 code) and consignee information, then the system identifies freight forwarder when n101 code indicates forwarder role and captures consignee name when n101 code indicates consignee role.
  • Context - a freight forwarder name has been identified from cargo segments:
    For Get Broker Short Name:
    When the system searches the broker name table using 'fw=' prefix concatenated with the freight forwarder name, then the system retrieves the corresponding broker short name if found, otherwise initializes empty broker name segment.
  • Context - a broker short name exists and broker contact information is available:
    For Get Broker Contact Information:
    When the system checks the broker's internet usage preference flag, then if broker uses internet (flag = 'y'), system sets email destination to 'extmail', formats internet address in email text, and marks for freight forwarder email delivery, otherwise uses default contact method.
  • Context - a cbp warning message needs to be sent via email:
    For Format Email Subject Line:
    When the system formats the email subject line, then the system uses the predefined email subject format for cbp warnings.
  • Context - cargo equipment information is available from the cargo record:
    For Format Equipment Information Line:
    When the system formats equipment information for email content, then the system includes the car identification number in the formatted equipment line.
  • Context - waybill information exists in the cargo record:
    For Format Waybill Information Line:
    When the system formats waybill information for email content, then the system concatenates road index, station index, and waybill index into a formatted waybill line.
  • Context - equipment load/empty status is available in the cargo record:
    For Format Load/Empty Indicator Line:
    When the system formats load/empty indicator for email content, then the system includes the load/empty code in the formatted indicator line.
  • Context - cargo content description is available in the system:
    For Format Content Description Line:
    When the system formats content description for email content, then the system includes the long description of the cargo content in the formatted content line.
  • Context - k3 segment contains date and time information:
    For Format Date and Time Information:
    When the system formats date and time for email display, then the system combines machine century with k3 date to create full year, extracts month and day from k3 date, and extracts hour and minute from k3 time.
  • Context - origin station information is available from shipment data:
    For Format Origin Station Information:
    When the system formats origin station information for email content, then the system concatenates origin station name with province/state code separated by comma and space.
  • Context - destination station information is available from shipment data:
    For Format Destination Station Information:
    When the system formats destination station information for email content, then the system concatenates destination station name with province/state code separated by comma and space.
  • Context - a k1 segment contains a cbp warning message:
    For Format CBP Warning Message:
    When the system formats the cbp warning message for email content, then the system includes the free-form message text from the k1 segment in the formatted warning message line.
  • Context - date and time components have been extracted from k3 segment:
    For Format Occurrence Date/Time:
    When the system formats the occurrence date and time for email content, then the system concatenates formatted date with formatted time separated by space to create occurrence timestamp.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with secondary segments containing party information
GIVEN
A cargo record exists with secondary segments containing party information
Applied to: Get Freight Forwarder Data
WHEN
The system processes secondary segments with record type '03' for freight forwarder (N101 code) and consignee information
THEN
The system identifies freight forwarder when N101 code indicates forwarder role and captures consignee name when N101 code indicates consignee role
Context: A freight forwarder name has been identified from cargo segments
GIVEN
A freight forwarder name has been identified from cargo segments
Applied to: Get Broker Short Name
WHEN
The system searches the broker name table using 'FW=' prefix concatenated with the freight forwarder name
THEN
The system retrieves the corresponding broker short name if found, otherwise initializes empty broker name segment
Context: A broker short name exists and broker contact information is available
GIVEN
A broker short name exists and broker contact information is available
Applied to: Get Broker Contact Information
WHEN
The system checks the broker's internet usage preference flag
THEN
If broker uses internet (flag = 'Y'), system sets email destination to 'EXTMAIL', formats internet address in email text, and marks for freight forwarder email delivery, otherwise uses default contact method
Context: A CBP warning message needs to be sent via email
GIVEN
A CBP warning message needs to be sent via email
Applied to: Format Email Subject Line
WHEN
The system formats the email subject line
THEN
The system uses the predefined email subject format for CBP warnings
Context: Cargo equipment information is available from the cargo record
GIVEN
Cargo equipment information is available from the cargo record
Applied to: Format Equipment Information Line
WHEN
The system formats equipment information for email content
THEN
The system includes the car identification number in the formatted equipment line
Context: Waybill information exists in the cargo record
GIVEN
Waybill information exists in the cargo record
Applied to: Format Waybill Information Line
WHEN
The system formats waybill information for email content
THEN
The system concatenates road index, station index, and waybill index into a formatted waybill line
Context: Equipment load/empty status is available in the cargo record
GIVEN
Equipment load/empty status is available in the cargo record
Applied to: Format Load/Empty Indicator Line
WHEN
The system formats load/empty indicator for email content
THEN
The system includes the load/empty code in the formatted indicator line
Context: Cargo content description is available in the system
GIVEN
Cargo content description is available in the system
Applied to: Format Content Description Line
WHEN
The system formats content description for email content
THEN
The system includes the long description of the cargo content in the formatted content line
Context: K3 segment contains date and time information
GIVEN
K3 segment contains date and time information
Applied to: Format Date and Time Information
WHEN
The system formats date and time for email display
THEN
The system combines machine century with K3 date to create full year, extracts month and day from K3 date, and extracts hour and minute from K3 time
Context: Origin station information is available from shipment data
GIVEN
Origin station information is available from shipment data
Applied to: Format Origin Station Information
WHEN
The system formats origin station information for email content
THEN
The system concatenates origin station name with province/state code separated by comma and space
Context: Destination station information is available from shipment data
GIVEN
Destination station information is available from shipment data
Applied to: Format Destination Station Information
WHEN
The system formats destination station information for email content
THEN
The system concatenates destination station name with province/state code separated by comma and space
Context: A K1 segment contains a CBP warning message
GIVEN
A K1 segment contains a CBP warning message
Applied to: Format CBP Warning Message
WHEN
The system formats the CBP warning message for email content
THEN
The system includes the free-form message text from the K1 segment in the formatted warning message line
Context: Date and time components have been extracted from K3 segment
GIVEN
Date and time components have been extracted from K3 segment
Applied to: Format Occurrence Date/Time
WHEN
The system formats the occurrence date and time for email content
THEN
The system concatenates formatted date with formatted time separated by space to create occurrence timestamp
R-GCX015E-cbl-00355 (+6) File: GCX015E.cbl Connect to Message Queue Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Connect to Message Queue':
  • Context - the system needs to process customs messages from the message queue:
    For Call MQCONNC to Connect to Message Queue Manager:
    When a connection request is made to the message queue manager, then the system should establish a successful connection to enable message processing.
  • Context - a connection attempt has been made to the message queue manager:
    For Connection Successful?:
    When the connection completion code is evaluated, then the system should determine if the connection was successful or failed.
  • Context - the message queue connection attempt has failed:
    For Get Error Reason Code:
    When the connection completion code indicates failure, then the system should capture the specific reason code for the connection failure.
  • Context - a message queue connection failure has occurred with a specific reason code:
    For Format Error Message with Reason Code:
    When an error message needs to be formatted, then the system should create a formatted error message that includes the reason code and descriptive text.
  • Context - a message queue connection error has occurred:
    For Set Transaction Set to '355':
    When error information is being prepared for logging, then the system should set the transaction set identifier to '355'.
    For Set Error Text to 'MQCONN FAILED':
    When error description is being set, then the system should set the program error text to 'mqconn failed'.
  • Context - message queue connection has failed and error information has been prepared:
    For Abort Processing with Error Message:
    When the system determines that processing cannot continue, then the system should abort processing and report the connection error.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process customs messages from the message queue
GIVEN
The system needs to process customs messages from the message queue
Applied to: Call MQCONNC to Connect to Message Queue Manager
WHEN
A connection request is made to the message queue manager
THEN
The system should establish a successful connection to enable message processing
Context: A connection attempt has been made to the message queue manager
GIVEN
A connection attempt has been made to the message queue manager
Applied to: Connection Successful?
WHEN
The connection completion code is evaluated
THEN
The system should determine if the connection was successful or failed
Context: The message queue connection attempt has failed
GIVEN
The message queue connection attempt has failed
Applied to: Get Error Reason Code
WHEN
The connection completion code indicates failure
THEN
The system should capture the specific reason code for the connection failure
Context: A message queue connection failure has occurred with a specific reason code
GIVEN
A message queue connection failure has occurred with a specific reason code
Applied to: Format Error Message with Reason Code
WHEN
An error message needs to be formatted
THEN
The system should create a formatted error message that includes the reason code and descriptive text
Context: A message queue connection error has occurred
GIVEN
A message queue connection error has occurred
Applied to: Set Transaction Set to '355'
WHEN
Error information is being prepared for logging
THEN
The system should set the transaction set identifier to '355'
Applied to: Set Error Text to 'MQCONN FAILED'
WHEN
Error description is being set
THEN
The system should set the program error text to 'MQCONN FAILED'
Context: Message queue connection has failed and error information has been prepared
GIVEN
Message queue connection has failed and error information has been prepared
Applied to: Abort Processing with Error Message
WHEN
The system determines that processing cannot continue
THEN
The system should abort processing and report the connection error
R-GCX015E-cbl-00362 (+8) File: GCX015E.cbl Open Message Queue Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Open Message Queue':
  • Context - the system needs to access customs transaction messages from a message queue:
    For Set Queue Object Type:
    When the queue configuration process begins, then the queue object type should be set to standard queue type for message retrieval.
  • Context - the system has a configured queue name for customs messages in mqtmc-qname:
    For Set Queue Name from MQTMC-QNAME:
    When the queue opening process requires queue identification, then the queue name should be set from the mqtmc-qname configuration value.
  • Context - the system needs to read customs transaction messages from the queue:
    For Set Input Options for Queue:
    When queue access options are being configured, then the queue options should be set to input-as-queue-defined to enable message reading.
  • Context - the queue type, name, and access options are configured:
    For Call MQOPEN to Open Queue:
    When the system attempts to open the message queue connection, then the mqopen service should be invoked with the connection handle, queue descriptor, options, and response parameters.
  • Context - the system attempts to open a customs message queue:
    For Queue Not Found Error?:
    When the queue open operation fails with reason code 2085 indicating queue not found, then the system should return to main processing without generating an error.
  • Context - the system has attempted to open the customs message queue:
    For Queue Open Successful?:
    When the queue open operation completes, then if the completion code equals mqcc-ok, the queue is successfully opened, otherwise it has failed.
  • Context - the customs message queue open operation has failed with an error other than queue not found:
    For Generate MQ Error Message:
    When error information needs to be generated, then the system should call gccmqerr service to convert the reason code to descriptive error text and format it with the reason code.
  • Context - a customs message queue error has occurred and error message has been generated:
    For Set Error Details:
    When error context needs to be established, then the transaction set should be set to '355', program error text should be set to 'mqopen failed', and the complete error message should be prepared.
  • Context - a critical customs message queue error has occurred and error details have been set:
    For Abort Processing:
    When the system cannot continue normal processing, then the system should invoke the z900-abend procedure to terminate processing.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to access customs transaction messages from a message queue
GIVEN
The system needs to access customs transaction messages from a message queue
Applied to: Set Queue Object Type
WHEN
The queue configuration process begins
THEN
The queue object type should be set to standard queue type for message retrieval
Context: The system has a configured queue name for customs messages in MQTMC-QNAME
GIVEN
The system has a configured queue name for customs messages in MQTMC-QNAME
Applied to: Set Queue Name from MQTMC-QNAME
WHEN
The queue opening process requires queue identification
THEN
The queue name should be set from the MQTMC-QNAME configuration value
Context: The system needs to read customs transaction messages from the queue
GIVEN
The system needs to read customs transaction messages from the queue
Applied to: Set Input Options for Queue
WHEN
Queue access options are being configured
THEN
The queue options should be set to input-as-queue-defined to enable message reading
Context: The queue type, name, and access options are configured
GIVEN
The queue type, name, and access options are configured
Applied to: Call MQOPEN to Open Queue
WHEN
The system attempts to open the message queue connection
THEN
The MQOPEN service should be invoked with the connection handle, queue descriptor, options, and response parameters
Context: The system attempts to open a customs message queue
GIVEN
The system attempts to open a customs message queue
Applied to: Queue Not Found Error?
WHEN
The queue open operation fails with reason code 2085 indicating queue not found
THEN
The system should return to main processing without generating an error
Context: The system has attempted to open the customs message queue
GIVEN
The system has attempted to open the customs message queue
Applied to: Queue Open Successful?
WHEN
The queue open operation completes
THEN
If the completion code equals MQCC-OK, the queue is successfully opened, otherwise it has failed
Context: The customs message queue open operation has failed with an error other than queue not found
GIVEN
The customs message queue open operation has failed with an error other than queue not found
Applied to: Generate MQ Error Message
WHEN
Error information needs to be generated
THEN
The system should call GCCMQERR service to convert the reason code to descriptive error text and format it with the reason code
Context: A customs message queue error has occurred and error message has been generated
GIVEN
A customs message queue error has occurred and error message has been generated
Applied to: Set Error Details
WHEN
Error context needs to be established
THEN
The transaction set should be set to '355', program error text should be set to 'MQOPEN FAILED', and the complete error message should be prepared
Context: A critical customs message queue error has occurred and error details have been set
GIVEN
A critical customs message queue error has occurred and error details have been set
Applied to: Abort Processing
WHEN
The system cannot continue normal processing
THEN
The system should invoke the Z900-ABEND procedure to terminate processing
R-GCX015E-cbl-00371 (+9) File: GCX015E.cbl Read Messages from Queue Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Read Messages from Queue':
  • Context - the system is connected to the message queue:
    For Call MQGET to Retrieve Message:
    When a message retrieval request is made, then the system calls mqget to retrieve the next available message from the queue.
  • Context - a message retrieval attempt has been made:
    For Message Successfully Retrieved:
    When the message queue completion code equals mqcc-ok, then the message is considered successfully retrieved for processing.
    For Set End of Queue Flag:
    When the completion code is mqcc-failed and the reason code is mqrc-no-msg-available, then the system sets the end of message queue flag to true.
  • Context - a message has been successfully retrieved from the queue:
    For Message Too Short Check:
    When the calculated maximum message entries is less than 1, then the system generates a user abend 355 error for message too short.
    For Message Backout Count Check:
    When the message backout count equals 0, then the message is marked as good for processing, otherwise it is marked to be skipped.
  • Context - a message has been retrieved with valid data length:
    For Calculate Number of Message Entries:
    When the system processes the message structure, then the maximum message entries is calculated as (data length minus header length minus unused length) divided by single entry length.
  • Context - a message has been retrieved with completion code mqcc-ok and backout count of 0:
    For Set Good Message Found Flag:
    When the message passes all initial validations, then the system sets the good message found flag to true.
  • Context - a message has been retrieved with completion code mqcc-ok:
    For Set Skip Message Flag:
    When the message backout count is not equal to 0, then the system sets the skip message flag to true.
  • Context - a message retrieval attempt has failed:
    For Generate MQ Error Message:
    When the completion code indicates an error other than no messages available, then the system generates an mq error message with reason code and description, sets transaction code to 355, and prepares for abend.
  • Context - a critical error has occurred during message processing:
    For Set Error Status and Abend:
    When either the message is too short or a message queue error has occurred, then the system performs an abend to terminate processing.
👨‍💻 Technical ACs (Gherkin)
Context: The system is connected to the message queue
GIVEN
The system is connected to the message queue
Applied to: Call MQGET to Retrieve Message
WHEN
A message retrieval request is made
THEN
The system calls MQGET to retrieve the next available message from the queue
Context: A message retrieval attempt has been made
GIVEN
A message retrieval attempt has been made
Applied to: Message Successfully Retrieved
WHEN
The message queue completion code equals MQCC-OK
THEN
The message is considered successfully retrieved for processing
Applied to: Set End of Queue Flag
WHEN
The completion code is MQCC-FAILED and the reason code is MQRC-NO-MSG-AVAILABLE
THEN
The system sets the end of message queue flag to true
Context: A message has been successfully retrieved from the queue
GIVEN
A message has been successfully retrieved from the queue
Applied to: Message Too Short Check
WHEN
The calculated maximum message entries is less than 1
THEN
The system generates a user abend 355 error for message too short
Applied to: Message Backout Count Check
WHEN
The message backout count equals 0
THEN
The message is marked as good for processing, otherwise it is marked to be skipped
Context: A message has been retrieved with valid data length
GIVEN
A message has been retrieved with valid data length
Applied to: Calculate Number of Message Entries
WHEN
The system processes the message structure
THEN
The maximum message entries is calculated as (data length minus header length minus unused length) divided by single entry length
Context: A message has been retrieved with completion code MQCC-OK and backout count of 0
GIVEN
A message has been retrieved with completion code MQCC-OK and backout count of 0
Applied to: Set Good Message Found Flag
WHEN
The message passes all initial validations
THEN
The system sets the good message found flag to true
Context: A message has been retrieved with completion code MQCC-OK
GIVEN
A message has been retrieved with completion code MQCC-OK
Applied to: Set Skip Message Flag
WHEN
The message backout count is not equal to 0
THEN
The system sets the skip message flag to true
Context: A message retrieval attempt has failed
GIVEN
A message retrieval attempt has failed
Applied to: Generate MQ Error Message
WHEN
The completion code indicates an error other than no messages available
THEN
The system generates an MQ error message with reason code and description, sets transaction code to 355, and prepares for abend
Context: A critical error has occurred during message processing
GIVEN
A critical error has occurred during message processing
Applied to: Set Error Status and Abend
WHEN
Either the message is too short or a message queue error has occurred
THEN
The system performs an abend to terminate processing
R-GCX015E-cbl-00381 (+3) File: GCX015E.cbl Check Manifest Type Code Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Manifest Type Code':
  • Context - a manifest record is being processed:
    For Set SHOULD-UPDATE-STATUS Flag:
    When the manifest type code is p (preliminary), y (yes/confirmed), or s (special), then the system sets the should-update-status flag to true.
    For Set SHOULD-NOT-UPDATE-STATUS Flag:
    When the manifest type code is not p, y, s, or h, then the system sets the should-not-update-status flag to true.
  • Context - a train manifest record is being processed:
    For Set SHOULD-DELETE-STATUS Flag and Set SHOULD-UPDATE-STATUS Flag:
    When the manifest type code is h (hold) and the processing type is train, then the system sets both should-delete-status flag and should-update-status flag to true.
  • Context - a cargo manifest record is being processed:
    For Set SHOULD-NOT-UPDATE-STATUS Flag:
    When the manifest type code is h (hold) and the processing type is cargo, then the system sets the should-not-update-status flag to true.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record is being processed
GIVEN
A manifest record is being processed
Applied to: Set SHOULD-UPDATE-STATUS Flag
WHEN
The manifest type code is P (Preliminary), Y (Yes/Confirmed), or S (Special)
THEN
The system sets the SHOULD-UPDATE-STATUS flag to true
Applied to: Set SHOULD-NOT-UPDATE-STATUS Flag
WHEN
The manifest type code is not P, Y, S, or H
THEN
The system sets the SHOULD-NOT-UPDATE-STATUS flag to true
Context: A train manifest record is being processed
GIVEN
A train manifest record is being processed
Applied to: Set SHOULD-DELETE-STATUS Flag and Set SHOULD-UPDATE-STATUS Flag
WHEN
The manifest type code is H (Hold) and the processing type is TRAIN
THEN
The system sets both SHOULD-DELETE-STATUS flag and SHOULD-UPDATE-STATUS flag to true
Context: A cargo manifest record is being processed
GIVEN
A cargo manifest record is being processed
Applied to: Set SHOULD-NOT-UPDATE-STATUS Flag
WHEN
The manifest type code is H (Hold) and the processing type is CARGO
THEN
The system sets the SHOULD-NOT-UPDATE-STATUS flag to true
R-GCX015E-cbl-00385 (+5) File: GCX015E.cbl Determine Message Severity Level Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Message Severity Level':
  • Context - a k1 message segment is being processed:
    For Set Message Severity: Information:
    When the k1-02-msg-number equals '000', then the message severity is set to information (msg-sev-i) and the processing status is set to acknowledged (ws-ack-status).
    For Set Message Severity: Fatal:
    When the k1-02-msg-number equals '009' or '017' or '038' or '040' or '291' or '630', then the message severity is set to fatal (msg-sev-f) and the processing status is set to error (ws-error-status).
    For Set Message Severity: Warning:
    When the k1-02-msg-number equals '631' or '632' or '633' or '634' or '695' or '696' or '697' or '698' or '699', then the message severity is set to warning (msg-sev-w) and the processing status is set to acknowledged (ws-ack-status).
    For Set Message Severity: Unknown:
    When the k1-02-msg-number does not equal '000' and does not equal any of '009','017','038','040','291','630' and does not equal any of '631','632','633','634','695','696','697','698','699', then the message severity is set to unknown (msg-sev-u) and the processing status is set to acknowledged (ws-ack-status).
    For Store Message for Logging:
    When the k1-02-free-form-message is not equal to spaces, then the free-form message is moved to mrln-lines for display, the line count is incremented, the message is formatted as work-log-message and stored in hold-k1-message array, and the k1-cnt counter is incremented.
  • Context - a k1 message has been classified as warning severity:
    For Trigger Email Warning Process:
    When the k1-02-msg-number equals '695' or '697' or '699', then the email warning process is triggered by performing c100-send-email-warning.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 message segment is being processed
GIVEN
A K1 message segment is being processed
Applied to: Set Message Severity: Information
WHEN
The K1-02-MSG-NUMBER equals '000'
THEN
The message severity is set to Information (MSG-SEV-I) and the processing status is set to acknowledged (WS-ACK-STATUS)
Applied to: Set Message Severity: Fatal
WHEN
The K1-02-MSG-NUMBER equals '009' OR '017' OR '038' OR '040' OR '291' OR '630'
THEN
The message severity is set to Fatal (MSG-SEV-F) and the processing status is set to error (WS-ERROR-STATUS)
Applied to: Set Message Severity: Warning
WHEN
The K1-02-MSG-NUMBER equals '631' OR '632' OR '633' OR '634' OR '695' OR '696' OR '697' OR '698' OR '699'
THEN
The message severity is set to Warning (MSG-SEV-W) and the processing status is set to acknowledged (WS-ACK-STATUS)
Applied to: Set Message Severity: Unknown
WHEN
The K1-02-MSG-NUMBER does not equal '000' AND does not equal any of '009','017','038','040','291','630' AND does not equal any of '631','632','633','634','695','696','697','698','699'
THEN
The message severity is set to Unknown (MSG-SEV-U) and the processing status is set to acknowledged (WS-ACK-STATUS)
Applied to: Store Message for Logging
WHEN
The K1-02-FREE-FORM-MESSAGE is not equal to spaces
THEN
The free-form message is moved to MRLN-LINES for display, the line count is incremented, the message is formatted as WORK-LOG-MESSAGE and stored in HOLD-K1-MESSAGE array, and the K1-CNT counter is incremented
Context: A K1 message has been classified as warning severity
GIVEN
A K1 message has been classified as warning severity
Applied to: Trigger Email Warning Process
WHEN
The K1-02-MSG-NUMBER equals '695' OR '697' OR '699'
THEN
The email warning process is triggered by performing C100-SEND-EMAIL-WARNING
R-GCX015E-cbl-00391 (+8) File: GCX015E.cbl Process Warning Messages for Email Notification Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Warning Messages for Email Notification':
  • Context - a k1 message segment is being processed:
    For Process K1 Warning Message:
    When the k1 message number is 695, 697, or 699, then the system should initiate email warning notification process.
  • Context - a warning message requires email notification and shipment data exists:
    For Retrieve Freight Forwarder Information:
    When the system processes secondary segments with record type 03 and entity qualifier n101 indicates forwarder, then the freight forwarder information should be retrieved and marked as found.
  • Context - shipment secondary segments are being processed:
    For Retrieve Freight Forwarder Information:
    When a record type 03 segment has entity qualifier n101 indicating consignee, then the consignee name should be extracted from n102 field and marked as found.
  • Context - freight forwarder information has been found in shipment data:
    For Get Freight Forwarder Contact Details:
    When the system queries broker name segment using freight forwarder name prefixed with 'fw=', then the broker short name should be retrieved from the broker name segment if found.
  • Context - broker short name is available and location id exists:
    For Retrieve Broker Contact Information:
    When the system queries broker segment (bk) and internet segment (b1) using broker short name and location id, then if broker uses internet communication, the internet address should be retrieved and email delivery should be enabled to freight forwarder.
  • Context - warning email notification is being prepared:
    For Retrieve Shipment Root Data:
    When the system calls shipment root retrieval using the waybill key from cargo data, then shipment root data should be retrieved for inclusion in email content.
  • Context - warning message 695, 697, or 699 requires email notification and shipment data is available:
    For Format Email Content for Warnings:
    When the system formats email content with equipment details, waybill information, ccn data, load/empty indicator, content description, origin/destination stations, consignee information, cbp warning message, and occurrence timestamp, then a complete formatted email should be prepared with all shipment details and warning information.
  • Context - email content is formatted and recipient information is available:
    For Send Merlin Email Messages:
    When the system calls merlin email service with formatted content and recipient details, then the warning email should be sent to freight forwarder if internet address is available, otherwise to default recipient.
  • Context - warning email has been processed through merlin messaging system:
    For Set Do Not Send Warning Flag:
    When the email sending process completes regardless of success or failure, then the do-not-send-warning flag should be set to prevent duplicate email attempts.
👨‍💻 Technical ACs (Gherkin)
Context: A K1 message segment is being processed
GIVEN
A K1 message segment is being processed
Applied to: Process K1 Warning Message
WHEN
The K1 message number is 695, 697, or 699
THEN
The system should initiate email warning notification process
Context: A warning message requires email notification and shipment data exists
GIVEN
A warning message requires email notification and shipment data exists
Applied to: Retrieve Freight Forwarder Information
WHEN
The system processes secondary segments with record type 03 and entity qualifier N101 indicates forwarder
THEN
The freight forwarder information should be retrieved and marked as found
Context: Shipment secondary segments are being processed
GIVEN
Shipment secondary segments are being processed
Applied to: Retrieve Freight Forwarder Information
WHEN
A record type 03 segment has entity qualifier N101 indicating consignee
THEN
The consignee name should be extracted from N102 field and marked as found
Context: Freight forwarder information has been found in shipment data
GIVEN
Freight forwarder information has been found in shipment data
Applied to: Get Freight Forwarder Contact Details
WHEN
The system queries broker name segment using freight forwarder name prefixed with 'FW='
THEN
The broker short name should be retrieved from the broker name segment if found
Context: Broker short name is available and location ID exists
GIVEN
Broker short name is available and location ID exists
Applied to: Retrieve Broker Contact Information
WHEN
The system queries broker segment (BK) and internet segment (B1) using broker short name and location ID
THEN
If broker uses internet communication, the internet address should be retrieved and email delivery should be enabled to freight forwarder
Context: Warning email notification is being prepared
GIVEN
Warning email notification is being prepared
Applied to: Retrieve Shipment Root Data
WHEN
The system calls shipment root retrieval using the waybill key from cargo data
THEN
Shipment root data should be retrieved for inclusion in email content
Context: Warning message 695, 697, or 699 requires email notification and shipment data is available
GIVEN
Warning message 695, 697, or 699 requires email notification and shipment data is available
Applied to: Format Email Content for Warnings
WHEN
The system formats email content with equipment details, waybill information, CCN data, load/empty indicator, content description, origin/destination stations, consignee information, CBP warning message, and occurrence timestamp
THEN
A complete formatted email should be prepared with all shipment details and warning information
Context: Email content is formatted and recipient information is available
GIVEN
Email content is formatted and recipient information is available
Applied to: Send Merlin Email Messages
WHEN
The system calls Merlin email service with formatted content and recipient details
THEN
The warning email should be sent to freight forwarder if internet address is available, otherwise to default recipient
Context: Warning email has been processed through Merlin messaging system
GIVEN
Warning email has been processed through Merlin messaging system
Applied to: Set Do Not Send Warning Flag
WHEN
The email sending process completes regardless of success or failure
THEN
The do-not-send-warning flag should be set to prevent duplicate email attempts
R-GCX015E-cbl-00400 (+6) File: GCX015E.cbl Evaluate Train Status for Acknowledgment Type Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Evaluate Train Status for Acknowledgment Type':
  • Context - a k3 segment is being processed for us customs response:
    For Total Reject Count = 0? & Set Error Status - Has Rejects:
    When the total reject count in the k3 segment is greater than zero, then set error status indicating the transaction has rejections and set error status to indicate transaction rejections.
  • Context - a k3 segment is being processed with zero reject counts:
    For Total Accept Count > 0?:
    When the total accept count in the k3 segment is zero, then log zero counts message and set acknowledgment status.
    For Set Error Status - Zero Counts:
    When the total accept count is also zero, then log 'uscs k3 record has zero counts' message and set acknowledgment status.
  • Context - a k3 segment has zero rejects and positive accept counts for a train:
    For Current Train Status?:
    When the train status is pre-arrived, then set pre-arrival acknowledgment status.
    For Current Train Status?:
    When the train status is review complete, then set review completed acknowledgment status.
    For Current Train Status?:
    When the train status is neither pre-arrived nor review complete, then set standard acknowledgment status.
👨‍💻 Technical ACs (Gherkin)
Context: A K3 segment is being processed for US Customs response
GIVEN
A K3 segment is being processed for US Customs response
Applied to: Total Reject Count = 0? & Set Error Status - Has Rejects
WHEN
The total reject count in the K3 segment is greater than zero
THEN
Set error status indicating the transaction has rejections AND Set error status to indicate transaction rejections
Context: A K3 segment is being processed with zero reject counts
GIVEN
A K3 segment is being processed with zero reject counts
Applied to: Total Accept Count > 0?
WHEN
The total accept count in the K3 segment is zero
THEN
Log zero counts message and set acknowledgment status
Applied to: Set Error Status - Zero Counts
WHEN
The total accept count is also zero
THEN
Log 'USCS K3 RECORD HAS ZERO COUNTS' message and set acknowledgment status
Context: A K3 segment has zero rejects and positive accept counts for a train
GIVEN
A K3 segment has zero rejects and positive accept counts for a train
Applied to: Current Train Status?
WHEN
The train status is Pre-Arrived
THEN
Set pre-arrival acknowledgment status
Applied to: Current Train Status?
WHEN
The train status is Review Complete
THEN
Set review completed acknowledgment status
Applied to: Current Train Status?
WHEN
The train status is neither Pre-Arrived nor Review Complete
THEN
Set standard acknowledgment status
R-GCX015E-cbl-00407 (+2) File: GCX015E.cbl Determine Train Status Update Logic Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Train Status Update Logic':
  • Context - a train record exists with current status as deleted and acknowledgment status is received:
    For Set Train Status to 'DELETED':
    When the system processes the train status update logic, then the train current status should be set to 'deleted', security context should be cleared, and the train record should be updated with root-only replacement.
  • Context - a train record exists with current status as delete-pending and acknowledgment status is received:
    For Set Train Status to 'DELETED':
    When the system processes the train status update logic, then the train current status should be set to 'deleted', security context should be cleared, and the train record should be updated with root-only replacement.
  • Context - a train record exists with status that is neither deleted nor delete-pending:
    For Set Train Status to Current WS-STATUS:
    When the system processes the train status update logic, then the train current status should be set to the current working status, the train record should be updated with root-only replacement, aei train send check should be performed, and if the train is acknowledged and has arrived-pending status, the train arrival process should be triggered.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists with current status as DELETED and acknowledgment status is received
GIVEN
A train record exists with current status as DELETED and acknowledgment status is received
Applied to: Set Train Status to 'DELETED'
WHEN
The system processes the train status update logic
THEN
The train current status should be set to 'DELETED', security context should be cleared, and the train record should be updated with root-only replacement
Context: A train record exists with current status as DELETE-PENDING and acknowledgment status is received
GIVEN
A train record exists with current status as DELETE-PENDING and acknowledgment status is received
Applied to: Set Train Status to 'DELETED'
WHEN
The system processes the train status update logic
THEN
The train current status should be set to 'DELETED', security context should be cleared, and the train record should be updated with root-only replacement
Context: A train record exists with status that is neither DELETED nor DELETE-PENDING
GIVEN
A train record exists with status that is neither DELETED nor DELETE-PENDING
Applied to: Set Train Status to Current WS-STATUS
WHEN
The system processes the train status update logic
THEN
The train current status should be set to the current working status, the train record should be updated with root-only replacement, AEI train send check should be performed, and if the train is acknowledged and has arrived-pending status, the train arrival process should be triggered
R-GCX015E-cbl-00410 (+5) File: GCX015E.cbl Handle Cargo Status Restoration Logic Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Cargo Status Restoration Logic':
  • Context - a cargo shipment has acknowledgment status and previous status description save field is not empty:
    For Restore Previous Cargo Status from Save Fields:
    When the cargo status update process is executed, then the cargo status is restored from the saved status field and the cargo description is restored from the saved description field.
  • Context - a cargo shipment has acknowledgment status and previous status description save field is empty:
    For Set Cargo Status to Acknowledged:
    When the cargo status update process is executed, then the cargo status is set to acknowledged and the cargo description is set to acknowledged.
  • Context - a cargo shipment has error status and current cargo status is not error and current cargo status is not acknowledgment and current cargo status is not acknowledgment-revised:
    For Save Current Status to Save Fields:
    When the cargo status update process is executed, then the current cargo status is saved to the save status field and the current cargo description is saved to the save description field.
  • Context - a cargo shipment has error status and (current cargo status is error or current cargo status is acknowledgment or current cargo status is acknowledgment-revised):
    For Skip Saving Current Status:
    When the cargo status update process is executed, then no changes are made to the save status field and no changes are made to the save description field.
  • Context - a cargo shipment has error status and cargo is not marked as deleted:
    For Set Cargo Status to Error:
    When the cargo status update process is executed, then the cp cargo status is set to error and the us cargo status is set to error and the us cargo description is set to error.
  • Context - cargo status fields have been updated with new values:
    For Update Cargo Record in Database:
    When the cargo database update is executed, then the cargo segment is updated in the database with the new status information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment has acknowledgment status AND previous status description save field is not empty
GIVEN
A cargo shipment has acknowledgment status AND previous status description save field is not empty
Applied to: Restore Previous Cargo Status from Save Fields
WHEN
The cargo status update process is executed
THEN
The cargo status is restored from the saved status field AND the cargo description is restored from the saved description field
Context: A cargo shipment has acknowledgment status AND previous status description save field is empty
GIVEN
A cargo shipment has acknowledgment status AND previous status description save field is empty
Applied to: Set Cargo Status to Acknowledged
WHEN
The cargo status update process is executed
THEN
The cargo status is set to acknowledged AND the cargo description is set to acknowledged
Context: A cargo shipment has error status AND current cargo status is not error AND current cargo status is not acknowledgment AND current cargo status is not acknowledgment-revised
GIVEN
A cargo shipment has error status AND current cargo status is not error AND current cargo status is not acknowledgment AND current cargo status is not acknowledgment-revised
Applied to: Save Current Status to Save Fields
WHEN
The cargo status update process is executed
THEN
The current cargo status is saved to the save status field AND the current cargo description is saved to the save description field
Context: A cargo shipment has error status AND (current cargo status is error OR current cargo status is acknowledgment OR current cargo status is acknowledgment-revised)
GIVEN
A cargo shipment has error status AND (current cargo status is error OR current cargo status is acknowledgment OR current cargo status is acknowledgment-revised)
Applied to: Skip Saving Current Status
WHEN
The cargo status update process is executed
THEN
No changes are made to the save status field AND no changes are made to the save description field
Context: A cargo shipment has error status AND cargo is not marked as deleted
GIVEN
A cargo shipment has error status AND cargo is not marked as deleted
Applied to: Set Cargo Status to Error
WHEN
The cargo status update process is executed
THEN
The CP cargo status is set to error AND the US cargo status is set to error AND the US cargo description is set to error
Context: Cargo status fields have been updated with new values
GIVEN
Cargo status fields have been updated with new values
Applied to: Update Cargo Record in Database
WHEN
The cargo database update is executed
THEN
The cargo segment is updated in the database with the new status information
R-GCX015E-cbl-00416 (+4) File: GCX015E.cbl Validate AEI Send Conditions Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate AEI Send Conditions':
  • Context - a train record is being processed for aei send validation:
    For Train Status = ACK?:
    When the system checks the train status, then aei processing should only continue if the train status is ack, otherwise skip aei processing.
  • Context - a train record with ack status is being validated for aei processing:
    For AEI Send Flag = True?:
    When the system checks the aei send flag, then aei processing should only continue if the aei send flag is true, otherwise skip aei processing.
  • Context - a train record with ack status and aei send flag enabled is being validated:
    For Enroute Not Reported?:
    When the system checks the enroute reporting status, then aei processing should only continue if enroute status is not reported, otherwise skip aei processing.
  • Context - a train record that has passed ack status, aei send flag, and enroute status validations:
    For Train ID Format Valid? Position 23 = 'T':
    When the system checks the train id format at position 23, then aei processing should only continue if position 23 of the train id contains 't', otherwise skip aei processing.
  • Context - a train record is being evaluated for aei processing eligibility:
    For Set AEI Processing Conditions Met:
    When all conditions are met: train status is ack and aei send flag is true and enroute is not reported and train id position 23 equals 't', then the system should set aei processing conditions as met and proceed with customs transaction generation.
👨‍💻 Technical ACs (Gherkin)
Context: A train record is being processed for AEI send validation
GIVEN
A train record is being processed for AEI send validation
Applied to: Train Status = ACK?
WHEN
The system checks the train status
THEN
AEI processing should only continue if the train status is ACK, otherwise skip AEI processing
Context: A train record with ACK status is being validated for AEI processing
GIVEN
A train record with ACK status is being validated for AEI processing
Applied to: AEI Send Flag = True?
WHEN
The system checks the AEI send flag
THEN
AEI processing should only continue if the AEI send flag is true, otherwise skip AEI processing
Context: A train record with ACK status and AEI send flag enabled is being validated
GIVEN
A train record with ACK status and AEI send flag enabled is being validated
Applied to: Enroute Not Reported?
WHEN
The system checks the enroute reporting status
THEN
AEI processing should only continue if enroute status is not reported, otherwise skip AEI processing
Context: A train record that has passed ACK status, AEI send flag, and enroute status validations
GIVEN
A train record that has passed ACK status, AEI send flag, and enroute status validations
Applied to: Train ID Format Valid? Position 23 = 'T'
WHEN
The system checks the train ID format at position 23
THEN
AEI processing should only continue if position 23 of the train ID contains 'T', otherwise skip AEI processing
Context: A train record is being evaluated for AEI processing eligibility
GIVEN
A train record is being evaluated for AEI processing eligibility
Applied to: Set AEI Processing Conditions Met
WHEN
All conditions are met: train status is ACK AND AEI send flag is true AND enroute is not reported AND train ID position 23 equals 'T'
THEN
The system should set AEI processing conditions as met and proceed with customs transaction generation
R-GCX015E-cbl-00421 (+20) File: GCX015E.cbl Build Email Content Structure Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build Email Content Structure':
  • Context - a cbp warning message needs to be sent via email:
    For Set Email Subject Line:
    When the system prepares the email notification, then the email subject line is set to the predefined warning subject format.
  • Context - an email warning is being constructed:
    For Format Email Header Lines:
    When the system builds the email content structure, then three header lines are formatted and positioned in the email body at lines 2, 3, and 5.
  • Context - a cargo record with equipment information exists:
    For Extract Equipment Information:
    When the system builds email warning content, then the equipment identification number is extracted from the cargo record field rt071-car-id-num-index.
  • Context - equipment identification information has been extracted:
    For Format Equipment Line Data:
    When the system formats the email content, then the equipment data is formatted into equipment line variables and placed at email text line 7.
  • Context - a cargo record contains waybill reference data:
    For Extract Waybill Information:
    When the system builds email warning content, then road index, station index, and waybill index are concatenated from rt072 fields into waybill line data.
  • Context - waybill information has been extracted and concatenated:
    For Format Waybill Line Data:
    When the system formats the email content, then the waybill line variables are placed at email text line 8.
  • Context - the m10-12 work data contains ccn information:
    For Format CCN Key Information:
    When the system builds email warning content, then the ccn line variables are formatted and placed at email text line 9.
  • Context - a cargo record contains equipment load/empty status:
    For Extract Load/Empty Indicator:
    When the system builds email warning content, then the load/empty code is extracted from vid10-load-empty-cde field.
  • Context - load/empty indicator has been extracted:
    For Format Load/Empty Line:
    When the system formats the email content, then the load/empty indicator variables are placed at email text line 10.
  • Context - a cargo record contains content description information:
    For Extract Content Description:
    When the system builds email warning content, then the long description is extracted from gcus-n1002-long-desc field.
  • Context - content description has been extracted:
    For Format Content Line:
    When the system formats the email content, then the content variables are placed at email text line 11.
  • Context - k3 segment contains date and time information:
    For Format Date and Time:
    When the system builds email warning content, then machine century is combined with k3-01-date to form year, month and day are extracted, and hour and minute are extracted from k3-01-time.
  • Context - shipment record contains origin station information:
    For Extract Origin Station Info:
    When the system builds email warning content, then origin station name and province/state code are concatenated with comma separator into origin station data.
  • Context - origin station information has been extracted and formatted:
    For Format Origin Station Line:
    When the system formats the email content, then the origin station variables are placed at email text line 12.
  • Context - shipment record contains destination station information:
    For Extract Destination Station Info:
    When the system builds email warning content, then destination station name and province/state code are concatenated with comma separator into destination station data.
  • Context - destination station information has been extracted and formatted:
    For Format Destination Station Line:
    When the system formats the email content, then the destination station variables are placed at email text line 13.
  • Context - consignee information has been previously extracted and stored:
    For Format Consignee Information:
    When the system formats the email content, then the consignee variables are placed at email text line 14.
  • Context - k1 segment contains a free form warning message:
    For Extract CBP Warning Message:
    When the system builds email warning content, then the free form message is extracted from k1-02-free-form-message field into cbp warning message data.
  • Context - cbp warning message has been extracted:
    For Format Warning Message Line:
    When the system formats the email content, then the cbp warning message variables are placed at email text line 16.
  • Context - date and time components have been formatted:
    For Format Occurrence Date/Time:
    When the system builds email warning content, then date formatter and time formatter are concatenated with space separator into occurrence data and placed at email text line 17.
  • Context - email warning content is being finalized:
    For Add Footer Text:
    When the system completes the email structure, then footer text is placed at email text line 20.
👨‍💻 Technical ACs (Gherkin)
Context: A CBP warning message needs to be sent via email
GIVEN
A CBP warning message needs to be sent via email
Applied to: Set Email Subject Line
WHEN
The system prepares the email notification
THEN
The email subject line is set to the predefined warning subject format
Context: An email warning is being constructed
GIVEN
An email warning is being constructed
Applied to: Format Email Header Lines
WHEN
The system builds the email content structure
THEN
Three header lines are formatted and positioned in the email body at lines 2, 3, and 5
Context: A cargo record with equipment information exists
GIVEN
A cargo record with equipment information exists
Applied to: Extract Equipment Information
WHEN
The system builds email warning content
THEN
The equipment identification number is extracted from the cargo record field RT071-CAR-ID-NUM-INDEX
Context: Equipment identification information has been extracted
GIVEN
Equipment identification information has been extracted
Applied to: Format Equipment Line Data
WHEN
The system formats the email content
THEN
The equipment data is formatted into equipment line variables and placed at email text line 7
Context: A cargo record contains waybill reference data
GIVEN
A cargo record contains waybill reference data
Applied to: Extract Waybill Information
WHEN
The system builds email warning content
THEN
Road index, station index, and waybill index are concatenated from RT072 fields into waybill line data
Context: Waybill information has been extracted and concatenated
GIVEN
Waybill information has been extracted and concatenated
Applied to: Format Waybill Line Data
WHEN
The system formats the email content
THEN
The waybill line variables are placed at email text line 8
Context: The M10-12 work data contains CCN information
GIVEN
The M10-12 work data contains CCN information
Applied to: Format CCN Key Information
WHEN
The system builds email warning content
THEN
The CCN line variables are formatted and placed at email text line 9
Context: A cargo record contains equipment load/empty status
GIVEN
A cargo record contains equipment load/empty status
Applied to: Extract Load/Empty Indicator
WHEN
The system builds email warning content
THEN
The load/empty code is extracted from VID10-LOAD-EMPTY-CDE field
Context: Load/empty indicator has been extracted
GIVEN
Load/empty indicator has been extracted
Applied to: Format Load/Empty Line
WHEN
The system formats the email content
THEN
The load/empty indicator variables are placed at email text line 10
Context: A cargo record contains content description information
GIVEN
A cargo record contains content description information
Applied to: Extract Content Description
WHEN
The system builds email warning content
THEN
The long description is extracted from GCUS-N1002-LONG-DESC field
Context: Content description has been extracted
GIVEN
Content description has been extracted
Applied to: Format Content Line
WHEN
The system formats the email content
THEN
The content variables are placed at email text line 11
Context: K3 segment contains date and time information
GIVEN
K3 segment contains date and time information
Applied to: Format Date and Time
WHEN
The system builds email warning content
THEN
Machine century is combined with K3-01-DATE to form year, month and day are extracted, and hour and minute are extracted from K3-01-TIME
Context: Shipment record contains origin station information
GIVEN
Shipment record contains origin station information
Applied to: Extract Origin Station Info
WHEN
The system builds email warning content
THEN
Origin station name and province/state code are concatenated with comma separator into origin station data
Context: Origin station information has been extracted and formatted
GIVEN
Origin station information has been extracted and formatted
Applied to: Format Origin Station Line
WHEN
The system formats the email content
THEN
The origin station variables are placed at email text line 12
Context: Shipment record contains destination station information
GIVEN
Shipment record contains destination station information
Applied to: Extract Destination Station Info
WHEN
The system builds email warning content
THEN
Destination station name and province/state code are concatenated with comma separator into destination station data
Context: Destination station information has been extracted and formatted
GIVEN
Destination station information has been extracted and formatted
Applied to: Format Destination Station Line
WHEN
The system formats the email content
THEN
The destination station variables are placed at email text line 13
Context: Consignee information has been previously extracted and stored
GIVEN
Consignee information has been previously extracted and stored
Applied to: Format Consignee Information
WHEN
The system formats the email content
THEN
The consignee variables are placed at email text line 14
Context: K1 segment contains a free form warning message
GIVEN
K1 segment contains a free form warning message
Applied to: Extract CBP Warning Message
WHEN
The system builds email warning content
THEN
The free form message is extracted from K1-02-FREE-FORM-MESSAGE field into CBP warning message data
Context: CBP warning message has been extracted
GIVEN
CBP warning message has been extracted
Applied to: Format Warning Message Line
WHEN
The system formats the email content
THEN
The CBP warning message variables are placed at email text line 16
Context: Date and time components have been formatted
GIVEN
Date and time components have been formatted
Applied to: Format Occurrence Date/Time
WHEN
The system builds email warning content
THEN
Date formatter and time formatter are concatenated with space separator into occurrence data and placed at email text line 17
Context: Email warning content is being finalized
GIVEN
Email warning content is being finalized
Applied to: Add Footer Text
WHEN
The system completes the email structure
THEN
Footer text is placed at email text line 20
R-GCX015E-cbl-00442 (+5) File: GCX015E.cbl Map Message Numbers to Severity Categories Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Map Message Numbers to Severity Categories':
  • Context - a k1 message segment is being processed:
    For Message Number = '000'?:
    When the k1-02-msg-number equals '000', then set message severity to information (msg-sev-i) and set processing status to acknowledged (ws-ack-status).
    For Message Number in Fatal Category? 009, 017, 038, 040, 291, 630:
    When the k1-02-msg-number equals '009' or '017' or '038' or '040' or '291' or '630', then set message severity to fatal (msg-sev-f) and set processing status to error (ws-error-status).
    For Message Number in Warning Category? 631, 632, 633, 634, 695, 696, 697, 698, 699:
    When the k1-02-msg-number equals '631' or '632' or '633' or '634' or '695' or '696' or '697' or '698' or '699', then set message severity to warning (msg-sev-w) and set processing status to acknowledged (ws-ack-status).
    For Set Severity: Unknown Set Status: Acknowledged:
    When the k1-02-msg-number does not equal '000' and does not match any fatal error numbers (009, 017, 038, 040, 291, 630) and does not match any warning numbers (631, 632, 633, 634, 695, 696, 697, 698, 699), then set message severity to unknown (msg-sev-u) and set processing status to acknowledged (ws-ack-status).
    For Store Message for Logging:
    When the k1-02-free-form-message is not spaces, then move the k1-02-free-form-message to display lines (mrln-lines) and store formatted message in hold array (hold-k1-message) for logging.
  • Context - a k1 message segment has been classified as warning severity:
    For Warning Message 695, 697, or 699?:
    When the k1-02-msg-number equals '695' or '697' or '699', then trigger email warning process to freight forwarder (c100-send-email-warning).
👨‍💻 Technical ACs (Gherkin)
Context: A K1 message segment is being processed
GIVEN
A K1 message segment is being processed
Applied to: Message Number = '000'?
WHEN
The K1-02-MSG-NUMBER equals '000'
THEN
Set message severity to Information (MSG-SEV-I) and set processing status to acknowledged (WS-ACK-STATUS)
Applied to: Message Number in Fatal Category? 009, 017, 038, 040, 291, 630
WHEN
The K1-02-MSG-NUMBER equals '009' OR '017' OR '038' OR '040' OR '291' OR '630'
THEN
Set message severity to Fatal (MSG-SEV-F) and set processing status to error (WS-ERROR-STATUS)
Applied to: Message Number in Warning Category? 631, 632, 633, 634, 695, 696, 697, 698, 699
WHEN
The K1-02-MSG-NUMBER equals '631' OR '632' OR '633' OR '634' OR '695' OR '696' OR '697' OR '698' OR '699'
THEN
Set message severity to Warning (MSG-SEV-W) and set processing status to acknowledged (WS-ACK-STATUS)
Applied to: Set Severity: Unknown Set Status: Acknowledged
WHEN
The K1-02-MSG-NUMBER does not equal '000' AND does not match any fatal error numbers (009, 017, 038, 040, 291, 630) AND does not match any warning numbers (631, 632, 633, 634, 695, 696, 697, 698, 699)
THEN
Set message severity to Unknown (MSG-SEV-U) and set processing status to acknowledged (WS-ACK-STATUS)
Applied to: Store Message for Logging
WHEN
The K1-02-FREE-FORM-MESSAGE is not spaces
THEN
Move the K1-02-FREE-FORM-MESSAGE to display lines (MRLN-LINES) and store formatted message in hold array (HOLD-K1-MESSAGE) for logging
Context: A K1 message segment has been classified as warning severity
GIVEN
A K1 message segment has been classified as warning severity
Applied to: Warning Message 695, 697, or 699?
WHEN
The K1-02-MSG-NUMBER equals '695' OR '697' OR '699'
THEN
Trigger email warning process to freight forwarder (C100-SEND-EMAIL-WARNING)
R-GCX015E-cbl-00448 (+7) File: GCX015E.cbl Identify Test Message Patterns Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Identify Test Message Patterns':
  • Context - a message with m10 segment is being processed:
    For Check M10 Reference Number:
    When the m10 reference number matches 'traincprstesttrain0000000000' or 'cargocprs940000000000' patterns, then the system triggers special test processing workflow.
  • Context - a test message pattern has been detected:
    For Retrieve T1 Table Configuration:
    When the system needs to update acknowledgment timestamps, then the system retrieves t1 table configuration using table id 't1' and empty sequence id.
  • Context - the system is attempting to retrieve t1 table configuration:
    For Handle Table Not Found Error:
    When the t1 table entry is not found (return flag is not '0'), then the system generates error message 't1 check table entry not found' and terminates processing.
  • Context - a test message is being processed and t1 table configuration is available:
    For Update 309 Acknowledgment Timestamp Manifest Type = P:
    When the manifest type in the message is 'p', then the system updates t1-309-ack field with current machine date (century + date) and time (first 4 digits).
    For Update 353 Acknowledgment Timestamp Manifest Type = H:
    When the manifest type in the message is 'h', then the system updates t1-353-ack field with current machine date (century + date) and time (first 4 digits).
    For Update 358 Acknowledgment Timestamp Manifest Type = S:
    When the manifest type in the message is 's', then the system updates t1-358-ack field with current machine date (century + date) and time (first 4 digits).
  • Context - t1 table acknowledgment timestamps have been updated:
    For Save Updated T1 Table:
    When the timestamp update is complete, then the system saves the updated t1 table segment using repl function code.
  • Context - test message acknowledgment processing is complete:
    For Clear Message Array:
    When t1 table has been updated and saved, then the system clears the message array to spaces, sets end processing flag to true, and exits the special processing.
👨‍💻 Technical ACs (Gherkin)
Context: A message with M10 segment is being processed
GIVEN
A message with M10 segment is being processed
Applied to: Check M10 Reference Number
WHEN
The M10 reference number matches 'TRAINCPRSTESTTRAIN0000000000' OR 'CARGOCPRS940000000000' patterns
THEN
The system triggers special test processing workflow
Context: A test message pattern has been detected
GIVEN
A test message pattern has been detected
Applied to: Retrieve T1 Table Configuration
WHEN
The system needs to update acknowledgment timestamps
THEN
The system retrieves T1 table configuration using table ID 'T1' and empty sequence ID
Context: The system is attempting to retrieve T1 table configuration
GIVEN
The system is attempting to retrieve T1 table configuration
Applied to: Handle Table Not Found Error
WHEN
The T1 table entry is not found (return flag is not '0')
THEN
The system generates error message 'T1 CHECK TABLE ENTRY NOT FOUND' and terminates processing
Context: A test message is being processed and T1 table configuration is available
GIVEN
A test message is being processed and T1 table configuration is available
Applied to: Update 309 Acknowledgment Timestamp Manifest Type = P
WHEN
The manifest type in the message is 'P'
THEN
The system updates T1-309-ACK field with current machine date (century + date) and time (first 4 digits)
Applied to: Update 353 Acknowledgment Timestamp Manifest Type = H
WHEN
The manifest type in the message is 'H'
THEN
The system updates T1-353-ACK field with current machine date (century + date) and time (first 4 digits)
Applied to: Update 358 Acknowledgment Timestamp Manifest Type = S
WHEN
The manifest type in the message is 'S'
THEN
The system updates T1-358-ACK field with current machine date (century + date) and time (first 4 digits)
Context: T1 table acknowledgment timestamps have been updated
GIVEN
T1 table acknowledgment timestamps have been updated
Applied to: Save Updated T1 Table
WHEN
The timestamp update is complete
THEN
The system saves the updated T1 table segment using REPL function code
Context: Test message acknowledgment processing is complete
GIVEN
Test message acknowledgment processing is complete
Applied to: Clear Message Array
WHEN
T1 table has been updated and saved
THEN
The system clears the message array to spaces, sets end processing flag to true, and exits the special processing
R-GCX015E-cbl-00456 (+6) File: GCX015E.cbl Update Manifest Timestamps by Type Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Manifest Timestamps by Type':
  • Context - a manifest message is being processed and the t1 table entry exists:
    For Update different timestamp fields (309, 353, 358) in T1 table based on manifest type code (P, H, S):
    When the manifest type code is p (manifest), h (delete manifest), or s (status manifest), then the system updates the corresponding acknowledgment timestamp field (309-ack for p, 353-ack for h, 358-ack for s) with current date and time.
  • Context - a manifest processing request is initiated:
    For Retrieve T1 Table Entry:
    When the system needs to update acknowledgment timestamps, then the system retrieves the t1 table entry using table id 't1' and empty sequence id.
  • Context - a request to update manifest acknowledgment timestamps:
    For T1 Entry Found?:
    When the t1 table entry retrieval is attempted, then if the t1 table entry is not found, the system generates an error message 't1 check table entry not found' and terminates processing.
  • Context - a manifest message with type code 'p' is being processed and t1 table entry exists:
    For Update 309-ACK Timestamp Type P - Manifest:
    When the manifest type code is 'p', then the system updates the t1-309-ack field with current machine date (century + date) and time (first 4 digits).
  • Context - a manifest message with type code 'h' is being processed and t1 table entry exists:
    For Update 353-ACK Timestamp Type H - Delete Manifest:
    When the manifest type code is 'h', then the system updates the t1-353-ack field with current machine date (century + date) and time (first 4 digits).
  • Context - a manifest message with type code 's' is being processed and t1 table entry exists:
    For Update 358-ACK Timestamp Type S - Status Manifest:
    When the manifest type code is 's', then the system updates the t1-358-ack field with current machine date (century + date) and time (first 4 digits).
  • Context - the t1 table entry has been updated with new acknowledgment timestamp:
    For Save Updated T1 Entry:
    When the timestamp update is complete, then the system saves the updated t1 segment back to the table using repl function code.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest message is being processed and the T1 table entry exists
GIVEN
A manifest message is being processed and the T1 table entry exists
Applied to: Update different timestamp fields (309, 353, 358) in T1 table based on manifest type code (P, H, S)
WHEN
The manifest type code is P (Manifest), H (Delete Manifest), or S (Status Manifest)
THEN
The system updates the corresponding acknowledgment timestamp field (309-ACK for P, 353-ACK for H, 358-ACK for S) with current date and time
Context: A manifest processing request is initiated
GIVEN
A manifest processing request is initiated
Applied to: Retrieve T1 Table Entry
WHEN
The system needs to update acknowledgment timestamps
THEN
The system retrieves the T1 table entry using table ID 'T1' and empty sequence ID
Context: A request to update manifest acknowledgment timestamps
GIVEN
A request to update manifest acknowledgment timestamps
Applied to: T1 Entry Found?
WHEN
The T1 table entry retrieval is attempted
THEN
If the T1 table entry is not found, the system generates an error message 'T1 CHECK TABLE ENTRY NOT FOUND' and terminates processing
Context: A manifest message with type code 'P' is being processed and T1 table entry exists
GIVEN
A manifest message with type code 'P' is being processed and T1 table entry exists
Applied to: Update 309-ACK Timestamp Type P - Manifest
WHEN
The manifest type code is 'P'
THEN
The system updates the T1-309-ACK field with current machine date (century + date) and time (first 4 digits)
Context: A manifest message with type code 'H' is being processed and T1 table entry exists
GIVEN
A manifest message with type code 'H' is being processed and T1 table entry exists
Applied to: Update 353-ACK Timestamp Type H - Delete Manifest
WHEN
The manifest type code is 'H'
THEN
The system updates the T1-353-ACK field with current machine date (century + date) and time (first 4 digits)
Context: A manifest message with type code 'S' is being processed and T1 table entry exists
GIVEN
A manifest message with type code 'S' is being processed and T1 table entry exists
Applied to: Update 358-ACK Timestamp Type S - Status Manifest
WHEN
The manifest type code is 'S'
THEN
The system updates the T1-358-ACK field with current machine date (century + date) and time (first 4 digits)
Context: The T1 table entry has been updated with new acknowledgment timestamp
GIVEN
The T1 table entry has been updated with new acknowledgment timestamp
Applied to: Save Updated T1 Entry
WHEN
The timestamp update is complete
THEN
The system saves the updated T1 segment back to the table using REPL function code
R-GCX015E-cbl-00463 (+17) File: GCX015E.cbl 20:Retrieve Freight Forwarder Information Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '20:Retrieve Freight Forwarder Information':
  • Context - a cargo shipment processing request is initiated:
    For Initialize Search Parameters:
    When the system begins freight forwarder information retrieval, then search flags are reset to not found state and segment type indicators are cleared.
  • Context - a valid us-ccn exists from the cargo root record:
    For Set US-CCN Key for Search:
    When initiating freight forwarder data retrieval, then the us-ccn key is set for gcsa2rt segment search with record type '03' and sequence '0'.
  • Context - us-ccn key is properly set for gcsa2rt segment search:
    For Get First GCSA2RT Segment:
    When database retrieval is executed with 'gu' function and greater than operator, then first matching gcsa2rt segment is retrieved or no record found status is returned.
  • Context - database retrieval operation has completed:
    For Segment Found?:
    When checking the database return status, then return status indicates successful retrieval (spaces) or failure (non-spaces), and processing continues or terminates accordingly.
  • Context - a gcsa2rt segment has been successfully retrieved:
    For Record Type = '03'?:
    When examining the record type field in the segment key, then record type equals '03' indicates party information record, otherwise continue to check for type '07'.
  • Context - a type 03 gcsa2rt segment record is available:
    For Process Type 03 Record:
    When processing the segment data, then segment data is moved to gcsuss03 structure for party information analysis.
  • Context - a type 03 party information record is being processed:
    For Is Freight Forwarder? & Is Consignee?:
    When checking the n101 qualifier code in the party record, then n101 qualifier indicates freight forwarder role and freight forwarder found flag is set to true and n101 qualifier indicates consignee role and consignee processing is initiated.
  • Context - a party record with freight forwarder n101 qualifier is identified:
    For Mark Freight Forwarder Found:
    When processing the freight forwarder party information, then freight forwarder found flag is set to true to track successful identification.
  • Context - a party record with consignee n101 qualifier is identified:
    For Extract Consignee Name:
    When processing the consignee party information, then n102 name field is extracted and stored as consignee data.
  • Context - consignee name has been successfully extracted from party record:
    For Mark Consignee Found:
    When completing consignee information processing, then consignee found flag is set to true to track successful identification.
  • Context - a gcsa2rt segment has been successfully retrieved and is not type 03:
    For Record Type = '07'?:
    When examining the record type field in the segment key, then record type equals '07' indicates additional shipment information record.
  • Context - a type 07 gcsa2rt segment record is available:
    For Process Type 07 Record:
    When processing the segment data, then segment data is moved to gcsuss07 structure for shipment information analysis.
  • Context - a type 07 segment record has been successfully processed:
    For Mark Segment 07 Found:
    When completing type 07 segment processing, then segment 07 found flag is set to true to track successful identification.
  • Context - current gcsa2rt segment has been processed:
    For Get Next GCSA2RT Segment:
    When database retrieval is executed with 'gn' function for next segment, then next sequential gcsa2rt segment is retrieved or end of data status is returned.
  • Context - next segment retrieval operation has completed:
    For More Segments Available?:
    When checking the database return status, then return status indicates more segments available (spaces) or end of data (ge or gb), and processing continues or terminates accordingly.
  • Context - a new gcsa2rt segment has been retrieved:
    For Same US-CCN Key?:
    When comparing the segment's us-ccn key with the original search key, then us-ccn keys match indicating same shipment, or keys differ indicating end of related segments.
  • Context - segment processing is continuing with valid us-ccn key:
    For All Required Data Found?:
    When evaluating collected data completeness, then freight forwarder found and segment 07 found and consignee found indicates complete data collection.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment processing request is initiated
GIVEN
A cargo shipment processing request is initiated
Applied to: Initialize Search Parameters
WHEN
The system begins freight forwarder information retrieval
THEN
Search flags are reset to not found state and segment type indicators are cleared
Context: A valid US-CCN exists from the cargo root record
GIVEN
A valid US-CCN exists from the cargo root record
Applied to: Set US-CCN Key for Search
WHEN
Initiating freight forwarder data retrieval
THEN
The US-CCN key is set for GCSA2RT segment search with record type '03' and sequence '0'
Context: US-CCN key is properly set for GCSA2RT segment search
GIVEN
US-CCN key is properly set for GCSA2RT segment search
Applied to: Get First GCSA2RT Segment
WHEN
Database retrieval is executed with 'GU' function and greater than operator
THEN
First matching GCSA2RT segment is retrieved or no record found status is returned
Context: Database retrieval operation has completed
GIVEN
Database retrieval operation has completed
Applied to: Segment Found?
WHEN
Checking the database return status
THEN
Return status indicates successful retrieval (spaces) or failure (non-spaces), and processing continues or terminates accordingly
Context: A GCSA2RT segment has been successfully retrieved
GIVEN
A GCSA2RT segment has been successfully retrieved
Applied to: Record Type = '03'?
WHEN
Examining the record type field in the segment key
THEN
Record type equals '03' indicates party information record, otherwise continue to check for type '07'
Context: A type 03 GCSA2RT segment record is available
GIVEN
A type 03 GCSA2RT segment record is available
Applied to: Process Type 03 Record
WHEN
Processing the segment data
THEN
Segment data is moved to GCSUSS03 structure for party information analysis
Context: A type 03 party information record is being processed
GIVEN
A type 03 party information record is being processed
Applied to: Is Freight Forwarder? & Is Consignee?
WHEN
Checking the N101 qualifier code in the party record
THEN
N101 qualifier indicates freight forwarder role and freight forwarder found flag is set to true AND N101 qualifier indicates consignee role and consignee processing is initiated
Context: A party record with freight forwarder N101 qualifier is identified
GIVEN
A party record with freight forwarder N101 qualifier is identified
Applied to: Mark Freight Forwarder Found
WHEN
Processing the freight forwarder party information
THEN
Freight forwarder found flag is set to true to track successful identification
Context: A party record with consignee N101 qualifier is identified
GIVEN
A party record with consignee N101 qualifier is identified
Applied to: Extract Consignee Name
WHEN
Processing the consignee party information
THEN
N102 name field is extracted and stored as consignee data
Context: Consignee name has been successfully extracted from party record
GIVEN
Consignee name has been successfully extracted from party record
Applied to: Mark Consignee Found
WHEN
Completing consignee information processing
THEN
Consignee found flag is set to true to track successful identification
Context: A GCSA2RT segment has been successfully retrieved and is not type 03
GIVEN
A GCSA2RT segment has been successfully retrieved and is not type 03
Applied to: Record Type = '07'?
WHEN
Examining the record type field in the segment key
THEN
Record type equals '07' indicates additional shipment information record
Context: A type 07 GCSA2RT segment record is available
GIVEN
A type 07 GCSA2RT segment record is available
Applied to: Process Type 07 Record
WHEN
Processing the segment data
THEN
Segment data is moved to GCSUSS07 structure for shipment information analysis
Context: A type 07 segment record has been successfully processed
GIVEN
A type 07 segment record has been successfully processed
Applied to: Mark Segment 07 Found
WHEN
Completing type 07 segment processing
THEN
Segment 07 found flag is set to true to track successful identification
Context: Current GCSA2RT segment has been processed
GIVEN
Current GCSA2RT segment has been processed
Applied to: Get Next GCSA2RT Segment
WHEN
Database retrieval is executed with 'GN' function for next segment
THEN
Next sequential GCSA2RT segment is retrieved or end of data status is returned
Context: Next segment retrieval operation has completed
GIVEN
Next segment retrieval operation has completed
Applied to: More Segments Available?
WHEN
Checking the database return status
THEN
Return status indicates more segments available (spaces) or end of data (GE or GB), and processing continues or terminates accordingly
Context: A new GCSA2RT segment has been retrieved
GIVEN
A new GCSA2RT segment has been retrieved
Applied to: Same US-CCN Key?
WHEN
Comparing the segment's US-CCN key with the original search key
THEN
US-CCN keys match indicating same shipment, or keys differ indicating end of related segments
Context: Segment processing is continuing with valid US-CCN key
GIVEN
Segment processing is continuing with valid US-CCN key
Applied to: All Required Data Found?
WHEN
Evaluating collected data completeness
THEN
Freight forwarder found AND segment 07 found AND consignee found indicates complete data collection
R-GCX015E-cbl-00481 (+4) File: GCX015E.cbl 21:Get Freight Forwarder Contact Details Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '21:Get Freight Forwarder Contact Details':
  • Context - the system needs to search for freight forwarder broker information:
    For Initialize GCWUSIO Parameters:
    When the freight forwarder broker search process is initiated, then the system clears all search parameters and sets up the broker registry table access.
  • Context - a freight forwarder name is available from the cargo shipment data:
    For Build Search Key with Freight Forwarder Name:
    When the system needs to search for the associated broker information, then the system creates a search key by concatenating 'fw=' with the freight forwarder name.
  • Context - a search key has been constructed with the freight forwarder name:
    For Search GCST2RT Table for Broker Record:
    When the system performs a lookup in the broker registry table, then the system executes a search operation against the gcst2rt table using the freight forwarder key.
  • Context - a broker record exists in the registry table for the given freight forwarder:
    For Retrieve Broker Short Name from GCT2 Segment:
    When the search operation successfully locates the broker record, then the system retains the broker short name and related information from the found record.
  • Context - no broker record exists in the registry table for the given freight forwarder:
    For Initialize Empty Broker Name Segment:
    When the search operation fails to locate a matching broker record, then the system initializes the broker name segment with empty values.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to search for freight forwarder broker information
GIVEN
The system needs to search for freight forwarder broker information
Applied to: Initialize GCWUSIO Parameters
WHEN
The freight forwarder broker search process is initiated
THEN
The system clears all search parameters and sets up the broker registry table access
Context: A freight forwarder name is available from the cargo shipment data
GIVEN
A freight forwarder name is available from the cargo shipment data
Applied to: Build Search Key with Freight Forwarder Name
WHEN
The system needs to search for the associated broker information
THEN
The system creates a search key by concatenating 'FW=' with the freight forwarder name
Context: A search key has been constructed with the freight forwarder name
GIVEN
A search key has been constructed with the freight forwarder name
Applied to: Search GCST2RT Table for Broker Record
WHEN
The system performs a lookup in the broker registry table
THEN
The system executes a search operation against the GCST2RT table using the freight forwarder key
Context: A broker record exists in the registry table for the given freight forwarder
GIVEN
A broker record exists in the registry table for the given freight forwarder
Applied to: Retrieve Broker Short Name from GCT2 Segment
WHEN
The search operation successfully locates the broker record
THEN
The system retains the broker short name and related information from the found record
Context: No broker record exists in the registry table for the given freight forwarder
GIVEN
No broker record exists in the registry table for the given freight forwarder
Applied to: Initialize Empty Broker Name Segment
WHEN
The search operation fails to locate a matching broker record
THEN
The system initializes the broker name segment with empty values
R-GCX015E-cbl-00486 (+4) File: GCX015E.cbl 39:Retrieve Broker Contact Information Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '39:Retrieve Broker Contact Information':
  • Context - a cargo shipment requires broker contact information retrieval:
    For Determine Location ID to Use:
    When the system needs to determine the location id for broker lookup, then if m1203 location id is available and not spaces, use m1203 location id, otherwise use p401 location id.
  • Context - broker short name and location id are available:
    For Build Broker Key with Short Name + Location ID:
    When the system builds the broker contact lookup key, then concatenate broker short name with the selected location id to form the lookup key.
  • Context - a broker lookup key has been constructed:
    For Retrieve BK Table Segment:
    When the system attempts to retrieve broker basic information from bk table, then if bk segment is not found or retrieval fails, initialize empty bk segment, otherwise use retrieved bk segment data.
  • Context - broker basic information retrieval has been attempted:
    For Retrieve B1 Table Segment:
    When the system attempts to retrieve broker contact details from b1 table, then if b1 segment is not found or retrieval fails, initialize empty b1 segment, otherwise use retrieved b1 segment data.
  • Context - broker contact information has been retrieved from bk and b1 tables:
    For Check Internet Usage Flag:
    When the system checks the internet usage preference, then if bk use internet flag equals 'y', set up internet email address from b1 segment and mark email to freight forwarder flag as true.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment requires broker contact information retrieval
GIVEN
A cargo shipment requires broker contact information retrieval
Applied to: Determine Location ID to Use
WHEN
The system needs to determine the location ID for broker lookup
THEN
If M1203 location ID is available and not spaces, use M1203 location ID, otherwise use P401 location ID
Context: Broker short name and location ID are available
GIVEN
Broker short name and location ID are available
Applied to: Build Broker Key with Short Name + Location ID
WHEN
The system builds the broker contact lookup key
THEN
Concatenate broker short name with the selected location ID to form the lookup key
Context: A broker lookup key has been constructed
GIVEN
A broker lookup key has been constructed
Applied to: Retrieve BK Table Segment
WHEN
The system attempts to retrieve broker basic information from BK table
THEN
If BK segment is not found or retrieval fails, initialize empty BK segment, otherwise use retrieved BK segment data
Context: Broker basic information retrieval has been attempted
GIVEN
Broker basic information retrieval has been attempted
Applied to: Retrieve B1 Table Segment
WHEN
The system attempts to retrieve broker contact details from B1 table
THEN
If B1 segment is not found or retrieval fails, initialize empty B1 segment, otherwise use retrieved B1 segment data
Context: Broker contact information has been retrieved from BK and B1 tables
GIVEN
Broker contact information has been retrieved from BK and B1 tables
Applied to: Check Internet Usage Flag
WHEN
The system checks the internet usage preference
THEN
If BK use internet flag equals 'Y', set up internet email address from B1 segment and mark email to freight forwarder flag as true
R-GCX015E-cbl-00491 (+5) File: GCX015E.cbl 22:Retrieve Shipment Root Data Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '22:Retrieve Shipment Root Data':
  • Context - a request to retrieve shipment root data is initiated:
    For Initialize FWWWBIO Parameters:
    When the system prepares to access the freight waybill system, then the fwwwbio parameters are cleared and initialized to spaces.
  • Context - the freight waybill system parameters are initialized:
    For Set Segment Type to 'SHIPROOT':
    When the system needs to specify what type of data to retrieve, then the segment type is set to 'shiproot' to indicate shipment root data retrieval.
  • Context - the segment type is set to shiproot:
    For Set Function Code to 'GU' - Get Unique:
    When the system needs to specify the database operation type, then the function code is set to 'gu' to perform a get unique operation.
  • Context - the function code is set to 'gu' for get unique operation:
    For Set Accept Status to 'GE':
    When the system needs to specify acceptable return status codes, then the accept status is set to 'ge' to allow successful retrieval operations.
  • Context - a cargo record exists with waybill information:
    For Extract Waybill Key from Cargo Record:
    When the system needs to identify the specific shipment to retrieve, then the waybill key is extracted from the cargo record field rt082-waybill-key and assigned to the root key parameter.
  • Context - all parameters are configured with segment type 'shiproot', function 'gu', accept status 'ge', and waybill key:
    For Call FWCWBIO to Retrieve Shipment Root:
    When the system executes the freight waybill data retrieval, then the fwcwbio program is called with the configured parameters to retrieve the shipment root data.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve shipment root data is initiated
GIVEN
A request to retrieve shipment root data is initiated
Applied to: Initialize FWWWBIO Parameters
WHEN
The system prepares to access the freight waybill system
THEN
The FWWWBIO parameters are cleared and initialized to spaces
Context: The freight waybill system parameters are initialized
GIVEN
The freight waybill system parameters are initialized
Applied to: Set Segment Type to 'SHIPROOT'
WHEN
The system needs to specify what type of data to retrieve
THEN
The segment type is set to 'SHIPROOT' to indicate shipment root data retrieval
Context: The segment type is set to SHIPROOT
GIVEN
The segment type is set to SHIPROOT
Applied to: Set Function Code to 'GU' - Get Unique
WHEN
The system needs to specify the database operation type
THEN
The function code is set to 'GU' to perform a get unique operation
Context: The function code is set to 'GU' for get unique operation
GIVEN
The function code is set to 'GU' for get unique operation
Applied to: Set Accept Status to 'GE'
WHEN
The system needs to specify acceptable return status codes
THEN
The accept status is set to 'GE' to allow successful retrieval operations
Context: A cargo record exists with waybill information
GIVEN
A cargo record exists with waybill information
Applied to: Extract Waybill Key from Cargo Record
WHEN
The system needs to identify the specific shipment to retrieve
THEN
The waybill key is extracted from the cargo record field RT082-WAYBILL-KEY and assigned to the root key parameter
Context: All parameters are configured with segment type 'SHIPROOT', function 'GU', accept status 'GE', and waybill key
GIVEN
All parameters are configured with segment type 'SHIPROOT', function 'GU', accept status 'GE', and waybill key
Applied to: Call FWCWBIO to Retrieve Shipment Root
WHEN
The system executes the freight waybill data retrieval
THEN
The FWCWBIO program is called with the configured parameters to retrieve the shipment root data
R-GCX015E-cbl-00497 (+5) File: GCX015E.cbl 36:Save Current Cargo Status Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '36:Save Current Cargo Status':
  • Context - a cargo transaction is being processed with a current status:
    For Check Cargo Processing Status:
    When the system receives an acknowledgment status response, then the system should either set cargo to acknowledged status or restore previous status from save fields.
  • Context - cargo processing has acknowledgment status and save status description fields are empty:
    For Set Cargo to Acknowledged Status:
    When the system processes the cargo status update, then the system should set both cargo status indicators to acknowledged state.
  • Context - cargo processing has acknowledgment status and save status description fields contain data:
    For Restore Previous Status from Save Fields:
    When the system processes the cargo status update, then the system should restore the saved status to current status field and restore the saved description to current description field.
  • Context - cargo processing does not have acknowledgment status:
    For Current Status is Error/Ack?:
    When the current cargo status is error or acknowledgment or acknowledgment-revised, then the system should continue without saving current status information.
    For Set Cargo to Error Status:
    When the system processes cargo status update for error condition and cargo is not marked as deleted, then the system should set canadian cargo status to error and set us cargo status to error and set us cargo description to error.
  • Context - cargo processing does not have acknowledgment status and current status is not error, acknowledgment, or acknowledgment-revised:
    For Save Current Status to Save Fields:
    When the system prepares to update cargo status to error, then the system should move current cargo status to save status field and move current cargo description to save description field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo transaction is being processed with a current status
GIVEN
A cargo transaction is being processed with a current status
Applied to: Check Cargo Processing Status
WHEN
The system receives an acknowledgment status response
THEN
The system should either set cargo to acknowledged status or restore previous status from save fields
Context: Cargo processing has acknowledgment status AND save status description fields are empty
GIVEN
Cargo processing has acknowledgment status AND save status description fields are empty
Applied to: Set Cargo to Acknowledged Status
WHEN
The system processes the cargo status update
THEN
The system should set both cargo status indicators to acknowledged state
Context: Cargo processing has acknowledgment status AND save status description fields contain data
GIVEN
Cargo processing has acknowledgment status AND save status description fields contain data
Applied to: Restore Previous Status from Save Fields
WHEN
The system processes the cargo status update
THEN
The system should restore the saved status to current status field AND restore the saved description to current description field
Context: Cargo processing does not have acknowledgment status
GIVEN
Cargo processing does not have acknowledgment status
Applied to: Current Status is Error/Ack?
WHEN
The current cargo status is error OR acknowledgment OR acknowledgment-revised
THEN
The system should continue without saving current status information
Applied to: Set Cargo to Error Status
WHEN
The system processes cargo status update for error condition AND cargo is not marked as deleted
THEN
The system should set Canadian cargo status to error AND set US cargo status to error AND set US cargo description to error
Context: Cargo processing does not have acknowledgment status AND current status is not error, acknowledgment, or acknowledgment-revised
GIVEN
Cargo processing does not have acknowledgment status AND current status is not error, acknowledgment, or acknowledgment-revised
Applied to: Save Current Status to Save Fields
WHEN
The system prepares to update cargo status to error
THEN
The system should move current cargo status to save status field AND move current cargo description to save description field
R-GCX015E-cbl-00503 (+3) File: GCX015E.cbl 35:Restore Previous Cargo Status Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '35:Restore Previous Cargo Status':
  • Context - a cargo record is being processed with acknowledgment status:
    For Is Acknowledgment Status?:
    When the system checks for previously saved status information, then if no saved status exists, set status to acknowledgment; if saved status exists, restore the saved status and description.
  • Context - a cargo record is being processed with acknowledgment status and no previously saved status information exists:
    For Set Status to ACK:
    When the save status description field is empty, then set both rt11 and rt21 cargo status fields to acknowledgment status.
  • Context - a cargo record is being processed with acknowledgment status and previously saved status information exists:
    For Restore Status from Save Field:
    When the save status description field contains data, then restore the cargo status from rt44 save field to rt11 status field and restore the status description from rt45 save field to rt21 description field.
  • Context - cargo status has been determined (either default acknowledgment or restored from saved fields):
    For Update Cargo Record:
    When the cargo status processing is complete, then update the cargo segment record in the database with the new status information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed with acknowledgment status
GIVEN
A cargo record is being processed with acknowledgment status
Applied to: Is Acknowledgment Status?
WHEN
The system checks for previously saved status information
THEN
If no saved status exists, set status to acknowledgment; if saved status exists, restore the saved status and description
Context: A cargo record is being processed with acknowledgment status and no previously saved status information exists
GIVEN
A cargo record is being processed with acknowledgment status and no previously saved status information exists
Applied to: Set Status to ACK
WHEN
The save status description field is empty
THEN
Set both RT11 and RT21 cargo status fields to acknowledgment status
Context: A cargo record is being processed with acknowledgment status and previously saved status information exists
GIVEN
A cargo record is being processed with acknowledgment status and previously saved status information exists
Applied to: Restore Status from Save Field
WHEN
The save status description field contains data
THEN
Restore the cargo status from RT44 save field to RT11 status field and restore the status description from RT45 save field to RT21 description field
Context: Cargo status has been determined (either default acknowledgment or restored from saved fields)
GIVEN
Cargo status has been determined (either default acknowledgment or restored from saved fields)
Applied to: Update Cargo Record
WHEN
The cargo status processing is complete
THEN
Update the cargo segment record in the database with the new status information
R-GCX015E-cbl-00507 (+9) File: GCX015E.cbl 16:Load Car Information for Customs Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '16:Load Car Information for Customs':
  • Context - equipment information is being processed for customs reporting:
    For Is Equipment a Container?:
    When the equipment container indicator is 'c', then skip the equipment and do not include it in customs car information.
  • Context - non-container equipment is being processed:
    For Extract Equipment Initial:
    When equipment initial information is available, then copy the equipment initial to the customs car initial field.
    For Extract Equipment Number:
    When equipment number information is available, then extract the equipment number for further processing.
  • Context - equipment number has been extracted:
    For Convert to 6-Digit Car Number:
    When the equipment number needs to be formatted for customs, then convert the equipment number to 6-digit car number format.
  • Context - current equipment is being processed and there is a next equipment in the sequence:
    For Set Load/Empty Indicator to 'L':
    When the next equipment's container indicator is 'c', then set the current equipment's load/empty indicator to 'l'.
  • Context - current equipment is being processed:
    For Copy Load/Empty from Equipment:
    When the next equipment is not a container or there is no next equipment, then copy the load/empty indicator from the current equipment data.
  • Context - equipment type information is available:
    For Set Car Kind to 'L' - Locomotive:
    When the equipment type is 'lo', then set the car kind to 'l' indicating locomotive.
    For Set Car Kind to Spaces:
    When the equipment type is neither 'lo' nor 'et', then set the car kind to spaces indicating standard railcar.
  • Context - equipment type information is available and it is not 'lo':
    For Set Car Kind to 'E' - Engine:
    When the equipment type is 'et', then set the car kind to 'e' indicating engine.
  • Context - car information has been processed and classified:
    For Store Car Information in Customs Table:
    When all car details are ready for customs reporting, then store the car initial, number, load/empty indicator, and car kind in the customs table.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment information is being processed for customs reporting
GIVEN
Equipment information is being processed for customs reporting
Applied to: Is Equipment a Container?
WHEN
The equipment container indicator is 'C'
THEN
Skip the equipment and do not include it in customs car information
Context: Non-container equipment is being processed
GIVEN
Non-container equipment is being processed
Applied to: Extract Equipment Initial
WHEN
Equipment initial information is available
THEN
Copy the equipment initial to the customs car initial field
Applied to: Extract Equipment Number
WHEN
Equipment number information is available
THEN
Extract the equipment number for further processing
Context: Equipment number has been extracted
GIVEN
Equipment number has been extracted
Applied to: Convert to 6-Digit Car Number
WHEN
The equipment number needs to be formatted for customs
THEN
Convert the equipment number to 6-digit car number format
Context: Current equipment is being processed and there is a next equipment in the sequence
GIVEN
Current equipment is being processed and there is a next equipment in the sequence
Applied to: Set Load/Empty Indicator to 'L'
WHEN
The next equipment's container indicator is 'C'
THEN
Set the current equipment's load/empty indicator to 'L'
Context: Current equipment is being processed
GIVEN
Current equipment is being processed
Applied to: Copy Load/Empty from Equipment
WHEN
The next equipment is not a container or there is no next equipment
THEN
Copy the load/empty indicator from the current equipment data
Context: Equipment type information is available
GIVEN
Equipment type information is available
Applied to: Set Car Kind to 'L' - Locomotive
WHEN
The equipment type is 'LO'
THEN
Set the car kind to 'L' indicating locomotive
Applied to: Set Car Kind to Spaces
WHEN
The equipment type is neither 'LO' nor 'ET'
THEN
Set the car kind to spaces indicating standard railcar
Context: Equipment type information is available and it is not 'LO'
GIVEN
Equipment type information is available and it is not 'LO'
Applied to: Set Car Kind to 'E' - Engine
WHEN
The equipment type is 'ET'
THEN
Set the car kind to 'E' indicating engine
Context: Car information has been processed and classified
GIVEN
Car information has been processed and classified
Applied to: Store Car Information in Customs Table
WHEN
All car details are ready for customs reporting
THEN
Store the car initial, number, load/empty indicator, and car kind in the customs table
R-GCX015E-cbl-00517 (+10) File: GCX015E.cbl Format Date and Time Information Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Format Date and Time Information':
  • Context - the system has access to machine century information:
    For Extract Century from CC-MACHINE-CENTURY:
    When processing email warning message formatting, then the century component is extracted and stored in the first 2 positions of the date year field.
  • Context - a k3 segment contains date information in k3-01-date field:
    For Extract Year from K3-01-DATE positions 1-2 & Extract Month from K3-01-DATE positions 3-2 & Extract Day from K3-01-DATE positions 5-2:
    When processing email warning message formatting, then the year component from positions 1-2 of k3-01-date is extracted and stored in positions 3-4 of the date year field and the month component from positions 3-4 of k3-01-date is extracted and stored in the date month field and the day component from positions 5-6 of k3-01-date is extracted and stored in the date day field.
  • Context - a k3 segment contains time information in k3-01-time field:
    For Extract Hour from K3-01-TIME positions 1-2 & Extract Minutes from K3-01-TIME positions 3-2:
    When processing email warning message formatting, then the hour component from positions 1-2 of k3-01-time is extracted and stored in the time hour field and the minutes component from positions 3-4 of k3-01-time is extracted and stored in the time minutes field.
  • Context - century component and 2-digit year component are available:
    For Combine Century and Year into WS-DATE-YEAR:
    When processing email warning message formatting, then the century and year are combined to form a complete 4-digit year in ws-date-year field.
  • Context - year, month, and day components are extracted and available:
    For Format Complete Date using WS-DATE-FORMATER:
    When processing email warning message formatting, then the date components are formatted into a complete readable date string using ws-date-formater.
  • Context - hour and minutes components are extracted and available:
    For Format Complete Time using WS-TIME-FORMATER:
    When processing email warning message formatting, then the time components are formatted into a complete readable time string using ws-time-formater.
  • Context - formatted date string and formatted time string are available:
    For Combine Date and Time into WS-OCCURED-ON-DATA:
    When processing email warning message formatting, then the formatted date and time are combined with a space delimiter into ws-occured-on-data field.
  • Context - complete formatted date-time occurrence information is available in ws-occured-on-data:
    For Move Formatted DateTime to Email Line for Display:
    When processing email warning message formatting, then the formatted occurrence timestamp is moved to ws-occured-on-vars and assigned to email text line 17 for display.
👨‍💻 Technical ACs (Gherkin)
Context: The system has access to machine century information
GIVEN
The system has access to machine century information
Applied to: Extract Century from CC-MACHINE-CENTURY
WHEN
Processing email warning message formatting
THEN
The century component is extracted and stored in the first 2 positions of the date year field
Context: A K3 segment contains date information in K3-01-DATE field
GIVEN
A K3 segment contains date information in K3-01-DATE field
Applied to: Extract Year from K3-01-DATE positions 1-2 & Extract Month from K3-01-DATE positions 3-2 & Extract Day from K3-01-DATE positions 5-2
WHEN
Processing email warning message formatting
THEN
The year component from positions 1-2 of K3-01-DATE is extracted and stored in positions 3-4 of the date year field AND The month component from positions 3-4 of K3-01-DATE is extracted and stored in the date month field AND The day component from positions 5-6 of K3-01-DATE is extracted and stored in the date day field
Context: A K3 segment contains time information in K3-01-TIME field
GIVEN
A K3 segment contains time information in K3-01-TIME field
Applied to: Extract Hour from K3-01-TIME positions 1-2 & Extract Minutes from K3-01-TIME positions 3-2
WHEN
Processing email warning message formatting
THEN
The hour component from positions 1-2 of K3-01-TIME is extracted and stored in the time hour field AND The minutes component from positions 3-4 of K3-01-TIME is extracted and stored in the time minutes field
Context: Century component and 2-digit year component are available
GIVEN
Century component and 2-digit year component are available
Applied to: Combine Century and Year into WS-DATE-YEAR
WHEN
Processing email warning message formatting
THEN
The century and year are combined to form a complete 4-digit year in WS-DATE-YEAR field
Context: Year, month, and day components are extracted and available
GIVEN
Year, month, and day components are extracted and available
Applied to: Format Complete Date using WS-DATE-FORMATER
WHEN
Processing email warning message formatting
THEN
The date components are formatted into a complete readable date string using WS-DATE-FORMATER
Context: Hour and minutes components are extracted and available
GIVEN
Hour and minutes components are extracted and available
Applied to: Format Complete Time using WS-TIME-FORMATER
WHEN
Processing email warning message formatting
THEN
The time components are formatted into a complete readable time string using WS-TIME-FORMATER
Context: Formatted date string and formatted time string are available
GIVEN
Formatted date string and formatted time string are available
Applied to: Combine Date and Time into WS-OCCURED-ON-DATA
WHEN
Processing email warning message formatting
THEN
The formatted date and time are combined with a space delimiter into WS-OCCURED-ON-DATA field
Context: Complete formatted date-time occurrence information is available in WS-OCCURED-ON-DATA
GIVEN
Complete formatted date-time occurrence information is available in WS-OCCURED-ON-DATA
Applied to: Move Formatted DateTime to Email Line for Display
WHEN
Processing email warning message formatting
THEN
The formatted occurrence timestamp is moved to WS-OCCURED-ON-VARS and assigned to email text line 17 for display
R-GCX015E-cbl-00528 (+5) File: GCX015E.cbl Extract Station Information Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Station Information':
  • Context - a cargo shipment record exists with waybill key information:
    For Get Origin Station Name from SHIPROOT:
    When the system needs to extract origin station information for email notification, then the origin station name should be retrieved from shiproot database using the waybill key.
    For Get Origin Province/State Code from SHIPROOT:
    When the system needs to extract origin location details for email notification, then the origin province or state code should be retrieved from shiproot database using the waybill key.
    For Get Destination Station Name from SHIPROOT:
    When the system needs to extract destination station information for email notification, then the destination station name should be retrieved from shiproot database using the waybill key.
    For Get Destination Province/State Code from SHIPROOT:
    When the system needs to extract destination location details for email notification, then the destination province or state code should be retrieved from shiproot database using the waybill key.
  • Context - origin station name and province/state code are available from shiproot database:
    For Format Origin Station String:
    When the system needs to create a formatted origin location string for email notification, then the origin station name and province/state code should be concatenated with comma separator into a readable format.
  • Context - destination station name and province/state code are available from shiproot database:
    For Format Destination Station String:
    When the system needs to create a formatted destination location string for email notification, then the destination station name and province/state code should be concatenated with comma separator into a readable format.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment record exists with waybill key information
GIVEN
A cargo shipment record exists with waybill key information
Applied to: Get Origin Station Name from SHIPROOT
WHEN
The system needs to extract origin station information for email notification
THEN
The origin station name should be retrieved from SHIPROOT database using the waybill key
Applied to: Get Origin Province/State Code from SHIPROOT
WHEN
The system needs to extract origin location details for email notification
THEN
The origin province or state code should be retrieved from SHIPROOT database using the waybill key
Applied to: Get Destination Station Name from SHIPROOT
WHEN
The system needs to extract destination station information for email notification
THEN
The destination station name should be retrieved from SHIPROOT database using the waybill key
Applied to: Get Destination Province/State Code from SHIPROOT
WHEN
The system needs to extract destination location details for email notification
THEN
The destination province or state code should be retrieved from SHIPROOT database using the waybill key
Context: Origin station name and province/state code are available from SHIPROOT database
GIVEN
Origin station name and province/state code are available from SHIPROOT database
Applied to: Format Origin Station String
WHEN
The system needs to create a formatted origin location string for email notification
THEN
The origin station name and province/state code should be concatenated with comma separator into a readable format
Context: Destination station name and province/state code are available from SHIPROOT database
GIVEN
Destination station name and province/state code are available from SHIPROOT database
Applied to: Format Destination Station String
WHEN
The system needs to create a formatted destination location string for email notification
THEN
The destination station name and province/state code should be concatenated with comma separator into a readable format
R-GCX015E-cbl-00534 (+6) File: GCX015E.cbl 31:Update Manifest Acknowledgment Timestamps Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '31:Update Manifest Acknowledgment Timestamps':
  • Context - a manifest processing request is initiated:
    For Retrieve T1 Table Segment:
    When the system needs to access t1 table configuration data, then the system retrieves the t1 table segment using table id 't1' with empty sequence id.
  • Context - a request to update manifest acknowledgment timestamps:
    For T1 Table Found?:
    When the t1 table retrieval operation is completed, then if t1 table is not found, log error 't1 check table entry not found' and terminate processing, otherwise proceed with timestamp updates.
  • Context - a manifest with type code 'p' (preliminary) is being processed:
    For Update 309-ACK Timestamp with Current Date/Time:
    When the system updates acknowledgment timestamps, then set t1-309-ack field with current machine century (positions 1-2), current machine date (positions 3-8), and current machine time first 4 digits (positions 9-12).
  • Context - a manifest with type code 'h' (hold) is being processed:
    For Update 353-ACK Timestamp with Current Date/Time:
    When the system updates acknowledgment timestamps, then set t1-353-ack field with current machine century (positions 1-2), current machine date (positions 3-8), and current machine time first 4 digits (positions 9-12).
  • Context - a manifest with type code 's' (supplemental) is being processed:
    For Update 358-ACK Timestamp with Current Date/Time:
    When the system updates acknowledgment timestamps, then set t1-358-ack field with current machine century (positions 1-2), current machine date (positions 3-8), and current machine time first 4 digits (positions 9-12).
  • Context - a manifest message is being processed for timestamp updates:
    For Check Manifest Type Code:
    When the system checks the manifest type code from mqs-table-mani-type, then route to appropriate timestamp update based on manifest type: 'p' for 309-ack, 'h' for 353-ack, 's' for 358-ack, or no update for other types.
  • Context - t1 table segment has been updated with new acknowledgment timestamp:
    For Write Updated T1 Segment:
    When the timestamp update process is completed, then write the modified t1 segment back to table storage using repl function code.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest processing request is initiated
GIVEN
A manifest processing request is initiated
Applied to: Retrieve T1 Table Segment
WHEN
The system needs to access T1 table configuration data
THEN
The system retrieves the T1 table segment using table ID 'T1' with empty sequence ID
Context: A request to update manifest acknowledgment timestamps
GIVEN
A request to update manifest acknowledgment timestamps
Applied to: T1 Table Found?
WHEN
The T1 table retrieval operation is completed
THEN
If T1 table is not found, log error 'T1 CHECK TABLE ENTRY NOT FOUND' and terminate processing, otherwise proceed with timestamp updates
Context: A manifest with type code 'P' (Preliminary) is being processed
GIVEN
A manifest with type code 'P' (Preliminary) is being processed
Applied to: Update 309-ACK Timestamp with Current Date/Time
WHEN
The system updates acknowledgment timestamps
THEN
Set T1-309-ACK field with current machine century (positions 1-2), current machine date (positions 3-8), and current machine time first 4 digits (positions 9-12)
Context: A manifest with type code 'H' (Hold) is being processed
GIVEN
A manifest with type code 'H' (Hold) is being processed
Applied to: Update 353-ACK Timestamp with Current Date/Time
WHEN
The system updates acknowledgment timestamps
THEN
Set T1-353-ACK field with current machine century (positions 1-2), current machine date (positions 3-8), and current machine time first 4 digits (positions 9-12)
Context: A manifest with type code 'S' (Supplemental) is being processed
GIVEN
A manifest with type code 'S' (Supplemental) is being processed
Applied to: Update 358-ACK Timestamp with Current Date/Time
WHEN
The system updates acknowledgment timestamps
THEN
Set T1-358-ACK field with current machine century (positions 1-2), current machine date (positions 3-8), and current machine time first 4 digits (positions 9-12)
Context: A manifest message is being processed for timestamp updates
GIVEN
A manifest message is being processed for timestamp updates
Applied to: Check Manifest Type Code
WHEN
The system checks the manifest type code from MQS-TABLE-MANI-TYPE
THEN
Route to appropriate timestamp update based on manifest type: 'P' for 309-ACK, 'H' for 353-ACK, 'S' for 358-ACK, or no update for other types
Context: T1 table segment has been updated with new acknowledgment timestamp
GIVEN
T1 table segment has been updated with new acknowledgment timestamp
Applied to: Write Updated T1 Segment
WHEN
The timestamp update process is completed
THEN
Write the modified T1 segment back to table storage using REPL function code
R-GCX015E-cbl-00541 (+3) File: GCX015E.cbl Process Type 03 Record Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Type 03 Record':
  • Context - a gcsa2rt segment exists with record type '03':
    For Read GCSA2RT Segment with Record Type '03':
    When the system processes the segment, then the segment data is moved to gcsuss03 structure for further analysis.
  • Context - a type 03 record with n101 qualifier code indicating freight forwarder:
    For Check N101 Qualifier Code:
    When the n101 qualifier is evaluated as freight forwarder type, then the freight forwarder found flag is set to true and the freight forwarder name is extracted.
  • Context - a type 03 record with n101 qualifier code indicating consignee:
    For Extract Consignee Name:
    When the n101 qualifier is evaluated as consignee type, then the consignee name is extracted and the consignee found flag is set to true.
  • Context - a type 03 record identified as freight forwarder or consignee:
    For Extract Freight Forwarder Name:
    When the entity type is confirmed, then the entity name is extracted from the n102 name field and stored in appropriate business data fields.
👨‍💻 Technical ACs (Gherkin)
Context: A GCSA2RT segment exists with record type '03'
GIVEN
A GCSA2RT segment exists with record type '03'
Applied to: Read GCSA2RT Segment with Record Type '03'
WHEN
The system processes the segment
THEN
The segment data is moved to GCSUSS03 structure for further analysis
Context: A Type 03 record with N101 qualifier code indicating freight forwarder
GIVEN
A Type 03 record with N101 qualifier code indicating freight forwarder
Applied to: Check N101 Qualifier Code
WHEN
The N101 qualifier is evaluated as freight forwarder type
THEN
The freight forwarder found flag is set to true and the freight forwarder name is extracted
Context: A Type 03 record with N101 qualifier code indicating consignee
GIVEN
A Type 03 record with N101 qualifier code indicating consignee
Applied to: Extract Consignee Name
WHEN
The N101 qualifier is evaluated as consignee type
THEN
The consignee name is extracted and the consignee found flag is set to true
Context: A Type 03 record identified as freight forwarder or consignee
GIVEN
A Type 03 record identified as freight forwarder or consignee
Applied to: Extract Freight Forwarder Name
WHEN
The entity type is confirmed
THEN
The entity name is extracted from the N102 name field and stored in appropriate business data fields
R-GCX015E-cbl-00545 (+2) File: GCX015E.cbl Determine Location ID to Use Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Location ID to Use':
  • Context - a freight forwarder broker requires location-specific information lookup and both m1203 location id and p401 location id are available in the system:
    For Use M1203 Location ID:
    When the system needs to select a location identifier for broker table lookup and m1203 location id contains actual data (not spaces), then the system shall use m1203 location id as the primary location identifier for the broker information lookup.
  • Context - a freight forwarder broker requires location-specific information lookup and m1203 location id is not available (contains spaces):
    For Use P401 Location ID as Default:
    When the system needs to select a location identifier for broker table lookup and m1203 location id is empty or contains only spaces, then the system shall use p401 location id as the default location identifier for the broker information lookup.
  • Context - a broker short name has been retrieved and a location identifier has been selected (either m1203 or p401):
    For Create Broker Key for Table Lookup:
    When the system needs to create a lookup key for accessing broker information in the table, then the system shall concatenate the broker short name with the selected location identifier to form the complete broker key for table lookup operations.
👨‍💻 Technical ACs (Gherkin)
Context: A freight forwarder broker requires location-specific information lookup and both M1203 Location ID and P401 Location ID are available in the system
GIVEN
A freight forwarder broker requires location-specific information lookup and both M1203 Location ID and P401 Location ID are available in the system
Applied to: Use M1203 Location ID
WHEN
The system needs to select a location identifier for broker table lookup and M1203 Location ID contains actual data (not spaces)
THEN
The system shall use M1203 Location ID as the primary location identifier for the broker information lookup
Context: A freight forwarder broker requires location-specific information lookup and M1203 Location ID is not available (contains spaces)
GIVEN
A freight forwarder broker requires location-specific information lookup and M1203 Location ID is not available (contains spaces)
Applied to: Use P401 Location ID as Default
WHEN
The system needs to select a location identifier for broker table lookup and M1203 Location ID is empty or contains only spaces
THEN
The system shall use P401 Location ID as the default location identifier for the broker information lookup
Context: A broker short name has been retrieved and a location identifier has been selected (either M1203 or P401)
GIVEN
A broker short name has been retrieved and a location identifier has been selected (either M1203 or P401)
Applied to: Create Broker Key for Table Lookup
WHEN
The system needs to create a lookup key for accessing broker information in the table
THEN
The system shall concatenate the broker short name with the selected location identifier to form the complete broker key for table lookup operations
R-GCX015E-cbl-00548 (+1) File: GCX015E.cbl Format Origin Station String Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Format Origin Station String':
  • Context - origin station name exists in orig-stn-nm and province/state code exists in orig-prov-state-cde:
    For Combine Station Name and Province/State with Comma Delimiter:
    When the system formats origin station information for email display, then the system combines the origin station name and province/state code with a comma and space delimiter and stores the formatted string in the origin station data field.
  • Context - origin station information has been formatted and stored in ws-origin-stn-vars:
    For Move Formatted Origin Station to Email Text Line:
    When the system prepares email content for cargo warning notifications, then the system assigns the formatted origin station information to email text line 12.
👨‍💻 Technical ACs (Gherkin)
Context: Origin station name exists in ORIG-STN-NM and province/state code exists in ORIG-PROV-STATE-CDE
GIVEN
Origin station name exists in ORIG-STN-NM and province/state code exists in ORIG-PROV-STATE-CDE
Applied to: Combine Station Name and Province/State with Comma Delimiter
WHEN
The system formats origin station information for email display
THEN
The system combines the origin station name and province/state code with a comma and space delimiter and stores the formatted string in the origin station data field
Context: Origin station information has been formatted and stored in WS-ORIGIN-STN-VARS
GIVEN
Origin station information has been formatted and stored in WS-ORIGIN-STN-VARS
Applied to: Move Formatted Origin Station to Email Text Line
WHEN
The system prepares email content for cargo warning notifications
THEN
The system assigns the formatted origin station information to email text line 12
R-GCX015E-cbl-00550 File: GCX015E.cbl Format Destination Station String
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Format Destination Station String':
  • Context - a cargo shipment has destination station name and province/state code available:
    For Combine Station Name and Province/State with Comma Delimiter:
    When the system prepares an email warning notification, then the destination station string should be formatted by combining the destination station name, a comma delimiter, and the province/state code, then stored in the email text line.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment has destination station name and province/state code available
GIVEN
A cargo shipment has destination station name and province/state code available
Applied to: Combine Station Name and Province/State with Comma Delimiter
WHEN
The system prepares an email warning notification
THEN
The destination station string should be formatted by combining the destination station name, a comma delimiter, and the province/state code, then stored in the email text line