Bits In Glass
BIG Pega COE Team

Detailed Acceptance Criteria (ACs)

Category: GCCE358

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.

🎯 GCCE358 Scope Detected: Extracted 837 rules, Optimally Merged into 107 Feature Scenarios.
R-GCCE358-cbl-00001 (+61) File: GCCE358.cblFile: GCCS358C.cblFile: GCCU358T.cbl Overview Rules Merged 62 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Overview Rules':
  • Context - edi 358 processing is initiated:
    For 1:Validate Processing Mode:
    When the processing mode is checked, then processing continues only if mode is foreground or background, otherwise sets wrong mode indicator.
  • Context - a valid processing mode is confirmed:
    For 2:Generate Transmission Number:
    When generating transmission number, then use prefix 106 for foreground mode or prefix 110 for background mode, combined with machine time.
  • Context - a transmission number is generated:
    For 3:Insert EDI Root Segment:
    When attempting to insert edi root segment, then if transmission number already exists, increment by 1 and retry until unique number is found.
  • Context - train equipment list is available:
    For 4:Count Bill of Lading Records:
    When counting bill of lading records, then increment count for each equipment item where us-ccn-key is not spaces.
  • Context - bill of lading count is calculated:
    For 5:Process M10 Manifest Header:
    When creating m10 manifest header, then set scac to 'cprs', transport type to 'r', country to 'ca', vessel name to customer train id, voyage number to train creation date, quantity to bol count, manifest type to 's', condition response to 'y', record type to 'train', and record number to customer train id.
  • Context - port and timing information is available:
    For 6:Process P4 Port Information:
    When creating p4 port information, then set location to origin service center, quantity to bol count, time to eta, id code to firms code, and for eta date: if year less than 70 use century 20, if year 70 or greater use century 19, if date is spaces or zeros use century 0.
  • Context - train equipment list contains multiple items:
    For More Equipment to Process?:
    When processing equipment items, then continue processing while equipment index is less than or equal to total equipment quantity.
  • Context - equipment items are being processed sequentially:
    For Equipment ID Changed?:
    When checking current equipment id, then if current equipment id is different from last processed equipment id, process vid record and update last equipment id.
  • Context - equipment record is being created:
    For 7:Process Equipment Records:
    When assigning equipment number, then if us-ccn-key starts with 'cprs' or car number is spaces, use equipment number from train list, otherwise use car number from cargo record.
  • Context - equipment load/empty status and cargo information is available:
    For 8:Determine Equipment Load Status:
    When determining final load status, then if status is 'h' change to 'e', if status is 'e' and ccn key exists and cargo weight greater than 1 change to 'l', otherwise keep original status.
  • Context - equipment has us-ccn-key that is not spaces:
    For 9:Lookup Foreign Carrier Information:
    When processing equipment records, then lookup cargo information using the ccn key to retrieve additional equipment details.
  • Context - equipment information is processed and validated:
    For 10:Create VID Equipment Segment:
    When creating vid equipment segment, then populate vid segment with equipment type, initial, processed equipment number, and determined load status.
  • Context - equipment item is being processed:
    For Equipment Has Bill of Lading?:
    When checking for bill of lading information, then if us-ccn-key is not spaces, process mbl bill of lading record.
  • Context - equipment has bill of lading information:
    For 11:Process Bill of Lading Records:
    When processing bill of lading records, then extract scac and bol/waybill information from equipment data for mbl segment creation.
  • Context - scac and port information is available:
    For 12:Determine Automated Carrier Status:
    When determining automated carrier status, then if scac is 'cprs' set response to 'y', otherwise lookup scac in table and if automated carrier flag is 'y' set response to 'y', else set to 'n'.
  • Context - equipment and bill of lading information is processed:
    For 13:Apply Special ER Processing Rules:
    When applying special er processing rules, then if equipment status is 'e' and ccn key exists and bol type is 23, override response code to 'y'.
  • Context - bill of lading information and automated carrier status is determined:
    For 14:Create MBL Bill Segment:
    When creating mbl bill segment, then populate mbl segment with scac, bol/waybill number, and determined response code.
  • Context - all edi segments are created successfully:
    For 15:Start EDI Send Function:
    When starting edi send function, then invoke edi send function with transmission number and high-values security setting.
  • Context - edi processing is completed:
    For 16:Start Log Update Function:
    When starting log update function, then if foreground mode use foreground action code and transaction name, if background mode use background action code and transaction name, include user id, current date and time.
  • Context - an edi 358 processing request is initiated:
    For Valid Processing Mode?:
    When the system checks the processing mode flags, then if none of the valid processing modes (foreground, background, or foreground-02) are set, the system sets wrong fb indicator and exits processing.
  • Context - an st header segment needs to be created for edi transmission:
    For Build ST Header Segment:
    When the system evaluates the post-emanifest flag in the train list, then if post-emanifest is true, set destination to 'cacustoms2-st-o', otherwise set destination to 'cacustoms-st-o'.
  • Context - a manifest transaction is being processed:
    For Set Transaction Purpose Code:
    When the operation type is add, then set the transaction purpose code to '00'.
    For Set Transaction Purpose Code:
    When the operation type is delete, then set the transaction purpose code to '03'.
  • Context - a manifest transaction is being processed with operation type change:
    For Set Transaction Purpose Code:
    When the system evaluates arrival date and post-emanifest flag, then if arrival date is empty, set purpose code to '04' and mark as not amendment. if arrival date exists and post-emanifest is true, set purpose code to 'co' and mark as amendment. if arrival date exists and post-emanifest is false, set purpose code to '04' and mark as not amendment.
  • Context - equipment processing needs to be performed for the manifest:
    For Determine EDI Version Processing:
    When the system evaluates the post-emanifest flag, then if post-emanifest is true, use 5040 version processing (b231-load-vid-mbl-5040), otherwise use 4040rail version processing (b230-load-vid-mbl).
  • Context - equipment is being processed in standard 4040rail version:
    For Set Equipment Load Status:
    When the system evaluates equipment load status and cargo key, then if equipment is loaded, set status to 'l'. if equipment is empty, set status to 'e'. if equipment is loaded but has no cargo key, override status to 'e'.
  • Context - equipment is being processed in 5040 post-emanifest version:
    For Set Equipment Load Status:
    When the system evaluates equipment load status and cargo key, then if equipment is loaded or (equipment is empty and has cargo key), set status to 'l'. otherwise set status to 'e'. if equipment is loaded but has no cargo key, override status to 'e'.
  • Context - equipment processing is being performed:
    For Set Equipment Load Status:
    When the cargo ccn key starts with '6105i', then override the equipment load status to 'e' (empty) regardless of other load status determinations.
  • Context - equipment has associated cargo information:
    For Set Location ID for Equipment:
    When the system evaluates the cargo in-transit status, then if in-transit status is 'r', set location id to '0000'. if in-transit status is 't', set location id to the manifest-to-trans-code. for any other status, set location id to spaces.
  • Context - equipment is a possible flatcar type in post-emanifest processing:
    For Handle Flat Car Processing:
    When the system checks subsequent equipment for container types, then if any subsequent container equipment is loaded or (empty with cargo key), set the flatcar status to 'l' (loaded).
  • Context - a master bill of lading segment is being created:
    For Handle Special SCAC Assignment:
    When the system evaluates the ccn key prefix, then if ccn key starts with '2156', set scac to 'cffo', otherwise set scac to 'cprs'.
  • Context - cargo information indicates in-transit status of 'r' (revenue):
    For Handle Revenue Transit Status:
    When the system processes the master bill of lading segment, then set bol/waybill to 'na', set response code to 'n', and if post-emanifest, set exception code to '08'.
  • Context - cargo information indicates haulage rights exist:
    For Process Haulage Rights:
    When the system processes the master bill of lading segment, then set scac to the haulage rights scac code and set response code to 'n'.
  • Context - processing is for the first equipment in an amendment scenario:
    For Build Dummy MBL Segment:
    When no cargo key exists for the equipment but amendment processing is required, then create a dummy mbl segment with scac 'cprs', bol/waybill 'na', and exception code '06'.
  • Context - amendment processing is required for the first equipment or dummy mbl scenario:
    For Build M13 Amendment Segment:
    When the system needs to document the amendment, then create m13 segment with scac 'cprs', location id from station code, bol/wb number from train key, and amendment code '60'.
  • Context - processing is post-emanifest version and this is the first equipment:
    For Build N9 Reference Segment:
    When the system creates reference information, then create n9 segment with reference qualifier '76', reference number 'edt', date from eda with machine century, time from eta with '00' seconds, and time code 'es'.
  • Context - a transmission number needs to be generated for edi processing:
    For Generate Transmission Number:
    When the system evaluates the processing mode, then if foreground mode, use prefix 147. if foreground-02 mode, use prefix 2. if background mode, use prefix 146. append machine time to create unique transmission number.
  • Context - station information is required for manifest processing:
    For Retrieve Station Information:
    When the system looks up the station code in the station table, then if station code is not found or returns '0000', generate error message indicating station not found. otherwise, use the retrieved station information.
  • Context - equipment has a non-empty cargo ccn key:
    For Retrieve Cargo Information:
    When the system attempts to retrieve cargo information, then if cargo root is not found, generate error message indicating cargo not found for ccn. otherwise, set cargo flag to true and use retrieved cargo information.
  • Context - a train processing request is initiated:
    For 1:Validate Foreground/Background Indicator:
    When the system checks the processing mode indicator, then processing continues if mode is foreground or background, otherwise sets wrong indicator error.
  • Context - a train has an origin station code:
    For 2:Check Station Code Validity:
    When the system looks up the station code in the se table, then sets valid port flag to true if found, false if not found.
  • Context - a train has equipment with us ccn keys:
    For 3:Count Bills of Lading:
    When the system evaluates each equipment's cargo type, then increments bol count if in-bond type is 'tr' or if cargo is export type and port is valid.
  • Context - a train has a valid port and train id:
    For 4:Determine Train Type:
    When the system examines position 23 of the train id, then sets train type to export if position 23 is 't', otherwise sets to transit.
  • Context - a train has been validated for processing mode and station code:
    For Valid Bills or Valid Port?:
    When the system checks if bol quantity is greater than 0 or if port is valid, then proceeds with edi processing if either condition is true, otherwise skips to logging.
  • Context - edi processing is required:
    For 5:Generate Transmission Number:
    When the system generates a transmission number, then uses prefix 106 for foreground or 003 for background, combined with machine time.
  • Context - a unique transmission number has been generated:
    For 6:Create EDI Root Segment:
    When the system creates the root segment, then inserts transmission record with transaction set '358' and generated transmission number.
  • Context - edi root segment has been created and train type determined:
    For 7:Build M10 Manifest Header:
    When the system builds the m10 segment, then sets scac to 'cprs', transport type to 'r', country to 'ca', manifest type to 'k' for export trains with valid port or 's' for others, and application type '28' for export trains with valid port.
  • Context - m10 segment has been created:
    For 8:Build P4 Port Information:
    When the system builds the p4 segment, then includes origin station code, estimated arrival date with century calculation, bol quantity, arrival time, and firms code.
  • Context - p4 segment has been created and equipment list exists:
    For 9:Process Equipment VID Segments:
    When the system processes each unique equipment id, then creates vid segment with equipment type, initial, number (using cargo car number if available), and load/empty status (e if train shows h, l if train shows e but cargo weight > 1, otherwise train value).
  • Context - equipment has associated cargo (us ccn key not spaces):
    For 10:Process Bill of Lading MBL Segments:
    When the system creates mbl segment, then uses cargo-derived scac and bol for valid ports, otherwise uses train list values, and sets automated response based on scac table lookup or special handling for empty cars with bol type '23'.
  • Context - equipment has cargo with transport export type:
    For 11:Process N9 Reference Segments:
    When the system processes n9 segment, then creates n9 segment with reference qualifier 'ib' and entry number from cargo record.
  • Context - train has valid cargo (bol quantity > 0) or valid port:
    For 12:Update Train Status to SENT:
    When the system updates train status, then sets train status to sent, enables edi sending flag, and updates both train database and train list.
  • Context - train has no valid cargo (bol quantity = 0) and no valid port:
    For 13:Update Train Status to ACK:
    When the system updates train status, then sets train status to ack and determines edi action based on previous edi send flag.
  • Context - train status has been set to ack:
    For Delete Required?:
    When the system checks previous edi send flag, then sets delete required flag if previously marked to send edi, otherwise sets do not send edi flag.
  • Context - edi segments have been created successfully:
    For 15:Start EDI Send Function:
    When the system starts edi send function, then calls edi send function with high-value security and generated transmission number.
  • Context - train processing has completed:
    For 16:Log Transaction Activity:
    When the system logs the transaction, then uses foreground or background action codes, includes user id, date, time, and appropriate message based on cargo validity.
  • Context - train is in background mode, has ack status, aei send is enabled, edi is not being sent, and train id position 23 is 't':
    For 17:Process AEI Train Send:
    When the system processes aei train send, then initiates customs transaction with train information for aei processing.
  • Context - aei train send is being processed:
    For 18:Load Car Information for CDN Send:
    When the system loads car information, then includes only non-container equipment with car initial, load/empty status, car number, and car kind classification.
  • Context - train has been marked as delete required:
    For 19:Spawn Delete Transaction:
    When the system spawns delete transaction, then calls gct1121e transaction with train id and delete action code 'td'.
  • Context - mbl segment is being processed with a scac code:
    For 21:Check Automated Carrier Status:
    When the system checks automated carrier status, then sets response to 'y' if scac is 'cprs' or if scac table indicates automated carrier, otherwise sets to 'n', with special 'y' setting for empty cars with bol type '23'.
  • Context - train processing has completed and edi is not being sent:
    For AEI Train Send Check?:
    When the system checks aei train send eligibility, then proceeds with aei processing if train is in background mode and meets aei criteria.
  • Context - edi processing and logging have completed:
    For Has Valid Cargo?:
    When the system determines final status, then updates to sent status if bol quantity > 0 or port is valid, otherwise updates to ack status.
👨‍💻 Technical ACs (Gherkin)
Context: EDI 358 processing is initiated
GIVEN
EDI 358 processing is initiated
Applied to: 1:Validate Processing Mode
WHEN
the processing mode is checked
THEN
processing continues only if mode is FOREGROUND or BACKGROUND, otherwise sets wrong mode indicator
Context: a valid processing mode is confirmed
GIVEN
a valid processing mode is confirmed
Applied to: 2:Generate Transmission Number
WHEN
generating transmission number
THEN
use prefix 106 for FOREGROUND mode or prefix 110 for BACKGROUND mode, combined with machine time
Context: a transmission number is generated
GIVEN
a transmission number is generated
Applied to: 3:Insert EDI Root Segment
WHEN
attempting to insert EDI root segment
THEN
if transmission number already exists, increment by 1 and retry until unique number is found
Context: train equipment list is available
GIVEN
train equipment list is available
Applied to: 4:Count Bill of Lading Records
WHEN
counting bill of lading records
THEN
increment count for each equipment item where US-CCN-KEY is not spaces
Context: bill of lading count is calculated
GIVEN
bill of lading count is calculated
Applied to: 5:Process M10 Manifest Header
WHEN
creating M10 manifest header
THEN
set SCAC to 'CPRS', transport type to 'R', country to 'CA', vessel name to customer train ID, voyage number to train creation date, quantity to BOL count, manifest type to 'S', condition response to 'Y', record type to 'TRAIN', and record number to customer train ID
Context: port and timing information is available
GIVEN
port and timing information is available
Applied to: 6:Process P4 Port Information
WHEN
creating P4 port information
THEN
set location to origin service center, quantity to BOL count, time to ETA, ID code to FIRMS code, and for ETA date: if year less than 70 use century 20, if year 70 or greater use century 19, if date is spaces or zeros use century 0
Context: train equipment list contains multiple items
GIVEN
train equipment list contains multiple items
Applied to: More Equipment to Process?
WHEN
processing equipment items
THEN
continue processing while equipment index is less than or equal to total equipment quantity
Context: equipment items are being processed sequentially
GIVEN
equipment items are being processed sequentially
Applied to: Equipment ID Changed?
WHEN
checking current equipment ID
THEN
if current equipment ID is different from last processed equipment ID, process VID record and update last equipment ID
Context: equipment record is being created
GIVEN
equipment record is being created
Applied to: 7:Process Equipment Records
WHEN
assigning equipment number
THEN
if US-CCN-KEY starts with 'CPRS' or car number is spaces, use equipment number from train list, otherwise use car number from cargo record
Context: equipment load/empty status and cargo information is available
GIVEN
equipment load/empty status and cargo information is available
Applied to: 8:Determine Equipment Load Status
WHEN
determining final load status
THEN
if status is 'H' change to 'E', if status is 'E' and CCN key exists and cargo weight greater than 1 change to 'L', otherwise keep original status
Context: equipment has US-CCN-KEY that is not spaces
GIVEN
equipment has US-CCN-KEY that is not spaces
Applied to: 9:Lookup Foreign Carrier Information
WHEN
processing equipment records
THEN
lookup cargo information using the CCN key to retrieve additional equipment details
Context: equipment information is processed and validated
GIVEN
equipment information is processed and validated
Applied to: 10:Create VID Equipment Segment
WHEN
creating VID equipment segment
THEN
populate VID segment with equipment type, initial, processed equipment number, and determined load status
Context: equipment item is being processed
GIVEN
equipment item is being processed
Applied to: Equipment Has Bill of Lading?
WHEN
checking for bill of lading information
THEN
if US-CCN-KEY is not spaces, process MBL bill of lading record
Context: equipment has bill of lading information
GIVEN
equipment has bill of lading information
Applied to: 11:Process Bill of Lading Records
WHEN
processing bill of lading records
THEN
extract SCAC and BOL/Waybill information from equipment data for MBL segment creation
Context: SCAC and port information is available
GIVEN
SCAC and port information is available
Applied to: 12:Determine Automated Carrier Status
WHEN
determining automated carrier status
THEN
if SCAC is 'CPRS' set response to 'Y', otherwise lookup SCAC in table and if automated carrier flag is 'Y' set response to 'Y', else set to 'N'
Context: equipment and bill of lading information is processed
GIVEN
equipment and bill of lading information is processed
Applied to: 13:Apply Special ER Processing Rules
WHEN
applying special ER processing rules
THEN
if equipment status is 'E' and CCN key exists and BOL type is 23, override response code to 'Y'
Context: bill of lading information and automated carrier status is determined
GIVEN
bill of lading information and automated carrier status is determined
Applied to: 14:Create MBL Bill Segment
WHEN
creating MBL bill segment
THEN
populate MBL segment with SCAC, BOL/Waybill number, and determined response code
Context: all EDI segments are created successfully
GIVEN
all EDI segments are created successfully
Applied to: 15:Start EDI Send Function
WHEN
starting EDI send function
THEN
invoke EDI send function with transmission number and high-values security setting
Context: EDI processing is completed
GIVEN
EDI processing is completed
Applied to: 16:Start Log Update Function
WHEN
starting log update function
THEN
if FOREGROUND mode use foreground action code and transaction name, if BACKGROUND mode use background action code and transaction name, include user ID, current date and time
Context: An EDI 358 processing request is initiated
GIVEN
An EDI 358 processing request is initiated
Applied to: Valid Processing Mode?
WHEN
The system checks the processing mode flags
THEN
If none of the valid processing modes (foreground, background, or foreground-02) are set, the system sets wrong FB indicator and exits processing
Context: An ST header segment needs to be created for EDI transmission
GIVEN
An ST header segment needs to be created for EDI transmission
Applied to: Build ST Header Segment
WHEN
The system evaluates the post-emanifest flag in the train list
THEN
If post-emanifest is true, set destination to 'CACUSTOMS2-ST-O', otherwise set destination to 'CACUSTOMS-ST-O'
Context: A manifest transaction is being processed
GIVEN
A manifest transaction is being processed
Applied to: Set Transaction Purpose Code
WHEN
The operation type is ADD
THEN
Set the transaction purpose code to '00'
Applied to: Set Transaction Purpose Code
WHEN
The operation type is DELETE
THEN
Set the transaction purpose code to '03'
Context: A manifest transaction is being processed with operation type CHANGE
GIVEN
A manifest transaction is being processed with operation type CHANGE
Applied to: Set Transaction Purpose Code
WHEN
The system evaluates arrival date and post-emanifest flag
THEN
If arrival date is empty, set purpose code to '04' and mark as not amendment. If arrival date exists and post-emanifest is true, set purpose code to 'CO' and mark as amendment. If arrival date exists and post-emanifest is false, set purpose code to '04' and mark as not amendment
Context: Equipment processing needs to be performed for the manifest
GIVEN
Equipment processing needs to be performed for the manifest
Applied to: Determine EDI Version Processing
WHEN
The system evaluates the post-emanifest flag
THEN
If post-emanifest is true, use 5040 version processing (B231-LOAD-VID-MBL-5040), otherwise use 4040RAIL version processing (B230-LOAD-VID-MBL)
Context: Equipment is being processed in standard 4040RAIL version
GIVEN
Equipment is being processed in standard 4040RAIL version
Applied to: Set Equipment Load Status
WHEN
The system evaluates equipment load status and cargo key
THEN
If equipment is loaded, set status to 'L'. If equipment is empty, set status to 'E'. If equipment is loaded but has no cargo key, override status to 'E'
Context: Equipment is being processed in 5040 post-emanifest version
GIVEN
Equipment is being processed in 5040 post-emanifest version
Applied to: Set Equipment Load Status
WHEN
The system evaluates equipment load status and cargo key
THEN
If equipment is loaded OR (equipment is empty AND has cargo key), set status to 'L'. Otherwise set status to 'E'. If equipment is loaded but has no cargo key, override status to 'E'
Context: Equipment processing is being performed
GIVEN
Equipment processing is being performed
Applied to: Set Equipment Load Status
WHEN
The cargo CCN key starts with '6105I'
THEN
Override the equipment load status to 'E' (empty) regardless of other load status determinations
Context: Equipment has associated cargo information
GIVEN
Equipment has associated cargo information
Applied to: Set Location ID for Equipment
WHEN
The system evaluates the cargo in-transit status
THEN
If in-transit status is 'R', set location ID to '0000'. If in-transit status is 'T', set location ID to the manifest-to-trans-code. For any other status, set location ID to spaces
Context: Equipment is a possible flatcar type in post-emanifest processing
GIVEN
Equipment is a possible flatcar type in post-emanifest processing
Applied to: Handle Flat Car Processing
WHEN
The system checks subsequent equipment for container types
THEN
If any subsequent container equipment is loaded OR (empty with cargo key), set the flatcar status to 'L' (loaded)
Context: A Master Bill of Lading segment is being created
GIVEN
A Master Bill of Lading segment is being created
Applied to: Handle Special SCAC Assignment
WHEN
The system evaluates the CCN key prefix
THEN
If CCN key starts with '2156', set SCAC to 'CFFO', otherwise set SCAC to 'CPRS'
Context: Cargo information indicates in-transit status of 'R' (revenue)
GIVEN
Cargo information indicates in-transit status of 'R' (revenue)
Applied to: Handle Revenue Transit Status
WHEN
The system processes the Master Bill of Lading segment
THEN
Set BOL/Waybill to 'NA', set response code to 'N', and if post-emanifest, set exception code to '08'
Context: Cargo information indicates haulage rights exist
GIVEN
Cargo information indicates haulage rights exist
Applied to: Process Haulage Rights
WHEN
The system processes the Master Bill of Lading segment
THEN
Set SCAC to the haulage rights SCAC code and set response code to 'N'
Context: Processing is for the first equipment in an amendment scenario
GIVEN
Processing is for the first equipment in an amendment scenario
Applied to: Build Dummy MBL Segment
WHEN
No cargo key exists for the equipment but amendment processing is required
THEN
Create a dummy MBL segment with SCAC 'CPRS', BOL/Waybill 'NA', and exception code '06'
Context: Amendment processing is required for the first equipment or dummy MBL scenario
GIVEN
Amendment processing is required for the first equipment or dummy MBL scenario
Applied to: Build M13 Amendment Segment
WHEN
The system needs to document the amendment
THEN
Create M13 segment with SCAC 'CPRS', location ID from station code, BOL/WB number from train key, and amendment code '60'
Context: Processing is post-emanifest version and this is the first equipment
GIVEN
Processing is post-emanifest version and this is the first equipment
Applied to: Build N9 Reference Segment
WHEN
The system creates reference information
THEN
Create N9 segment with reference qualifier '76', reference number 'EDT', date from EDA with machine century, time from ETA with '00' seconds, and time code 'ES'
Context: A transmission number needs to be generated for EDI processing
GIVEN
A transmission number needs to be generated for EDI processing
Applied to: Generate Transmission Number
WHEN
The system evaluates the processing mode
THEN
If foreground mode, use prefix 147. If foreground-02 mode, use prefix 2. If background mode, use prefix 146. Append machine time to create unique transmission number
Context: Station information is required for manifest processing
GIVEN
Station information is required for manifest processing
Applied to: Retrieve Station Information
WHEN
The system looks up the station code in the station table
THEN
If station code is not found or returns '0000', generate error message indicating station not found. Otherwise, use the retrieved station information
Context: Equipment has a non-empty cargo CCN key
GIVEN
Equipment has a non-empty cargo CCN key
Applied to: Retrieve Cargo Information
WHEN
The system attempts to retrieve cargo information
THEN
If cargo root is not found, generate error message indicating cargo not found for CCN. Otherwise, set cargo flag to true and use retrieved cargo information
Context: A train processing request is initiated
GIVEN
A train processing request is initiated
Applied to: 1:Validate Foreground/Background Indicator
WHEN
The system checks the processing mode indicator
THEN
Processing continues if mode is foreground or background, otherwise sets wrong indicator error
Context: A train has an origin station code
GIVEN
A train has an origin station code
Applied to: 2:Check Station Code Validity
WHEN
The system looks up the station code in the SE table
THEN
Sets valid port flag to true if found, false if not found
Context: A train has equipment with US CCN keys
GIVEN
A train has equipment with US CCN keys
Applied to: 3:Count Bills of Lading
WHEN
The system evaluates each equipment's cargo type
THEN
Increments BOL count if in-bond type is 'TR' or if cargo is export type and port is valid
Context: A train has a valid port and train ID
GIVEN
A train has a valid port and train ID
Applied to: 4:Determine Train Type
WHEN
The system examines position 23 of the train ID
THEN
Sets train type to export if position 23 is 'T', otherwise sets to transit
Context: A train has been validated for processing mode and station code
GIVEN
A train has been validated for processing mode and station code
Applied to: Valid Bills or Valid Port?
WHEN
The system checks if BOL quantity is greater than 0 or if port is valid
THEN
Proceeds with EDI processing if either condition is true, otherwise skips to logging
Context: EDI processing is required
GIVEN
EDI processing is required
Applied to: 5:Generate Transmission Number
WHEN
The system generates a transmission number
THEN
Uses prefix 106 for foreground or 003 for background, combined with machine time
Context: A unique transmission number has been generated
GIVEN
A unique transmission number has been generated
Applied to: 6:Create EDI Root Segment
WHEN
The system creates the root segment
THEN
Inserts transmission record with transaction set '358' and generated transmission number
Context: EDI root segment has been created and train type determined
GIVEN
EDI root segment has been created and train type determined
Applied to: 7:Build M10 Manifest Header
WHEN
The system builds the M10 segment
THEN
Sets SCAC to 'CPRS', transport type to 'R', country to 'CA', manifest type to 'K' for export trains with valid port or 'S' for others, and application type '28' for export trains with valid port
Context: M10 segment has been created
GIVEN
M10 segment has been created
Applied to: 8:Build P4 Port Information
WHEN
The system builds the P4 segment
THEN
Includes origin station code, estimated arrival date with century calculation, BOL quantity, arrival time, and FIRMS code
Context: P4 segment has been created and equipment list exists
GIVEN
P4 segment has been created and equipment list exists
Applied to: 9:Process Equipment VID Segments
WHEN
The system processes each unique equipment ID
THEN
Creates VID segment with equipment type, initial, number (using cargo car number if available), and load/empty status (E if train shows H, L if train shows E but cargo weight > 1, otherwise train value)
Context: Equipment has associated cargo (US CCN key not spaces)
GIVEN
Equipment has associated cargo (US CCN key not spaces)
Applied to: 10:Process Bill of Lading MBL Segments
WHEN
The system creates MBL segment
THEN
Uses cargo-derived SCAC and BOL for valid ports, otherwise uses train list values, and sets automated response based on SCAC table lookup or special handling for empty cars with BOL type '23'
Context: Equipment has cargo with transport export type
GIVEN
Equipment has cargo with transport export type
Applied to: 11:Process N9 Reference Segments
WHEN
The system processes N9 segment
THEN
Creates N9 segment with reference qualifier 'IB' and entry number from cargo record
Context: Train has valid cargo (BOL quantity > 0) or valid port
GIVEN
Train has valid cargo (BOL quantity > 0) or valid port
Applied to: 12:Update Train Status to SENT
WHEN
The system updates train status
THEN
Sets train status to SENT, enables EDI sending flag, and updates both train database and train list
Context: Train has no valid cargo (BOL quantity = 0) and no valid port
GIVEN
Train has no valid cargo (BOL quantity = 0) and no valid port
Applied to: 13:Update Train Status to ACK
WHEN
The system updates train status
THEN
Sets train status to ACK and determines EDI action based on previous EDI send flag
Context: Train status has been set to ACK
GIVEN
Train status has been set to ACK
Applied to: Delete Required?
WHEN
The system checks previous EDI send flag
THEN
Sets delete required flag if previously marked to send EDI, otherwise sets do not send EDI flag
Context: EDI segments have been created successfully
GIVEN
EDI segments have been created successfully
Applied to: 15:Start EDI Send Function
WHEN
The system starts EDI send function
THEN
Calls EDI send function with high-value security and generated transmission number
Context: Train processing has completed
GIVEN
Train processing has completed
Applied to: 16:Log Transaction Activity
WHEN
The system logs the transaction
THEN
Uses foreground or background action codes, includes user ID, date, time, and appropriate message based on cargo validity
Context: Train is in background mode, has ACK status, AEI send is enabled, EDI is not being sent, and train ID position 23 is 'T'
GIVEN
Train is in background mode, has ACK status, AEI send is enabled, EDI is not being sent, and train ID position 23 is 'T'
Applied to: 17:Process AEI Train Send
WHEN
The system processes AEI train send
THEN
Initiates customs transaction with train information for AEI processing
Context: AEI train send is being processed
GIVEN
AEI train send is being processed
Applied to: 18:Load Car Information for CDN Send
WHEN
The system loads car information
THEN
Includes only non-container equipment with car initial, load/empty status, car number, and car kind classification
Context: Train has been marked as delete required
GIVEN
Train has been marked as delete required
Applied to: 19:Spawn Delete Transaction
WHEN
The system spawns delete transaction
THEN
Calls GCT1121E transaction with train ID and delete action code 'TD'
Context: MBL segment is being processed with a SCAC code
GIVEN
MBL segment is being processed with a SCAC code
Applied to: 21:Check Automated Carrier Status
WHEN
The system checks automated carrier status
THEN
Sets response to 'Y' if SCAC is 'CPRS' or if SCAC table indicates automated carrier, otherwise sets to 'N', with special 'Y' setting for empty cars with BOL type '23'
Context: Train processing has completed and EDI is not being sent
GIVEN
Train processing has completed and EDI is not being sent
Applied to: AEI Train Send Check?
WHEN
The system checks AEI train send eligibility
THEN
Proceeds with AEI processing if train is in background mode and meets AEI criteria
Context: EDI processing and logging have completed
GIVEN
EDI processing and logging have completed
Applied to: Has Valid Cargo?
WHEN
The system determines final status
THEN
Updates to SENT status if BOL quantity > 0 or port is valid, otherwise updates to ACK status
R-GCCE358-cbl-00020 (+2) File: GCCE358.cbl Validate Processing Mode Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Processing Mode':
  • Context - a train equipment processing request is initiated:
    For Validate Processing Mode - Check if the processing mode is foreground or background, return error if invalid:
    When the system checks the processing mode indicator, then if the mode is foreground or background, set success flag and continue processing, otherwise set wrong mode error flag.
  • Context - the processing mode has been validated as either foreground or background:
    For Set Success Flag - Continue Processing:
    When the validation check passes, then set the success flag to true to allow continued processing.
  • Context - the processing mode is neither foreground nor background:
    For Set Wrong Mode Error Flag:
    When the validation check fails, then set the wrong mode error flag to true to prevent continued processing.
👨‍💻 Technical ACs (Gherkin)
Context: A train equipment processing request is initiated
GIVEN
A train equipment processing request is initiated
Applied to: Validate Processing Mode - Check if the processing mode is foreground or background, return error if invalid
WHEN
The system checks the processing mode indicator
THEN
If the mode is foreground OR background, set success flag and continue processing, otherwise set wrong mode error flag
Context: The processing mode has been validated as either foreground or background
GIVEN
The processing mode has been validated as either foreground or background
Applied to: Set Success Flag - Continue Processing
WHEN
The validation check passes
THEN
Set the success flag to true to allow continued processing
Context: The processing mode is neither foreground nor background
GIVEN
The processing mode is neither foreground nor background
Applied to: Set Wrong Mode Error Flag
WHEN
The validation check fails
THEN
Set the wrong mode error flag to true to prevent continued processing
R-GCCS358C-cbl-00021 (+5) File: GCCS358C.cbl Initialize EDI 358 Transaction Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize EDI 358 Transaction':
  • Context - an edi 358 transaction is being initiated:
    For Save Current Program Name:
    When the system begins processing the transaction, then the current program name from the control block is saved to a temporary variable.
  • Context - the current program name has been saved:
    For Set Module Name in Control Block:
    When the edi 358 processing begins, then the module name is assigned to the program field in the control block.
  • Context - an edi 358 transaction is being processed:
    For Check Processing Mode:
    When the system checks the processing mode configuration, then the transaction must be set for foreground, background, or foreground-02 mode, otherwise processing is terminated with an error indicator.
  • Context - the processing mode validation has failed:
    For Set Wrong Mode Indicator:
    When none of the valid processing modes (foreground, background, foreground-02) are active, then the wrong fb indicator is set to true and processing is directed to exit.
  • Context - the processing mode validation has passed:
    For Continue to Main Processing:
    When a valid processing mode is confirmed, then the aa200-358-process routine is executed to handle the edi transaction processing.
  • Context - edi 358 processing has completed (either successfully or with error):
    For Restore Program Name:
    When the system is preparing to return control to the caller, then the saved program name is restored to the control block program field.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 358 transaction is being initiated
GIVEN
An EDI 358 transaction is being initiated
Applied to: Save Current Program Name
WHEN
The system begins processing the transaction
THEN
The current program name from the control block is saved to a temporary variable
Context: The current program name has been saved
GIVEN
The current program name has been saved
Applied to: Set Module Name in Control Block
WHEN
The EDI 358 processing begins
THEN
The module name is assigned to the program field in the control block
Context: An EDI 358 transaction is being processed
GIVEN
An EDI 358 transaction is being processed
Applied to: Check Processing Mode
WHEN
The system checks the processing mode configuration
THEN
The transaction must be set for foreground, background, or foreground-02 mode, otherwise processing is terminated with an error indicator
Context: The processing mode validation has failed
GIVEN
The processing mode validation has failed
Applied to: Set Wrong Mode Indicator
WHEN
None of the valid processing modes (foreground, background, foreground-02) are active
THEN
The wrong FB indicator is set to true and processing is directed to exit
Context: The processing mode validation has passed
GIVEN
The processing mode validation has passed
Applied to: Continue to Main Processing
WHEN
A valid processing mode is confirmed
THEN
The AA200-358-PROCESS routine is executed to handle the EDI transaction processing
Context: EDI 358 processing has completed (either successfully or with error)
GIVEN
EDI 358 processing has completed (either successfully or with error)
Applied to: Restore Program Name
WHEN
The system is preparing to return control to the caller
THEN
The saved program name is restored to the control block program field
R-GCCE358-cbl-00023 (+12) File: GCCE358.cblFile: GCCS358C.cblFile: GCCU358T.cbl Generate Transmission Number Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generate Transmission Number':
  • Context - a train equipment processing request is initiated:
    For Check Processing Mode:
    When the system checks the processing mode indicator, then if the mode is foreground, set transmission prefix to 106, otherwise if the mode is background, set transmission prefix to 110.
  • Context - the transmission prefix has been determined based on processing mode:
    For Get Current Machine Time:
    When the system needs to create a transmission number, then retrieve the current machine time and use it as the base transmission number.
  • Context - a transmission prefix (106 or 110) and machine time are available:
    For Combine Prefix + Machine Time to Create Transmission Number:
    When the system creates the transmission number, then combine the prefix with the machine time to form the complete transmission number.
  • Context - a transmission number has been generated:
    For Transmission Number Generated:
    When the system attempts to create a transmission record, then if the transmission number already exists, increment the number by 1 and retry until a unique number is found.
  • Context - the system is processing a train manifest transaction:
    For Set Prefix to 147 Foreground Mode:
    When the processing mode is set to foreground (gcws358c-foreground is true), then the transmission prefix should be set to 147.
    For Set Prefix to 2 Foreground-02 Mode:
    When the processing mode is set to foreground-02 (gcws358c-foreground-02 is true) and not foreground mode, then the transmission prefix should be set to 2.
    For Set Prefix to 146 Background Mode:
    When the processing mode is neither foreground nor foreground-02 (default to background), then the transmission prefix should be set to 146.
  • Context - a transmission prefix has been determined based on processing mode:
    For Get Current Machine Time:
    When the system needs to create a unique transmission number, then the current machine time should be retrieved and combined with the prefix to form the transmission number.
  • Context - a train manifest processing request is initiated:
    For Set Prefix to 106 Foreground Mode / Set Prefix to 003 Background Mode:
    When the system determines the processing mode (foreground or background), then the transmission prefix is set to 106 for foreground mode or 003 for background mode.
  • Context - a transmission prefix has been determined:
    For Get Current Machine Time as Base Number:
    When the system needs to create a unique transmission number, then the current machine time is retrieved and used as the base number component.
  • Context - a transmission prefix and machine time are available:
    For Combine Prefix + Time to Create Transmission Number:
    When the system constructs the transmission number, then the prefix and machine time are combined to form the complete transmission number.
  • Context - a complete transmission number has been generated:
    For Attempt to Insert Transmission Number:
    When the system attempts to insert the transmission record, then a new transmission record is created with transaction set '358' and the generated transmission number.
  • Context - a transmission number has been generated and insertion attempted:
    For Number Already Exists? / Increment Number by 1:
    When the transmission number already exists in the system, then the transmission number is incremented by 1 and insertion is attempted again until a unique number is found.
👨‍💻 Technical ACs (Gherkin)
Context: A train equipment processing request is initiated
GIVEN
A train equipment processing request is initiated
Applied to: Check Processing Mode
WHEN
The system checks the processing mode indicator
THEN
If the mode is foreground, set transmission prefix to 106, otherwise if the mode is background, set transmission prefix to 110
Context: The transmission prefix has been determined based on processing mode
GIVEN
The transmission prefix has been determined based on processing mode
Applied to: Get Current Machine Time
WHEN
The system needs to create a transmission number
THEN
Retrieve the current machine time and use it as the base transmission number
Context: A transmission prefix (106 or 110) and machine time are available
GIVEN
A transmission prefix (106 or 110) and machine time are available
Applied to: Combine Prefix + Machine Time to Create Transmission Number
WHEN
The system creates the transmission number
THEN
Combine the prefix with the machine time to form the complete transmission number
Context: A transmission number has been generated
GIVEN
A transmission number has been generated
Applied to: Transmission Number Generated
WHEN
The system attempts to create a transmission record
THEN
If the transmission number already exists, increment the number by 1 and retry until a unique number is found
Context: The system is processing a train manifest transaction
GIVEN
The system is processing a train manifest transaction
Applied to: Set Prefix to 147 Foreground Mode
WHEN
The processing mode is set to foreground (GCWS358C-FOREGROUND is true)
THEN
The transmission prefix should be set to 147
Applied to: Set Prefix to 2 Foreground-02 Mode
WHEN
The processing mode is set to foreground-02 (GCWS358C-FOREGROUND-02 is true) and not foreground mode
THEN
The transmission prefix should be set to 2
Applied to: Set Prefix to 146 Background Mode
WHEN
The processing mode is neither foreground nor foreground-02 (default to background)
THEN
The transmission prefix should be set to 146
Context: A transmission prefix has been determined based on processing mode
GIVEN
A transmission prefix has been determined based on processing mode
Applied to: Get Current Machine Time
WHEN
The system needs to create a unique transmission number
THEN
The current machine time should be retrieved and combined with the prefix to form the transmission number
Context: A train manifest processing request is initiated
GIVEN
A train manifest processing request is initiated
Applied to: Set Prefix to 106 Foreground Mode / Set Prefix to 003 Background Mode
WHEN
The system determines the processing mode (foreground or background)
THEN
The transmission prefix is set to 106 for foreground mode or 003 for background mode
Context: A transmission prefix has been determined
GIVEN
A transmission prefix has been determined
Applied to: Get Current Machine Time as Base Number
WHEN
The system needs to create a unique transmission number
THEN
The current machine time is retrieved and used as the base number component
Context: A transmission prefix and machine time are available
GIVEN
A transmission prefix and machine time are available
Applied to: Combine Prefix + Time to Create Transmission Number
WHEN
The system constructs the transmission number
THEN
The prefix and machine time are combined to form the complete transmission number
Context: A complete transmission number has been generated
GIVEN
A complete transmission number has been generated
Applied to: Attempt to Insert Transmission Number
WHEN
The system attempts to insert the transmission record
THEN
A new transmission record is created with transaction set '358' and the generated transmission number
Context: A transmission number has been generated and insertion attempted
GIVEN
A transmission number has been generated and insertion attempted
Applied to: Number Already Exists? / Increment Number by 1
WHEN
The transmission number already exists in the system
THEN
The transmission number is incremented by 1 and insertion is attempted again until a unique number is found
R-GCCU358T-cbl-00024 (+3) File: GCCU358T.cbl Validate Foreground/Background Indicator Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Foreground/Background Indicator':
  • Context - a processing request is received with a foreground/background indicator:
    For Is Mode Foreground?:
    When the system checks if gcwu358t-foreground is true, then the system identifies the mode as foreground and allows continued processing.
  • Context - a processing request is not in foreground mode:
    For Is Mode Background?:
    When the system checks if gcwu358t-background is true, then the system identifies the mode as background and allows continued processing.
  • Context - the processing mode has been validated as either foreground or background:
    For Set Processing Mode as Valid:
    When gcwu358t-foreground or gcwu358t-background is true, then the system proceeds with edi processing workflow including information gathering, root processing, and equipment processing.
  • Context - a processing request is received with an invalid foreground/background indicator:
    For Set Wrong FB Indicator Error:
    When the processing mode is neither gcwu358t-foreground nor gcwu358t-background, then the system sets gcwu358t-wrong-fb-ind to true and stops processing.
👨‍💻 Technical ACs (Gherkin)
Context: A processing request is received with a foreground/background indicator
GIVEN
A processing request is received with a foreground/background indicator
Applied to: Is Mode Foreground?
WHEN
The system checks if GCWU358T-FOREGROUND is true
THEN
The system identifies the mode as foreground and allows continued processing
Context: A processing request is not in foreground mode
GIVEN
A processing request is not in foreground mode
Applied to: Is Mode Background?
WHEN
The system checks if GCWU358T-BACKGROUND is true
THEN
The system identifies the mode as background and allows continued processing
Context: The processing mode has been validated as either foreground or background
GIVEN
The processing mode has been validated as either foreground or background
Applied to: Set Processing Mode as Valid
WHEN
GCWU358T-FOREGROUND OR GCWU358T-BACKGROUND is true
THEN
The system proceeds with EDI processing workflow including information gathering, root processing, and equipment processing
Context: A processing request is received with an invalid foreground/background indicator
GIVEN
A processing request is received with an invalid foreground/background indicator
Applied to: Set Wrong FB Indicator Error
WHEN
The processing mode is neither GCWU358T-FOREGROUND nor GCWU358T-BACKGROUND
THEN
The system sets GCWU358T-WRONG-FB-IND to TRUE and stops processing
R-GCCE358-cbl-00027 (+6) File: GCCE358.cbl Insert EDI Root Segment Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Insert EDI Root Segment':
  • Context - an edi transmission needs to be created:
    For Initialize Root Segment Structure:
    When the root segment creation process begins, then the a9rt transmission segment structure is initialized to empty values.
  • Context - a transmission number has been generated based on machine time:
    For Set Transmission Number from Generated Value:
    When creating the edi root segment, then the transmission number is assigned to the a9rt transmission number field.
  • Context - an edi root segment is being created for train equipment data:
    For Set Transaction Set to '358':
    When setting the transaction set identifier, then the transaction set code is set to '358'.
  • Context - a complete edi root segment with transmission number and transaction set:
    For Attempt to Insert Root Segment into EDI Database:
    When inserting the segment into the edi database, then the system attempts to insert the a9rt segment using database insert operation.
  • Context - an edi root segment insertion has been attempted:
    For Insert Successful?:
    When the database insert operation completes, then if the status code is not blank, the insertion failed due to duplicate transmission number.
  • Context - an edi root segment insertion failed due to duplicate transmission number:
    For Increment Transmission Number by 1:
    When resolving the transmission number collision, then the transmission number is incremented by 1 and assigned to the root segment.
  • Context - a transmission number collision has been detected and resolved by incrementing:
    For Root Segment Successfully Created:
    When attempting to insert the root segment again, then the system continues the insertion retry loop until the status code is blank indicating success.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI transmission needs to be created
GIVEN
An EDI transmission needs to be created
Applied to: Initialize Root Segment Structure
WHEN
The root segment creation process begins
THEN
The A9RT transmission segment structure is initialized to empty values
Context: A transmission number has been generated based on machine time
GIVEN
A transmission number has been generated based on machine time
Applied to: Set Transmission Number from Generated Value
WHEN
Creating the EDI root segment
THEN
The transmission number is assigned to the A9RT transmission number field
Context: An EDI root segment is being created for train equipment data
GIVEN
An EDI root segment is being created for train equipment data
Applied to: Set Transaction Set to '358'
WHEN
Setting the transaction set identifier
THEN
The transaction set code is set to '358'
Context: A complete EDI root segment with transmission number and transaction set
GIVEN
A complete EDI root segment with transmission number and transaction set
Applied to: Attempt to Insert Root Segment into EDI Database
WHEN
Inserting the segment into the EDI database
THEN
The system attempts to insert the A9RT segment using database insert operation
Context: An EDI root segment insertion has been attempted
GIVEN
An EDI root segment insertion has been attempted
Applied to: Insert Successful?
WHEN
The database insert operation completes
THEN
If the status code is not blank, the insertion failed due to duplicate transmission number
Context: An EDI root segment insertion failed due to duplicate transmission number
GIVEN
An EDI root segment insertion failed due to duplicate transmission number
Applied to: Increment Transmission Number by 1
WHEN
Resolving the transmission number collision
THEN
The transmission number is incremented by 1 and assigned to the root segment
Context: A transmission number collision has been detected and resolved by incrementing
GIVEN
A transmission number collision has been detected and resolved by incrementing
Applied to: Root Segment Successfully Created
WHEN
Attempting to insert the root segment again
THEN
The system continues the insertion retry loop until the status code is blank indicating success
R-GCCU358T-cbl-00028 (+4) File: GCCU358T.cbl Check Station Code Validity Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Station Code Validity':
  • Context - a train record with an origin station code in field p401-m1302-us-from-sc:
    For Check Station Code Validity - Validate the station code against the SE table to determine if it's a valid port:
    When the system performs a lookup in the se table using the station code as the search key, then the system sets a valid port indicator flag to true if the station code is found in the se table, otherwise sets the flag to false.
  • Context - a train record requiring station code validation:
    For Setup SE Table Lookup Parameters:
    When the system initiates the se table lookup process, then the system sets the function code to 'gu', clears all key values and flags, sets table id to 'se', and moves the train's origin station code to the search key field.
  • Context - se table lookup parameters are properly configured with station code:
    For Query SE Table with Station Code:
    When the system calls the table access program gcctbio, then the system executes the query and returns a status code indicating whether the station code was found.
  • Context - an se table lookup has been completed with a return status:
    For Set Valid Port Flag:
    When the return flag equals '0' indicating successful record retrieval, then the system sets the valid port switch to true to indicate the station is a recognized valid port.
    For Set Invalid Port Flag:
    When the return flag does not equal '0' indicating the record was not found, then the system sets the valid port switch to false to indicate the station is not a recognized valid port.
👨‍💻 Technical ACs (Gherkin)
Context: A train record with an origin station code in field P401-M1302-US-FROM-SC
GIVEN
A train record with an origin station code in field P401-M1302-US-FROM-SC
Applied to: Check Station Code Validity - Validate the station code against the SE table to determine if it's a valid port
WHEN
The system performs a lookup in the SE table using the station code as the search key
THEN
The system sets a valid port indicator flag to TRUE if the station code is found in the SE table, otherwise sets the flag to FALSE
Context: A train record requiring station code validation
GIVEN
A train record requiring station code validation
Applied to: Setup SE Table Lookup Parameters
WHEN
The system initiates the SE table lookup process
THEN
The system sets the function code to 'GU', clears all key values and flags, sets table ID to 'SE', and moves the train's origin station code to the search key field
Context: SE table lookup parameters are properly configured with station code
GIVEN
SE table lookup parameters are properly configured with station code
Applied to: Query SE Table with Station Code
WHEN
The system calls the table access program GCCTBIO
THEN
The system executes the query and returns a status code indicating whether the station code was found
Context: An SE table lookup has been completed with a return status
GIVEN
An SE table lookup has been completed with a return status
Applied to: Set Valid Port Flag
WHEN
The return flag equals '0' indicating successful record retrieval
THEN
The system sets the valid port switch to TRUE to indicate the station is a recognized valid port
Applied to: Set Invalid Port Flag
WHEN
The return flag does not equal '0' indicating the record was not found
THEN
The system sets the valid port switch to FALSE to indicate the station is not a recognized valid port
R-GCCS358C-cbl-00031 (+7) File: GCCS358C.cbl Create A9RT Root Segment Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Create A9RT Root Segment':
  • Context - a transmission counter needs to be generated for edi processing:
    For Set Prefix 147 for Foreground:
    When the processing mode is foreground, then the transmission prefix should be set to 147.
    For Set Prefix 2 for Foreground-02:
    When the processing mode is foreground-02, then the transmission prefix should be set to 2.
    For Set Prefix 146 for Background:
    When the processing mode is background, then the transmission prefix should be set to 146.
  • Context - a transmission prefix has been determined based on processing mode:
    For Use Machine Time as Counter:
    When a transmission number needs to be generated, then the machine time should be used as the transmission number base.
  • Context - a transmission number has been generated:
    For Initialize A9RT Transmission Segment:
    When creating a root transmission segment, then the a9rt transmission segment should be initialized to clear any previous data.
  • Context - a root transmission segment has been initialized:
    For Set Transaction Set to 358:
    When setting up the transmission for customs manifest data, then the transaction set should be set to '358'.
  • Context - a root transmission segment insertion has failed due to duplicate key:
    For Increment Transmission Number:
    When the transmission number already exists in the database, then the transmission number should be incremented by 1 and insertion should be retried.
  • Context - a complete root transmission segment with transmission number and transaction set:
    For Insert Root Segment to Database:
    When the segment is ready for database storage, then the root segment should be inserted into the gca9rt transmission database.
👨‍💻 Technical ACs (Gherkin)
Context: A transmission counter needs to be generated for EDI processing
GIVEN
A transmission counter needs to be generated for EDI processing
Applied to: Set Prefix 147 for Foreground
WHEN
The processing mode is foreground
THEN
The transmission prefix should be set to 147
Applied to: Set Prefix 2 for Foreground-02
WHEN
The processing mode is foreground-02
THEN
The transmission prefix should be set to 2
Applied to: Set Prefix 146 for Background
WHEN
The processing mode is background
THEN
The transmission prefix should be set to 146
Context: A transmission prefix has been determined based on processing mode
GIVEN
A transmission prefix has been determined based on processing mode
Applied to: Use Machine Time as Counter
WHEN
A transmission number needs to be generated
THEN
The machine time should be used as the transmission number base
Context: A transmission number has been generated
GIVEN
A transmission number has been generated
Applied to: Initialize A9RT Transmission Segment
WHEN
Creating a root transmission segment
THEN
The A9RT transmission segment should be initialized to clear any previous data
Context: A root transmission segment has been initialized
GIVEN
A root transmission segment has been initialized
Applied to: Set Transaction Set to 358
WHEN
Setting up the transmission for customs manifest data
THEN
The transaction set should be set to '358'
Context: A root transmission segment insertion has failed due to duplicate key
GIVEN
A root transmission segment insertion has failed due to duplicate key
Applied to: Increment Transmission Number
WHEN
The transmission number already exists in the database
THEN
The transmission number should be incremented by 1 and insertion should be retried
Context: A complete root transmission segment with transmission number and transaction set
GIVEN
A complete root transmission segment with transmission number and transaction set
Applied to: Insert Root Segment to Database
WHEN
The segment is ready for database storage
THEN
The root segment should be inserted into the GCA9RT transmission database
R-GCCU358T-cbl-00033 (+8) File: GCCU358T.cbl Count Bills of Lading Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Count Bills of Lading':
  • Context - the system is starting to count bills of lading for a train:
    For Initialize BOL Count to Zero:
    When the counting process begins, then the bol counter is set to zero.
  • Context - a train list contains multiple equipment items:
    For Loop Through Each Equipment Item:
    When processing bills of lading, then the system iterates through each equipment item from position 1 to the total equipment quantity.
  • Context - an equipment item is being processed:
    For Equipment Has Cargo Key?:
    When checking for associated cargo, then if the us ccn key is not spaces, the equipment has cargo; otherwise it does not.
  • Context - an equipment item has a valid cargo key:
    For Read Cargo Information from Database:
    When cargo information is needed, then the system retrieves cargo details using the us ccn key.
  • Context - a cargo lookup has been performed:
    For Cargo Found?:
    When validating the lookup result, then if cargo is found, continue processing; otherwise skip to next equipment.
  • Context - cargo information is available for an equipment item:
    For Check Bond Type and Export Criteria:
    When determining if cargo qualifies for bol counting, then cargo qualifies if in-bond type is 'tr' or if cargo type is export/returned us goods/empty residue/transport export/immediate export/multi-port and the port is valid.
  • Context - cargo meets the bond type and export criteria:
    For Increment BOL Count:
    When processing qualified cargo, then the bol count is increased by one.
  • Context - cargo qualifies for bol counting and the port is valid:
    For Set Train Type to Export:
    When processing qualified cargo, then the train type indicator is set to export.
  • Context - an equipment item has been processed:
    For More Equipment to Process?:
    When checking for continuation, then if the current equipment index is less than the total equipment quantity, continue processing; otherwise end the loop.
👨‍💻 Technical ACs (Gherkin)
Context: The system is starting to count bills of lading for a train
GIVEN
The system is starting to count bills of lading for a train
Applied to: Initialize BOL Count to Zero
WHEN
The counting process begins
THEN
The BOL counter is set to zero
Context: A train list contains multiple equipment items
GIVEN
A train list contains multiple equipment items
Applied to: Loop Through Each Equipment Item
WHEN
Processing bills of lading
THEN
The system iterates through each equipment item from position 1 to the total equipment quantity
Context: An equipment item is being processed
GIVEN
An equipment item is being processed
Applied to: Equipment Has Cargo Key?
WHEN
Checking for associated cargo
THEN
If the US CCN key is not spaces, the equipment has cargo; otherwise it does not
Context: An equipment item has a valid cargo key
GIVEN
An equipment item has a valid cargo key
Applied to: Read Cargo Information from Database
WHEN
Cargo information is needed
THEN
The system retrieves cargo details using the US CCN key
Context: A cargo lookup has been performed
GIVEN
A cargo lookup has been performed
Applied to: Cargo Found?
WHEN
Validating the lookup result
THEN
If cargo is found, continue processing; otherwise skip to next equipment
Context: Cargo information is available for an equipment item
GIVEN
Cargo information is available for an equipment item
Applied to: Check Bond Type and Export Criteria
WHEN
Determining if cargo qualifies for BOL counting
THEN
Cargo qualifies if in-bond type is 'TR' OR if cargo type is export/returned US goods/empty residue/transport export/immediate export/multi-port AND the port is valid
Context: Cargo meets the bond type and export criteria
GIVEN
Cargo meets the bond type and export criteria
Applied to: Increment BOL Count
WHEN
Processing qualified cargo
THEN
The BOL count is increased by one
Context: Cargo qualifies for BOL counting and the port is valid
GIVEN
Cargo qualifies for BOL counting and the port is valid
Applied to: Set Train Type to Export
WHEN
Processing qualified cargo
THEN
The train type indicator is set to export
Context: An equipment item has been processed
GIVEN
An equipment item has been processed
Applied to: More Equipment to Process?
WHEN
Checking for continuation
THEN
If the current equipment index is less than the total equipment quantity, continue processing; otherwise end the loop
R-GCCE358-cbl-00034 (+5) File: GCCE358.cbl Count Bill of Lading Records Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Count Bill of Lading Records':
  • Context - the system is ready to count bill of lading records:
    For Initialize Bill of Lading Counter to Zero:
    When the counting process begins, then the bill of lading counter is set to zero.
  • Context - equipment records are available for processing:
    For Start Equipment Loop - Index = 1:
    When the equipment loop begins, then the equipment index is set to 1 to start from the first record.
  • Context - an equipment index and total equipment quantity are available:
    For More Equipment Records to Process?:
    When the system checks for more records to process, then continue processing if index is less than or equal to total equipment quantity, otherwise stop processing.
  • Context - an equipment record at the current index position:
    For Equipment Has US CCN Key?:
    When the system evaluates the equipment's us ccn key field, then if the us ccn key is not equal to spaces, the equipment has a valid key, otherwise it does not.
  • Context - an equipment record with a valid us ccn key (not spaces):
    For Increment Bill of Lading Counter:
    When the system processes this equipment record, then the bill of lading counter is increased by 1.
  • Context - the current equipment record has been processed:
    For Move to Next Equipment Record:
    When the system moves to the next record, then the equipment index is incremented by 1.
👨‍💻 Technical ACs (Gherkin)
Context: The system is ready to count bill of lading records
GIVEN
The system is ready to count bill of lading records
Applied to: Initialize Bill of Lading Counter to Zero
WHEN
The counting process begins
THEN
The bill of lading counter is set to zero
Context: Equipment records are available for processing
GIVEN
Equipment records are available for processing
Applied to: Start Equipment Loop - Index = 1
WHEN
The equipment loop begins
THEN
The equipment index is set to 1 to start from the first record
Context: An equipment index and total equipment quantity are available
GIVEN
An equipment index and total equipment quantity are available
Applied to: More Equipment Records to Process?
WHEN
The system checks for more records to process
THEN
Continue processing if index is less than or equal to total equipment quantity, otherwise stop processing
Context: An equipment record at the current index position
GIVEN
An equipment record at the current index position
Applied to: Equipment Has US CCN Key?
WHEN
The system evaluates the equipment's US CCN key field
THEN
If the US CCN key is not equal to spaces, the equipment has a valid key, otherwise it does not
Context: An equipment record with a valid US CCN key (not spaces)
GIVEN
An equipment record with a valid US CCN key (not spaces)
Applied to: Increment Bill of Lading Counter
WHEN
The system processes this equipment record
THEN
The bill of lading counter is increased by 1
Context: The current equipment record has been processed
GIVEN
The current equipment record has been processed
Applied to: Move to Next Equipment Record
WHEN
The system moves to the next record
THEN
The equipment index is incremented by 1
R-GCCS358C-cbl-00039 (+4) File: GCCS358C.cbl Build ST Header Segment Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build ST Header Segment':
  • Context - a new edi 358 transaction needs to be created:
    For Initialize ST Segment Structure:
    When the st segment initialization process begins, then the st segment definition structure is initialized and the st identifier is set to 'st'.
  • Context - an st segment is being prepared for transmission:
    For Set Transaction Code to '358':
    When the transaction code needs to be assigned, then the transaction code is set to '358' to identify this as a customs manifest transaction.
  • Context - an st segment is being created for transmission:
    For Check Post-Emanifest Flag:
    When the post-emanifest flag is evaluated, then if post-emanifest is true, the destination is set to 'cacustoms2-st-o', otherwise the destination is set to 'cacustoms-st-o'.
  • Context - an st segment has been fully populated with required data:
    For Prepare Segment for Transmission:
    When the segment needs to be prepared for database insertion, then the st segment data is moved to the transmission data structure and the dependent segment is initialized.
  • Context - an st segment is prepared for database insertion:
    For Insert ST Segment into Database:
    When the database insertion process is invoked, then the st segment is inserted into the gca9dp transmission database with proper sequencing.
👨‍💻 Technical ACs (Gherkin)
Context: A new EDI 358 transaction needs to be created
GIVEN
A new EDI 358 transaction needs to be created
Applied to: Initialize ST Segment Structure
WHEN
The ST segment initialization process begins
THEN
The ST segment definition structure is initialized and the ST identifier is set to 'ST'
Context: An ST segment is being prepared for transmission
GIVEN
An ST segment is being prepared for transmission
Applied to: Set Transaction Code to '358'
WHEN
The transaction code needs to be assigned
THEN
The transaction code is set to '358' to identify this as a customs manifest transaction
Context: An ST segment is being created for transmission
GIVEN
An ST segment is being created for transmission
Applied to: Check Post-Emanifest Flag
WHEN
The post-emanifest flag is evaluated
THEN
If post-emanifest is true, the destination is set to 'CACUSTOMS2-ST-O', otherwise the destination is set to 'CACUSTOMS-ST-O'
Context: An ST segment has been fully populated with required data
GIVEN
An ST segment has been fully populated with required data
Applied to: Prepare Segment for Transmission
WHEN
The segment needs to be prepared for database insertion
THEN
The ST segment data is moved to the transmission data structure and the dependent segment is initialized
Context: An ST segment is prepared for database insertion
GIVEN
An ST segment is prepared for database insertion
Applied to: Insert ST Segment into Database
WHEN
The database insertion process is invoked
THEN
The ST segment is inserted into the GCA9DP transmission database with proper sequencing
R-GCCE358-cbl-00040 (+12) File: GCCE358.cbl Process M10 Manifest Header Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process M10 Manifest Header':
  • Context - the system needs to create a new m10 manifest segment:
    For Initialize M10 Segment Structure:
    When m10 manifest processing begins, then the m10 segment structure is initialized to clear any previous data.
  • Context - an m10 manifest segment is being created:
    For Set M10 Identifier:
    When the segment identifier needs to be set, then the identifier is set to 'm10'.
    For Set Transport Type Code to 'R' for Rail:
    When the transport type code needs to be assigned, then the transport type code is set to 'r' to indicate rail transport.
    For Set Manifest Type Code to 'S' for Standard:
    When the manifest type code needs to be assigned, then the manifest type code is set to 's' for standard manifest.
    For Set Conditional Response Code to 'Y':
    When the conditional response code needs to be assigned, then the conditional response code is set to 'y' to indicate response is required.
  • Context - an m10 manifest segment is being created for rail transport:
    For Set SCAC Code to 'CPRS':
    When the scac code needs to be assigned, then the scac code is set to 'cprs' for canadian pacific railway.
  • Context - an m10 manifest segment is being created for canadian rail operations:
    For Set Country Code to 'CA' for Canada:
    When the country code needs to be assigned, then the country code is set to 'ca' for canada.
  • Context - an m10 manifest segment is being created and customer train id is available:
    For Set Vessel Name from Train ID:
    When the vessel name needs to be assigned, then the vessel name is set to the customer train id from the train list.
    For Set Record Number from Train ID:
    When the record number needs to be assigned, then the record number is set to the customer train id from the train list.
  • Context - an m10 manifest segment is being created and train creation date is available:
    For Set Voyage Number from Train Creation Date:
    When the voyage number needs to be assigned, then the voyage number is set to the train creation date from the train list.
  • Context - an m10 manifest segment is being created and bill of lading count is calculated:
    For Set Quantity from Bill of Lading Count:
    When the quantity needs to be assigned, then the quantity is set to the total count of bills of lading.
  • Context - an m10 manifest segment is being created for train operations:
    For Set Record Type to 'TRAIN':
    When the record type needs to be assigned, then the record type is set to 'train'.
  • Context - an m10 manifest segment is fully populated with all required data:
    For Insert M10 Segment into EDI Database:
    When the segment needs to be stored for edi transmission, then the m10 segment is inserted into the edi database with proper sequence numbering.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to create a new M10 manifest segment
GIVEN
The system needs to create a new M10 manifest segment
Applied to: Initialize M10 Segment Structure
WHEN
M10 manifest processing begins
THEN
The M10 segment structure is initialized to clear any previous data
Context: An M10 manifest segment is being created
GIVEN
An M10 manifest segment is being created
Applied to: Set M10 Identifier
WHEN
The segment identifier needs to be set
THEN
The identifier is set to 'M10'
Applied to: Set Transport Type Code to 'R' for Rail
WHEN
The transport type code needs to be assigned
THEN
The transport type code is set to 'R' to indicate rail transport
Applied to: Set Manifest Type Code to 'S' for Standard
WHEN
The manifest type code needs to be assigned
THEN
The manifest type code is set to 'S' for standard manifest
Applied to: Set Conditional Response Code to 'Y'
WHEN
The conditional response code needs to be assigned
THEN
The conditional response code is set to 'Y' to indicate response is required
Context: An M10 manifest segment is being created for rail transport
GIVEN
An M10 manifest segment is being created for rail transport
Applied to: Set SCAC Code to 'CPRS'
WHEN
The SCAC code needs to be assigned
THEN
The SCAC code is set to 'CPRS' for Canadian Pacific Railway
Context: An M10 manifest segment is being created for Canadian rail operations
GIVEN
An M10 manifest segment is being created for Canadian rail operations
Applied to: Set Country Code to 'CA' for Canada
WHEN
The country code needs to be assigned
THEN
The country code is set to 'CA' for Canada
Context: An M10 manifest segment is being created and customer train ID is available
GIVEN
An M10 manifest segment is being created and customer train ID is available
Applied to: Set Vessel Name from Train ID
WHEN
The vessel name needs to be assigned
THEN
The vessel name is set to the customer train ID from the train list
Applied to: Set Record Number from Train ID
WHEN
The record number needs to be assigned
THEN
The record number is set to the customer train ID from the train list
Context: An M10 manifest segment is being created and train creation date is available
GIVEN
An M10 manifest segment is being created and train creation date is available
Applied to: Set Voyage Number from Train Creation Date
WHEN
The voyage number needs to be assigned
THEN
The voyage number is set to the train creation date from the train list
Context: An M10 manifest segment is being created and bill of lading count is calculated
GIVEN
An M10 manifest segment is being created and bill of lading count is calculated
Applied to: Set Quantity from Bill of Lading Count
WHEN
The quantity needs to be assigned
THEN
The quantity is set to the total count of bills of lading
Context: An M10 manifest segment is being created for train operations
GIVEN
An M10 manifest segment is being created for train operations
Applied to: Set Record Type to 'TRAIN'
WHEN
The record type needs to be assigned
THEN
The record type is set to 'TRAIN'
Context: An M10 manifest segment is fully populated with all required data
GIVEN
An M10 manifest segment is fully populated with all required data
Applied to: Insert M10 Segment into EDI Database
WHEN
The segment needs to be stored for EDI transmission
THEN
The M10 segment is inserted into the EDI database with proper sequence numbering
R-GCCU358T-cbl-00042 (+2) File: GCCU358T.cbl Determine Train Type Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Train Type':
  • Context - a train record exists with a valid train id in the train list:
    For Check 23rd Character of Train ID:
    When the system examines the 23rd character of the train id (m1005-us-cust-train-id), then if the 23rd character equals 't', the train is classified as an export train, otherwise it is classified as a transit train.
  • Context - a train record exists and the system is determining train type for a valid port:
    For Set Train Type as Export Train:
    When the 23rd character of the train id equals 't', then the system sets the train type indicator to export train (ws-export-train).
    For Set Train Type as Transit Train:
    When the 23rd character of the train id does not equal 't', then the system sets the train type indicator to transit train (ws-transit-train).
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists with a valid train ID in the train list
GIVEN
A train record exists with a valid train ID in the train list
Applied to: Check 23rd Character of Train ID
WHEN
The system examines the 23rd character of the train ID (M1005-US-CUST-TRAIN-ID)
THEN
If the 23rd character equals 'T', the train is classified as an export train, otherwise it is classified as a transit train
Context: A train record exists and the system is determining train type for a valid port
GIVEN
A train record exists and the system is determining train type for a valid port
Applied to: Set Train Type as Export Train
WHEN
The 23rd character of the train ID equals 'T'
THEN
The system sets the train type indicator to export train (WS-EXPORT-TRAIN)
Applied to: Set Train Type as Transit Train
WHEN
The 23rd character of the train ID does not equal 'T'
THEN
The system sets the train type indicator to transit train (WS-TRANSIT-TRAIN)
R-GCCS358C-cbl-00044 (+15) File: GCCS358C.cbl Build M10 Manifest Segment Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build M10 Manifest Segment':
  • Context - a new m10 manifest segment needs to be created:
    For Initialize M10 Segment Structure:
    When the system starts building the m10 segment, then the m10 segment is initialized and the identifier is set to 'm10'.
  • Context - an m10 manifest segment is being created:
    For Set SCAC Code to 'CPRS':
    When the scac code needs to be assigned, then the scac code is set to 'cprs'.
    For Set Country Code to 'US':
    When the country code needs to be assigned, then the country code is set to 'us'.
    For Set Manifest Type Code to 'S':
    When the manifest type code needs to be assigned, then the manifest type code is set to 's' for ship manifest.
    For Set Application Type to '27':
    When the application type needs to be assigned, then the application type is set to '27'.
  • Context - an m10 manifest segment is being created for rail transport:
    For Set Transport Type Code to 'R':
    When the transport type code needs to be assigned, then the transport type code is set to 'r' for rail.
  • Context - an m10 manifest segment is being created and a train key exists:
    For Set Vessel Name from Train Key:
    When the vessel name needs to be assigned, then the vessel name is set to the value from the train key.
  • Context - an m10 manifest segment is being created and current machine date is available:
    For Convert Current Date to Julian Format:
    When the flight/voyage number needs to be calculated, then the system converts the current date from gregorian to julian format using date conversion service.
  • Context - the current date has been converted to julian format:
    For Set Flight/Voyage Number from Julian Date:
    When the flight/voyage number needs to be assigned, then the flight/voyage number is set to the julian date value.
  • Context - an m10 manifest segment is being created for train transport:
    For Set Reference Number to 'TRAIN':
    When the reference number needs to be assigned, then the reference number is set to 'train'.
  • Context - an m10 manifest segment is being created and the operation type is add:
    For Set Purpose Code to '00' - Add:
    When the transaction purpose code needs to be determined, then the purpose code is set to '00'.
  • Context - an m10 manifest segment is being created and the operation type is change and the arrival date is empty:
    For Set Purpose Code to '04' - Change:
    When the transaction purpose code needs to be determined, then the purpose code is set to '04' and amendment flag is set to false.
  • Context - an m10 manifest segment is being created and the operation type is change and arrival date is not empty and it's a post-emanifest transaction:
    For Set Purpose Code to 'CO' - Amendment:
    When the transaction purpose code needs to be determined, then the purpose code is set to 'co' and amendment flag is set to true.
  • Context - an m10 manifest segment is being created and the operation type is change and arrival date is not empty and it's not a post-emanifest transaction:
    For Set Purpose Code to '04' - Change:
    When the transaction purpose code needs to be determined, then the purpose code is set to '04' and amendment flag is set to false.
  • Context - an m10 manifest segment is being created and the operation type is delete:
    For Set Purpose Code to '03' - Delete:
    When the transaction purpose code needs to be determined, then the purpose code is set to '03'.
  • Context - an m10 manifest segment has been fully populated with all required data:
    For Insert M10 Segment into Transmission:
    When the segment needs to be added to the transmission, then the m10 segment is inserted into the transmission data queue.
👨‍💻 Technical ACs (Gherkin)
Context: A new M10 manifest segment needs to be created
GIVEN
A new M10 manifest segment needs to be created
Applied to: Initialize M10 Segment Structure
WHEN
The system starts building the M10 segment
THEN
The M10 segment is initialized and the identifier is set to 'M10'
Context: An M10 manifest segment is being created
GIVEN
An M10 manifest segment is being created
Applied to: Set SCAC Code to 'CPRS'
WHEN
The SCAC code needs to be assigned
THEN
The SCAC code is set to 'CPRS'
Applied to: Set Country Code to 'US'
WHEN
The country code needs to be assigned
THEN
The country code is set to 'US'
Applied to: Set Manifest Type Code to 'S'
WHEN
The manifest type code needs to be assigned
THEN
The manifest type code is set to 'S' for ship manifest
Applied to: Set Application Type to '27'
WHEN
The application type needs to be assigned
THEN
The application type is set to '27'
Context: An M10 manifest segment is being created for rail transport
GIVEN
An M10 manifest segment is being created for rail transport
Applied to: Set Transport Type Code to 'R'
WHEN
The transport type code needs to be assigned
THEN
The transport type code is set to 'R' for rail
Context: An M10 manifest segment is being created and a train key exists
GIVEN
An M10 manifest segment is being created and a train key exists
Applied to: Set Vessel Name from Train Key
WHEN
The vessel name needs to be assigned
THEN
The vessel name is set to the value from the train key
Context: An M10 manifest segment is being created and current machine date is available
GIVEN
An M10 manifest segment is being created and current machine date is available
Applied to: Convert Current Date to Julian Format
WHEN
The flight/voyage number needs to be calculated
THEN
The system converts the current date from Gregorian to Julian format using date conversion service
Context: The current date has been converted to Julian format
GIVEN
The current date has been converted to Julian format
Applied to: Set Flight/Voyage Number from Julian Date
WHEN
The flight/voyage number needs to be assigned
THEN
The flight/voyage number is set to the Julian date value
Context: An M10 manifest segment is being created for train transport
GIVEN
An M10 manifest segment is being created for train transport
Applied to: Set Reference Number to 'TRAIN'
WHEN
The reference number needs to be assigned
THEN
The reference number is set to 'TRAIN'
Context: An M10 manifest segment is being created and the operation type is ADD
GIVEN
An M10 manifest segment is being created and the operation type is ADD
Applied to: Set Purpose Code to '00' - Add
WHEN
The transaction purpose code needs to be determined
THEN
The purpose code is set to '00'
Context: An M10 manifest segment is being created and the operation type is CHANGE and the arrival date is empty
GIVEN
An M10 manifest segment is being created and the operation type is CHANGE and the arrival date is empty
Applied to: Set Purpose Code to '04' - Change
WHEN
The transaction purpose code needs to be determined
THEN
The purpose code is set to '04' and amendment flag is set to false
Context: An M10 manifest segment is being created and the operation type is CHANGE and arrival date is not empty and it's a post-emanifest transaction
GIVEN
An M10 manifest segment is being created and the operation type is CHANGE and arrival date is not empty and it's a post-emanifest transaction
Applied to: Set Purpose Code to 'CO' - Amendment
WHEN
The transaction purpose code needs to be determined
THEN
The purpose code is set to 'CO' and amendment flag is set to true
Context: An M10 manifest segment is being created and the operation type is CHANGE and arrival date is not empty and it's not a post-emanifest transaction
GIVEN
An M10 manifest segment is being created and the operation type is CHANGE and arrival date is not empty and it's not a post-emanifest transaction
Applied to: Set Purpose Code to '04' - Change
WHEN
The transaction purpose code needs to be determined
THEN
The purpose code is set to '04' and amendment flag is set to false
Context: An M10 manifest segment is being created and the operation type is DELETE
GIVEN
An M10 manifest segment is being created and the operation type is DELETE
Applied to: Set Purpose Code to '03' - Delete
WHEN
The transaction purpose code needs to be determined
THEN
The purpose code is set to '03'
Context: An M10 manifest segment has been fully populated with all required data
GIVEN
An M10 manifest segment has been fully populated with all required data
Applied to: Insert M10 Segment into Transmission
WHEN
The segment needs to be added to the transmission
THEN
The M10 segment is inserted into the transmission data queue
R-GCCU358T-cbl-00050 (+4) File: GCCU358T.cbl Create EDI Root Segment Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Create EDI Root Segment':
  • Context - the system is creating an edi root segment:
    For Set Transmission Prefix to 106 Foreground Mode / Set Transmission Prefix to 003 Background Mode:
    When the processing mode is foreground, then the transmission prefix is set to 106, and when the processing mode is background, the transmission prefix is set to 003.
  • Context - a transmission prefix has been determined based on processing mode:
    For Generate Transmission Number Using Machine Time:
    When the system needs to generate a transmission number, then the machine time is retrieved and combined with the prefix to create the transmission number.
  • Context - a transmission number has been generated:
    For Initialize Root Segment Structure / Set Transaction Set to 358:
    When the system initializes the edi root segment, then the root segment structure is cleared and the transaction set is set to '358'.
  • Context - an edi root segment is ready for insertion into the database:
    For Insert Successful? / Increment Transmission Number / Retry Insert with New Number:
    When the insertion fails due to a duplicate transmission number, then the transmission number is incremented by 1 and the insertion is retried until a unique number is found.
  • Context - the edi root segment is initialized with transmission number and transaction set 358:
    For Insert Root Segment into EDI Database:
    When the system attempts to insert the root segment, then the root segment is stored in the edi work database using the transmission number as the key.
👨‍💻 Technical ACs (Gherkin)
Context: The system is creating an EDI root segment
GIVEN
The system is creating an EDI root segment
Applied to: Set Transmission Prefix to 106 Foreground Mode / Set Transmission Prefix to 003 Background Mode
WHEN
The processing mode is foreground
THEN
The transmission prefix is set to 106, and when the processing mode is background, the transmission prefix is set to 003
Context: A transmission prefix has been determined based on processing mode
GIVEN
A transmission prefix has been determined based on processing mode
Applied to: Generate Transmission Number Using Machine Time
WHEN
The system needs to generate a transmission number
THEN
The machine time is retrieved and combined with the prefix to create the transmission number
Context: A transmission number has been generated
GIVEN
A transmission number has been generated
Applied to: Initialize Root Segment Structure / Set Transaction Set to 358
WHEN
The system initializes the EDI root segment
THEN
The root segment structure is cleared and the transaction set is set to '358'
Context: An EDI root segment is ready for insertion into the database
GIVEN
An EDI root segment is ready for insertion into the database
Applied to: Insert Successful? / Increment Transmission Number / Retry Insert with New Number
WHEN
The insertion fails due to a duplicate transmission number
THEN
The transmission number is incremented by 1 and the insertion is retried until a unique number is found
Context: The EDI root segment is initialized with transmission number and transaction set 358
GIVEN
The EDI root segment is initialized with transmission number and transaction set 358
Applied to: Insert Root Segment into EDI Database
WHEN
The system attempts to insert the root segment
THEN
The root segment is stored in the EDI work database using the transmission number as the key
R-GCCE358-cbl-00053 (+8) File: GCCE358.cbl Process P4 Port Information Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process P4 Port Information':
  • Context - the system is processing port information for edi transmission:
    For Initialize P4 Segment Structure:
    When p4 segment processing begins, then the p4 segment structure is initialized and the identifier is set to 'p4'.
  • Context - train data contains origin service center information:
    For Set Departure Location ID from Train Data:
    When p4 segment is being populated with location details, then the departure location id is set from the train's origin service center.
  • Context - train data contains estimated departure date information:
    For Extract Estimated Departure Date:
    When p4 segment requires departure date information, then the estimated departure date is extracted and moved to temporary date field for processing.
  • Context - the departure date is valid and not empty or zero:
    For Apply Century Logic for Date:
    When century calculation is required for the departure date, then if the year is less than 70, century is set to 20 (2000s), otherwise century is set to 19 (1900s).
  • Context - the departure date is empty, spaces, or zero:
    For Set Century to 0 for Invalid Date:
    When date validation is performed, then the century component is set to 0 to indicate invalid date.
  • Context - bill of lading count has been calculated from equipment processing:
    For Set Quantity from Bill of Lading Count:
    When p4 segment quantity field needs to be populated, then the quantity is set to the bill of lading count value.
  • Context - train data contains estimated time of arrival information:
    For Set Estimated Time of Arrival:
    When p4 segment time field needs to be populated, then the time field is set from the train's estimated time of arrival.
  • Context - train data contains firms code information:
    For Set FIRMS Code from Train Data:
    When p4 segment id code field needs to be populated, then the id code field is set from the train's firms code.
  • Context - p4 segment has been fully populated with all required port information:
    For Insert P4 Segment into EDI Database:
    When p4 segment is ready for edi transmission, then the p4 segment is inserted into the edi transmission database with proper sequence numbering.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing port information for EDI transmission
GIVEN
The system is processing port information for EDI transmission
Applied to: Initialize P4 Segment Structure
WHEN
P4 segment processing begins
THEN
The P4 segment structure is initialized and the identifier is set to 'P4'
Context: Train data contains origin service center information
GIVEN
Train data contains origin service center information
Applied to: Set Departure Location ID from Train Data
WHEN
P4 segment is being populated with location details
THEN
The departure location ID is set from the train's origin service center
Context: Train data contains estimated departure date information
GIVEN
Train data contains estimated departure date information
Applied to: Extract Estimated Departure Date
WHEN
P4 segment requires departure date information
THEN
The estimated departure date is extracted and moved to temporary date field for processing
Context: The departure date is valid and not empty or zero
GIVEN
The departure date is valid and not empty or zero
Applied to: Apply Century Logic for Date
WHEN
Century calculation is required for the departure date
THEN
If the year is less than 70, century is set to 20 (2000s), otherwise century is set to 19 (1900s)
Context: The departure date is empty, spaces, or zero
GIVEN
The departure date is empty, spaces, or zero
Applied to: Set Century to 0 for Invalid Date
WHEN
Date validation is performed
THEN
The century component is set to 0 to indicate invalid date
Context: Bill of lading count has been calculated from equipment processing
GIVEN
Bill of lading count has been calculated from equipment processing
Applied to: Set Quantity from Bill of Lading Count
WHEN
P4 segment quantity field needs to be populated
THEN
The quantity is set to the bill of lading count value
Context: Train data contains estimated time of arrival information
GIVEN
Train data contains estimated time of arrival information
Applied to: Set Estimated Time of Arrival
WHEN
P4 segment time field needs to be populated
THEN
The time field is set from the train's estimated time of arrival
Context: Train data contains FIRMS code information
GIVEN
Train data contains FIRMS code information
Applied to: Set FIRMS Code from Train Data
WHEN
P4 segment ID code field needs to be populated
THEN
The ID code field is set from the train's FIRMS code
Context: P4 segment has been fully populated with all required port information
GIVEN
P4 segment has been fully populated with all required port information
Applied to: Insert P4 Segment into EDI Database
WHEN
P4 segment is ready for EDI transmission
THEN
The P4 segment is inserted into the EDI transmission database with proper sequence numbering
R-GCCU358T-cbl-00055 (+9) File: GCCU358T.cbl Build M10 Manifest Header Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build M10 Manifest Header':
  • Context - a train manifest needs to be processed for edi transmission:
    For Initialize M10 Manifest Header:
    When the system begins creating the m10 manifest header segment, then the m10 segment is initialized with empty values to prepare for data population.
  • Context - an m10 manifest header segment is being created:
    For Set Standard M10 Fields - Identifier: M10, SCAC: CPRS, Transport Type: R, Country: CA:
    When the system sets the standard transport fields, then the identifier is set to 'm10', scac code is set to 'cprs', transport type code is set to 'r' for rail, and country code is set to 'ca' for canada.
  • Context - an m10 manifest header is being populated with train information:
    For Set Train ID as Vessel Name:
    When the system assigns the vessel name field, then the customer train id from the train list is copied to the m10 vessel name field.
  • Context - a train is being processed for a valid port and train type needs to be determined:
    For Check Train ID Character 23:
    When the system examines the 23rd character of the train id, then if the character is 't' then the train is classified as an export train, otherwise it is classified as a transit train.
  • Context - an m10 manifest header requires a voyage number:
    For Generate Voyage Number from Creation Date:
    When the system generates the voyage number, then the first 2 characters are taken from the train creation year and the next 3 characters are taken from the train creation julian date.
  • Context - an m10 manifest header is being populated with cargo information:
    For Set Bill of Lading Quantity:
    When the system sets the quantity field, then the bill of lading quantity (count of valid cargo entries) is assigned to the m10 quantity field.
  • Context - a train is classified as an export train and is being processed for a valid port:
    For Set Manifest Type: K, Application Type: 28:
    When the system determines the manifest type and application type, then the manifest type code is set to 'k' and the application type is set to '28'.
  • Context - a train is either not an export train or not processing for a valid port:
    For Set Manifest Type: S:
    When the system determines the manifest type, then the manifest type code is set to 's'.
  • Context - an m10 manifest header is being finalized with response information:
    For Set Standard Response Fields - Condition Response: Y, Record Type: TRAIN, Record Number: Train ID:
    When the system sets the standard response fields, then the condition response code is set to 'y', record type is set to 'train', and record number is set to the customer train id.
  • Context - an m10 manifest header segment has been fully populated with train and cargo information:
    For Insert M10 Segment into EDI Transmission:
    When the system processes the segment for edi transmission, then the m10 segment is inserted into the edi transmission data with an incremented sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest needs to be processed for EDI transmission
GIVEN
A train manifest needs to be processed for EDI transmission
Applied to: Initialize M10 Manifest Header
WHEN
The system begins creating the M10 manifest header segment
THEN
The M10 segment is initialized with empty values to prepare for data population
Context: An M10 manifest header segment is being created
GIVEN
An M10 manifest header segment is being created
Applied to: Set Standard M10 Fields - Identifier: M10, SCAC: CPRS, Transport Type: R, Country: CA
WHEN
The system sets the standard transport fields
THEN
The identifier is set to 'M10', SCAC code is set to 'CPRS', transport type code is set to 'R' for rail, and country code is set to 'CA' for Canada
Context: An M10 manifest header is being populated with train information
GIVEN
An M10 manifest header is being populated with train information
Applied to: Set Train ID as Vessel Name
WHEN
The system assigns the vessel name field
THEN
The customer train ID from the train list is copied to the M10 vessel name field
Context: A train is being processed for a valid port and train type needs to be determined
GIVEN
A train is being processed for a valid port and train type needs to be determined
Applied to: Check Train ID Character 23
WHEN
The system examines the 23rd character of the train ID
THEN
If the character is 'T' then the train is classified as an export train, otherwise it is classified as a transit train
Context: An M10 manifest header requires a voyage number
GIVEN
An M10 manifest header requires a voyage number
Applied to: Generate Voyage Number from Creation Date
WHEN
The system generates the voyage number
THEN
The first 2 characters are taken from the train creation year and the next 3 characters are taken from the train creation Julian date
Context: An M10 manifest header is being populated with cargo information
GIVEN
An M10 manifest header is being populated with cargo information
Applied to: Set Bill of Lading Quantity
WHEN
The system sets the quantity field
THEN
The bill of lading quantity (count of valid cargo entries) is assigned to the M10 quantity field
Context: A train is classified as an export train and is being processed for a valid port
GIVEN
A train is classified as an export train and is being processed for a valid port
Applied to: Set Manifest Type: K, Application Type: 28
WHEN
The system determines the manifest type and application type
THEN
The manifest type code is set to 'K' and the application type is set to '28'
Context: A train is either not an export train or not processing for a valid port
GIVEN
A train is either not an export train or not processing for a valid port
Applied to: Set Manifest Type: S
WHEN
The system determines the manifest type
THEN
The manifest type code is set to 'S'
Context: An M10 manifest header is being finalized with response information
GIVEN
An M10 manifest header is being finalized with response information
Applied to: Set Standard Response Fields - Condition Response: Y, Record Type: TRAIN, Record Number: Train ID
WHEN
The system sets the standard response fields
THEN
The condition response code is set to 'Y', record type is set to 'TRAIN', and record number is set to the customer train ID
Context: An M10 manifest header segment has been fully populated with train and cargo information
GIVEN
An M10 manifest header segment has been fully populated with train and cargo information
Applied to: Insert M10 Segment into EDI Transmission
WHEN
The system processes the segment for EDI transmission
THEN
The M10 segment is inserted into the EDI transmission data with an incremented sequence number
R-GCCS358C-cbl-00060 (+4) File: GCCS358C.cbl Set Transaction Purpose Code Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Transaction Purpose Code':
  • Context - a train manifest transaction is being processed:
    For Set Purpose Code = '00' ADD Operation:
    When the operation type is add (gcws358c-add flag is true), then the m10 transaction purpose code (m10-13-ts-purpose-cde) is set to '00'.
    For Set Purpose Code = '03' DELETE Operation:
    When the operation type is delete (gcws358c-delete flag is true), then the m10 transaction purpose code (m10-13-ts-purpose-cde) is set to '03'.
  • Context - a train manifest transaction is being processed with change operation type:
    For Set Purpose Code = '04' Regular Change:
    When the arrival date (gcwb4tl-arrival-date) is empty or contains spaces, then the m10 transaction purpose code (m10-13-ts-purpose-cde) is set to '04' and the ws-not-amendment flag is set to true.
  • Context - a train manifest transaction is being processed with change operation type and arrival date is not empty:
    For Set Purpose Code = 'CO' Post-Emanifest Amendment:
    When the post-emanifest flag (gcwb4tl-post-emanifest) is true, then the m10 transaction purpose code (m10-13-ts-purpose-cde) is set to 'co' and the ws-amendment flag is set to true.
    For Set Purpose Code = '04' Regular Change:
    When the post-emanifest flag (gcwb4tl-post-emanifest) is false, then the m10 transaction purpose code (m10-13-ts-purpose-cde) is set to '04' and the ws-not-amendment flag is set to true.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest transaction is being processed
GIVEN
A train manifest transaction is being processed
Applied to: Set Purpose Code = '00' ADD Operation
WHEN
The operation type is ADD (GCWS358C-ADD flag is true)
THEN
The M10 transaction purpose code (M10-13-TS-PURPOSE-CDE) is set to '00'
Applied to: Set Purpose Code = '03' DELETE Operation
WHEN
The operation type is DELETE (GCWS358C-DELETE flag is true)
THEN
The M10 transaction purpose code (M10-13-TS-PURPOSE-CDE) is set to '03'
Context: A train manifest transaction is being processed with CHANGE operation type
GIVEN
A train manifest transaction is being processed with CHANGE operation type
Applied to: Set Purpose Code = '04' Regular Change
WHEN
The arrival date (GCWB4TL-ARRIVAL-DATE) is empty or contains spaces
THEN
The M10 transaction purpose code (M10-13-TS-PURPOSE-CDE) is set to '04' and the WS-NOT-AMENDMENT flag is set to true
Context: A train manifest transaction is being processed with CHANGE operation type and arrival date is not empty
GIVEN
A train manifest transaction is being processed with CHANGE operation type and arrival date is not empty
Applied to: Set Purpose Code = 'CO' Post-Emanifest Amendment
WHEN
The post-emanifest flag (GCWB4TL-POST-EMANIFEST) is true
THEN
The M10 transaction purpose code (M10-13-TS-PURPOSE-CDE) is set to 'CO' and the WS-AMENDMENT flag is set to true
Applied to: Set Purpose Code = '04' Regular Change
WHEN
The post-emanifest flag (GCWB4TL-POST-EMANIFEST) is false
THEN
The M10 transaction purpose code (M10-13-TS-PURPOSE-CDE) is set to '04' and the WS-NOT-AMENDMENT flag is set to true
R-GCCE358-cbl-00062 (+10) File: GCCE358.cbl Process Equipment Records Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Equipment Records':
  • Context - a train list contains multiple equipment items with a total equipment quantity:
    For Start Equipment Processing Loop:
    When the equipment processing begins, then the system should initialize the equipment index to 1 and process each equipment item sequentially until all equipment in the train list has been processed.
  • Context - an equipment item is being processed and there is a record of the last processed equipment id:
    For Equipment ID Different from Last Processed?:
    When the system compares the current equipment id with the last processed equipment id, then if the equipment ids are different, the system should proceed to create a new vid segment, otherwise skip vid creation for this equipment.
  • Context - a new unique equipment id has been identified for vid processing:
    For Store Current Equipment ID as Last Processed:
    When the system begins processing this equipment, then the current equipment id should be stored as the last processed equipment id for future duplicate detection.
  • Context - a vid segment is being created for an equipment item:
    For Set Equipment Description Code:
    When the equipment description code needs to be populated, then the system should copy the equipment type from the train list equipment data to the vid equipment description code field.
    For Set Equipment Initial:
    When the equipment initial needs to be populated, then the system should copy the equipment initial from the train list equipment data to the vid equipment initial field.
  • Context - an equipment item has a us-ccn-key and cargo data has been retrieved:
    For Is Equipment CP or Has No Car Number?:
    When the system needs to determine the equipment number for the vid segment, then if the us-ccn-key starts with 'cprs' or the cargo car number is spaces, then use the train list equipment number, otherwise use the cargo database car number.
  • Context - the equipment belongs to cp rail (cprs) or no car number exists in cargo data:
    For Use Train List Equipment Number:
    When the vid equipment number field needs to be populated, then the system should use the equipment number from the train list data.
  • Context - the equipment does not belong to cp rail and a car number exists in the cargo database:
    For Use Cargo Database Car Number:
    When the vid equipment number field needs to be populated, then the system should use the car number from the cargo database.
  • Context - an equipment item has a load/empty status from the train list:
    For Apply Load/Empty Status Logic:
    When the vid load/empty status needs to be determined, then if status is 'h' then set to 'e', else if status is 'e' and ccn key exists and cargo weight > 1 then set to 'l', else if status is 'e' and ccn key exists and bol type is 23 then keep as 'e', otherwise keep original status.
  • Context - a vid segment has been fully populated with equipment data:
    For Insert VID Segment to EDI Data:
    When the segment needs to be added to the edi transmission, then the system should insert the vid segment into the transmission data with an incremented sequence number.
  • Context - the current equipment item has been processed:
    For More Equipment in Train List?:
    When the system checks for more equipment to process, then if the equipment index is less than or equal to the total equipment quantity, continue processing the next equipment item, otherwise end the equipment processing loop.
👨‍💻 Technical ACs (Gherkin)
Context: A train list contains multiple equipment items with a total equipment quantity
GIVEN
A train list contains multiple equipment items with a total equipment quantity
Applied to: Start Equipment Processing Loop
WHEN
The equipment processing begins
THEN
The system should initialize the equipment index to 1 and process each equipment item sequentially until all equipment in the train list has been processed
Context: An equipment item is being processed and there is a record of the last processed equipment ID
GIVEN
An equipment item is being processed and there is a record of the last processed equipment ID
Applied to: Equipment ID Different from Last Processed?
WHEN
The system compares the current equipment ID with the last processed equipment ID
THEN
If the equipment IDs are different, the system should proceed to create a new VID segment, otherwise skip VID creation for this equipment
Context: A new unique equipment ID has been identified for VID processing
GIVEN
A new unique equipment ID has been identified for VID processing
Applied to: Store Current Equipment ID as Last Processed
WHEN
The system begins processing this equipment
THEN
The current equipment ID should be stored as the last processed equipment ID for future duplicate detection
Context: A VID segment is being created for an equipment item
GIVEN
A VID segment is being created for an equipment item
Applied to: Set Equipment Description Code
WHEN
The equipment description code needs to be populated
THEN
The system should copy the equipment type from the train list equipment data to the VID equipment description code field
Applied to: Set Equipment Initial
WHEN
The equipment initial needs to be populated
THEN
The system should copy the equipment initial from the train list equipment data to the VID equipment initial field
Context: An equipment item has a US-CCN-KEY and cargo data has been retrieved
GIVEN
An equipment item has a US-CCN-KEY and cargo data has been retrieved
Applied to: Is Equipment CP or Has No Car Number?
WHEN
The system needs to determine the equipment number for the VID segment
THEN
If the US-CCN-KEY starts with 'CPRS' OR the cargo car number is spaces, then use the train list equipment number, otherwise use the cargo database car number
Context: The equipment belongs to CP Rail (CPRS) or no car number exists in cargo data
GIVEN
The equipment belongs to CP Rail (CPRS) or no car number exists in cargo data
Applied to: Use Train List Equipment Number
WHEN
The VID equipment number field needs to be populated
THEN
The system should use the equipment number from the train list data
Context: The equipment does not belong to CP Rail and a car number exists in the cargo database
GIVEN
The equipment does not belong to CP Rail and a car number exists in the cargo database
Applied to: Use Cargo Database Car Number
WHEN
The VID equipment number field needs to be populated
THEN
The system should use the car number from the cargo database
Context: An equipment item has a load/empty status from the train list
GIVEN
An equipment item has a load/empty status from the train list
Applied to: Apply Load/Empty Status Logic
WHEN
The VID load/empty status needs to be determined
THEN
If status is 'H' then set to 'E', else if status is 'E' and CCN key exists and cargo weight > 1 then set to 'L', else if status is 'E' and CCN key exists and BOL type is 23 then keep as 'E', otherwise keep original status
Context: A VID segment has been fully populated with equipment data
GIVEN
A VID segment has been fully populated with equipment data
Applied to: Insert VID Segment to EDI Data
WHEN
The segment needs to be added to the EDI transmission
THEN
The system should insert the VID segment into the transmission data with an incremented sequence number
Context: The current equipment item has been processed
GIVEN
The current equipment item has been processed
Applied to: More Equipment in Train List?
WHEN
The system checks for more equipment to process
THEN
If the equipment index is less than or equal to the total equipment quantity, continue processing the next equipment item, otherwise end the equipment processing loop
R-GCCS358C-cbl-00065 (+6) File: GCCS358C.cbl Build P4 Location Segment Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build P4 Location Segment':
  • Context - a p4 location segment needs to be created for transmission:
    For Initialize P4 Segment Structure:
    When the system begins building the p4 segment, then the p4 segment structure is initialized and the identifier is set to 'p4'.
  • Context - a train departure location needs to be processed:
    For Retrieve Canadian Station Information:
    When the system needs to build the p4 location segment, then the system retrieves station information using the train's departure station code.
  • Context - canadian station information has been retrieved from the station table:
    For Set Canadian Station Code as Location ID:
    When the p4 location segment is being populated, then the canadian station code is assigned as the location identifier.
  • Context - an estimated departure date year needs century determination:
    For Determine Century for Departure Date:
    When the estimated departure year is greater than 90, then the century is set to '19', otherwise the century is set to '20'.
  • Context - train estimated departure date information is available:
    For Set Estimated Departure Year, Set Estimated Departure Month, Set Estimated Departure Day:
    When the p4 location segment date fields need to be populated, then the estimated departure year, month, and day are set from the train list data.
  • Context - the p4 location segment has a populated location identifier:
    For Copy Location ID to ID Code Field, Set Time Field to Spaces:
    When the remaining p4 segment fields need to be set, then the location identifier is copied to the id code field and the time field is set to spaces.
  • Context - a completed p4 location segment is ready for transmission:
    For Insert P4 Segment into Transmission:
    When the segment needs to be added to the transmission data, then the p4 segment is inserted into the transmission data structure.
👨‍💻 Technical ACs (Gherkin)
Context: A P4 location segment needs to be created for transmission
GIVEN
A P4 location segment needs to be created for transmission
Applied to: Initialize P4 Segment Structure
WHEN
The system begins building the P4 segment
THEN
The P4 segment structure is initialized and the identifier is set to 'P4'
Context: A train departure location needs to be processed
GIVEN
A train departure location needs to be processed
Applied to: Retrieve Canadian Station Information
WHEN
The system needs to build the P4 location segment
THEN
The system retrieves station information using the train's departure station code
Context: Canadian station information has been retrieved from the station table
GIVEN
Canadian station information has been retrieved from the station table
Applied to: Set Canadian Station Code as Location ID
WHEN
The P4 location segment is being populated
THEN
The Canadian station code is assigned as the location identifier
Context: An estimated departure date year needs century determination
GIVEN
An estimated departure date year needs century determination
Applied to: Determine Century for Departure Date
WHEN
The estimated departure year is greater than 90
THEN
The century is set to '19', otherwise the century is set to '20'
Context: Train estimated departure date information is available
GIVEN
Train estimated departure date information is available
Applied to: Set Estimated Departure Year, Set Estimated Departure Month, Set Estimated Departure Day
WHEN
The P4 location segment date fields need to be populated
THEN
The estimated departure year, month, and day are set from the train list data
Context: The P4 location segment has a populated location identifier
GIVEN
The P4 location segment has a populated location identifier
Applied to: Copy Location ID to ID Code Field, Set Time Field to Spaces
WHEN
The remaining P4 segment fields need to be set
THEN
The location identifier is copied to the ID code field and the time field is set to spaces
Context: A completed P4 location segment is ready for transmission
GIVEN
A completed P4 location segment is ready for transmission
Applied to: Insert P4 Segment into Transmission
WHEN
The segment needs to be added to the transmission data
THEN
The P4 segment is inserted into the transmission data structure
R-GCCU358T-cbl-00065 (+10) File: GCCU358T.cbl Build P4 Port Information Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build P4 Port Information':
  • Context - the system needs to create a p4 port information segment:
    For Initialize P4 Segment:
    When the p4 processing begins, then the p4 segment structure is initialized to clear any previous data.
  • Context - a p4 segment is being created:
    For Set P4 Identifier:
    When the segment identifier needs to be set, then the identifier is set to 'p4' to indicate this is a port information segment.
  • Context - a train has an origin station code in the train list:
    For Set Departure Port Location:
    When the p4 segment departure port needs to be populated, then the departure port location is set to the train's origin station code.
  • Context - a train has estimated departure date information:
    For Get Estimated Departure Date:
    When the p4 segment date field needs to be populated, then the estimated departure date is extracted from the train's eda field.
  • Context - the estimated departure date is either spaces or zeros:
    For Date Available?:
    When the system checks for date availability, then the century component is set to 0 to indicate no date available.
  • Context - an estimated departure date is available with a two-digit year:
    For Year < 70?:
    When the year portion is less than 70, then the century is set to 20 to represent years 2000-2069.
    For Year < 70?:
    When the year portion is 70 or greater, then the century is set to 19 to represent years 1970-1999.
  • Context - the system has calculated the total number of valid bills of lading for the train:
    For Set Bill of Lading Quantity:
    When the p4 segment quantity field needs to be populated, then the quantity is set to the calculated bill of lading count.
  • Context - a train has estimated departure time information:
    For Set Estimated Departure Time:
    When the p4 segment time field needs to be populated, then the time is set to the train's estimated time of arrival (eta) value.
  • Context - a train has firms code information:
    For Set FIRMS Code:
    When the p4 segment id code field needs to be populated, then the id code is set to the train's firms code value.
  • Context - a p4 segment has been fully populated with port information:
    For Insert P4 Segment into EDI:
    When the segment needs to be added to the edi transmission, then the p4 segment is inserted into the transmission data structure.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to create a P4 port information segment
GIVEN
The system needs to create a P4 port information segment
Applied to: Initialize P4 Segment
WHEN
The P4 processing begins
THEN
The P4 segment structure is initialized to clear any previous data
Context: A P4 segment is being created
GIVEN
A P4 segment is being created
Applied to: Set P4 Identifier
WHEN
The segment identifier needs to be set
THEN
The identifier is set to 'P4' to indicate this is a port information segment
Context: A train has an origin station code in the train list
GIVEN
A train has an origin station code in the train list
Applied to: Set Departure Port Location
WHEN
The P4 segment departure port needs to be populated
THEN
The departure port location is set to the train's origin station code
Context: A train has estimated departure date information
GIVEN
A train has estimated departure date information
Applied to: Get Estimated Departure Date
WHEN
The P4 segment date field needs to be populated
THEN
The estimated departure date is extracted from the train's EDA field
Context: The estimated departure date is either spaces or zeros
GIVEN
The estimated departure date is either spaces or zeros
Applied to: Date Available?
WHEN
The system checks for date availability
THEN
The century component is set to 0 to indicate no date available
Context: An estimated departure date is available with a two-digit year
GIVEN
An estimated departure date is available with a two-digit year
Applied to: Year < 70?
WHEN
The year portion is less than 70
THEN
The century is set to 20 to represent years 2000-2069
Applied to: Year < 70?
WHEN
The year portion is 70 or greater
THEN
The century is set to 19 to represent years 1970-1999
Context: The system has calculated the total number of valid bills of lading for the train
GIVEN
The system has calculated the total number of valid bills of lading for the train
Applied to: Set Bill of Lading Quantity
WHEN
The P4 segment quantity field needs to be populated
THEN
The quantity is set to the calculated bill of lading count
Context: A train has estimated departure time information
GIVEN
A train has estimated departure time information
Applied to: Set Estimated Departure Time
WHEN
The P4 segment time field needs to be populated
THEN
The time is set to the train's estimated time of arrival (ETA) value
Context: A train has FIRMS code information
GIVEN
A train has FIRMS code information
Applied to: Set FIRMS Code
WHEN
The P4 segment ID code field needs to be populated
THEN
The ID code is set to the train's FIRMS code value
Context: A P4 segment has been fully populated with port information
GIVEN
A P4 segment has been fully populated with port information
Applied to: Insert P4 Segment into EDI
WHEN
The segment needs to be added to the EDI transmission
THEN
The P4 segment is inserted into the transmission data structure
R-GCCS358C-cbl-00072 (+14) File: GCCS358C.cbl Process Equipment List Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Equipment List':
  • Context - a train list with equipment records needs to be processed:
    For Initialize Equipment Counter SUB-TL = 1:
    When equipment processing begins, then the equipment counter sub-tl is set to 1 to start with the first equipment.
  • Context - equipment processing is in progress with current equipment counter sub-tl:
    For Equipment ID Empty?:
    When the equipment id at the current position is empty or spaces, then equipment processing terminates and exits the loop.
  • Context - an equipment record needs to be processed:
    For Post-Emanifest Processing? & Process Equipment - 5040 Version:
    When the processing mode is post-emanifest (gcwb4tl-post-emanifest is true), then use the 5040 version processing method (b231-load-vid-mbl-5040).
    For Process Equipment - 4040RAIL Version:
    When the processing mode is not post-emanifest (gcwb4tl-post-emanifest is false), then use the standard processing method (b230-load-vid-mbl).
  • Context - current equipment processing is complete:
    For Increment Equipment Counter:
    When moving to process the next equipment, then the equipment counter sub-tl is incremented by 1.
  • Context - an equipment record at position sub-tl in the train list:
    For Extract Equipment Type, Initial, Number:
    When equipment data needs to be extracted for vid segment creation, then equipment type, initial, and number are extracted from gcwb4tl fields at sub-tl position.
  • Context - equipment record with load indicator and cargo key information:
    For Determine Load/Empty Status:
    When equipment load status needs to be determined for standard processing, then status is 'l' if equipment is loaded, 'e' if equipment is empty, with special handling for loaded equipment without cargo key (set to 'e') and ccn starting with '6105i' (set to 'e').
  • Context - equipment record with load indicator, empty indicator, and cargo key information in post-emanifest mode:
    For Determine Load/Empty Status with Revenue Empty Logic:
    When equipment load status needs to be determined for post-emanifest processing, then status is 'l' if equipment is loaded or (equipment is empty and has cargo key), otherwise 'e', with special handling for loaded equipment without cargo key (set to 'e') and ccn starting with '6105i' (set to 'e').
  • Context - equipment with specific car types that form flat car and container combinations:
    For Handle Flat Car Logic for Container Cars:
    When current equipment is a flat car type (bg, ca, et, gs, id, lo, rr, sk, tn) and next equipment is a container type (cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, tl), then store flat car information and process both flat car and container as a combined unit with special vid segment handling.
  • Context - a flat car type equipment in post-emanifest processing:
    For Check Flat Car for Loaded Containers:
    When the equipment is a possible flat car type, then check subsequent container cars on the flat car and if any container is loaded or (empty with cargo key), set the flat car status to 'l'.
  • Context - equipment data including type, initial, number, and determined load/empty status:
    For Create VID Segment:
    When vid segment needs to be created for the equipment, then vid segment is initialized and populated with equipment identifier 'vid', equipment description code, equipment initial, equipment number, and load/empty status code.
  • Context - post-emanifest processing mode and equipment counter sub-tl equals 1:
    For Create N9 Reference Segment for First Equipment:
    When processing the first equipment in the list, then create n9 segment with identifier 'n9', reference number qualifier '76', reference number 'edt', estimated departure date, estimated time of arrival, and time code 'es'.
  • Context - equipment that is loaded and has a cargo key (cda-ccn-key is not spaces):
    For Process Bill of Lading if Loaded:
    When equipment processing requires bill of lading information, then process mbl segment with cargo details, scac code, bill of lading number, and response codes.
  • Context - post-emanifest processing mode with equipment that may or may not have cargo:
    For Process Bill of Lading or Dummy MBL:
    When equipment has cargo key, then process regular mbl segment, otherwise if this is the first equipment and an amendment, create dummy mbl with exception code '06' and m13 amendment segment.
👨‍💻 Technical ACs (Gherkin)
Context: A train list with equipment records needs to be processed
GIVEN
A train list with equipment records needs to be processed
Applied to: Initialize Equipment Counter SUB-TL = 1
WHEN
Equipment processing begins
THEN
The equipment counter SUB-TL is set to 1 to start with the first equipment
Context: Equipment processing is in progress with current equipment counter SUB-TL
GIVEN
Equipment processing is in progress with current equipment counter SUB-TL
Applied to: Equipment ID Empty?
WHEN
The equipment ID at the current position is empty or spaces
THEN
Equipment processing terminates and exits the loop
Context: An equipment record needs to be processed
GIVEN
An equipment record needs to be processed
Applied to: Post-Emanifest Processing? & Process Equipment - 5040 Version
WHEN
The processing mode is post-emanifest (GCWB4TL-POST-EMANIFEST is true)
THEN
Use the 5040 version processing method (B231-LOAD-VID-MBL-5040)
Applied to: Process Equipment - 4040RAIL Version
WHEN
The processing mode is not post-emanifest (GCWB4TL-POST-EMANIFEST is false)
THEN
Use the standard processing method (B230-LOAD-VID-MBL)
Context: Current equipment processing is complete
GIVEN
Current equipment processing is complete
Applied to: Increment Equipment Counter
WHEN
Moving to process the next equipment
THEN
The equipment counter SUB-TL is incremented by 1
Context: An equipment record at position SUB-TL in the train list
GIVEN
An equipment record at position SUB-TL in the train list
Applied to: Extract Equipment Type, Initial, Number
WHEN
Equipment data needs to be extracted for VID segment creation
THEN
Equipment type, initial, and number are extracted from GCWB4TL fields at SUB-TL position
Context: Equipment record with load indicator and cargo key information
GIVEN
Equipment record with load indicator and cargo key information
Applied to: Determine Load/Empty Status
WHEN
Equipment load status needs to be determined for standard processing
THEN
Status is 'L' if equipment is loaded, 'E' if equipment is empty, with special handling for loaded equipment without cargo key (set to 'E') and CCN starting with '6105I' (set to 'E')
Context: Equipment record with load indicator, empty indicator, and cargo key information in post-emanifest mode
GIVEN
Equipment record with load indicator, empty indicator, and cargo key information in post-emanifest mode
Applied to: Determine Load/Empty Status with Revenue Empty Logic
WHEN
Equipment load status needs to be determined for post-emanifest processing
THEN
Status is 'L' if equipment is loaded OR (equipment is empty AND has cargo key), otherwise 'E', with special handling for loaded equipment without cargo key (set to 'E') and CCN starting with '6105I' (set to 'E')
Context: Equipment with specific car types that form flat car and container combinations
GIVEN
Equipment with specific car types that form flat car and container combinations
Applied to: Handle Flat Car Logic for Container Cars
WHEN
Current equipment is a flat car type (BG, CA, ET, GS, ID, LO, RR, SK, TN) and next equipment is a container type (CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, TL)
THEN
Store flat car information and process both flat car and container as a combined unit with special VID segment handling
Context: A flat car type equipment in post-emanifest processing
GIVEN
A flat car type equipment in post-emanifest processing
Applied to: Check Flat Car for Loaded Containers
WHEN
The equipment is a possible flat car type
THEN
Check subsequent container cars on the flat car and if any container is loaded or (empty with cargo key), set the flat car status to 'L'
Context: Equipment data including type, initial, number, and determined load/empty status
GIVEN
Equipment data including type, initial, number, and determined load/empty status
Applied to: Create VID Segment
WHEN
VID segment needs to be created for the equipment
THEN
VID segment is initialized and populated with equipment identifier 'VID', equipment description code, equipment initial, equipment number, and load/empty status code
Context: Post-emanifest processing mode and equipment counter SUB-TL equals 1
GIVEN
Post-emanifest processing mode and equipment counter SUB-TL equals 1
Applied to: Create N9 Reference Segment for First Equipment
WHEN
Processing the first equipment in the list
THEN
Create N9 segment with identifier 'N9', reference number qualifier '76', reference number 'EDT', estimated departure date, estimated time of arrival, and time code 'ES'
Context: Equipment that is loaded and has a cargo key (CDA-CCN-KEY is not spaces)
GIVEN
Equipment that is loaded and has a cargo key (CDA-CCN-KEY is not spaces)
Applied to: Process Bill of Lading if Loaded
WHEN
Equipment processing requires bill of lading information
THEN
Process MBL segment with cargo details, SCAC code, bill of lading number, and response codes
Context: Post-emanifest processing mode with equipment that may or may not have cargo
GIVEN
Post-emanifest processing mode with equipment that may or may not have cargo
Applied to: Process Bill of Lading or Dummy MBL
WHEN
Equipment has cargo key
THEN
Process regular MBL segment, otherwise if this is the first equipment and an amendment, create dummy MBL with exception code '06' and M13 amendment segment
R-GCCE358-cbl-00073 (+3) File: GCCE358.cbl Determine Equipment Load Status Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Equipment Load Status':
  • Context - an equipment item exists in the train list:
    For Set Status to 'E' - Empty:
    When the equipment load/empty status is 'h' (hold), then the system sets the equipment status to 'e' (empty).
  • Context - an equipment item has status 'e' (empty) and has a bill number (us-ccn-key is not spaces):
    For Cargo Weight > 1?:
    When the cargo weight is greater than 1, then the system sets the equipment status to 'l' (loaded).
    For Keep Original Status:
    When the cargo weight is 1 or less, then the system keeps the original equipment status 'e' (empty).
  • Context - an equipment item has any status other than 'h' (hold):
    For Keep Original Status:
    When the equipment does not have a bill number (us-ccn-key is spaces), then the system keeps the original equipment load/empty status unchanged.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item exists in the train list
GIVEN
An equipment item exists in the train list
Applied to: Set Status to 'E' - Empty
WHEN
The equipment load/empty status is 'H' (Hold)
THEN
The system sets the equipment status to 'E' (Empty)
Context: An equipment item has status 'E' (Empty) and has a bill number (US-CCN-KEY is not spaces)
GIVEN
An equipment item has status 'E' (Empty) and has a bill number (US-CCN-KEY is not spaces)
Applied to: Cargo Weight > 1?
WHEN
The cargo weight is greater than 1
THEN
The system sets the equipment status to 'L' (Loaded)
Applied to: Keep Original Status
WHEN
The cargo weight is 1 or less
THEN
The system keeps the original equipment status 'E' (Empty)
Context: An equipment item has any status other than 'H' (Hold)
GIVEN
An equipment item has any status other than 'H' (Hold)
Applied to: Keep Original Status
WHEN
The equipment does not have a bill number (US-CCN-KEY is spaces)
THEN
The system keeps the original equipment load/empty status unchanged
R-GCCU358T-cbl-00076 (+8) File: GCCU358T.cbl Process Equipment VID Segments Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Equipment VID Segments':
  • Context - equipment processing is required for edi transmission:
    For Initialize VID Segment:
    When vid segment processing begins, then vid segment structure is cleared and ready for data population.
  • Context - vid segment is being created:
    For Set VID Identifier to 'VID':
    When segment identifier needs to be set, then vid identifier is set to 'vid'.
  • Context - equipment is being processed at a specific index position:
    For Get Equipment Type from Train List:
    When equipment type data is required for vid segment, then equipment type is retrieved from train list at current equipment index and assigned to vid equipment description code.
    For Get Equipment Initials from Train List:
    When equipment initials are required for vid segment, then equipment initials are retrieved from train list at current equipment index and assigned to vid equipment initials.
  • Context - equipment number needs to be assigned to vid segment:
    For Car Number Available in Cargo?:
    When car number from cargo record is not empty, then car number from cargo record is used for vid equipment number.
  • Context - equipment load/empty status needs to be determined:
    For Load/Empty Status = 'H'?:
    When train list shows load/empty status as 'h', then vid load/empty status is set to 'e' for empty.
  • Context - equipment has associated cargo and train list shows empty status 'e':
    For Has Cargo and Status='E' and Weight>1?:
    When cargo weight is greater than 1, then vid load/empty status is set to 'l' for loaded.
  • Context - equipment load/empty status is not 'h' and does not meet weight override conditions:
    For Use Original Load/Empty Status:
    When no special status conversion rules apply, then original load/empty status from train list is used for vid segment.
  • Context - vid segment has been populated with all required equipment data:
    For Insert VID Segment to EDI Data:
    When vid segment is ready for transmission, then vid segment is inserted into edi transmission data stream.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment processing is required for EDI transmission
GIVEN
Equipment processing is required for EDI transmission
Applied to: Initialize VID Segment
WHEN
VID segment processing begins
THEN
VID segment structure is cleared and ready for data population
Context: VID segment is being created
GIVEN
VID segment is being created
Applied to: Set VID Identifier to 'VID'
WHEN
Segment identifier needs to be set
THEN
VID identifier is set to 'VID'
Context: Equipment is being processed at a specific index position
GIVEN
Equipment is being processed at a specific index position
Applied to: Get Equipment Type from Train List
WHEN
Equipment type data is required for VID segment
THEN
Equipment type is retrieved from train list at current equipment index and assigned to VID equipment description code
Applied to: Get Equipment Initials from Train List
WHEN
Equipment initials are required for VID segment
THEN
Equipment initials are retrieved from train list at current equipment index and assigned to VID equipment initials
Context: Equipment number needs to be assigned to VID segment
GIVEN
Equipment number needs to be assigned to VID segment
Applied to: Car Number Available in Cargo?
WHEN
Car number from cargo record is not empty
THEN
Car number from cargo record is used for VID equipment number
Context: Equipment load/empty status needs to be determined
GIVEN
Equipment load/empty status needs to be determined
Applied to: Load/Empty Status = 'H'?
WHEN
Train list shows load/empty status as 'H'
THEN
VID load/empty status is set to 'E' for empty
Context: Equipment has associated cargo and train list shows empty status 'E'
GIVEN
Equipment has associated cargo and train list shows empty status 'E'
Applied to: Has Cargo and Status='E' and Weight>1?
WHEN
Cargo weight is greater than 1
THEN
VID load/empty status is set to 'L' for loaded
Context: Equipment load/empty status is not 'H' and does not meet weight override conditions
GIVEN
Equipment load/empty status is not 'H' and does not meet weight override conditions
Applied to: Use Original Load/Empty Status
WHEN
No special status conversion rules apply
THEN
Original load/empty status from train list is used for VID segment
Context: VID segment has been populated with all required equipment data
GIVEN
VID segment has been populated with all required equipment data
Applied to: Insert VID Segment to EDI Data
WHEN
VID segment is ready for transmission
THEN
VID segment is inserted into EDI transmission data stream
R-GCCE358-cbl-00077 (+5) File: GCCE358.cbl Lookup Foreign Carrier Information Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup Foreign Carrier Information':
  • Context - an equipment record is being processed with a us-ccn-key:
    For Is Equipment CP Owned?:
    When the us-ccn-key starts with 'cprs' indicating cp ownership, then use the original equipment number from the train list without performing cargo lookup.
  • Context - equipment is identified as cp-owned or cargo record lookup fails or foreign carrier number is not available:
    For Use Original Equipment Number from Train List:
    When equipment number needs to be determined for vid record, then assign the equipment number from the train list to the vid equipment number field.
  • Context - equipment is not cp-owned (us-ccn-key does not start with 'cprs'):
    For Lookup Cargo Information in Database:
    When equipment number determination is required, then perform cargo database lookup using the us-ccn-key to retrieve foreign carrier information.
  • Context - cargo record has been successfully retrieved from database:
    For Foreign Carrier Number Available?:
    When determining which equipment number to use, then check if the foreign carrier equipment number field contains valid data (not spaces).
  • Context - cargo record exists and foreign carrier equipment number is not spaces:
    For Use Foreign Carrier Equipment Number:
    When equipment number needs to be assigned to vid record, then use the foreign carrier equipment number from the cargo record.
  • Context - cargo record exists but foreign carrier equipment number is spaces or empty:
    For Use Original Equipment Number as Fallback:
    When equipment number assignment is required, then use the original equipment number from the train list as fallback.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record is being processed with a US-CCN-KEY
GIVEN
An equipment record is being processed with a US-CCN-KEY
Applied to: Is Equipment CP Owned?
WHEN
The US-CCN-KEY starts with 'CPRS' indicating CP ownership
THEN
Use the original equipment number from the train list without performing cargo lookup
Context: Equipment is identified as CP-owned OR cargo record lookup fails OR foreign carrier number is not available
GIVEN
Equipment is identified as CP-owned OR cargo record lookup fails OR foreign carrier number is not available
Applied to: Use Original Equipment Number from Train List
WHEN
Equipment number needs to be determined for VID record
THEN
Assign the equipment number from the train list to the VID equipment number field
Context: Equipment is not CP-owned (US-CCN-KEY does not start with 'CPRS')
GIVEN
Equipment is not CP-owned (US-CCN-KEY does not start with 'CPRS')
Applied to: Lookup Cargo Information in Database
WHEN
Equipment number determination is required
THEN
Perform cargo database lookup using the US-CCN-KEY to retrieve foreign carrier information
Context: Cargo record has been successfully retrieved from database
GIVEN
Cargo record has been successfully retrieved from database
Applied to: Foreign Carrier Number Available?
WHEN
Determining which equipment number to use
THEN
Check if the foreign carrier equipment number field contains valid data (not spaces)
Context: Cargo record exists AND foreign carrier equipment number is not spaces
GIVEN
Cargo record exists AND foreign carrier equipment number is not spaces
Applied to: Use Foreign Carrier Equipment Number
WHEN
Equipment number needs to be assigned to VID record
THEN
Use the foreign carrier equipment number from the cargo record
Context: Cargo record exists BUT foreign carrier equipment number is spaces or empty
GIVEN
Cargo record exists BUT foreign carrier equipment number is spaces or empty
Applied to: Use Original Equipment Number as Fallback
WHEN
Equipment number assignment is required
THEN
Use the original equipment number from the train list as fallback
R-GCCE358-cbl-00083 (+6) File: GCCE358.cbl Create VID Equipment Segment Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Create VID Equipment Segment':
  • Context - a vid equipment segment needs to be created:
    For Initialize VID Segment Structure:
    When the system starts processing equipment data, then the vid segment structure is initialized and the identifier is set to 'vid'.
  • Context - equipment data exists in the train list for the current equipment index:
    For Set Equipment Description Code from Train List & Set Equipment Initial from Train List:
    When the system processes vid segment creation, then the equipment description code is set from the train list vid01 equipment type field and the equipment initial is set from the train list vid02 equipment initial field.
  • Context - equipment data is being processed for vid segment creation:
    For Is Equipment CP-owned or No Foreign Car Number?:
    When the system needs to determine the equipment number source, then if the us-ccn-key starts with 'cprs' or the 350-car-number is spaces, use equipment number from train list, otherwise use the foreign car number from cargo database.
  • Context - equipment is cp-owned (us-ccn-key starts with 'cprs') or foreign car number is not available (350-car-number is spaces):
    For Use Equipment Number from Train List:
    When the system sets the equipment number in vid segment, then the equipment number is set from the train list vid03 equipment number field.
  • Context - equipment is not cp-owned (us-ccn-key does not start with 'cprs') and foreign car number is available (350-car-number is not spaces):
    For Use Foreign Car Number from Cargo Database:
    When the system sets the equipment number in vid segment, then the equipment number is set from the cargo database 350-car-number field.
  • Context - vid segment has been populated with equipment data:
    For Insert VID Segment into EDI Data:
    When the system completes vid segment creation, then the vid segment is moved to transmission data and inserted into the edi data structure.
👨‍💻 Technical ACs (Gherkin)
Context: A VID equipment segment needs to be created
GIVEN
A VID equipment segment needs to be created
Applied to: Initialize VID Segment Structure
WHEN
The system starts processing equipment data
THEN
The VID segment structure is initialized and the identifier is set to 'VID'
Context: Equipment data exists in the train list for the current equipment index
GIVEN
Equipment data exists in the train list for the current equipment index
Applied to: Set Equipment Description Code from Train List & Set Equipment Initial from Train List
WHEN
The system processes VID segment creation
THEN
The equipment description code is set from the train list VID01 equipment type field AND The equipment initial is set from the train list VID02 equipment initial field
Context: Equipment data is being processed for VID segment creation
GIVEN
Equipment data is being processed for VID segment creation
Applied to: Is Equipment CP-owned or No Foreign Car Number?
WHEN
The system needs to determine the equipment number source
THEN
If the US-CCN-KEY starts with 'CPRS' OR the 350-CAR-NUMBER is spaces, use equipment number from train list, otherwise use the foreign car number from cargo database
Context: Equipment is CP-owned (US-CCN-KEY starts with 'CPRS') OR foreign car number is not available (350-CAR-NUMBER is spaces)
GIVEN
Equipment is CP-owned (US-CCN-KEY starts with 'CPRS') OR foreign car number is not available (350-CAR-NUMBER is spaces)
Applied to: Use Equipment Number from Train List
WHEN
The system sets the equipment number in VID segment
THEN
The equipment number is set from the train list VID03 equipment number field
Context: Equipment is not CP-owned (US-CCN-KEY does not start with 'CPRS') AND foreign car number is available (350-CAR-NUMBER is not spaces)
GIVEN
Equipment is not CP-owned (US-CCN-KEY does not start with 'CPRS') AND foreign car number is available (350-CAR-NUMBER is not spaces)
Applied to: Use Foreign Car Number from Cargo Database
WHEN
The system sets the equipment number in VID segment
THEN
The equipment number is set from the cargo database 350-CAR-NUMBER field
Context: VID segment has been populated with equipment data
GIVEN
VID segment has been populated with equipment data
Applied to: Insert VID Segment into EDI Data
WHEN
The system completes VID segment creation
THEN
The VID segment is moved to transmission data and inserted into the EDI data structure
R-GCCU358T-cbl-00085 (+8) File: GCCU358T.cbl Process Bill of Lading MBL Segments Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Bill of Lading MBL Segments':
  • Context - the system is processing cargo equipment for edi transmission:
    For Initialize MBL Segment:
    When a new mbl segment needs to be created for cargo, then the system initializes the mbl segment structure and sets the identifier to 'mbl'.
  • Context - the system is processing mbl segment for cargo equipment:
    For Valid Port?:
    When the port is valid, then the system extracts scac code and bol number from the mbl export key structure.
    For Extract SCAC and BOL from Equipment Data:
    When the port is not valid, then the system extracts scac code from equipment scac field and bol number from equipment ccn id field.
  • Context - the system is processing mbl segment with scac code information:
    For SCAC = 'CPRS'?:
    When the scac code equals 'cprs', then the system sets the automated carrier response code to 'y'.
  • Context - the system is processing mbl segment with a non-cprs scac code:
    For Lookup SCAC in SS Table:
    When the scac code is not 'cprs', then the system initializes scac table key with 'ss' table id, equipment scac code, and origin port code, then performs scac table lookup.
  • Context - the system has performed scac table lookup for a carrier:
    For SCAC Found and Automated?:
    When the scac lookup is successful and the carrier is marked as automated with 'y', then the system sets the automated carrier response code to 'y'.
    For Set Automated Carrier = 'N':
    When the scac lookup fails or the carrier is not marked as automated, then the system sets the automated carrier response code to 'n'.
  • Context - the system is processing mbl segment for equipment with cargo information:
    For Empty Equipment with BOL Type 23?:
    When the equipment load/empty status is 'e' and has associated cargo with bol type code '23', then the system overrides the automated carrier response code to 'y'.
  • Context - the system has completed processing mbl segment with all required data:
    For Insert MBL Segment to EDI:
    When the mbl segment is ready for transmission, then the system moves the mbl segment to transmission data and inserts it into the edi stream.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing cargo equipment for EDI transmission
GIVEN
The system is processing cargo equipment for EDI transmission
Applied to: Initialize MBL Segment
WHEN
A new MBL segment needs to be created for cargo
THEN
The system initializes the MBL segment structure and sets the identifier to 'MBL'
Context: The system is processing MBL segment for cargo equipment
GIVEN
The system is processing MBL segment for cargo equipment
Applied to: Valid Port?
WHEN
The port is valid
THEN
The system extracts SCAC code and BOL number from the MBL export key structure
Applied to: Extract SCAC and BOL from Equipment Data
WHEN
The port is not valid
THEN
The system extracts SCAC code from equipment SCAC field and BOL number from equipment CCN ID field
Context: The system is processing MBL segment with SCAC code information
GIVEN
The system is processing MBL segment with SCAC code information
Applied to: SCAC = 'CPRS'?
WHEN
The SCAC code equals 'CPRS'
THEN
The system sets the automated carrier response code to 'Y'
Context: The system is processing MBL segment with a non-CPRS SCAC code
GIVEN
The system is processing MBL segment with a non-CPRS SCAC code
Applied to: Lookup SCAC in SS Table
WHEN
The SCAC code is not 'CPRS'
THEN
The system initializes SCAC table key with 'SS' table ID, equipment SCAC code, and origin port code, then performs SCAC table lookup
Context: The system has performed SCAC table lookup for a carrier
GIVEN
The system has performed SCAC table lookup for a carrier
Applied to: SCAC Found and Automated?
WHEN
The SCAC lookup is successful and the carrier is marked as automated with 'Y'
THEN
The system sets the automated carrier response code to 'Y'
Applied to: Set Automated Carrier = 'N'
WHEN
The SCAC lookup fails or the carrier is not marked as automated
THEN
The system sets the automated carrier response code to 'N'
Context: The system is processing MBL segment for equipment with cargo information
GIVEN
The system is processing MBL segment for equipment with cargo information
Applied to: Empty Equipment with BOL Type 23?
WHEN
The equipment load/empty status is 'E' and has associated cargo with BOL type code '23'
THEN
The system overrides the automated carrier response code to 'Y'
Context: The system has completed processing MBL segment with all required data
GIVEN
The system has completed processing MBL segment with all required data
Applied to: Insert MBL Segment to EDI
WHEN
The MBL segment is ready for transmission
THEN
The system moves the MBL segment to transmission data and inserts it into the EDI stream
R-GCCS358C-cbl-00087 (+3) File: GCCS358C.cbl Determine EDI Version Processing Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine EDI Version Processing':
  • Context - a train manifest processing request is received:
    For Check Post-Emanifest Flag:
    When the system checks the post-emanifest flag (gcwb4tl-post-emanifest), then the system evaluates the flag to determine routing to appropriate edi version processing.
  • Context - a train manifest processing request is being evaluated for edi version routing:
    For Route to 5040 Version Processing:
    When the post-emanifest flag (gcwb4tl-post-emanifest) is set to true, then the system routes processing to b231-load-vid-mbl-5040 for enhanced equipment processing with 5040 version capabilities.
    For Route to 4040RAIL Version Processing:
    When the post-emanifest flag (gcwb4tl-post-emanifest) is not set or is false, then the system routes processing to b230-load-vid-mbl for standard equipment processing with 4040rail version capabilities.
  • Context - the edi version processing route has been determined:
    For Process All Equipment in Train List:
    When the system begins equipment processing, then the system iterates through all equipment entries (sub-tl) in the train list until an empty equipment id is encountered, processing each equipment entry using the selected processing method.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest processing request is received
GIVEN
A train manifest processing request is received
Applied to: Check Post-Emanifest Flag
WHEN
The system checks the post-emanifest flag (GCWB4TL-POST-EMANIFEST)
THEN
The system evaluates the flag to determine routing to appropriate EDI version processing
Context: A train manifest processing request is being evaluated for EDI version routing
GIVEN
A train manifest processing request is being evaluated for EDI version routing
Applied to: Route to 5040 Version Processing
WHEN
The post-emanifest flag (GCWB4TL-POST-EMANIFEST) is set to true
THEN
The system routes processing to B231-LOAD-VID-MBL-5040 for enhanced equipment processing with 5040 version capabilities
Applied to: Route to 4040RAIL Version Processing
WHEN
The post-emanifest flag (GCWB4TL-POST-EMANIFEST) is not set or is false
THEN
The system routes processing to B230-LOAD-VID-MBL for standard equipment processing with 4040RAIL version capabilities
Context: The EDI version processing route has been determined
GIVEN
The EDI version processing route has been determined
Applied to: Process All Equipment in Train List
WHEN
The system begins equipment processing
THEN
The system iterates through all equipment entries (SUB-TL) in the train list until an empty equipment ID is encountered, processing each equipment entry using the selected processing method
R-GCCE358-cbl-00090 (+7) File: GCCE358.cbl Process Bill of Lading Records Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Bill of Lading Records':
  • Context - equipment has an associated bill of lading (us-ccn-key is not spaces):
    For Initialize MBL Segment:
    When the system begins mbl processing for the equipment, then a new mbl segment structure is initialized and the mbl identifier is set to 'mbl'.
  • Context - equipment has bill of lading information:
    For Extract Carrier SCAC Code from Equipment & Extract Bill of Lading Number from Equipment:
    When processing mbl segment creation, then the carrier scac code is extracted from the equipment's mbl01-m1309-us-ccn-scac field and assigned to mbl-01-scac and the bill of lading number is extracted from the equipment's mbl02-m1304-us-ccn-id field and assigned to mbl-02-bol-waybill.
  • Context - a bill of lading with carrier information:
    For Set Automated Response to 'Y':
    When the carrier scac code equals 'cprs', then the automated response code (mbl-04-yes-no-resp-code) is set to 'y' indicating automated processing.
  • Context - a bill of lading with a non-cprs carrier:
    For Lookup Carrier in SS Table by SCAC and Port:
    When the carrier scac code is not 'cprs', then the system queries the ss table using the carrier scac code and origin port to determine automation capabilities.
  • Context - a carrier table lookup has been performed for a non-cprs carrier:
    For Set Automated Response to 'Y' or 'N':
    When the lookup is successful and the carrier's automated flag equals 'y', then the automated response code is set to 'y', otherwise it is set to 'n'.
  • Context - equipment with a bill of lading:
    For Override Response to 'Y' for Electronic Reporting:
    When the equipment load status is 'e' (empty) and the us-ccn-key is not spaces and the bill of lading type code equals 23, then the automated response code is overridden to 'y' regardless of previous carrier lookup results.
  • Context - a fully populated mbl segment with carrier and bill information:
    For Insert MBL Segment into EDI Data:
    When all mbl processing is complete, then the mbl segment is moved to the transmission data structure and inserted into the edi data stream.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment has an associated bill of lading (US-CCN-KEY is not spaces)
GIVEN
Equipment has an associated bill of lading (US-CCN-KEY is not spaces)
Applied to: Initialize MBL Segment
WHEN
The system begins MBL processing for the equipment
THEN
A new MBL segment structure is initialized and the MBL identifier is set to 'MBL'
Context: Equipment has bill of lading information
GIVEN
Equipment has bill of lading information
Applied to: Extract Carrier SCAC Code from Equipment & Extract Bill of Lading Number from Equipment
WHEN
Processing MBL segment creation
THEN
The carrier SCAC code is extracted from the equipment's MBL01-M1309-US-CCN-SCAC field and assigned to MBL-01-SCAC AND The bill of lading number is extracted from the equipment's MBL02-M1304-US-CCN-ID field and assigned to MBL-02-BOL-WAYBILL
Context: A bill of lading with carrier information
GIVEN
A bill of lading with carrier information
Applied to: Set Automated Response to 'Y'
WHEN
The carrier SCAC code equals 'CPRS'
THEN
The automated response code (MBL-04-YES-NO-RESP-CODE) is set to 'Y' indicating automated processing
Context: A bill of lading with a non-CPRS carrier
GIVEN
A bill of lading with a non-CPRS carrier
Applied to: Lookup Carrier in SS Table by SCAC and Port
WHEN
The carrier SCAC code is not 'CPRS'
THEN
The system queries the SS table using the carrier SCAC code and origin port to determine automation capabilities
Context: A carrier table lookup has been performed for a non-CPRS carrier
GIVEN
A carrier table lookup has been performed for a non-CPRS carrier
Applied to: Set Automated Response to 'Y' or 'N'
WHEN
The lookup is successful and the carrier's automated flag equals 'Y'
THEN
The automated response code is set to 'Y', otherwise it is set to 'N'
Context: Equipment with a bill of lading
GIVEN
Equipment with a bill of lading
Applied to: Override Response to 'Y' for Electronic Reporting
WHEN
The equipment load status is 'E' (Empty) AND the US-CCN-KEY is not spaces AND the bill of lading type code equals 23
THEN
The automated response code is overridden to 'Y' regardless of previous carrier lookup results
Context: A fully populated MBL segment with carrier and bill information
GIVEN
A fully populated MBL segment with carrier and bill information
Applied to: Insert MBL Segment into EDI Data
WHEN
All MBL processing is complete
THEN
The MBL segment is moved to the transmission data structure and inserted into the EDI data stream
R-GCCS358C-cbl-00091 (+16) File: GCCS358C.cbl Build VID Equipment Segment (4040RAIL) Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build VID Equipment Segment (4040RAIL)':
  • Context - an equipment unit exists in the train list with a ccn key:
    For Get Cargo Information for Equipment:
    When the system processes the equipment for manifest creation, then the system retrieves the corresponding cargo information using the ccn key and sets cargo found flag to true, or initializes empty cargo segment if no cargo exists.
  • Context - equipment processing is initiated for manifest creation:
    For Initialize VID Segment:
    When a new vid segment needs to be created, then the system initializes the vid segment and sets the identifier to 'vid'.
  • Context - a vid segment is being populated for an equipment unit:
    For Set Equipment Type from Train List:
    When equipment type information is available in the train list, then the system copies the equipment type code from the train list to the vid equipment description code field.
    For Set Equipment Initial from Train List:
    When equipment initial information is available in the train list, then the system copies the equipment initial from the train list to the vid equipment initial field.
    For Set Equipment Number from Train List:
    When equipment number information is available in the train list, then the system copies the equipment number from the train list to the vid equipment number field.
  • Context - equipment is being processed for manifest creation:
    For Equipment Marked as Loaded?:
    When the train list indicates the equipment load status, then the system sets load status to 'l' if equipment is marked as loaded, otherwise sets status to 'e' for empty.
    For Current Equipment is Flat Car? & Current Equipment is Container?:
    When the equipment type is evaluated, then the system identifies the equipment as a flat car if the type is bg, ca, et, gs, id, lo, rr, sk, or tn and the system identifies the equipment as a container if the type is cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl.
  • Context - equipment is marked as loaded in the train list:
    For Loaded but No CCN Key?:
    When the equipment has no ccn key (cargo control number) associated with it, then the system overrides the load status to 'e' (empty) regardless of the original load flag.
  • Context - equipment has an associated cargo control number key:
    For CCN Key starts with '6105I'?:
    When the ccn key starts with '6105i', then the system forces the equipment load status to 'e' (empty) regardless of other load indicators.
  • Context - equipment has associated cargo with an in-transit status:
    For Cargo In-Transit Status?:
    When the cargo in-transit status is evaluated, then the system sets location id to '0000' if status is 'r' (received), sets location id to manifest-to-trans-code if status is 't' (in-transit), or sets location id to spaces for any other status.
  • Context - current equipment is identified as a flat car type:
    For Next Equipment is Container?:
    When the next equipment in the sequence is evaluated, then the system identifies the next equipment as a container if the type is cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl.
  • Context - current equipment is a flat car and next equipment is a container:
    For Store Flat Car VID Data:
    When the flat car vid segment is created, then the system stores the flat car vid segment data and initializes container vid structures for subsequent processing.
  • Context - current equipment is a container and flat car vid data exists from previous processing:
    For Create Flat Car VID with Container Location:
    When container vid segment is being created, then the system creates a flat car vid segment with container location information, then creates the container vid segment, and processes mbl segment if equipment is loaded with cargo.
  • Context - equipment is not part of a flat car-container combination:
    For Create Standard VID Segment:
    When vid segment processing is performed, then the system creates a standard vid segment and processes mbl segment if equipment is loaded with cargo.
  • Context - equipment vid segment has been created:
    For Equipment Has CCN and is Loaded?:
    When the system evaluates mbl processing requirements, then the system creates an mbl segment if the equipment is loaded and has an associated ccn key (cargo control number).
  • Context - current equipment vid processing is complete:
    For More Equipment to Process?:
    When the system checks for additional equipment in the train list, then the system continues processing the next equipment unit if more equipment exists, otherwise completes vid processing.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment unit exists in the train list with a CCN key
GIVEN
An equipment unit exists in the train list with a CCN key
Applied to: Get Cargo Information for Equipment
WHEN
The system processes the equipment for manifest creation
THEN
The system retrieves the corresponding cargo information using the CCN key and sets cargo found flag to true, or initializes empty cargo segment if no cargo exists
Context: Equipment processing is initiated for manifest creation
GIVEN
Equipment processing is initiated for manifest creation
Applied to: Initialize VID Segment
WHEN
A new VID segment needs to be created
THEN
The system initializes the VID segment and sets the identifier to 'VID'
Context: A VID segment is being populated for an equipment unit
GIVEN
A VID segment is being populated for an equipment unit
Applied to: Set Equipment Type from Train List
WHEN
Equipment type information is available in the train list
THEN
The system copies the equipment type code from the train list to the VID equipment description code field
Applied to: Set Equipment Initial from Train List
WHEN
Equipment initial information is available in the train list
THEN
The system copies the equipment initial from the train list to the VID equipment initial field
Applied to: Set Equipment Number from Train List
WHEN
Equipment number information is available in the train list
THEN
The system copies the equipment number from the train list to the VID equipment number field
Context: Equipment is being processed for manifest creation
GIVEN
Equipment is being processed for manifest creation
Applied to: Equipment Marked as Loaded?
WHEN
The train list indicates the equipment load status
THEN
The system sets load status to 'L' if equipment is marked as loaded, otherwise sets status to 'E' for empty
Applied to: Current Equipment is Flat Car? & Current Equipment is Container?
WHEN
The equipment type is evaluated
THEN
The system identifies the equipment as a flat car if the type is BG, CA, ET, GS, ID, LO, RR, SK, or TN AND The system identifies the equipment as a container if the type is CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
Context: Equipment is marked as loaded in the train list
GIVEN
Equipment is marked as loaded in the train list
Applied to: Loaded but No CCN Key?
WHEN
The equipment has no CCN key (cargo control number) associated with it
THEN
The system overrides the load status to 'E' (empty) regardless of the original load flag
Context: Equipment has an associated cargo control number key
GIVEN
Equipment has an associated cargo control number key
Applied to: CCN Key starts with '6105I'?
WHEN
The CCN key starts with '6105I'
THEN
The system forces the equipment load status to 'E' (empty) regardless of other load indicators
Context: Equipment has associated cargo with an in-transit status
GIVEN
Equipment has associated cargo with an in-transit status
Applied to: Cargo In-Transit Status?
WHEN
The cargo in-transit status is evaluated
THEN
The system sets location ID to '0000' if status is 'R' (received), sets location ID to manifest-to-trans-code if status is 'T' (in-transit), or sets location ID to spaces for any other status
Context: Current equipment is identified as a flat car type
GIVEN
Current equipment is identified as a flat car type
Applied to: Next Equipment is Container?
WHEN
The next equipment in the sequence is evaluated
THEN
The system identifies the next equipment as a container if the type is CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
Context: Current equipment is a flat car and next equipment is a container
GIVEN
Current equipment is a flat car and next equipment is a container
Applied to: Store Flat Car VID Data
WHEN
The flat car VID segment is created
THEN
The system stores the flat car VID segment data and initializes container VID structures for subsequent processing
Context: Current equipment is a container and flat car VID data exists from previous processing
GIVEN
Current equipment is a container and flat car VID data exists from previous processing
Applied to: Create Flat Car VID with Container Location
WHEN
Container VID segment is being created
THEN
The system creates a flat car VID segment with container location information, then creates the container VID segment, and processes MBL segment if equipment is loaded with cargo
Context: Equipment is not part of a flat car-container combination
GIVEN
Equipment is not part of a flat car-container combination
Applied to: Create Standard VID Segment
WHEN
VID segment processing is performed
THEN
The system creates a standard VID segment and processes MBL segment if equipment is loaded with cargo
Context: Equipment VID segment has been created
GIVEN
Equipment VID segment has been created
Applied to: Equipment Has CCN and is Loaded?
WHEN
The system evaluates MBL processing requirements
THEN
The system creates an MBL segment if the equipment is loaded and has an associated CCN key (cargo control number)
Context: Current equipment VID processing is complete
GIVEN
Current equipment VID processing is complete
Applied to: More Equipment to Process?
WHEN
The system checks for additional equipment in the train list
THEN
The system continues processing the next equipment unit if more equipment exists, otherwise completes VID processing
R-GCCU358T-cbl-00094 (+4) File: GCCU358T.cbl Process N9 Reference Segments Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process N9 Reference Segments':
  • Context - a cargo record exists with a specific bill of lading type:
    For Is Bill Transportation Export?:
    When the system processes the cargo record and the bill of lading type is transportation export (88-gcusrt-m1201-transp-export condition is true), then the system should proceed to create an n9 reference segment.
  • Context - the system has determined that an n9 segment needs to be created for a transportation export bill:
    For Initialize N9 Segment:
    When the n9 segment processing begins, then the system should initialize the n9 data structure to clear any previous values.
  • Context - an n9 segment is being created for a transportation export bill:
    For Set Reference Number Qualifier to 'IB':
    When the system populates the reference number qualifier field, then the reference number qualifier should be set to 'ib' to indicate in-bond reference.
  • Context - an n9 segment is being created and the cargo record contains an entry number:
    For Set Entry Number from Cargo Record:
    When the system populates the reference number field, then the entry number from the cargo record (gcusrt-m1202-entry-num) should be assigned to the n9 reference number field.
  • Context - an n9 segment has been fully populated with reference qualifier and entry number:
    For Insert N9 Segment into EDI Data:
    When the system processes the completed n9 segment, then the n9 segment should be moved to the transmission data area and inserted into the edi data stream.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with a specific bill of lading type
GIVEN
A cargo record exists with a specific bill of lading type
Applied to: Is Bill Transportation Export?
WHEN
The system processes the cargo record and the bill of lading type is transportation export (88-GCUSRT-M1201-TRANSP-EXPORT condition is true)
THEN
The system should proceed to create an N9 reference segment
Context: The system has determined that an N9 segment needs to be created for a transportation export bill
GIVEN
The system has determined that an N9 segment needs to be created for a transportation export bill
Applied to: Initialize N9 Segment
WHEN
The N9 segment processing begins
THEN
The system should initialize the N9 data structure to clear any previous values
Context: An N9 segment is being created for a transportation export bill
GIVEN
An N9 segment is being created for a transportation export bill
Applied to: Set Reference Number Qualifier to 'IB'
WHEN
The system populates the reference number qualifier field
THEN
The reference number qualifier should be set to 'IB' to indicate in-bond reference
Context: An N9 segment is being created and the cargo record contains an entry number
GIVEN
An N9 segment is being created and the cargo record contains an entry number
Applied to: Set Entry Number from Cargo Record
WHEN
The system populates the reference number field
THEN
The entry number from the cargo record (GCUSRT-M1202-ENTRY-NUM) should be assigned to the N9 reference number field
Context: An N9 segment has been fully populated with reference qualifier and entry number
GIVEN
An N9 segment has been fully populated with reference qualifier and entry number
Applied to: Insert N9 Segment into EDI Data
WHEN
The system processes the completed N9 segment
THEN
The N9 segment should be moved to the transmission data area and inserted into the EDI data stream
R-GCCE358-cbl-00098 (+4) File: GCCE358.cbl Determine Automated Carrier Status Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Automated Carrier Status':
  • Context - a bill of lading record is being processed with carrier scac code:
    For Is Carrier SCAC = 'CPRS'?:
    When the carrier scac code equals 'cprs', then set the response code to 'y' indicating automated carrier processing.
  • Context - a bill of lading record with a non-cprs carrier scac code:
    For Build SS Table Lookup Key:
    When the carrier automation status needs to be determined, then initialize the ss table lookup with table id 'ss', the carrier scac code, and the origin port.
  • Context - ss table lookup key is prepared with scac code and port:
    For Search SS Table with SCAC Code and Port:
    When carrier automation status lookup is performed, then search the ss table using the prepared key to retrieve carrier automation information.
  • Context - ss table lookup was successful and carrier record is found:
    For Is Carrier Marked as Automated in SS Table?:
    When the automated carrier flag is evaluated, then if the automated carrier flag equals 'y', set response code to 'y', otherwise set response code to 'n'.
  • Context - a carrier scac code and port combination:
    For Set Response Code to 'N' - Carrier Not Automated:
    When the ss table lookup fails to find a matching carrier record, then set the response code to 'n' indicating non-automated carrier processing.
👨‍💻 Technical ACs (Gherkin)
Context: A bill of lading record is being processed with carrier SCAC code
GIVEN
A bill of lading record is being processed with carrier SCAC code
Applied to: Is Carrier SCAC = 'CPRS'?
WHEN
The carrier SCAC code equals 'CPRS'
THEN
Set the response code to 'Y' indicating automated carrier processing
Context: A bill of lading record with a non-CPRS carrier SCAC code
GIVEN
A bill of lading record with a non-CPRS carrier SCAC code
Applied to: Build SS Table Lookup Key
WHEN
The carrier automation status needs to be determined
THEN
Initialize the SS table lookup with table ID 'SS', the carrier SCAC code, and the origin port
Context: SS table lookup key is prepared with SCAC code and port
GIVEN
SS table lookup key is prepared with SCAC code and port
Applied to: Search SS Table with SCAC Code and Port
WHEN
Carrier automation status lookup is performed
THEN
Search the SS table using the prepared key to retrieve carrier automation information
Context: SS table lookup was successful and carrier record is found
GIVEN
SS table lookup was successful and carrier record is found
Applied to: Is Carrier Marked as Automated in SS Table?
WHEN
The automated carrier flag is evaluated
THEN
If the automated carrier flag equals 'Y', set response code to 'Y', otherwise set response code to 'N'
Context: A carrier SCAC code and port combination
GIVEN
A carrier SCAC code and port combination
Applied to: Set Response Code to 'N' - Carrier Not Automated
WHEN
The SS table lookup fails to find a matching carrier record
THEN
Set the response code to 'N' indicating non-automated carrier processing
R-GCCU358T-cbl-00099 (+11) File: GCCU358T.cbl Update Train Status to SENT Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Train Status to SENT':
  • Context - a train id exists in the system:
    For Retrieve Train Record:
    When the system needs to update train status, then the train record is retrieved using the train id as the key.
  • Context - a train retrieval operation has been performed:
    For Train Found?:
    When the system checks if the train record was found, then processing continues only if the train record exists, otherwise the process terminates.
  • Context - a train record exists with cargo information and port details:
    For Has Valid Bills or Valid Port?:
    When the system evaluates processing eligibility, then the train is eligible for processing if it has valid bills of lading (bol quantity > 0) or operates through a valid authorized port.
  • Context - a train has valid bills of lading or operates through a valid port:
    For Set Train Status to SENT:
    When the system processes the train for edi transmission, then the train status is set to sent to indicate successful processing eligibility.
  • Context - a train status has been set to sent:
    For Set Train Send EDI Flag to TRUE:
    When the system configures transmission settings, then the edi send flag is set to true to enable electronic data interchange transmission.
  • Context - a train has no valid bills of lading and does not operate through a valid port:
    For Set Train Status to ACK:
    When the system evaluates the train for processing, then the train status is set to ack to indicate acknowledgment without transmission.
  • Context - a train status has been set to ack:
    For Previously Marked to Send?:
    When the system determines final edi configuration, then the system checks if the train was previously marked to send edi transmissions.
  • Context - a train status is ack and the train was previously marked to send edi:
    For Set Delete Required Flag:
    When the system finalizes train disposition, then the delete required flag is set to true to trigger train record cleanup.
  • Context - a train status is ack and the train was not previously marked to send edi:
    For Set Do Not Send EDI Flag:
    When the system finalizes edi configuration, then the do not send edi flag is set to true to prevent transmission attempts.
  • Context - train status and edi flags have been determined:
    For Update Train Record:
    When the system completes status processing, then all changes are saved to the train record in the database.
  • Context - train record has been updated with new status and flags:
    For Delete Required?:
    When the system checks for additional processing requirements, then deletion process is triggered only if the delete required flag is set to true.
  • Context - a train has been marked with delete required flag set to true:
    For Trigger Train Deletion Process:
    When the system processes deletion requirements, then the train deletion process is initiated by calling the appropriate deletion program.
👨‍💻 Technical ACs (Gherkin)
Context: A train ID exists in the system
GIVEN
A train ID exists in the system
Applied to: Retrieve Train Record
WHEN
The system needs to update train status
THEN
The train record is retrieved using the train ID as the key
Context: A train retrieval operation has been performed
GIVEN
A train retrieval operation has been performed
Applied to: Train Found?
WHEN
The system checks if the train record was found
THEN
Processing continues only if the train record exists, otherwise the process terminates
Context: A train record exists with cargo information and port details
GIVEN
A train record exists with cargo information and port details
Applied to: Has Valid Bills or Valid Port?
WHEN
The system evaluates processing eligibility
THEN
The train is eligible for processing if it has valid bills of lading (BOL quantity > 0) OR operates through a valid authorized port
Context: A train has valid bills of lading or operates through a valid port
GIVEN
A train has valid bills of lading or operates through a valid port
Applied to: Set Train Status to SENT
WHEN
The system processes the train for EDI transmission
THEN
The train status is set to SENT to indicate successful processing eligibility
Context: A train status has been set to SENT
GIVEN
A train status has been set to SENT
Applied to: Set Train Send EDI Flag to TRUE
WHEN
The system configures transmission settings
THEN
The EDI send flag is set to TRUE to enable electronic data interchange transmission
Context: A train has no valid bills of lading and does not operate through a valid port
GIVEN
A train has no valid bills of lading and does not operate through a valid port
Applied to: Set Train Status to ACK
WHEN
The system evaluates the train for processing
THEN
The train status is set to ACK to indicate acknowledgment without transmission
Context: A train status has been set to ACK
GIVEN
A train status has been set to ACK
Applied to: Previously Marked to Send?
WHEN
The system determines final EDI configuration
THEN
The system checks if the train was previously marked to send EDI transmissions
Context: A train status is ACK and the train was previously marked to send EDI
GIVEN
A train status is ACK and the train was previously marked to send EDI
Applied to: Set Delete Required Flag
WHEN
The system finalizes train disposition
THEN
The delete required flag is set to TRUE to trigger train record cleanup
Context: A train status is ACK and the train was not previously marked to send EDI
GIVEN
A train status is ACK and the train was not previously marked to send EDI
Applied to: Set Do Not Send EDI Flag
WHEN
The system finalizes EDI configuration
THEN
The do not send EDI flag is set to TRUE to prevent transmission attempts
Context: Train status and EDI flags have been determined
GIVEN
Train status and EDI flags have been determined
Applied to: Update Train Record
WHEN
The system completes status processing
THEN
All changes are saved to the train record in the database
Context: Train record has been updated with new status and flags
GIVEN
Train record has been updated with new status and flags
Applied to: Delete Required?
WHEN
The system checks for additional processing requirements
THEN
Deletion process is triggered only if the delete required flag is set to TRUE
Context: A train has been marked with delete required flag set to TRUE
GIVEN
A train has been marked with delete required flag set to TRUE
Applied to: Trigger Train Deletion Process
WHEN
The system processes deletion requirements
THEN
The train deletion process is initiated by calling the appropriate deletion program
R-GCCE358-cbl-00103 File: GCCE358.cbl Apply Special ER Processing Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Special ER Processing Rules':
  • Context - an equipment item is being processed for mbl record creation:
    For Apply Special ER Processing Rules - For empty cars with bill type 23, override response code to 'Y' for electronic reporting:
    When the equipment status is 'e' (empty) and the equipment has a us ccn key (not spaces) and the bill of lading type code is 23, then the mbl response code is set to 'y' for electronic reporting regardless of other response code logic.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed for MBL record creation
GIVEN
An equipment item is being processed for MBL record creation
Applied to: Apply Special ER Processing Rules - For empty cars with bill type 23, override response code to 'Y' for electronic reporting
WHEN
The equipment status is 'E' (Empty) AND the equipment has a US CCN key (not spaces) AND the bill of lading type code is 23
THEN
The MBL response code is set to 'Y' for electronic reporting regardless of other response code logic
R-GCCE358-cbl-00104 (+9) File: GCCE358.cbl Create MBL Bill Segment Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Create MBL Bill Segment':
  • Context - a bill of lading processing request is initiated:
    For Initialize MBL Segment Structure:
    When the system begins mbl segment creation, then the mbl segment structure is initialized to clear any previous data.
  • Context - an mbl segment is being created:
    For Set MBL Identifier to 'MBL':
    When the segment identifier needs to be set, then the identifier is set to 'mbl' to indicate this is a master bill of lading segment.
  • Context - an equipment item is being processed for mbl creation:
    For Extract SCAC Code from Equipment Record:
    When the scac code is needed for the mbl segment, then the scac code is extracted from the equipment record's ccn scac field.
    For Extract Bill of Lading Number from Equipment Record:
    When the bill of lading number is needed for the mbl segment, then the bill of lading number is extracted from the equipment record's ccn id field.
  • Context - an mbl segment is being created with a scac code:
    For Is SCAC Code 'CPRS'?:
    When the scac code equals 'cprs', then the response code is set to 'y' indicating automated processing for cp rail.
  • Context - an mbl segment is being created with a non-cprs scac code:
    For Look up SCAC in SS Table for Port:
    When the scac code is not 'cprs', then the system performs a table lookup using table id 'ss', the scac code, and the origin port to determine carrier automation status.
  • Context - a scac table lookup has been performed for an external carrier:
    For SCAC Found and Automated?:
    When the lookup is successful and the carrier's automated flag is 'y', then the response code is set to 'y' indicating automated processing.
    For Set Response Code to 'N' - Manual:
    When the lookup fails or the carrier's automated flag is not 'y', then the response code is set to 'n' indicating manual processing required.
  • Context - an mbl segment response code has been determined:
    For Is Equipment Empty with Bill Type 23?:
    When the equipment load/empty status is 'e' and the ccn key is not spaces and the bill type code is 23, then the response code is overridden to 'y' for special er processing requirements.
  • Context - an mbl segment has been fully populated with all required data:
    For Insert MBL Segment into EDI Data:
    When the segment is ready for transmission, then the mbl segment is inserted into the edi transmission data structure.
👨‍💻 Technical ACs (Gherkin)
Context: A bill of lading processing request is initiated
GIVEN
A bill of lading processing request is initiated
Applied to: Initialize MBL Segment Structure
WHEN
The system begins MBL segment creation
THEN
The MBL segment structure is initialized to clear any previous data
Context: An MBL segment is being created
GIVEN
An MBL segment is being created
Applied to: Set MBL Identifier to 'MBL'
WHEN
The segment identifier needs to be set
THEN
The identifier is set to 'MBL' to indicate this is a Master Bill of Lading segment
Context: An equipment item is being processed for MBL creation
GIVEN
An equipment item is being processed for MBL creation
Applied to: Extract SCAC Code from Equipment Record
WHEN
The SCAC code is needed for the MBL segment
THEN
The SCAC code is extracted from the equipment record's CCN SCAC field
Applied to: Extract Bill of Lading Number from Equipment Record
WHEN
The bill of lading number is needed for the MBL segment
THEN
The bill of lading number is extracted from the equipment record's CCN ID field
Context: An MBL segment is being created with a SCAC code
GIVEN
An MBL segment is being created with a SCAC code
Applied to: Is SCAC Code 'CPRS'?
WHEN
The SCAC code equals 'CPRS'
THEN
The response code is set to 'Y' indicating automated processing for CP Rail
Context: An MBL segment is being created with a non-CPRS SCAC code
GIVEN
An MBL segment is being created with a non-CPRS SCAC code
Applied to: Look up SCAC in SS Table for Port
WHEN
The SCAC code is not 'CPRS'
THEN
The system performs a table lookup using table ID 'SS', the SCAC code, and the origin port to determine carrier automation status
Context: A SCAC table lookup has been performed for an external carrier
GIVEN
A SCAC table lookup has been performed for an external carrier
Applied to: SCAC Found and Automated?
WHEN
The lookup is successful AND the carrier's automated flag is 'Y'
THEN
The response code is set to 'Y' indicating automated processing
Applied to: Set Response Code to 'N' - Manual
WHEN
The lookup fails OR the carrier's automated flag is not 'Y'
THEN
The response code is set to 'N' indicating manual processing required
Context: An MBL segment response code has been determined
GIVEN
An MBL segment response code has been determined
Applied to: Is Equipment Empty with Bill Type 23?
WHEN
The equipment load/empty status is 'E' AND the CCN key is not spaces AND the bill type code is 23
THEN
The response code is overridden to 'Y' for special ER processing requirements
Context: An MBL segment has been fully populated with all required data
GIVEN
An MBL segment has been fully populated with all required data
Applied to: Insert MBL Segment into EDI Data
WHEN
The segment is ready for transmission
THEN
The MBL segment is inserted into the EDI transmission data structure
R-GCCS358C-cbl-00108 (+14) File: GCCS358C.cbl Build VID Equipment Segment (5040) Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build VID Equipment Segment (5040)':
  • Context - equipment processing is starting for 5040 version:
    For Initialize VID Segment Structure:
    When vid segment initialization is required, then vid segment structure is cleared and ready for data population.
  • Context - vid segment is being created:
    For Set Equipment Identifier to 'VID':
    When equipment identifier needs to be set, then vid identifier is set to 'vid'.
  • Context - equipment data exists in train list:
    For Copy Equipment Type from Train List:
    When vid segment requires equipment type, then equipment type is copied from train list vid01 field to vid equipment description code.
    For Copy Equipment Initial from Train List:
    When vid segment requires equipment initial, then equipment initial is copied from train list vid02 field to vid equipment initial.
    For Copy Equipment Number from Train List:
    When vid segment requires equipment number, then equipment number is copied from train list vid03 field to vid equipment number.
  • Context - equipment is being processed for 5040 version:
    For Equipment Loaded OR Empty with CCN?:
    When equipment is loaded or equipment is empty and has a cargo control number, then load empty status code is set to 'l' for loaded.
    For Set Load Status to 'E':
    When equipment is not loaded and (equipment is not empty or has no cargo control number), then load empty status code is set to 'e' for empty.
  • Context - equipment is marked as loaded:
    For Equipment Loaded AND No CCN?:
    When equipment has no cargo control number (ccn is spaces), then load empty status code is overridden to 'e' for empty.
  • Context - equipment has an associated cargo control number:
    For CCN Key starts with '6105I'?:
    When ccn key starts with '6105i', then load empty status code is overridden to 'e' for empty regardless of other conditions.
  • Context - equipment has associated cargo information:
    For In-Transit Status = 'R'?:
    When cargo in-transit status is 'r' for refused, then vid location id is set to '0000'.
    For Set Location ID to Spaces:
    When cargo in-transit status is neither 'r' nor 't', then vid location id is set to spaces.
  • Context - equipment has associated cargo information and in-transit status is not 'r':
    For In-Transit Status = 'T'?:
    When cargo in-transit status is 't' for transit, then vid location id is set to manifest-to-trans-code from cargo data.
  • Context - equipment is identified as a possible flat car type:
    For Check Equipment for Flat Car Processing:
    When flat car processing is initiated, then system checks subsequent container equipment for load status and updates flat car status accordingly.
  • Context - vid segment is fully populated with equipment data:
    For Insert VID Segment to Database:
    When vid segment insertion is performed, then vid segment is stored in transmission database with proper sequence number.
  • Context - vid equipment segment has been processed:
    For Process N9 and MBL Segments:
    When associated segment processing is required, then n9 reference segments and mbl bill of lading segments are processed based on equipment and cargo conditions.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment processing is starting for 5040 version
GIVEN
Equipment processing is starting for 5040 version
Applied to: Initialize VID Segment Structure
WHEN
VID segment initialization is required
THEN
VID segment structure is cleared and ready for data population
Context: VID segment is being created
GIVEN
VID segment is being created
Applied to: Set Equipment Identifier to 'VID'
WHEN
Equipment identifier needs to be set
THEN
VID identifier is set to 'VID'
Context: Equipment data exists in train list
GIVEN
Equipment data exists in train list
Applied to: Copy Equipment Type from Train List
WHEN
VID segment requires equipment type
THEN
Equipment type is copied from train list VID01 field to VID equipment description code
Applied to: Copy Equipment Initial from Train List
WHEN
VID segment requires equipment initial
THEN
Equipment initial is copied from train list VID02 field to VID equipment initial
Applied to: Copy Equipment Number from Train List
WHEN
VID segment requires equipment number
THEN
Equipment number is copied from train list VID03 field to VID equipment number
Context: Equipment is being processed for 5040 version
GIVEN
Equipment is being processed for 5040 version
Applied to: Equipment Loaded OR Empty with CCN?
WHEN
Equipment is loaded OR equipment is empty AND has a cargo control number
THEN
Load empty status code is set to 'L' for loaded
Applied to: Set Load Status to 'E'
WHEN
Equipment is NOT loaded AND (equipment is NOT empty OR has no cargo control number)
THEN
Load empty status code is set to 'E' for empty
Context: Equipment is marked as loaded
GIVEN
Equipment is marked as loaded
Applied to: Equipment Loaded AND No CCN?
WHEN
Equipment has no cargo control number (CCN is spaces)
THEN
Load empty status code is overridden to 'E' for empty
Context: Equipment has an associated cargo control number
GIVEN
Equipment has an associated cargo control number
Applied to: CCN Key starts with '6105I'?
WHEN
CCN key starts with '6105I'
THEN
Load empty status code is overridden to 'E' for empty regardless of other conditions
Context: Equipment has associated cargo information
GIVEN
Equipment has associated cargo information
Applied to: In-Transit Status = 'R'?
WHEN
Cargo in-transit status is 'R' for refused
THEN
VID location ID is set to '0000'
Applied to: Set Location ID to Spaces
WHEN
Cargo in-transit status is neither 'R' nor 'T'
THEN
VID location ID is set to spaces
Context: Equipment has associated cargo information AND in-transit status is not 'R'
GIVEN
Equipment has associated cargo information AND in-transit status is not 'R'
Applied to: In-Transit Status = 'T'?
WHEN
Cargo in-transit status is 'T' for transit
THEN
VID location ID is set to manifest-to-trans-code from cargo data
Context: Equipment is identified as a possible flat car type
GIVEN
Equipment is identified as a possible flat car type
Applied to: Check Equipment for Flat Car Processing
WHEN
Flat car processing is initiated
THEN
System checks subsequent container equipment for load status and updates flat car status accordingly
Context: VID segment is fully populated with equipment data
GIVEN
VID segment is fully populated with equipment data
Applied to: Insert VID Segment to Database
WHEN
VID segment insertion is performed
THEN
VID segment is stored in transmission database with proper sequence number
Context: VID equipment segment has been processed
GIVEN
VID equipment segment has been processed
Applied to: Process N9 and MBL Segments
WHEN
Associated segment processing is required
THEN
N9 reference segments and MBL bill of lading segments are processed based on equipment and cargo conditions
R-GCCU358T-cbl-00111 (+10) File: GCCU358T.cbl Update Train Status to ACK Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Train Status to ACK':
  • Context - a train processing request with customer train id:
    For Retrieve Train Record from Database:
    When the system needs to update train status, then the system retrieves the train record from database using the customer train id.
  • Context - a database lookup for train record has been performed:
    For Train Found?:
    When the system checks if train record was found, then the system continues processing if train found, otherwise exits the process.
  • Context - a train record with bill of lading count and port validation status:
    For Has Valid Bills of Lading OR Valid Port?:
    When the system evaluates transmission requirements, then the system proceeds with edi transmission if bill of lading count is greater than zero or port is valid.
  • Context - a train with valid bills of lading or valid port status:
    For Set Train Status to SENT Mark for EDI Transmission:
    When the system determines edi transmission is required, then the system sets train status to sent and marks train for edi transmission.
  • Context - a train with no valid bills of lading and invalid port status:
    For Set Train Status to ACK No Transmission Required:
    When the system determines no edi transmission is required, then the system sets train status to ack indicating no transmission required.
  • Context - a train with ack status that requires no edi transmission:
    For Was Train Previously Marked for EDI Send?:
    When the system evaluates previous edi send configuration, then the system checks if train was previously marked to send edi.
  • Context - a train with ack status that was previously marked for edi send:
    For Mark Train for Deletion Set DELETE-REQUIRED Flag:
    When the system determines train configuration has changed, then the system sets delete-required flag to mark train for deletion process.
  • Context - a train with ack status that was never previously marked for edi send:
    For Set Train to DO-NOT-SEND-EDI:
    When the system determines train should not send edi, then the system sets train configuration to do-not-send-edi.
  • Context - a train record with updated status and configuration flags:
    For Update Train Record in Database:
    When the system completes status determination logic, then the system updates the train record in the database with new status and flags.
  • Context - a train record that has been updated in the database:
    For Train Marked for Deletion?:
    When the system evaluates post-update processing requirements, then the system checks if train has delete-required flag set.
  • Context - a train record marked with delete-required flag:
    For Trigger Train Deletion Process:
    When the system determines deletion process is needed, then the system triggers external train deletion process.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request with customer train ID
GIVEN
A train processing request with customer train ID
Applied to: Retrieve Train Record from Database
WHEN
The system needs to update train status
THEN
The system retrieves the train record from database using the customer train ID
Context: A database lookup for train record has been performed
GIVEN
A database lookup for train record has been performed
Applied to: Train Found?
WHEN
The system checks if train record was found
THEN
The system continues processing if train found, otherwise exits the process
Context: A train record with bill of lading count and port validation status
GIVEN
A train record with bill of lading count and port validation status
Applied to: Has Valid Bills of Lading OR Valid Port?
WHEN
The system evaluates transmission requirements
THEN
The system proceeds with EDI transmission if bill of lading count is greater than zero OR port is valid
Context: A train with valid bills of lading OR valid port status
GIVEN
A train with valid bills of lading OR valid port status
Applied to: Set Train Status to SENT Mark for EDI Transmission
WHEN
The system determines EDI transmission is required
THEN
The system sets train status to SENT and marks train for EDI transmission
Context: A train with no valid bills of lading AND invalid port status
GIVEN
A train with no valid bills of lading AND invalid port status
Applied to: Set Train Status to ACK No Transmission Required
WHEN
The system determines no EDI transmission is required
THEN
The system sets train status to ACK indicating no transmission required
Context: A train with ACK status that requires no EDI transmission
GIVEN
A train with ACK status that requires no EDI transmission
Applied to: Was Train Previously Marked for EDI Send?
WHEN
The system evaluates previous EDI send configuration
THEN
The system checks if train was previously marked to send EDI
Context: A train with ACK status that was previously marked for EDI send
GIVEN
A train with ACK status that was previously marked for EDI send
Applied to: Mark Train for Deletion Set DELETE-REQUIRED Flag
WHEN
The system determines train configuration has changed
THEN
The system sets DELETE-REQUIRED flag to mark train for deletion process
Context: A train with ACK status that was never previously marked for EDI send
GIVEN
A train with ACK status that was never previously marked for EDI send
Applied to: Set Train to DO-NOT-SEND-EDI
WHEN
The system determines train should not send EDI
THEN
The system sets train configuration to DO-NOT-SEND-EDI
Context: A train record with updated status and configuration flags
GIVEN
A train record with updated status and configuration flags
Applied to: Update Train Record in Database
WHEN
The system completes status determination logic
THEN
The system updates the train record in the database with new status and flags
Context: A train record that has been updated in the database
GIVEN
A train record that has been updated in the database
Applied to: Train Marked for Deletion?
WHEN
The system evaluates post-update processing requirements
THEN
The system checks if train has DELETE-REQUIRED flag set
Context: A train record marked with DELETE-REQUIRED flag
GIVEN
A train record marked with DELETE-REQUIRED flag
Applied to: Trigger Train Deletion Process
WHEN
The system determines deletion process is needed
THEN
The system triggers external train deletion process
R-GCCE358-cbl-00114 (+12) File: GCCE358.cblFile: GCCU358T.cbl Start EDI Send Function Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Start EDI Send Function':
  • Context - the system needs to initiate edi message transmission:
    For Set EDI Send Function Name:
    When the edi send process is started, then the system sets the edi send function name flag to true to identify the correct processing function.
  • Context - an edi message is being prepared for transmission:
    For Set Security Authorization:
    When security authorization is being configured, then the system sets the security byte to high-values to enforce maximum security protection.
  • Context - a transmission number has been generated for the current edi process:
    For Add Transmission Number to Message:
    When the edi message is being prepared, then the system adds the transmission number to the message structure for identification.
  • Context - all edi message components including security, transmission number, and function name are configured:
    For Prepare EDI Message for Transmission:
    When the message preparation process is executed, then the system moves the complete input structure to the message output text for transmission.
  • Context - an edi message is ready for transmission:
    For Send Message to EDI Queue:
    When the message is being sent to the edi queue, then the system sets the edi send function length flag to ensure proper message sizing.
  • Context - an edi message is formatted and ready with proper length specification:
    For Send Message to EDI Queue:
    When the message insertion process is initiated, then the system performs the insert purge message operation to queue the message for transmission.
  • Context - the system needs to initiate edi transmission processing:
    For Set EDI Send Function Name:
    When the edi send function process is started, then the system sets the edi send function name identifier to true.
  • Context - the edi send function name has been set:
    For Change to EDI Send Function:
    When the system needs to change processing context, then the system performs the function change operation to switch to edi send context.
  • Context - the system is preparing an edi transmission:
    For Set Security to High Values:
    When security parameters need to be established, then the system sets the security byte to high-values for maximum security.
  • Context - a transmission number has been generated during root processing:
    For Set Transmission Number:
    When the edi message is being prepared for transmission, then the system assigns the working storage transmission number to the edi message transmission number field.
  • Context - the transmission number and security parameters have been set:
    For Prepare EDI Send Message:
    When the edi message needs to be formatted for transmission, then the system moves the edi input structure to the message output text field.
  • Context - the edi message has been prepared:
    For Set Message Length:
    When the message length needs to be established, then the system sets the edi send function length indicator to true.
  • Context - the edi message is properly formatted with correct length and security:
    For Insert and Purge Message:
    When the message is ready for transmission, then the system performs the insert and purge message operation to complete the edi transmission.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to initiate EDI message transmission
GIVEN
The system needs to initiate EDI message transmission
Applied to: Set EDI Send Function Name
WHEN
The EDI send process is started
THEN
The system sets the EDI send function name flag to true to identify the correct processing function
Context: An EDI message is being prepared for transmission
GIVEN
An EDI message is being prepared for transmission
Applied to: Set Security Authorization
WHEN
Security authorization is being configured
THEN
The system sets the security byte to high-values to enforce maximum security protection
Context: A transmission number has been generated for the current EDI process
GIVEN
A transmission number has been generated for the current EDI process
Applied to: Add Transmission Number to Message
WHEN
The EDI message is being prepared
THEN
The system adds the transmission number to the message structure for identification
Context: All EDI message components including security, transmission number, and function name are configured
GIVEN
All EDI message components including security, transmission number, and function name are configured
Applied to: Prepare EDI Message for Transmission
WHEN
The message preparation process is executed
THEN
The system moves the complete input structure to the message output text for transmission
Context: An EDI message is ready for transmission
GIVEN
An EDI message is ready for transmission
Applied to: Send Message to EDI Queue
WHEN
The message is being sent to the EDI queue
THEN
The system sets the EDI send function length flag to ensure proper message sizing
Context: An EDI message is formatted and ready with proper length specification
GIVEN
An EDI message is formatted and ready with proper length specification
Applied to: Send Message to EDI Queue
WHEN
The message insertion process is initiated
THEN
The system performs the insert purge message operation to queue the message for transmission
Context: The system needs to initiate EDI transmission processing
GIVEN
The system needs to initiate EDI transmission processing
Applied to: Set EDI Send Function Name
WHEN
The EDI send function process is started
THEN
The system sets the EDI send function name identifier to TRUE
Context: The EDI send function name has been set
GIVEN
The EDI send function name has been set
Applied to: Change to EDI Send Function
WHEN
The system needs to change processing context
THEN
The system performs the function change operation to switch to EDI send context
Context: The system is preparing an EDI transmission
GIVEN
The system is preparing an EDI transmission
Applied to: Set Security to High Values
WHEN
Security parameters need to be established
THEN
The system sets the security byte to HIGH-VALUES for maximum security
Context: A transmission number has been generated during root processing
GIVEN
A transmission number has been generated during root processing
Applied to: Set Transmission Number
WHEN
The EDI message is being prepared for transmission
THEN
The system assigns the working storage transmission number to the EDI message transmission number field
Context: The transmission number and security parameters have been set
GIVEN
The transmission number and security parameters have been set
Applied to: Prepare EDI Send Message
WHEN
The EDI message needs to be formatted for transmission
THEN
The system moves the EDI input structure to the message output text field
Context: The EDI message has been prepared
GIVEN
The EDI message has been prepared
Applied to: Set Message Length
WHEN
The message length needs to be established
THEN
The system sets the EDI send function length indicator to TRUE
Context: The EDI message is properly formatted with correct length and security
GIVEN
The EDI message is properly formatted with correct length and security
Applied to: Insert and Purge Message
WHEN
The message is ready for transmission
THEN
The system performs the insert and purge message operation to complete the EDI transmission
R-GCCE358-cbl-00120 (+10) File: GCCE358.cbl Start Log Update Function Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Start Log Update Function':
  • Context - the system needs to log an edi transmission activity:
    For Set Log Update Function Name:
    When the log update process is initiated, then the system sets the function name to log-updt-func-name to identify the logging service.
  • Context - a log entry needs to be created for edi transmission:
    For Initialize Security Parameters:
    When security parameters are being configured, then the system sets the security byte to high-values for secure transmission.
  • Context - an edi transmission log entry is being created:
    For Set Train ID from Train List:
    When train identification is required for the log, then the system sets the train identifier using the us customer train id from the train list.
    For Set User ID from System:
    When user identification is required for audit purposes, then the system captures and records the acf2 user id from the system.
  • Context - a train-related log entry is being created:
    For Mark as US Train Type:
    When the train type needs to be specified, then the system marks the record as us-train type.
  • Context - an edi transmission log entry requires an action code:
    For Processing Mode?:
    When the processing mode is background, then the system uses the background action code.
  • Context - an edi transmission log entry requires a transaction name:
    For Set Foreground Action Code and Transaction Name / Set Background Action Code and Transaction Name:
    When the processing mode is background, then the system uses the background transaction name.
  • Context - an edi transmission log entry requires a date stamp:
    For Set Current Date from System:
    When the current date needs to be recorded, then the system concatenates the machine century and machine date to create a complete date stamp.
  • Context - an edi transmission log entry requires a time stamp:
    For Set Current Time from System:
    When the current time needs to be recorded, then the system records the machine time from the system.
  • Context - a log entry message field needs to be set:
    For Initialize Message as Empty:
    When no specific message content is required, then the system initializes the message field to spaces.
  • Context - a complete log entry has been prepared with all required fields:
    For Submit Log Entry to GCT1051E:
    When the log entry needs to be submitted for processing, then the system calls the gct1051e logging function with the prepared log entry data.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to log an EDI transmission activity
GIVEN
The system needs to log an EDI transmission activity
Applied to: Set Log Update Function Name
WHEN
The log update process is initiated
THEN
The system sets the function name to LOG-UPDT-FUNC-NAME to identify the logging service
Context: A log entry needs to be created for EDI transmission
GIVEN
A log entry needs to be created for EDI transmission
Applied to: Initialize Security Parameters
WHEN
Security parameters are being configured
THEN
The system sets the security byte to HIGH-VALUES for secure transmission
Context: An EDI transmission log entry is being created
GIVEN
An EDI transmission log entry is being created
Applied to: Set Train ID from Train List
WHEN
Train identification is required for the log
THEN
The system sets the train identifier using the US customer train ID from the train list
Applied to: Set User ID from System
WHEN
User identification is required for audit purposes
THEN
The system captures and records the ACF2 user ID from the system
Context: A train-related log entry is being created
GIVEN
A train-related log entry is being created
Applied to: Mark as US Train Type
WHEN
The train type needs to be specified
THEN
The system marks the record as US-TRAIN type
Context: An EDI transmission log entry requires an action code
GIVEN
An EDI transmission log entry requires an action code
Applied to: Processing Mode?
WHEN
The processing mode is background
THEN
The system uses the background action code
Context: An EDI transmission log entry requires a transaction name
GIVEN
An EDI transmission log entry requires a transaction name
Applied to: Set Foreground Action Code and Transaction Name / Set Background Action Code and Transaction Name
WHEN
The processing mode is background
THEN
The system uses the background transaction name
Context: An EDI transmission log entry requires a date stamp
GIVEN
An EDI transmission log entry requires a date stamp
Applied to: Set Current Date from System
WHEN
The current date needs to be recorded
THEN
The system concatenates the machine century and machine date to create a complete date stamp
Context: An EDI transmission log entry requires a time stamp
GIVEN
An EDI transmission log entry requires a time stamp
Applied to: Set Current Time from System
WHEN
The current time needs to be recorded
THEN
The system records the machine time from the system
Context: A log entry message field needs to be set
GIVEN
A log entry message field needs to be set
Applied to: Initialize Message as Empty
WHEN
No specific message content is required
THEN
The system initializes the message field to spaces
Context: A complete log entry has been prepared with all required fields
GIVEN
A complete log entry has been prepared with all required fields
Applied to: Submit Log Entry to GCT1051E
WHEN
The log entry needs to be submitted for processing
THEN
The system calls the GCT1051E logging function with the prepared log entry data
R-GCCU358T-cbl-00122 (+8) File: GCCU358T.cbl Handle Delete Required Status Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Delete Required Status':
  • Context - a train with equipment containing cargo records and port validation status:
    For Has Valid Bills of Lading or Valid Port?:
    When the system checks if the train has valid bills of lading greater than zero or operates through a valid port, then the system determines whether the train qualifies for edi processing.
  • Context - a train that has valid bills of lading greater than zero or operates through a valid port:
    For Set Train Status to SENT:
    When the system processes the train status update, then the train status is set to sent, edi sending is enabled, and both train list and train root records are updated accordingly.
  • Context - a train that has no valid bills of lading (zero count) and does not operate through a valid port:
    For Set Train Status to ACK:
    When the system processes the train status update, then the train status is set to ack in both train list and train root records.
  • Context - a train that is being set to ack status due to no valid cargo:
    For Was Train Previously Set to Send EDI?:
    When the system evaluates the train's previous edi send configuration, then the system determines whether the train was previously marked to send edi.
  • Context - a train with ack status that was previously configured to send edi:
    For Mark Train for Deletion Required:
    When the system updates the train's edi configuration, then the train is marked as deletion required in both train list and train root records.
  • Context - a train with ack status that was not previously configured to send edi:
    For Set Train to Do Not Send EDI:
    When the system updates the train's edi configuration, then the train is marked as do not send edi in both train list and train root records.
  • Context - a train with updated status and edi configuration settings:
    For Update Train Status in Database:
    When the system performs the database update operation, then the train root segment is replaced in the database with the new status information.
  • Context - a train that has been updated with new status information:
    For Is Delete Required?:
    When the system evaluates the train's deletion requirement flag, then the system determines whether deletion cleanup processes need to be initiated.
  • Context - a train that has been marked as deletion required:
    For Trigger Train Deletion Process:
    When the system initiates cleanup processes, then the gct1121e deletion process is spawned to handle removal of associated edi transmission records.
👨‍💻 Technical ACs (Gherkin)
Context: A train with equipment containing cargo records and port validation status
GIVEN
A train with equipment containing cargo records and port validation status
Applied to: Has Valid Bills of Lading or Valid Port?
WHEN
The system checks if the train has valid bills of lading greater than zero OR operates through a valid port
THEN
The system determines whether the train qualifies for EDI processing
Context: A train that has valid bills of lading greater than zero OR operates through a valid port
GIVEN
A train that has valid bills of lading greater than zero OR operates through a valid port
Applied to: Set Train Status to SENT
WHEN
The system processes the train status update
THEN
The train status is set to SENT, EDI sending is enabled, and both train list and train root records are updated accordingly
Context: A train that has no valid bills of lading (zero count) AND does not operate through a valid port
GIVEN
A train that has no valid bills of lading (zero count) AND does not operate through a valid port
Applied to: Set Train Status to ACK
WHEN
The system processes the train status update
THEN
The train status is set to ACK in both train list and train root records
Context: A train that is being set to ACK status due to no valid cargo
GIVEN
A train that is being set to ACK status due to no valid cargo
Applied to: Was Train Previously Set to Send EDI?
WHEN
The system evaluates the train's previous EDI send configuration
THEN
The system determines whether the train was previously marked to send EDI
Context: A train with ACK status that was previously configured to send EDI
GIVEN
A train with ACK status that was previously configured to send EDI
Applied to: Mark Train for Deletion Required
WHEN
The system updates the train's EDI configuration
THEN
The train is marked as deletion required in both train list and train root records
Context: A train with ACK status that was not previously configured to send EDI
GIVEN
A train with ACK status that was not previously configured to send EDI
Applied to: Set Train to Do Not Send EDI
WHEN
The system updates the train's EDI configuration
THEN
The train is marked as do not send EDI in both train list and train root records
Context: A train with updated status and EDI configuration settings
GIVEN
A train with updated status and EDI configuration settings
Applied to: Update Train Status in Database
WHEN
The system performs the database update operation
THEN
The train root segment is replaced in the database with the new status information
Context: A train that has been updated with new status information
GIVEN
A train that has been updated with new status information
Applied to: Is Delete Required?
WHEN
The system evaluates the train's deletion requirement flag
THEN
The system determines whether deletion cleanup processes need to be initiated
Context: A train that has been marked as deletion required
GIVEN
A train that has been marked as deletion required
Applied to: Trigger Train Deletion Process
WHEN
The system initiates cleanup processes
THEN
The GCT1121E deletion process is spawned to handle removal of associated EDI transmission records
R-GCCS358C-cbl-00123 (+6) File: GCCS358C.cbl Handle Flat Car Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Flat Car Processing':
  • Context - an equipment type code is provided:
    For Is Equipment a Flat Car Type?:
    When the equipment type is one of bg, ca, et, gs, id, lo, rr, sk, or tn, then the equipment is classified as a flat car type.
  • Context - a flat car equipment is identified at position sub-tl:
    For Set Search Position to Next Equipment:
    When the flat car load search process begins, then the search position is set to sub-tl + 1 and load found flag is initialized to spaces.
  • Context - an equipment type code is being examined:
    For Is Next Equipment a Container Type?:
    When the equipment type is one of cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then the equipment is classified as a container type.
  • Context - a container equipment is found on a flat car:
    For Is Container Equipment Loaded?:
    When the container is marked as loaded or the container is marked as empty but has a cargo key (cda-ccn-key), then the container is considered loaded.
  • Context - a flat car has at least one loaded container:
    For Set Flat Car as Loaded:
    When a loaded container is found during the search process, then the flat car load/empty status is set to 'l' (loaded) and the load found flag is set to true.
  • Context - the flat car container search is in progress:
    For More Equipment to Check?:
    When the search position is less than or equal to 2500 and the current equipment is still a container type and no loaded container has been found yet, then continue searching through the next equipment item.
  • Context - a flat car has been searched for loaded containers:
    For Keep Flat Car as Empty:
    When no loaded containers are found on the flat car, then the flat car retains its original empty status.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment type code is provided
GIVEN
An equipment type code is provided
Applied to: Is Equipment a Flat Car Type?
WHEN
The equipment type is one of BG, CA, ET, GS, ID, LO, RR, SK, or TN
THEN
The equipment is classified as a flat car type
Context: A flat car equipment is identified at position SUB-TL
GIVEN
A flat car equipment is identified at position SUB-TL
Applied to: Set Search Position to Next Equipment
WHEN
The flat car load search process begins
THEN
The search position is set to SUB-TL + 1 and load found flag is initialized to spaces
Context: An equipment type code is being examined
GIVEN
An equipment type code is being examined
Applied to: Is Next Equipment a Container Type?
WHEN
The equipment type is one of CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
The equipment is classified as a container type
Context: A container equipment is found on a flat car
GIVEN
A container equipment is found on a flat car
Applied to: Is Container Equipment Loaded?
WHEN
The container is marked as loaded OR the container is marked as empty but has a cargo key (CDA-CCN-KEY)
THEN
The container is considered loaded
Context: A flat car has at least one loaded container
GIVEN
A flat car has at least one loaded container
Applied to: Set Flat Car as Loaded
WHEN
A loaded container is found during the search process
THEN
The flat car load/empty status is set to 'L' (Loaded) and the load found flag is set to true
Context: The flat car container search is in progress
GIVEN
The flat car container search is in progress
Applied to: More Equipment to Check?
WHEN
The search position is less than or equal to 2500 AND the current equipment is still a container type AND no loaded container has been found yet
THEN
Continue searching through the next equipment item
Context: A flat car has been searched for loaded containers
GIVEN
A flat car has been searched for loaded containers
Applied to: Keep Flat Car as Empty
WHEN
No loaded containers are found on the flat car
THEN
The flat car retains its original empty status
R-GCCS358C-cbl-00130 (+3) File: GCCS358C.cbl Retrieve Cargo Information Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Cargo Information':
  • Context - a train equipment record contains a ccn key for cargo identification:
    For Retrieve Cargo Information - Get cargo details from Canadian cargo database using CCN key:
    When the system needs to retrieve cargo information for manifest processing, then the system queries the canadian cargo database using the ccn key and sets cargo availability flag based on successful retrieval.
  • Context - the system has attempted to retrieve cargo information from the database:
    For Set Cargo Available Flag:
    When cargo record is successfully found and retrieved, then the system sets the cargo available flag to true to enable cargo-related processing.
  • Context - no cargo record exists in the database for the provided ccn key:
    For Initialize Empty Cargo Structure:
    When the cargo retrieval process completes without finding matching records, then the system initializes an empty cargo structure to prevent processing errors.
  • Context - a database error occurs during cargo information retrieval:
    For Generate Error Message:
    When the system cannot access the canadian cargo database or encounters retrieval failures, then the system generates an error message indicating cargo retrieval failure and terminates processing.
👨‍💻 Technical ACs (Gherkin)
Context: A train equipment record contains a CCN key for cargo identification
GIVEN
A train equipment record contains a CCN key for cargo identification
Applied to: Retrieve Cargo Information - Get cargo details from Canadian cargo database using CCN key
WHEN
The system needs to retrieve cargo information for manifest processing
THEN
The system queries the Canadian cargo database using the CCN key and sets cargo availability flag based on successful retrieval
Context: The system has attempted to retrieve cargo information from the database
GIVEN
The system has attempted to retrieve cargo information from the database
Applied to: Set Cargo Available Flag
WHEN
Cargo record is successfully found and retrieved
THEN
The system sets the cargo available flag to true to enable cargo-related processing
Context: No cargo record exists in the database for the provided CCN key
GIVEN
No cargo record exists in the database for the provided CCN key
Applied to: Initialize Empty Cargo Structure
WHEN
The cargo retrieval process completes without finding matching records
THEN
The system initializes an empty cargo structure to prevent processing errors
Context: A database error occurs during cargo information retrieval
GIVEN
A database error occurs during cargo information retrieval
Applied to: Generate Error Message
WHEN
The system cannot access the Canadian cargo database or encounters retrieval failures
THEN
The system generates an error message indicating cargo retrieval failure and terminates processing
R-GCCE358-cbl-00131 (+4) File: GCCE358.cbl Attempt to Insert Root Segment into EDI Database Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Attempt to Insert Root Segment into EDI Database':
  • Context - a transmission needs to be created for edi processing:
    For Initialize Root Segment with Transmission Number and Transaction Set '358':
    When the system initializes the root segment, then the transmission number is set from machine time, transaction set is set to '358', and the root segment is prepared for insertion.
  • Context - a root segment has been initialized with transmission number and transaction set:
    For Attempt to Insert Root Segment into EDI Database:
    When the system attempts to insert the root segment into the edi database, then the insertion is attempted and the result status is captured for evaluation.
  • Context - a root segment insertion has been attempted:
    For Insert Successful?:
    When the insertion fails due to duplicate transmission number, then the system detects the failure and initiates the duplicate resolution process.
    For Root Segment Successfully Inserted:
    When the insertion is successful without conflicts, then the root segment is successfully stored in the edi database and the process continues.
  • Context - a duplicate transmission number conflict has been detected:
    For Increment Transmission Number by 1:
    When the system needs to resolve the conflict, then the transmission number is incremented by 1 and the insertion process is retried.
👨‍💻 Technical ACs (Gherkin)
Context: A transmission needs to be created for EDI processing
GIVEN
A transmission needs to be created for EDI processing
Applied to: Initialize Root Segment with Transmission Number and Transaction Set '358'
WHEN
The system initializes the root segment
THEN
The transmission number is set from machine time, transaction set is set to '358', and the root segment is prepared for insertion
Context: A root segment has been initialized with transmission number and transaction set
GIVEN
A root segment has been initialized with transmission number and transaction set
Applied to: Attempt to Insert Root Segment into EDI Database
WHEN
The system attempts to insert the root segment into the EDI database
THEN
The insertion is attempted and the result status is captured for evaluation
Context: A root segment insertion has been attempted
GIVEN
A root segment insertion has been attempted
Applied to: Insert Successful?
WHEN
The insertion fails due to duplicate transmission number
THEN
The system detects the failure and initiates the duplicate resolution process
Applied to: Root Segment Successfully Inserted
WHEN
The insertion is successful without conflicts
THEN
The root segment is successfully stored in the EDI database and the process continues
Context: A duplicate transmission number conflict has been detected
GIVEN
A duplicate transmission number conflict has been detected
Applied to: Increment Transmission Number by 1
WHEN
The system needs to resolve the conflict
THEN
The transmission number is incremented by 1 and the insertion process is retried
R-GCCS358C-cbl-00134 (+5) File: GCCS358C.cbl Set Equipment Load Status Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Equipment Load Status':
  • Context - an equipment item is being processed for manifest transmission:
    For Equipment Marked as Loaded?:
    When the equipment load indicator shows loaded status, then check for cargo documentation to confirm load status.
  • Context - equipment is marked as loaded:
    For CCN Key Present?:
    When cargo control number key is present and not empty, then set equipment status to 'l' for loaded.
    For Set Status to 'E' - Empty:
    When cargo control number key is empty or spaces, then override equipment status to 'e' for empty despite load indicator.
  • Context - equipment is being processed for any manifest:
    For Override Status to 'E' - Empty:
    When the cargo control number starts with '6105i', then override equipment status to 'e' for empty regardless of load indicator or cargo presence.
  • Context - equipment is marked as empty and post-emanifest processing is active:
    For Set Status to 'L' - Loaded for Revenue Empty:
    When equipment has cargo control number documentation present, then set equipment status to 'l' for loaded to indicate revenue empty movement.
  • Context - equipment is being processed for manifest transmission:
    For Set Status to 'E' - Empty:
    When equipment load indicator shows empty status, then set equipment status to 'e' for empty.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed for manifest transmission
GIVEN
An equipment item is being processed for manifest transmission
Applied to: Equipment Marked as Loaded?
WHEN
The equipment load indicator shows loaded status
THEN
Check for cargo documentation to confirm load status
Context: Equipment is marked as loaded
GIVEN
Equipment is marked as loaded
Applied to: CCN Key Present?
WHEN
Cargo control number key is present and not empty
THEN
Set equipment status to 'L' for loaded
Applied to: Set Status to 'E' - Empty
WHEN
Cargo control number key is empty or spaces
THEN
Override equipment status to 'E' for empty despite load indicator
Context: Equipment is being processed for any manifest
GIVEN
Equipment is being processed for any manifest
Applied to: Override Status to 'E' - Empty
WHEN
The cargo control number starts with '6105I'
THEN
Override equipment status to 'E' for empty regardless of load indicator or cargo presence
Context: Equipment is marked as empty and post-emanifest processing is active
GIVEN
Equipment is marked as empty and post-emanifest processing is active
Applied to: Set Status to 'L' - Loaded for Revenue Empty
WHEN
Equipment has cargo control number documentation present
THEN
Set equipment status to 'L' for loaded to indicate revenue empty movement
Context: Equipment is being processed for manifest transmission
GIVEN
Equipment is being processed for manifest transmission
Applied to: Set Status to 'E' - Empty
WHEN
Equipment load indicator shows empty status
THEN
Set equipment status to 'E' for empty
R-GCCE358-cbl-00136 (+6) File: GCCE358.cbl Set Quantity from Bill of Lading Count Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Quantity from Bill of Lading Count':
  • Context - the system is ready to process equipment records for quantity calculation:
    For Initialize Bill of Lading Count to Zero:
    When the bill of lading counting process begins, then the bill of lading quantity counter is set to zero.
  • Context - a train list contains multiple equipment records:
    For Start Equipment Loop:
    When the system processes equipment for bill of lading counting, then the system loops through each equipment record from position 1 to the total equipment quantity.
  • Context - the system is processing equipment records in a loop:
    For More Equipment Records?:
    When the current equipment index is compared against the total equipment quantity, then if the index is less than or equal to the total quantity, continue processing, otherwise stop the loop.
  • Context - an equipment record is being processed for bill of lading counting:
    For Equipment Has US CCN Key?:
    When the system checks the us ccn key field for the equipment, then if the us ccn key is not equal to spaces, the equipment qualifies for bill of lading counting.
  • Context - an equipment record has a valid us ccn key that is not spaces:
    For Increment Bill of Lading Count by 1:
    When the system processes this equipment for counting, then the bill of lading quantity counter is increased by 1.
  • Context - the bill of lading count has been calculated from all equipment records:
    For Apply Count to M10 Manifest Quantity:
    When the system creates the m10 manifest record, then the m10 quantity field is set to the calculated bill of lading count.
    For Apply Count to P4 Port Quantity:
    When the system creates the p4 port record, then the p4 quantity field is set to the calculated bill of lading count.
👨‍💻 Technical ACs (Gherkin)
Context: The system is ready to process equipment records for quantity calculation
GIVEN
The system is ready to process equipment records for quantity calculation
Applied to: Initialize Bill of Lading Count to Zero
WHEN
The bill of lading counting process begins
THEN
The bill of lading quantity counter is set to zero
Context: A train list contains multiple equipment records
GIVEN
A train list contains multiple equipment records
Applied to: Start Equipment Loop
WHEN
The system processes equipment for bill of lading counting
THEN
The system loops through each equipment record from position 1 to the total equipment quantity
Context: The system is processing equipment records in a loop
GIVEN
The system is processing equipment records in a loop
Applied to: More Equipment Records?
WHEN
The current equipment index is compared against the total equipment quantity
THEN
If the index is less than or equal to the total quantity, continue processing, otherwise stop the loop
Context: An equipment record is being processed for bill of lading counting
GIVEN
An equipment record is being processed for bill of lading counting
Applied to: Equipment Has US CCN Key?
WHEN
The system checks the US CCN key field for the equipment
THEN
If the US CCN key is not equal to spaces, the equipment qualifies for bill of lading counting
Context: An equipment record has a valid US CCN key that is not spaces
GIVEN
An equipment record has a valid US CCN key that is not spaces
Applied to: Increment Bill of Lading Count by 1
WHEN
The system processes this equipment for counting
THEN
The bill of lading quantity counter is increased by 1
Context: The bill of lading count has been calculated from all equipment records
GIVEN
The bill of lading count has been calculated from all equipment records
Applied to: Apply Count to M10 Manifest Quantity
WHEN
The system creates the M10 manifest record
THEN
The M10 quantity field is set to the calculated bill of lading count
Applied to: Apply Count to P4 Port Quantity
WHEN
The system creates the P4 port record
THEN
The P4 quantity field is set to the calculated bill of lading count
R-GCCS358C-cbl-00140 (+2) File: GCCS358C.cbl Set Location ID for Equipment Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Location ID for Equipment':
  • Context - an equipment record is being processed for manifest reporting:
    For Set Location ID for Equipment - Assign location ID based on cargo in-transit status (0000 for R status, manifest code for T status):
    When the system needs to determine the location id and cargo data is available with in-transit status 'r', then the location id should be set to '0000'.
    For Set Location ID for Equipment - Assign location ID based on cargo in-transit status (0000 for R status, manifest code for T status):
    When either no cargo data is available or the cargo in-transit status is neither 'r' nor 't', then the location id should be set to spaces (empty).
  • Context - an equipment record is being processed for manifest reporting and cargo data is available:
    For Set Location ID for Equipment - Assign location ID based on cargo in-transit status (0000 for R status, manifest code for T status):
    When the cargo has in-transit status 't', then the location id should be set to the manifest transfer code from the cargo data.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record is being processed for manifest reporting
GIVEN
An equipment record is being processed for manifest reporting
Applied to: Set Location ID for Equipment - Assign location ID based on cargo in-transit status (0000 for R status, manifest code for T status)
WHEN
The system needs to determine the location ID and cargo data is available with in-transit status 'R'
THEN
The location ID should be set to '0000'
Applied to: Set Location ID for Equipment - Assign location ID based on cargo in-transit status (0000 for R status, manifest code for T status)
WHEN
Either no cargo data is available or the cargo in-transit status is neither 'R' nor 'T'
THEN
The location ID should be set to spaces (empty)
Context: An equipment record is being processed for manifest reporting and cargo data is available
GIVEN
An equipment record is being processed for manifest reporting and cargo data is available
Applied to: Set Location ID for Equipment - Assign location ID based on cargo in-transit status (0000 for R status, manifest code for T status)
WHEN
The cargo has in-transit status 'T'
THEN
The location ID should be set to the manifest transfer code from the cargo data
R-GCCE358-cbl-00143 (+2) File: GCCE358.cbl Apply Century Logic for Date Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Century Logic for Date':
  • Context - an estimated departure date (eda) from the train list data:
    For Is Date Empty or Zero?:
    When the eda date is either spaces or zeroes, then set the century component to 0 to indicate invalid date.
  • Context - a valid 2-digit year from the eda date that is not empty or zero:
    For Is Year < 70?:
    When the 2-digit year is less than 70, then set the century to 20 to create years in the range 2000-2069.
    For Set Century to 19:
    When the 2-digit year is 70 or greater, then set the century to 19 to create years in the range 1970-1999.
👨‍💻 Technical ACs (Gherkin)
Context: An Estimated Departure Date (EDA) from the train list data
GIVEN
An Estimated Departure Date (EDA) from the train list data
Applied to: Is Date Empty or Zero?
WHEN
The EDA date is either spaces or zeroes
THEN
Set the century component to 0 to indicate invalid date
Context: A valid 2-digit year from the EDA date that is not empty or zero
GIVEN
A valid 2-digit year from the EDA date that is not empty or zero
Applied to: Is Year < 70?
WHEN
The 2-digit year is less than 70
THEN
Set the century to 20 to create years in the range 2000-2069
Applied to: Set Century to 19
WHEN
The 2-digit year is 70 or greater
THEN
Set the century to 19 to create years in the range 1970-1999
R-GCCS358C-cbl-00143 (+8) File: GCCS358C.cbl Build N9 Reference Segment Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build N9 Reference Segment':
  • Context - the system needs to create an n9 reference segment:
    For Initialize N9 Segment Structure:
    When the n9 segment creation process begins, then the n9 segment structure is initialized to clear any previous data.
  • Context - an n9 reference segment is being created:
    For Set Reference Qualifier to '76':
    When the reference qualifier needs to be assigned, then the reference qualifier is set to '76'.
  • Context - an n9 reference segment is being populated:
    For Set Reference Number to 'EDT':
    When the reference number field needs to be assigned, then the reference number is set to 'edt'.
  • Context - train data contains estimated departure date information:
    For Extract Departure Date from Train Data:
    When the n9 segment date field needs to be populated, then the departure date from train data is extracted and assigned to the n9 date field positions 3-8.
  • Context - the n9 date field needs century information:
    For Format Date with Century Prefix:
    When the date is being formatted for the n9 segment, then the machine century is added to positions 1-2 of the n9 date field.
  • Context - train data contains estimated departure time information:
    For Extract Departure Time from Train Data:
    When the n9 segment time field needs to be populated, then the departure time from train data is extracted and assigned to positions 1-4 of the n9 time field.
  • Context - the n9 time field has been populated with hours and minutes:
    For Add '00' Seconds to Time:
    When the time format needs to be completed, then the value '00' is added to positions 5-6 of the n9 time field for seconds.
  • Context - the n9 segment time information needs a time zone indicator:
    For Set Time Code to 'ES' - Eastern Standard:
    When the time code field is being assigned, then the time code is set to 'es' for eastern standard time.
  • Context - the n9 segment has been fully populated with reference data:
    For Insert N9 Segment into Transmission:
    When the segment needs to be added to the transmission, then the n9 segment is inserted into the transmission data structure and the dependent segment insertion process is performed.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to create an N9 reference segment
GIVEN
The system needs to create an N9 reference segment
Applied to: Initialize N9 Segment Structure
WHEN
The N9 segment creation process begins
THEN
The N9 segment structure is initialized to clear any previous data
Context: An N9 reference segment is being created
GIVEN
An N9 reference segment is being created
Applied to: Set Reference Qualifier to '76'
WHEN
The reference qualifier needs to be assigned
THEN
The reference qualifier is set to '76'
Context: An N9 reference segment is being populated
GIVEN
An N9 reference segment is being populated
Applied to: Set Reference Number to 'EDT'
WHEN
The reference number field needs to be assigned
THEN
The reference number is set to 'EDT'
Context: Train data contains estimated departure date information
GIVEN
Train data contains estimated departure date information
Applied to: Extract Departure Date from Train Data
WHEN
The N9 segment date field needs to be populated
THEN
The departure date from train data is extracted and assigned to the N9 date field positions 3-8
Context: The N9 date field needs century information
GIVEN
The N9 date field needs century information
Applied to: Format Date with Century Prefix
WHEN
The date is being formatted for the N9 segment
THEN
The machine century is added to positions 1-2 of the N9 date field
Context: Train data contains estimated departure time information
GIVEN
Train data contains estimated departure time information
Applied to: Extract Departure Time from Train Data
WHEN
The N9 segment time field needs to be populated
THEN
The departure time from train data is extracted and assigned to positions 1-4 of the N9 time field
Context: The N9 time field has been populated with hours and minutes
GIVEN
The N9 time field has been populated with hours and minutes
Applied to: Add '00' Seconds to Time
WHEN
The time format needs to be completed
THEN
The value '00' is added to positions 5-6 of the N9 time field for seconds
Context: The N9 segment time information needs a time zone indicator
GIVEN
The N9 segment time information needs a time zone indicator
Applied to: Set Time Code to 'ES' - Eastern Standard
WHEN
The time code field is being assigned
THEN
The time code is set to 'ES' for Eastern Standard time
Context: The N9 segment has been fully populated with reference data
GIVEN
The N9 segment has been fully populated with reference data
Applied to: Insert N9 Segment into Transmission
WHEN
The segment needs to be added to the transmission
THEN
The N9 segment is inserted into the transmission data structure and the dependent segment insertion process is performed
R-GCCE358-cbl-00146 (+4) File: GCCE358.cbl Apply Load/Empty Status Logic Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Load/Empty Status Logic':
  • Context - an equipment item with load/empty status code from the train list:
    For Status Code = 'H'?:
    When the equipment load/empty status code is 'h' (hold), then the status code should be converted to 'e' (empty) for the edi transmission.
    For Keep Original Status Code:
    When the equipment load/empty status code is neither 'h' (hold) nor 'e' (empty), then the original status code should be preserved without modification.
  • Context - an equipment item with status 'e' (empty) and an associated bill of lading (us-ccn-key is not spaces):
    For Cargo Weight > 1?:
    When the cargo weight from the database is greater than 1, then the equipment status should be overridden to 'l' (loaded).
    For Cargo Weight > 1?:
    When the cargo weight from the database is 1 or less, then the equipment status should remain 'e' (empty).
  • Context - an equipment item with status 'e' (empty):
    For Equipment Has Bill of Lading?:
    When the equipment has no associated bill of lading (us-ccn-key is spaces), then the equipment status should remain 'e' (empty).
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item with load/empty status code from the train list
GIVEN
An equipment item with load/empty status code from the train list
Applied to: Status Code = 'H'?
WHEN
The equipment load/empty status code is 'H' (Hold)
THEN
The status code should be converted to 'E' (Empty) for the EDI transmission
Applied to: Keep Original Status Code
WHEN
The equipment load/empty status code is neither 'H' (Hold) nor 'E' (Empty)
THEN
The original status code should be preserved without modification
Context: An equipment item with status 'E' (Empty) and an associated bill of lading (US-CCN-KEY is not spaces)
GIVEN
An equipment item with status 'E' (Empty) and an associated bill of lading (US-CCN-KEY is not spaces)
Applied to: Cargo Weight > 1?
WHEN
The cargo weight from the database is greater than 1
THEN
The equipment status should be overridden to 'L' (Loaded)
Applied to: Cargo Weight > 1?
WHEN
The cargo weight from the database is 1 or less
THEN
The equipment status should remain 'E' (Empty)
Context: An equipment item with status 'E' (Empty)
GIVEN
An equipment item with status 'E' (Empty)
Applied to: Equipment Has Bill of Lading?
WHEN
The equipment has no associated bill of lading (US-CCN-KEY is spaces)
THEN
The equipment status should remain 'E' (Empty)
R-GCCE358-cbl-00151 (+4) File: GCCE358.cbl Lookup Cargo Information in Database Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup Cargo Information in Database':
  • Context - a cargo lookup request with us ccn key from equipment data:
    For Lookup Cargo Information in Database - Retrieve and validate foreign carrier equipment details:
    When the system searches the cargo database using the ccn key, then the system returns cargo found status if record exists or cargo not found status if record does not exist.
  • Context - a cargo lookup operation is initiated:
    For Set Database Access Parameters:
    When the system prepares to access the cargo database, then the system sets segment type to gcsusrt, function type to gu (get unique), and index usage to not used.
  • Context - a database lookup operation has been completed:
    For Cargo Record Found?:
    When the system evaluates the database operation status code, then if status code is spaces then cargo is found, otherwise cargo is not found.
  • Context - database operation completed with successful status:
    For Set Cargo Found Status:
    When the system processes the successful lookup result, then the system sets cargo found status to true.
  • Context - database operation completed with unsuccessful status:
    For Set Cargo Not Found Status:
    When the system processes the unsuccessful lookup result, then the system sets cargo not found status to true.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo lookup request with US CCN key from equipment data
GIVEN
A cargo lookup request with US CCN key from equipment data
Applied to: Lookup Cargo Information in Database - Retrieve and validate foreign carrier equipment details
WHEN
The system searches the cargo database using the CCN key
THEN
The system returns cargo found status if record exists or cargo not found status if record does not exist
Context: A cargo lookup operation is initiated
GIVEN
A cargo lookup operation is initiated
Applied to: Set Database Access Parameters
WHEN
The system prepares to access the cargo database
THEN
The system sets segment type to GCSUSRT, function type to GU (Get Unique), and index usage to not used
Context: A database lookup operation has been completed
GIVEN
A database lookup operation has been completed
Applied to: Cargo Record Found?
WHEN
The system evaluates the database operation status code
THEN
If status code is spaces then cargo is found, otherwise cargo is not found
Context: Database operation completed with successful status
GIVEN
Database operation completed with successful status
Applied to: Set Cargo Found Status
WHEN
The system processes the successful lookup result
THEN
The system sets cargo found status to true
Context: Database operation completed with unsuccessful status
GIVEN
Database operation completed with unsuccessful status
Applied to: Set Cargo Not Found Status
WHEN
The system processes the unsuccessful lookup result
THEN
The system sets cargo not found status to true
R-GCCS358C-cbl-00152 (+8) File: GCCS358C.cbl Build MBL Bill of Lading Segment Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build MBL Bill of Lading Segment':
  • Context - an equipment item is being processed for mbl segment creation:
    For CCN Key starts with '6105I'?:
    When the cargo control number (ccn) key starts with '6105i', then the system skips mbl segment creation and proceeds to check for amendment processing requirements.
  • Context - a master bill of lading segment is being created for equipment:
    For CCN starts with '2156'?:
    When the cargo control number starts with '2156', then the system sets the scac code to 'cffo', otherwise it sets the scac code to 'cprs'.
  • Context - a master bill of lading segment is being initialized:
    For Set CCN as Bill of Lading Number:
    When the equipment has an associated cargo control number, then the system sets the ccn as the bill of lading waybill number.
  • Context - a master bill of lading segment is being populated:
    For Set Condition Response Code from Equipment:
    When equipment data contains a condition response code, then the system transfers the equipment condition response code to the mbl segment.
  • Context - a master bill of lading segment has an empty condition response code:
    For Response Code Empty?:
    When the bill of lading waybill number is present, then the system sets the response code to 'y', otherwise it sets the response code to 'n'.
  • Context - equipment has associated cargo with in-transit status:
    For Cargo Status is Revenue Transit 'R'?:
    When the cargo in-transit status is 'r' (revenue transit), then the system sets the bill of lading waybill number to 'na' and the response code to 'n'.
  • Context - cargo is in revenue transit status with bill of lading set to 'na':
    For Post-Emanifest Processing?:
    When the processing mode is post-emanifest, then the system sets the exception code to '08'.
  • Context - equipment has associated cargo being processed for mbl segment:
    For Haulage Rights Exist?:
    When the cargo has haulage rights with a haulage rights scac code, then the system overrides the scac code with the haulage rights scac and sets the response code to 'n'.
  • Context - an mbl segment has been processed and inserted:
    For First Equipment and Amendment?:
    When this is the first equipment item being processed and the transaction is an amendment, then the system creates an m13 amendment segment with amendment code '60'.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed for MBL segment creation
GIVEN
An equipment item is being processed for MBL segment creation
Applied to: CCN Key starts with '6105I'?
WHEN
The cargo control number (CCN) key starts with '6105I'
THEN
The system skips MBL segment creation and proceeds to check for amendment processing requirements
Context: A Master Bill of Lading segment is being created for equipment
GIVEN
A Master Bill of Lading segment is being created for equipment
Applied to: CCN starts with '2156'?
WHEN
The cargo control number starts with '2156'
THEN
The system sets the SCAC code to 'CFFO', otherwise it sets the SCAC code to 'CPRS'
Context: A Master Bill of Lading segment is being initialized
GIVEN
A Master Bill of Lading segment is being initialized
Applied to: Set CCN as Bill of Lading Number
WHEN
The equipment has an associated cargo control number
THEN
The system sets the CCN as the bill of lading waybill number
Context: A Master Bill of Lading segment is being populated
GIVEN
A Master Bill of Lading segment is being populated
Applied to: Set Condition Response Code from Equipment
WHEN
Equipment data contains a condition response code
THEN
The system transfers the equipment condition response code to the MBL segment
Context: A Master Bill of Lading segment has an empty condition response code
GIVEN
A Master Bill of Lading segment has an empty condition response code
Applied to: Response Code Empty?
WHEN
The bill of lading waybill number is present
THEN
The system sets the response code to 'Y', otherwise it sets the response code to 'N'
Context: Equipment has associated cargo with in-transit status
GIVEN
Equipment has associated cargo with in-transit status
Applied to: Cargo Status is Revenue Transit 'R'?
WHEN
The cargo in-transit status is 'R' (Revenue Transit)
THEN
The system sets the bill of lading waybill number to 'NA' and the response code to 'N'
Context: Cargo is in revenue transit status with bill of lading set to 'NA'
GIVEN
Cargo is in revenue transit status with bill of lading set to 'NA'
Applied to: Post-Emanifest Processing?
WHEN
The processing mode is post-emanifest
THEN
The system sets the exception code to '08'
Context: Equipment has associated cargo being processed for MBL segment
GIVEN
Equipment has associated cargo being processed for MBL segment
Applied to: Haulage Rights Exist?
WHEN
The cargo has haulage rights with a haulage rights SCAC code
THEN
The system overrides the SCAC code with the haulage rights SCAC and sets the response code to 'N'
Context: An MBL segment has been processed and inserted
GIVEN
An MBL segment has been processed and inserted
Applied to: First Equipment and Amendment?
WHEN
This is the first equipment item being processed and the transaction is an amendment
THEN
The system creates an M13 amendment segment with amendment code '60'
R-GCCU358T-cbl-00153 (+10) File: GCCU358T.cbl Process AEI Train Send Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process AEI Train Send':
  • Context - a train record exists in the system:
    For Train Status is ACK?:
    When the system checks the train status for aei processing eligibility, then the train must have ack status to proceed with aei processing.
  • Context - a train has ack status:
    For Train was AEI Sent?:
    When the system validates aei send eligibility, then the train must have aei-send flag set to true to continue processing.
  • Context - a train has ack status and aei-send flag is true:
    For Train ID ends with 'T' Export Train?:
    When the system checks the train type for canadian customs processing, then the train id must end with 't' at position 23 to be classified as an export train.
  • Context - a train qualifies for aei processing (ack status, aei-send true, export train):
    For Set Transaction Code GCT1461E:
    When the system prepares the canadian customs transaction, then the transaction code must be set to 'gct1461e'.
  • Context - a canadian customs transaction is being prepared:
    For Set Train Details ID, Stations, Date, Time:
    When the system sets train details for customs processing, then the system must populate train id, from/to stations, consist number, estimated departure date, and estimated time of arrival.
  • Context - equipment records are being processed for canadian customs:
    For Equipment is Container?:
    When the system encounters equipment with container indicator 'c', then the container equipment must be skipped and not included in the car loading process.
  • Context - non-container equipment is being processed for canadian customs:
    For Load Car Initials and Number:
    When the system loads car identification information, then the system must extract equipment initials and convert equipment number to 6-digit car number format.
  • Context - car identification information has been loaded:
    For Determine Load/Empty Status:
    When the system determines load/empty status for customs reporting, then if the next equipment in sequence is a container, the status must be set to 'l' (loaded), otherwise use the equipment's load/empty indicator.
  • Context - car load/empty status has been determined:
    For Set Equipment Type LO=L, ET=E, Other=Space:
    When the system classifies equipment type for canadian customs, then equipment type 'lo' must be mapped to 'l', equipment type 'et' must be mapped to 'e', and all other types must be set to spaces.
  • Context - all car information has been loaded and formatted for canadian customs:
    For Send Transaction to Canadian Customs:
    When the system submits the transaction, then the system must call the cims program to send the customs transaction.
  • Context - the customs transaction has been sent to canadian customs:
    For Write Message to Queue:
    When the system queues the message for processing, then the system must write the message to the queue using writmsgl with message code 's'.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists in the system
GIVEN
A train record exists in the system
Applied to: Train Status is ACK?
WHEN
The system checks the train status for AEI processing 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: Train was AEI Sent?
WHEN
The system validates AEI send eligibility
THEN
The train must have AEI-SEND flag set to true to continue processing
Context: A train has ACK status and AEI-SEND flag is true
GIVEN
A train has ACK status and AEI-SEND flag is true
Applied to: Train ID ends with 'T' Export Train?
WHEN
The system checks the train type for Canadian customs processing
THEN
The train ID must end with 'T' at position 23 to be classified as an export train
Context: A train qualifies for AEI processing (ACK status, AEI-SEND true, export train)
GIVEN
A train qualifies for AEI processing (ACK status, AEI-SEND true, export train)
Applied to: Set Transaction Code GCT1461E
WHEN
The system prepares the Canadian customs transaction
THEN
The transaction code must be set to 'GCT1461E'
Context: A Canadian customs transaction is being prepared
GIVEN
A Canadian customs transaction is being prepared
Applied to: Set Train Details ID, Stations, Date, Time
WHEN
The system sets train details for customs processing
THEN
The system must populate train ID, from/to stations, consist number, estimated departure date, and estimated time of arrival
Context: Equipment records are being processed for Canadian customs
GIVEN
Equipment records are being processed for Canadian customs
Applied to: Equipment is Container?
WHEN
The system encounters equipment with container indicator 'C'
THEN
The container equipment must be skipped and not included in the car loading process
Context: Non-container equipment is being processed for Canadian customs
GIVEN
Non-container equipment is being processed for Canadian customs
Applied to: Load Car Initials and Number
WHEN
The system loads car identification information
THEN
The system must extract equipment initials and convert equipment number to 6-digit car number format
Context: Car identification information has been loaded
GIVEN
Car identification information has been loaded
Applied to: Determine Load/Empty Status
WHEN
The system determines load/empty status for customs reporting
THEN
If the next equipment in sequence is a container, the status must be set to 'L' (Loaded), otherwise use the equipment's load/empty indicator
Context: Car load/empty status has been determined
GIVEN
Car load/empty status has been determined
Applied to: Set Equipment Type LO=L, ET=E, Other=Space
WHEN
The system classifies equipment type for Canadian customs
THEN
Equipment type 'LO' must be mapped to 'L', equipment type 'ET' must be mapped to 'E', and all other types must be set to spaces
Context: All car information has been loaded and formatted for Canadian customs
GIVEN
All car information has been loaded and formatted for Canadian customs
Applied to: Send Transaction to Canadian Customs
WHEN
The system submits the transaction
THEN
The system must call the CIMS program to send the customs transaction
Context: The customs transaction has been sent to Canadian customs
GIVEN
The customs transaction has been sent to Canadian customs
Applied to: Write Message to Queue
WHEN
The system queues the message for processing
THEN
The system must write the message to the queue using WRITMSGL with message code 'S'
R-GCCE358-cbl-00156 (+4) File: GCCE358.cbl Lookup Carrier in SS Table by SCAC and Port Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup Carrier in SS Table by SCAC and Port':
  • Context - a bill of lading record is being processed with carrier scac code:
    For Is Carrier CPRS?:
    When the carrier scac code equals 'cprs', then set the automated response code to 'y' indicating yes for automated processing.
  • Context - a bill of lading record with a non-cprs carrier scac code needs automated status determination:
    For Initialize SS Table Key:
    When the carrier scac code is not 'cprs', then initialize the ss table lookup key structure with table id 'ss', the carrier scac code, and departure port location.
  • Context - ss table lookup parameters are properly initialized with table id, scac code, and port location:
    For Call SS Table Lookup Function:
    When the table lookup function is called, then query the ss table and return the carrier automation configuration data.
  • Context - ss table lookup was successful and returned carrier configuration data:
    For Is Carrier Automated in Table?:
    When the automated carrier flag in the table data equals 'y', then set the response code to 'y' for automated processing, otherwise set to 'n' for manual processing.
  • Context - ss table lookup was attempted for a non-cprs carrier:
    For Set Automated Status to 'N':
    When the table lookup fails or the carrier automated flag is not 'y', then set the response code to 'n' indicating manual processing is required.
👨‍💻 Technical ACs (Gherkin)
Context: A bill of lading record is being processed with carrier SCAC code
GIVEN
A bill of lading record is being processed with carrier SCAC code
Applied to: Is Carrier CPRS?
WHEN
The carrier SCAC code equals 'CPRS'
THEN
Set the automated response code to 'Y' indicating yes for automated processing
Context: A bill of lading record with a non-CPRS carrier SCAC code needs automated status determination
GIVEN
A bill of lading record with a non-CPRS carrier SCAC code needs automated status determination
Applied to: Initialize SS Table Key
WHEN
The carrier SCAC code is not 'CPRS'
THEN
Initialize the SS table lookup key structure with table ID 'SS', the carrier SCAC code, and departure port location
Context: SS table lookup parameters are properly initialized with table ID, SCAC code, and port location
GIVEN
SS table lookup parameters are properly initialized with table ID, SCAC code, and port location
Applied to: Call SS Table Lookup Function
WHEN
The table lookup function is called
THEN
Query the SS table and return the carrier automation configuration data
Context: SS table lookup was successful and returned carrier configuration data
GIVEN
SS table lookup was successful and returned carrier configuration data
Applied to: Is Carrier Automated in Table?
WHEN
The automated carrier flag in the table data equals 'Y'
THEN
Set the response code to 'Y' for automated processing, otherwise set to 'N' for manual processing
Context: SS table lookup was attempted for a non-CPRS carrier
GIVEN
SS table lookup was attempted for a non-CPRS carrier
Applied to: Set Automated Status to 'N'
WHEN
The table lookup fails or the carrier automated flag is not 'Y'
THEN
Set the response code to 'N' indicating manual processing is required
R-GCCE358-cbl-00161 (+10) File: GCCE358.cbl Search SS Table with SCAC Code and Port Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search SS Table with SCAC Code and Port':
  • Context - a request to lookup carrier automation status:
    For Initialize Table Search Parameters:
    When the system initializes the table search parameters, then the return flag should be cleared to prepare for the lookup operation.
  • Context - a table lookup operation is being prepared:
    For Set Table ID to 'SS':
    When the system sets the table identifier, then the table id should be set to 'ss' to target the scac service table.
  • Context - an equipment record with scac information is being processed:
    For Set SCAC Code from Equipment Record:
    When the system prepares the table lookup key, then the scac code should be extracted from the equipment record and set as the lookup key.
  • Context - a train departure location is available:
    For Set Port from Departure Location:
    When the system prepares the port parameter for table lookup, then the departure service center should be used as the port identifier.
  • Context - table lookup parameters are prepared with scac code and port:
    For Call Table Lookup Function GCCTBIO:
    When the system calls the gcctbio table lookup function, then the function should be invoked with the prepared parameters to search the ss table.
  • Context - a table lookup operation has been completed:
    For Table Record Found?:
    When the system evaluates the lookup result, then if the return flag indicates success, the record was found; otherwise, no matching record exists.
  • Context - a successful ss table lookup has been completed:
    For Retrieve SS Segment Data:
    When the system processes the lookup result, then the ss segment data should be moved from the table buffer to the working storage area.
  • Context - ss segment data has been retrieved from the table:
    For Automated Carrier Flag = 'Y'?:
    When the system checks the automated carrier flag, then if the automated carrier flag equals 'y', the carrier supports automation; otherwise, it does not.
  • Context - the ss table record shows automated carrier flag as 'y':
    For Set Carrier as Automated:
    When the system processes the automation status, then the carrier should be classified as supporting automated processing.
  • Context - the ss table record shows automated carrier flag is not 'y':
    For Set Carrier as Not Automated:
    When the system processes the automation status, then the carrier should be classified as not supporting automated processing.
  • Context - the ss table lookup operation failed to find a matching record:
    For Clear SS Segment Data:
    When the system handles the lookup failure, then the ss segment data area should be cleared to spaces to indicate no data available.
👨‍💻 Technical ACs (Gherkin)
Context: A request to lookup carrier automation status
GIVEN
A request to lookup carrier automation status
Applied to: Initialize Table Search Parameters
WHEN
The system initializes the table search parameters
THEN
The return flag should be cleared to prepare for the lookup operation
Context: A table lookup operation is being prepared
GIVEN
A table lookup operation is being prepared
Applied to: Set Table ID to 'SS'
WHEN
The system sets the table identifier
THEN
The table ID should be set to 'SS' to target the SCAC Service table
Context: An equipment record with SCAC information is being processed
GIVEN
An equipment record with SCAC information is being processed
Applied to: Set SCAC Code from Equipment Record
WHEN
The system prepares the table lookup key
THEN
The SCAC code should be extracted from the equipment record and set as the lookup key
Context: A train departure location is available
GIVEN
A train departure location is available
Applied to: Set Port from Departure Location
WHEN
The system prepares the port parameter for table lookup
THEN
The departure service center should be used as the port identifier
Context: Table lookup parameters are prepared with SCAC code and port
GIVEN
Table lookup parameters are prepared with SCAC code and port
Applied to: Call Table Lookup Function GCCTBIO
WHEN
The system calls the GCCTBIO table lookup function
THEN
The function should be invoked with the prepared parameters to search the SS table
Context: A table lookup operation has been completed
GIVEN
A table lookup operation has been completed
Applied to: Table Record Found?
WHEN
The system evaluates the lookup result
THEN
If the return flag indicates success, the record was found; otherwise, no matching record exists
Context: A successful SS table lookup has been completed
GIVEN
A successful SS table lookup has been completed
Applied to: Retrieve SS Segment Data
WHEN
The system processes the lookup result
THEN
The SS segment data should be moved from the table buffer to the working storage area
Context: SS segment data has been retrieved from the table
GIVEN
SS segment data has been retrieved from the table
Applied to: Automated Carrier Flag = 'Y'?
WHEN
The system checks the automated carrier flag
THEN
If the automated carrier flag equals 'Y', the carrier supports automation; otherwise, it does not
Context: The SS table record shows automated carrier flag as 'Y'
GIVEN
The SS table record shows automated carrier flag as 'Y'
Applied to: Set Carrier as Automated
WHEN
The system processes the automation status
THEN
The carrier should be classified as supporting automated processing
Context: The SS table record shows automated carrier flag is not 'Y'
GIVEN
The SS table record shows automated carrier flag is not 'Y'
Applied to: Set Carrier as Not Automated
WHEN
The system processes the automation status
THEN
The carrier should be classified as not supporting automated processing
Context: The SS table lookup operation failed to find a matching record
GIVEN
The SS table lookup operation failed to find a matching record
Applied to: Clear SS Segment Data
WHEN
The system handles the lookup failure
THEN
The SS segment data area should be cleared to spaces to indicate no data available
R-GCCS358C-cbl-00161 File: GCCS358C.cbl Handle Special SCAC Assignment
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Special SCAC Assignment':
  • Context - a train list equipment entry with a ccn key is being processed for mbl segment creation:
    For Handle Special SCAC Assignment - Assign CFFO SCAC for CCN starting with 2156, otherwise use CPRS:
    When the system evaluates the ccn prefix to determine the appropriate scac code, then if the ccn starts with '2156', assign cffo scac code, otherwise assign cprs scac code to the mbl segment.
👨‍💻 Technical ACs (Gherkin)
Context: A train list equipment entry with a CCN key is being processed for MBL segment creation
GIVEN
A train list equipment entry with a CCN key is being processed for MBL segment creation
Applied to: Handle Special SCAC Assignment - Assign CFFO SCAC for CCN starting with 2156, otherwise use CPRS
WHEN
The system evaluates the CCN prefix to determine the appropriate SCAC code
THEN
If the CCN starts with '2156', assign CFFO SCAC code, otherwise assign CPRS SCAC code to the MBL segment
R-GCCS358C-cbl-00162 (+1) File: GCCS358C.cbl Process Haulage Rights Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Haulage Rights':
  • Context - a cargo record exists with haulage rights information:
    For Set SCAC to Haulage Rights SCAC & Set Manual Haulage Indicator to N:
    When the cargo has haulage rights (gccc-haulage is true), then the mbl scac code should be set to the haulage rights scac code (gccc-haulage-rights-scac) and the mbl response code should be set to 'n' to indicate manual processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with haulage rights information
GIVEN
A cargo record exists with haulage rights information
Applied to: Set SCAC to Haulage Rights SCAC & Set Manual Haulage Indicator to N
WHEN
The cargo has haulage rights (GCCC-HAULAGE is true)
THEN
The MBL SCAC code should be set to the haulage rights SCAC code (GCCC-HAULAGE-RIGHTS-SCAC) AND The MBL response code should be set to 'N' to indicate manual processing
R-GCCS358C-cbl-00164 (+2) File: GCCS358C.cbl Handle Revenue Transit Status Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Revenue Transit Status':
  • Context - a cargo record exists with in-transit status:
    For Set Bill of Lading to 'NA' & Set Response Code to 'N':
    When the cargo in-transit status is 'r' (revenue), then the bill of lading number should be set to 'na' and the response code should be set to 'n'.
  • Context - a cargo record has revenue in-transit status and the processing is post-emanifest:
    For Set Exception Code to '08':
    When the cargo in-transit status is 'r' (revenue) and post-emanifest flag is true, then the exception code should be set to '08'.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with in-transit status
GIVEN
A cargo record exists with in-transit status
Applied to: Set Bill of Lading to 'NA' & Set Response Code to 'N'
WHEN
The cargo in-transit status is 'R' (Revenue)
THEN
The bill of lading number should be set to 'NA' AND The response code should be set to 'N'
Context: A cargo record has revenue in-transit status and the processing is post-emanifest
GIVEN
A cargo record has revenue in-transit status and the processing is post-emanifest
Applied to: Set Exception Code to '08'
WHEN
The cargo in-transit status is 'R' (Revenue) and post-emanifest flag is true
THEN
The exception code should be set to '08'
R-GCCU358T-cbl-00164 (+10) File: GCCU358T.cbl Load Car Information for CDN Send Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Load Car Information for CDN Send':
  • Context - equipment is being processed for car loading:
    For Is Equipment a Container?:
    When the equipment container indicator is 'c', then skip processing this equipment and continue to next equipment.
    For Load Current Equipment L/E Status:
    When there is no more equipment or the next equipment is not a container, then use the current equipment's load/empty status from the train list.
    For Load Equipment Number:
    When equipment number needs to be recorded, then move the equipment number from train list to working storage car number field.
    For Equipment Type = LO?:
    When the equipment type is 'lo' (locomotive), then set the car kind to 'l' in the customs car record.
  • Context - equipment is not a container:
    For Load Equipment Initials:
    When processing equipment for car loading, then move the equipment initials from train list to customs car initials field.
  • Context - current equipment is being processed and there is a next equipment:
    For More Equipment Available?:
    When the next equipment container indicator is 'c', then set the current equipment load/empty status to 'l' (loaded).
  • Context - equipment number has been loaded into working storage:
    For Convert to 6-Digit Car Number:
    When car number needs to be formatted for customs, then convert the car number to 6-digit format and move to customs car number field.
  • Context - equipment is not locomotive type:
    For Equipment Type = ET?:
    When the equipment type is 'et' (end of train), then set the car kind to 'e' in the customs car record.
    For Set Car Kind to Spaces:
    When the equipment type is not 'et' (end of train), then set the car kind to spaces in the customs car record.
  • Context - car information has been loaded into customs record:
    For Increment Car Counter:
    When car processing is complete, then add 1 to the car counter (ws-sub2) for next car position.
  • Context - equipment processing is complete:
    For Increment Equipment Counter:
    When moving to next equipment, then add 1 to the equipment sequence counter (ws-sub3) for next equipment position.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment is being processed for car loading
GIVEN
Equipment is being processed for car loading
Applied to: Is Equipment a Container?
WHEN
The equipment container indicator is 'C'
THEN
Skip processing this equipment and continue to next equipment
Applied to: Load Current Equipment L/E Status
WHEN
There is no more equipment OR the next equipment is not a container
THEN
Use the current equipment's load/empty status from the train list
Applied to: Load Equipment Number
WHEN
Equipment number needs to be recorded
THEN
Move the equipment number from train list to working storage car number field
Applied to: Equipment Type = LO?
WHEN
The equipment type is 'LO' (Locomotive)
THEN
Set the car kind to 'L' in the customs car record
Context: Equipment is not a container
GIVEN
Equipment is not a container
Applied to: Load Equipment Initials
WHEN
Processing equipment for car loading
THEN
Move the equipment initials from train list to customs car initials field
Context: Current equipment is being processed and there is a next equipment
GIVEN
Current equipment is being processed and there is a next equipment
Applied to: More Equipment Available?
WHEN
The next equipment container indicator is 'C'
THEN
Set the current equipment load/empty status to 'L' (Loaded)
Context: Equipment number has been loaded into working storage
GIVEN
Equipment number has been loaded into working storage
Applied to: Convert to 6-Digit Car Number
WHEN
Car number needs to be formatted for customs
THEN
Convert the car number to 6-digit format and move to customs car number field
Context: Equipment is not locomotive type
GIVEN
Equipment is not locomotive type
Applied to: Equipment Type = ET?
WHEN
The equipment type is 'ET' (End of Train)
THEN
Set the car kind to 'E' in the customs car record
Applied to: Set Car Kind to Spaces
WHEN
The equipment type is not 'ET' (End of Train)
THEN
Set the car kind to spaces in the customs car record
Context: Car information has been loaded into customs record
GIVEN
Car information has been loaded into customs record
Applied to: Increment Car Counter
WHEN
Car processing is complete
THEN
Add 1 to the car counter (WS-SUB2) for next car position
Context: Equipment processing is complete
GIVEN
Equipment processing is complete
Applied to: Increment Equipment Counter
WHEN
Moving to next equipment
THEN
Add 1 to the equipment sequence counter (WS-SUB3) for next equipment position
R-GCCS358C-cbl-00167 (+6) File: GCCS358C.cbl Build Dummy MBL Segment Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build Dummy MBL Segment':
  • Context - a train amendment is being processed and the first equipment position has no cargo control number:
    For Initialize MBL Segment Structure:
    When the system needs to create a dummy mbl segment, then the mbl segment structure should be initialized to empty values.
  • Context - a dummy mbl segment is being created:
    For Set MBL Identifier to 'MBL':
    When the segment identifier needs to be set, then the mbl identifier should be set to 'mbl'.
    For Set Bill of Lading to 'NA':
    When the bill of lading number needs to be set, then the bill of lading should be set to 'na' to indicate not applicable.
  • Context - a dummy mbl segment is being created for a train amendment:
    For Set SCAC Code to 'CPRS':
    When the scac code needs to be assigned, then the scac code should be set to 'cprs'.
    For Set Exception Code to '06':
    When the exception code needs to be assigned, then the exception code should be set to '06'.
  • Context - a dummy mbl segment has been created with all required fields:
    For Insert MBL Segment into Transmission Data:
    When the segment needs to be added to the transmission, then the mbl segment should be inserted into the transmission data structure.
  • Context - a dummy mbl segment has been created and inserted:
    For Build M13 Amendment Segment:
    When amendment processing continues, then an m13 amendment segment should be created.
👨‍💻 Technical ACs (Gherkin)
Context: A train amendment is being processed and the first equipment position has no cargo control number
GIVEN
A train amendment is being processed and the first equipment position has no cargo control number
Applied to: Initialize MBL Segment Structure
WHEN
The system needs to create a dummy MBL segment
THEN
The MBL segment structure should be initialized to empty values
Context: A dummy MBL segment is being created
GIVEN
A dummy MBL segment is being created
Applied to: Set MBL Identifier to 'MBL'
WHEN
The segment identifier needs to be set
THEN
The MBL identifier should be set to 'MBL'
Applied to: Set Bill of Lading to 'NA'
WHEN
The bill of lading number needs to be set
THEN
The bill of lading should be set to 'NA' to indicate not applicable
Context: A dummy MBL segment is being created for a train amendment
GIVEN
A dummy MBL segment is being created for a train amendment
Applied to: Set SCAC Code to 'CPRS'
WHEN
The SCAC code needs to be assigned
THEN
The SCAC code should be set to 'CPRS'
Applied to: Set Exception Code to '06'
WHEN
The exception code needs to be assigned
THEN
The exception code should be set to '06'
Context: A dummy MBL segment has been created with all required fields
GIVEN
A dummy MBL segment has been created with all required fields
Applied to: Insert MBL Segment into Transmission Data
WHEN
The segment needs to be added to the transmission
THEN
The MBL segment should be inserted into the transmission data structure
Context: A dummy MBL segment has been created and inserted
GIVEN
A dummy MBL segment has been created and inserted
Applied to: Build M13 Amendment Segment
WHEN
Amendment processing continues
THEN
An M13 amendment segment should be created
R-GCCE358-cbl-00172 (+5) File: GCCE358.cbl Look up SCAC in SS Table for Port Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Look up SCAC in SS Table for Port':
  • Context - a bill of lading record is being processed with carrier scac code:
    For Is Carrier CPRS?:
    When the carrier scac code equals 'cprs', then set the automated response code to 'y' indicating automated processing is available.
  • Context - a bill of lading record is being processed for a non-cprs carrier:
    For Initialize SS Table Key:
    When the carrier scac code is not 'cprs', then initialize the table lookup key structure and set table id to 'ss' for scac automation lookup.
  • Context - table lookup parameters are initialized with scac code and departure port:
    For Lookup SCAC in SS Table:
    When the scac table lookup is performed, then retrieve the automation status for the carrier at the specified port.
  • Context - scac table lookup has been successfully completed:
    For Is Carrier Automated?:
    When the carrier's automated flag equals 'y' in the table, then set the response code to 'y' indicating automated processing is available.
  • Context - scac table lookup has been performed:
    For Set Response Code to 'N':
    When the carrier is not found in the table or the carrier's automated flag is not 'y', then set the response code to 'n' indicating manual processing is required.
  • Context - a bill of lading record is being processed with equipment and cargo information:
    For Set Response Code to 'Y':
    When the equipment load status is 'e' (empty) and the ccn key is not spaces and the bol type code equals 23, then set the response code to 'y' overriding any previous automation determination.
👨‍💻 Technical ACs (Gherkin)
Context: A bill of lading record is being processed with carrier SCAC code
GIVEN
A bill of lading record is being processed with carrier SCAC code
Applied to: Is Carrier CPRS?
WHEN
The carrier SCAC code equals 'CPRS'
THEN
Set the automated response code to 'Y' indicating automated processing is available
Context: A bill of lading record is being processed for a non-CPRS carrier
GIVEN
A bill of lading record is being processed for a non-CPRS carrier
Applied to: Initialize SS Table Key
WHEN
The carrier SCAC code is not 'CPRS'
THEN
Initialize the table lookup key structure and set table ID to 'SS' for SCAC automation lookup
Context: Table lookup parameters are initialized with SCAC code and departure port
GIVEN
Table lookup parameters are initialized with SCAC code and departure port
Applied to: Lookup SCAC in SS Table
WHEN
The SCAC table lookup is performed
THEN
Retrieve the automation status for the carrier at the specified port
Context: SCAC table lookup has been successfully completed
GIVEN
SCAC table lookup has been successfully completed
Applied to: Is Carrier Automated?
WHEN
The carrier's automated flag equals 'Y' in the table
THEN
Set the response code to 'Y' indicating automated processing is available
Context: SCAC table lookup has been performed
GIVEN
SCAC table lookup has been performed
Applied to: Set Response Code to 'N'
WHEN
The carrier is not found in the table OR the carrier's automated flag is not 'Y'
THEN
Set the response code to 'N' indicating manual processing is required
Context: A bill of lading record is being processed with equipment and cargo information
GIVEN
A bill of lading record is being processed with equipment and cargo information
Applied to: Set Response Code to 'Y'
WHEN
The equipment load status is 'E' (Empty) AND the CCN key is not spaces AND the BOL type code equals 23
THEN
Set the response code to 'Y' overriding any previous automation determination
R-GCCS358C-cbl-00174 (+6) File: GCCS358C.cbl Build M13 Amendment Segment Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build M13 Amendment Segment':
  • Context - the system needs to create an m13 amendment segment:
    For Initialize M13 Segment Structure:
    When the m13 segment initialization is triggered, then the m13 segment structure is cleared and ready for data population.
  • Context - an m13 segment structure is initialized:
    For Set M13 Identifier:
    When the segment identifier needs to be set, then the m13 identifier field is populated with 'm13'.
  • Context - an m13 segment with identifier set:
    For Set SCAC Code to CPRS:
    When the scac code needs to be assigned, then the scac code field is populated with 'cprs'.
  • Context - an m13 segment with scac code set and canadian station code available in station reference:
    For Set Location ID from Canadian Station Code:
    When the location identifier needs to be populated, then the location id field is populated with the canadian station code from the station reference table.
  • Context - an m13 segment with location id set and train key available:
    For Set Bill of Lading/Waybill Number from Train Key:
    When the bill of lading/waybill number needs to be assigned, then the bill of lading/waybill number field is populated with the train key identifier.
  • Context - an m13 segment with bill of lading number set:
    For Set Amendment Code to 60:
    When the amendment code needs to be assigned, then the amendment code field is populated with '60' to indicate train amendment.
  • Context - a complete m13 segment with all required fields populated:
    For Insert M13 Segment into Transmission:
    When the m13 segment needs to be added to the transmission, then the m13 segment is inserted into the transmission data structure for edi processing.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to create an M13 amendment segment
GIVEN
The system needs to create an M13 amendment segment
Applied to: Initialize M13 Segment Structure
WHEN
The M13 segment initialization is triggered
THEN
The M13 segment structure is cleared and ready for data population
Context: An M13 segment structure is initialized
GIVEN
An M13 segment structure is initialized
Applied to: Set M13 Identifier
WHEN
The segment identifier needs to be set
THEN
The M13 identifier field is populated with 'M13'
Context: An M13 segment with identifier set
GIVEN
An M13 segment with identifier set
Applied to: Set SCAC Code to CPRS
WHEN
The SCAC code needs to be assigned
THEN
The SCAC code field is populated with 'CPRS'
Context: An M13 segment with SCAC code set and Canadian station code available in station reference
GIVEN
An M13 segment with SCAC code set and Canadian station code available in station reference
Applied to: Set Location ID from Canadian Station Code
WHEN
The location identifier needs to be populated
THEN
The location ID field is populated with the Canadian station code from the station reference table
Context: An M13 segment with location ID set and train key available
GIVEN
An M13 segment with location ID set and train key available
Applied to: Set Bill of Lading/Waybill Number from Train Key
WHEN
The bill of lading/waybill number needs to be assigned
THEN
The bill of lading/waybill number field is populated with the train key identifier
Context: An M13 segment with bill of lading number set
GIVEN
An M13 segment with bill of lading number set
Applied to: Set Amendment Code to 60
WHEN
The amendment code needs to be assigned
THEN
The amendment code field is populated with '60' to indicate train amendment
Context: A complete M13 segment with all required fields populated
GIVEN
A complete M13 segment with all required fields populated
Applied to: Insert M13 Segment into Transmission
WHEN
The M13 segment needs to be added to the transmission
THEN
The M13 segment is inserted into the transmission data structure for EDI processing
R-GCCU358T-cbl-00175 (+8) File: GCCU358T.cbl Spawn Delete Transaction Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Spawn Delete Transaction':
  • Context - a train has been marked for deletion required:
    For Initialize Delete Message Structure:
    When the delete transaction process is initiated, then the delete message structure gcx112-input is initialized to spaces.
  • Context - a delete message structure is being prepared:
    For Set Train ID in Delete Message:
    When setting the train identifier in the delete message, then the train's us customer train id is moved to the gcx112-train-or-us-ccn field.
    For Set Action Code to 'TD' - Train Delete:
    When setting the action code for train deletion, then the action code gcx112-action-code is set to 'td' to indicate train delete operation.
  • Context - a delete message is being prepared:
    For Set Security Byte to High Value:
    When setting security authorization for the delete transaction, then the security byte gcx112-security-byte is set to high-value for maximum authorization.
  • Context - a delete message is being prepared for a train:
    For Set Train Type Indicator to US Train:
    When setting the train type indicator, then the train type indicator gcx112-us-train is set to true.
  • Context - all delete message fields have been populated:
    For Prepare Delete Message for GCT1121E:
    When preparing the message for transaction processing, then the complete gcx112-input structure is moved to gct1121e-msg for processing.
  • Context - a delete message is ready to be sent:
    For Change to Alternative PCB:
    When initiating the delete transaction processing, then the system changes to the alternative pcb using chng function with alt-pcb.
  • Context - the delete message is prepared and pcb is set to alternative:
    For Send Delete Message to Message Queue:
    When sending the delete message for processing, then the delete message is written to the message queue using writmsgl with the prepared message structure.
  • Context - the delete message has been written to the message queue:
    For Purge Message from Queue:
    When completing the delete transaction processing, then the message is purged from the queue using purg function with alt-pcb.
👨‍💻 Technical ACs (Gherkin)
Context: A train has been marked for deletion required
GIVEN
A train has been marked for deletion required
Applied to: Initialize Delete Message Structure
WHEN
The delete transaction process is initiated
THEN
The delete message structure GCX112-INPUT is initialized to spaces
Context: A delete message structure is being prepared
GIVEN
A delete message structure is being prepared
Applied to: Set Train ID in Delete Message
WHEN
Setting the train identifier in the delete message
THEN
The train's US customer train ID is moved to the GCX112-TRAIN-OR-US-CCN field
Applied to: Set Action Code to 'TD' - Train Delete
WHEN
Setting the action code for train deletion
THEN
The action code GCX112-ACTION-CODE is set to 'TD' to indicate train delete operation
Context: A delete message is being prepared
GIVEN
A delete message is being prepared
Applied to: Set Security Byte to High Value
WHEN
Setting security authorization for the delete transaction
THEN
The security byte GCX112-SECURITY-BYTE is set to HIGH-VALUE for maximum authorization
Context: A delete message is being prepared for a train
GIVEN
A delete message is being prepared for a train
Applied to: Set Train Type Indicator to US Train
WHEN
Setting the train type indicator
THEN
The train type indicator GCX112-US-TRAIN is set to TRUE
Context: All delete message fields have been populated
GIVEN
All delete message fields have been populated
Applied to: Prepare Delete Message for GCT1121E
WHEN
Preparing the message for transaction processing
THEN
The complete GCX112-INPUT structure is moved to GCT1121E-MSG for processing
Context: A delete message is ready to be sent
GIVEN
A delete message is ready to be sent
Applied to: Change to Alternative PCB
WHEN
Initiating the delete transaction processing
THEN
The system changes to the alternative PCB using CHNG function with ALT-PCB
Context: The delete message is prepared and PCB is set to alternative
GIVEN
The delete message is prepared and PCB is set to alternative
Applied to: Send Delete Message to Message Queue
WHEN
Sending the delete message for processing
THEN
The delete message is written to the message queue using WRITMSGL with the prepared message structure
Context: The delete message has been written to the message queue
GIVEN
The delete message has been written to the message queue
Applied to: Purge Message from Queue
WHEN
Completing the delete transaction processing
THEN
The message is purged from the queue using PURG function with ALT-PCB
R-GCCS358C-cbl-00181 (+6) File: GCCS358C.cbl Retrieve Station Information Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Station Information':
  • Context - a train list record with train origin station information is available:
    For Extract Train Origin Station from Train List:
    When the system needs to retrieve station information for customs processing, then the train origin station identifier is extracted and stored for table lookup.
  • Context - a station lookup operation is required:
    For Set Table Access Parameters:
    When the system prepares to access the station code table, then table access parameters are set with 'gu' function code, 'sc' table identifier, and the station identifier as the search key.
  • Context - station table access parameters are configured with the train origin station:
    For Access SC Station Table:
    When the system performs a table lookup operation, then the sc station table is accessed to retrieve the canadian station code information.
  • Context - a station table lookup has been performed:
    For Station Found?:
    When the system checks the table access return status, then if the return flag is not '0', the station record is considered not found and an error is generated.
  • Context - a canadian station code has been retrieved from the station table:
    For Valid Station Code?:
    When the system validates the station code value, then if the canadian station code equals '0000', it is considered invalid and an error is generated.
  • Context - a valid canadian station code has been retrieved and validated:
    For Store Canadian Station Code:
    When the station lookup operation completes successfully, then the table segment containing the canadian station code is stored for subsequent processing.
  • Context - a station table lookup operation has failed to find a matching record:
    For Generate Station Not Found Error:
    When the system processes the lookup failure, then an error message is generated containing 'sc table entry for [station] not found rc=' with the station identifier and return code.
👨‍💻 Technical ACs (Gherkin)
Context: A train list record with train origin station information is available
GIVEN
A train list record with train origin station information is available
Applied to: Extract Train Origin Station from Train List
WHEN
The system needs to retrieve station information for customs processing
THEN
The train origin station identifier is extracted and stored for table lookup
Context: A station lookup operation is required
GIVEN
A station lookup operation is required
Applied to: Set Table Access Parameters
WHEN
The system prepares to access the station code table
THEN
Table access parameters are set with 'GU' function code, 'SC' table identifier, and the station identifier as the search key
Context: Station table access parameters are configured with the train origin station
GIVEN
Station table access parameters are configured with the train origin station
Applied to: Access SC Station Table
WHEN
The system performs a table lookup operation
THEN
The SC station table is accessed to retrieve the Canadian station code information
Context: A station table lookup has been performed
GIVEN
A station table lookup has been performed
Applied to: Station Found?
WHEN
The system checks the table access return status
THEN
If the return flag is not '0', the station record is considered not found and an error is generated
Context: A Canadian station code has been retrieved from the station table
GIVEN
A Canadian station code has been retrieved from the station table
Applied to: Valid Station Code?
WHEN
The system validates the station code value
THEN
If the Canadian station code equals '0000', it is considered invalid and an error is generated
Context: A valid Canadian station code has been retrieved and validated
GIVEN
A valid Canadian station code has been retrieved and validated
Applied to: Store Canadian Station Code
WHEN
The station lookup operation completes successfully
THEN
The table segment containing the Canadian station code is stored for subsequent processing
Context: A station table lookup operation has failed to find a matching record
GIVEN
A station table lookup operation has failed to find a matching record
Applied to: Generate Station Not Found Error
WHEN
The system processes the lookup failure
THEN
An error message is generated containing 'SC TABLE ENTRY FOR [station] NOT FOUND RC=' with the station identifier and return code
R-GCCU358T-cbl-00184 (+6) File: GCCU358T.cbl Validate Cargo Manifest Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Cargo Manifest':
  • Context - an equipment entry exists with a us ccn key that is not spaces:
    For Retrieve Cargo Record by CCN Key:
    When the system processes the equipment entry, then the system retrieves the cargo record using the us ccn key as the search criteria.
  • Context - a cargo record search has been performed using the us ccn key:
    For Cargo Found?:
    When the system evaluates the search results, then the system determines if cargo was found and sets the cargo found indicator accordingly.
  • Context - a cargo record exists with an in-bond type code:
    For Bond Type = 'TR' Transit?:
    When the system evaluates the in-bond type code, then the system determines if the bond type equals 'tr' for transit cargo.
  • Context - a cargo record exists with bol type codes and manifest type codes:
    For Export Type Valid?:
    When the system evaluates the cargo type codes, then the system determines if the cargo is classified as export, returned us goods, empty residue, transport export, immediate export, or multi-port.
  • Context - export type cargo exists and a port validation indicator is set:
    For Valid Port?:
    When the system evaluates port authorization for export cargo, then the system confirms the port is valid for processing the export cargo type.
  • Context - cargo has either transit bond type 'tr' or valid export type with authorized port:
    For Mark Cargo as Valid:
    When the system completes cargo validation, then the system increments the valid cargo count and sets export train indicator if applicable.
  • Context - cargo does not have transit bond type 'tr' and either has invalid export type or unauthorized port:
    For Mark Cargo as Invalid:
    When the system completes cargo validation, then the system does not increment the cargo count and continues to next equipment.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment entry exists with a US CCN key that is not spaces
GIVEN
An equipment entry exists with a US CCN key that is not spaces
Applied to: Retrieve Cargo Record by CCN Key
WHEN
The system processes the equipment entry
THEN
The system retrieves the cargo record using the US CCN key as the search criteria
Context: A cargo record search has been performed using the US CCN key
GIVEN
A cargo record search has been performed using the US CCN key
Applied to: Cargo Found?
WHEN
The system evaluates the search results
THEN
The system determines if cargo was found and sets the cargo found indicator accordingly
Context: A cargo record exists with an in-bond type code
GIVEN
A cargo record exists with an in-bond type code
Applied to: Bond Type = 'TR' Transit?
WHEN
The system evaluates the in-bond type code
THEN
The system determines if the bond type equals 'TR' for transit cargo
Context: A cargo record exists with BOL type codes and manifest type codes
GIVEN
A cargo record exists with BOL type codes and manifest type codes
Applied to: Export Type Valid?
WHEN
The system evaluates the cargo type codes
THEN
The system determines if the cargo is classified as Export, Returned US Goods, Empty Residue, Transport Export, Immediate Export, or Multi-Port
Context: Export type cargo exists and a port validation indicator is set
GIVEN
Export type cargo exists and a port validation indicator is set
Applied to: Valid Port?
WHEN
The system evaluates port authorization for export cargo
THEN
The system confirms the port is valid for processing the export cargo type
Context: Cargo has either transit bond type 'TR' or valid export type with authorized port
GIVEN
Cargo has either transit bond type 'TR' or valid export type with authorized port
Applied to: Mark Cargo as Valid
WHEN
The system completes cargo validation
THEN
The system increments the valid cargo count and sets export train indicator if applicable
Context: Cargo does not have transit bond type 'TR' and either has invalid export type or unauthorized port
GIVEN
Cargo does not have transit bond type 'TR' and either has invalid export type or unauthorized port
Applied to: Mark Cargo as Invalid
WHEN
The system completes cargo validation
THEN
The system does not increment the cargo count and continues to next equipment
R-GCCS358C-cbl-00188 (+5) File: GCCS358C.cbl Send EDI Transmission Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send EDI Transmission':
  • Context - the system needs to initiate edi transmission processing:
    For Set EDI Send Function Name:
    When the edi send function is being prepared, then the system sets the edi send function name flag to true to identify the correct function type.
  • Context - an edi transmission is being prepared for sending:
    For Set Security Parameters:
    When security parameters need to be configured, then the system sets the security byte to high-values to establish maximum security level.
  • Context - a transmission number has been generated for the edi message:
    For Set Transmission Number:
    When the edi transmission structure is being populated, then the system assigns the workspace transmission number to the edi transmission number field.
  • Context - edi input data has been prepared in the gcx121 structure:
    For Prepare Message Output:
    When the message needs to be formatted for output transmission, then the system moves the gcx121 input data to the message output text field.
  • Context - the edi message has been prepared for transmission:
    For Set Function Length:
    When function length parameters need to be configured, then the system sets the edi send function length flag to true.
  • Context - the edi message has been fully prepared with all required parameters:
    For Insert Purge Message:
    When the message needs to be queued for transmission, then the system calls the purge message insertion process to queue the message.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to initiate EDI transmission processing
GIVEN
The system needs to initiate EDI transmission processing
Applied to: Set EDI Send Function Name
WHEN
The EDI send function is being prepared
THEN
The system sets the EDI send function name flag to true to identify the correct function type
Context: An EDI transmission is being prepared for sending
GIVEN
An EDI transmission is being prepared for sending
Applied to: Set Security Parameters
WHEN
Security parameters need to be configured
THEN
The system sets the security byte to high-values to establish maximum security level
Context: A transmission number has been generated for the EDI message
GIVEN
A transmission number has been generated for the EDI message
Applied to: Set Transmission Number
WHEN
The EDI transmission structure is being populated
THEN
The system assigns the workspace transmission number to the EDI transmission number field
Context: EDI input data has been prepared in the GCX121 structure
GIVEN
EDI input data has been prepared in the GCX121 structure
Applied to: Prepare Message Output
WHEN
The message needs to be formatted for output transmission
THEN
The system moves the GCX121 input data to the message output text field
Context: The EDI message has been prepared for transmission
GIVEN
The EDI message has been prepared for transmission
Applied to: Set Function Length
WHEN
Function length parameters need to be configured
THEN
The system sets the EDI send function length flag to true
Context: The EDI message has been fully prepared with all required parameters
GIVEN
The EDI message has been fully prepared with all required parameters
Applied to: Insert Purge Message
WHEN
The message needs to be queued for transmission
THEN
The system calls the purge message insertion process to queue the message
R-GCCU358T-cbl-00191 (+5) File: GCCU358T.cbl Check Automated Carrier Status Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Automated Carrier Status':
  • Context - a bill of lading is being processed with a carrier scac code:
    For Is SCAC = 'CPRS'?:
    When the scac code equals 'cprs', then set the automated carrier response code to 'y' indicating automated processing.
  • Context - a bill of lading is being processed with a non-cprs carrier scac code:
    For Setup SCAC Table Lookup:
    When the scac code is not equal to 'cprs', then initialize scac table lookup parameters with table id 'ss', the carrier scac code, and the origin port code.
  • Context - scac table lookup parameters are initialized with table id, scac code, and port code:
    For Lookup SCAC in SS Table by SCAC Code and Port:
    When the scac table lookup is performed, then retrieve the carrier record from the ss table and determine if the lookup was successful.
  • Context - a carrier record was successfully found in the scac table:
    For Is Automated Carrier Flag = 'Y'?:
    When the automated carrier flag in the table record equals 'y', then set the automated carrier response code to 'y' for automated processing.
  • Context - a carrier scac lookup has been performed:
    For Set Automated Carrier = 'N':
    When either the carrier is not found in the scac table or the automated carrier flag is not equal to 'y', then set the automated carrier response code to 'n' indicating manual processing required.
  • Context - an equipment piece is being processed with associated cargo information:
    For Set Automated Carrier = 'Y':
    When the equipment load/empty status is 'e' and there is a us ccn key and the bill of lading type code is '23', then set the automated carrier response code to 'y' for automated processing.
👨‍💻 Technical ACs (Gherkin)
Context: A bill of lading is being processed with a carrier SCAC code
GIVEN
A bill of lading is being processed with a carrier SCAC code
Applied to: Is SCAC = 'CPRS'?
WHEN
The SCAC code equals 'CPRS'
THEN
Set the automated carrier response code to 'Y' indicating automated processing
Context: A bill of lading is being processed with a non-CPRS carrier SCAC code
GIVEN
A bill of lading is being processed with a non-CPRS carrier SCAC code
Applied to: Setup SCAC Table Lookup
WHEN
The SCAC code is not equal to 'CPRS'
THEN
Initialize SCAC table lookup parameters with table ID 'SS', the carrier SCAC code, and the origin port code
Context: SCAC table lookup parameters are initialized with table ID, SCAC code, and port code
GIVEN
SCAC table lookup parameters are initialized with table ID, SCAC code, and port code
Applied to: Lookup SCAC in SS Table by SCAC Code and Port
WHEN
The SCAC table lookup is performed
THEN
Retrieve the carrier record from the SS table and determine if the lookup was successful
Context: A carrier record was successfully found in the SCAC table
GIVEN
A carrier record was successfully found in the SCAC table
Applied to: Is Automated Carrier Flag = 'Y'?
WHEN
The automated carrier flag in the table record equals 'Y'
THEN
Set the automated carrier response code to 'Y' for automated processing
Context: A carrier SCAC lookup has been performed
GIVEN
A carrier SCAC lookup has been performed
Applied to: Set Automated Carrier = 'N'
WHEN
Either the carrier is not found in the SCAC table OR the automated carrier flag is not equal to 'Y'
THEN
Set the automated carrier response code to 'N' indicating manual processing required
Context: An equipment piece is being processed with associated cargo information
GIVEN
An equipment piece is being processed with associated cargo information
Applied to: Set Automated Carrier = 'Y'
WHEN
The equipment load/empty status is 'E' AND there is a US CCN key AND the bill of lading type code is '23'
THEN
Set the automated carrier response code to 'Y' for automated processing
R-GCCS358C-cbl-00194 (+27) File: GCCS358C.cblFile: GCCU358T.cbl Log Transaction Activity Merged 28 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Log Transaction Activity':
  • Context - a transaction logging process is initiated:
    For Set Log Update Function Name:
    When the system needs to specify the logging function, then the log update function name flag should be set to true.
  • Context - a log entry is being prepared for transmission:
    For Set Security Parameters:
    When security parameters need to be established, then the security byte should be set to high-values for maximum security.
  • Context - a train manifest transaction is being logged:
    For Set Train ID from Input:
    When the train identifier needs to be recorded, then the canadian customs train id should be copied from the input train list to the log entry.
  • Context - a canadian train manifest is being processed:
    For Mark as New Canadian Train:
    When the transaction type needs to be classified, then the transaction should be marked as a new canadian train entry.
  • Context - a transaction is being logged with a specific processing mode:
    For Set Foreground Action Code, Set Foreground-02 Action Code, Set Background Action Code:
    When the action code needs to be determined, then if processing mode is foreground, use foreground action code; if processing mode is foreground-02, use foreground action code; if processing mode is background, use background action code.
    For Set Foreground Transaction Name, Set Foreground-02 Transaction Name, Set Background Transaction Name:
    When the transaction name needs to be determined, then if processing mode is foreground, use foreground transaction name; if processing mode is foreground-02, use foreground-02 transaction name; if processing mode is background, use background transaction name.
  • Context - a transaction is being logged:
    For Set User ID from System:
    When user identification is required for audit trail, then the current user's acf2 user id should be captured from the system and stored in the log entry.
    For Set Current Date:
    When the transaction date needs to be recorded, then the current machine date including century should be concatenated and stored in the log entry date field.
    For Set Current Time:
    When the transaction time needs to be recorded, then the current machine time should be stored in the log entry time field.
  • Context - a log entry is being prepared:
    For Clear Message Field:
    When the message field needs to be initialized, then the message field should be set to spaces to ensure clean data.
  • Context - all log entry fields have been populated:
    For Prepare Log Entry for Transmission:
    When the log entry needs to be prepared for transmission, then the complete log input structure should be moved to the message output text field.
  • Context - a log entry is ready for transmission:
    For Send Log Entry to System:
    When the message length needs to be specified, then the log update function length flag should be set to true to indicate proper message sizing.
  • Context - a log entry is prepared with correct length specification:
    For Send Log Entry to System:
    When the log entry needs to be transmitted, then the system should perform the insert purge message operation to send the log entry to the logging system.
  • Context - the system needs to log transaction activity:
    For Set Log Update Function Name:
    When log transaction activity process is initiated, then the log update function name should be set to enable proper logging functionality.
  • Context - log update function has been configured:
    For Initialize Security Parameters:
    When security parameters need to be established for logging, then security byte should be set to high-values for secure transaction logging.
  • Context - security parameters have been initialized:
    For Set Train ID for Logging:
    When train identification is required for logging, then the train id from the train list should be assigned to the log entry and train type indicator should be set.
  • Context - train id has been set for logging:
    For Processing Mode?:
    When processing mode needs to be determined, then system should check if transaction is running in foreground mode or background mode.
  • Context - processing mode has been determined as foreground:
    For Set Foreground Action Code and Transaction Name:
    When foreground processing parameters need to be set, then foreground action code should be assigned to the log entry and foreground transaction name should be set.
  • Context - processing mode has been determined as background:
    For Set Background Action Code and Transaction Name:
    When background processing parameters need to be set, then background action code should be assigned to the log entry and background transaction name should be set.
  • Context - processing mode parameters have been set:
    For Set User ID from System:
    When user identification is required for audit trail, then current user id from system should be assigned to the log entry.
  • Context - user id has been set for audit trail:
    For Set Current Date and Time:
    When transaction timestamp is required, then current system date should be formatted and assigned to log entry and current system time should be assigned to log entry.
  • Context - date and time have been set for transaction:
    For Has Valid Bills or Valid Port?:
    When message type needs to be determined for logging, then system should check if bill of lading quantity is greater than zero or if port is valid.
  • Context - valid bills of lading exist or port is valid:
    For Set Success Message - Blank:
    When success message needs to be set, then log message should be set to blank spaces indicating successful processing.
  • Context - no valid bills of lading exist and port is not valid:
    For Set No Cargo Action Code:
    When no cargo action code needs to be set, then action code should be cleared to spaces and zzz action code should be assigned.
  • Context - no cargo action code has been set:
    For Processing Mode for No Cargo?:
    When processing mode needs to be determined for message assignment, then system should check if transaction is running in foreground mode for no cargo scenario.
  • Context - processing is in foreground mode and no cargo exists:
    For Set Train Updated Message:
    When train updated message needs to be set, then zzz train update message should be assigned to the log entry.
  • Context - processing is in background mode and no cargo exists:
    For Set Train Added Message:
    When train added message needs to be set, then zzz train added message should be assigned to the log entry.
  • Context - log message has been prepared with appropriate content:
    For Send Log Message to System:
    When log message needs to be sent to system, then log input should be moved to message output and log update function length should be set and message should be sent via purge message process.
👨‍💻 Technical ACs (Gherkin)
Context: A transaction logging process is initiated
GIVEN
A transaction logging process is initiated
Applied to: Set Log Update Function Name
WHEN
The system needs to specify the logging function
THEN
The log update function name flag should be set to true
Context: A log entry is being prepared for transmission
GIVEN
A log entry is being prepared for transmission
Applied to: Set Security Parameters
WHEN
Security parameters need to be established
THEN
The security byte should be set to high-values for maximum security
Context: A train manifest transaction is being logged
GIVEN
A train manifest transaction is being logged
Applied to: Set Train ID from Input
WHEN
The train identifier needs to be recorded
THEN
The Canadian customs train ID should be copied from the input train list to the log entry
Context: A Canadian train manifest is being processed
GIVEN
A Canadian train manifest is being processed
Applied to: Mark as New Canadian Train
WHEN
The transaction type needs to be classified
THEN
The transaction should be marked as a new Canadian train entry
Context: A transaction is being logged with a specific processing mode
GIVEN
A transaction is being logged with a specific processing mode
Applied to: Set Foreground Action Code, Set Foreground-02 Action Code, Set Background Action Code
WHEN
The action code needs to be determined
THEN
If processing mode is foreground, use foreground action code; if processing mode is foreground-02, use foreground action code; if processing mode is background, use background action code
Applied to: Set Foreground Transaction Name, Set Foreground-02 Transaction Name, Set Background Transaction Name
WHEN
The transaction name needs to be determined
THEN
If processing mode is foreground, use foreground transaction name; if processing mode is foreground-02, use foreground-02 transaction name; if processing mode is background, use background transaction name
Context: A transaction is being logged
GIVEN
A transaction is being logged
Applied to: Set User ID from System
WHEN
User identification is required for audit trail
THEN
The current user's ACF2 user ID should be captured from the system and stored in the log entry
Applied to: Set Current Date
WHEN
The transaction date needs to be recorded
THEN
The current machine date including century should be concatenated and stored in the log entry date field
Applied to: Set Current Time
WHEN
The transaction time needs to be recorded
THEN
The current machine time should be stored in the log entry time field
Context: A log entry is being prepared
GIVEN
A log entry is being prepared
Applied to: Clear Message Field
WHEN
The message field needs to be initialized
THEN
The message field should be set to spaces to ensure clean data
Context: All log entry fields have been populated
GIVEN
All log entry fields have been populated
Applied to: Prepare Log Entry for Transmission
WHEN
The log entry needs to be prepared for transmission
THEN
The complete log input structure should be moved to the message output text field
Context: A log entry is ready for transmission
GIVEN
A log entry is ready for transmission
Applied to: Send Log Entry to System
WHEN
The message length needs to be specified
THEN
The log update function length flag should be set to true to indicate proper message sizing
Context: A log entry is prepared with correct length specification
GIVEN
A log entry is prepared with correct length specification
Applied to: Send Log Entry to System
WHEN
The log entry needs to be transmitted
THEN
The system should perform the insert purge message operation to send the log entry to the logging system
Context: The system needs to log transaction activity
GIVEN
The system needs to log transaction activity
Applied to: Set Log Update Function Name
WHEN
Log transaction activity process is initiated
THEN
The log update function name should be set to enable proper logging functionality
Context: Log update function has been configured
GIVEN
Log update function has been configured
Applied to: Initialize Security Parameters
WHEN
Security parameters need to be established for logging
THEN
Security byte should be set to high-values for secure transaction logging
Context: Security parameters have been initialized
GIVEN
Security parameters have been initialized
Applied to: Set Train ID for Logging
WHEN
Train identification is required for logging
THEN
The train ID from the train list should be assigned to the log entry and train type indicator should be set
Context: Train ID has been set for logging
GIVEN
Train ID has been set for logging
Applied to: Processing Mode?
WHEN
Processing mode needs to be determined
THEN
System should check if transaction is running in foreground mode or background mode
Context: Processing mode has been determined as foreground
GIVEN
Processing mode has been determined as foreground
Applied to: Set Foreground Action Code and Transaction Name
WHEN
Foreground processing parameters need to be set
THEN
Foreground action code should be assigned to the log entry and foreground transaction name should be set
Context: Processing mode has been determined as background
GIVEN
Processing mode has been determined as background
Applied to: Set Background Action Code and Transaction Name
WHEN
Background processing parameters need to be set
THEN
Background action code should be assigned to the log entry and background transaction name should be set
Context: Processing mode parameters have been set
GIVEN
Processing mode parameters have been set
Applied to: Set User ID from System
WHEN
User identification is required for audit trail
THEN
Current user ID from system should be assigned to the log entry
Context: User ID has been set for audit trail
GIVEN
User ID has been set for audit trail
Applied to: Set Current Date and Time
WHEN
Transaction timestamp is required
THEN
Current system date should be formatted and assigned to log entry and current system time should be assigned to log entry
Context: Date and time have been set for transaction
GIVEN
Date and time have been set for transaction
Applied to: Has Valid Bills or Valid Port?
WHEN
Message type needs to be determined for logging
THEN
System should check if bill of lading quantity is greater than zero or if port is valid
Context: Valid bills of lading exist or port is valid
GIVEN
Valid bills of lading exist or port is valid
Applied to: Set Success Message - Blank
WHEN
Success message needs to be set
THEN
Log message should be set to blank spaces indicating successful processing
Context: No valid bills of lading exist and port is not valid
GIVEN
No valid bills of lading exist and port is not valid
Applied to: Set No Cargo Action Code
WHEN
No cargo action code needs to be set
THEN
Action code should be cleared to spaces and ZZZ action code should be assigned
Context: No cargo action code has been set
GIVEN
No cargo action code has been set
Applied to: Processing Mode for No Cargo?
WHEN
Processing mode needs to be determined for message assignment
THEN
System should check if transaction is running in foreground mode for no cargo scenario
Context: Processing is in foreground mode and no cargo exists
GIVEN
Processing is in foreground mode and no cargo exists
Applied to: Set Train Updated Message
WHEN
Train updated message needs to be set
THEN
ZZZ train update message should be assigned to the log entry
Context: Processing is in background mode and no cargo exists
GIVEN
Processing is in background mode and no cargo exists
Applied to: Set Train Added Message
WHEN
Train added message needs to be set
THEN
ZZZ train added message should be assigned to the log entry
Context: Log message has been prepared with appropriate content
GIVEN
Log message has been prepared with appropriate content
Applied to: Send Log Message to System
WHEN
Log message needs to be sent to system
THEN
Log input should be moved to message output and log update function length should be set and message should be sent via purge message process
R-GCCU358T-cbl-00197 (+4) File: GCCU358T.cbl Handle Empty Equipment for Export Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Empty Equipment for Export':
  • Context - an equipment piece is being processed for vid segment creation:
    For Equipment Load/Empty Status = 'H'?:
    When the equipment's load/empty status in the train list is 'h' (hold), then the vid segment load/empty status code is set to 'e' (empty).
  • Context - an equipment piece has a us ccn key (cargo reference) and the train list shows load/empty status as 'e' (empty):
    For Has Cargo AND Status = 'E' AND Weight > 1?:
    When the associated cargo record shows a weight greater than 1, then the vid segment load/empty status code is set to 'l' (loaded).
  • Context - an equipment piece is being processed and does not have hold status 'h':
    For Keep Original Status:
    When the equipment either has no cargo, status is not 'e', or cargo weight is 1 or less, then the vid segment load/empty status code is set to the original value from the train list.
  • Context - equipment details and determined load/empty status are available:
    For Create VID Segment with Equipment Details:
    When processing equipment for vid segment creation, then a vid segment is created with equipment type, initial, number, and load/empty status code.
  • Context - a vid segment has been created with all required equipment details:
    For Insert VID Segment to EDI:
    When the vid segment is ready for transmission, then the vid segment is inserted into the edi transmission data structure.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment piece is being processed for VID segment creation
GIVEN
An equipment piece is being processed for VID segment creation
Applied to: Equipment Load/Empty Status = 'H'?
WHEN
The equipment's load/empty status in the train list is 'H' (Hold)
THEN
The VID segment load/empty status code is set to 'E' (Empty)
Context: An equipment piece has a US CCN key (cargo reference) and the train list shows load/empty status as 'E' (Empty)
GIVEN
An equipment piece has a US CCN key (cargo reference) and the train list shows load/empty status as 'E' (Empty)
Applied to: Has Cargo AND Status = 'E' AND Weight > 1?
WHEN
The associated cargo record shows a weight greater than 1
THEN
The VID segment load/empty status code is set to 'L' (Loaded)
Context: An equipment piece is being processed and does not have hold status 'H'
GIVEN
An equipment piece is being processed and does not have hold status 'H'
Applied to: Keep Original Status
WHEN
The equipment either has no cargo, status is not 'E', or cargo weight is 1 or less
THEN
The VID segment load/empty status code is set to the original value from the train list
Context: Equipment details and determined load/empty status are available
GIVEN
Equipment details and determined load/empty status are available
Applied to: Create VID Segment with Equipment Details
WHEN
Processing equipment for VID segment creation
THEN
A VID segment is created with equipment type, initial, number, and load/empty status code
Context: A VID segment has been created with all required equipment details
GIVEN
A VID segment has been created with all required equipment details
Applied to: Insert VID Segment to EDI
WHEN
The VID segment is ready for transmission
THEN
The VID segment is inserted into the EDI transmission data structure
R-GCCU358T-cbl-00202 (+11) File: GCCU358T.cbl Check Bond Type and Export Criteria Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Bond Type and Export Criteria':
  • Context - a train equipment has a us ccn key that is not spaces:
    For Get Cargo Information from Database:
    When the system processes the equipment for cargo validation, then the system retrieves cargo information from gcsusrt database using the us ccn key.
  • Context - the system has attempted to retrieve cargo information from database:
    For Cargo Found?:
    When the database lookup operation completes, then the system checks if cargo was found and proceeds to bond type validation only if cargo exists.
  • Context - cargo information has been found in the database:
    For Bond Type = 'TR' Transit?:
    When the system checks the in-bond type code, then if the in-bond type code equals 'tr', the cargo is accepted for processing regardless of other criteria.
  • Context - cargo does not have transit bond type 'tr':
    For M1109 Export Type?:
    When the system evaluates export criteria, then if cargo has m1109 export type classification, it qualifies for export processing subject to valid port requirement.
  • Context - cargo does not have transit bond type 'tr' and is not m1109 export type:
    For M1109 Returned US Goods?:
    When the system continues evaluating export criteria, then if cargo is classified as m1109 returned us goods, it qualifies for export processing subject to valid port requirement.
  • Context - cargo does not have transit bond type 'tr', is not m1109 export type, and is not returned us goods:
    For M1109 Empty Residue?:
    When the system continues evaluating export criteria, then if cargo is classified as m1109 empty residue, it qualifies for export processing subject to valid port requirement.
  • Context - cargo does not meet previous export criteria (m1109 types):
    For M1201 Transport Export?:
    When the system continues evaluating m1201 export criteria, then if cargo has m1201 transport export classification, it qualifies for export processing subject to valid port requirement.
  • Context - cargo does not meet previous export criteria including m1201 transport export:
    For M1201 Immediate Export?:
    When the system continues evaluating m1201 export criteria, then if cargo has m1201 immediate export classification, it qualifies for export processing subject to valid port requirement.
  • Context - cargo does not meet any previous export criteria:
    For M1201 Multi-Port?:
    When the system performs final export criteria check, then if cargo has m1201 multi-port classification, it qualifies for export processing subject to valid port requirement.
  • Context - cargo meets export criteria (any m1109 or m1201 export types) or has transit bond type 'tr':
    For Valid Port Required?:
    When the system evaluates port validity requirement, then for export types, cargo is accepted only if port is valid; for transit bond type 'tr', cargo is accepted regardless of port validity.
  • Context - cargo meets either transit bond type 'tr' criteria or export criteria with valid port:
    For Accept Cargo - Increment BOL Count:
    When the system completes cargo validation, then the system increments the bol quantity count by 1 and marks the cargo as accepted for processing.
  • Context - cargo does not meet transit bond type 'tr' criteria and either does not meet export criteria or port is invalid:
    For Reject Cargo - Skip Processing:
    When the system completes cargo validation, then the system skips the cargo without incrementing bol count and continues to next equipment.
👨‍💻 Technical ACs (Gherkin)
Context: A train equipment has a US CCN key that is not spaces
GIVEN
A train equipment has a US CCN key that is not spaces
Applied to: Get Cargo Information from Database
WHEN
The system processes the equipment for cargo validation
THEN
The system retrieves cargo information from GCSUSRT database using the US CCN key
Context: The system has attempted to retrieve cargo information from database
GIVEN
The system has attempted to retrieve cargo information from database
Applied to: Cargo Found?
WHEN
The database lookup operation completes
THEN
The system checks if cargo was found and proceeds to bond type validation only if cargo exists
Context: Cargo information has been found in the database
GIVEN
Cargo information has been found in the database
Applied to: Bond Type = 'TR' Transit?
WHEN
The system checks the in-bond type code
THEN
If the in-bond type code equals 'TR', the cargo is accepted for processing regardless of other criteria
Context: Cargo does not have transit bond type 'TR'
GIVEN
Cargo does not have transit bond type 'TR'
Applied to: M1109 Export Type?
WHEN
The system evaluates export criteria
THEN
If cargo has M1109 export type classification, it qualifies for export processing subject to valid port requirement
Context: Cargo does not have transit bond type 'TR' and is not M1109 export type
GIVEN
Cargo does not have transit bond type 'TR' and is not M1109 export type
Applied to: M1109 Returned US Goods?
WHEN
The system continues evaluating export criteria
THEN
If cargo is classified as M1109 returned US goods, it qualifies for export processing subject to valid port requirement
Context: Cargo does not have transit bond type 'TR', is not M1109 export type, and is not returned US goods
GIVEN
Cargo does not have transit bond type 'TR', is not M1109 export type, and is not returned US goods
Applied to: M1109 Empty Residue?
WHEN
The system continues evaluating export criteria
THEN
If cargo is classified as M1109 empty residue, it qualifies for export processing subject to valid port requirement
Context: Cargo does not meet previous export criteria (M1109 types)
GIVEN
Cargo does not meet previous export criteria (M1109 types)
Applied to: M1201 Transport Export?
WHEN
The system continues evaluating M1201 export criteria
THEN
If cargo has M1201 transport export classification, it qualifies for export processing subject to valid port requirement
Context: Cargo does not meet previous export criteria including M1201 transport export
GIVEN
Cargo does not meet previous export criteria including M1201 transport export
Applied to: M1201 Immediate Export?
WHEN
The system continues evaluating M1201 export criteria
THEN
If cargo has M1201 immediate export classification, it qualifies for export processing subject to valid port requirement
Context: Cargo does not meet any previous export criteria
GIVEN
Cargo does not meet any previous export criteria
Applied to: M1201 Multi-Port?
WHEN
The system performs final export criteria check
THEN
If cargo has M1201 multi-port classification, it qualifies for export processing subject to valid port requirement
Context: Cargo meets export criteria (any M1109 or M1201 export types) or has transit bond type 'TR'
GIVEN
Cargo meets export criteria (any M1109 or M1201 export types) or has transit bond type 'TR'
Applied to: Valid Port Required?
WHEN
The system evaluates port validity requirement
THEN
For export types, cargo is accepted only if port is valid; for transit bond type 'TR', cargo is accepted regardless of port validity
Context: Cargo meets either transit bond type 'TR' criteria or export criteria with valid port
GIVEN
Cargo meets either transit bond type 'TR' criteria or export criteria with valid port
Applied to: Accept Cargo - Increment BOL Count
WHEN
The system completes cargo validation
THEN
The system increments the BOL quantity count by 1 and marks the cargo as accepted for processing
Context: Cargo does not meet transit bond type 'TR' criteria and either does not meet export criteria or port is invalid
GIVEN
Cargo does not meet transit bond type 'TR' criteria and either does not meet export criteria or port is invalid
Applied to: Reject Cargo - Skip Processing
WHEN
The system completes cargo validation
THEN
The system skips the cargo without incrementing BOL count and continues to next equipment
R-GCCS358C-cbl-00207 (+5) File: GCCS358C.cbl Handle Processing Errors Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Processing Errors':
  • Context - a manifest processing request is initiated:
    For Processing Mode Valid?:
    When the processing mode is not foreground and not background and not foreground-02, then set wrong fb indicator to true and exit processing.
  • Context - a transmission root segment insert is attempted:
    For Database Insert Failed?:
    When the database insert fails with a non-space status code, then increment the transmission number by 1 and retry the insert operation until successful.
  • Context - a station lookup is performed for manifest processing:
    For Station Table Entry Found?:
    When the station table entry is not found or the canadian station code is '0000', then build error message with station identifier and terminate processing with error handler.
  • Context - a cargo lookup is performed for equipment with a cargo key:
    For Cargo Record Found?:
    When the cargo record is not found in the database, then build error message with the cargo control number and terminate processing with error handler.
  • Context - a message write operation is attempted:
    For Message Write Failed?:
    When the message write operation fails with a non-zero return code, then build message write error and terminate processing with error handler.
  • Context - a critical error condition has been detected:
    For Call Error Handler CERR:
    When error message has been built for the specific error condition, then call the cerr error handling program to terminate processing.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest processing request is initiated
GIVEN
A manifest processing request is initiated
Applied to: Processing Mode Valid?
WHEN
The processing mode is not foreground AND not background AND not foreground-02
THEN
Set wrong FB indicator to true and exit processing
Context: A transmission root segment insert is attempted
GIVEN
A transmission root segment insert is attempted
Applied to: Database Insert Failed?
WHEN
The database insert fails with a non-space status code
THEN
Increment the transmission number by 1 and retry the insert operation until successful
Context: A station lookup is performed for manifest processing
GIVEN
A station lookup is performed for manifest processing
Applied to: Station Table Entry Found?
WHEN
The station table entry is not found OR the Canadian station code is '0000'
THEN
Build error message with station identifier and terminate processing with error handler
Context: A cargo lookup is performed for equipment with a cargo key
GIVEN
A cargo lookup is performed for equipment with a cargo key
Applied to: Cargo Record Found?
WHEN
The cargo record is not found in the database
THEN
Build error message with the cargo control number and terminate processing with error handler
Context: A message write operation is attempted
GIVEN
A message write operation is attempted
Applied to: Message Write Failed?
WHEN
The message write operation fails with a non-zero return code
THEN
Build message write error and terminate processing with error handler
Context: A critical error condition has been detected
GIVEN
A critical error condition has been detected
Applied to: Call Error Handler CERR
WHEN
Error message has been built for the specific error condition
THEN
Call the CERR error handling program to terminate processing
R-GCCS358C-cbl-00213 (+2) File: GCCS358C.cbl Extract Equipment Type, Initial, Number Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Equipment Type, Initial, Number':
  • Context - a train list entry exists with equipment type information:
    For Extract Equipment Type from GCWB4TL-VID01-EQUIPMENT-TYPE:
    When processing equipment data for vid segment creation, then the equipment type code should be extracted from the train list and stored in the vid equipment description code field.
  • Context - a train list entry exists with equipment initial information:
    For Extract Equipment Initial from GCWB4TL-VID02-EQUIPMENT-INIT:
    When processing equipment data for vid segment creation, then the equipment initial should be extracted from the train list and stored in the vid equipment initial field.
  • Context - a train list entry exists with equipment number information:
    For Extract Equipment Number from GCWB4TL-VID03-EQUIPMENT-NUM:
    When processing equipment data for vid segment creation, then the equipment number should be extracted from the train list and stored in the vid equipment number field.
👨‍💻 Technical ACs (Gherkin)
Context: A train list entry exists with equipment type information
GIVEN
A train list entry exists with equipment type information
Applied to: Extract Equipment Type from GCWB4TL-VID01-EQUIPMENT-TYPE
WHEN
Processing equipment data for VID segment creation
THEN
The equipment type code should be extracted from the train list and stored in the VID equipment description code field
Context: A train list entry exists with equipment initial information
GIVEN
A train list entry exists with equipment initial information
Applied to: Extract Equipment Initial from GCWB4TL-VID02-EQUIPMENT-INIT
WHEN
Processing equipment data for VID segment creation
THEN
The equipment initial should be extracted from the train list and stored in the VID equipment initial field
Context: A train list entry exists with equipment number information
GIVEN
A train list entry exists with equipment number information
Applied to: Extract Equipment Number from GCWB4TL-VID03-EQUIPMENT-NUM
WHEN
Processing equipment data for VID segment creation
THEN
The equipment number should be extracted from the train list and stored in the VID equipment number field
R-GCCU358T-cbl-00214 (+2) File: GCCU358T.cbl Generate Voyage Number from Creation Date Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generate Voyage Number from Creation Date':
  • Context - a train record exists with a creation date in yymmdd format:
    For Extract Year from Creation Date GCWTL-CREATION-YYMMDD positions 1-2:
    When the system processes the train for voyage number generation, then the first two characters (year) from the creation date should be extracted and stored as the first part of the voyage number.
  • Context - a train record exists with a julian creation date:
    For Extract Julian Date from Train Creation Date GCWTL-US-TRAIN-CREAT-JDATE positions 2-4:
    When the system processes the train for voyage number generation, then characters 2-4 from the julian creation date should be extracted and stored as the second part of the voyage number.
  • Context - year component has been extracted from creation date and julian date component has been extracted from train creation date:
    For Combine Year and Julian Date to form 5-character Voyage Number:
    When the system combines these components for voyage number generation, then the year (2 characters) and julian date (3 characters) should be concatenated to form a 5-character voyage number and stored in the m10 flight voyage number field.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists with a creation date in YYMMDD format
GIVEN
A train record exists with a creation date in YYMMDD format
Applied to: Extract Year from Creation Date GCWTL-CREATION-YYMMDD positions 1-2
WHEN
The system processes the train for voyage number generation
THEN
The first two characters (year) from the creation date should be extracted and stored as the first part of the voyage number
Context: A train record exists with a Julian creation date
GIVEN
A train record exists with a Julian creation date
Applied to: Extract Julian Date from Train Creation Date GCWTL-US-TRAIN-CREAT-JDATE positions 2-4
WHEN
The system processes the train for voyage number generation
THEN
Characters 2-4 from the Julian creation date should be extracted and stored as the second part of the voyage number
Context: Year component has been extracted from creation date and Julian date component has been extracted from train creation date
GIVEN
Year component has been extracted from creation date and Julian date component has been extracted from train creation date
Applied to: Combine Year and Julian Date to form 5-character Voyage Number
WHEN
The system combines these components for voyage number generation
THEN
The year (2 characters) and Julian date (3 characters) should be concatenated to form a 5-character voyage number and stored in the M10 flight voyage number field
R-GCCS358C-cbl-00216 (+3) File: GCCS358C.cbl Determine Load/Empty Status Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Load/Empty Status':
  • Context - an equipment record with a load flag indicator and optional cargo control number key:
    For Equipment Marked as Load?:
    When the equipment is marked as loaded and a cargo control number key is present, then set the equipment status to 'l' for loaded.
  • Context - an equipment record being processed for load/empty status:
    For Set Status to 'E' - Empty:
    When the equipment is not marked as loaded or no cargo control number key is present, then set the equipment status to 'e' for empty.
  • Context - an equipment record with a cargo control number that has been assigned a load/empty status:
    For CCN Starts with '6105I'?:
    When the cargo control number starts with '6105i', then override the equipment status to 'e' for empty regardless of previous status determination.
  • Context - equipment marked as empty with a cargo control number key present during post-emanifest processing (5040 version):
    For Equipment Empty but CCN Present?:
    When the equipment is empty and a cargo control number key is present and processing is in 5040 version mode, then set the equipment status to 'l' for loaded to indicate revenue empty status.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record with a load flag indicator and optional cargo control number key
GIVEN
An equipment record with a load flag indicator and optional cargo control number key
Applied to: Equipment Marked as Load?
WHEN
The equipment is marked as loaded AND a cargo control number key is present
THEN
Set the equipment status to 'L' for Loaded
Context: An equipment record being processed for load/empty status
GIVEN
An equipment record being processed for load/empty status
Applied to: Set Status to 'E' - Empty
WHEN
The equipment is NOT marked as loaded OR no cargo control number key is present
THEN
Set the equipment status to 'E' for Empty
Context: An equipment record with a cargo control number that has been assigned a load/empty status
GIVEN
An equipment record with a cargo control number that has been assigned a load/empty status
Applied to: CCN Starts with '6105I'?
WHEN
The cargo control number starts with '6105I'
THEN
Override the equipment status to 'E' for Empty regardless of previous status determination
Context: Equipment marked as empty with a cargo control number key present during post-emanifest processing (5040 version)
GIVEN
Equipment marked as empty with a cargo control number key present during post-emanifest processing (5040 version)
Applied to: Equipment Empty but CCN Present?
WHEN
The equipment is empty AND a cargo control number key is present AND processing is in 5040 version mode
THEN
Set the equipment status to 'L' for Loaded to indicate revenue empty status
R-GCCU358T-cbl-00217 (+2) File: GCCU358T.cbl Determine Equipment Load/Empty Status Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Equipment Load/Empty Status':
  • Context - an equipment piece in the train list:
    For Current Status = 'H' 'Hold'?:
    When the equipment's load/empty status indicator is 'h' (hold), then the equipment load/empty status should be set to 'e' (empty).
  • Context - an equipment piece with cargo information and current load/empty status of 'e' (empty):
    For Has Cargo AND Current Status = 'E' AND Weight > 1?:
    When the equipment has a us ccn key (cargo exists) and the cargo weight is greater than 1, then the equipment load/empty status should be overridden to 'l' (loaded).
  • Context - an equipment piece that does not have hold status:
    For Keep Current Status:
    When the equipment either has no cargo, or status is not empty, or cargo weight is 1 or less, then the equipment load/empty status should remain as specified in the original train list.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment piece in the train list
GIVEN
An equipment piece in the train list
Applied to: Current Status = 'H' 'Hold'?
WHEN
The equipment's load/empty status indicator is 'H' (Hold)
THEN
The equipment load/empty status should be set to 'E' (Empty)
Context: An equipment piece with cargo information and current load/empty status of 'E' (Empty)
GIVEN
An equipment piece with cargo information and current load/empty status of 'E' (Empty)
Applied to: Has Cargo AND Current Status = 'E' AND Weight > 1?
WHEN
The equipment has a US CCN key (cargo exists) and the cargo weight is greater than 1
THEN
The equipment load/empty status should be overridden to 'L' (Loaded)
Context: An equipment piece that does not have hold status
GIVEN
An equipment piece that does not have hold status
Applied to: Keep Current Status
WHEN
The equipment either has no cargo, or status is not empty, or cargo weight is 1 or less
THEN
The equipment load/empty status should remain as specified in the original train list
R-GCCS358C-cbl-00220 (+6) File: GCCS358C.cbl Handle Flat Car Logic for Container Cars Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Flat Car Logic for Container Cars':
  • Context - an equipment item with a specific equipment type code:
    For Is Current Equipment a Flat Car?:
    When the equipment type code is evaluated against flat car classifications, then the equipment is identified as a flat car if the type code matches bg, ca, et, gs, id, lo, rr, sk, or tn.
    For Is Equipment a Container Car?:
    When the equipment type code is evaluated against container car classifications, then the equipment is identified as a container car if the type code matches cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl.
  • Context - a flat car equipment that needs load status verification:
    For Initialize Search Variables:
    When the flat car load check process begins, then the search position is set to the current equipment position, search index is incremented by 1, and load found flag is reset to spaces.
  • Context - a container car positioned on a flat car:
    For Is Container Loaded or Has Cargo?:
    When the container's load status is evaluated, then the container is considered loaded if it has a load indicator set to true or if it is empty but has a non-space cargo key (cda-ccn-key).
  • Context - a flat car with at least one loaded container:
    For Mark Flat Car as Loaded:
    When a loaded container is identified on the flat car, then the flat car's load-empty status code is set to 'l' (loaded) and the load found flag is set to true.
  • Context - a flat car with multiple equipment positions to check:
    For Move to Next Equipment Position:
    When the current container position does not contain a loaded container, then the search index is incremented by 1 and the next equipment type is retrieved for evaluation.
  • Context - a flat car load status check in progress:
    For More Equipment to Check?:
    When the search process evaluates continuation criteria, then the search continues if the search index is less than or equal to 2500 and the current equipment type is a container car type and no loaded container has been found yet.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item with a specific equipment type code
GIVEN
An equipment item with a specific equipment type code
Applied to: Is Current Equipment a Flat Car?
WHEN
The equipment type code is evaluated against flat car classifications
THEN
The equipment is identified as a flat car if the type code matches BG, CA, ET, GS, ID, LO, RR, SK, or TN
Applied to: Is Equipment a Container Car?
WHEN
The equipment type code is evaluated against container car classifications
THEN
The equipment is identified as a container car if the type code matches CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
Context: A flat car equipment that needs load status verification
GIVEN
A flat car equipment that needs load status verification
Applied to: Initialize Search Variables
WHEN
The flat car load check process begins
THEN
The search position is set to the current equipment position, search index is incremented by 1, and load found flag is reset to spaces
Context: A container car positioned on a flat car
GIVEN
A container car positioned on a flat car
Applied to: Is Container Loaded or Has Cargo?
WHEN
The container's load status is evaluated
THEN
The container is considered loaded if it has a load indicator set to true OR if it is empty but has a non-space cargo key (CDA-CCN-KEY)
Context: A flat car with at least one loaded container
GIVEN
A flat car with at least one loaded container
Applied to: Mark Flat Car as Loaded
WHEN
A loaded container is identified on the flat car
THEN
The flat car's load-empty status code is set to 'L' (Loaded) and the load found flag is set to true
Context: A flat car with multiple equipment positions to check
GIVEN
A flat car with multiple equipment positions to check
Applied to: Move to Next Equipment Position
WHEN
The current container position does not contain a loaded container
THEN
The search index is incremented by 1 and the next equipment type is retrieved for evaluation
Context: A flat car load status check in progress
GIVEN
A flat car load status check in progress
Applied to: More Equipment to Check?
WHEN
The search process evaluates continuation criteria
THEN
The search continues if the search index is less than or equal to 2500 AND the current equipment type is a container car type AND no loaded container has been found yet
R-GCCU358T-cbl-00220 (+5) File: GCCU358T.cbl Lookup SCAC in SS Table Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup SCAC in SS Table':
  • Context - a carrier scac code is being processed for mbl segment:
    For Is Carrier CPRS?:
    When the carrier scac code equals 'cprs', then set the mbl response code to 'y' for automated processing.
  • Context - a non-cprs carrier needs automated response determination:
    For Initialize SCAC Table Key:
    When scac table lookup is required, then initialize the scac table key structure with table id 'ss', carrier scac code, and port code.
  • Context - scac table key is initialized with carrier and port information:
    For Call Table Lookup Function:
    When table lookup function is called, then query the scac table to retrieve carrier automation settings.
  • Context - scac table record is found for the carrier and port combination:
    For Automated Carrier = 'Y'?:
    When the automated carrier flag in the scac record equals 'y', then set mbl response code to 'y', otherwise set to 'n'.
  • Context - scac table lookup has been executed:
    For SCAC Record Found?:
    When no scac record is found for the carrier and port combination, then set mbl response code to 'n' for non-automated processing.
  • Context - an equipment piece has load/empty status of 'e' and associated cargo with bol type '23':
    For Set MBL Response Code to 'Y':
    When the equipment has a valid us ccn key, then set mbl response code to 'y' regardless of carrier automation settings.
👨‍💻 Technical ACs (Gherkin)
Context: A carrier SCAC code is being processed for MBL segment
GIVEN
A carrier SCAC code is being processed for MBL segment
Applied to: Is Carrier CPRS?
WHEN
The carrier SCAC code equals 'CPRS'
THEN
Set the MBL response code to 'Y' for automated processing
Context: A non-CPRS carrier needs automated response determination
GIVEN
A non-CPRS carrier needs automated response determination
Applied to: Initialize SCAC Table Key
WHEN
SCAC table lookup is required
THEN
Initialize the SCAC table key structure with table ID 'SS', carrier SCAC code, and port code
Context: SCAC table key is initialized with carrier and port information
GIVEN
SCAC table key is initialized with carrier and port information
Applied to: Call Table Lookup Function
WHEN
Table lookup function is called
THEN
Query the SCAC table to retrieve carrier automation settings
Context: SCAC table record is found for the carrier and port combination
GIVEN
SCAC table record is found for the carrier and port combination
Applied to: Automated Carrier = 'Y'?
WHEN
The automated carrier flag in the SCAC record equals 'Y'
THEN
Set MBL response code to 'Y', otherwise set to 'N'
Context: SCAC table lookup has been executed
GIVEN
SCAC table lookup has been executed
Applied to: SCAC Record Found?
WHEN
No SCAC record is found for the carrier and port combination
THEN
Set MBL response code to 'N' for non-automated processing
Context: An equipment piece has load/empty status of 'E' and associated cargo with BOL type '23'
GIVEN
An equipment piece has load/empty status of 'E' and associated cargo with BOL type '23'
Applied to: Set MBL Response Code to 'Y'
WHEN
The equipment has a valid US CCN key
THEN
Set MBL response code to 'Y' regardless of carrier automation settings
R-GCCU358T-cbl-00226 (+10) File: GCCU358T.cbl Load Car Information Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Load Car Information':
  • Context - an equipment item is being processed for car loading:
    For Is Equipment a Container?:
    When the equipment container indicator is 'c', then the equipment should be skipped and not processed as car information.
  • Context - an equipment item is not a container:
    For Extract Car Initials:
    When processing car information, then the equipment initials should be moved to the customs car initials field.
  • Context - current equipment is being processed and there is a next equipment item:
    For Set Load Status Based on Next Equipment:
    When the next equipment item has container indicator 'c', then the current car's load/empty status should be set to 'l' (loaded).
  • Context - current equipment is being processed:
    For Set Load Status from Current Equipment:
    When the next equipment item is not a container or there is no next equipment, then the car's load/empty status should be set from the current equipment's load/empty indicator.
    For Determine Load/Empty Status:
    When the current equipment index is greater than the total equipment quantity, then the car's load/empty status should be set from the current equipment's load/empty indicator.
  • Context - equipment number has been extracted:
    For Convert to 6-Digit Car Number:
    When processing car information for customs, then the equipment number should be converted to a 6-digit car number format.
  • Context - equipment type has been identified:
    For Set Car Kind to 'L' for Locomotive:
    When the equipment type is 'lo', then the car kind should be set to 'l' for locomotive.
  • Context - equipment type is not 'lo':
    For Set Car Kind to 'E' for End of Train:
    When the equipment type is 'et', then the car kind should be set to 'e' for end of train device.
    For Set Car Kind to Spaces:
    When the equipment type is not 'et', then the car kind should be set to spaces (blank).
  • Context - car initials, load status, car number, and car kind have been determined:
    For Store Car Information in Output Table:
    When all car information processing is complete, then the car information should be stored in the appropriate position in the customs output table.
  • Context - car information has been stored in the output table:
    For Increment Car Counter:
    When processing is complete for the current equipment, then the car counter should be incremented by 1 to prepare for the next car.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed for car loading
GIVEN
An equipment item is being processed for car loading
Applied to: Is Equipment a Container?
WHEN
The equipment container indicator is 'C'
THEN
The equipment should be skipped and not processed as car information
Context: An equipment item is not a container
GIVEN
An equipment item is not a container
Applied to: Extract Car Initials
WHEN
Processing car information
THEN
The equipment initials should be moved to the customs car initials field
Context: Current equipment is being processed and there is a next equipment item
GIVEN
Current equipment is being processed and there is a next equipment item
Applied to: Set Load Status Based on Next Equipment
WHEN
The next equipment item has container indicator 'C'
THEN
The current car's load/empty status should be set to 'L' (Loaded)
Context: Current equipment is being processed
GIVEN
Current equipment is being processed
Applied to: Set Load Status from Current Equipment
WHEN
The next equipment item is not a container or there is no next equipment
THEN
The car's load/empty status should be set from the current equipment's load/empty indicator
Applied to: Determine Load/Empty Status
WHEN
The current equipment index is greater than the total equipment quantity
THEN
The car's load/empty status should be set from the current equipment's load/empty indicator
Context: Equipment number has been extracted
GIVEN
Equipment number has been extracted
Applied to: Convert to 6-Digit Car Number
WHEN
Processing car information for customs
THEN
The equipment number should be converted to a 6-digit car number format
Context: Equipment type has been identified
GIVEN
Equipment type has been identified
Applied to: Set Car Kind to 'L' for Locomotive
WHEN
The equipment type is 'LO'
THEN
The car kind should be set to 'L' for locomotive
Context: Equipment type is not 'LO'
GIVEN
Equipment type is not 'LO'
Applied to: Set Car Kind to 'E' for End of Train
WHEN
The equipment type is 'ET'
THEN
The car kind should be set to 'E' for end of train device
Applied to: Set Car Kind to Spaces
WHEN
The equipment type is not 'ET'
THEN
The car kind should be set to spaces (blank)
Context: Car initials, load status, car number, and car kind have been determined
GIVEN
Car initials, load status, car number, and car kind have been determined
Applied to: Store Car Information in Output Table
WHEN
All car information processing is complete
THEN
The car information should be stored in the appropriate position in the customs output table
Context: Car information has been stored in the output table
GIVEN
Car information has been stored in the output table
Applied to: Increment Car Counter
WHEN
Processing is complete for the current equipment
THEN
The car counter should be incremented by 1 to prepare for the next car
R-GCCS358C-cbl-00227 (+13) File: GCCS358C.cbl Create VID Segment Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Create VID Segment':
  • Context - a vid segment needs to be created for equipment processing:
    For Initialize VID Segment Structure:
    When the vid segment initialization is performed, then the vid segment structure is initialized and the identifier is set to 'vid'.
  • Context - a vid segment is being created for equipment:
    For Set Equipment Description Code from Train List:
    When equipment description code needs to be set, then the equipment description code from the train list is assigned to vid-01-equip-desc-cde.
    For Set Equipment Initial from Train List:
    When equipment initial needs to be set, then the equipment initial from the train list is assigned to vid-02-equip-init.
    For Set Equipment Number from Train List:
    When equipment number needs to be set, then the equipment number from the train list is assigned to vid-03-equip-num.
  • Context - equipment is being processed for vid segment creation:
    For Equipment Marked as Loaded?:
    When equipment is marked as loaded and cargo key is present, then load status is set to 'l' (loaded).
    For Set Load Status to 'E':
    When equipment is not marked as loaded or cargo key is not present, then load status is set to 'e' (empty).
  • Context - post-emanifest processing is active for equipment:
    For Equipment Marked as Loaded?:
    When equipment is marked as loaded or (equipment is empty and cargo key is present), then load status is set to 'l' (loaded).
  • Context - equipment load status has been determined:
    For Override Load Status to 'E':
    When cargo control number starts with '6105i', then load status is overridden to 'e' (empty) regardless of previous determination.
  • Context - cargo exists for the equipment:
    For Set Location ID to '0000':
    When cargo in-transit status is 'r' (received), then location id is set to '0000'.
    For Set Location ID to Manifest Code:
    When cargo in-transit status is 't' (transit), then location id is set to the manifest-to-trans code from cargo.
  • Context - equipment is being processed for location id:
    For Set Location ID to Spaces:
    When no cargo exists or cargo in-transit status is neither 'r' nor 't', then location id is set to spaces.
  • Context - post-emanifest processing is active:
    For Check for Flat Car Configuration:
    When equipment type indicates a possible flat car (bg, ca, et, gs, id, lo, rr, sk, tn), then system checks subsequent equipment for container types and determines flat car configuration.
  • Context - equipment is identified as a possible flat car:
    For Process Flat Car and Container Units:
    When subsequent equipment includes loaded containers (cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, tl), then flat car load status is set to 'l' if any container on the flat car is loaded or has cargo key.
  • Context - vid segment has been fully populated with equipment data:
    For Insert VID Segment to Database:
    When vid segment is ready for transmission, then vid segment is inserted into the transmission database for edi processing.
👨‍💻 Technical ACs (Gherkin)
Context: A VID segment needs to be created for equipment processing
GIVEN
A VID segment needs to be created for equipment processing
Applied to: Initialize VID Segment Structure
WHEN
The VID segment initialization is performed
THEN
The VID segment structure is initialized and the identifier is set to 'VID'
Context: A VID segment is being created for equipment
GIVEN
A VID segment is being created for equipment
Applied to: Set Equipment Description Code from Train List
WHEN
Equipment description code needs to be set
THEN
The equipment description code from the train list is assigned to VID-01-EQUIP-DESC-CDE
Applied to: Set Equipment Initial from Train List
WHEN
Equipment initial needs to be set
THEN
The equipment initial from the train list is assigned to VID-02-EQUIP-INIT
Applied to: Set Equipment Number from Train List
WHEN
Equipment number needs to be set
THEN
The equipment number from the train list is assigned to VID-03-EQUIP-NUM
Context: Equipment is being processed for VID segment creation
GIVEN
Equipment is being processed for VID segment creation
Applied to: Equipment Marked as Loaded?
WHEN
Equipment is marked as loaded AND cargo key is present
THEN
Load status is set to 'L' (Loaded)
Applied to: Set Load Status to 'E'
WHEN
Equipment is not marked as loaded OR cargo key is not present
THEN
Load status is set to 'E' (Empty)
Context: Post-emanifest processing is active for equipment
GIVEN
Post-emanifest processing is active for equipment
Applied to: Equipment Marked as Loaded?
WHEN
Equipment is marked as loaded OR (equipment is empty AND cargo key is present)
THEN
Load status is set to 'L' (Loaded)
Context: Equipment load status has been determined
GIVEN
Equipment load status has been determined
Applied to: Override Load Status to 'E'
WHEN
Cargo control number starts with '6105I'
THEN
Load status is overridden to 'E' (Empty) regardless of previous determination
Context: Cargo exists for the equipment
GIVEN
Cargo exists for the equipment
Applied to: Set Location ID to '0000'
WHEN
Cargo in-transit status is 'R' (Received)
THEN
Location ID is set to '0000'
Applied to: Set Location ID to Manifest Code
WHEN
Cargo in-transit status is 'T' (Transit)
THEN
Location ID is set to the manifest-to-trans code from cargo
Context: Equipment is being processed for location ID
GIVEN
Equipment is being processed for location ID
Applied to: Set Location ID to Spaces
WHEN
No cargo exists OR cargo in-transit status is neither 'R' nor 'T'
THEN
Location ID is set to spaces
Context: Post-emanifest processing is active
GIVEN
Post-emanifest processing is active
Applied to: Check for Flat Car Configuration
WHEN
Equipment type indicates a possible flat car (BG, CA, ET, GS, ID, LO, RR, SK, TN)
THEN
System checks subsequent equipment for container types and determines flat car configuration
Context: Equipment is identified as a possible flat car
GIVEN
Equipment is identified as a possible flat car
Applied to: Process Flat Car and Container Units
WHEN
Subsequent equipment includes loaded containers (CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, TL)
THEN
Flat car load status is set to 'L' if any container on the flat car is loaded or has cargo key
Context: VID segment has been fully populated with equipment data
GIVEN
VID segment has been fully populated with equipment data
Applied to: Insert VID Segment to Database
WHEN
VID segment is ready for transmission
THEN
VID segment is inserted into the transmission database for EDI processing
R-GCCU358T-cbl-00237 (+9) File: GCCU358T.cbl Check Export Type Codes Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Export Type Codes':
  • Context - a cargo record exists with an in-bond type code:
    For Is Transit 'TR'?:
    When the in-bond type code equals 'tr', then accept the cargo for processing without additional validation.
  • Context - a cargo record exists with a bol type code and the in-bond type is not 'tr':
    For Is Standard Export?:
    When the bol type code indicates standard export, then proceed to validate port authorization for cargo acceptance.
  • Context - a cargo record exists with a bol type code and is not standard export:
    For Is Returned US Goods?:
    When the bol type code indicates returned us goods export, then proceed to validate port authorization for cargo acceptance.
  • Context - a cargo record exists with a bol type code and is not standard export or returned us goods:
    For Is Empty Residue?:
    When the bol type code indicates empty residue export, then proceed to validate port authorization for cargo acceptance.
  • Context - a cargo record exists with an in-bond type code and previous export validations failed:
    For Is Transportation Export?:
    When the in-bond type code indicates transportation export, then proceed to validate port authorization for cargo acceptance.
    For Is Immediate Export?:
    When the in-bond type code indicates immediate export, then proceed to validate port authorization for cargo acceptance.
    For Is Multi-Port?:
    When the in-bond type code indicates multi-port export, then proceed to validate port authorization for cargo acceptance.
  • Context - a cargo record has been identified as an export type requiring port validation:
    For Valid Port Required?:
    When the port authorization check is performed, then accept cargo if port is valid, otherwise reject cargo for processing.
  • Context - a cargo record has passed all validation checks:
    For Accept Cargo for Processing:
    When the cargo meets transit or export with valid port criteria, then increment the bol quantity counter and mark cargo as accepted for processing.
  • Context - a cargo record exists but fails validation checks:
    For Reject Cargo:
    When the cargo does not meet transit criteria or export with valid port criteria, then do not increment bol quantity counter and exclude cargo from processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with an in-bond type code
GIVEN
A cargo record exists with an in-bond type code
Applied to: Is Transit 'TR'?
WHEN
The in-bond type code equals 'TR'
THEN
Accept the cargo for processing without additional validation
Context: A cargo record exists with a BOL type code and the in-bond type is not 'TR'
GIVEN
A cargo record exists with a BOL type code and the in-bond type is not 'TR'
Applied to: Is Standard Export?
WHEN
The BOL type code indicates standard export
THEN
Proceed to validate port authorization for cargo acceptance
Context: A cargo record exists with a BOL type code and is not standard export
GIVEN
A cargo record exists with a BOL type code and is not standard export
Applied to: Is Returned US Goods?
WHEN
The BOL type code indicates returned US goods export
THEN
Proceed to validate port authorization for cargo acceptance
Context: A cargo record exists with a BOL type code and is not standard export or returned US goods
GIVEN
A cargo record exists with a BOL type code and is not standard export or returned US goods
Applied to: Is Empty Residue?
WHEN
The BOL type code indicates empty residue export
THEN
Proceed to validate port authorization for cargo acceptance
Context: A cargo record exists with an in-bond type code and previous export validations failed
GIVEN
A cargo record exists with an in-bond type code and previous export validations failed
Applied to: Is Transportation Export?
WHEN
The in-bond type code indicates transportation export
THEN
Proceed to validate port authorization for cargo acceptance
Applied to: Is Immediate Export?
WHEN
The in-bond type code indicates immediate export
THEN
Proceed to validate port authorization for cargo acceptance
Applied to: Is Multi-Port?
WHEN
The in-bond type code indicates multi-port export
THEN
Proceed to validate port authorization for cargo acceptance
Context: A cargo record has been identified as an export type requiring port validation
GIVEN
A cargo record has been identified as an export type requiring port validation
Applied to: Valid Port Required?
WHEN
The port authorization check is performed
THEN
Accept cargo if port is valid, otherwise reject cargo for processing
Context: A cargo record has passed all validation checks
GIVEN
A cargo record has passed all validation checks
Applied to: Accept Cargo for Processing
WHEN
The cargo meets transit or export with valid port criteria
THEN
Increment the BOL quantity counter and mark cargo as accepted for processing
Context: A cargo record exists but fails validation checks
GIVEN
A cargo record exists but fails validation checks
Applied to: Reject Cargo
WHEN
The cargo does not meet transit criteria or export with valid port criteria
THEN
Do not increment BOL quantity counter and exclude cargo from processing
R-GCCS358C-cbl-00241 (+9) File: GCCS358C.cbl Process Bill of Lading if Loaded Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Bill of Lading if Loaded':
  • Context - an equipment record is being processed for master bill of lading creation:
    For CCN Key = '6105I'?:
    When the cargo ccn key starts with '6105i', then the system skips all mbl segment processing and proceeds to the next step.
  • Context - a master bill of lading segment is being created for equipment with a ccn key:
    For CCN starts with '2156'?:
    When the ccn key starts with '2156', then the system sets the scac code to 'cffo', otherwise sets it to 'cprs'.
  • Context - a master bill of lading segment is being initialized:
    For Set CCN as Bill of Lading Number:
    When the equipment has a valid ccn key, then the system assigns the ccn key as the bill of lading/waybill number.
  • Context - a master bill of lading segment is being populated:
    For Set Condition Response Code:
    When the equipment record contains a condition response code, then the system copies the condition response code to the mbl segment.
  • Context - a master bill of lading segment has an empty condition response code:
    For Response Code Empty?:
    When the bill of lading number is not empty, then the system sets the response code to 'y', otherwise sets it to 'n'.
  • Context - equipment has associated cargo with in-transit status:
    For Cargo Status = 'R' Revenue Transit?:
    When the cargo in-transit status is 'r' (revenue transit), then the system sets bill of lading to 'na' and response code to 'n'.
  • Context - cargo is in revenue transit status with bill of lading set to 'na':
    For Set Exception Code to '08':
    When the processing mode is post-emanifest, then the system sets the exception code to '08'.
  • Context - equipment has associated cargo being processed for mbl:
    For Haulage Rights Exist?:
    When the cargo has haulage rights defined, then the system sets the scac to the haulage rights scac and response code to 'n'.
  • Context - equipment is being processed in amendment mode:
    For First Equipment and Amendment?:
    When this is the first equipment item being processed, then the system creates an m13 amendment segment with amendment code '60'.
    For No CCN and Amendment?:
    When the equipment has no ccn key and this is the first equipment, then the system creates a dummy mbl segment with bill of lading 'na', exception code '06', and follows with m13 amendment segment.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record is being processed for Master Bill of Lading creation
GIVEN
An equipment record is being processed for Master Bill of Lading creation
Applied to: CCN Key = '6105I'?
WHEN
The cargo CCN key starts with '6105I'
THEN
The system skips all MBL segment processing and proceeds to the next step
Context: A Master Bill of Lading segment is being created for equipment with a CCN key
GIVEN
A Master Bill of Lading segment is being created for equipment with a CCN key
Applied to: CCN starts with '2156'?
WHEN
The CCN key starts with '2156'
THEN
The system sets the SCAC code to 'CFFO', otherwise sets it to 'CPRS'
Context: A Master Bill of Lading segment is being initialized
GIVEN
A Master Bill of Lading segment is being initialized
Applied to: Set CCN as Bill of Lading Number
WHEN
The equipment has a valid CCN key
THEN
The system assigns the CCN key as the Bill of Lading/Waybill number
Context: A Master Bill of Lading segment is being populated
GIVEN
A Master Bill of Lading segment is being populated
Applied to: Set Condition Response Code
WHEN
The equipment record contains a condition response code
THEN
The system copies the condition response code to the MBL segment
Context: A Master Bill of Lading segment has an empty condition response code
GIVEN
A Master Bill of Lading segment has an empty condition response code
Applied to: Response Code Empty?
WHEN
The Bill of Lading number is not empty
THEN
The system sets the response code to 'Y', otherwise sets it to 'N'
Context: Equipment has associated cargo with in-transit status
GIVEN
Equipment has associated cargo with in-transit status
Applied to: Cargo Status = 'R' Revenue Transit?
WHEN
The cargo in-transit status is 'R' (Revenue Transit)
THEN
The system sets Bill of Lading to 'NA' and response code to 'N'
Context: Cargo is in revenue transit status with Bill of Lading set to 'NA'
GIVEN
Cargo is in revenue transit status with Bill of Lading set to 'NA'
Applied to: Set Exception Code to '08'
WHEN
The processing mode is post-emanifest
THEN
The system sets the exception code to '08'
Context: Equipment has associated cargo being processed for MBL
GIVEN
Equipment has associated cargo being processed for MBL
Applied to: Haulage Rights Exist?
WHEN
The cargo has haulage rights defined
THEN
The system sets the SCAC to the haulage rights SCAC and response code to 'N'
Context: Equipment is being processed in amendment mode
GIVEN
Equipment is being processed in amendment mode
Applied to: First Equipment and Amendment?
WHEN
This is the first equipment item being processed
THEN
The system creates an M13 amendment segment with amendment code '60'
Applied to: No CCN and Amendment?
WHEN
The equipment has no CCN key and this is the first equipment
THEN
The system creates a dummy MBL segment with Bill of Lading 'NA', exception code '06', and follows with M13 amendment segment
R-GCCU358T-cbl-00247 (+3) File: GCCU358T.cbl Setup SCAC Table Lookup Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Setup SCAC Table Lookup':
  • Context - a scac table lookup is required for carrier validation:
    For Initialize SCAC Table Key Structure:
    When the system initializes the table query parameters, then the scac table key structure is cleared to spaces.
  • Context - a scac table lookup needs to be performed:
    For Set Table ID to 'SS':
    When the system sets up the table query, then the table id is set to 'ss' to identify the scac table.
  • Context - an equipment record contains a scac code for carrier identification:
    For Move SCAC Code from Equipment to Key:
    When the system prepares to lookup carrier automation status, then the scac code from the equipment record is moved to the table lookup key.
  • Context - a train has an origin port code that needs carrier validation:
    For Move Port Code to Key:
    When the system sets up scac table lookup parameters, then the train's origin port code is moved to the table lookup key.
👨‍💻 Technical ACs (Gherkin)
Context: A SCAC table lookup is required for carrier validation
GIVEN
A SCAC table lookup is required for carrier validation
Applied to: Initialize SCAC Table Key Structure
WHEN
The system initializes the table query parameters
THEN
The SCAC table key structure is cleared to spaces
Context: A SCAC table lookup needs to be performed
GIVEN
A SCAC table lookup needs to be performed
Applied to: Set Table ID to 'SS'
WHEN
The system sets up the table query
THEN
The table ID is set to 'SS' to identify the SCAC table
Context: An equipment record contains a SCAC code for carrier identification
GIVEN
An equipment record contains a SCAC code for carrier identification
Applied to: Move SCAC Code from Equipment to Key
WHEN
The system prepares to lookup carrier automation status
THEN
The SCAC code from the equipment record is moved to the table lookup key
Context: A train has an origin port code that needs carrier validation
GIVEN
A train has an origin port code that needs carrier validation
Applied to: Move Port Code to Key
WHEN
The system sets up SCAC table lookup parameters
THEN
The train's origin port code is moved to the table lookup key
R-GCCS358C-cbl-00251 (+5) File: GCCS358C.cbl Handle Flat Car and Container Car Pairing Logic Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Flat Car and Container Car Pairing Logic':
  • Context - an equipment item with a specific equipment type code:
    For Is Current Car a Flat Car Type?:
    When the equipment type code is bg, ca, et, gs, id, lo, rr, sk, or tn, then the equipment is classified as a flat car type.
  • Context - the next equipment item with a specific equipment type code:
    For Is Next Car a Container Car Type?:
    When the equipment type code is cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then the equipment is classified as a container car type.
  • Context - a flat car equipment type followed by a container car equipment type:
    For Store Flat Car Information:
    When the flat car and container car pairing is identified, then the flat car vid segment is stored for later processing with the container car's location information.
  • Context - a stored flat car vid segment and a current container car being processed:
    For Create VID Segment for Flat Car:
    When the container car is processed and has location information, then two vid segments are created - one for the flat car using the container's location id and one for the container car.
  • Context - an equipment item that is not a flat car followed by a container or a container with stored flat car information:
    For Process as Regular Equipment:
    When the equipment is processed individually, then a single vid segment is created for the equipment and mbl segment is created if the equipment is loaded with cargo.
  • Context - equipment in a flat car-container pairing that is loaded and has cargo information:
    For Create MBL Segment if Loaded:
    When the equipment vid segments are created for the pairing, then an mbl segment is created for the loaded equipment with cargo details.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item with a specific equipment type code
GIVEN
An equipment item with a specific equipment type code
Applied to: Is Current Car a Flat Car Type?
WHEN
The equipment type code is BG, CA, ET, GS, ID, LO, RR, SK, or TN
THEN
The equipment is classified as a flat car type
Context: The next equipment item with a specific equipment type code
GIVEN
The next equipment item with a specific equipment type code
Applied to: Is Next Car a Container Car Type?
WHEN
The equipment type code is CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
The equipment is classified as a container car type
Context: A flat car equipment type followed by a container car equipment type
GIVEN
A flat car equipment type followed by a container car equipment type
Applied to: Store Flat Car Information
WHEN
The flat car and container car pairing is identified
THEN
The flat car VID segment is stored for later processing with the container car's location information
Context: A stored flat car VID segment and a current container car being processed
GIVEN
A stored flat car VID segment and a current container car being processed
Applied to: Create VID Segment for Flat Car
WHEN
The container car is processed and has location information
THEN
Two VID segments are created - one for the flat car using the container's location ID and one for the container car
Context: An equipment item that is not a flat car followed by a container or a container with stored flat car information
GIVEN
An equipment item that is not a flat car followed by a container or a container with stored flat car information
Applied to: Process as Regular Equipment
WHEN
The equipment is processed individually
THEN
A single VID segment is created for the equipment and MBL segment is created if the equipment is loaded with cargo
Context: Equipment in a flat car-container pairing that is loaded and has cargo information
GIVEN
Equipment in a flat car-container pairing that is loaded and has cargo information
Applied to: Create MBL Segment if Loaded
WHEN
The equipment VID segments are created for the pairing
THEN
An MBL segment is created for the loaded equipment with cargo details
R-GCCU358T-cbl-00251 (+8) File: GCCU358T.cbl Export Criteria Check Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Export Criteria Check':
  • Context - a cargo record exists with m1201 in-bond type code:
    For M1201 In-Bond Type = 'TR'?:
    When the m1201 in-bond type code equals 'tr', then the cargo automatically qualifies for export processing regardless of other conditions.
  • Context - a train has an origin station code in p401-m1302-us-from-sc:
    For Valid Port?:
    When the origin station code is found in the se table with successful lookup, then the port is considered valid and sw-valid-port is set to true.
  • Context - a cargo record has m1109 bol type code and the port is valid:
    For M1109 Export Type?:
    When the m1109 bol type code indicates export (88-gcusrt-m1109-export condition is true), then the cargo qualifies for export processing.
    For M1109 Returned US Goods?:
    When the m1109 bol type code indicates returned us goods (88-gcusrt-m1109-rtned-us-goods condition is true), then the cargo qualifies for export processing.
    For M1109 Empty Residue?:
    When the m1109 bol type code indicates empty residue (88-gcusrt-m1109-empty-residue condition is true), then the cargo qualifies for export processing.
  • Context - a cargo record has m1201 in-bond type code and the port is valid:
    For M1201 Transport Export?:
    When the m1201 in-bond type code indicates transport export (88-gcusrt-m1201-transp-export condition is true), then the cargo qualifies for export processing.
    For M1201 Immediate Export?:
    When the m1201 in-bond type code indicates immediate export (88-gcusrt-m1201-imm-export condition is true), then the cargo qualifies for export processing.
    For M1201 Multi-Port?:
    When the m1201 in-bond type code indicates multi-port (88-gcusrt-m1201-multi-port condition is true), then the cargo qualifies for export processing.
  • Context - a cargo record has been evaluated against export criteria:
    For Cargo Qualifies for Export Processing:
    When the cargo meets any of the qualifying conditions (tr in-bond type or valid export types with valid port), then the bill of lading quantity counter (ws-bol-qte) is incremented by 1 and export train indicator is set if port is valid.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with M1201 in-bond type code
GIVEN
A cargo record exists with M1201 in-bond type code
Applied to: M1201 In-Bond Type = 'TR'?
WHEN
The M1201 in-bond type code equals 'TR'
THEN
The cargo automatically qualifies for export processing regardless of other conditions
Context: A train has an origin station code in P401-M1302-US-FROM-SC
GIVEN
A train has an origin station code in P401-M1302-US-FROM-SC
Applied to: Valid Port?
WHEN
The origin station code is found in the SE table with successful lookup
THEN
The port is considered valid and SW-VALID-PORT is set to true
Context: A cargo record has M1109 BOL type code and the port is valid
GIVEN
A cargo record has M1109 BOL type code and the port is valid
Applied to: M1109 Export Type?
WHEN
The M1109 BOL type code indicates export (88-GCUSRT-M1109-EXPORT condition is true)
THEN
The cargo qualifies for export processing
Applied to: M1109 Returned US Goods?
WHEN
The M1109 BOL type code indicates returned US goods (88-GCUSRT-M1109-RTNED-US-GOODS condition is true)
THEN
The cargo qualifies for export processing
Applied to: M1109 Empty Residue?
WHEN
The M1109 BOL type code indicates empty residue (88-GCUSRT-M1109-EMPTY-RESIDUE condition is true)
THEN
The cargo qualifies for export processing
Context: A cargo record has M1201 in-bond type code and the port is valid
GIVEN
A cargo record has M1201 in-bond type code and the port is valid
Applied to: M1201 Transport Export?
WHEN
The M1201 in-bond type code indicates transport export (88-GCUSRT-M1201-TRANSP-EXPORT condition is true)
THEN
The cargo qualifies for export processing
Applied to: M1201 Immediate Export?
WHEN
The M1201 in-bond type code indicates immediate export (88-GCUSRT-M1201-IMM-EXPORT condition is true)
THEN
The cargo qualifies for export processing
Applied to: M1201 Multi-Port?
WHEN
The M1201 in-bond type code indicates multi-port (88-GCUSRT-M1201-MULTI-PORT condition is true)
THEN
The cargo qualifies for export processing
Context: A cargo record has been evaluated against export criteria
GIVEN
A cargo record has been evaluated against export criteria
Applied to: Cargo Qualifies for Export Processing
WHEN
The cargo meets any of the qualifying conditions (TR in-bond type OR valid export types with valid port)
THEN
The bill of lading quantity counter (WS-BOL-QTE) is incremented by 1 and export train indicator is set if port is valid
R-GCCS358C-cbl-00257 (+2) File: GCCS358C.cbl Determine Bill of Lading Response Code Logic Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Bill of Lading Response Code Logic':
  • Context - a bill of lading response code field is empty or spaces:
    For Response Code Already Set?:
    When the system processes the bill of lading information, then if bill of lading number exists and is not spaces, set response code to 'y', otherwise set response code to 'n'.
  • Context - a cargo record with in-transit status:
    For Cargo Status is Revenue Transit?:
    When the cargo in-transit status equals 'r' (revenue transit), then override the bill of lading number to 'na' and set response code to 'n'.
  • Context - a cargo record that may have haulage rights:
    For Haulage Rights Exist?:
    When the cargo has haulage rights (gccc-haulage is true), then set the scac code to the haulage rights scac and override response code to 'n'.
👨‍💻 Technical ACs (Gherkin)
Context: A bill of lading response code field is empty or spaces
GIVEN
A bill of lading response code field is empty or spaces
Applied to: Response Code Already Set?
WHEN
The system processes the bill of lading information
THEN
If bill of lading number exists and is not spaces, set response code to 'Y', otherwise set response code to 'N'
Context: A cargo record with in-transit status
GIVEN
A cargo record with in-transit status
Applied to: Cargo Status is Revenue Transit?
WHEN
The cargo in-transit status equals 'R' (Revenue Transit)
THEN
Override the bill of lading number to 'NA' and set response code to 'N'
Context: A cargo record that may have haulage rights
GIVEN
A cargo record that may have haulage rights
Applied to: Haulage Rights Exist?
WHEN
The cargo has haulage rights (GCCC-HAULAGE is true)
THEN
Set the SCAC code to the haulage rights SCAC and override response code to 'N'
R-GCCS358C-cbl-00260 (+3) File: GCCS358C.cbl Apply Revenue Transit and Haulage Business Rules Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Revenue Transit and Haulage Business Rules':
  • Context - a cargo record exists with in-transit status:
    For Revenue Transit Status = 'R'?:
    When the cargo in-transit status equals 'r' (revenue transit), then set mbl bol-waybill to 'na' and set mbl yes-no-resp-code to 'n'.
  • Context - cargo has revenue transit status 'r' and processing is in post-emanifest mode:
    For Set Exception Code to '08':
    When the transaction is post-emanifest (gcwb4tl-post-emanifest is true), then set mbl exception code to '08'.
  • Context - a cargo record with haulage rights information:
    For Set SCAC to Haulage Rights SCAC & Set Response Code to 'N':
    When the cargo has haulage rights (gccc-haulage is true), then set mbl scac to the haulage rights scac (gccc-haulage-rights-scac) and set mbl yes-no-resp-code to 'n'.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with in-transit status
GIVEN
A cargo record exists with in-transit status
Applied to: Revenue Transit Status = 'R'?
WHEN
The cargo in-transit status equals 'R' (Revenue Transit)
THEN
Set MBL BOL-WAYBILL to 'NA' and set MBL YES-NO-RESP-CODE to 'N'
Context: Cargo has revenue transit status 'R' and processing is in post-emanifest mode
GIVEN
Cargo has revenue transit status 'R' and processing is in post-emanifest mode
Applied to: Set Exception Code to '08'
WHEN
The transaction is post-emanifest (GCWB4TL-POST-EMANIFEST is true)
THEN
Set MBL exception code to '08'
Context: A cargo record with haulage rights information
GIVEN
A cargo record with haulage rights information
Applied to: Set SCAC to Haulage Rights SCAC & Set Response Code to 'N'
WHEN
The cargo has haulage rights (GCCC-HAULAGE is true)
THEN
Set MBL SCAC to the haulage rights SCAC (GCCC-HAULAGE-RIGHTS-SCAC) AND Set MBL YES-NO-RESP-CODE to 'N'
R-GCCU358T-cbl-00260 (+2) File: GCCU358T.cbl Determine Equipment Load/Empty Status Based on Cargo Weight Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Equipment Load/Empty Status Based on Cargo Weight':
  • Context - an equipment piece is being processed for load/empty status determination:
    For Set Status to 'E' 'Empty':
    When the equipment's load/empty indicator from the train list is 'h' (hold), then the equipment's load/empty status code is set to 'e' (empty).
  • Context - an equipment piece has cargo associated with it and the train list shows empty status and the equipment's load/empty indicator is not 'h':
    For Set Status to 'L' 'Loaded':
    When the equipment has a us ccn key (cargo present) and the train list load/empty indicator is 'e' (empty) and the cargo weight is greater than 1, then the equipment's load/empty status code is set to 'l' (loaded).
  • Context - an equipment piece is being processed for load/empty status determination and the equipment's load/empty indicator is not 'h':
    For Keep Original Status:
    When the equipment does not have cargo or the current status is not 'e' or the cargo weight is not greater than 1, then the equipment's load/empty status code remains as the original value from the train list.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment piece is being processed for load/empty status determination
GIVEN
An equipment piece is being processed for load/empty status determination
Applied to: Set Status to 'E' 'Empty'
WHEN
The equipment's load/empty indicator from the train list is 'H' (Hold)
THEN
The equipment's load/empty status code is set to 'E' (Empty)
Context: An equipment piece has cargo associated with it and the train list shows empty status and the equipment's load/empty indicator is not 'H'
GIVEN
An equipment piece has cargo associated with it and the train list shows empty status and the equipment's load/empty indicator is not 'H'
Applied to: Set Status to 'L' 'Loaded'
WHEN
The equipment has a US CCN key (cargo present) and the train list load/empty indicator is 'E' (Empty) and the cargo weight is greater than 1
THEN
The equipment's load/empty status code is set to 'L' (Loaded)
Context: An equipment piece is being processed for load/empty status determination and the equipment's load/empty indicator is not 'H'
GIVEN
An equipment piece is being processed for load/empty status determination and the equipment's load/empty indicator is not 'H'
Applied to: Keep Original Status
WHEN
The equipment does not have cargo or the current status is not 'E' or the cargo weight is not greater than 1
THEN
The equipment's load/empty status code remains as the original value from the train list
R-GCCU358T-cbl-00263 (+4) File: GCCU358T.cbl Initialize SCAC Table Key Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize SCAC Table Key':
  • Context - a scac table key structure exists for carrier validation lookup:
    For Clear SCAC Table Key Structure:
    When the system needs to prepare the key structure for a new lookup operation, then all fields in the scac table key structure are cleared to spaces.
  • Context - a scac table lookup operation is being prepared:
    For Set Table ID to 'SS':
    When the system needs to specify which table to query, then the table id is set to 'ss' to identify the scac table.
  • Context - an equipment record contains a scac code and a table lookup key structure is prepared:
    For Move Equipment SCAC Code to Key:
    When the system needs to identify the carrier for automated processing validation, then the equipment's scac code is copied to the scac field in the lookup key.
  • Context - a train has an origin port code and a scac table lookup key is being prepared:
    For Move Port Code to Key:
    When the system needs to validate carrier automation at a specific port, then the train's origin port code is copied to the port field in the lookup key.
  • Context - scac table key structure has been initialized with table id, equipment scac code, and port code:
    For SCAC Table Key Ready for Lookup:
    When all required lookup parameters have been populated, then the scac table key is ready for carrier automation validation lookup operation.
👨‍💻 Technical ACs (Gherkin)
Context: A SCAC table key structure exists for carrier validation lookup
GIVEN
A SCAC table key structure exists for carrier validation lookup
Applied to: Clear SCAC Table Key Structure
WHEN
The system needs to prepare the key structure for a new lookup operation
THEN
All fields in the SCAC table key structure are cleared to spaces
Context: A SCAC table lookup operation is being prepared
GIVEN
A SCAC table lookup operation is being prepared
Applied to: Set Table ID to 'SS'
WHEN
The system needs to specify which table to query
THEN
The table ID is set to 'SS' to identify the SCAC table
Context: An equipment record contains a SCAC code and a table lookup key structure is prepared
GIVEN
An equipment record contains a SCAC code and a table lookup key structure is prepared
Applied to: Move Equipment SCAC Code to Key
WHEN
The system needs to identify the carrier for automated processing validation
THEN
The equipment's SCAC code is copied to the SCAC field in the lookup key
Context: A train has an origin port code and a SCAC table lookup key is being prepared
GIVEN
A train has an origin port code and a SCAC table lookup key is being prepared
Applied to: Move Port Code to Key
WHEN
The system needs to validate carrier automation at a specific port
THEN
The train's origin port code is copied to the port field in the lookup key
Context: SCAC table key structure has been initialized with table ID, equipment SCAC code, and port code
GIVEN
SCAC table key structure has been initialized with table ID, equipment SCAC code, and port code
Applied to: SCAC Table Key Ready for Lookup
WHEN
All required lookup parameters have been populated
THEN
The SCAC table key is ready for carrier automation validation lookup operation
R-GCCS358C-cbl-00264 (+5) File: GCCS358C.cbl Check Equipment Type Against Flat Car Classifications Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Equipment Type Against Flat Car Classifications':
  • Context - an equipment type code is provided for classification:
    For Is Equipment a Possible Flat Car?:
    When the equipment type is one of bg, ca, et, gs, id, lo, rr, sk, or tn, then the equipment is classified as a possible flat car type.
  • Context - a flat car type equipment has been identified:
    For Set Index to Next Equipment Position:
    When the system needs to check for loaded containers on the flat car, then the index is set to the next equipment position and the load found flag is initialized to spaces.
  • Context - a flat car is being examined for loaded containers:
    For More Equipment to Check AND Still Container Type?:
    When the current position is within the equipment list (position <= 2500) and the equipment type is one of cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then continue the load status check process for the current equipment position.
  • Context - a container type equipment is positioned on a flat car:
    For Equipment is Loaded OR Empty with CCN?:
    When the equipment is marked as loaded or the equipment is marked as empty but has a cargo control number (ccn) that is not spaces, then the container is considered to have cargo and affects the flat car's load status.
  • Context - a flat car has at least one container with cargo:
    For Set Flat Car Load Status to 'L':
    When a loaded container or empty container with ccn is found on the flat car, then the flat car's load/empty status is set to 'l' (loaded) and the load found flag is set to true.
  • Context - the current container position on the flat car has been evaluated:
    For Move to Next Equipment:
    When no cargo is found at the current position and more positions need to be checked, then the index is incremented to examine the next equipment position and its type is retrieved.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment type code is provided for classification
GIVEN
An equipment type code is provided for classification
Applied to: Is Equipment a Possible Flat Car?
WHEN
The equipment type is one of BG, CA, ET, GS, ID, LO, RR, SK, or TN
THEN
The equipment is classified as a possible flat car type
Context: A flat car type equipment has been identified
GIVEN
A flat car type equipment has been identified
Applied to: Set Index to Next Equipment Position
WHEN
The system needs to check for loaded containers on the flat car
THEN
The index is set to the next equipment position and the load found flag is initialized to spaces
Context: A flat car is being examined for loaded containers
GIVEN
A flat car is being examined for loaded containers
Applied to: More Equipment to Check AND Still Container Type?
WHEN
The current position is within the equipment list (position <= 2500) AND the equipment type is one of CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
Continue the load status check process for the current equipment position
Context: A container type equipment is positioned on a flat car
GIVEN
A container type equipment is positioned on a flat car
Applied to: Equipment is Loaded OR Empty with CCN?
WHEN
The equipment is marked as loaded OR the equipment is marked as empty but has a cargo control number (CCN) that is not spaces
THEN
The container is considered to have cargo and affects the flat car's load status
Context: A flat car has at least one container with cargo
GIVEN
A flat car has at least one container with cargo
Applied to: Set Flat Car Load Status to 'L'
WHEN
A loaded container or empty container with CCN is found on the flat car
THEN
The flat car's load/empty status is set to 'L' (loaded) and the load found flag is set to true
Context: The current container position on the flat car has been evaluated
GIVEN
The current container position on the flat car has been evaluated
Applied to: Move to Next Equipment
WHEN
No cargo is found at the current position and more positions need to be checked
THEN
The index is incremented to examine the next equipment position and its type is retrieved
R-GCCU358T-cbl-00268 (+3) File: GCCU358T.cbl Determine Load/Empty Status Based on Next Equipment Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Load/Empty Status Based on Next Equipment':
  • Context - a train equipment item is being processed for load/empty status:
    For Skip Container Equipment:
    When the current equipment container indicator is 'c', then skip processing this equipment and continue to next equipment.
  • Context - processing equipment for load/empty status determination:
    For Use Current Equipment Load/Empty Status:
    When the next equipment index (ws-sub3) is greater than the total equipment quantity (gcwtl-equipment-qte), then use the current equipment's load/empty status (gcwtl-vid10-le) as the final status.
  • Context - processing equipment for load/empty status and next equipment index is within train length:
    For Set Load Status to 'L':
    When the next equipment's container indicator is 'c', then set the current equipment's load/empty status to 'l' (loaded).
    For Use Current Equipment Load/Empty Status:
    When the next equipment's container indicator is not 'c', then use the current equipment's original load/empty status (gcwtl-vid10-le) as the final status.
👨‍💻 Technical ACs (Gherkin)
Context: A train equipment item is being processed for load/empty status
GIVEN
A train equipment item is being processed for load/empty status
Applied to: Skip Container Equipment
WHEN
The current equipment container indicator is 'C'
THEN
Skip processing this equipment and continue to next equipment
Context: Processing equipment for load/empty status determination
GIVEN
Processing equipment for load/empty status determination
Applied to: Use Current Equipment Load/Empty Status
WHEN
The next equipment index (WS-SUB3) is greater than the total equipment quantity (GCWTL-EQUIPMENT-QTE)
THEN
Use the current equipment's load/empty status (GCWTL-VID10-LE) as the final status
Context: Processing equipment for load/empty status and next equipment index is within train length
GIVEN
Processing equipment for load/empty status and next equipment index is within train length
Applied to: Set Load Status to 'L'
WHEN
The next equipment's container indicator is 'C'
THEN
Set the current equipment's load/empty status to 'L' (Loaded)
Applied to: Use Current Equipment Load/Empty Status
WHEN
The next equipment's container indicator is not 'C'
THEN
Use the current equipment's original load/empty status (GCWTL-VID10-LE) as the final status
R-GCCS358C-cbl-00270 (+8) File: GCCS358C.cbl Search Through Container Cars for Load Status Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search Through Container Cars for Load Status':
  • Context - a train equipment car with a specific equipment type code:
    For Is Current Car a Flat Car Type?:
    When the equipment type code is bg, ca, et, gs, id, lo, rr, sk, or tn, then the car is identified as a possible flat car type and container search is initiated.
  • Context - a flat car has been identified in the equipment sequence:
    For Set Search Index to Next Car Position:
    When container search is initiated, then the search index is set to the next car position after the flat car and the load found flag is reset.
  • Context - a car in the equipment sequence following a flat car:
    For Is Next Car a Container Type?:
    When the car type code is cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then the car is identified as a container type and load status checking continues.
  • Context - a container search is in progress through the equipment sequence:
    For More Cars to Check?:
    When the current search index is less than or equal to 2500 and the current car is a container type and no load has been found yet, then continue searching through the remaining cars in the sequence.
  • Context - a container car in the equipment sequence:
    For Is Container Car Loaded?:
    When the container car has a load indicator set to loaded, then the container is considered loaded and affects the flat car load status.
  • Context - a container car that is marked as empty:
    For Is Container Car Empty with CCN?:
    When the container car has a non-blank cargo control number (ccn) key, then the container is treated as loaded for flat car status determination.
  • Context - a flat car with associated container cars being searched:
    For Set Flat Car Status to Loaded:
    When any container car on the flat car is loaded or empty with a cargo control number, then the flat car load status is set to 'l' (loaded) and the search is terminated.
  • Context - a container car that is empty without a cargo control number:
    For Move to Next Car in Sequence:
    When the container search is still active, then move to the next car in the sequence and continue the container type validation.
  • Context - a flat car with no loaded container cars found in the search:
    For Keep Flat Car Status as Empty:
    When the container search is completed without finding any loaded containers, then the flat car retains its original empty load status.
👨‍💻 Technical ACs (Gherkin)
Context: A train equipment car with a specific equipment type code
GIVEN
A train equipment car with a specific equipment type code
Applied to: Is Current Car a Flat Car Type?
WHEN
The equipment type code is BG, CA, ET, GS, ID, LO, RR, SK, or TN
THEN
The car is identified as a possible flat car type and container search is initiated
Context: A flat car has been identified in the equipment sequence
GIVEN
A flat car has been identified in the equipment sequence
Applied to: Set Search Index to Next Car Position
WHEN
Container search is initiated
THEN
The search index is set to the next car position after the flat car and the load found flag is reset
Context: A car in the equipment sequence following a flat car
GIVEN
A car in the equipment sequence following a flat car
Applied to: Is Next Car a Container Type?
WHEN
The car type code is CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
The car is identified as a container type and load status checking continues
Context: A container search is in progress through the equipment sequence
GIVEN
A container search is in progress through the equipment sequence
Applied to: More Cars to Check?
WHEN
The current search index is less than or equal to 2500 and the current car is a container type and no load has been found yet
THEN
Continue searching through the remaining cars in the sequence
Context: A container car in the equipment sequence
GIVEN
A container car in the equipment sequence
Applied to: Is Container Car Loaded?
WHEN
The container car has a load indicator set to loaded
THEN
The container is considered loaded and affects the flat car load status
Context: A container car that is marked as empty
GIVEN
A container car that is marked as empty
Applied to: Is Container Car Empty with CCN?
WHEN
The container car has a non-blank cargo control number (CCN) key
THEN
The container is treated as loaded for flat car status determination
Context: A flat car with associated container cars being searched
GIVEN
A flat car with associated container cars being searched
Applied to: Set Flat Car Status to Loaded
WHEN
Any container car on the flat car is loaded or empty with a cargo control number
THEN
The flat car load status is set to 'L' (loaded) and the search is terminated
Context: A container car that is empty without a cargo control number
GIVEN
A container car that is empty without a cargo control number
Applied to: Move to Next Car in Sequence
WHEN
The container search is still active
THEN
Move to the next car in the sequence and continue the container type validation
Context: A flat car with no loaded container cars found in the search
GIVEN
A flat car with no loaded container cars found in the search
Applied to: Keep Flat Car Status as Empty
WHEN
The container search is completed without finding any loaded containers
THEN
The flat car retains its original empty load status
R-GCCU358T-cbl-00272 (+4) File: GCCU358T.cbl Convert Equipment Number to Standard Format Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Convert Equipment Number to Standard Format':
  • Context - a train equipment record with equipment number in the train list:
    For Convert Equipment Number to Standard Format:
    When processing equipment for canadian customs transmission, then the equipment number is converted to 6-digit car number format and stored in the canadian output table.
  • Context - a valid equipment index position in the train list:
    For Get Equipment Number from Train List:
    When processing equipment number conversion, then the equipment number is retrieved from the train list at the current equipment index position.
  • Context - an equipment number from the train list equipment record:
    For Move Equipment Number to Working Storage Car Number Field:
    When preparing for car number format conversion, then the equipment number is moved to the working storage car number field.
  • Context - an equipment number in the working storage car number field:
    For Convert to 6-Digit Car Number Format:
    When converting to canadian transmission format, then the equipment number is formatted as a 6-digit car number.
  • Context - a 6-digit formatted car number and a valid equipment index position:
    For Store Converted Number in Canadian Output Table:
    When storing converted car number for canadian transmission, then the 6-digit car number is stored in the canadian customs output table at the current equipment position.
👨‍💻 Technical ACs (Gherkin)
Context: A train equipment record with equipment number in the train list
GIVEN
A train equipment record with equipment number in the train list
Applied to: Convert Equipment Number to Standard Format
WHEN
Processing equipment for Canadian customs transmission
THEN
The equipment number is converted to 6-digit car number format and stored in the Canadian output table
Context: A valid equipment index position in the train list
GIVEN
A valid equipment index position in the train list
Applied to: Get Equipment Number from Train List
WHEN
Processing equipment number conversion
THEN
The equipment number is retrieved from the train list at the current equipment index position
Context: An equipment number from the train list equipment record
GIVEN
An equipment number from the train list equipment record
Applied to: Move Equipment Number to Working Storage Car Number Field
WHEN
Preparing for car number format conversion
THEN
The equipment number is moved to the working storage car number field
Context: An equipment number in the working storage car number field
GIVEN
An equipment number in the working storage car number field
Applied to: Convert to 6-Digit Car Number Format
WHEN
Converting to Canadian transmission format
THEN
The equipment number is formatted as a 6-digit car number
Context: A 6-digit formatted car number and a valid equipment index position
GIVEN
A 6-digit formatted car number and a valid equipment index position
Applied to: Store Converted Number in Canadian Output Table
WHEN
Storing converted car number for Canadian transmission
THEN
The 6-digit car number is stored in the Canadian customs output table at the current equipment position
R-GCCU358T-cbl-00277 (+2) File: GCCU358T.cbl Determine Car Kind Based on Equipment Type Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Car Kind Based on Equipment Type':
  • Context - a train equipment record is being processed for car kind determination:
    For Equipment Type = 'LO'?:
    When the equipment type code is 'lo' (locomotive), then the car kind should be set to 'l' to indicate locomotive equipment.
  • Context - a train equipment record is being processed for car kind determination and the equipment type is not 'lo':
    For Equipment Type = 'ET'?:
    When the equipment type code is 'et' (end-of-train), then the car kind should be set to 'e' to indicate end-of-train equipment.
  • Context - a train equipment record is being processed for car kind determination and the equipment type is neither 'lo' nor 'et':
    For Set Car Kind = SPACES for Standard Equipment:
    When the equipment type code is any value other than 'lo' or 'et', then the car kind should be set to spaces to indicate standard equipment.
👨‍💻 Technical ACs (Gherkin)
Context: A train equipment record is being processed for car kind determination
GIVEN
A train equipment record is being processed for car kind determination
Applied to: Equipment Type = 'LO'?
WHEN
The equipment type code is 'LO' (Locomotive)
THEN
The car kind should be set to 'L' to indicate locomotive equipment
Context: A train equipment record is being processed for car kind determination and the equipment type is not 'LO'
GIVEN
A train equipment record is being processed for car kind determination and the equipment type is not 'LO'
Applied to: Equipment Type = 'ET'?
WHEN
The equipment type code is 'ET' (End-of-Train)
THEN
The car kind should be set to 'E' to indicate end-of-train equipment
Context: A train equipment record is being processed for car kind determination and the equipment type is neither 'LO' nor 'ET'
GIVEN
A train equipment record is being processed for car kind determination and the equipment type is neither 'LO' nor 'ET'
Applied to: Set Car Kind = SPACES for Standard Equipment
WHEN
The equipment type code is any value other than 'LO' or 'ET'
THEN
The car kind should be set to spaces to indicate standard equipment
R-GCCS358C-cbl-00279 (+2) File: GCCS358C.cbl Apply Special Business Rules for Load Status Override Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Special Business Rules for Load Status Override':
  • Context - an equipment record is being processed with a ccn key:
    For CCN Key starts with '6105I'?:
    When the ccn key starts with '6105i', then the equipment load status is set to empty ('e').
  • Context - an equipment record is being processed:
    For Equipment marked as Loaded AND CCN Key is blank?:
    When the equipment is marked as loaded and the ccn key is blank or spaces, then the equipment load status is set to empty ('e').
  • Context - equipment is being processed in post-emanifest mode:
    For Equipment is Empty AND has CCN Key?:
    When the equipment is marked as empty and has a non-blank ccn key, then the equipment load status is set to loaded ('l') for revenue empty handling.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record is being processed with a CCN key
GIVEN
An equipment record is being processed with a CCN key
Applied to: CCN Key starts with '6105I'?
WHEN
The CCN key starts with '6105I'
THEN
The equipment load status is set to Empty ('E')
Context: An equipment record is being processed
GIVEN
An equipment record is being processed
Applied to: Equipment marked as Loaded AND CCN Key is blank?
WHEN
The equipment is marked as loaded AND the CCN key is blank or spaces
THEN
The equipment load status is set to Empty ('E')
Context: Equipment is being processed in post-emanifest mode
GIVEN
Equipment is being processed in post-emanifest mode
Applied to: Equipment is Empty AND has CCN Key?
WHEN
The equipment is marked as empty AND has a non-blank CCN key
THEN
The equipment load status is set to Loaded ('L') for revenue empty handling
R-GCCS358C-cbl-00282 File: GCCS358C.cbl Determine SCAC Code Assignment Based on CCN Prefix
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine SCAC Code Assignment Based on CCN Prefix':
  • Context - a train list equipment record with a cda ccn key:
    For CCN Key Starts with '2156'?:
    When the system processes the mbl segment for scac code assignment, then if the ccn key starts with '2156', assign scac code 'cffo', otherwise assign scac code 'cprs'.
👨‍💻 Technical ACs (Gherkin)
Context: A train list equipment record with a CDA CCN key
GIVEN
A train list equipment record with a CDA CCN key
Applied to: CCN Key Starts with '2156'?
WHEN
The system processes the MBL segment for SCAC code assignment
THEN
If the CCN key starts with '2156', assign SCAC code 'CFFO', otherwise assign SCAC code 'CPRS'
R-GCCS358C-cbl-00283 (+17) File: GCCS358C.cbl Process Amendment Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Amendment':
  • Context - a train manifest is being processed with equipment items:
    For Check if Amendment Processing Required:
    When the system checks if this is the first equipment item (sub-tl = 1) and the amendment flag is set to true, then amendment processing should be initiated for mbl segment creation.
  • Context - equipment items are being processed sequentially with a position counter (sub-tl):
    For First Equipment in List?:
    When the system checks the equipment position counter, then if sub-tl equals 1, the equipment is identified as the first in the list, otherwise it is not the first.
  • Context - an equipment item is being processed for mbl segment creation:
    For Equipment has CCN?:
    When the system checks the cda-ccn-key field for the equipment, then if the ccn key is not spaces, the equipment has cargo data, otherwise it has no cargo data.
  • Context - an equipment item has a valid ccn key (not spaces):
    For Process Regular MBL Segment:
    When the system processes the mbl segment for this equipment, then the regular mbl processing function (b240-load-mbl-seg) should be invoked.
  • Context - this is the first equipment item (sub-tl = 1) and amendment processing is required and the equipment has no ccn key (spaces):
    For Create Dummy MBL Segment:
    When the system determines that a dummy mbl is needed for amendment purposes, then the dummy mbl creation process (b250-load-dummy-mbl-seg) should be initiated.
  • Context - a dummy mbl segment is being created:
    For Set MBL Identifier to 'MBL':
    When the system initializes the mbl segment structure, then the mbl identifier field should be set to 'mbl'.
    For Set SCAC Code to 'CPRS':
    When the system sets the scac (standard carrier alpha code), then the scac code should be set to 'cprs' for canadian pacific railway.
    For Set Exception Code to '06':
    When the system sets the exception code for the mbl, then the exception code should be set to '06' to indicate this is a dummy mbl for amendment processing.
  • Context - a dummy mbl segment is being created for equipment without cargo:
    For Set Bill of Lading to 'NA':
    When the system sets the bill of lading/waybill number, then the bill of lading field should be set to 'na' indicating not applicable.
  • Context - a dummy mbl segment has been created and populated with required data:
    For Insert Dummy MBL into Transmission:
    When the system processes the mbl for transmission, then the dummy mbl segment should be inserted into the transmission data structure (a9dp-transmission-data).
  • Context - amendment processing is required and dummy mbl has been processed:
    For Create M13 Amendment Segment:
    When the system creates amendment documentation, then an m13 amendment segment should be created and initialized.
  • Context - an m13 amendment segment is being created:
    For Set M13 Identifier to 'M13':
    When the system initializes the m13 segment structure, then the m13 identifier field should be set to 'm13'.
    For Set SCAC Code to 'CPRS':
    When the system sets the scac (standard carrier alpha code) for the amendment, then the scac code should be set to 'cprs' for canadian pacific railway.
    For Set Amendment Code to '60':
    When the system sets the amendment code, then the amendment code should be set to '60' to indicate the specific type of manifest amendment.
  • Context - an m13 amendment segment is being created and station information is available:
    For Set Location ID from Station Code:
    When the system sets the location identifier for the amendment, then the location id should be set to the canadian station code (gcstbrt-sc-cdn-stat-code-x).
  • Context - an m13 amendment segment is being created and train information is available:
    For Set Bill/Waybill Number from Train Key:
    When the system sets the bill/waybill number for the amendment, then the bill/waybill number should be set to the train key (gcwb4tl-key).
  • Context - an m13 amendment segment has been created and populated with required data:
    For Insert M13 Amendment into Transmission:
    When the system processes the m13 for transmission, then the m13 amendment segment should be inserted into the transmission data structure (a9dp-transmission-data).
  • Context - all amendment-specific mbl and m13 segments have been processed:
    For Amendment MBL Processing Complete:
    When the system completes the amendment processing workflow, then the amendment mbl processing should be marked as complete and control should return to the main processing flow.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest is being processed with equipment items
GIVEN
A train manifest is being processed with equipment items
Applied to: Check if Amendment Processing Required
WHEN
The system checks if this is the first equipment item (SUB-TL = 1) and the amendment flag is set to true
THEN
Amendment processing should be initiated for MBL segment creation
Context: Equipment items are being processed sequentially with a position counter (SUB-TL)
GIVEN
Equipment items are being processed sequentially with a position counter (SUB-TL)
Applied to: First Equipment in List?
WHEN
The system checks the equipment position counter
THEN
If SUB-TL equals 1, the equipment is identified as the first in the list, otherwise it is not the first
Context: An equipment item is being processed for MBL segment creation
GIVEN
An equipment item is being processed for MBL segment creation
Applied to: Equipment has CCN?
WHEN
The system checks the CDA-CCN-KEY field for the equipment
THEN
If the CCN key is not spaces, the equipment has cargo data, otherwise it has no cargo data
Context: An equipment item has a valid CCN key (not spaces)
GIVEN
An equipment item has a valid CCN key (not spaces)
Applied to: Process Regular MBL Segment
WHEN
The system processes the MBL segment for this equipment
THEN
The regular MBL processing function (B240-LOAD-MBL-SEG) should be invoked
Context: This is the first equipment item (SUB-TL = 1) and amendment processing is required and the equipment has no CCN key (spaces)
GIVEN
This is the first equipment item (SUB-TL = 1) and amendment processing is required and the equipment has no CCN key (spaces)
Applied to: Create Dummy MBL Segment
WHEN
The system determines that a dummy MBL is needed for amendment purposes
THEN
The dummy MBL creation process (B250-LOAD-DUMMY-MBL-SEG) should be initiated
Context: A dummy MBL segment is being created
GIVEN
A dummy MBL segment is being created
Applied to: Set MBL Identifier to 'MBL'
WHEN
The system initializes the MBL segment structure
THEN
The MBL identifier field should be set to 'MBL'
Applied to: Set SCAC Code to 'CPRS'
WHEN
The system sets the SCAC (Standard Carrier Alpha Code)
THEN
The SCAC code should be set to 'CPRS' for Canadian Pacific Railway
Applied to: Set Exception Code to '06'
WHEN
The system sets the exception code for the MBL
THEN
The exception code should be set to '06' to indicate this is a dummy MBL for amendment processing
Context: A dummy MBL segment is being created for equipment without cargo
GIVEN
A dummy MBL segment is being created for equipment without cargo
Applied to: Set Bill of Lading to 'NA'
WHEN
The system sets the bill of lading/waybill number
THEN
The bill of lading field should be set to 'NA' indicating not applicable
Context: A dummy MBL segment has been created and populated with required data
GIVEN
A dummy MBL segment has been created and populated with required data
Applied to: Insert Dummy MBL into Transmission
WHEN
The system processes the MBL for transmission
THEN
The dummy MBL segment should be inserted into the transmission data structure (A9DP-TRANSMISSION-DATA)
Context: Amendment processing is required and dummy MBL has been processed
GIVEN
Amendment processing is required and dummy MBL has been processed
Applied to: Create M13 Amendment Segment
WHEN
The system creates amendment documentation
THEN
An M13 amendment segment should be created and initialized
Context: An M13 amendment segment is being created
GIVEN
An M13 amendment segment is being created
Applied to: Set M13 Identifier to 'M13'
WHEN
The system initializes the M13 segment structure
THEN
The M13 identifier field should be set to 'M13'
Applied to: Set SCAC Code to 'CPRS'
WHEN
The system sets the SCAC (Standard Carrier Alpha Code) for the amendment
THEN
The SCAC code should be set to 'CPRS' for Canadian Pacific Railway
Applied to: Set Amendment Code to '60'
WHEN
The system sets the amendment code
THEN
The amendment code should be set to '60' to indicate the specific type of manifest amendment
Context: An M13 amendment segment is being created and station information is available
GIVEN
An M13 amendment segment is being created and station information is available
Applied to: Set Location ID from Station Code
WHEN
The system sets the location identifier for the amendment
THEN
The location ID should be set to the Canadian station code (GCSTBRT-SC-CDN-STAT-CODE-X)
Context: An M13 amendment segment is being created and train information is available
GIVEN
An M13 amendment segment is being created and train information is available
Applied to: Set Bill/Waybill Number from Train Key
WHEN
The system sets the bill/waybill number for the amendment
THEN
The bill/waybill number should be set to the train key (GCWB4TL-KEY)
Context: An M13 amendment segment has been created and populated with required data
GIVEN
An M13 amendment segment has been created and populated with required data
Applied to: Insert M13 Amendment into Transmission
WHEN
The system processes the M13 for transmission
THEN
The M13 amendment segment should be inserted into the transmission data structure (A9DP-TRANSMISSION-DATA)
Context: All amendment-specific MBL and M13 segments have been processed
GIVEN
All amendment-specific MBL and M13 segments have been processed
Applied to: Amendment MBL Processing Complete
WHEN
The system completes the amendment processing workflow
THEN
The amendment MBL processing should be marked as complete and control should return to the main processing flow
R-GCCS358C-cbl-00301 (+7) File: GCCS358C.cbl Store and Retrieve Flat Car Information for Container Pairing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Store and Retrieve Flat Car Information for Container Pairing':
  • Context - equipment processing is in progress and current equipment type is available:
    For Is Current Equipment a Flat Car?:
    When current equipment type is bg, ca, et, gs, id, lo, rr, sk, or tn, then equipment is classified as a flat car and system proceeds to check for container pairing.
  • Context - current equipment is identified as a flat car and next equipment type is available:
    For Is Next Equipment a Container?:
    When next equipment type is cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then next equipment is classified as a container and flat car-container pairing is initiated.
  • Context - current equipment is a flat car and next equipment is a container:
    For Store Flat Car Information in FLATCAR-VID-SEGMENT:
    When flat car-container pairing condition is met, then current vid segment information is stored in flatcar-vid-segment for later retrieval and container information storage areas are initialized.
  • Context - equipment processing is in progress and current equipment is not a flat car:
    For Is Current Equipment a Container?:
    When current equipment type is cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then equipment is classified as a container and system checks for available stored flat car information.
  • Context - current equipment is identified as a container:
    For Is Stored Flat Car Available?:
    When flatcar-vid-segment contains previously stored flat car information (not equal to spaces), then stored flat car is available for pairing and container pairing process is initiated.
  • Context - stored flat car information is available and current equipment is a container:
    For Process Flat Car with Container Location:
    When container location information is captured and flat car data is retrieved from storage, then flat car vid segment is processed with container location id and both segments are transmitted as a paired unit.
  • Context - flat car-container pair is processed and container has cargo information:
    For Generate MBL Segment for Pair:
    When container is loaded and has valid cargo key (cda-ccn-key not equal to spaces), then mbl segment is generated for the paired equipment unit.
  • Context - equipment does not meet flat car-container pairing criteria:
    For Process as Regular Equipment:
    When equipment is not a flat car followed by container, or is not a container with stored flat car, or is at end of equipment list, then equipment vid segment is transmitted as individual unit and mbl is generated if equipment has loaded cargo.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment processing is in progress and current equipment type is available
GIVEN
Equipment processing is in progress and current equipment type is available
Applied to: Is Current Equipment a Flat Car?
WHEN
Current equipment type is BG, CA, ET, GS, ID, LO, RR, SK, or TN
THEN
Equipment is classified as a flat car and system proceeds to check for container pairing
Context: Current equipment is identified as a flat car and next equipment type is available
GIVEN
Current equipment is identified as a flat car and next equipment type is available
Applied to: Is Next Equipment a Container?
WHEN
Next equipment type is CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
Next equipment is classified as a container and flat car-container pairing is initiated
Context: Current equipment is a flat car and next equipment is a container
GIVEN
Current equipment is a flat car and next equipment is a container
Applied to: Store Flat Car Information in FLATCAR-VID-SEGMENT
WHEN
Flat car-container pairing condition is met
THEN
Current VID segment information is stored in FLATCAR-VID-SEGMENT for later retrieval and container information storage areas are initialized
Context: Equipment processing is in progress and current equipment is not a flat car
GIVEN
Equipment processing is in progress and current equipment is not a flat car
Applied to: Is Current Equipment a Container?
WHEN
Current equipment type is CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
Equipment is classified as a container and system checks for available stored flat car information
Context: Current equipment is identified as a container
GIVEN
Current equipment is identified as a container
Applied to: Is Stored Flat Car Available?
WHEN
FLATCAR-VID-SEGMENT contains previously stored flat car information (not equal to spaces)
THEN
Stored flat car is available for pairing and container pairing process is initiated
Context: Stored flat car information is available and current equipment is a container
GIVEN
Stored flat car information is available and current equipment is a container
Applied to: Process Flat Car with Container Location
WHEN
Container location information is captured and flat car data is retrieved from storage
THEN
Flat car VID segment is processed with container location ID and both segments are transmitted as a paired unit
Context: Flat car-container pair is processed and container has cargo information
GIVEN
Flat car-container pair is processed and container has cargo information
Applied to: Generate MBL Segment for Pair
WHEN
Container is loaded and has valid cargo key (CDA-CCN-KEY not equal to spaces)
THEN
MBL segment is generated for the paired equipment unit
Context: Equipment does not meet flat car-container pairing criteria
GIVEN
Equipment does not meet flat car-container pairing criteria
Applied to: Process as Regular Equipment
WHEN
Equipment is not a flat car followed by container, or is not a container with stored flat car, or is at end of equipment list
THEN
Equipment VID segment is transmitted as individual unit and MBL is generated if equipment has loaded cargo
R-GCCS358C-cbl-00309 (+2) File: GCCS358C.cbl Apply Post Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Post':
  • Context - a cargo record exists with in-transit status 'r' and the system is performing post-emanifest processing:
    For Set Exception Code '08':
    When the mbl segment is being created for the cargo, then the system sets exception code '08' in the mbl segment.
  • Context - a cargo record has in-transit status 'r':
    For Continue MBL Processing:
    When the mbl segment is being processed, then the system sets the bol waybill field to 'na'.
    For Continue MBL Processing:
    When the mbl segment response code is being determined, then the system sets the yes/no response code to 'n'.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with in-transit status 'R' and the system is performing post-emanifest processing
GIVEN
A cargo record exists with in-transit status 'R' and the system is performing post-emanifest processing
Applied to: Set Exception Code '08'
WHEN
The MBL segment is being created for the cargo
THEN
The system sets exception code '08' in the MBL segment
Context: A cargo record has in-transit status 'R'
GIVEN
A cargo record has in-transit status 'R'
Applied to: Continue MBL Processing
WHEN
The MBL segment is being processed
THEN
The system sets the BOL waybill field to 'NA'
Applied to: Continue MBL Processing
WHEN
The MBL segment response code is being determined
THEN
The system sets the yes/no response code to 'N'
R-GCCS358C-cbl-00312 (+4) File: GCCS358C.cbl Classify Equipment Types into Flat Car and Container Categories Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Classify Equipment Types into Flat Car and Container Categories':
  • Context - an equipment item with a specific equipment type code:
    For Is Current Equipment a Flat Car Type?:
    When the equipment type code is one of bg, ca, et, gs, id, lo, rr, sk, or tn, then the equipment is classified as a flat car type.
  • Context - the next equipment item in the sequence with a specific equipment type code:
    For Is Next Equipment a Container Type?:
    When the next equipment type code is one of cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then the next equipment is classified as a container type.
  • Context - a flat car type equipment followed by a container type equipment:
    For Initialize Flat Car Processing Variables:
    When the flat car and container combination is identified, then initialize flatcar-vid-segment, im-unit-vid-segment, and im-unit-vid12-element variables and store the current vid segment as flat car data.
  • Context - a container type equipment and existing flat car segment data:
    For Does Flat Car Data Exist?:
    When the current equipment is a container type and flatcar-vid-segment is not equal to spaces, then store current vid segment as container unit, preserve location id, process flat car segment first, then process container unit segment, and generate mbl segment if equipment is loaded with cargo.
  • Context - an equipment item that does not fit flat car-container combination patterns:
    For Process Equipment Normally:
    When the equipment is not part of a flat car-container sequence or is processed individually, then generate vid segment using standard processing and create mbl segment if equipment is loaded with cargo.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item with a specific equipment type code
GIVEN
An equipment item with a specific equipment type code
Applied to: Is Current Equipment a Flat Car Type?
WHEN
The equipment type code is one of BG, CA, ET, GS, ID, LO, RR, SK, or TN
THEN
The equipment is classified as a flat car type
Context: The next equipment item in the sequence with a specific equipment type code
GIVEN
The next equipment item in the sequence with a specific equipment type code
Applied to: Is Next Equipment a Container Type?
WHEN
The next equipment type code is one of CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
The next equipment is classified as a container type
Context: A flat car type equipment followed by a container type equipment
GIVEN
A flat car type equipment followed by a container type equipment
Applied to: Initialize Flat Car Processing Variables
WHEN
The flat car and container combination is identified
THEN
Initialize FLATCAR-VID-SEGMENT, IM-UNIT-VID-SEGMENT, and IM-UNIT-VID12-ELEMENT variables and store the current VID segment as flat car data
Context: A container type equipment and existing flat car segment data
GIVEN
A container type equipment and existing flat car segment data
Applied to: Does Flat Car Data Exist?
WHEN
The current equipment is a container type and FLATCAR-VID-SEGMENT is not equal to spaces
THEN
Store current VID segment as container unit, preserve location ID, process flat car segment first, then process container unit segment, and generate MBL segment if equipment is loaded with cargo
Context: An equipment item that does not fit flat car-container combination patterns
GIVEN
An equipment item that does not fit flat car-container combination patterns
Applied to: Process Equipment Normally
WHEN
The equipment is not part of a flat car-container sequence or is processed individually
THEN
Generate VID segment using standard processing and create MBL segment if equipment is loaded with cargo
R-GCCS358C-cbl-00317 (+5) File: GCCS358C.cbl Validate Container Car Sequence and Load Status Rules Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Container Car Sequence and Load Status Rules':
  • Context - an equipment item with a specific car type code:
    For Is Current Car a Flat Car Type?:
    When the system checks if the car type is one of the flat car types (bg, ca, et, gs, id, lo, rr, sk, tn), then the system determines whether container sequence validation should be performed for subsequent equipment.
  • Context - a flat car type equipment at a specific position in the equipment list:
    For Set Index to Next Equipment Position:
    When the system needs to validate container sequence for the flat car, then the system sets the index to the next equipment position and initializes the load found flag.
  • Context - a flat car followed by subsequent equipment in the list:
    For Within Equipment List AND Next Car is Container Type?:
    When the system checks each subsequent equipment position up to the maximum limit of 2500, then the system continues validation only if the position is within bounds and the equipment is a container type (cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, tl).
  • Context - a container equipment item on a flat car:
    For Equipment Has Load OR Empty with CCN?:
    When the system checks if the equipment is loaded or if it's empty but has a cargo control number (ccn), then the system identifies whether the container has cargo that affects the flat car's load status.
  • Context - a flat car with containers where at least one container has cargo:
    For Set Flat Car Load Status to 'L':
    When the system finds a container that is loaded or empty with a cargo control number, then the system sets the flat car's load/empty status to 'l' (loaded) and marks the load as found.
  • Context - a flat car with multiple containers in sequence:
    For Move to Next Equipment:
    When the system has checked one container and needs to validate the next one, then the system increments the equipment index and updates the car type for the next validation cycle.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item with a specific car type code
GIVEN
An equipment item with a specific car type code
Applied to: Is Current Car a Flat Car Type?
WHEN
The system checks if the car type is one of the flat car types (BG, CA, ET, GS, ID, LO, RR, SK, TN)
THEN
The system determines whether container sequence validation should be performed for subsequent equipment
Context: A flat car type equipment at a specific position in the equipment list
GIVEN
A flat car type equipment at a specific position in the equipment list
Applied to: Set Index to Next Equipment Position
WHEN
The system needs to validate container sequence for the flat car
THEN
The system sets the index to the next equipment position and initializes the load found flag
Context: A flat car followed by subsequent equipment in the list
GIVEN
A flat car followed by subsequent equipment in the list
Applied to: Within Equipment List AND Next Car is Container Type?
WHEN
The system checks each subsequent equipment position up to the maximum limit of 2500
THEN
The system continues validation only if the position is within bounds and the equipment is a container type (CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, TL)
Context: A container equipment item on a flat car
GIVEN
A container equipment item on a flat car
Applied to: Equipment Has Load OR Empty with CCN?
WHEN
The system checks if the equipment is loaded OR if it's empty but has a cargo control number (CCN)
THEN
The system identifies whether the container has cargo that affects the flat car's load status
Context: A flat car with containers where at least one container has cargo
GIVEN
A flat car with containers where at least one container has cargo
Applied to: Set Flat Car Load Status to 'L'
WHEN
The system finds a container that is loaded or empty with a cargo control number
THEN
The system sets the flat car's load/empty status to 'L' (Loaded) and marks the load as found
Context: A flat car with multiple containers in sequence
GIVEN
A flat car with multiple containers in sequence
Applied to: Move to Next Equipment
WHEN
The system has checked one container and needs to validate the next one
THEN
The system increments the equipment index and updates the car type for the next validation cycle
R-GCCS358C-cbl-00323 (+7) File: GCCS358C.cbl Build and Configure Dummy MBL Segment with Business Rules Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build and Configure Dummy MBL Segment with Business Rules':
  • Context - a dummy mbl segment needs to be created for amendment processing:
    For Initialize MBL Segment Structure:
    When the system begins dummy mbl segment creation, then the mbl segment structure is initialized to clear any previous data.
  • Context - a dummy mbl segment is being created:
    For Set MBL Identifier to 'MBL':
    When the segment identifier needs to be set, then the mbl identifier is set to 'mbl'.
    For Set Bill of Lading to 'NA':
    When the bill of lading waybill number needs to be set, then the bill of lading waybill is set to 'na'.
  • Context - a dummy mbl segment is being created for amendment processing:
    For Set SCAC Code to 'CPRS':
    When the scac code needs to be assigned, then the scac code is set to 'cprs'.
    For Set Exception Code to '06':
    When the exception code needs to be assigned, then the exception code is set to '06'.
  • Context - a dummy mbl segment is being processed:
    For Clear Load Found Flag:
    When the load found flag needs to be reset, then the load found flag is cleared to spaces.
  • Context - a dummy mbl segment has been configured with all required values:
    For Insert MBL Segment into Transmission:
    When the segment needs to be added to the transmission, then the mbl segment is inserted into the transmission data structure.
  • Context - a dummy mbl segment has been successfully created and inserted:
    For Build M13 Amendment Segment:
    When amendment processing continues, then the m13 amendment segment is built and processed.
👨‍💻 Technical ACs (Gherkin)
Context: A dummy MBL segment needs to be created for amendment processing
GIVEN
A dummy MBL segment needs to be created for amendment processing
Applied to: Initialize MBL Segment Structure
WHEN
The system begins dummy MBL segment creation
THEN
The MBL segment structure is initialized to clear any previous data
Context: A dummy MBL segment is being created
GIVEN
A dummy MBL segment is being created
Applied to: Set MBL Identifier to 'MBL'
WHEN
The segment identifier needs to be set
THEN
The MBL identifier is set to 'MBL'
Applied to: Set Bill of Lading to 'NA'
WHEN
The bill of lading waybill number needs to be set
THEN
The bill of lading waybill is set to 'NA'
Context: A dummy MBL segment is being created for amendment processing
GIVEN
A dummy MBL segment is being created for amendment processing
Applied to: Set SCAC Code to 'CPRS'
WHEN
The SCAC code needs to be assigned
THEN
The SCAC code is set to 'CPRS'
Applied to: Set Exception Code to '06'
WHEN
The exception code needs to be assigned
THEN
The exception code is set to '06'
Context: A dummy MBL segment is being processed
GIVEN
A dummy MBL segment is being processed
Applied to: Clear Load Found Flag
WHEN
The load found flag needs to be reset
THEN
The load found flag is cleared to spaces
Context: A dummy MBL segment has been configured with all required values
GIVEN
A dummy MBL segment has been configured with all required values
Applied to: Insert MBL Segment into Transmission
WHEN
The segment needs to be added to the transmission
THEN
The MBL segment is inserted into the transmission data structure
Context: A dummy MBL segment has been successfully created and inserted
GIVEN
A dummy MBL segment has been successfully created and inserted
Applied to: Build M13 Amendment Segment
WHEN
Amendment processing continues
THEN
The M13 amendment segment is built and processed
R-GCCS358C-cbl-00331 (+6) File: GCCS358C.cbl Build and Configure M13 Amendment Segment with Location and Reference Data Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build and Configure M13 Amendment Segment with Location and Reference Data':
  • Context - the system needs to create an m13 amendment segment:
    For Initialize M13 Segment Structure:
    When the m13 segment initialization is triggered, then the m13 segment structure is cleared and ready for data population.
  • Context - an m13 amendment segment is being created:
    For Set M13 Identifier:
    When the segment identifier needs to be set, then the m13 identifier is set to 'm13'.
    For Set Amendment Code to 60:
    When the amendment code field needs to be set, then the amendment code is set to '60'.
  • Context - an m13 amendment segment is being populated:
    For Set SCAC Code to CPRS:
    When the scac code field needs to be set, then the scac code is set to 'cprs'.
  • Context - an m13 amendment segment is being created and station information is available:
    For Set Location ID from Station Code:
    When the location id field needs to be populated, then the location id is set to the canadian station code from gcstbrt station table.
  • Context - an m13 amendment segment is being created and train information is available:
    For Set Bill of Lading/Waybill Number from Train Key:
    When the bill of lading/waybill number field needs to be populated, then the bill of lading/waybill number is set to the train key from gcwb4tl.
  • Context - an m13 amendment segment has been fully populated:
    For Insert M13 Segment into Transmission:
    When the segment needs to be added to the transmission, then the m13 segment is inserted into the a9dp transmission data structure.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to create an M13 amendment segment
GIVEN
The system needs to create an M13 amendment segment
Applied to: Initialize M13 Segment Structure
WHEN
The M13 segment initialization is triggered
THEN
The M13 segment structure is cleared and ready for data population
Context: An M13 amendment segment is being created
GIVEN
An M13 amendment segment is being created
Applied to: Set M13 Identifier
WHEN
The segment identifier needs to be set
THEN
The M13 identifier is set to 'M13'
Applied to: Set Amendment Code to 60
WHEN
The amendment code field needs to be set
THEN
The amendment code is set to '60'
Context: An M13 amendment segment is being populated
GIVEN
An M13 amendment segment is being populated
Applied to: Set SCAC Code to CPRS
WHEN
The SCAC code field needs to be set
THEN
The SCAC code is set to 'CPRS'
Context: An M13 amendment segment is being created and station information is available
GIVEN
An M13 amendment segment is being created and station information is available
Applied to: Set Location ID from Station Code
WHEN
The location ID field needs to be populated
THEN
The location ID is set to the Canadian station code from GCSTBRT station table
Context: An M13 amendment segment is being created and train information is available
GIVEN
An M13 amendment segment is being created and train information is available
Applied to: Set Bill of Lading/Waybill Number from Train Key
WHEN
The bill of lading/waybill number field needs to be populated
THEN
The bill of lading/waybill number is set to the train key from GCWB4TL
Context: An M13 amendment segment has been fully populated
GIVEN
An M13 amendment segment has been fully populated
Applied to: Insert M13 Segment into Transmission
WHEN
The segment needs to be added to the transmission
THEN
The M13 segment is inserted into the A9DP transmission data structure
R-GCCS358C-cbl-00338 (+16) File: GCCS358C.cbl Execute Flat Car and Container Pairing Logic with Load Status Validation Merged 17 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Flat Car and Container Pairing Logic with Load Status Validation':
  • Context - an equipment item with a specific equipment type code:
    For Is Current Equipment a Flat Car?:
    When the equipment type code is one of bg, ca, et, gs, id, lo, rr, sk, or tn, then the equipment is classified as a flat car type.
    For Is Next Equipment a Container?:
    When the equipment type code is one of cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then the equipment is classified as a container type.
  • Context - a flat car equipment type is followed by a container equipment type:
    For Initialize Flat Car VID Segment:
    When the flat car and container pairing is identified, then initialize flat car vid segment, container vid segment, and container location element to prepare for data storage.
  • Context - a vid segment is populated with current equipment data and flat car pairing is identified:
    For Store Current VID as Flat Car:
    When the current equipment is a flat car type, then copy the current vid segment data to the flat car vid segment storage.
  • Context - current equipment is a container type and flat car vid segment storage exists:
    For Does Flat Car VID Exist?:
    When the flat car vid segment is not empty, then process the container as part of a flat car-container pair.
  • Context - a container equipment is being processed and an existing flat car vid segment is available:
    For Initialize Container VID Segment:
    When container vid segment needs to be paired with flat car, then initialize container vid segment, store container location id, and prepare for flat car data transfer.
  • Context - flat car vid segment data is stored and container location information is preserved:
    For Copy Flat Car VID to Current VID:
    When processing flat car-container pair, then copy flat car vid segment data to current vid segment.
  • Context - container location id is stored and flat car vid data is in current vid segment:
    For Apply Container Location ID to Flat Car:
    When processing flat car-container pair, then move the stored container location id to the vid location field.
  • Context - flat car vid segment is populated with equipment data and container location:
    For Insert Flat Car VID Segment:
    When flat car-container pair processing is complete, then insert the flat car vid segment into the transmission data.
  • Context - flat car vid segment has been inserted and container vid segment data is stored:
    For Reset VID to Container Data:
    When processing the container portion of flat car-container pair, then initialize current vid segment and copy container vid segment data to current vid segment.
  • Context - container vid segment data is restored to current vid segment:
    For Insert Container VID Segment:
    When container portion of flat car-container pair is ready, then insert the container vid segment into the transmission data.
  • Context - a container equipment in a flat car-container pair:
    For Equipment Has CCN and is Loaded?:
    When the equipment is loaded and has a cargo control number (ccn) that is not spaces, then process the mbl segment for the container.
  • Context - container equipment is loaded and has a valid cargo control number:
    For Process MBL Segment for Container:
    When mbl processing is required for the container, then execute mbl segment loading procedure for the container.
  • Context - equipment processing is in progress with a current subscript position:
    For Last Equipment in List?:
    When the subscript position is less than 999, then continue processing with flat car-container pairing logic, otherwise process as single equipment.
  • Context - equipment is the last in the list or does not qualify for flat car-container pairing:
    For Insert Single VID Segment:
    When vid segment is populated and not empty, then insert the vid segment into the transmission data.
  • Context - a single equipment item that is not part of flat car-container pairing:
    For Equipment Has CCN and is Loaded?:
    When the equipment is loaded and has a cargo control number (ccn) that is not spaces, then process the mbl segment for the equipment.
  • Context - single equipment is loaded and has a valid cargo control number:
    For Process MBL Segment:
    When mbl processing is required for the equipment, then execute mbl segment loading procedure for the equipment.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item with a specific equipment type code
GIVEN
An equipment item with a specific equipment type code
Applied to: Is Current Equipment a Flat Car?
WHEN
The equipment type code is one of BG, CA, ET, GS, ID, LO, RR, SK, or TN
THEN
The equipment is classified as a flat car type
Applied to: Is Next Equipment a Container?
WHEN
The equipment type code is one of CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
The equipment is classified as a container type
Context: A flat car equipment type is followed by a container equipment type
GIVEN
A flat car equipment type is followed by a container equipment type
Applied to: Initialize Flat Car VID Segment
WHEN
The flat car and container pairing is identified
THEN
Initialize flat car VID segment, container VID segment, and container location element to prepare for data storage
Context: A VID segment is populated with current equipment data and flat car pairing is identified
GIVEN
A VID segment is populated with current equipment data and flat car pairing is identified
Applied to: Store Current VID as Flat Car
WHEN
The current equipment is a flat car type
THEN
Copy the current VID segment data to the flat car VID segment storage
Context: Current equipment is a container type and flat car VID segment storage exists
GIVEN
Current equipment is a container type and flat car VID segment storage exists
Applied to: Does Flat Car VID Exist?
WHEN
The flat car VID segment is not empty
THEN
Process the container as part of a flat car-container pair
Context: A container equipment is being processed and an existing flat car VID segment is available
GIVEN
A container equipment is being processed and an existing flat car VID segment is available
Applied to: Initialize Container VID Segment
WHEN
Container VID segment needs to be paired with flat car
THEN
Initialize container VID segment, store container location ID, and prepare for flat car data transfer
Context: Flat car VID segment data is stored and container location information is preserved
GIVEN
Flat car VID segment data is stored and container location information is preserved
Applied to: Copy Flat Car VID to Current VID
WHEN
Processing flat car-container pair
THEN
Copy flat car VID segment data to current VID segment
Context: Container location ID is stored and flat car VID data is in current VID segment
GIVEN
Container location ID is stored and flat car VID data is in current VID segment
Applied to: Apply Container Location ID to Flat Car
WHEN
Processing flat car-container pair
THEN
Move the stored container location ID to the VID location field
Context: Flat car VID segment is populated with equipment data and container location
GIVEN
Flat car VID segment is populated with equipment data and container location
Applied to: Insert Flat Car VID Segment
WHEN
Flat car-container pair processing is complete
THEN
Insert the flat car VID segment into the transmission data
Context: Flat car VID segment has been inserted and container VID segment data is stored
GIVEN
Flat car VID segment has been inserted and container VID segment data is stored
Applied to: Reset VID to Container Data
WHEN
Processing the container portion of flat car-container pair
THEN
Initialize current VID segment and copy container VID segment data to current VID segment
Context: Container VID segment data is restored to current VID segment
GIVEN
Container VID segment data is restored to current VID segment
Applied to: Insert Container VID Segment
WHEN
Container portion of flat car-container pair is ready
THEN
Insert the container VID segment into the transmission data
Context: A container equipment in a flat car-container pair
GIVEN
A container equipment in a flat car-container pair
Applied to: Equipment Has CCN and is Loaded?
WHEN
The equipment is loaded and has a cargo control number (CCN) that is not spaces
THEN
Process the MBL segment for the container
Context: Container equipment is loaded and has a valid cargo control number
GIVEN
Container equipment is loaded and has a valid cargo control number
Applied to: Process MBL Segment for Container
WHEN
MBL processing is required for the container
THEN
Execute MBL segment loading procedure for the container
Context: Equipment processing is in progress with a current subscript position
GIVEN
Equipment processing is in progress with a current subscript position
Applied to: Last Equipment in List?
WHEN
The subscript position is less than 999
THEN
Continue processing with flat car-container pairing logic, otherwise process as single equipment
Context: Equipment is the last in the list or does not qualify for flat car-container pairing
GIVEN
Equipment is the last in the list or does not qualify for flat car-container pairing
Applied to: Insert Single VID Segment
WHEN
VID segment is populated and not empty
THEN
Insert the VID segment into the transmission data
Context: A single equipment item that is not part of flat car-container pairing
GIVEN
A single equipment item that is not part of flat car-container pairing
Applied to: Equipment Has CCN and is Loaded?
WHEN
The equipment is loaded and has a cargo control number (CCN) that is not spaces
THEN
Process the MBL segment for the equipment
Context: Single equipment is loaded and has a valid cargo control number
GIVEN
Single equipment is loaded and has a valid cargo control number
Applied to: Process MBL Segment
WHEN
MBL processing is required for the equipment
THEN
Execute MBL segment loading procedure for the equipment
R-GCCS358C-cbl-00355 (+7) File: GCCS358C.cbl Generate MBL Segments for Equipment Pairs Based on Cargo Status Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generate MBL Segments for Equipment Pairs Based on Cargo Status':
  • Context - an equipment record is being processed for mbl segment generation:
    For CCN Key = '6105I'?:
    When the ccn key starts with '6105i', then skip mbl segment generation and check if first equipment requires amendment processing.
  • Context - an mbl segment is being created for equipment with a valid ccn:
    For CCN starts with '2156'?:
    When the ccn starts with '2156', then set scac code to 'cffo', otherwise set scac code to 'cprs'.
  • Context - an mbl segment is being initialized:
    For Set CCN as Bill of Lading Number:
    When the equipment has a valid ccn key, then set the ccn key as the bill of lading waybill number in the mbl segment.
  • Context - an mbl segment is being populated:
    For Set Condition Response Code:
    When the equipment record contains a condition response code, then set the mbl condition response code to the equipment's condition response code value.
  • Context - an mbl segment has an empty response code:
    For Response Code Empty?:
    When the bill of lading waybill number is not empty, then set response code to 'y', otherwise set response code to 'n'.
  • Context - an mbl segment is being processed for cargo with in-transit status:
    For Cargo Status = 'R' 'Revenue'?:
    When the cargo in-transit status is 'r' (revenue), then set bill of lading to 'na', set response code to 'n', and if post-emanifest then set exception code to '08'.
  • Context - an mbl segment is being processed for cargo:
    For Haulage Rights Exist?:
    When the cargo has haulage rights defined, then set scac code to the haulage rights scac and set response code to 'n'.
  • Context - an mbl segment has been processed:
    For First Equipment & Amendment?:
    When this is the first equipment (sub-tl = 1) and the transaction is an amendment, then generate an m13 amendment segment with amendment code '60'.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment record is being processed for MBL segment generation
GIVEN
An equipment record is being processed for MBL segment generation
Applied to: CCN Key = '6105I'?
WHEN
The CCN key starts with '6105I'
THEN
Skip MBL segment generation and check if first equipment requires amendment processing
Context: An MBL segment is being created for equipment with a valid CCN
GIVEN
An MBL segment is being created for equipment with a valid CCN
Applied to: CCN starts with '2156'?
WHEN
The CCN starts with '2156'
THEN
Set SCAC code to 'CFFO', otherwise set SCAC code to 'CPRS'
Context: An MBL segment is being initialized
GIVEN
An MBL segment is being initialized
Applied to: Set CCN as Bill of Lading Number
WHEN
The equipment has a valid CCN key
THEN
Set the CCN key as the bill of lading waybill number in the MBL segment
Context: An MBL segment is being populated
GIVEN
An MBL segment is being populated
Applied to: Set Condition Response Code
WHEN
The equipment record contains a condition response code
THEN
Set the MBL condition response code to the equipment's condition response code value
Context: An MBL segment has an empty response code
GIVEN
An MBL segment has an empty response code
Applied to: Response Code Empty?
WHEN
The bill of lading waybill number is not empty
THEN
Set response code to 'Y', otherwise set response code to 'N'
Context: An MBL segment is being processed for cargo with in-transit status
GIVEN
An MBL segment is being processed for cargo with in-transit status
Applied to: Cargo Status = 'R' 'Revenue'?
WHEN
The cargo in-transit status is 'R' (Revenue)
THEN
Set bill of lading to 'NA', set response code to 'N', and if post-emanifest then set exception code to '08'
Context: An MBL segment is being processed for cargo
GIVEN
An MBL segment is being processed for cargo
Applied to: Haulage Rights Exist?
WHEN
The cargo has haulage rights defined
THEN
Set SCAC code to the haulage rights SCAC and set response code to 'N'
Context: An MBL segment has been processed
GIVEN
An MBL segment has been processed
Applied to: First Equipment & Amendment?
WHEN
This is the first equipment (SUB-TL = 1) and the transaction is an amendment
THEN
Generate an M13 amendment segment with amendment code '60'
R-GCCS358C-cbl-00363 (+4) File: GCCS358C.cbl Determine Equipment Type Classification Rules Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Equipment Type Classification Rules':
  • Context - an equipment item with a specific equipment type code:
    For Current Equipment is Flat Car Type?:
    When the equipment type code is one of bg, ca, et, gs, id, lo, rr, sk, or tn, then the equipment is classified as a flat car type.
    For Next Equipment is Container Type?:
    When the equipment type code is one of cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then the equipment is classified as a container type.
  • Context - a current equipment that is classified as flat car type and a next equipment in sequence:
    For Current Equipment is Flat Car Type? AND Next Equipment is Container Type?:
    When the current equipment type is bg, ca, et, gs, id, lo, rr, sk, or tn and the next equipment type is cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl, then initialize flat car processing variables and store current vid as flat car segment for paired processing.
  • Context - a current equipment that is classified as container type and an existing flat car segment:
    For Current Equipment is Container Type? AND Flat Car Segment Exists?:
    When the current equipment type is cc, ch, cm, cn, cx, cz, ls, ot, pl, pt, rl, rt, or tl and a flat car segment has been previously stored, then store current vid as container unit segment, copy container location id to flat car, and process both flat car and container unit vid segments.
  • Context - an equipment item that does not meet flat car-container pairing criteria:
    For Process Equipment Normally:
    When the equipment is not part of a flat car-container combination or is the last equipment in the list, then process the equipment using standard vid segment processing and load mbl segment if equipment is loaded with cargo.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item with a specific equipment type code
GIVEN
An equipment item with a specific equipment type code
Applied to: Current Equipment is Flat Car Type?
WHEN
The equipment type code is one of BG, CA, ET, GS, ID, LO, RR, SK, or TN
THEN
The equipment is classified as a flat car type
Applied to: Next Equipment is Container Type?
WHEN
The equipment type code is one of CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
The equipment is classified as a container type
Context: A current equipment that is classified as flat car type and a next equipment in sequence
GIVEN
A current equipment that is classified as flat car type and a next equipment in sequence
Applied to: Current Equipment is Flat Car Type? AND Next Equipment is Container Type?
WHEN
The current equipment type is BG, CA, ET, GS, ID, LO, RR, SK, or TN AND the next equipment type is CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL
THEN
Initialize flat car processing variables and store current VID as flat car segment for paired processing
Context: A current equipment that is classified as container type and an existing flat car segment
GIVEN
A current equipment that is classified as container type and an existing flat car segment
Applied to: Current Equipment is Container Type? AND Flat Car Segment Exists?
WHEN
The current equipment type is CC, CH, CM, CN, CX, CZ, LS, OT, PL, PT, RL, RT, or TL AND a flat car segment has been previously stored
THEN
Store current VID as container unit segment, copy container location ID to flat car, and process both flat car and container unit VID segments
Context: An equipment item that does not meet flat car-container pairing criteria
GIVEN
An equipment item that does not meet flat car-container pairing criteria
Applied to: Process Equipment Normally
WHEN
The equipment is not part of a flat car-container combination OR is the last equipment in the list
THEN
Process the equipment using standard VID segment processing and load MBL segment if equipment is loaded with cargo
R-GCCS358C-cbl-00368 (+7) File: GCCS358C.cbl Apply Dummy MBL Business Rules Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Dummy MBL Business Rules':
  • Context - an amendment scenario requires a dummy mbl segment:
    For Initialize MBL Segment Structure:
    When the dummy mbl processing begins, then the mbl segment structure is initialized to clear any previous data.
  • Context - a dummy mbl segment is being created:
    For Set MBL Identifier to 'MBL':
    When the segment identifier needs to be set, then the mbl identifier is set to 'mbl'.
  • Context - a dummy mbl segment is being processed:
    For Assign Standard CPRS SCAC Code:
    When the scac code needs to be assigned, then the scac code is set to 'cprs'.
    For Clear Load Found Flag:
    When the load found flag needs to be reset, then the load found flag is set to spaces.
  • Context - a dummy mbl segment is being created for amendment purposes:
    For Set Bill of Lading to 'NA':
    When the bill of lading waybill field needs to be populated, then the bill of lading waybill is set to 'na'.
  • Context - a dummy mbl segment is created for an amendment scenario:
    For Configure Exception Code '06':
    When the exception code needs to be configured, then the exception code is set to '06'.
  • Context - a dummy mbl segment has been configured with all required fields:
    For Insert MBL Segment into Transmission:
    When the segment needs to be added to the transmission, then the mbl segment is moved to transmission data and inserted into the data stream.
  • Context - a dummy mbl segment has been successfully inserted into the transmission:
    For Trigger M13 Amendment Segment Creation:
    When amendment processing is required, then the m13 amendment segment creation process is triggered.
👨‍💻 Technical ACs (Gherkin)
Context: An amendment scenario requires a dummy MBL segment
GIVEN
An amendment scenario requires a dummy MBL segment
Applied to: Initialize MBL Segment Structure
WHEN
The dummy MBL processing begins
THEN
The MBL segment structure is initialized to clear any previous data
Context: A dummy MBL segment is being created
GIVEN
A dummy MBL segment is being created
Applied to: Set MBL Identifier to 'MBL'
WHEN
The segment identifier needs to be set
THEN
The MBL identifier is set to 'MBL'
Context: A dummy MBL segment is being processed
GIVEN
A dummy MBL segment is being processed
Applied to: Assign Standard CPRS SCAC Code
WHEN
The SCAC code needs to be assigned
THEN
The SCAC code is set to 'CPRS'
Applied to: Clear Load Found Flag
WHEN
The load found flag needs to be reset
THEN
The load found flag is set to spaces
Context: A dummy MBL segment is being created for amendment purposes
GIVEN
A dummy MBL segment is being created for amendment purposes
Applied to: Set Bill of Lading to 'NA'
WHEN
The bill of lading waybill field needs to be populated
THEN
The bill of lading waybill is set to 'NA'
Context: A dummy MBL segment is created for an amendment scenario
GIVEN
A dummy MBL segment is created for an amendment scenario
Applied to: Configure Exception Code '06'
WHEN
The exception code needs to be configured
THEN
The exception code is set to '06'
Context: A dummy MBL segment has been configured with all required fields
GIVEN
A dummy MBL segment has been configured with all required fields
Applied to: Insert MBL Segment into Transmission
WHEN
The segment needs to be added to the transmission
THEN
The MBL segment is moved to transmission data and inserted into the data stream
Context: A dummy MBL segment has been successfully inserted into the transmission
GIVEN
A dummy MBL segment has been successfully inserted into the transmission
Applied to: Trigger M13 Amendment Segment Creation
WHEN
Amendment processing is required
THEN
The M13 amendment segment creation process is triggered
R-GCCS358C-cbl-00376 (+1) File: GCCS358C.cbl Determine SCAC Assignment Logic Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine SCAC Assignment Logic':
  • Context - a cargo record with a ccn key exists for processing:
    For Check CCN Key Prefix:
    When the system evaluates the ccn key prefix during mbl segment creation, then cffo scac code is assigned if ccn starts with '2156', otherwise cprs scac code is assigned.
  • Context - a cargo record is being processed for mbl segment creation:
    For Haulage Rights Exist?:
    When the cargo has haulage rights defined with a specific scac code, then the haulage rights scac code overrides the standard ccn-based scac assignment and response code is set to 'n'.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with a CCN key exists for processing
GIVEN
A cargo record with a CCN key exists for processing
Applied to: Check CCN Key Prefix
WHEN
The system evaluates the CCN key prefix during MBL segment creation
THEN
CFFO SCAC code is assigned if CCN starts with '2156', otherwise CPRS SCAC code is assigned
Context: A cargo record is being processed for MBL segment creation
GIVEN
A cargo record is being processed for MBL segment creation
Applied to: Haulage Rights Exist?
WHEN
The cargo has haulage rights defined with a specific SCAC code
THEN
The haulage rights SCAC code overrides the standard CCN-based SCAC assignment and response code is set to 'N'
R-GCCS358C-cbl-00378 (+3) File: GCCS358C.cbl Process Revenue Transit Status Rules Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Revenue Transit Status Rules':
  • Context - a cargo shipment exists with in-transit status:
    For Check Cargo In-Transit Status:
    When the cargo in-transit status is 'r' (revenue), then the bill of lading should be overridden to 'na' and response code should be set to 'n'.
  • Context - a cargo shipment has revenue transit status 'r' and the processing is post-emanifest:
    For Set Exception Code '08':
    When the system processes the mbl segment for this revenue transit cargo, then the exception code should be set to '08' to indicate post-emanifest revenue transit processing.
  • Context - a cargo shipment with in-transit status 'r' (revenue):
    For Override Bill of Lading to 'NA' & Set Response Code to 'N':
    When the system processes the mbl segment, then the bill of lading waybill field should be set to 'na' regardless of the original cargo ccn key and the yes/no response code should be set to 'n' to indicate negative response.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment exists with in-transit status
GIVEN
A cargo shipment exists with in-transit status
Applied to: Check Cargo In-Transit Status
WHEN
The cargo in-transit status is 'R' (Revenue)
THEN
The bill of lading should be overridden to 'NA' and response code should be set to 'N'
Context: A cargo shipment has revenue transit status 'R' and the processing is post-emanifest
GIVEN
A cargo shipment has revenue transit status 'R' and the processing is post-emanifest
Applied to: Set Exception Code '08'
WHEN
The system processes the MBL segment for this revenue transit cargo
THEN
The exception code should be set to '08' to indicate post-emanifest revenue transit processing
Context: A cargo shipment with in-transit status 'R' (Revenue)
GIVEN
A cargo shipment with in-transit status 'R' (Revenue)
Applied to: Override Bill of Lading to 'NA' & Set Response Code to 'N'
WHEN
The system processes the MBL segment
THEN
The bill of lading waybill field should be set to 'NA' regardless of the original cargo CCN key AND The yes/no response code should be set to 'N' to indicate negative response