Bits In Glass
BIG Pega COE Team

Detailed Acceptance Criteria (ACs)

Category: GCX003_US_Export_train

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

🎯 GCX003_US_Export_train Scope Detected: Extracted 1891 rules, Optimally Merged into 152 Feature Scenarios.
R-GCX003-cbl-00001 (+50) File: GCX003.cbl Overview Rules Merged 51 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Overview Rules':
  • Context - a train export request is received with a specific request type:
    For 46:AEI Request Type Classification:
    When the request type equals the aei request type constant, then set aei train send flag to yes, otherwise set aei train send flag to no.
  • Context - a user attempts to process a train request with their acf2 user id:
    For 2:User Security Validation:
    When the user's scac access is invalid and the request is not an aei train send request, then generate error message 14 (access denied) and set user access flag to no.
  • Context - a user requests to send a train manifest:
    For 2:User Security Validation:
    When the user's utf authorization is not 'u' or 's' and the request is not an aei train send request, then generate error message 13 (insufficient authorization) and set user access flag to no.
  • Context - a user requests to send a train manifest that requires special manifest processing:
    For 2:User Security Validation:
    When the user's special manifest authorization is not 's' and the request is not an aei train send request, then set user not authorized for special manifest flag to true.
  • Context - a train request is being processed:
    For 3:Train Origin Validation:
    When the train origin field is blank or spaces, then generate error message 2 (missing train origin) and exit validation.
  • Context - a train origin is provided:
    For 3:Train Origin Validation:
    When the origin is not found in station code table or the us station code is blank, then generate error message 2 (invalid train origin).
  • Context - a train request includes an eta date:
    For 4:Estimated Time of Arrival Validation:
    When the eta date equals '000000', then generate error message 3 (invalid eta date) and exit validation.
  • Context - an eta date and time are provided:
    For 4:Estimated Time of Arrival Validation:
    When the date conversion fails or eta time is not numeric or hour is not 00-23 or minute is not 00-59, then generate error message 3 (invalid eta format).
  • Context - a valid eta date is provided and user authorization level is determined:
    For 4:Estimated Time of Arrival Validation:
    When for 's' authorization: eta is not within 30 days before to 5 days after current date, or for other users: eta is not within 2 days before to 2 days after current date, then generate error message 4 (for 's' users) or message 21 (for other users).
  • Context - train details including scac, train id, origin, consist number, and creation date:
    For 5:US Customs Train ID Generation:
    When a train record with the same us customs train id already exists and is not marked as deleted, then generate error message 6 (duplicate train id).
  • Context - a train record with the same us customs train id exists:
    For 5:US Customs Train ID Generation:
    When the existing train record is marked as deleted, then delete the existing train record to allow creation of new record.
  • Context - train origin station is validated:
    For 6:MERLIN Customs ID Validation:
    When the station's public merlin id is blank or the merlin id is not found in merlin database, then generate error message 7 (missing merlin id) or message 8 (merlin id not found).
  • Context - a train request contains an equipment list:
    For 47:Equipment Limit Validation:
    When the first equipment item is marked as 'no more equipment' or the 500th equipment item is not marked as 'no more equipment', then generate error message 5 (invalid equipment list size).
  • Context - equipment is identified as a container:
    For 8:Container Waybill Retrieval:
    When container is found in container inquiry system, then retrieve waybill information using container inquiry data, otherwise use container database lookup.
  • Context - equipment is identified as a car with init and number:
    For 9:Car Waybill Retrieval:
    When car waybill lookup is performed, then retrieve latest waybill excluding temporary, corrector, and incomplete edi waybills, and if car is loaded empty, treat as waybill not found.
  • Context - a waybill is found for equipment:
    For 10:Cargo Record Retrieval:
    When cargo lookup is performed using waybill number and equipment id, then retrieve first cargo record and set cargo found flag, otherwise set no cargo found flag.
  • Context - cargo is found for equipment and request action is send with no errors:
    For 11:Cargo Attachment to Train:
    When cargo is immediate transport or already created for it or us-canada-us with release status or default with release status or empty equipment or special manifest at woburn pq station or export at non-laredo stations, then skip cargo attachment to train.
  • Context - equipment information is available:
    For 12:Equipment Detail Line Building:
    When building equipment detail line, then include equipment id, load/empty indicator, equipment type, and format according to container or car type.
  • Context - equipment id is provided:
    For 13:Equipment Type Validation:
    When equipment type lookup fails, then generate error message 35 (for containers) or message 36 (for cars) and set equipment error flag.
  • Context - equipment type is 'sk' and waybill is found:
    For 13:Equipment Type Validation:
    When double stack traffic type is determined, then add double stack count to appropriate traffic counter (cprs, csxt, ns, or haul).
  • Context - cargo is found for equipment:
    For 14:Cargo Information Processing:
    When processing cargo information, then extract us ccn key, load/empty code, bond numbers, and set appropriate bond found flags based on cargo type.
  • Context - cargo with bond type information is processed:
    For 15:Bond Type Classification:
    When bond type is us-canada-us and not created for it and not special tr, then set tr bond found flag, and when bond type is transport export and not created for it, set te bond found flag.
  • Context - cargo is being processed:
    For 16:Special Manifest Processing:
    When cargo has special manifest origin flag, then set special manifest it found flag, and when cargo is transport export with special manifest flag, set special manifest te found flag.
  • Context - cargo is export type with us-mexico country codes:
    For 16:Special Manifest Processing:
    When cargo has special 88 flag, then set us-mexico 88 found flag, and when cargo is us-canada-us with special tr flag, set special tr found flag.
  • Context - cargo is found and being validated:
    For 17:Cargo Status Validation:
    When cargo status is pending, deleted, or error, then generate error message 16 (cargo status invalid).
  • Context - cargo with specific bill type is processed:
    For 18:Bill Type Validation:
    When bill type is '15', then format as 'ppr 7512 15 us-ca-us', when bond type is it or ie, format as 'ams [bond_type] [bond_number]', when bond type is te, tr, or mt, format as 'ams 7512 [bond_type] [bond_number]'.
  • Context - equipment with cargo is being processed:
    For 19:Equipment Load Status Validation:
    When cargo is empty equipment or empty residue type, then set equipment as empty, update counters from loaded to empty, and format info as 'empty'.
  • Context - cargo is processed at laredo tx station:
    For 20:Mexico Customs Documentation Check:
    When fen reference number is not found, then generate error message 46, when kcm reference number is not found, generate error message 47, when cargo has hold border status, generate message 48, when cargo has dsp hold flag, generate message 49, when both hold border and dsp hold exist, generate message 52.
  • Context - cargo and waybill conditions are evaluated:
    For 21:Detour Processing Coordination:
    When specific detour conditions are met for te bond, tr bond, border clearance, us-us movement, or us-mexico export, then invoke appropriate detour processing routine (b551, b552, b553, b554, or b555).
  • Context - transport export cargo not created for it with location mismatch:
    For 22:TE Bond Port Change Processing:
    When request action is report, then generate message 19 with station code, when request action is send and user is authorized for special manifest, generate message 20 and spawn port change manifest, when user is not authorized, generate message 43.
  • Context - transit cargo not created for it with release status:
    For 23:TR Bond Diversion Processing:
    When request action is report, then generate message 18, when request action is send and user is authorized for special manifest, generate message 23 and spawn detour manifest, when user is not authorized, generate message 43.
  • Context - default cargo type not created for it:
    For 24:Border Clearance Detour Processing:
    When cargo has release status and request action is report, then generate message 18, when request action is send and user is authorized for special manifest, generate message 23 and spawn detour manifest, when user is not authorized, generate message 43, when cargo does not have release status, generate message 31.
  • Context - waybill found with no cargo for us domestic movement:
    For 25:US-US Movement Detour Processing:
    When request action is report, then generate message 18, when request action is send and user is authorized for special manifest, generate message 23 and spawn us-us detour manifest, when user is not authorized, generate message 43.
  • Context - export cargo with us-mexico country codes without special manifest:
    For 26:US-Mexico Export Detour Processing:
    When request action is report, then generate message 50, when request action is send and user is authorized for special manifest, generate message 23 and spawn 88-tr detour manifest, when user is not authorized, generate message 43, when cargo is not export type, generate message 31.
  • Context - waybill contains routing information:
    For 27:Geographic Route Validation:
    When route contains hazmat code 'hm', then set routing indicator to 2, when route has csxt or ns to cprs via det, set indicator to 3 (csxt) or 4 (ns), otherwise set indicator to 1.
  • Context - equipment is identified as container or waybill indicates conveying car with loaded status:
    For 28:Container on Flat Car Processing:
    When container is not found in primary database, then search container database, if still not found, search inquiry system for container cross-reference, generate error message 11 if no container found.
  • Context - train processing is complete:
    For 29:Report Header and Summary Building:
    When building final report, then include train id, origin station, user id, processing date/time, action type (send/report), result status, error/warning counts, equipment totals, and eta information.
  • Context - train processing completed successfully with send action:
    For 30:Train Database Record Creation:
    When creating train database record, then store train header with id, origin, destination, eta, aei flag, and up to maximum equipment items with their cargo details, generate error if equipment limit exceeded.
  • Context - train record is successfully created in database:
    For 32:EDI Train List Transmission:
    When transmitting to customs system, then call edi transmission module with train list data, generate error if transmission fails.
  • Context - aei train processing is completed:
    For 37:AEI Activity Logging:
    When logging aei activity, then create log entry with train id, user id, date/time, action code 'zzz', and aei send message.
  • Context - train processing is completed successfully:
    For 33:Report Transmission to Customs:
    When sending report to customs, then send email to om01247 with train details, equipment list, and status information, handle large reports with continuation logic.
  • Context - report exceeds 699 lines:
    For 34:Large Report Email Pagination:
    When sending large report, then send first portion, create continuation message with headers, and send remaining portions with continuation indicators.
  • Context - train processing is completed:
    For 35:Report Distribution to Originator:
    When distributing results to originator, then send appropriate report type (error, sent, or report) to originator terminal or alternate terminal if specified.
  • Context - request is aei train send type:
    For 38:AEI Report Processing:
    When processing aei report, then retrieve email addresses from aei work table for train origin, send report to configured addresses, use default addresses if none configured, handle email failures by sending to support.
  • Context - train processing completed successfully for non-laredo stations:
    For 39:Canadian Export Report Generation:
    When generating export report, then spawn gcx141 message for export report generation.
  • Context - train processing completed successfully at laredo tx station:
    For 40:Enhanced Report Generation:
    When generating enhanced report, then create detailed report with car/container counts, locomotive counts, port information, eta details, and equipment details with bol information.
  • Context - report data is prepared:
    For 41:PDF Report Generation:
    When generating pdf reports, then call gcx904 module to create pdf reports for both pre-exit report (80 character width) and export train report (132 character width).
  • Context - error or warning message is generated:
    For 42:Error Message Processing:
    When processing message, then increment appropriate counter (error, warning, info), track special message types (dsp holds), and handle spawn message indicators.
  • Context - report contains equipment entries:
    For 43:Duplicate Equipment Removal:
    When scanning for duplicates, then remove duplicate car ids while preserving first occurrence, skip error/warning/info message lines.
  • Context - cargo is successfully added to train:
    For 44:Activity Audit Logging:
    When logging cargo activity, then create audit log entry with cargo ccn, user id, date/time, action code 'zzz', and cargo added message.
  • Context - processing errors occur that require rollback:
    For 45:Database Rollback Processing:
    When performing rollback, then execute database rollback operation to undo all changes made during current transaction.
👨‍💻 Technical ACs (Gherkin)
Context: A train export request is received with a specific request type
GIVEN
A train export request is received with a specific request type
Applied to: 46:AEI Request Type Classification
WHEN
The request type equals the AEI request type constant
THEN
Set AEI train send flag to YES, otherwise set AEI train send flag to NO
Context: A user attempts to process a train request with their ACF2 user ID
GIVEN
A user attempts to process a train request with their ACF2 user ID
Applied to: 2:User Security Validation
WHEN
The user's SCAC access is invalid AND the request is not an AEI train send request
THEN
Generate error message 14 (access denied) and set user access flag to NO
Context: A user requests to send a train manifest
GIVEN
A user requests to send a train manifest
Applied to: 2:User Security Validation
WHEN
The user's UTF authorization is not 'U' or 'S' AND the request is not an AEI train send request
THEN
Generate error message 13 (insufficient authorization) and set user access flag to NO
Context: A user requests to send a train manifest that requires special manifest processing
GIVEN
A user requests to send a train manifest that requires special manifest processing
Applied to: 2:User Security Validation
WHEN
The user's special manifest authorization is not 'S' AND the request is not an AEI train send request
THEN
Set user not authorized for special manifest flag to TRUE
Context: A train request is being processed
GIVEN
A train request is being processed
Applied to: 3:Train Origin Validation
WHEN
The train origin field is blank or spaces
THEN
Generate error message 2 (missing train origin) and exit validation
Context: A train origin is provided
GIVEN
A train origin is provided
Applied to: 3:Train Origin Validation
WHEN
The origin is not found in station code table OR the US station code is blank
THEN
Generate error message 2 (invalid train origin)
Context: A train request includes an ETA date
GIVEN
A train request includes an ETA date
Applied to: 4:Estimated Time of Arrival Validation
WHEN
The ETA date equals '000000'
THEN
Generate error message 3 (invalid ETA date) and exit validation
Context: An ETA date and time are provided
GIVEN
An ETA date and time are provided
Applied to: 4:Estimated Time of Arrival Validation
WHEN
The date conversion fails OR ETA time is not numeric OR hour is not 00-23 OR minute is not 00-59
THEN
Generate error message 3 (invalid ETA format)
Context: A valid ETA date is provided and user authorization level is determined
GIVEN
A valid ETA date is provided and user authorization level is determined
Applied to: 4:Estimated Time of Arrival Validation
WHEN
For 'S' authorization: ETA is not within 30 days before to 5 days after current date, OR For other users: ETA is not within 2 days before to 2 days after current date
THEN
Generate error message 4 (for 'S' users) or message 21 (for other users)
Context: Train details including SCAC, train ID, origin, consist number, and creation date
GIVEN
Train details including SCAC, train ID, origin, consist number, and creation date
Applied to: 5:US Customs Train ID Generation
WHEN
A train record with the same US customs train ID already exists AND is not marked as deleted
THEN
Generate error message 6 (duplicate train ID)
Context: A train record with the same US customs train ID exists
GIVEN
A train record with the same US customs train ID exists
Applied to: 5:US Customs Train ID Generation
WHEN
The existing train record is marked as deleted
THEN
Delete the existing train record to allow creation of new record
Context: Train origin station is validated
GIVEN
Train origin station is validated
Applied to: 6:MERLIN Customs ID Validation
WHEN
The station's public MERLIN ID is blank OR the MERLIN ID is not found in MERLIN database
THEN
Generate error message 7 (missing MERLIN ID) or message 8 (MERLIN ID not found)
Context: A train request contains an equipment list
GIVEN
A train request contains an equipment list
Applied to: 47:Equipment Limit Validation
WHEN
The first equipment item is marked as 'no more equipment' OR the 500th equipment item is not marked as 'no more equipment'
THEN
Generate error message 5 (invalid equipment list size)
Context: Equipment is identified as a container
GIVEN
Equipment is identified as a container
Applied to: 8:Container Waybill Retrieval
WHEN
Container is found in container inquiry system
THEN
Retrieve waybill information using container inquiry data, otherwise use container database lookup
Context: Equipment is identified as a car with init and number
GIVEN
Equipment is identified as a car with init and number
Applied to: 9:Car Waybill Retrieval
WHEN
Car waybill lookup is performed
THEN
Retrieve latest waybill excluding temporary, corrector, and incomplete EDI waybills, and if car is loaded empty, treat as waybill not found
Context: A waybill is found for equipment
GIVEN
A waybill is found for equipment
Applied to: 10:Cargo Record Retrieval
WHEN
Cargo lookup is performed using waybill number and equipment ID
THEN
Retrieve first cargo record and set cargo found flag, otherwise set no cargo found flag
Context: Cargo is found for equipment and request action is SEND with no errors
GIVEN
Cargo is found for equipment and request action is SEND with no errors
Applied to: 11:Cargo Attachment to Train
WHEN
Cargo is immediate transport OR already created for IT OR US-Canada-US with release status OR default with release status OR empty equipment OR special manifest at Woburn PQ station OR export at non-Laredo stations
THEN
Skip cargo attachment to train
Context: Equipment information is available
GIVEN
Equipment information is available
Applied to: 12:Equipment Detail Line Building
WHEN
Building equipment detail line
THEN
Include equipment ID, load/empty indicator, equipment type, and format according to container or car type
Context: Equipment ID is provided
GIVEN
Equipment ID is provided
Applied to: 13:Equipment Type Validation
WHEN
Equipment type lookup fails
THEN
Generate error message 35 (for containers) or message 36 (for cars) and set equipment error flag
Context: Equipment type is 'SK' and waybill is found
GIVEN
Equipment type is 'SK' and waybill is found
Applied to: 13:Equipment Type Validation
WHEN
Double stack traffic type is determined
THEN
Add double stack count to appropriate traffic counter (CPRS, CSXT, NS, or HAUL)
Context: Cargo is found for equipment
GIVEN
Cargo is found for equipment
Applied to: 14:Cargo Information Processing
WHEN
Processing cargo information
THEN
Extract US CCN key, load/empty code, bond numbers, and set appropriate bond found flags based on cargo type
Context: Cargo with bond type information is processed
GIVEN
Cargo with bond type information is processed
Applied to: 15:Bond Type Classification
WHEN
Bond type is US-Canada-US and not created for IT and not special TR
THEN
Set TR bond found flag, and when bond type is transport export and not created for IT, set TE bond found flag
Context: Cargo is being processed
GIVEN
Cargo is being processed
Applied to: 16:Special Manifest Processing
WHEN
Cargo has special manifest origin flag
THEN
Set special manifest IT found flag, and when cargo is transport export with special manifest flag, set special manifest TE found flag
Context: Cargo is export type with US-Mexico country codes
GIVEN
Cargo is export type with US-Mexico country codes
Applied to: 16:Special Manifest Processing
WHEN
Cargo has special 88 flag
THEN
Set US-Mexico 88 found flag, and when cargo is US-Canada-US with special TR flag, set special TR found flag
Context: Cargo is found and being validated
GIVEN
Cargo is found and being validated
Applied to: 17:Cargo Status Validation
WHEN
Cargo status is pending, deleted, or error
THEN
Generate error message 16 (cargo status invalid)
Context: Cargo with specific bill type is processed
GIVEN
Cargo with specific bill type is processed
Applied to: 18:Bill Type Validation
WHEN
Bill type is '15'
THEN
Format as 'PPR 7512 15 US-CA-US', when bond type is IT or IE, format as 'AMS [bond_type] [bond_number]', when bond type is TE, TR, or MT, format as 'AMS 7512 [bond_type] [bond_number]'
Context: Equipment with cargo is being processed
GIVEN
Equipment with cargo is being processed
Applied to: 19:Equipment Load Status Validation
WHEN
Cargo is empty equipment or empty residue type
THEN
Set equipment as empty, update counters from loaded to empty, and format info as 'EMPTY'
Context: Cargo is processed at Laredo TX station
GIVEN
Cargo is processed at Laredo TX station
Applied to: 20:Mexico Customs Documentation Check
WHEN
FEN reference number is not found
THEN
Generate error message 46, when KCM reference number is not found, generate error message 47, when cargo has hold border status, generate message 48, when cargo has DSP hold flag, generate message 49, when both hold border and DSP hold exist, generate message 52
Context: Cargo and waybill conditions are evaluated
GIVEN
Cargo and waybill conditions are evaluated
Applied to: 21:Detour Processing Coordination
WHEN
Specific detour conditions are met for TE bond, TR bond, border clearance, US-US movement, or US-Mexico export
THEN
Invoke appropriate detour processing routine (B551, B552, B553, B554, or B555)
Context: Transport export cargo not created for IT with location mismatch
GIVEN
Transport export cargo not created for IT with location mismatch
Applied to: 22:TE Bond Port Change Processing
WHEN
Request action is REPORT
THEN
Generate message 19 with station code, when request action is SEND and user is authorized for special manifest, generate message 20 and spawn port change manifest, when user is not authorized, generate message 43
Context: Transit cargo not created for IT with release status
GIVEN
Transit cargo not created for IT with release status
Applied to: 23:TR Bond Diversion Processing
WHEN
Request action is REPORT
THEN
Generate message 18, when request action is SEND and user is authorized for special manifest, generate message 23 and spawn detour manifest, when user is not authorized, generate message 43
Context: Default cargo type not created for IT
GIVEN
Default cargo type not created for IT
Applied to: 24:Border Clearance Detour Processing
WHEN
Cargo has release status and request action is REPORT
THEN
Generate message 18, when request action is SEND and user is authorized for special manifest, generate message 23 and spawn detour manifest, when user is not authorized, generate message 43, when cargo does not have release status, generate message 31
Context: Waybill found with no cargo for US domestic movement
GIVEN
Waybill found with no cargo for US domestic movement
Applied to: 25:US-US Movement Detour Processing
WHEN
Request action is REPORT
THEN
Generate message 18, when request action is SEND and user is authorized for special manifest, generate message 23 and spawn US-US detour manifest, when user is not authorized, generate message 43
Context: Export cargo with US-Mexico country codes without special manifest
GIVEN
Export cargo with US-Mexico country codes without special manifest
Applied to: 26:US-Mexico Export Detour Processing
WHEN
Request action is REPORT
THEN
Generate message 50, when request action is SEND and user is authorized for special manifest, generate message 23 and spawn 88-TR detour manifest, when user is not authorized, generate message 43, when cargo is not export type, generate message 31
Context: Waybill contains routing information
GIVEN
Waybill contains routing information
Applied to: 27:Geographic Route Validation
WHEN
Route contains hazmat code 'HM'
THEN
Set routing indicator to 2, when route has CSXT or NS to CPRS via DET, set indicator to 3 (CSXT) or 4 (NS), otherwise set indicator to 1
Context: Equipment is identified as container or waybill indicates conveying car with loaded status
GIVEN
Equipment is identified as container or waybill indicates conveying car with loaded status
Applied to: 28:Container on Flat Car Processing
WHEN
Container is not found in primary database
THEN
Search container database, if still not found, search inquiry system for container cross-reference, generate error message 11 if no container found
Context: Train processing is complete
GIVEN
Train processing is complete
Applied to: 29:Report Header and Summary Building
WHEN
Building final report
THEN
Include train ID, origin station, user ID, processing date/time, action type (SEND/REPORT), result status, error/warning counts, equipment totals, and ETA information
Context: Train processing completed successfully with SEND action
GIVEN
Train processing completed successfully with SEND action
Applied to: 30:Train Database Record Creation
WHEN
Creating train database record
THEN
Store train header with ID, origin, destination, ETA, AEI flag, and up to maximum equipment items with their cargo details, generate error if equipment limit exceeded
Context: Train record is successfully created in database
GIVEN
Train record is successfully created in database
Applied to: 32:EDI Train List Transmission
WHEN
Transmitting to customs system
THEN
Call EDI transmission module with train list data, generate error if transmission fails
Context: AEI train processing is completed
GIVEN
AEI train processing is completed
Applied to: 37:AEI Activity Logging
WHEN
Logging AEI activity
THEN
Create log entry with train ID, user ID, date/time, action code 'ZZZ', and AEI send message
Context: Train processing is completed successfully
GIVEN
Train processing is completed successfully
Applied to: 33:Report Transmission to Customs
WHEN
Sending report to customs
THEN
Send email to OM01247 with train details, equipment list, and status information, handle large reports with continuation logic
Context: Report exceeds 699 lines
GIVEN
Report exceeds 699 lines
Applied to: 34:Large Report Email Pagination
WHEN
Sending large report
THEN
Send first portion, create continuation message with headers, and send remaining portions with continuation indicators
Context: Train processing is completed
GIVEN
Train processing is completed
Applied to: 35:Report Distribution to Originator
WHEN
Distributing results to originator
THEN
Send appropriate report type (error, sent, or report) to originator terminal or alternate terminal if specified
Context: Request is AEI train send type
GIVEN
Request is AEI train send type
Applied to: 38:AEI Report Processing
WHEN
Processing AEI report
THEN
Retrieve email addresses from AEI work table for train origin, send report to configured addresses, use default addresses if none configured, handle email failures by sending to support
Context: Train processing completed successfully for non-Laredo stations
GIVEN
Train processing completed successfully for non-Laredo stations
Applied to: 39:Canadian Export Report Generation
WHEN
Generating export report
THEN
Spawn GCX141 message for export report generation
Context: Train processing completed successfully at Laredo TX station
GIVEN
Train processing completed successfully at Laredo TX station
Applied to: 40:Enhanced Report Generation
WHEN
Generating enhanced report
THEN
Create detailed report with car/container counts, locomotive counts, port information, ETA details, and equipment details with BOL information
Context: Report data is prepared
GIVEN
Report data is prepared
Applied to: 41:PDF Report Generation
WHEN
Generating PDF reports
THEN
Call GCX904 module to create PDF reports for both pre-exit report (80 character width) and export train report (132 character width)
Context: Error or warning message is generated
GIVEN
Error or warning message is generated
Applied to: 42:Error Message Processing
WHEN
Processing message
THEN
Increment appropriate counter (error, warning, info), track special message types (DSP holds), and handle spawn message indicators
Context: Report contains equipment entries
GIVEN
Report contains equipment entries
Applied to: 43:Duplicate Equipment Removal
WHEN
Scanning for duplicates
THEN
Remove duplicate car IDs while preserving first occurrence, skip error/warning/info message lines
Context: Cargo is successfully added to train
GIVEN
Cargo is successfully added to train
Applied to: 44:Activity Audit Logging
WHEN
Logging cargo activity
THEN
Create audit log entry with cargo CCN, user ID, date/time, action code 'ZZZ', and cargo added message
Context: Processing errors occur that require rollback
GIVEN
Processing errors occur that require rollback
Applied to: 45:Database Rollback Processing
WHEN
Performing rollback
THEN
Execute database rollback operation to undo all changes made during current transaction
R-GCX003-cbl-00052 (+9) File: GCX003.cbl Request Processing Loop Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Request Processing Loop':
  • Context - the system is ready to process train export requests:
    For Read First Input Message:
    When the system starts processing, then the first input message is read and message availability status is set.
  • Context - the system has attempted to read an input message:
    For More Input Messages Available?:
    When the system checks the message availability status, then processing continues if messages are available, otherwise the processing loop terminates.
  • Context - a train export request message has been received:
    For Classify Request Type - AEI or Regular:
    When the system examines the request type field, then the request is classified as either aei type or regular type based on the request type value.
  • Context - the request type has been classified as aei or regular:
    For Set AEI Processing Flag:
    When the system sets processing flags, then aei train send flag is set to yes if request type equals aei request type, otherwise set to no.
  • Context - a train export request has been received and classified:
    For Prepare Request for Processing:
    When the system prepares the request for processing, then all request validations are performed including train security, origin validation, eta validation, us customer train id validation, equipment list validation, and customs id retrieval.
  • Context - request preparation including security validation has been completed:
    For User Has Access to Process Request?:
    When the system checks the user access status, then processing continues to equipment processing if user has access, otherwise skips to request termination.
  • Context - user has access to process the request and equipment list exists:
    For Process Equipment List for Train:
    When the system processes the equipment list, then each equipment item is processed through equipment validation, waybill retrieval, cargo processing, and report building until all equipment is processed or maximum limit of 499 items is reached.
  • Context - equipment processing has been completed or user access was denied:
    For Terminate Current Request Processing:
    When the system terminates the current request, then final report is generated, appropriate actions are taken based on request type (send, report, or error), and all necessary notifications are sent to originators and customs systems.
  • Context - current request processing has been terminated:
    For Read Next Input Message:
    When the system attempts to read the next message, then the next input message is read and message availability status is updated for the next loop iteration.
  • Context - no more input messages are available for processing:
    For End Request Processing Loop:
    When the system exits the processing loop, then the main processing routine is completed and control returns to the calling program.
👨‍💻 Technical ACs (Gherkin)
Context: The system is ready to process train export requests
GIVEN
The system is ready to process train export requests
Applied to: Read First Input Message
WHEN
The system starts processing
THEN
The first input message is read and message availability status is set
Context: The system has attempted to read an input message
GIVEN
The system has attempted to read an input message
Applied to: More Input Messages Available?
WHEN
The system checks the message availability status
THEN
Processing continues if messages are available, otherwise the processing loop terminates
Context: A train export request message has been received
GIVEN
A train export request message has been received
Applied to: Classify Request Type - AEI or Regular
WHEN
The system examines the request type field
THEN
The request is classified as either AEI type or regular type based on the request type value
Context: The request type has been classified as AEI or regular
GIVEN
The request type has been classified as AEI or regular
Applied to: Set AEI Processing Flag
WHEN
The system sets processing flags
THEN
AEI train send flag is set to YES if request type equals AEI request type, otherwise set to NO
Context: A train export request has been received and classified
GIVEN
A train export request has been received and classified
Applied to: Prepare Request for Processing
WHEN
The system prepares the request for processing
THEN
All request validations are performed including train security, origin validation, ETA validation, US customer train ID validation, equipment list validation, and customs ID retrieval
Context: Request preparation including security validation has been completed
GIVEN
Request preparation including security validation has been completed
Applied to: User Has Access to Process Request?
WHEN
The system checks the user access status
THEN
Processing continues to equipment processing if user has access, otherwise skips to request termination
Context: User has access to process the request and equipment list exists
GIVEN
User has access to process the request and equipment list exists
Applied to: Process Equipment List for Train
WHEN
The system processes the equipment list
THEN
Each equipment item is processed through equipment validation, waybill retrieval, cargo processing, and report building until all equipment is processed or maximum limit of 499 items is reached
Context: Equipment processing has been completed or user access was denied
GIVEN
Equipment processing has been completed or user access was denied
Applied to: Terminate Current Request Processing
WHEN
The system terminates the current request
THEN
Final report is generated, appropriate actions are taken based on request type (SEND, REPORT, or ERROR), and all necessary notifications are sent to originators and customs systems
Context: Current request processing has been terminated
GIVEN
Current request processing has been terminated
Applied to: Read Next Input Message
WHEN
The system attempts to read the next message
THEN
The next input message is read and message availability status is updated for the next loop iteration
Context: No more input messages are available for processing
GIVEN
No more input messages are available for processing
Applied to: End Request Processing Loop
WHEN
The system exits the processing loop
THEN
The main processing routine is completed and control returns to the calling program
R-GCX003-cbl-00062 (+3) File: GCX003.cbl User Security Validation Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'User Security Validation':
  • Context - a user with acf2 id attempts to access train processing functionality:
    For Check SCAC Access Permission:
    When the system checks scac access permission and the request is an aei train request, then access is granted even if scac access is invalid, but for non-aei requests with invalid scac access, user access is denied and error message 14 is generated.
  • Context - a valid acf2 user id is available:
    For Retrieve User Profile from Security Table:
    When the system queries the user security table, then if user profile is found, the profile data is loaded for further validation, otherwise processing continues with default permissions.
  • Context - a user profile exists and the request action is send:
    For Validate User Train Send Authority:
    When the system checks the user's train send authority flag, then if user has 'u' or 's' authorization or the request is an aei train send, access is granted, otherwise error message 13 is generated and access is denied.
  • Context - a user has valid send authority and the request is not an aei train send:
    For Check Special Manifest Authorization:
    When the system checks the user's special manifest authorization flag, then if user does not have 's' authorization for special manifests, the special manifest flag is set to indicate restricted access.
👨‍💻 Technical ACs (Gherkin)
Context: A user with ACF2 ID attempts to access train processing functionality
GIVEN
A user with ACF2 ID attempts to access train processing functionality
Applied to: Check SCAC Access Permission
WHEN
The system checks SCAC access permission and the request is an AEI train request
THEN
Access is granted even if SCAC access is invalid, but for non-AEI requests with invalid SCAC access, user access is denied and error message 14 is generated
Context: A valid ACF2 user ID is available
GIVEN
A valid ACF2 user ID is available
Applied to: Retrieve User Profile from Security Table
WHEN
The system queries the user security table
THEN
If user profile is found, the profile data is loaded for further validation, otherwise processing continues with default permissions
Context: A user profile exists and the request action is SEND
GIVEN
A user profile exists and the request action is SEND
Applied to: Validate User Train Send Authority
WHEN
The system checks the user's train send authority flag
THEN
If user has 'U' or 'S' authorization or the request is an AEI train send, access is granted, otherwise error message 13 is generated and access is denied
Context: A user has valid send authority and the request is not an AEI train send
GIVEN
A user has valid send authority and the request is not an AEI train send
Applied to: Check Special Manifest Authorization
WHEN
The system checks the user's special manifest authorization flag
THEN
If user does not have 'S' authorization for special manifests, the special manifest flag is set to indicate restricted access
R-GCX003-cbl-00066 (+4) File: GCX003.cbl Train Origin Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Origin Validation':
  • Context - a train manifest request is being processed:
    For Is Train Origin Empty?:
    When the train origin field is empty or contains only spaces, then the system should set error message 2 indicating origin is required and mark validation as failed.
  • Context - a train origin value has been provided:
    For Look Up Station in Reference Table:
    When the system needs to validate the origin station, then the system should query the gcstbrt station code reference table using the train origin as the search key.
  • Context - a train origin has been looked up in the station code reference table:
    For Station Found in Table?:
    When the station lookup operation completes, then if the station is not found in the reference table, the system should set error message 2 for invalid origin station.
  • Context - a valid station record has been found in the reference table:
    For Extract US Station Code:
    When the system processes the station data, then the system should extract the us station code from the station record and store it for crossing port determination.
  • Context - a us station code has been extracted from the station reference data:
    For US Station Code Valid?:
    When the system validates the us station code, then if the us station code is empty or contains only spaces, the system should set error message 2 for invalid origin station.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest request is being processed
GIVEN
A train manifest request is being processed
Applied to: Is Train Origin Empty?
WHEN
The train origin field is empty or contains only spaces
THEN
The system should set error message 2 indicating origin is required and mark validation as failed
Context: A train origin value has been provided
GIVEN
A train origin value has been provided
Applied to: Look Up Station in Reference Table
WHEN
The system needs to validate the origin station
THEN
The system should query the GCSTBRT station code reference table using the train origin as the search key
Context: A train origin has been looked up in the station code reference table
GIVEN
A train origin has been looked up in the station code reference table
Applied to: Station Found in Table?
WHEN
The station lookup operation completes
THEN
If the station is not found in the reference table, the system should set error message 2 for invalid origin station
Context: A valid station record has been found in the reference table
GIVEN
A valid station record has been found in the reference table
Applied to: Extract US Station Code
WHEN
The system processes the station data
THEN
The system should extract the US station code from the station record and store it for crossing port determination
Context: A US station code has been extracted from the station reference data
GIVEN
A US station code has been extracted from the station reference data
Applied to: US Station Code Valid?
WHEN
The system validates the US station code
THEN
If the US station code is empty or contains only spaces, the system should set error message 2 for invalid origin station
R-GCX003-cbl-00071 (+5) File: GCX003.cbl Estimated Time of Arrival Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Estimated Time of Arrival Validation':
  • Context - a train export request is being processed:
    For ETA Date = '000000'?:
    When the eta date field equals '000000', then set error message indicating eta date is required and exit validation.
  • Context - an eta date with 2-digit year is being processed:
    For Year > 80?:
    When the year portion is greater than 80, then set the century to '19' for years 81-99, otherwise set century to '20' for years 00-80.
  • Context - a valid eta date and time in local border crossing time zone:
    For Convert Local Time to Eastern Time:
    When time zone conversion is requested, then convert the local date and time to eastern standard time using the border crossing station's time zone.
  • Context - an eta date and time are provided:
    For Date/Time Format Valid?:
    When date conversion service validates the format or time is not numeric or hour is not between 00-23 or minute is not between 00-59, then set error message indicating invalid eta format.
  • Context - a user is processing an eta validation:
    For User Type = Supervisor?:
    When the user has supervisor authorization level ('s'), then set acceptable date range to 30 days before current date to 5 days after current date, otherwise set range to 2 days before current date to 2 days after current date.
  • Context - an eta date and calculated acceptable date range:
    For ETA Within Acceptable Range?:
    When the eta date is less than the low date or greater than the high date of the acceptable range, then set appropriate error message based on user type - message 4 for supervisor users or message 21 for regular users.
👨‍💻 Technical ACs (Gherkin)
Context: A train export request is being processed
GIVEN
A train export request is being processed
Applied to: ETA Date = '000000'?
WHEN
The ETA date field equals '000000'
THEN
Set error message indicating ETA date is required and exit validation
Context: An ETA date with 2-digit year is being processed
GIVEN
An ETA date with 2-digit year is being processed
Applied to: Year > 80?
WHEN
The year portion is greater than 80
THEN
Set the century to '19' for years 81-99, otherwise set century to '20' for years 00-80
Context: A valid ETA date and time in local border crossing time zone
GIVEN
A valid ETA date and time in local border crossing time zone
Applied to: Convert Local Time to Eastern Time
WHEN
Time zone conversion is requested
THEN
Convert the local date and time to Eastern Standard Time using the border crossing station's time zone
Context: An ETA date and time are provided
GIVEN
An ETA date and time are provided
Applied to: Date/Time Format Valid?
WHEN
Date conversion service validates the format OR time is not numeric OR hour is not between 00-23 OR minute is not between 00-59
THEN
Set error message indicating invalid ETA format
Context: A user is processing an ETA validation
GIVEN
A user is processing an ETA validation
Applied to: User Type = Supervisor?
WHEN
The user has supervisor authorization level ('S')
THEN
Set acceptable date range to 30 days before current date to 5 days after current date, otherwise set range to 2 days before current date to 2 days after current date
Context: An ETA date and calculated acceptable date range
GIVEN
An ETA date and calculated acceptable date range
Applied to: ETA Within Acceptable Range?
WHEN
The ETA date is less than the low date OR greater than the high date of the acceptable range
THEN
Set appropriate error message based on user type - message 4 for supervisor users or message 21 for regular users
R-GCX003-cbl-00077 (+16) File: GCX003.cbl US Customs Train ID Generation Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US Customs Train ID Generation':
  • Context - a train manifest processing request is being prepared:
    For Extract SCAC Code from Constants:
    When the system needs to generate a unique us customs train identifier, then the system extracts the canadian pacific scac code from constants and assigns it to the train scac field.
  • Context - a train manifest request contains train identification information:
    For Get Train ID from Request:
    When the system processes the request for us customs train id generation, then the system extracts the train id from the request and assigns it to the train identifier field.
  • Context - a train manifest request specifies an origin location:
    For Get Train Origin from Request:
    When the system builds the us customs train identifier, then the system extracts the train origin from the request and assigns it to the train origin field.
  • Context - a train manifest request includes a consist number:
    For Get Consist Number from Request:
    When the system generates the us customs train identifier, then the system extracts the consist number from the request and assigns it to the train consist number field.
  • Context - the system is processing a train manifest request:
    For Get Current Machine Date:
    When a unique train identifier needs to be generated, then the system captures the current machine date and century from the system.
  • Context - the system has captured the current machine date and century:
    For Convert Date to Julian Format:
    When the date needs to be formatted for train identifier generation, then the system converts the date to julian format using date conversion services and stores it as a 5-digit julian date.
  • Context - a train manifest is being processed for export purposes:
    For Build Train Export Indicator 'T':
    When the system builds the us customs train identifier, then the system sets the export indicator to 't' to designate this as an export train.
  • Context - all train identifier components have been extracted and formatted (scac code, train id, origin, consist number, julian date, export indicator):
    For Concatenate All Components into US Customs Train ID:
    When the system needs to create the final us customs train identifier, then the system concatenates all components into a single unique identifier and stores it as the us customer train id.
  • Context - a complete us customs train identifier has been generated:
    For Store Generated ID in Train Header:
    When the system needs to preserve the identifier for processing, then the system stores the generated train id in the train header record.
  • Context - a us customs train identifier has been generated:
    For Check if Train ID Already Exists in Database:
    When the system needs to ensure uniqueness of the train record, then the system queries the train database to check if a record with the same train identifier already exists.
  • Context - a train record with the same identifier exists in the database:
    For Read Existing Train Record:
    When the system needs to determine the status of the existing record, then the system reads the existing train record to examine its current status and deletion flag.
  • Context - an existing train record has been found with the same identifier:
    For Is Existing Record Marked for Deletion?:
    When the system needs to determine if the new record can proceed, then the system checks if the existing record has a deletion confirmation flag set to determine next action.
  • Context - an existing train record is found and is marked for deletion:
    For Delete Existing Train Record:
    When the system needs to create a new record with the same identifier, then the system deletes the existing train record from the database.
  • Context - an existing active train record is found with the same identifier:
    For Generate Error - Duplicate Train ID:
    When the system attempts to create a new train record, then the system generates error message 6 indicating a duplicate train identifier and prevents record creation.
  • Context - no active train record exists with the same identifier or existing record has been deleted:
    For Initialize New Train Header Record:
    When the system needs to create a new train record, then the system initializes a new train header record structure with default values.
  • Context - a new train header record has been initialized and a us customs train id has been generated:
    For Set Generated Train ID in Multiple Fields:
    When the system needs to populate the train record with identifier information, then the system assigns the generated train id to both the train header us customer train id field and the added train field.
  • Context - a new train record has been created with the generated us customs train identifier:
    For Mark Train ID as Added to System:
    When the system completes the train id generation process, then the system marks the train identifier as added to the system in the tracking records.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest processing request is being prepared
GIVEN
A train manifest processing request is being prepared
Applied to: Extract SCAC Code from Constants
WHEN
The system needs to generate a unique US Customs train identifier
THEN
The system extracts the Canadian Pacific SCAC code from constants and assigns it to the train SCAC field
Context: A train manifest request contains train identification information
GIVEN
A train manifest request contains train identification information
Applied to: Get Train ID from Request
WHEN
The system processes the request for US Customs train ID generation
THEN
The system extracts the train ID from the request and assigns it to the train identifier field
Context: A train manifest request specifies an origin location
GIVEN
A train manifest request specifies an origin location
Applied to: Get Train Origin from Request
WHEN
The system builds the US Customs train identifier
THEN
The system extracts the train origin from the request and assigns it to the train origin field
Context: A train manifest request includes a consist number
GIVEN
A train manifest request includes a consist number
Applied to: Get Consist Number from Request
WHEN
The system generates the US Customs train identifier
THEN
The system extracts the consist number from the request and assigns it to the train consist number field
Context: The system is processing a train manifest request
GIVEN
The system is processing a train manifest request
Applied to: Get Current Machine Date
WHEN
A unique train identifier needs to be generated
THEN
The system captures the current machine date and century from the system
Context: The system has captured the current machine date and century
GIVEN
The system has captured the current machine date and century
Applied to: Convert Date to Julian Format
WHEN
The date needs to be formatted for train identifier generation
THEN
The system converts the date to Julian format using date conversion services and stores it as a 5-digit Julian date
Context: A train manifest is being processed for export purposes
GIVEN
A train manifest is being processed for export purposes
Applied to: Build Train Export Indicator 'T'
WHEN
The system builds the US Customs train identifier
THEN
The system sets the export indicator to 'T' to designate this as an export train
Context: All train identifier components have been extracted and formatted (SCAC code, train ID, origin, consist number, Julian date, export indicator)
GIVEN
All train identifier components have been extracted and formatted (SCAC code, train ID, origin, consist number, Julian date, export indicator)
Applied to: Concatenate All Components into US Customs Train ID
WHEN
The system needs to create the final US Customs train identifier
THEN
The system concatenates all components into a single unique identifier and stores it as the US Customer Train ID
Context: A complete US Customs train identifier has been generated
GIVEN
A complete US Customs train identifier has been generated
Applied to: Store Generated ID in Train Header
WHEN
The system needs to preserve the identifier for processing
THEN
The system stores the generated train ID in the train header record
Context: A US Customs train identifier has been generated
GIVEN
A US Customs train identifier has been generated
Applied to: Check if Train ID Already Exists in Database
WHEN
The system needs to ensure uniqueness of the train record
THEN
The system queries the train database to check if a record with the same train identifier already exists
Context: A train record with the same identifier exists in the database
GIVEN
A train record with the same identifier exists in the database
Applied to: Read Existing Train Record
WHEN
The system needs to determine the status of the existing record
THEN
The system reads the existing train record to examine its current status and deletion flag
Context: An existing train record has been found with the same identifier
GIVEN
An existing train record has been found with the same identifier
Applied to: Is Existing Record Marked for Deletion?
WHEN
The system needs to determine if the new record can proceed
THEN
The system checks if the existing record has a deletion confirmation flag set to determine next action
Context: An existing train record is found and is marked for deletion
GIVEN
An existing train record is found and is marked for deletion
Applied to: Delete Existing Train Record
WHEN
The system needs to create a new record with the same identifier
THEN
The system deletes the existing train record from the database
Context: An existing active train record is found with the same identifier
GIVEN
An existing active train record is found with the same identifier
Applied to: Generate Error - Duplicate Train ID
WHEN
The system attempts to create a new train record
THEN
The system generates error message 6 indicating a duplicate train identifier and prevents record creation
Context: No active train record exists with the same identifier or existing record has been deleted
GIVEN
No active train record exists with the same identifier or existing record has been deleted
Applied to: Initialize New Train Header Record
WHEN
The system needs to create a new train record
THEN
The system initializes a new train header record structure with default values
Context: A new train header record has been initialized and a US Customs train ID has been generated
GIVEN
A new train header record has been initialized and a US Customs train ID has been generated
Applied to: Set Generated Train ID in Multiple Fields
WHEN
The system needs to populate the train record with identifier information
THEN
The system assigns the generated train ID to both the train header US Customer Train ID field and the added train field
Context: A new train record has been created with the generated US Customs train identifier
GIVEN
A new train record has been created with the generated US Customs train identifier
Applied to: Mark Train ID as Added to System
WHEN
The system completes the train ID generation process
THEN
The system marks the train identifier as added to the system in the tracking records
R-GCX003-cbl-00094 (+5) File: GCX003.cbl MERLIN Customs ID Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MERLIN Customs ID Validation':
  • Context - a request requires merlin customs id validation:
    For Retrieve Administration Table for MERLIN Configuration:
    When the system attempts to retrieve administration table with ad key configuration, then the administration table segment is retrieved for merlin id extraction.
  • Context - administration table retrieval has been attempted:
    For Administration Table Found?:
    When the system checks if the administration table was successfully retrieved, then if table not found, generate error message 7 indicating merlin configuration unavailable, otherwise proceed to extract merlin id.
  • Context - administration table has been successfully retrieved:
    For Extract Public MERLIN ID from Configuration:
    When the system extracts the public merlin id from the administration segment, then the public merlin id value is obtained from the configuration for validation.
  • Context - public merlin id has been extracted from administration table:
    For MERLIN ID Present?:
    When the system checks if the merlin id field contains spaces or is empty, then if merlin id is spaces, generate error message 7 indicating missing merlin configuration, otherwise proceed to database validation.
  • Context - a valid merlin id has been extracted from administration configuration:
    For Validate MERLIN ID in MERLIN Database:
    When the system queries the merlin database using the extracted merlin id, then the merlin database is accessed to verify id validity and availability.
  • Context - merlin database validation has been performed:
    For MERLIN ID Valid in Database?:
    When the system evaluates the database query results for merlin id existence, then if merlin id not found in database, generate error message 8 indicating invalid merlin id, otherwise validation is successful.
👨‍💻 Technical ACs (Gherkin)
Context: A request requires MERLIN customs ID validation
GIVEN
A request requires MERLIN customs ID validation
Applied to: Retrieve Administration Table for MERLIN Configuration
WHEN
The system attempts to retrieve administration table with AD key configuration
THEN
The administration table segment is retrieved for MERLIN ID extraction
Context: Administration table retrieval has been attempted
GIVEN
Administration table retrieval has been attempted
Applied to: Administration Table Found?
WHEN
The system checks if the administration table was successfully retrieved
THEN
If table not found, generate error message 7 indicating MERLIN configuration unavailable, otherwise proceed to extract MERLIN ID
Context: Administration table has been successfully retrieved
GIVEN
Administration table has been successfully retrieved
Applied to: Extract Public MERLIN ID from Configuration
WHEN
The system extracts the public MERLIN ID from the administration segment
THEN
The public MERLIN ID value is obtained from the configuration for validation
Context: Public MERLIN ID has been extracted from administration table
GIVEN
Public MERLIN ID has been extracted from administration table
Applied to: MERLIN ID Present?
WHEN
The system checks if the MERLIN ID field contains spaces or is empty
THEN
If MERLIN ID is spaces, generate error message 7 indicating missing MERLIN configuration, otherwise proceed to database validation
Context: A valid MERLIN ID has been extracted from administration configuration
GIVEN
A valid MERLIN ID has been extracted from administration configuration
Applied to: Validate MERLIN ID in MERLIN Database
WHEN
The system queries the MERLIN database using the extracted MERLIN ID
THEN
The MERLIN database is accessed to verify ID validity and availability
Context: MERLIN database validation has been performed
GIVEN
MERLIN database validation has been performed
Applied to: MERLIN ID Valid in Database?
WHEN
The system evaluates the database query results for MERLIN ID existence
THEN
If MERLIN ID not found in database, generate error message 8 indicating invalid MERLIN ID, otherwise validation is successful
R-GCX003-cbl-00109 (+10) File: GCX003.cbl Container Waybill Retrieval Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Waybill Retrieval':
  • Context - a container processing request is being handled:
    For Container Found in Inquiry System?:
    When the system checks for container existence in inquiry system, then if container is found in inquiry system, proceed to retrieve from inquiry database, otherwise check primary system.
  • Context - container is confirmed to exist in inquiry system:
    For Retrieve Container from Inquiry Database:
    When system attempts to retrieve container from inquiry database, then container information is fetched from fwiqroot and fwiqbotl databases using container cross-reference.
  • Context - container was not found in inquiry system:
    For Container Found in Primary System?:
    When system checks primary waybill system for container, then if container exists in primary system, proceed to retrieve container information, otherwise mark as not found.
  • Context - container exists in either inquiry or primary system:
    For Retrieve Container Information Using Container ID:
    When system retrieves container information using container id, then container details are fetched from shiproot database and waybill information is populated.
  • Context - container information retrieval has been attempted:
    For Waybill Data Retrieved Successfully?:
    When system validates the retrieval operation result, then if waybill data is successfully retrieved, proceed to extract container details, otherwise mark waybill as not found.
  • Context - waybill data has been successfully retrieved:
    For Extract Container Details from Waybill:
    When system extracts container details from waybill, then container id, load/empty status, and other relevant details are extracted and populated.
  • Context - container details have been extracted from waybill:
    For Validate Container Load/Empty Status:
    When system validates container load/empty status, then container status is verified against waybill information for consistency.
  • Context - container load/empty status has been validated:
    For Container is Loaded but Waybill Shows Empty?:
    When container is expected to be loaded but waybill indicates empty status, then if mismatch exists, mark waybill as not found, otherwise proceed with successful retrieval.
  • Context - container load status mismatch has been detected:
    For Mark Waybill as Not Found:
    When system processes the status mismatch, then waybill is marked as not found and container processing continues with not found status.
  • Context - container information has been processed without status mismatch:
    For Container Waybill Retrieved Successfully:
    When system completes container waybill retrieval, then container waybill is marked as successfully retrieved and available for further processing.
  • Context - container waybill retrieval has failed from all available systems:
    For Container Waybill Not Found:
    When system processes the not found condition, then container is marked as having no waybill found and appropriate error handling is initiated.
👨‍💻 Technical ACs (Gherkin)
Context: A container processing request is being handled
GIVEN
A container processing request is being handled
Applied to: Container Found in Inquiry System?
WHEN
The system checks for container existence in inquiry system
THEN
If container is found in inquiry system, proceed to retrieve from inquiry database, otherwise check primary system
Context: Container is confirmed to exist in inquiry system
GIVEN
Container is confirmed to exist in inquiry system
Applied to: Retrieve Container from Inquiry Database
WHEN
System attempts to retrieve container from inquiry database
THEN
Container information is fetched from FWIQROOT and FWIQBOTL databases using container cross-reference
Context: Container was not found in inquiry system
GIVEN
Container was not found in inquiry system
Applied to: Container Found in Primary System?
WHEN
System checks primary waybill system for container
THEN
If container exists in primary system, proceed to retrieve container information, otherwise mark as not found
Context: Container exists in either inquiry or primary system
GIVEN
Container exists in either inquiry or primary system
Applied to: Retrieve Container Information Using Container ID
WHEN
System retrieves container information using container ID
THEN
Container details are fetched from SHIPROOT database and waybill information is populated
Context: Container information retrieval has been attempted
GIVEN
Container information retrieval has been attempted
Applied to: Waybill Data Retrieved Successfully?
WHEN
System validates the retrieval operation result
THEN
If waybill data is successfully retrieved, proceed to extract container details, otherwise mark waybill as not found
Context: Waybill data has been successfully retrieved
GIVEN
Waybill data has been successfully retrieved
Applied to: Extract Container Details from Waybill
WHEN
System extracts container details from waybill
THEN
Container ID, load/empty status, and other relevant details are extracted and populated
Context: Container details have been extracted from waybill
GIVEN
Container details have been extracted from waybill
Applied to: Validate Container Load/Empty Status
WHEN
System validates container load/empty status
THEN
Container status is verified against waybill information for consistency
Context: Container load/empty status has been validated
GIVEN
Container load/empty status has been validated
Applied to: Container is Loaded but Waybill Shows Empty?
WHEN
Container is expected to be loaded but waybill indicates empty status
THEN
If mismatch exists, mark waybill as not found, otherwise proceed with successful retrieval
Context: Container load status mismatch has been detected
GIVEN
Container load status mismatch has been detected
Applied to: Mark Waybill as Not Found
WHEN
System processes the status mismatch
THEN
Waybill is marked as not found and container processing continues with not found status
Context: Container information has been processed without status mismatch
GIVEN
Container information has been processed without status mismatch
Applied to: Container Waybill Retrieved Successfully
WHEN
System completes container waybill retrieval
THEN
Container waybill is marked as successfully retrieved and available for further processing
Context: Container waybill retrieval has failed from all available systems
GIVEN
Container waybill retrieval has failed from all available systems
Applied to: Container Waybill Not Found
WHEN
System processes the not found condition
THEN
Container is marked as having no waybill found and appropriate error handling is initiated
R-GCX003-cbl-00120 (+10) File: GCX003.cbl Car Waybill Retrieval Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car Waybill Retrieval':
  • Context - a car waybill retrieval request is initiated:
    For First Call or Different Equipment ID?:
    When the system checks if this is the first fwcarget call or the current equipment id is different from the previously held equipment id, then if either condition is true, proceed with full waybill retrieval process, otherwise skip to exit.
  • Context - waybill retrieval parameters need to be initialized:
    For Set Search Criteria - All Types Except 98-99:
    When setting up the car search criteria, then configure to search all car types except types 98 and 99, include all status types, exclude edi incomplete records, include temporary waybills, exclude corrector waybills, return lead waybill, and use latest waybill date.
  • Context - a waybill has been successfully retrieved:
    For Has Haulage Right Carrier?:
    When the system checks if the haulage right carrier field contains data, then if haulage right carrier is spaces, mark as done and proceed to result processing, otherwise continue with edi completion check.
    For Empty Status but Loaded Request?:
    When the waybill shows empty status ('e') and the equipment request indicates loaded status, then set waybill status to not found to trigger fallback processing.
  • Context - a waybill with haulage right carrier has been retrieved:
    For EDI Complete Release?:
    When the system checks the edi completion 418 release flag, then if edi completion 418 release equals 'y', mark as done and proceed to result processing, otherwise check for duplicate waybill key.
  • Context - a waybill without edi completion release has been found:
    For Same Waybill Key as Previous?:
    When the system compares the current fwbx key feedback with the stored previous fwbx key feedback, then if the keys match, set waybill not found status and mark as done, otherwise update the stored key and set previous status waybill date for next iteration.
  • Context - primary waybill retrieval has failed or returned not found status:
    For Try Inquiry System Fallback:
    When the system initiates fallback processing using the inquiry system, then retrieve car information from container inquiry root, set inquiry parameters using road number, station number, and waybill number, and attempt to get waybill data from inquiry system.
  • Context - waybill data has been successfully retrieved from inquiry system:
    For Set Load/Empty Status:
    When the system processes the belonging code from the inquiry root, then if belonging code equals 'ze', set equipment status to 'e' (empty), otherwise set status to 'l' (loaded).
  • Context - inquiry system has returned successful waybill data:
    For Get Additional Routing Info:
    When the system processes routing information from fwiqinfo segment, then parse routing fields to extract up to 4 scac codes and their corresponding junction r260 codes, handling space-separated field format and storing in routing group structure.
  • Context - car search parameters have been properly configured:
    For Call FWCARGET to Retrieve Waybill:
    When the system needs to retrieve waybill data for a specific equipment id, then call fwcarget external program with configured parameters and equipment id to retrieve waybill information.
  • Context - primary waybill retrieval has failed and inquiry parameters are set:
    For Call FWIQIO to Get Waybill from Inquiry:
    When the system attempts fallback waybill retrieval from inquiry system, then call fwiqio external program with inquiry parameters to retrieve waybill data from inquiry database.
👨‍💻 Technical ACs (Gherkin)
Context: A car waybill retrieval request is initiated
GIVEN
A car waybill retrieval request is initiated
Applied to: First Call or Different Equipment ID?
WHEN
The system checks if this is the first FWCARGET call OR the current equipment ID is different from the previously held equipment ID
THEN
If either condition is true, proceed with full waybill retrieval process, otherwise skip to exit
Context: Waybill retrieval parameters need to be initialized
GIVEN
Waybill retrieval parameters need to be initialized
Applied to: Set Search Criteria - All Types Except 98-99
WHEN
Setting up the car search criteria
THEN
Configure to search all car types except types 98 and 99, include all status types, exclude EDI incomplete records, include temporary waybills, exclude corrector waybills, return lead waybill, and use latest waybill date
Context: A waybill has been successfully retrieved
GIVEN
A waybill has been successfully retrieved
Applied to: Has Haulage Right Carrier?
WHEN
The system checks if the haulage right carrier field contains data
THEN
If haulage right carrier is spaces, mark as done and proceed to result processing, otherwise continue with EDI completion check
Applied to: Empty Status but Loaded Request?
WHEN
The waybill shows empty status ('E') AND the equipment request indicates loaded status
THEN
Set waybill status to not found to trigger fallback processing
Context: A waybill with haulage right carrier has been retrieved
GIVEN
A waybill with haulage right carrier has been retrieved
Applied to: EDI Complete Release?
WHEN
The system checks the EDI completion 418 release flag
THEN
If EDI completion 418 release equals 'Y', mark as done and proceed to result processing, otherwise check for duplicate waybill key
Context: A waybill without EDI completion release has been found
GIVEN
A waybill without EDI completion release has been found
Applied to: Same Waybill Key as Previous?
WHEN
The system compares the current FWBX key feedback with the stored previous FWBX key feedback
THEN
If the keys match, set waybill not found status and mark as done, otherwise update the stored key and set previous status waybill date for next iteration
Context: Primary waybill retrieval has failed or returned not found status
GIVEN
Primary waybill retrieval has failed or returned not found status
Applied to: Try Inquiry System Fallback
WHEN
The system initiates fallback processing using the inquiry system
THEN
Retrieve car information from container inquiry root, set inquiry parameters using road number, station number, and waybill number, and attempt to get waybill data from inquiry system
Context: Waybill data has been successfully retrieved from inquiry system
GIVEN
Waybill data has been successfully retrieved from inquiry system
Applied to: Set Load/Empty Status
WHEN
The system processes the belonging code from the inquiry root
THEN
If belonging code equals 'ZE', set equipment status to 'E' (empty), otherwise set status to 'L' (loaded)
Context: Inquiry system has returned successful waybill data
GIVEN
Inquiry system has returned successful waybill data
Applied to: Get Additional Routing Info
WHEN
The system processes routing information from FWIQINFO segment
THEN
Parse routing fields to extract up to 4 SCAC codes and their corresponding junction R260 codes, handling space-separated field format and storing in routing group structure
Context: Car search parameters have been properly configured
GIVEN
Car search parameters have been properly configured
Applied to: Call FWCARGET to Retrieve Waybill
WHEN
The system needs to retrieve waybill data for a specific equipment ID
THEN
Call FWCARGET external program with configured parameters and equipment ID to retrieve waybill information
Context: Primary waybill retrieval has failed and inquiry parameters are set
GIVEN
Primary waybill retrieval has failed and inquiry parameters are set
Applied to: Call FWIQIO to Get Waybill from Inquiry
WHEN
The system attempts fallback waybill retrieval from inquiry system
THEN
Call FWIQIO external program with inquiry parameters to retrieve waybill data from inquiry database
R-GCX003-cbl-00131 (+16) File: GCX003.cbl Cargo Record Retrieval Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Record Retrieval':
  • Context - equipment processing is starting for a specific equipment piece:
    For Initialize Cargo Search Parameters:
    When the system initializes cargo search parameters, then all cargo record structures are cleared and ready for new cargo data retrieval.
  • Context - equipment has been processed and waybill information is available:
    For Set Waybill Root Key from Equipment:
    When the system sets up cargo search parameters, then waybill root key and waybill date are extracted from equipment record for cargo search.
  • Context - equipment id is available from current equipment processing:
    For Set Equipment ID for Search:
    When the system prepares cargo search criteria, then equipment id is assigned to the cargo search index for precise cargo matching.
  • Context - waybill root key, waybill date, and equipment id are available:
    For Build Cargo Database Index Key:
    When the system builds the cargo database index key, then complete index key is constructed combining waybill root-date and equipment id for cargo record retrieval.
  • Context - cargo database index key is properly constructed:
    For Execute First Cargo Record Query:
    When the system executes the first cargo record query, then database query is performed using the cargo index key and cargo record status is returned.
  • Context - cargo record query has been executed:
    For Cargo Record Found?:
    When the system evaluates the query results, then cargo found status is determined based on database query return status.
  • Context - a cargo record has been retrieved from the database:
    For Validate Cargo Belongs to Equipment:
    When the system validates cargo ownership, then equipment id and waybill root-date from cargo record are compared against current equipment values.
  • Context - cargo record contains equipment id and waybill information:
    For Equipment ID and Waybill Match?:
    When the system compares cargo record data with current equipment data, then match is confirmed when equipment id equals cargo equipment id and waybill root-date equals cargo waybill root-date.
  • Context - cargo record has been retrieved and validated as belonging to current equipment:
    For Set Cargo Found Status:
    When the system sets cargo processing status, then cargo found indicator is set to true and cargo data is available for processing.
  • Context - cargo record query returned no results or retrieved cargo does not match current equipment:
    For Set No Cargo Found Status:
    When the system sets cargo processing status, then no cargo found indicator is set to true indicating no valid cargo exists for this equipment.
  • Context - initial cargo record has been processed and more cargo records may exist:
    For Get Next Cargo Record:
    When the system attempts to retrieve next cargo record, then database query is executed to get the next cargo record using the same search criteria.
  • Context - next cargo record query has been executed:
    For More Cargo Records?:
    When the system evaluates query results for additional records, then more cargo records status is determined based on successful retrieval of next cargo record.
  • Context - additional cargo record has been retrieved from database:
    For Validate Next Cargo Record:
    When the system validates the next cargo record, then equipment id and waybill information from next cargo record are validated against current equipment.
  • Context - next cargo record contains equipment and waybill identification:
    For Next Record Matches Equipment?:
    When the system compares next record with current equipment, then match is confirmed when next record equipment id equals current equipment id and next record waybill root-date equals current waybill root-date.
  • Context - next cargo record matches current equipment and waybill:
    For Continue to Next Record:
    When the system processes the matching cargo record, then cargo record is processed and system continues to search for additional cargo records.
  • Context - no more cargo records are available or next cargo record does not match current equipment:
    For Set No More Cargo Status:
    When the system completes cargo record processing, then no more cargo indicator is set to true indicating all cargo records for this equipment have been processed.
  • Context - cargo record retrieval and validation process is complete:
    For Return Cargo Record Data:
    When the system returns cargo data to equipment processing, then cargo record data and cargo found status are made available for subsequent equipment processing steps.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment processing is starting for a specific equipment piece
GIVEN
Equipment processing is starting for a specific equipment piece
Applied to: Initialize Cargo Search Parameters
WHEN
The system initializes cargo search parameters
THEN
All cargo record structures are cleared and ready for new cargo data retrieval
Context: Equipment has been processed and waybill information is available
GIVEN
Equipment has been processed and waybill information is available
Applied to: Set Waybill Root Key from Equipment
WHEN
The system sets up cargo search parameters
THEN
Waybill root key and waybill date are extracted from equipment record for cargo search
Context: Equipment ID is available from current equipment processing
GIVEN
Equipment ID is available from current equipment processing
Applied to: Set Equipment ID for Search
WHEN
The system prepares cargo search criteria
THEN
Equipment ID is assigned to the cargo search index for precise cargo matching
Context: Waybill root key, waybill date, and equipment ID are available
GIVEN
Waybill root key, waybill date, and equipment ID are available
Applied to: Build Cargo Database Index Key
WHEN
The system builds the cargo database index key
THEN
Complete index key is constructed combining waybill root-date and equipment ID for cargo record retrieval
Context: Cargo database index key is properly constructed
GIVEN
Cargo database index key is properly constructed
Applied to: Execute First Cargo Record Query
WHEN
The system executes the first cargo record query
THEN
Database query is performed using the cargo index key and cargo record status is returned
Context: Cargo record query has been executed
GIVEN
Cargo record query has been executed
Applied to: Cargo Record Found?
WHEN
The system evaluates the query results
THEN
Cargo found status is determined based on database query return status
Context: A cargo record has been retrieved from the database
GIVEN
A cargo record has been retrieved from the database
Applied to: Validate Cargo Belongs to Equipment
WHEN
The system validates cargo ownership
THEN
Equipment ID and waybill root-date from cargo record are compared against current equipment values
Context: Cargo record contains equipment ID and waybill information
GIVEN
Cargo record contains equipment ID and waybill information
Applied to: Equipment ID and Waybill Match?
WHEN
The system compares cargo record data with current equipment data
THEN
Match is confirmed when equipment ID equals cargo equipment ID AND waybill root-date equals cargo waybill root-date
Context: Cargo record has been retrieved and validated as belonging to current equipment
GIVEN
Cargo record has been retrieved and validated as belonging to current equipment
Applied to: Set Cargo Found Status
WHEN
The system sets cargo processing status
THEN
Cargo found indicator is set to true and cargo data is available for processing
Context: Cargo record query returned no results OR retrieved cargo does not match current equipment
GIVEN
Cargo record query returned no results OR retrieved cargo does not match current equipment
Applied to: Set No Cargo Found Status
WHEN
The system sets cargo processing status
THEN
No cargo found indicator is set to true indicating no valid cargo exists for this equipment
Context: Initial cargo record has been processed and more cargo records may exist
GIVEN
Initial cargo record has been processed and more cargo records may exist
Applied to: Get Next Cargo Record
WHEN
The system attempts to retrieve next cargo record
THEN
Database query is executed to get the next cargo record using the same search criteria
Context: Next cargo record query has been executed
GIVEN
Next cargo record query has been executed
Applied to: More Cargo Records?
WHEN
The system evaluates query results for additional records
THEN
More cargo records status is determined based on successful retrieval of next cargo record
Context: Additional cargo record has been retrieved from database
GIVEN
Additional cargo record has been retrieved from database
Applied to: Validate Next Cargo Record
WHEN
The system validates the next cargo record
THEN
Equipment ID and waybill information from next cargo record are validated against current equipment
Context: Next cargo record contains equipment and waybill identification
GIVEN
Next cargo record contains equipment and waybill identification
Applied to: Next Record Matches Equipment?
WHEN
The system compares next record with current equipment
THEN
Match is confirmed when next record equipment ID equals current equipment ID AND next record waybill root-date equals current waybill root-date
Context: Next cargo record matches current equipment and waybill
GIVEN
Next cargo record matches current equipment and waybill
Applied to: Continue to Next Record
WHEN
The system processes the matching cargo record
THEN
Cargo record is processed and system continues to search for additional cargo records
Context: No more cargo records are available OR next cargo record does not match current equipment
GIVEN
No more cargo records are available OR next cargo record does not match current equipment
Applied to: Set No More Cargo Status
WHEN
The system completes cargo record processing
THEN
No more cargo indicator is set to true indicating all cargo records for this equipment have been processed
Context: Cargo record retrieval and validation process is complete
GIVEN
Cargo record retrieval and validation process is complete
Applied to: Return Cargo Record Data
WHEN
The system returns cargo data to equipment processing
THEN
Cargo record data and cargo found status are made available for subsequent equipment processing steps
R-GCX003-cbl-00148 (+12) File: GCX003.cbl Cargo Attachment to Train Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Attachment to Train':
  • Context - a cargo attachment process is initiated:
    For Is Request Action SEND?:
    When the request action is not send, then skip the cargo attachment process and exit.
  • Context - a send request is being processed for cargo attachment:
    For Are There Processing Errors?:
    When there are processing errors present, then skip the cargo attachment process and exit.
  • Context - a send request with no processing errors is being processed:
    For Is Spawn Required?:
    When spawn processing is required, then skip the cargo attachment process and exit.
  • Context - a send request with no errors or spawn requirements is being processed:
    For Is Cargo Empty Residue?:
    When the cargo is classified as empty residue, then skip the cargo attachment process and exit.
  • Context - a cargo record is being evaluated for attachment to train manifest:
    For IT Bond - Immediate Transport?:
    When the cargo has immediate transport bond type (it bond), then skip cargo attachment and add to special processing queue.
  • Context - a cargo record without immediate transport bond is being evaluated:
    For TR Created for IT Bond?:
    When the cargo has tr bond already created for it processing, then skip cargo attachment and add to special processing queue.
  • Context - a cargo record without it bond or existing tr bond is being evaluated:
    For US-Canada-US Movement with Release Status?:
    When the cargo is us-canada-us movement type and tr bond is not created for it and cargo has release status, then skip cargo attachment and add to special processing queue.
  • Context - a cargo record that doesn't meet previous exclusion criteria is being evaluated:
    For Default Bond with Release Status?:
    When the cargo has default bond type and tr bond is not created for it and cargo has release status, then skip cargo attachment and add to special processing queue.
    For Empty Equipment Bond?:
    When the cargo is classified as empty equipment bond, then skip cargo attachment and add to special processing queue.
    For Special Manifest Original at Woburn-PQ?:
    When the cargo has special manifest original designation and the crossing port is woburn-pq station, then skip cargo attachment and add to special processing queue.
    For Special Manifest Special 'Not Woburn-PQ'?:
    When the cargo has special manifest special designation and the crossing port is not woburn-pq station, then skip cargo attachment and add to special processing queue.
    For Export Bond US-Mexico 'Not Laredo'?:
    When the cargo has export bond type and origin-destination country codes are us-mexico and the crossing port is not laredo-tx station, then skip cargo attachment and add to special processing queue.
  • Context - a cargo record has been evaluated against all exclusion criteria:
    For Attach Cargo to Train for Customs Report:
    When the cargo does not meet any of the exclusion criteria, then attach the cargo to the train manifest for customs reporting.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo attachment process is initiated
GIVEN
A cargo attachment process is initiated
Applied to: Is Request Action SEND?
WHEN
The request action is not SEND
THEN
Skip the cargo attachment process and exit
Context: A SEND request is being processed for cargo attachment
GIVEN
A SEND request is being processed for cargo attachment
Applied to: Are There Processing Errors?
WHEN
There are processing errors present
THEN
Skip the cargo attachment process and exit
Context: A SEND request with no processing errors is being processed
GIVEN
A SEND request with no processing errors is being processed
Applied to: Is Spawn Required?
WHEN
Spawn processing is required
THEN
Skip the cargo attachment process and exit
Context: A SEND request with no errors or spawn requirements is being processed
GIVEN
A SEND request with no errors or spawn requirements is being processed
Applied to: Is Cargo Empty Residue?
WHEN
The cargo is classified as empty residue
THEN
Skip the cargo attachment process and exit
Context: A cargo record is being evaluated for attachment to train manifest
GIVEN
A cargo record is being evaluated for attachment to train manifest
Applied to: IT Bond - Immediate Transport?
WHEN
The cargo has immediate transport bond type (IT bond)
THEN
Skip cargo attachment and add to special processing queue
Context: A cargo record without immediate transport bond is being evaluated
GIVEN
A cargo record without immediate transport bond is being evaluated
Applied to: TR Created for IT Bond?
WHEN
The cargo has TR bond already created for IT processing
THEN
Skip cargo attachment and add to special processing queue
Context: A cargo record without IT bond or existing TR bond is being evaluated
GIVEN
A cargo record without IT bond or existing TR bond is being evaluated
Applied to: US-Canada-US Movement with Release Status?
WHEN
The cargo is US-Canada-US movement type AND TR bond is not created for IT AND cargo has release status
THEN
Skip cargo attachment and add to special processing queue
Context: A cargo record that doesn't meet previous exclusion criteria is being evaluated
GIVEN
A cargo record that doesn't meet previous exclusion criteria is being evaluated
Applied to: Default Bond with Release Status?
WHEN
The cargo has default bond type AND TR bond is not created for IT AND cargo has release status
THEN
Skip cargo attachment and add to special processing queue
Applied to: Empty Equipment Bond?
WHEN
The cargo is classified as empty equipment bond
THEN
Skip cargo attachment and add to special processing queue
Applied to: Special Manifest Original at Woburn-PQ?
WHEN
The cargo has special manifest original designation AND the crossing port is Woburn-PQ station
THEN
Skip cargo attachment and add to special processing queue
Applied to: Special Manifest Special 'Not Woburn-PQ'?
WHEN
The cargo has special manifest special designation AND the crossing port is NOT Woburn-PQ station
THEN
Skip cargo attachment and add to special processing queue
Applied to: Export Bond US-Mexico 'Not Laredo'?
WHEN
The cargo has export bond type AND origin-destination country codes are US-Mexico AND the crossing port is NOT Laredo-TX station
THEN
Skip cargo attachment and add to special processing queue
Context: A cargo record has been evaluated against all exclusion criteria
GIVEN
A cargo record has been evaluated against all exclusion criteria
Applied to: Attach Cargo to Train for Customs Report
WHEN
The cargo does not meet any of the exclusion criteria
THEN
Attach the cargo to the train manifest for customs reporting
R-GCX003-cbl-00161 (+24) File: GCX003.cbl Equipment Detail Line Building Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Detail Line Building':
  • Context - a new equipment item needs to be processed for reporting:
    For Initialize Report Line:
    When the system begins building the equipment detail line, then the report line is cleared and initialized with default values.
  • Context - an equipment item is being processed:
    For Equipment Type?:
    When the system checks if a container was found in the waybill, then equipment is classified as container if container found, otherwise as car.
  • Context - equipment is classified as a container:
    For Process Container Information:
    When the system processes container information, then container id is set from equipment id, load/empty indicator is set from shipment root, and container flag is set for validation.
  • Context - equipment is classified as a car:
    For Process Car Information:
    When the system processes car information, then car id is set from request equipment id, load/empty indicator is set from request, car flag is set for validation, and equipment id is formatted for new report.
  • Context - equipment information has been formatted with car or container details:
    For Call Equipment Type Validation:
    When the system calls equipment type validation service, then equipment type code is validated and equipment details are retrieved from the equipment type master.
  • Context - equipment type validation has been performed:
    For Equipment Type Valid?:
    When the equipment type validation call is not successful, then equipment error flag is set and appropriate error message is added to the report.
  • Context - equipment type validation has failed:
    For Set Equipment Error Flag:
    When the system processes the validation failure, then equipment error flag is set to indicate processing should not continue.
  • Context - equipment has failed validation and error flag is set:
    For Add Error Message:
    When the system adds error messages to the report, then message 35 is added for container validation failure or message 36 for car validation failure.
  • Context - equipment has valid waybill and equipment type code is 'sk':
    For Process Double Stack Container Count:
    When the system processes double stack container information, then double stack counts are updated based on traffic type (cprs, csxt, ns, or haul).
  • Context - equipment has valid waybill information:
    For Process Equipment Routing Information:
    When the system processes routing information from the waybill, then routing is checked against predefined patterns and empty indicator is set to 1 if no valid route found, otherwise route-specific indicators are set.
  • Context - equipment type code has been validated successfully:
    For Retrieve Equipment Type Description:
    When the system retrieves equipment type description from the vehicle information table, then equipment type description is retrieved and stored for report display.
  • Context - equipment information has been processed:
    For Cargo Found?:
    When the system checks for associated cargo records, then processing branches to cargo handling if cargo found, otherwise proceeds to information field formatting.
  • Context - cargo information exists for the equipment:
    For Fill Cargo Part Information:
    When the system processes cargo details, then bond type indicators are set, us ccn key is captured, load/empty indicator is updated, and cargo condition response code is stored.
  • Context - equipment information has been formatted:
    For Equipment Category?:
    When the system categorizes equipment for counting purposes, then equipment is classified as locomotive, container, or car based on equipment type code.
  • Context - equipment type code is 'lo' or 'et':
    For Count Locomotives:
    When the system processes locomotive equipment, then total locomotive count is incremented by 1.
  • Context - equipment type code is 'cn' (container):
    For Count Containers by Load/Empty:
    When the system processes container load status, then total loaded container count is incremented if load indicator is 'l', otherwise total empty container count is incremented.
  • Context - equipment type code is not locomotive or container:
    For Count Cars by Load/Empty:
    When the system processes car load status, then total loaded car count is incremented if load indicator is 'l', otherwise total empty car count is incremented.
  • Context - equipment has been categorized and counted:
    For Special Equipment?:
    When the system checks for special equipment characteristics, then equipment is identified as sbu van, conveying car, or regular equipment for appropriate information formatting.
  • Context - equipment is identified as sbu van unit:
    For Process International Service Unit:
    When the load/empty indicator is 'e' (empty), then information field is set to 'international service' and processing exits.
  • Context - equipment is identified as conveying car and no cargo found:
    For Process Conveying Flat Car:
    When the system processes conveying car information, then information field is set to 'conveying flat car' and processing exits.
  • Context - equipment and cargo information has been processed:
    For Cargo Status?:
    When the system determines cargo processing requirements, then cargo is classified as empty equipment, loaded with bond information, or regular cargo for information field formatting.
  • Context - cargo is classified as empty equipment or empty residue:
    For Process Empty Equipment:
    When the system processes empty equipment status, then container or car counts are adjusted from loaded to empty, information field is set to 'empty', and load/empty indicator is set to 'e'.
  • Context - cargo has bond information that needs display formatting:
    For Format AMS Bond Display:
    When the system formats bond information for display, then bond information is formatted as 'ppr 7512 15 us-ca-us' for type 15, 'ams [type] [number]' for it/ie types, or 'ams 7512 [type] [number]' for te/tr/mt types.
  • Context - cargo information exists and segment 07 data is available:
    For Process Segment 07 Data:
    When the system processes segment 07 cargo descriptions, then cargo descriptions are extracted from segment 07 data, formatted for display, and multiple descriptions create separate report lines.
  • Context - equipment information has been completely formatted:
    For Add Equipment Line to Report:
    When the equipment line is not blank and not marked for special processing, then equipment count is incremented, report line is added to email text, and report index is advanced.
👨‍💻 Technical ACs (Gherkin)
Context: A new equipment item needs to be processed for reporting
GIVEN
A new equipment item needs to be processed for reporting
Applied to: Initialize Report Line
WHEN
The system begins building the equipment detail line
THEN
The report line is cleared and initialized with default values
Context: An equipment item is being processed
GIVEN
An equipment item is being processed
Applied to: Equipment Type?
WHEN
The system checks if a container was found in the waybill
THEN
Equipment is classified as container if container found, otherwise as car
Context: Equipment is classified as a container
GIVEN
Equipment is classified as a container
Applied to: Process Container Information
WHEN
The system processes container information
THEN
Container ID is set from equipment ID, load/empty indicator is set from shipment root, and container flag is set for validation
Context: Equipment is classified as a car
GIVEN
Equipment is classified as a car
Applied to: Process Car Information
WHEN
The system processes car information
THEN
Car ID is set from request equipment ID, load/empty indicator is set from request, car flag is set for validation, and equipment ID is formatted for new report
Context: Equipment information has been formatted with car or container details
GIVEN
Equipment information has been formatted with car or container details
Applied to: Call Equipment Type Validation
WHEN
The system calls equipment type validation service
THEN
Equipment type code is validated and equipment details are retrieved from the equipment type master
Context: Equipment type validation has been performed
GIVEN
Equipment type validation has been performed
Applied to: Equipment Type Valid?
WHEN
The equipment type validation call is not successful
THEN
Equipment error flag is set and appropriate error message is added to the report
Context: Equipment type validation has failed
GIVEN
Equipment type validation has failed
Applied to: Set Equipment Error Flag
WHEN
The system processes the validation failure
THEN
Equipment error flag is set to indicate processing should not continue
Context: Equipment has failed validation and error flag is set
GIVEN
Equipment has failed validation and error flag is set
Applied to: Add Error Message
WHEN
The system adds error messages to the report
THEN
Message 35 is added for container validation failure or message 36 for car validation failure
Context: Equipment has valid waybill and equipment type code is 'SK'
GIVEN
Equipment has valid waybill and equipment type code is 'SK'
Applied to: Process Double Stack Container Count
WHEN
The system processes double stack container information
THEN
Double stack counts are updated based on traffic type (CPRS, CSXT, NS, or HAUL)
Context: Equipment has valid waybill information
GIVEN
Equipment has valid waybill information
Applied to: Process Equipment Routing Information
WHEN
The system processes routing information from the waybill
THEN
Routing is checked against predefined patterns and empty indicator is set to 1 if no valid route found, otherwise route-specific indicators are set
Context: Equipment type code has been validated successfully
GIVEN
Equipment type code has been validated successfully
Applied to: Retrieve Equipment Type Description
WHEN
The system retrieves equipment type description from the vehicle information table
THEN
Equipment type description is retrieved and stored for report display
Context: Equipment information has been processed
GIVEN
Equipment information has been processed
Applied to: Cargo Found?
WHEN
The system checks for associated cargo records
THEN
Processing branches to cargo handling if cargo found, otherwise proceeds to information field formatting
Context: Cargo information exists for the equipment
GIVEN
Cargo information exists for the equipment
Applied to: Fill Cargo Part Information
WHEN
The system processes cargo details
THEN
Bond type indicators are set, US CCN key is captured, load/empty indicator is updated, and cargo condition response code is stored
Context: Equipment information has been formatted
GIVEN
Equipment information has been formatted
Applied to: Equipment Category?
WHEN
The system categorizes equipment for counting purposes
THEN
Equipment is classified as locomotive, container, or car based on equipment type code
Context: Equipment type code is 'LO' or 'ET'
GIVEN
Equipment type code is 'LO' or 'ET'
Applied to: Count Locomotives
WHEN
The system processes locomotive equipment
THEN
Total locomotive count is incremented by 1
Context: Equipment type code is 'CN' (container)
GIVEN
Equipment type code is 'CN' (container)
Applied to: Count Containers by Load/Empty
WHEN
The system processes container load status
THEN
Total loaded container count is incremented if load indicator is 'L', otherwise total empty container count is incremented
Context: Equipment type code is not locomotive or container
GIVEN
Equipment type code is not locomotive or container
Applied to: Count Cars by Load/Empty
WHEN
The system processes car load status
THEN
Total loaded car count is incremented if load indicator is 'L', otherwise total empty car count is incremented
Context: Equipment has been categorized and counted
GIVEN
Equipment has been categorized and counted
Applied to: Special Equipment?
WHEN
The system checks for special equipment characteristics
THEN
Equipment is identified as SBU van, conveying car, or regular equipment for appropriate information formatting
Context: Equipment is identified as SBU van unit
GIVEN
Equipment is identified as SBU van unit
Applied to: Process International Service Unit
WHEN
The load/empty indicator is 'E' (empty)
THEN
Information field is set to 'INTERNATIONAL SERVICE' and processing exits
Context: Equipment is identified as conveying car and no cargo found
GIVEN
Equipment is identified as conveying car and no cargo found
Applied to: Process Conveying Flat Car
WHEN
The system processes conveying car information
THEN
Information field is set to 'CONVEYING FLAT CAR' and processing exits
Context: Equipment and cargo information has been processed
GIVEN
Equipment and cargo information has been processed
Applied to: Cargo Status?
WHEN
The system determines cargo processing requirements
THEN
Cargo is classified as empty equipment, loaded with bond information, or regular cargo for information field formatting
Context: Cargo is classified as empty equipment or empty residue
GIVEN
Cargo is classified as empty equipment or empty residue
Applied to: Process Empty Equipment
WHEN
The system processes empty equipment status
THEN
Container or car counts are adjusted from loaded to empty, information field is set to 'EMPTY', and load/empty indicator is set to 'E'
Context: Cargo has bond information that needs display formatting
GIVEN
Cargo has bond information that needs display formatting
Applied to: Format AMS Bond Display
WHEN
The system formats bond information for display
THEN
Bond information is formatted as 'PPR 7512 15 US-CA-US' for type 15, 'AMS [type] [number]' for IT/IE types, or 'AMS 7512 [type] [number]' for TE/TR/MT types
Context: Cargo information exists and segment 07 data is available
GIVEN
Cargo information exists and segment 07 data is available
Applied to: Process Segment 07 Data
WHEN
The system processes segment 07 cargo descriptions
THEN
Cargo descriptions are extracted from segment 07 data, formatted for display, and multiple descriptions create separate report lines
Context: Equipment information has been completely formatted
GIVEN
Equipment information has been completely formatted
Applied to: Add Equipment Line to Report
WHEN
The equipment line is not blank and not marked for special processing
THEN
Equipment count is incremented, report line is added to email text, and report index is advanced
R-GCX003-cbl-00186 (+11) File: GCX003.cbl Equipment Type Validation Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Type Validation':
  • Context - equipment processing is initiated and waybill data is available:
    For Set Container Parameters:
    When the system detects container equipment from waybill data, then equipment type is set to container and container-specific processing parameters are established.
  • Context - equipment is classified as container type and waybill routing data is available:
    For Set Trailer Parameters:
    When the waybill indicates trailer equipment type, then trailer-specific processing parameters are applied to the equipment.
  • Context - equipment processing is initiated:
    For Set Car Parameters:
    When the equipment is not identified as container equipment, then equipment type is set to car and car-specific processing parameters are established.
  • Context - equipment type parameters are set and equipment id is available:
    For Call Equipment Type Validation Service GCCCARTP:
    When equipment type validation is required, then external equipment validation service gcccartp is called with equipment parameters.
  • Context - equipment validation service has been called:
    For Validation Successful?:
    When the validation service returns a response, then system checks if validation was successful and routes processing accordingly.
  • Context - equipment validation was successful and equipment code is available:
    For Retrieve Equipment Type Description:
    When equipment type description is needed for reporting, then system retrieves equipment type description from vehicle information reference table.
  • Context - equipment is validated and waybill is found and equipment type is 'sk' (stack car):
    For Set Double Stack Container Count:
    When double stack container processing is required, then system calls double stack service and updates appropriate traffic type counters (cprs, csxt, ns, or haul).
  • Context - waybill is found and routing information is available:
    For Validate Equipment Routing Information:
    When equipment routing validation is performed, then system checks routing information against predefined routing patterns and sets appropriate routing indicators.
  • Context - equipment routing validation has been performed:
    For Set Empty Equipment Indicator:
    When routing validation fails or waybill is not found, then empty equipment indicator is set to 1 for the equipment.
  • Context - equipment is classified as container type:
    For Generate Container Type Error Message MSG-35:
    When equipment type validation service call fails, then error message msg-35 is generated indicating container type validation failure.
  • Context - equipment is classified as car type:
    For Generate Car Type Error Message MSG-36:
    When equipment type validation service call fails, then error message msg-36 is generated indicating car type validation failure.
  • Context - equipment type validation has failed:
    For Set Equipment Error Flag:
    When error messages have been generated, then equipment error flag is set to prevent continued processing of invalid equipment.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment processing is initiated and waybill data is available
GIVEN
Equipment processing is initiated and waybill data is available
Applied to: Set Container Parameters
WHEN
The system detects container equipment from waybill data
THEN
Equipment type is set to container and container-specific processing parameters are established
Context: Equipment is classified as container type and waybill routing data is available
GIVEN
Equipment is classified as container type and waybill routing data is available
Applied to: Set Trailer Parameters
WHEN
The waybill indicates trailer equipment type
THEN
Trailer-specific processing parameters are applied to the equipment
Context: Equipment processing is initiated
GIVEN
Equipment processing is initiated
Applied to: Set Car Parameters
WHEN
The equipment is not identified as container equipment
THEN
Equipment type is set to car and car-specific processing parameters are established
Context: Equipment type parameters are set and equipment ID is available
GIVEN
Equipment type parameters are set and equipment ID is available
Applied to: Call Equipment Type Validation Service GCCCARTP
WHEN
Equipment type validation is required
THEN
External equipment validation service GCCCARTP is called with equipment parameters
Context: Equipment validation service has been called
GIVEN
Equipment validation service has been called
Applied to: Validation Successful?
WHEN
The validation service returns a response
THEN
System checks if validation was successful and routes processing accordingly
Context: Equipment validation was successful and equipment code is available
GIVEN
Equipment validation was successful and equipment code is available
Applied to: Retrieve Equipment Type Description
WHEN
Equipment type description is needed for reporting
THEN
System retrieves equipment type description from vehicle information reference table
Context: Equipment is validated and waybill is found and equipment type is 'SK' (stack car)
GIVEN
Equipment is validated and waybill is found and equipment type is 'SK' (stack car)
Applied to: Set Double Stack Container Count
WHEN
Double stack container processing is required
THEN
System calls double stack service and updates appropriate traffic type counters (CPRS, CSXT, NS, or HAUL)
Context: Waybill is found and routing information is available
GIVEN
Waybill is found and routing information is available
Applied to: Validate Equipment Routing Information
WHEN
Equipment routing validation is performed
THEN
System checks routing information against predefined routing patterns and sets appropriate routing indicators
Context: Equipment routing validation has been performed
GIVEN
Equipment routing validation has been performed
Applied to: Set Empty Equipment Indicator
WHEN
Routing validation fails or waybill is not found
THEN
Empty equipment indicator is set to 1 for the equipment
Context: Equipment is classified as container type
GIVEN
Equipment is classified as container type
Applied to: Generate Container Type Error Message MSG-35
WHEN
Equipment type validation service call fails
THEN
Error message MSG-35 is generated indicating container type validation failure
Context: Equipment is classified as car type
GIVEN
Equipment is classified as car type
Applied to: Generate Car Type Error Message MSG-36
WHEN
Equipment type validation service call fails
THEN
Error message MSG-36 is generated indicating car type validation failure
Context: Equipment type validation has failed
GIVEN
Equipment type validation has failed
Applied to: Set Equipment Error Flag
WHEN
Error messages have been generated
THEN
Equipment error flag is set to prevent continued processing of invalid equipment
R-GCX003-cbl-00198 (+15) File: GCX003.cbl Cargo Information Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Information Processing':
  • Context - a cargo record with bond type classification criteria:
    For Bond Type = TR?:
    When the cargo has us-canada-us bond type code and the cargo was not created for it processing and the cargo is not designated as special usmx tr cargo, then set the tr bond found flag to true.
    For Bond Type = TE?:
    When the cargo has transportation export bond type code and the cargo was not created for it processing, then set the te bond found flag to true.
  • Context - a cargo record with special manifest indicators:
    For Special Manifest Original?:
    When the cargo is designated as special manifest original, then set the special it found flag to true.
  • Context - a cargo record with te bond type and special manifest indicators:
    For Bond Type = TE AND Special Manifest?:
    When the cargo has transportation export bond type code and the cargo is designated as special manifest, then set the special te found flag to true.
  • Context - a cargo record with export bond type and special indicators:
    For Bond Type = Export AND Special 88?:
    When the cargo has export bond type code and the cargo has usmx special 88 designation, then set the us-mx 88 found flag to true.
  • Context - a cargo record with us-canada-us bond type and special tr indicators:
    For Bond Type = US-CAN-US AND Special TR?:
    When the cargo has us-canada-us bond type code and the cargo has usmx special tr designation, then set the special tr found flag to true.
  • Context - a cargo record with potential bond number sources:
    For Entry Number Available?:
    When the cargo entry number field is not blank or spaces, then use the entry number as the bond number for processing.
  • Context - a cargo record where entry number is not available:
    For In-Bond Control Number Available?:
    When the in-bond control number field is not blank or spaces, then use the in-bond control number as the bond number for processing.
  • Context - a cargo record with empty equipment designation:
    For Process Empty Equipment:
    When the cargo is classified as empty equipment or empty residue, then set cargo information to 'empty', update load/empty indicator to 'e', and adjust equipment counters from loaded to empty.
  • Context - a cargo record with specific bond type code:
    For Process Paper 7512 Movement:
    When the cargo bond type code equals '15', then set cargo information to 'ppr 7512 15 us-ca-us'.
  • Context - a cargo record with it or ie bond type and extracted bond number:
    For Process AMS IT/IE Bond:
    When the cargo in-bond type code equals 'it' or 'ie', then format cargo information as 'ams' followed by bond type code and bond number.
  • Context - a cargo record with te, tr, or mt bond type and extracted bond number:
    For Process AMS 7512 TE/TR/MT Bond:
    When the cargo in-bond type code equals 'te' or 'tr' or 'mt', then format cargo information as 'ams 7512' followed by bond type code and bond number.
  • Context - a cargo record with potential segment 07 data:
    For Segment 07 Data Available?:
    When segment 07 data exists and is not blank or low-values, then process the segment 07 data for cargo description extraction.
  • Context - a cargo record with valid segment 07 data:
    For Extract Equipment Description:
    When segment 07 contains cargo description information, then extract the cargo description and use it as the cargo information field.
  • Context - an empty equipment record with residue weight information:
    For Residue Weight > Threshold?:
    When the residue weight is greater than zero and special handling code contains er threshold code, then apply empty residue processing rules.
  • Context - equipment with determined load/empty status and equipment type:
    For Update Load/Empty Status Counters:
    When processing equipment counters for containers or cars, then increment appropriate counter (container loaded/empty or car loaded/empty) based on equipment type and load status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with bond type classification criteria
GIVEN
A cargo record with bond type classification criteria
Applied to: Bond Type = TR?
WHEN
The cargo has US-Canada-US bond type code AND the cargo was not created for IT processing AND the cargo is not designated as special USMX TR cargo
THEN
Set the TR bond found flag to true
Applied to: Bond Type = TE?
WHEN
The cargo has transportation export bond type code AND the cargo was not created for IT processing
THEN
Set the TE bond found flag to true
Context: A cargo record with special manifest indicators
GIVEN
A cargo record with special manifest indicators
Applied to: Special Manifest Original?
WHEN
The cargo is designated as special manifest original
THEN
Set the special IT found flag to true
Context: A cargo record with TE bond type and special manifest indicators
GIVEN
A cargo record with TE bond type and special manifest indicators
Applied to: Bond Type = TE AND Special Manifest?
WHEN
The cargo has transportation export bond type code AND the cargo is designated as special manifest
THEN
Set the special TE found flag to true
Context: A cargo record with export bond type and special indicators
GIVEN
A cargo record with export bond type and special indicators
Applied to: Bond Type = Export AND Special 88?
WHEN
The cargo has export bond type code AND the cargo has USMX special 88 designation
THEN
Set the US-MX 88 found flag to true
Context: A cargo record with US-Canada-US bond type and special TR indicators
GIVEN
A cargo record with US-Canada-US bond type and special TR indicators
Applied to: Bond Type = US-CAN-US AND Special TR?
WHEN
The cargo has US-Canada-US bond type code AND the cargo has USMX special TR designation
THEN
Set the special TR found flag to true
Context: A cargo record with potential bond number sources
GIVEN
A cargo record with potential bond number sources
Applied to: Entry Number Available?
WHEN
The cargo entry number field is not blank or spaces
THEN
Use the entry number as the bond number for processing
Context: A cargo record where entry number is not available
GIVEN
A cargo record where entry number is not available
Applied to: In-Bond Control Number Available?
WHEN
The in-bond control number field is not blank or spaces
THEN
Use the in-bond control number as the bond number for processing
Context: A cargo record with empty equipment designation
GIVEN
A cargo record with empty equipment designation
Applied to: Process Empty Equipment
WHEN
The cargo is classified as empty equipment or empty residue
THEN
Set cargo information to 'EMPTY', update load/empty indicator to 'E', and adjust equipment counters from loaded to empty
Context: A cargo record with specific bond type code
GIVEN
A cargo record with specific bond type code
Applied to: Process Paper 7512 Movement
WHEN
The cargo bond type code equals '15'
THEN
Set cargo information to 'PPR 7512 15 US-CA-US'
Context: A cargo record with IT or IE bond type and extracted bond number
GIVEN
A cargo record with IT or IE bond type and extracted bond number
Applied to: Process AMS IT/IE Bond
WHEN
The cargo in-bond type code equals 'IT' or 'IE'
THEN
Format cargo information as 'AMS' followed by bond type code and bond number
Context: A cargo record with TE, TR, or MT bond type and extracted bond number
GIVEN
A cargo record with TE, TR, or MT bond type and extracted bond number
Applied to: Process AMS 7512 TE/TR/MT Bond
WHEN
The cargo in-bond type code equals 'TE' or 'TR' or 'MT'
THEN
Format cargo information as 'AMS 7512' followed by bond type code and bond number
Context: A cargo record with potential segment 07 data
GIVEN
A cargo record with potential segment 07 data
Applied to: Segment 07 Data Available?
WHEN
Segment 07 data exists and is not blank or low-values
THEN
Process the segment 07 data for cargo description extraction
Context: A cargo record with valid segment 07 data
GIVEN
A cargo record with valid segment 07 data
Applied to: Extract Equipment Description
WHEN
Segment 07 contains cargo description information
THEN
Extract the cargo description and use it as the cargo information field
Context: An empty equipment record with residue weight information
GIVEN
An empty equipment record with residue weight information
Applied to: Residue Weight > Threshold?
WHEN
The residue weight is greater than zero AND special handling code contains ER threshold code
THEN
Apply empty residue processing rules
Context: Equipment with determined load/empty status and equipment type
GIVEN
Equipment with determined load/empty status and equipment type
Applied to: Update Load/Empty Status Counters
WHEN
Processing equipment counters for containers or cars
THEN
Increment appropriate counter (container loaded/empty or car loaded/empty) based on equipment type and load status
R-GCX003-cbl-00214 (+22) File: GCX003.cbl Bond Type Classification Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Type Classification':
  • Context - a cargo record exists for the equipment:
    For Extract Bond Type from Cargo Record:
    When the system processes the cargo information, then the in-bond type code is extracted from the cargo record field m1201-in-bond-typ-cde.
  • Context - cargo has it bond type:
    For Set Special Manifest Flags:
    When the system processes the bond type classification, then the special manifest origin flag is set to indicate special processing is required.
  • Context - cargo has te bond type and special manifest processing is required:
    For Set Special Manifest Flags:
    When the system processes the bond type classification, then the special manifest special flag is set to indicate te special processing.
  • Context - cargo has us-canada-us bond type and tr is not already created and does not have special tr processing:
    For Set TR Bond Found Flag:
    When the system processes tr bond type, then the tr bond found flag is set to true.
  • Context - cargo has transport export bond type and te is not already created:
    For Set TE Bond Found Flag:
    When the system processes te bond type, then the te bond found flag is set to true.
  • Context - cargo has export bond type and has usmx special 88 processing:
    For Set Special Manifest Flags:
    When the system processes export bond classification, then the usmx 88 found flag is set to indicate special export processing.
  • Context - cargo has us-canada-us bond type and has usmx special tr processing:
    For Set Special Manifest Flags:
    When the system processes bond type classification, then the splc tr found flag is set to indicate special tr processing.
  • Context - cargo bond type is not spaces and not export type and not empty equipment type:
    For Format Bond Information Display:
    When the system formats cargo information for display, then the us ccn key from cargo is assigned to the report us ccn field.
  • Context - cargo entry number field is not spaces:
    For Extract from Entry Number:
    When the system extracts bond number information, then the entry number is saved as the bond number for display formatting.
  • Context - cargo entry number is spaces and in-bond control number is not spaces:
    For Extract from In-Bond Control Number:
    When the system extracts bond number information, then the in-bond control number is saved as the bond number for display formatting.
  • Context - cargo is empty equipment type or empty residue type:
    For Format Bond Information Display:
    When the system formats bond information for display, then the report info shows 'empty', load/empty indicator is set to 'e', and equipment counters are updated from loaded to empty.
  • Context - cargo bond type code is '15':
    For Format Bond Information Display:
    When the system formats bond information for display, then the report info displays 'ppr 7512 15 us-ca-us'.
  • Context - cargo in-bond type code is 'it' or 'ie':
    For Format Bond Information Display:
    When the system formats bond information for display, then the report info displays 'ams ' concatenated with bond type and bond number.
  • Context - cargo in-bond type code is 'te' or 'tr' or 'mt':
    For Format Bond Information Display:
    When the system formats bond information for display, then the report info displays 'ams 7512 ' concatenated with bond type and bond number.
  • Context - it cargo requires special manifest processing and action is send:
    For Check if Special Manifest Required:
    When the system checks user authorization for special manifests, then if user is not authorized for special manifests, generate authorization error message 43, otherwise proceed with it export manifest creation.
  • Context - te cargo requires port change processing and action is send:
    For Check Port Change Requirements:
    When the system checks user authorization for port change manifests, then if user is not authorized for special manifests, generate authorization error message 43, otherwise proceed with port change manifest creation.
  • Context - tr cargo requires diversion processing and action is send:
    For Check Diversion Requirements:
    When the system checks user authorization for diversion manifests, then if user is not authorized for special manifests, generate authorization error message 43, otherwise proceed with diversion manifest creation.
  • Context - it cargo is not already created and user is authorized for special manifests and action is send:
    For Create IT Export Special Manifest:
    When the system processes it export requirements, then generate message 23, set it export spawn flag, and invoke special manifest creation process.
  • Context - te cargo location does not match crossing port and user is authorized and action is send:
    For Create TE Port Change Manifest:
    When the system processes te port change requirements, then generate message 20, set port change spawn flag, and invoke special manifest creation process.
  • Context - tr cargo requires diversion processing and user is authorized and action is send:
    For Create TR Diversion Manifest:
    When the system processes tr diversion requirements, then generate message 23, set detour spawn flag, and invoke special manifest creation process.
  • Context - cargo has mt bond type and vessel name is not 'train' and not spaces and crossing port matches cargo location:
    For Validate Vessel Name:
    When the system validates mt bond requirements, then generate error message 25 for invalid mt bond vessel configuration.
  • Context - cargo has te bond type and vessel name character 23 is 't':
    For Validate Vessel Name:
    When the system validates te bond requirements, then generate error message 17 for invalid te bond vessel name.
  • Context - cargo bond type is not 'te' and not 'mt' and vessel name is not 'train':
    For Validate Vessel Name:
    When the system validates bond vessel requirements, then generate error message 17 for invalid vessel name configuration.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists for the equipment
GIVEN
A cargo record exists for the equipment
Applied to: Extract Bond Type from Cargo Record
WHEN
The system processes the cargo information
THEN
The in-bond type code is extracted from the cargo record field M1201-IN-BOND-TYP-CDE
Context: Cargo has IT bond type
GIVEN
Cargo has IT bond type
Applied to: Set Special Manifest Flags
WHEN
The system processes the bond type classification
THEN
The special manifest origin flag is set to indicate special processing is required
Context: Cargo has TE bond type and special manifest processing is required
GIVEN
Cargo has TE bond type and special manifest processing is required
Applied to: Set Special Manifest Flags
WHEN
The system processes the bond type classification
THEN
The special manifest special flag is set to indicate TE special processing
Context: Cargo has US-Canada-US bond type and TR is not already created and does not have special TR processing
GIVEN
Cargo has US-Canada-US bond type and TR is not already created and does not have special TR processing
Applied to: Set TR Bond Found Flag
WHEN
The system processes TR bond type
THEN
The TR bond found flag is set to true
Context: Cargo has transport export bond type and TE is not already created
GIVEN
Cargo has transport export bond type and TE is not already created
Applied to: Set TE Bond Found Flag
WHEN
The system processes TE bond type
THEN
The TE bond found flag is set to true
Context: Cargo has export bond type and has USMX special 88 processing
GIVEN
Cargo has export bond type and has USMX special 88 processing
Applied to: Set Special Manifest Flags
WHEN
The system processes export bond classification
THEN
The USMX 88 found flag is set to indicate special export processing
Context: Cargo has US-Canada-US bond type and has USMX special TR processing
GIVEN
Cargo has US-Canada-US bond type and has USMX special TR processing
Applied to: Set Special Manifest Flags
WHEN
The system processes bond type classification
THEN
The SPLC TR found flag is set to indicate special TR processing
Context: Cargo bond type is not spaces and not export type and not empty equipment type
GIVEN
Cargo bond type is not spaces and not export type and not empty equipment type
Applied to: Format Bond Information Display
WHEN
The system formats cargo information for display
THEN
The US CCN key from cargo is assigned to the report US CCN field
Context: Cargo entry number field is not spaces
GIVEN
Cargo entry number field is not spaces
Applied to: Extract from Entry Number
WHEN
The system extracts bond number information
THEN
The entry number is saved as the bond number for display formatting
Context: Cargo entry number is spaces and in-bond control number is not spaces
GIVEN
Cargo entry number is spaces and in-bond control number is not spaces
Applied to: Extract from In-Bond Control Number
WHEN
The system extracts bond number information
THEN
The in-bond control number is saved as the bond number for display formatting
Context: Cargo is empty equipment type or empty residue type
GIVEN
Cargo is empty equipment type or empty residue type
Applied to: Format Bond Information Display
WHEN
The system formats bond information for display
THEN
The report info shows 'EMPTY', load/empty indicator is set to 'E', and equipment counters are updated from loaded to empty
Context: Cargo bond type code is '15'
GIVEN
Cargo bond type code is '15'
Applied to: Format Bond Information Display
WHEN
The system formats bond information for display
THEN
The report info displays 'PPR 7512 15 US-CA-US'
Context: Cargo in-bond type code is 'IT' or 'IE'
GIVEN
Cargo in-bond type code is 'IT' or 'IE'
Applied to: Format Bond Information Display
WHEN
The system formats bond information for display
THEN
The report info displays 'AMS ' concatenated with bond type and bond number
Context: Cargo in-bond type code is 'TE' or 'TR' or 'MT'
GIVEN
Cargo in-bond type code is 'TE' or 'TR' or 'MT'
Applied to: Format Bond Information Display
WHEN
The system formats bond information for display
THEN
The report info displays 'AMS 7512 ' concatenated with bond type and bond number
Context: IT cargo requires special manifest processing and action is send
GIVEN
IT cargo requires special manifest processing and action is send
Applied to: Check if Special Manifest Required
WHEN
The system checks user authorization for special manifests
THEN
If user is not authorized for special manifests, generate authorization error message 43, otherwise proceed with IT export manifest creation
Context: TE cargo requires port change processing and action is send
GIVEN
TE cargo requires port change processing and action is send
Applied to: Check Port Change Requirements
WHEN
The system checks user authorization for port change manifests
THEN
If user is not authorized for special manifests, generate authorization error message 43, otherwise proceed with port change manifest creation
Context: TR cargo requires diversion processing and action is send
GIVEN
TR cargo requires diversion processing and action is send
Applied to: Check Diversion Requirements
WHEN
The system checks user authorization for diversion manifests
THEN
If user is not authorized for special manifests, generate authorization error message 43, otherwise proceed with diversion manifest creation
Context: IT cargo is not already created and user is authorized for special manifests and action is send
GIVEN
IT cargo is not already created and user is authorized for special manifests and action is send
Applied to: Create IT Export Special Manifest
WHEN
The system processes IT export requirements
THEN
Generate message 23, set IT export spawn flag, and invoke special manifest creation process
Context: TE cargo location does not match crossing port and user is authorized and action is send
GIVEN
TE cargo location does not match crossing port and user is authorized and action is send
Applied to: Create TE Port Change Manifest
WHEN
The system processes TE port change requirements
THEN
Generate message 20, set port change spawn flag, and invoke special manifest creation process
Context: TR cargo requires diversion processing and user is authorized and action is send
GIVEN
TR cargo requires diversion processing and user is authorized and action is send
Applied to: Create TR Diversion Manifest
WHEN
The system processes TR diversion requirements
THEN
Generate message 23, set detour spawn flag, and invoke special manifest creation process
Context: Cargo has MT bond type and vessel name is not 'TRAIN' and not spaces and crossing port matches cargo location
GIVEN
Cargo has MT bond type and vessel name is not 'TRAIN' and not spaces and crossing port matches cargo location
Applied to: Validate Vessel Name
WHEN
The system validates MT bond requirements
THEN
Generate error message 25 for invalid MT bond vessel configuration
Context: Cargo has TE bond type and vessel name character 23 is 'T'
GIVEN
Cargo has TE bond type and vessel name character 23 is 'T'
Applied to: Validate Vessel Name
WHEN
The system validates TE bond requirements
THEN
Generate error message 17 for invalid TE bond vessel name
Context: Cargo bond type is not 'TE' and not 'MT' and vessel name is not 'TRAIN'
GIVEN
Cargo bond type is not 'TE' and not 'MT' and vessel name is not 'TRAIN'
Applied to: Validate Vessel Name
WHEN
The system validates bond vessel requirements
THEN
Generate error message 17 for invalid vessel name configuration
R-GCX003-cbl-00237 (+16) File: GCX003.cbl Special Manifest Processing Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Manifest Processing':
  • Context - a user is processing it bond cargo that requires special manifest creation:
    For User Authorized for Special Manifests?:
    When the system checks if the user is authorized for special manifests and the request is not an aei train send, then if user is not authorized for special manifests, generate authorization error message 43.
  • Context - it bond cargo exists with tr-created-for-it not equal to 'y' and special manifest original flag is not set and user is authorized for special manifests:
    For Create IT Export Special Manifest:
    When the request action is send, then set it export spawn flag to true, generate message 23, and perform special manifest creation process.
  • Context - it bond cargo exists with tr-created-for-it not equal to 'y' and special manifest original flag is not set:
    For Generate IT Export Report Message:
    When the request action is report, then generate message 24 for it export reporting.
  • Context - cargo is found with tr bond type and cargo location id does not match train crossing port:
    For Create TR Diversion Special Manifest:
    When the request action is send and user is authorized for special manifests, then set diversion spawn flag to true, generate message 20, and perform special manifest creation process.
    For Generate TR Diversion Report Message:
    When the request action is report, then generate message 19 with station code information for tr bond diversion reporting.
  • Context - cargo is found with te bond type and tr-created-for-it is spaces and cargo status is not export and cargo is billed as cprs and cargo location id1 does not match train crossing port:
    For Create TE Port Change Special Manifest:
    When the request action is send and user is authorized for special manifests, then set port change spawn flag to true, generate message 20, and perform special manifest creation process.
    For Generate TE Port Change Report Message:
    When the request action is report, then generate message 19 with station code information for te bond port change reporting.
  • Context - waybill is found with no cargo and origin and destination are both us states and equipment is loaded or has residue weight with er found:
    For Create US-US Detour Special Manifest:
    When the request action is send and user is authorized for special manifests, then set us-us detour spawn flag to true, generate message 23, and perform special manifest creation process.
    For Generate US-US Detour Report Message:
    When the request action is report, then generate message 18 for us-us movement detour reporting.
  • Context - cargo is found with export type and origin-destination country codes are 'usmx' and special manifest flag is spaces and not at laredo tx station:
    For Create US-Mexico Export Special Manifest:
    When the request action is send and user is authorized for special manifests, then set 88-tr detour spawn flag to true, generate message 23, and perform special manifest creation process.
    For Generate US-Mexico Export Report Message:
    When the request action is report, then generate message 50 for us-mexico export reporting.
  • Context - cargo is found with default type and tr-created-for-it is spaces and special manifest original flag is not set:
    For Create Border Clearance Special Manifest:
    When cargo status equals release status and request action is send and user is authorized for special manifests, then set detour spawn flag to true, generate message 23, and perform special manifest creation process.
    For Generate Invalid Status Message:
    When cargo status does not equal release status, then generate message 31 for invalid cargo status.
  • Context - a special manifest needs to be created for any cargo type:
    For Set Special Manifest Parameters:
    When special manifest creation is triggered, then set high-values security byte, set 'us' record type code, set border code from station crossing port, set border name from station name, and set ccn from cargo ccn key.
  • Context - special manifest parameters are configured:
    For Determine Manifest Type:
    When evaluating spawn type flags, then set diversion flag for diversion spawn, set it export flag for it export spawn, set change port flag for port change spawn, set it export flag for detour spawn, set us-us detour flag for us-us detour spawn, or set export tr flag for 88-tr detour spawn.
  • Context - special manifest type is determined:
    For Set Equipment and Waybill Information:
    When setting equipment and waybill information, then set equipment id from current equipment id, set waybill number from cargo waybill index, and set waybill date from cargo waybill date index.
  • Context - special manifest is fully configured with all required parameters:
    For Queue Special Manifest for Processing:
    When queuing manifest for processing, then increment report spawn count by 1 and store special manifest input parameters in working storage spawn table.
👨‍💻 Technical ACs (Gherkin)
Context: A user is processing IT bond cargo that requires special manifest creation
GIVEN
A user is processing IT bond cargo that requires special manifest creation
Applied to: User Authorized for Special Manifests?
WHEN
The system checks if the user is authorized for special manifests AND the request is not an AEI train send
THEN
If user is not authorized for special manifests, generate authorization error message 43
Context: IT bond cargo exists with TR-CREATED-FOR-IT not equal to 'Y' AND special manifest original flag is not set AND user is authorized for special manifests
GIVEN
IT bond cargo exists with TR-CREATED-FOR-IT not equal to 'Y' AND special manifest original flag is not set AND user is authorized for special manifests
Applied to: Create IT Export Special Manifest
WHEN
The request action is SEND
THEN
Set IT export spawn flag to TRUE, generate message 23, and perform special manifest creation process
Context: IT bond cargo exists with TR-CREATED-FOR-IT not equal to 'Y' AND special manifest original flag is not set
GIVEN
IT bond cargo exists with TR-CREATED-FOR-IT not equal to 'Y' AND special manifest original flag is not set
Applied to: Generate IT Export Report Message
WHEN
The request action is REPORT
THEN
Generate message 24 for IT export reporting
Context: Cargo is found with TR bond type AND cargo location ID does not match train crossing port
GIVEN
Cargo is found with TR bond type AND cargo location ID does not match train crossing port
Applied to: Create TR Diversion Special Manifest
WHEN
The request action is SEND AND user is authorized for special manifests
THEN
Set diversion spawn flag to TRUE, generate message 20, and perform special manifest creation process
Applied to: Generate TR Diversion Report Message
WHEN
The request action is REPORT
THEN
Generate message 19 with station code information for TR bond diversion reporting
Context: Cargo is found with TE bond type AND TR-CREATED-FOR-IT is SPACES AND cargo status is not export AND cargo is billed as CPRS AND cargo location ID1 does not match train crossing port
GIVEN
Cargo is found with TE bond type AND TR-CREATED-FOR-IT is SPACES AND cargo status is not export AND cargo is billed as CPRS AND cargo location ID1 does not match train crossing port
Applied to: Create TE Port Change Special Manifest
WHEN
The request action is SEND AND user is authorized for special manifests
THEN
Set port change spawn flag to TRUE, generate message 20, and perform special manifest creation process
Applied to: Generate TE Port Change Report Message
WHEN
The request action is REPORT
THEN
Generate message 19 with station code information for TE bond port change reporting
Context: Waybill is found with no cargo AND origin and destination are both US states AND equipment is loaded or has residue weight with ER found
GIVEN
Waybill is found with no cargo AND origin and destination are both US states AND equipment is loaded or has residue weight with ER found
Applied to: Create US-US Detour Special Manifest
WHEN
The request action is SEND AND user is authorized for special manifests
THEN
Set US-US detour spawn flag to TRUE, generate message 23, and perform special manifest creation process
Applied to: Generate US-US Detour Report Message
WHEN
The request action is REPORT
THEN
Generate message 18 for US-US movement detour reporting
Context: Cargo is found with export type AND origin-destination country codes are 'USMX' AND special manifest flag is SPACES AND not at Laredo TX station
GIVEN
Cargo is found with export type AND origin-destination country codes are 'USMX' AND special manifest flag is SPACES AND not at Laredo TX station
Applied to: Create US-Mexico Export Special Manifest
WHEN
The request action is SEND AND user is authorized for special manifests
THEN
Set 88-TR detour spawn flag to TRUE, generate message 23, and perform special manifest creation process
Applied to: Generate US-Mexico Export Report Message
WHEN
The request action is REPORT
THEN
Generate message 50 for US-Mexico export reporting
Context: Cargo is found with default type AND TR-CREATED-FOR-IT is SPACES AND special manifest original flag is not set
GIVEN
Cargo is found with default type AND TR-CREATED-FOR-IT is SPACES AND special manifest original flag is not set
Applied to: Create Border Clearance Special Manifest
WHEN
Cargo status equals release status AND request action is SEND AND user is authorized for special manifests
THEN
Set detour spawn flag to TRUE, generate message 23, and perform special manifest creation process
Applied to: Generate Invalid Status Message
WHEN
Cargo status does not equal release status
THEN
Generate message 31 for invalid cargo status
Context: A special manifest needs to be created for any cargo type
GIVEN
A special manifest needs to be created for any cargo type
Applied to: Set Special Manifest Parameters
WHEN
Special manifest creation is triggered
THEN
Set high-values security byte, set 'US' record type code, set border code from station crossing port, set border name from station name, and set CCN from cargo CCN key
Context: Special manifest parameters are configured
GIVEN
Special manifest parameters are configured
Applied to: Determine Manifest Type
WHEN
Evaluating spawn type flags
THEN
Set diversion flag for diversion spawn, set IT export flag for IT export spawn, set change port flag for port change spawn, set IT export flag for detour spawn, set US-US detour flag for US-US detour spawn, or set export TR flag for 88-TR detour spawn
Context: Special manifest type is determined
GIVEN
Special manifest type is determined
Applied to: Set Equipment and Waybill Information
WHEN
Setting equipment and waybill information
THEN
Set equipment ID from current equipment ID, set waybill number from cargo waybill index, and set waybill date from cargo waybill date index
Context: Special manifest is fully configured with all required parameters
GIVEN
Special manifest is fully configured with all required parameters
Applied to: Queue Special Manifest for Processing
WHEN
Queuing manifest for processing
THEN
Increment report spawn count by 1 and store special manifest input parameters in working storage spawn table
R-GCX003-cbl-00254 (+12) File: GCX003.cbl Cargo Status Validation Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Validation':
  • Context - a cargo record exists and has been retrieved for processing:
    For Is Cargo Empty Residue?:
    When the cargo is classified as empty residue type, then skip all cargo status validations and proceed to completion.
  • Context - a cargo record exists and is not empty residue type:
    For Is Cargo Empty Equipment?:
    When the cargo is classified as empty equipment type, then skip all cargo status validations and proceed to completion.
  • Context - a cargo record exists and is not empty residue or empty equipment:
    For Is Cargo Pending?:
    When the cargo status is pending, deleted, or in error state, then generate cargo status error message and halt processing for this cargo.
  • Context - cargo has been found and passed initial status checks:
    For Is TR Bond with Export Status?:
    When the cargo has tr bond type and the cargo status description indicates export status, then generate tr bond export error message.
  • Context - cargo has mt bond type and vessel name is not 'train' or spaces:
    For Is MT Bond at Wrong Location?:
    When the train crossing port does not match the cargo location id, then generate mt bond location error message.
  • Context - cargo has te bond type:
    For Is TE Bond with Wrong Vessel?:
    When the vessel name does not have 't' in position 23, then generate te bond vessel error message.
  • Context - cargo does not have te or mt bond type:
    For Is Non-TE/MT Bond with Wrong Vessel?:
    When the vessel name is not 'train', then generate vessel type error message.
  • Context - cargo has been found and passed bond validation checks:
    For Is Cargo at Laredo Station?:
    When the train crossing port is laredo tx station, then perform dsp hold status checks and documentation validations.
  • Context - cargo is being processed at laredo station and cargo description indicates border hold status:
    For Is Border Hold Status?:
    When dsp hold is also applied to the cargo, then generate dsp hold error message for border hold cargo.
  • Context - cargo is being processed at laredo station and does not have border hold status:
    For Is DSP Hold Applied?:
    When dsp hold is applied to the cargo, then generate dsp hold warning message.
  • Context - cargo is being processed at laredo station and dsp hold is not applied:
    For Is Border Hold Status?:
    When the cargo description indicates border hold status, then generate border hold error message.
  • Context - cargo is being processed at laredo station and segment 02 data is available:
    For Is FEN Documentation Missing?:
    When fen reference number qualifier is not found in the segment data, then generate fen missing warning message.
    For Is KCM Documentation Missing?:
    When kcm reference number qualifier is not found in the segment data, then generate kcm missing warning message.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists and has been retrieved for processing
GIVEN
A cargo record exists and has been retrieved for processing
Applied to: Is Cargo Empty Residue?
WHEN
The cargo is classified as empty residue type
THEN
Skip all cargo status validations and proceed to completion
Context: A cargo record exists and is not empty residue type
GIVEN
A cargo record exists and is not empty residue type
Applied to: Is Cargo Empty Equipment?
WHEN
The cargo is classified as empty equipment type
THEN
Skip all cargo status validations and proceed to completion
Context: A cargo record exists and is not empty residue or empty equipment
GIVEN
A cargo record exists and is not empty residue or empty equipment
Applied to: Is Cargo Pending?
WHEN
The cargo status is pending, deleted, or in error state
THEN
Generate cargo status error message and halt processing for this cargo
Context: Cargo has been found and passed initial status checks
GIVEN
Cargo has been found and passed initial status checks
Applied to: Is TR Bond with Export Status?
WHEN
The cargo has TR bond type and the cargo status description indicates export status
THEN
Generate TR bond export error message
Context: Cargo has MT bond type and vessel name is not 'TRAIN' or spaces
GIVEN
Cargo has MT bond type and vessel name is not 'TRAIN' or spaces
Applied to: Is MT Bond at Wrong Location?
WHEN
The train crossing port does not match the cargo location ID
THEN
Generate MT bond location error message
Context: Cargo has TE bond type
GIVEN
Cargo has TE bond type
Applied to: Is TE Bond with Wrong Vessel?
WHEN
The vessel name does not have 'T' in position 23
THEN
Generate TE bond vessel error message
Context: Cargo does not have TE or MT bond type
GIVEN
Cargo does not have TE or MT bond type
Applied to: Is Non-TE/MT Bond with Wrong Vessel?
WHEN
The vessel name is not 'TRAIN'
THEN
Generate vessel type error message
Context: Cargo has been found and passed bond validation checks
GIVEN
Cargo has been found and passed bond validation checks
Applied to: Is Cargo at Laredo Station?
WHEN
The train crossing port is Laredo TX station
THEN
Perform DSP hold status checks and documentation validations
Context: Cargo is being processed at Laredo station and cargo description indicates border hold status
GIVEN
Cargo is being processed at Laredo station and cargo description indicates border hold status
Applied to: Is Border Hold Status?
WHEN
DSP hold is also applied to the cargo
THEN
Generate DSP hold error message for border hold cargo
Context: Cargo is being processed at Laredo station and does not have border hold status
GIVEN
Cargo is being processed at Laredo station and does not have border hold status
Applied to: Is DSP Hold Applied?
WHEN
DSP hold is applied to the cargo
THEN
Generate DSP hold warning message
Context: Cargo is being processed at Laredo station and DSP hold is not applied
GIVEN
Cargo is being processed at Laredo station and DSP hold is not applied
Applied to: Is Border Hold Status?
WHEN
The cargo description indicates border hold status
THEN
Generate border hold error message
Context: Cargo is being processed at Laredo station and segment 02 data is available
GIVEN
Cargo is being processed at Laredo station and segment 02 data is available
Applied to: Is FEN Documentation Missing?
WHEN
FEN reference number qualifier is not found in the segment data
THEN
Generate FEN missing warning message
Applied to: Is KCM Documentation Missing?
WHEN
KCM reference number qualifier is not found in the segment data
THEN
Generate KCM missing warning message
R-GCX003-cbl-00267 (+4) File: GCX003.cbl Bill Type Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bill Type Validation':
  • Context - cargo is found and has valid bill type information:
    For Set Paper 7512 US-CA-US Message:
    When the cargo bill type code equals '15', then set the cargo information message to 'ppr 7512 15 us-ca-us'.
  • Context - cargo is found with in-bond type code and bond number information available:
    For Format AMS Bond Message with Bond Number:
    When the in-bond type code is 'it' or 'ie', then format cargo information as 'ams' followed by the in-bond type code and bond number.
    For Format AMS 7512 Bond Message with Bond Number:
    When the in-bond type code is 'te', 'tr', or 'mt', then format cargo information as 'ams 7512' followed by the in-bond type code and bond number.
  • Context - cargo is found with bill type information:
    For Apply Default Bill Type Processing:
    When the cargo is classified as empty equipment or empty residue, then set cargo information to 'empty', set load/empty indicator to 'e', and adjust equipment counters from loaded to empty.
  • Context - cargo is found and segment 07 data is available and cargo information is currently blank:
    For Accept Bill Type:
    When no specific bill type formatting rules apply and segment data contains valid information, then extract and format cargo description from segment data into the cargo information field.
👨‍💻 Technical ACs (Gherkin)
Context: Cargo is found and has valid bill type information
GIVEN
Cargo is found and has valid bill type information
Applied to: Set Paper 7512 US-CA-US Message
WHEN
The cargo bill type code equals '15'
THEN
Set the cargo information message to 'PPR 7512 15 US-CA-US'
Context: Cargo is found with in-bond type code and bond number information available
GIVEN
Cargo is found with in-bond type code and bond number information available
Applied to: Format AMS Bond Message with Bond Number
WHEN
The in-bond type code is 'IT' or 'IE'
THEN
Format cargo information as 'AMS' followed by the in-bond type code and bond number
Applied to: Format AMS 7512 Bond Message with Bond Number
WHEN
The in-bond type code is 'TE', 'TR', or 'MT'
THEN
Format cargo information as 'AMS 7512' followed by the in-bond type code and bond number
Context: Cargo is found with bill type information
GIVEN
Cargo is found with bill type information
Applied to: Apply Default Bill Type Processing
WHEN
The cargo is classified as empty equipment or empty residue
THEN
Set cargo information to 'EMPTY', set load/empty indicator to 'E', and adjust equipment counters from loaded to empty
Context: Cargo is found and segment 07 data is available and cargo information is currently blank
GIVEN
Cargo is found and segment 07 data is available and cargo information is currently blank
Applied to: Accept Bill Type
WHEN
No specific bill type formatting rules apply and segment data contains valid information
THEN
Extract and format cargo description from segment data into the cargo information field
R-GCX003-cbl-00272 (+4) File: GCX003.cbl Equipment Load Status Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Load Status Validation':
  • Context - an equipment item is being processed for a train manifest:
    For Generate Error Message - Missing Waybill for Loaded Equipment:
    When the equipment is marked as loaded and no waybill is found and the equipment is not an sbu van unit, then generate error message msg-ten indicating missing waybill for loaded equipment.
  • Context - an equipment item has an associated waybill:
    For Generate Error Message - Missing Cargo for Loaded Equipment:
    When no cargo records are found for the equipment and the equipment is marked as loaded and the equipment is not a conveying car and the equipment is not an idler car, then generate error message msg-fifteen indicating missing cargo records for loaded equipment with waybill and date information.
  • Context - an equipment item is being processed for cargo validation:
    For Equipment Validation Passed:
    When the equipment load/empty indicator shows the equipment is empty, then skip cargo validation checks and mark equipment validation as passed.
  • Context - an equipment item is marked as loaded but has no waybill:
    For Equipment Validation Passed:
    When the equipment is classified as an sbu van unit, then exempt the equipment from waybill requirement validation and mark validation as passed.
  • Context - an equipment item has a waybill but no cargo records are found:
    For Equipment Validation Passed:
    When the equipment is classified as a conveying car, then exempt the equipment from cargo record requirement validation and mark validation as passed.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed for a train manifest
GIVEN
An equipment item is being processed for a train manifest
Applied to: Generate Error Message - Missing Waybill for Loaded Equipment
WHEN
The equipment is marked as loaded AND no waybill is found AND the equipment is not an SBU Van unit
THEN
Generate error message MSG-TEN indicating missing waybill for loaded equipment
Context: An equipment item has an associated waybill
GIVEN
An equipment item has an associated waybill
Applied to: Generate Error Message - Missing Cargo for Loaded Equipment
WHEN
No cargo records are found for the equipment AND the equipment is marked as loaded AND the equipment is not a conveying car AND the equipment is not an idler car
THEN
Generate error message MSG-FIFTEEN indicating missing cargo records for loaded equipment with waybill and date information
Context: An equipment item is being processed for cargo validation
GIVEN
An equipment item is being processed for cargo validation
Applied to: Equipment Validation Passed
WHEN
The equipment load/empty indicator shows the equipment is empty
THEN
Skip cargo validation checks and mark equipment validation as passed
Context: An equipment item is marked as loaded but has no waybill
GIVEN
An equipment item is marked as loaded but has no waybill
Applied to: Equipment Validation Passed
WHEN
The equipment is classified as an SBU Van unit
THEN
Exempt the equipment from waybill requirement validation and mark validation as passed
Context: An equipment item has a waybill but no cargo records are found
GIVEN
An equipment item has a waybill but no cargo records are found
Applied to: Equipment Validation Passed
WHEN
The equipment is classified as a conveying car
THEN
Exempt the equipment from cargo record requirement validation and mark validation as passed
R-GCX003-cbl-00277 (+22) File: GCX003.cbl Mexico Customs Documentation Check Merged 23 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Mexico Customs Documentation Check':
  • Context - a cargo processing request is being evaluated:
    For Is Cargo Found?:
    When the system checks for cargo existence, then if no cargo is found, skip mexico customs documentation validation and continue with next processing step.
  • Context - cargo is found and being processed:
    For Is Train Origin Laredo TX Station?:
    When the system evaluates the train crossing station, then if the crossing station is not laredo tx, skip mexico customs documentation validation.
  • Context - cargo is found and train origin is laredo tx station:
    For Is Segment 02 Data Found?:
    When the system checks for segment 02 reference data availability, then if segment 02 data is not found or empty, skip mexico customs documentation validation.
  • Context - segment 02 data is available for processing:
    For Initialize FEN and KCM Flags as Not Found:
    When the system begins mexico customs documentation validation, then set fen documentation flag to not found and kcm documentation flag to not found.
  • Context - system is processing segment 02 reference numbers:
    For Reference Number Qualifier = 'FEN'?:
    When a reference number qualifier equals 'fen', then check if the corresponding reference number value is not empty.
    For Reference Number Qualifier = 'KCM'?:
    When a reference number qualifier equals 'kcm', then check if the corresponding reference number value is not empty.
    For More Reference Numbers?:
    When current reference number processing is complete, then if more reference numbers exist, continue processing next reference number, otherwise proceed to documentation validation.
  • Context - a reference number qualifier is identified as 'fen':
    For Reference Number Not Empty?:
    When the system validates the reference number value, then if the reference number is not empty or low-values, set fen found flag to true.
  • Context - fen reference qualifier is found with valid reference number value:
    For Set FEN Found Flag:
    When the system processes the fen documentation, then set the fen found flag to indicate required documentation is present.
  • Context - a reference number qualifier is identified as 'kcm':
    For Reference Number Not Empty?:
    When the system validates the reference number value, then if the reference number is not empty or low-values, set kcm found flag to true.
  • Context - kcm reference qualifier is found with valid reference number value:
    For Set KCM Found Flag:
    When the system processes the kcm documentation, then set the kcm found flag to indicate required documentation is present.
  • Context - all reference numbers have been processed:
    For Is Cargo Hold at Border Status?:
    When the system evaluates cargo status conditions, then if cargo short description equals hold at border status, check for dsp hold application.
  • Context - cargo has hold at border status:
    For Is DSP Hold Applied?:
    When the system checks dsp hold application, then if dsp hold is applied, generate message 52 for hold at border with dsp hold.
  • Context - cargo has hold at border status and dsp hold is applied:
    For Generate Message 52: Hold at Border with DSP Hold:
    When the system processes the combined hold conditions, then generate message 52 indicating hold at border status with dsp hold applied.
  • Context - cargo does not have hold at border status:
    For Is DSP Hold Applied Only?:
    When the system checks for dsp hold application, then if dsp hold is applied, generate message 49 for dsp hold applied.
  • Context - cargo has dsp hold applied but no hold at border status:
    For Generate Message 49: DSP Hold Applied:
    When the system processes the dsp hold condition, then generate message 49 indicating dsp hold is applied.
  • Context - cargo has hold at border status but dsp hold is not applied:
    For Is Hold at Border Status Only?:
    When the system evaluates the hold at border condition, then generate message 48 for hold at border status.
  • Context - cargo has hold at border status but no dsp hold applied:
    For Generate Message 48: Hold at Border Status:
    When the system processes the hold at border condition, then generate message 48 indicating hold at border status.
  • Context - all hold status conditions have been processed:
    For Is FEN Documentation Missing?:
    When the system validates fen documentation presence, then if fen documentation is not found, generate message 46 for missing fen documentation.
  • Context - fen documentation is not found in cargo data:
    For Generate Message 46: FEN Documentation Required:
    When the system validates mexico customs documentation requirements, then generate message 46 indicating fen documentation is required.
  • Context - fen documentation validation is complete:
    For Is KCM Documentation Missing?:
    When the system validates kcm documentation presence, then if kcm documentation is not found, generate message 47 for missing kcm documentation.
  • Context - kcm documentation is not found in cargo data:
    For Generate Message 47: KCM Documentation Required:
    When the system validates mexico customs documentation requirements, then generate message 47 indicating kcm documentation is required.
  • Context - all mexico customs documentation validation is complete:
    For Continue Processing:
    When the system has processed all required documentation checks, then continue with normal cargo processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing request is being evaluated
GIVEN
A cargo processing request is being evaluated
Applied to: Is Cargo Found?
WHEN
The system checks for cargo existence
THEN
If no cargo is found, skip Mexico customs documentation validation and continue with next processing step
Context: Cargo is found and being processed
GIVEN
Cargo is found and being processed
Applied to: Is Train Origin Laredo TX Station?
WHEN
The system evaluates the train crossing station
THEN
If the crossing station is not Laredo TX, skip Mexico customs documentation validation
Context: Cargo is found and train origin is Laredo TX station
GIVEN
Cargo is found and train origin is Laredo TX station
Applied to: Is Segment 02 Data Found?
WHEN
The system checks for segment 02 reference data availability
THEN
If segment 02 data is not found or empty, skip Mexico customs documentation validation
Context: Segment 02 data is available for processing
GIVEN
Segment 02 data is available for processing
Applied to: Initialize FEN and KCM Flags as Not Found
WHEN
The system begins Mexico customs documentation validation
THEN
Set FEN documentation flag to not found and KCM documentation flag to not found
Context: System is processing segment 02 reference numbers
GIVEN
System is processing segment 02 reference numbers
Applied to: Reference Number Qualifier = 'FEN'?
WHEN
A reference number qualifier equals 'FEN'
THEN
Check if the corresponding reference number value is not empty
Applied to: Reference Number Qualifier = 'KCM'?
WHEN
A reference number qualifier equals 'KCM'
THEN
Check if the corresponding reference number value is not empty
Applied to: More Reference Numbers?
WHEN
Current reference number processing is complete
THEN
If more reference numbers exist, continue processing next reference number, otherwise proceed to documentation validation
Context: A reference number qualifier is identified as 'FEN'
GIVEN
A reference number qualifier is identified as 'FEN'
Applied to: Reference Number Not Empty?
WHEN
The system validates the reference number value
THEN
If the reference number is not empty or low-values, set FEN found flag to true
Context: FEN reference qualifier is found with valid reference number value
GIVEN
FEN reference qualifier is found with valid reference number value
Applied to: Set FEN Found Flag
WHEN
The system processes the FEN documentation
THEN
Set the FEN found flag to indicate required documentation is present
Context: A reference number qualifier is identified as 'KCM'
GIVEN
A reference number qualifier is identified as 'KCM'
Applied to: Reference Number Not Empty?
WHEN
The system validates the reference number value
THEN
If the reference number is not empty or low-values, set KCM found flag to true
Context: KCM reference qualifier is found with valid reference number value
GIVEN
KCM reference qualifier is found with valid reference number value
Applied to: Set KCM Found Flag
WHEN
The system processes the KCM documentation
THEN
Set the KCM found flag to indicate required documentation is present
Context: All reference numbers have been processed
GIVEN
All reference numbers have been processed
Applied to: Is Cargo Hold at Border Status?
WHEN
The system evaluates cargo status conditions
THEN
If cargo short description equals hold at border status, check for DSP hold application
Context: Cargo has hold at border status
GIVEN
Cargo has hold at border status
Applied to: Is DSP Hold Applied?
WHEN
The system checks DSP hold application
THEN
If DSP hold is applied, generate message 52 for hold at border with DSP hold
Context: Cargo has hold at border status and DSP hold is applied
GIVEN
Cargo has hold at border status and DSP hold is applied
Applied to: Generate Message 52: Hold at Border with DSP Hold
WHEN
The system processes the combined hold conditions
THEN
Generate message 52 indicating hold at border status with DSP hold applied
Context: Cargo does not have hold at border status
GIVEN
Cargo does not have hold at border status
Applied to: Is DSP Hold Applied Only?
WHEN
The system checks for DSP hold application
THEN
If DSP hold is applied, generate message 49 for DSP hold applied
Context: Cargo has DSP hold applied but no hold at border status
GIVEN
Cargo has DSP hold applied but no hold at border status
Applied to: Generate Message 49: DSP Hold Applied
WHEN
The system processes the DSP hold condition
THEN
Generate message 49 indicating DSP hold is applied
Context: Cargo has hold at border status but DSP hold is not applied
GIVEN
Cargo has hold at border status but DSP hold is not applied
Applied to: Is Hold at Border Status Only?
WHEN
The system evaluates the hold at border condition
THEN
Generate message 48 for hold at border status
Context: Cargo has hold at border status but no DSP hold applied
GIVEN
Cargo has hold at border status but no DSP hold applied
Applied to: Generate Message 48: Hold at Border Status
WHEN
The system processes the hold at border condition
THEN
Generate message 48 indicating hold at border status
Context: All hold status conditions have been processed
GIVEN
All hold status conditions have been processed
Applied to: Is FEN Documentation Missing?
WHEN
The system validates FEN documentation presence
THEN
If FEN documentation is not found, generate message 46 for missing FEN documentation
Context: FEN documentation is not found in cargo data
GIVEN
FEN documentation is not found in cargo data
Applied to: Generate Message 46: FEN Documentation Required
WHEN
The system validates Mexico customs documentation requirements
THEN
Generate message 46 indicating FEN documentation is required
Context: FEN documentation validation is complete
GIVEN
FEN documentation validation is complete
Applied to: Is KCM Documentation Missing?
WHEN
The system validates KCM documentation presence
THEN
If KCM documentation is not found, generate message 47 for missing KCM documentation
Context: KCM documentation is not found in cargo data
GIVEN
KCM documentation is not found in cargo data
Applied to: Generate Message 47: KCM Documentation Required
WHEN
The system validates Mexico customs documentation requirements
THEN
Generate message 47 indicating KCM documentation is required
Context: All Mexico customs documentation validation is complete
GIVEN
All Mexico customs documentation validation is complete
Applied to: Continue Processing
WHEN
The system has processed all required documentation checks
THEN
Continue with normal cargo processing workflow
R-GCX003-cbl-00300 (+15) File: GCX003.cbl Detour Processing Coordination Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Detour Processing Coordination':
  • Context - a detour processing request is initiated:
    For Cargo Found?:
    When the system checks for cargo existence, then if cargo is found, proceed to bond type evaluation, otherwise process as original us-us movement.
  • Context - cargo is found and bond type is transport export (te):
    For TE Bond Detour Processing:
    When the system processes te bond detour requirements, then execute te bond specific detour processing logic including port change validation.
  • Context - cargo is found and bond type is transit (tr):
    For TR Bond Detour Processing:
    When the system processes tr bond detour requirements, then execute tr bond specific detour processing logic including release status validation.
  • Context - cargo is found and requires border clearance processing:
    For Border Clearance Detour Processing:
    When the system processes border clearance detour requirements, then execute border clearance specific detour processing logic including release status validation.
  • Context - cargo is found and is us to mexico export type:
    For US-Mexico Export Detour Processing:
    When the system processes us-mexico export detour requirements, then execute us-mexico export specific detour processing logic including special manifest validation.
  • Context - no cargo is found or cargo requires us domestic movement processing:
    For Original US-US Movement Detour Processing:
    When the system processes us-us movement detour requirements, then execute us domestic movement specific detour processing logic.
  • Context - transport export cargo is being processed and cargo is not created for it and cargo status is not export and cargo is billed as cprs:
    For TE Bond: Port Change Required?:
    When the system checks if cargo location does not match the train crossing port, then if locations do not match, require port change processing, otherwise skip port change.
  • Context - a special manifest creation is required for detour processing:
    For User Authorized for Special Manifest?:
    When the system validates user authorization for special manifests, then if user is not authorized, generate error message 43 and report message, otherwise proceed with special manifest creation.
  • Context - user is authorized and port change is required for te bond cargo and action is send:
    For Create Port Change Special Manifest:
    When the system creates a port change special manifest, then generate message 20, set port change spawn flag, and invoke special manifest creation process.
  • Context - transit bond cargo is being processed and cargo is not created for it:
    For TR Bond: Release Status Check:
    When the system checks if cargo status equals release status, then if status matches release, proceed with tr detour processing, otherwise skip.
  • Context - user is authorized and tr bond release status is valid and action is send:
    For Create TR Detour Special Manifest:
    When the system creates a tr detour special manifest, then generate message 23, set detour spawn flag, and invoke special manifest creation process.
  • Context - border clearance cargo is being processed and cargo is not created for it:
    For Border Clearance: Release Status Check:
    When the system checks cargo release status, then if status equals release, proceed with border clearance detour, if invalid status generate message 31, otherwise skip.
  • Context - user is authorized and border clearance release status is valid and action is send:
    For Create Border Clearance Special Manifest:
    When the system creates a border clearance special manifest, then generate message 23, set detour spawn flag, and invoke special manifest creation process.
  • Context - us-mexico export cargo is being processed:
    For US-MX Export: Special Manifest Check:
    When the system checks if special manifest field is empty, then if special manifest is empty, proceed with export detour processing, otherwise skip.
  • Context - user is authorized and us-mexico export requires special manifest and action is send:
    For Create US-MX Export Special Manifest:
    When the system creates a us-mexico export special manifest, then generate message 23, set 88-tr detour spawn flag, and invoke special manifest creation process.
  • Context - user is authorized and us-us detour is required and action is send:
    For Create US-US Detour Special Manifest:
    When the system creates a us-us detour special manifest, then generate message 23, set us-us detour spawn flag, and invoke special manifest creation process.
👨‍💻 Technical ACs (Gherkin)
Context: A detour processing request is initiated
GIVEN
A detour processing request is initiated
Applied to: Cargo Found?
WHEN
The system checks for cargo existence
THEN
If cargo is found, proceed to bond type evaluation, otherwise process as original US-US movement
Context: Cargo is found and bond type is Transport Export (TE)
GIVEN
Cargo is found and bond type is Transport Export (TE)
Applied to: TE Bond Detour Processing
WHEN
The system processes TE bond detour requirements
THEN
Execute TE bond specific detour processing logic including port change validation
Context: Cargo is found and bond type is Transit (TR)
GIVEN
Cargo is found and bond type is Transit (TR)
Applied to: TR Bond Detour Processing
WHEN
The system processes TR bond detour requirements
THEN
Execute TR bond specific detour processing logic including release status validation
Context: Cargo is found and requires border clearance processing
GIVEN
Cargo is found and requires border clearance processing
Applied to: Border Clearance Detour Processing
WHEN
The system processes border clearance detour requirements
THEN
Execute border clearance specific detour processing logic including release status validation
Context: Cargo is found and is US to Mexico export type
GIVEN
Cargo is found and is US to Mexico export type
Applied to: US-Mexico Export Detour Processing
WHEN
The system processes US-Mexico export detour requirements
THEN
Execute US-Mexico export specific detour processing logic including special manifest validation
Context: No cargo is found or cargo requires US domestic movement processing
GIVEN
No cargo is found or cargo requires US domestic movement processing
Applied to: Original US-US Movement Detour Processing
WHEN
The system processes US-US movement detour requirements
THEN
Execute US domestic movement specific detour processing logic
Context: Transport Export cargo is being processed and cargo is not created for IT and cargo status is not export and cargo is billed as CPRS
GIVEN
Transport Export cargo is being processed and cargo is not created for IT and cargo status is not export and cargo is billed as CPRS
Applied to: TE Bond: Port Change Required?
WHEN
The system checks if cargo location does not match the train crossing port
THEN
If locations do not match, require port change processing, otherwise skip port change
Context: A special manifest creation is required for detour processing
GIVEN
A special manifest creation is required for detour processing
Applied to: User Authorized for Special Manifest?
WHEN
The system validates user authorization for special manifests
THEN
If user is not authorized, generate error message 43 and report message, otherwise proceed with special manifest creation
Context: User is authorized and port change is required for TE bond cargo and action is SEND
GIVEN
User is authorized and port change is required for TE bond cargo and action is SEND
Applied to: Create Port Change Special Manifest
WHEN
The system creates a port change special manifest
THEN
Generate message 20, set port change spawn flag, and invoke special manifest creation process
Context: Transit bond cargo is being processed and cargo is not created for IT
GIVEN
Transit bond cargo is being processed and cargo is not created for IT
Applied to: TR Bond: Release Status Check
WHEN
The system checks if cargo status equals release status
THEN
If status matches release, proceed with TR detour processing, otherwise skip
Context: User is authorized and TR bond release status is valid and action is SEND
GIVEN
User is authorized and TR bond release status is valid and action is SEND
Applied to: Create TR Detour Special Manifest
WHEN
The system creates a TR detour special manifest
THEN
Generate message 23, set detour spawn flag, and invoke special manifest creation process
Context: Border clearance cargo is being processed and cargo is not created for IT
GIVEN
Border clearance cargo is being processed and cargo is not created for IT
Applied to: Border Clearance: Release Status Check
WHEN
The system checks cargo release status
THEN
If status equals release, proceed with border clearance detour, if invalid status generate message 31, otherwise skip
Context: User is authorized and border clearance release status is valid and action is SEND
GIVEN
User is authorized and border clearance release status is valid and action is SEND
Applied to: Create Border Clearance Special Manifest
WHEN
The system creates a border clearance special manifest
THEN
Generate message 23, set detour spawn flag, and invoke special manifest creation process
Context: US-Mexico export cargo is being processed
GIVEN
US-Mexico export cargo is being processed
Applied to: US-MX Export: Special Manifest Check
WHEN
The system checks if special manifest field is empty
THEN
If special manifest is empty, proceed with export detour processing, otherwise skip
Context: User is authorized and US-Mexico export requires special manifest and action is SEND
GIVEN
User is authorized and US-Mexico export requires special manifest and action is SEND
Applied to: Create US-MX Export Special Manifest
WHEN
The system creates a US-Mexico export special manifest
THEN
Generate message 23, set 88-TR detour spawn flag, and invoke special manifest creation process
Context: User is authorized and US-US detour is required and action is SEND
GIVEN
User is authorized and US-US detour is required and action is SEND
Applied to: Create US-US Detour Special Manifest
WHEN
The system creates a US-US detour special manifest
THEN
Generate message 23, set US-US detour spawn flag, and invoke special manifest creation process
R-GCX003-cbl-00337 (+9) File: GCX003.cbl Border Clearance Detour Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Border Clearance Detour Processing':
  • Context - a cargo record exists with default manifest type:
    For Check if TR Created for IT = SPACES:
    When the system checks the tr created for it field, then processing continues only if tr created for it field is empty (spaces).
  • Context - a cargo record with tr created for it field as spaces:
    For Check Cargo Status Description:
    When the system evaluates the cargo short description status, then if status equals release, proceed with detour processing, otherwise generate invalid cargo status message.
  • Context - a cargo record with release status for border clearance:
    For Request Action Type?:
    When the system checks the request action type, then if action is report, generate detour report message; if action is send, check user authorization.
  • Context - a request action type of report for border clearance cargo:
    For Generate Message 18 - Detour Report:
    When the system processes the detour requirement, then generate message 18 indicating detour required and add to report output.
  • Context - a send request for border clearance cargo requiring special manifest:
    For User Authorized for Special Manifest?:
    When the system validates user special manifest authorization, then if user is not authorized, generate authorization error message; if authorized, proceed with manifest creation.
  • Context - a user without special manifest authorization attempting to send border clearance cargo:
    For Generate Message 43 - Not Authorized:
    When the system validates authorization permissions, then generate message 43 indicating user not authorized for special manifest and add to report output.
  • Context - an authorized user sending border clearance cargo requiring special manifest:
    For Generate Message 23 - Special Manifest Created:
    When the system creates the special manifest, then generate message 23 confirming special manifest creation and add to report output.
  • Context - an authorized special manifest creation for border clearance:
    For Set Detour Spawn Flag:
    When the system prepares for manifest generation, then set the detour spawn flag to true to trigger special manifest processing.
  • Context - a detour spawn flag set to true for border clearance:
    For Create Special Manifest:
    When the system processes the special manifest requirement, then call the special manifest creation procedure to generate the required documentation.
  • Context - a cargo record with tr created for it as spaces but cargo status not equal to release:
    For Generate Message 31 - Invalid Cargo Status:
    When the system validates cargo status for border clearance, then generate message 31 indicating invalid cargo status and add to report output.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with default manifest type
GIVEN
A cargo record exists with default manifest type
Applied to: Check if TR Created for IT = SPACES
WHEN
The system checks the TR created for IT field
THEN
Processing continues only if TR created for IT field is empty (SPACES)
Context: A cargo record with TR created for IT field as SPACES
GIVEN
A cargo record with TR created for IT field as SPACES
Applied to: Check Cargo Status Description
WHEN
The system evaluates the cargo short description status
THEN
If status equals RELEASE, proceed with detour processing, otherwise generate invalid cargo status message
Context: A cargo record with release status for border clearance
GIVEN
A cargo record with release status for border clearance
Applied to: Request Action Type?
WHEN
The system checks the request action type
THEN
If action is REPORT, generate detour report message; if action is SEND, check user authorization
Context: A request action type of REPORT for border clearance cargo
GIVEN
A request action type of REPORT for border clearance cargo
Applied to: Generate Message 18 - Detour Report
WHEN
The system processes the detour requirement
THEN
Generate message 18 indicating detour required and add to report output
Context: A SEND request for border clearance cargo requiring special manifest
GIVEN
A SEND request for border clearance cargo requiring special manifest
Applied to: User Authorized for Special Manifest?
WHEN
The system validates user special manifest authorization
THEN
If user is not authorized, generate authorization error message; if authorized, proceed with manifest creation
Context: A user without special manifest authorization attempting to send border clearance cargo
GIVEN
A user without special manifest authorization attempting to send border clearance cargo
Applied to: Generate Message 43 - Not Authorized
WHEN
The system validates authorization permissions
THEN
Generate message 43 indicating user not authorized for special manifest and add to report output
Context: An authorized user sending border clearance cargo requiring special manifest
GIVEN
An authorized user sending border clearance cargo requiring special manifest
Applied to: Generate Message 23 - Special Manifest Created
WHEN
The system creates the special manifest
THEN
Generate message 23 confirming special manifest creation and add to report output
Context: An authorized special manifest creation for border clearance
GIVEN
An authorized special manifest creation for border clearance
Applied to: Set Detour Spawn Flag
WHEN
The system prepares for manifest generation
THEN
Set the detour spawn flag to TRUE to trigger special manifest processing
Context: A detour spawn flag set to TRUE for border clearance
GIVEN
A detour spawn flag set to TRUE for border clearance
Applied to: Create Special Manifest
WHEN
The system processes the special manifest requirement
THEN
Call the special manifest creation procedure to generate the required documentation
Context: A cargo record with TR created for IT as SPACES but cargo status not equal to RELEASE
GIVEN
A cargo record with TR created for IT as SPACES but cargo status not equal to RELEASE
Applied to: Generate Message 31 - Invalid Cargo Status
WHEN
The system validates cargo status for border clearance
THEN
Generate message 31 indicating invalid cargo status and add to report output
R-GCX003-cbl-00347 (+16) File: GCX003.cbl US Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US':
  • Context - a waybill processing scenario exists:
    For Waybill Found AND No Cargo Found?:
    When the system checks if waybill is found and no cargo is found, then the system should proceed to us-us movement detour processing if both conditions are true, otherwise skip the processing.
  • Context - a us-us movement detour scenario is identified:
    For Request Action Type?:
    When the system evaluates the request action type, then the system should route to report generation if action is report, or to authorization check if action is send.
  • Context - a us-us movement detour scenario exists and request action is report:
    For Generate Warning Message 18: Original US-US Movement Detour Required:
    When the system processes the detour for reporting, then the system should generate warning message 18 indicating that an original us-us movement detour is required.
  • Context - a us-us movement detour scenario exists and request action is send:
    For User Authorized for Special Manifests?:
    When the system checks user authorization for special manifests, then the system should proceed with special manifest creation if authorized, otherwise generate an authorization error.
  • Context - a us-us movement detour scenario exists with send action and user lacks special manifest authorization:
    For Generate Error Message 43: User Not Authorized for Special Manifests:
    When the system processes the unauthorized special manifest request, then the system should generate error message 43 indicating the user is not authorized for special manifests.
  • Context - a us-us movement detour scenario exists with send action and user has special manifest authorization:
    For Generate Success Message 23: Special Manifest Will Be Created:
    When the system processes the authorized special manifest request, then the system should generate success message 23 indicating that a special manifest will be created.
  • Context - a us-us movement detour scenario requires special manifest creation:
    For Set US-US Detour Spawn Flag:
    When the system processes the detour request, then the system should set the us-us detour spawn flag to trigger subsequent special manifest processing.
  • Context - a us-us detour spawn flag is set:
    For Create Special Manifest Request:
    When the system initiates special manifest creation, then the system should create a special manifest request through the special manifest creation process.
  • Context - a cargo record exists with bill type code:
    For Check Export Bill Type 88?:
    When processing us-mexico export detour and bill type code is checked, then continue processing only if bill type code equals export type 88, otherwise skip processing.
  • Context - origin and destination country codes are available:
    For Check US-MX Country Codes?:
    When processing export detour for bill type 88, then continue processing only if origin-destination country codes equal 'usmx', otherwise skip processing.
  • Context - a cargo record with us-mexico export type 88:
    For Check Special 88 Manifest Flag?:
    When checking special manifest requirements, then continue processing if special 88 manifest flag is set, otherwise check if special manifest field is empty.
  • Context - a train crossing port station code:
    For Check Not Laredo Station?:
    When processing us-mexico export detour with special 88 manifest, then continue processing only if station is not laredo tx, otherwise skip detour processing.
  • Context - a cargo record for us-mexico export processing:
    For Check Special Manifest Empty?:
    When special manifest field is checked, then continue with detour processing if special manifest field is empty (spaces), otherwise skip processing.
  • Context - a valid us-mexico export detour scenario with empty special manifest:
    For Generate Report Message 50:
    When request action type is 'report', then generate message 50 and add to report without creating special manifest.
  • Context - a send action request for us-mexico export detour and user authorization status:
    For Generate Warning Message 43 - User Not Authorized:
    When user is not authorized for special manifests, then generate warning message 43 and skip special manifest creation.
  • Context - a send action request for us-mexico export detour with authorized user:
    For Generate Special Manifest Message 23:
    When user has special manifest authorization, then generate message 23, set 88-tr detour spawn flag, and create special manifest.
  • Context - a cargo record that doesn't meet export type 88 criteria:
    For Generate Error Message 31 - Invalid Status:
    When cargo status is invalid for us-mexico export processing, then generate error message 31 indicating invalid cargo status.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill processing scenario exists
GIVEN
A waybill processing scenario exists
Applied to: Waybill Found AND No Cargo Found?
WHEN
The system checks if waybill is found and no cargo is found
THEN
The system should proceed to US-US movement detour processing if both conditions are true, otherwise skip the processing
Context: A US-US movement detour scenario is identified
GIVEN
A US-US movement detour scenario is identified
Applied to: Request Action Type?
WHEN
The system evaluates the request action type
THEN
The system should route to report generation if action is REPORT, or to authorization check if action is SEND
Context: A US-US movement detour scenario exists and request action is REPORT
GIVEN
A US-US movement detour scenario exists and request action is REPORT
Applied to: Generate Warning Message 18: Original US-US Movement Detour Required
WHEN
The system processes the detour for reporting
THEN
The system should generate warning message 18 indicating that an original US-US movement detour is required
Context: A US-US movement detour scenario exists and request action is SEND
GIVEN
A US-US movement detour scenario exists and request action is SEND
Applied to: User Authorized for Special Manifests?
WHEN
The system checks user authorization for special manifests
THEN
The system should proceed with special manifest creation if authorized, otherwise generate an authorization error
Context: A US-US movement detour scenario exists with SEND action and user lacks special manifest authorization
GIVEN
A US-US movement detour scenario exists with SEND action and user lacks special manifest authorization
Applied to: Generate Error Message 43: User Not Authorized for Special Manifests
WHEN
The system processes the unauthorized special manifest request
THEN
The system should generate error message 43 indicating the user is not authorized for special manifests
Context: A US-US movement detour scenario exists with SEND action and user has special manifest authorization
GIVEN
A US-US movement detour scenario exists with SEND action and user has special manifest authorization
Applied to: Generate Success Message 23: Special Manifest Will Be Created
WHEN
The system processes the authorized special manifest request
THEN
The system should generate success message 23 indicating that a special manifest will be created
Context: A US-US movement detour scenario requires special manifest creation
GIVEN
A US-US movement detour scenario requires special manifest creation
Applied to: Set US-US Detour Spawn Flag
WHEN
The system processes the detour request
THEN
The system should set the US-US detour spawn flag to trigger subsequent special manifest processing
Context: A US-US detour spawn flag is set
GIVEN
A US-US detour spawn flag is set
Applied to: Create Special Manifest Request
WHEN
The system initiates special manifest creation
THEN
The system should create a special manifest request through the special manifest creation process
Context: A cargo record exists with bill type code
GIVEN
A cargo record exists with bill type code
Applied to: Check Export Bill Type 88?
WHEN
Processing US-Mexico export detour and bill type code is checked
THEN
Continue processing only if bill type code equals Export type 88, otherwise skip processing
Context: Origin and destination country codes are available
GIVEN
Origin and destination country codes are available
Applied to: Check US-MX Country Codes?
WHEN
Processing export detour for bill type 88
THEN
Continue processing only if origin-destination country codes equal 'USMX', otherwise skip processing
Context: A cargo record with US-Mexico export type 88
GIVEN
A cargo record with US-Mexico export type 88
Applied to: Check Special 88 Manifest Flag?
WHEN
Checking special manifest requirements
THEN
Continue processing if special 88 manifest flag is set, otherwise check if special manifest field is empty
Context: A train crossing port station code
GIVEN
A train crossing port station code
Applied to: Check Not Laredo Station?
WHEN
Processing US-Mexico export detour with special 88 manifest
THEN
Continue processing only if station is not Laredo TX, otherwise skip detour processing
Context: A cargo record for US-Mexico export processing
GIVEN
A cargo record for US-Mexico export processing
Applied to: Check Special Manifest Empty?
WHEN
Special manifest field is checked
THEN
Continue with detour processing if special manifest field is empty (spaces), otherwise skip processing
Context: A valid US-Mexico export detour scenario with empty special manifest
GIVEN
A valid US-Mexico export detour scenario with empty special manifest
Applied to: Generate Report Message 50
WHEN
Request action type is 'REPORT'
THEN
Generate message 50 and add to report without creating special manifest
Context: A send action request for US-Mexico export detour and user authorization status
GIVEN
A send action request for US-Mexico export detour and user authorization status
Applied to: Generate Warning Message 43 - User Not Authorized
WHEN
User is not authorized for special manifests
THEN
Generate warning message 43 and skip special manifest creation
Context: A send action request for US-Mexico export detour with authorized user
GIVEN
A send action request for US-Mexico export detour with authorized user
Applied to: Generate Special Manifest Message 23
WHEN
User has special manifest authorization
THEN
Generate message 23, set 88-TR detour spawn flag, and create special manifest
Context: A cargo record that doesn't meet export type 88 criteria
GIVEN
A cargo record that doesn't meet export type 88 criteria
Applied to: Generate Error Message 31 - Invalid Status
WHEN
Cargo status is invalid for US-Mexico export processing
THEN
Generate error message 31 indicating invalid cargo status
R-GCX003-cbl-00364 (+1) File: GCX003.cbl Geographic Route Validation Merged 2 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Geographic Route Validation':
  • Context - a waybill contains an origin state/province code:
    For Search State-Country Reference Table for Origin:
    When the system searches the state-country reference table for the origin state code, then if the origin state is found in the table, set the origin country code from the table entry, otherwise set the origin country code to spaces.
  • Context - a waybill contains a destination state/province code:
    For Search State-Country Reference Table for Destination:
    When the system searches the state-country reference table for the destination state code, then if the destination state is found in the table, set the destination country code from the table entry, otherwise set the destination country code to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill contains an origin state/province code
GIVEN
A waybill contains an origin state/province code
Applied to: Search State-Country Reference Table for Origin
WHEN
The system searches the state-country reference table for the origin state code
THEN
If the origin state is found in the table, set the origin country code from the table entry, otherwise set the origin country code to spaces
Context: A waybill contains a destination state/province code
GIVEN
A waybill contains a destination state/province code
Applied to: Search State-Country Reference Table for Destination
WHEN
The system searches the state-country reference table for the destination state code
THEN
If the destination state is found in the table, set the destination country code from the table entry, otherwise set the destination country code to spaces
R-GCX003-cbl-00366 (+10) File: GCX003.cbl Container on Flat Car Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container on Flat Car Processing':
  • Context - an equipment item is being processed for a train manifest:
    For Container Found or Conveying Car with Load?:
    When the system checks if the equipment has containers or is a conveying car with load status, then container processing is initiated if container is found or if equipment is a conveying car with loaded status, otherwise container processing is skipped.
  • Context - container processing is required for an equipment item:
    For Check if Container Not Found in Primary System:
    When the system determines that container was not found in the primary waybill system, then the system initiates container lookup in the fwswrwr container database.
  • Context - container information is not available from primary waybill system:
    For Retrieve Container from FWSWRWR Database:
    When the system searches the fwswrwr database using the waybill root key, then container segment information is retrieved if found in the database.
  • Context - container segment is found in fwswrwr database:
    For Get Next Container Equipment Record:
    When the system retrieves the next container equipment record using gnp function, then container equipment details are loaded for processing.
  • Context - a valid container equipment record is retrieved:
    For Move Container ID to Equipment ID:
    When the system processes the container information, then the container id is assigned to the working equipment id variable for further processing.
  • Context - a container has been processed for a rail car:
    For More Containers on This Car?:
    When the system checks for additional containers using inquiry system data, then processing continues with next container if more containers exist, otherwise container processing is marked complete.
  • Context - multiple containers exist on the same rail car:
    For Increment Container Sequence:
    When the system processes containers sequentially, then the container sequence counter is incremented to process the next container.
  • Context - a container id is retrieved from the sequence:
    For Valid Container ID?:
    When the system validates the container id, then processing continues if container id is not spaces or low-values, otherwise container processing is marked complete.
  • Context - container is not found in primary fwswrwr database:
    For Search FWIQ Container Cross-Reference:
    When the system searches the fwiq inquiry database using waybill information, then container cross-reference records are retrieved if they exist in the inquiry system.
  • Context - container cross-reference records are found in inquiry system:
    For Extract Container Information from Inquiry:
    When the system processes fwiqbotl records with 't/c xref' identifier, then container ids and associated waybill information are extracted and stored in container table.
  • Context - container processing is required but container is not found in any database:
    For Generate Container Not Found Error:
    When both fwswrwr and fwiq inquiry systems return no container information, then error message 11 is generated indicating container not found.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed for a train manifest
GIVEN
An equipment item is being processed for a train manifest
Applied to: Container Found or Conveying Car with Load?
WHEN
The system checks if the equipment has containers or is a conveying car with load status
THEN
Container processing is initiated if container is found OR if equipment is a conveying car with loaded status, otherwise container processing is skipped
Context: Container processing is required for an equipment item
GIVEN
Container processing is required for an equipment item
Applied to: Check if Container Not Found in Primary System
WHEN
The system determines that container was not found in the primary waybill system
THEN
The system initiates container lookup in the FWSWRWR container database
Context: Container information is not available from primary waybill system
GIVEN
Container information is not available from primary waybill system
Applied to: Retrieve Container from FWSWRWR Database
WHEN
The system searches the FWSWRWR database using the waybill root key
THEN
Container segment information is retrieved if found in the database
Context: Container segment is found in FWSWRWR database
GIVEN
Container segment is found in FWSWRWR database
Applied to: Get Next Container Equipment Record
WHEN
The system retrieves the next container equipment record using GNP function
THEN
Container equipment details are loaded for processing
Context: A valid container equipment record is retrieved
GIVEN
A valid container equipment record is retrieved
Applied to: Move Container ID to Equipment ID
WHEN
The system processes the container information
THEN
The container ID is assigned to the working equipment ID variable for further processing
Context: A container has been processed for a rail car
GIVEN
A container has been processed for a rail car
Applied to: More Containers on This Car?
WHEN
The system checks for additional containers using inquiry system data
THEN
Processing continues with next container if more containers exist, otherwise container processing is marked complete
Context: Multiple containers exist on the same rail car
GIVEN
Multiple containers exist on the same rail car
Applied to: Increment Container Sequence
WHEN
The system processes containers sequentially
THEN
The container sequence counter is incremented to process the next container
Context: A container ID is retrieved from the sequence
GIVEN
A container ID is retrieved from the sequence
Applied to: Valid Container ID?
WHEN
The system validates the container ID
THEN
Processing continues if container ID is not spaces or low-values, otherwise container processing is marked complete
Context: Container is not found in primary FWSWRWR database
GIVEN
Container is not found in primary FWSWRWR database
Applied to: Search FWIQ Container Cross-Reference
WHEN
The system searches the FWIQ inquiry database using waybill information
THEN
Container cross-reference records are retrieved if they exist in the inquiry system
Context: Container cross-reference records are found in inquiry system
GIVEN
Container cross-reference records are found in inquiry system
Applied to: Extract Container Information from Inquiry
WHEN
The system processes FWIQBOTL records with 'T/C XREF' identifier
THEN
Container IDs and associated waybill information are extracted and stored in container table
Context: Container processing is required but container is not found in any database
GIVEN
Container processing is required but container is not found in any database
Applied to: Generate Container Not Found Error
WHEN
Both FWSWRWR and FWIQ inquiry systems return no container information
THEN
Error message 11 is generated indicating container not found
R-GCX003-cbl-00377 (+30) File: GCX003.cbl Report Header and Summary Building Merged 31 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Header and Summary Building':
  • Context - a report is being finalized:
    For Set Report End Marker:
    When the current report line at index rpt-idx is blank, then set the report line as end of report marker.
    For Store Last Line Index:
    When the report processing reaches the end, then store the current rpt-idx as rpt-last-line and new-rpt-idx as new-rpt-last-line.
  • Context - a report header is being created:
    For Create Header Line 1 - Train Information:
    When setting up the first header line, then set rpt-header-line-1 flag to true for line 1.
    For Create Header Line 2 - User Information:
    When setting up the second header line, then set rpt-header-line-2 flag to true for line 2.
    For Create Header Line 3 - Action Type:
    When setting up the third header line, then set rpt-header-line-3 flag to true for line 3.
    For Create Header Line 4 - Train Details:
    When setting up the fourth header line, then set rpt-header-line-4 flag to true for line 4.
  • Context - a report header line 1 is being populated:
    For Set Train ID in Header:
    When adding train identification information, then move req-train-id to rpt-hdr-train-id for line 1.
    For Set Origin Station Name in Header:
    When adding origin station information, then move gcstbrt-sc-us-stat-name to rpt-hdr-origin for line 1.
  • Context - a report header line 2 is being populated:
    For Set User ID in Header:
    When adding user identification information, then move cc-acf2-userid from cccom to rpt-hdr-user-id for line 2.
    For Set Terminal ID in Header:
    When adding terminal identification information, then move cc-orig-lterm from cccom to rpt-hdr-lterm for line 2.
    For Set Processing Date in Header:
    When adding processing date information, then move cc-machine-date from cccom to rpt-hdr-date for line 2.
    For Set Processing Time in Header:
    When adding processing time information, then move cc-machine-hour and cc-machine-min from cccom to rpt-hdr-hour and rpt-hdr-min for line 2.
  • Context - a report header line 3 is being populated:
    For Request Action Type?:
    When the request action type is being evaluated, then branch to send action processing if req-action-send, report action processing if req-action-report, or other action processing for any other action type.
    For Set SEND Action Header:
    When the request action type is send, then perform c150-send-report-wrapup to set send-specific header information.
    For Set REPORT Action Header:
    When the request action type is report, then set rpt-hdr-report flag to true for line 3.
    For Set OTHER Action Header:
    When the request action type is neither send nor report, then move req-type to rpt-hdr-type for line 3 and set rpt-result-abort flag to true for line 3.
  • Context - a send or report action header is being configured:
    For Processing Status?:
    When the processing status needs to be determined, then check if there are no errors and no warnings to set result as no-msg, otherwise set result as msg with error and warning counts.
  • Context - a send action is being processed:
    For Set Result as SENT:
    When there are no errors (rpt-no-error) and no spawn processing (rpt-no-spawn), then set rpt-result-sent flag to true for line 3 and move rpt-warning-cnt to rpt-wrn-cnt1 for line 3.
    For Set Result as NOT SENT:
    When there are errors or spawn processing is required, then set rpt-result-no-sent flag to true for line 3, move rpt-warning-cnt to rpt-wrn-cnt2 for line 3, add rpt-spawn-cnt to rpt-error-cnt, and move rpt-error-cnt to rpt-err-cnt2 for line 3.
  • Context - an other action type is being processed:
    For Set Result as ABORTED:
    When the action is neither send nor report, then set rpt-result-abort flag to true for line 3.
  • Context - a report action header is being configured:
    For Add Warning Count to Header & Add Error Count to Header & Add DSP Count to Header:
    When there are errors or warnings (not rpt-no-error or not rpt-no-wrn), then move rpt-warning-cnt to rpt-wrn-cnt4 for line 3 and move rpt-error-cnt to rpt-err-cnt4 for line 3 and move rpt-dsp-cnt to rpt-dsp-cnt4 for line 3.
  • Context - a report header line 4 is being populated:
    For Set US Customs Train ID:
    When adding us customs train identification, then move gcwtl-m1005-us-cust-train-id to rpt-hdr-us-train-id for line 4.
    For Set ETA Year in Header:
    When adding eta year information, then move req-eta-year to rpt-hdr-eta-year for line 4.
    For Set ETA Month in Header:
    When adding eta month information, then move req-eta-month to rpt-hdr-eta-month for line 4.
    For Set ETA Day in Header:
    When adding eta day information, then move req-eta-day to rpt-hdr-eta-day for line 4.
    For Set ETA Hour in Header:
    When adding eta hour information, then move req-eta-hour to rpt-hdr-eta-hour for line 4.
    For Set ETA Minutes in Header:
    When adding eta minutes information, then move req-eta-min to rpt-hdr-eta-min for line 4.
  • Context - a report header is being finalized:
    For Create Detail Headers:
    When setting up detail section headers, then set rpt-det-header-1 flag to true for line 6 and rpt-det-header-2 flag to true for line 7.
  • Context - all report headers have been configured:
    For Copy Headers to Report Lines:
    When finalizing the report structure, then move rpt-line content for lines 1 through 5 to corresponding emi-text-line positions.
👨‍💻 Technical ACs (Gherkin)
Context: A report is being finalized
GIVEN
A report is being finalized
Applied to: Set Report End Marker
WHEN
The current report line at index RPT-IDX is blank
THEN
Set the report line as end of report marker
Applied to: Store Last Line Index
WHEN
The report processing reaches the end
THEN
Store the current RPT-IDX as RPT-LAST-LINE and NEW-RPT-IDX as NEW-RPT-LAST-LINE
Context: A report header is being created
GIVEN
A report header is being created
Applied to: Create Header Line 1 - Train Information
WHEN
Setting up the first header line
THEN
Set RPT-HEADER-LINE-1 flag to TRUE for line 1
Applied to: Create Header Line 2 - User Information
WHEN
Setting up the second header line
THEN
Set RPT-HEADER-LINE-2 flag to TRUE for line 2
Applied to: Create Header Line 3 - Action Type
WHEN
Setting up the third header line
THEN
Set RPT-HEADER-LINE-3 flag to TRUE for line 3
Applied to: Create Header Line 4 - Train Details
WHEN
Setting up the fourth header line
THEN
Set RPT-HEADER-LINE-4 flag to TRUE for line 4
Context: A report header line 1 is being populated
GIVEN
A report header line 1 is being populated
Applied to: Set Train ID in Header
WHEN
Adding train identification information
THEN
Move REQ-TRAIN-ID to RPT-HDR-TRAIN-ID for line 1
Applied to: Set Origin Station Name in Header
WHEN
Adding origin station information
THEN
Move GCSTBRT-SC-US-STAT-NAME to RPT-HDR-ORIGIN for line 1
Context: A report header line 2 is being populated
GIVEN
A report header line 2 is being populated
Applied to: Set User ID in Header
WHEN
Adding user identification information
THEN
Move CC-ACF2-USERID from CCCOM to RPT-HDR-USER-ID for line 2
Applied to: Set Terminal ID in Header
WHEN
Adding terminal identification information
THEN
Move CC-ORIG-LTERM from CCCOM to RPT-HDR-LTERM for line 2
Applied to: Set Processing Date in Header
WHEN
Adding processing date information
THEN
Move CC-MACHINE-DATE from CCCOM to RPT-HDR-DATE for line 2
Applied to: Set Processing Time in Header
WHEN
Adding processing time information
THEN
Move CC-MACHINE-HOUR and CC-MACHINE-MIN from CCCOM to RPT-HDR-HOUR and RPT-HDR-MIN for line 2
Context: A report header line 3 is being populated
GIVEN
A report header line 3 is being populated
Applied to: Request Action Type?
WHEN
The request action type is being evaluated
THEN
Branch to SEND action processing if REQ-ACTION-SEND, REPORT action processing if REQ-ACTION-REPORT, or OTHER action processing for any other action type
Applied to: Set SEND Action Header
WHEN
The request action type is SEND
THEN
Perform C150-SEND-REPORT-WRAPUP to set SEND-specific header information
Applied to: Set REPORT Action Header
WHEN
The request action type is REPORT
THEN
Set RPT-HDR-REPORT flag to TRUE for line 3
Applied to: Set OTHER Action Header
WHEN
The request action type is neither SEND nor REPORT
THEN
Move REQ-TYPE to RPT-HDR-TYPE for line 3 and set RPT-RESULT-ABORT flag to TRUE for line 3
Context: A SEND or REPORT action header is being configured
GIVEN
A SEND or REPORT action header is being configured
Applied to: Processing Status?
WHEN
The processing status needs to be determined
THEN
Check if there are no errors and no warnings to set result as NO-MSG, otherwise set result as MSG with error and warning counts
Context: A SEND action is being processed
GIVEN
A SEND action is being processed
Applied to: Set Result as SENT
WHEN
There are no errors (RPT-NO-ERROR) and no spawn processing (RPT-NO-SPAWN)
THEN
Set RPT-RESULT-SENT flag to TRUE for line 3 and move RPT-WARNING-CNT to RPT-WRN-CNT1 for line 3
Applied to: Set Result as NOT SENT
WHEN
There are errors or spawn processing is required
THEN
Set RPT-RESULT-NO-SENT flag to TRUE for line 3, move RPT-WARNING-CNT to RPT-WRN-CNT2 for line 3, add RPT-SPAWN-CNT to RPT-ERROR-CNT, and move RPT-ERROR-CNT to RPT-ERR-CNT2 for line 3
Context: An OTHER action type is being processed
GIVEN
An OTHER action type is being processed
Applied to: Set Result as ABORTED
WHEN
The action is neither SEND nor REPORT
THEN
Set RPT-RESULT-ABORT flag to TRUE for line 3
Context: A REPORT action header is being configured
GIVEN
A REPORT action header is being configured
Applied to: Add Warning Count to Header & Add Error Count to Header & Add DSP Count to Header
WHEN
There are errors or warnings (not RPT-NO-ERROR or not RPT-NO-WRN)
THEN
Move RPT-WARNING-CNT to RPT-WRN-CNT4 for line 3 AND Move RPT-ERROR-CNT to RPT-ERR-CNT4 for line 3 AND Move RPT-DSP-CNT to RPT-DSP-CNT4 for line 3
Context: A report header line 4 is being populated
GIVEN
A report header line 4 is being populated
Applied to: Set US Customs Train ID
WHEN
Adding US Customs train identification
THEN
Move GCWTL-M1005-US-CUST-TRAIN-ID to RPT-HDR-US-TRAIN-ID for line 4
Applied to: Set ETA Year in Header
WHEN
Adding ETA year information
THEN
Move REQ-ETA-YEAR to RPT-HDR-ETA-YEAR for line 4
Applied to: Set ETA Month in Header
WHEN
Adding ETA month information
THEN
Move REQ-ETA-MONTH to RPT-HDR-ETA-MONTH for line 4
Applied to: Set ETA Day in Header
WHEN
Adding ETA day information
THEN
Move REQ-ETA-DAY to RPT-HDR-ETA-DAY for line 4
Applied to: Set ETA Hour in Header
WHEN
Adding ETA hour information
THEN
Move REQ-ETA-HOUR to RPT-HDR-ETA-HOUR for line 4
Applied to: Set ETA Minutes in Header
WHEN
Adding ETA minutes information
THEN
Move REQ-ETA-MIN to RPT-HDR-ETA-MIN for line 4
Context: A report header is being finalized
GIVEN
A report header is being finalized
Applied to: Create Detail Headers
WHEN
Setting up detail section headers
THEN
Set RPT-DET-HEADER-1 flag to TRUE for line 6 and RPT-DET-HEADER-2 flag to TRUE for line 7
Context: All report headers have been configured
GIVEN
All report headers have been configured
Applied to: Copy Headers to Report Lines
WHEN
Finalizing the report structure
THEN
Move RPT-LINE content for lines 1 through 5 to corresponding EMI-TEXT-LINE positions
R-GCX003-cbl-00408 (+16) File: GCX003.cbl Train Database Record Creation Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Database Record Creation':
  • Context - a train record creation process is initiated:
    For Initialize Train Header Record:
    When the system begins creating a new train database record, then the train header record structure is initialized to empty values.
  • Context - a train header record is initialized and train request data is available:
    For Set Train Identification Data:
    When the system sets train identification data, then the train number, train day, train origin, and consist number are assigned to the train header record.
  • Context - train identification data is set and station information is validated:
    For Set Train Origin and Destination:
    When the system assigns station information to the train record, then the us station code, us station name, and firms code are populated in the train header.
  • Context - station information is assigned and eta data is validated:
    For Set Estimated Time of Arrival:
    When the system sets the estimated time of arrival, then the eta date and eta time are assigned to the train header record.
  • Context - eta information is set and aei send status is determined:
    For Set AEI Send Flag:
    When the system configures the aei send flag, then the aei send indicator is set to true if aei sending is enabled, otherwise set to false.
  • Context - aei send flag is configured:
    For Initialize Equipment Counter:
    When the system initializes equipment processing, then the equipment quantity counter is set to zero.
  • Context - equipment processing is in progress with current report index position:
    For More Equipment to Process?:
    When the system checks for more equipment to process, then continue processing if report index is within the last line limit and equipment table is not full, otherwise stop processing.
  • Context - more equipment exists to process and current report line contains equipment data:
    For Extract Equipment Details:
    When the system extracts equipment details, then equipment id is extracted from either container id or car identification fields, and equipment type information is captured.
  • Context - equipment details are extracted from the report line:
    For Determine Equipment Type:
    When the system determines equipment type, then equipment is classified as container if container id exists, otherwise classified as railcar using car identification.
  • Context - equipment type is determined and cargo information is available:
    For Set Load/Empty Status:
    When the system sets load/empty status, then status is set to 'e' (empty) if no cargo key exists, otherwise set to the load/empty indicator from the report line.
  • Context - equipment type is determined and load/empty status is set:
    For Store Equipment Information:
    When the system stores equipment information, then equipment id, equipment type, load/empty status, cargo key, and condition response code are stored in the equipment table at the current quantity position.
  • Context - equipment information is stored in the equipment table:
    For Increment Equipment Counter:
    When the system increments the equipment counter, then the equipment quantity counter is increased by one.
  • Context - equipment counter is incremented and current report index position is known:
    For Equipment Table Full?:
    When the system checks equipment table capacity, then if equipment quantity equals maximum capacity and more report lines exist, trigger system abend for table overflow, otherwise continue processing.
  • Context - all equipment is processed and train header is complete:
    For Insert Train Record to Database:
    When the system inserts the train record to database, then the train list record is inserted into the gcsutrt and gcsutdp database tables.
  • Context - train record insertion to database is attempted:
    For Database Insert Successful?:
    When the system validates database insert success, then if insertion is successful, continue processing, otherwise if record already exists trigger system abend.
  • Context - database insertion is validated as successful:
    For Train Record Created Successfully:
    When the system completes train record creation, then train record creation process is marked as successfully completed.
  • Context - database insertion fails or equipment table overflow occurs:
    For Database Insert Failed - Abend:
    When the system handles database insert failure, then system abend is triggered with appropriate error message.
👨‍💻 Technical ACs (Gherkin)
Context: A train record creation process is initiated
GIVEN
A train record creation process is initiated
Applied to: Initialize Train Header Record
WHEN
The system begins creating a new train database record
THEN
The train header record structure is initialized to empty values
Context: A train header record is initialized and train request data is available
GIVEN
A train header record is initialized and train request data is available
Applied to: Set Train Identification Data
WHEN
The system sets train identification data
THEN
The train number, train day, train origin, and consist number are assigned to the train header record
Context: Train identification data is set and station information is validated
GIVEN
Train identification data is set and station information is validated
Applied to: Set Train Origin and Destination
WHEN
The system assigns station information to the train record
THEN
The US station code, US station name, and FIRMS code are populated in the train header
Context: Station information is assigned and ETA data is validated
GIVEN
Station information is assigned and ETA data is validated
Applied to: Set Estimated Time of Arrival
WHEN
The system sets the estimated time of arrival
THEN
The ETA date and ETA time are assigned to the train header record
Context: ETA information is set and AEI send status is determined
GIVEN
ETA information is set and AEI send status is determined
Applied to: Set AEI Send Flag
WHEN
The system configures the AEI send flag
THEN
The AEI send indicator is set to true if AEI sending is enabled, otherwise set to false
Context: AEI send flag is configured
GIVEN
AEI send flag is configured
Applied to: Initialize Equipment Counter
WHEN
The system initializes equipment processing
THEN
The equipment quantity counter is set to zero
Context: Equipment processing is in progress with current report index position
GIVEN
Equipment processing is in progress with current report index position
Applied to: More Equipment to Process?
WHEN
The system checks for more equipment to process
THEN
Continue processing if report index is within the last line limit and equipment table is not full, otherwise stop processing
Context: More equipment exists to process and current report line contains equipment data
GIVEN
More equipment exists to process and current report line contains equipment data
Applied to: Extract Equipment Details
WHEN
The system extracts equipment details
THEN
Equipment ID is extracted from either container ID or car identification fields, and equipment type information is captured
Context: Equipment details are extracted from the report line
GIVEN
Equipment details are extracted from the report line
Applied to: Determine Equipment Type
WHEN
The system determines equipment type
THEN
Equipment is classified as container if container ID exists, otherwise classified as railcar using car identification
Context: Equipment type is determined and cargo information is available
GIVEN
Equipment type is determined and cargo information is available
Applied to: Set Load/Empty Status
WHEN
The system sets load/empty status
THEN
Status is set to 'E' (empty) if no cargo key exists, otherwise set to the load/empty indicator from the report line
Context: Equipment type is determined and load/empty status is set
GIVEN
Equipment type is determined and load/empty status is set
Applied to: Store Equipment Information
WHEN
The system stores equipment information
THEN
Equipment ID, equipment type, load/empty status, cargo key, and condition response code are stored in the equipment table at the current quantity position
Context: Equipment information is stored in the equipment table
GIVEN
Equipment information is stored in the equipment table
Applied to: Increment Equipment Counter
WHEN
The system increments the equipment counter
THEN
The equipment quantity counter is increased by one
Context: Equipment counter is incremented and current report index position is known
GIVEN
Equipment counter is incremented and current report index position is known
Applied to: Equipment Table Full?
WHEN
The system checks equipment table capacity
THEN
If equipment quantity equals maximum capacity and more report lines exist, trigger system abend for table overflow, otherwise continue processing
Context: All equipment is processed and train header is complete
GIVEN
All equipment is processed and train header is complete
Applied to: Insert Train Record to Database
WHEN
The system inserts the train record to database
THEN
The train list record is inserted into the GCSUTRT and GCSUTDP database tables
Context: Train record insertion to database is attempted
GIVEN
Train record insertion to database is attempted
Applied to: Database Insert Successful?
WHEN
The system validates database insert success
THEN
If insertion is successful, continue processing, otherwise if record already exists trigger system abend
Context: Database insertion is validated as successful
GIVEN
Database insertion is validated as successful
Applied to: Train Record Created Successfully
WHEN
The system completes train record creation
THEN
Train record creation process is marked as successfully completed
Context: Database insertion fails or equipment table overflow occurs
GIVEN
Database insertion fails or equipment table overflow occurs
Applied to: Database Insert Failed - Abend
WHEN
The system handles database insert failure
THEN
System abend is triggered with appropriate error message
R-GCX003-cbl-00425 (+11) File: GCX003.cbl Equipment Routing Classification Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Routing Classification':
  • Context - a waybill exists with routing information in rut-info fields:
    For Extract Routing Information from Waybill:
    When the system processes the waybill routing data, then the routing information is extracted into working storage and exclamation marks are replaced with spaces for proper parsing.
  • Context - equipment routing classification process is starting:
    For Initialize Route Search Variables:
    When the system begins route pattern analysis, then route search variables are initialized and route not found flag is set to true.
  • Context - equipment has routing information with csxt as first carrier, cprs as second carrier, and det as junction:
    For Set Equipment Routing Flag = 3 for CSXT:
    When the system analyzes the route pattern, then equipment routing indicator is set to 3 and route found flag is set to true.
  • Context - equipment has routing information with ns as first carrier, cprs as second carrier, and det as junction:
    For Set Equipment Routing Flag = 4 for NS:
    When the system analyzes the route pattern, then equipment routing indicator is set to 4 and route found flag is set to true.
  • Context - equipment does not match csxt-cprs-det or ns-cprs-det patterns and has hazardous materials indicator:
    For Set Equipment Routing Flag = 2 for Haulage:
    When the system checks for hazmat classification, then equipment routing indicator is set to 2 and route found flag is set to true.
  • Context - equipment does not match any specific routing patterns or no routing information is found:
    For Set Equipment Routing Flag = 1 for Empty/No Route:
    When the system completes route pattern analysis without finding a match, then equipment routing indicator is set to 1 as the default classification.
  • Context - equipment routing information is being processed:
    For Set Route Type 2 - Hazmat Routing:
    When the equipment ima code equals 'hm' indicating hazmat material, then set route classification to type 2 (hazmat routing) and mark route as found.
    For Set Route Type 1 - No Special Routing:
    When equipment is not hazmat and routing pattern doesn't match csxt/ns to cprs via detroit, then set route classification to type 1 indicating no special routing requirements.
  • Context - raw routing information has been extracted from waybill:
    For Clean Routing Data - Replace Special Characters:
    When the routing information contains exclamation mark delimiters, then replace all exclamation marks with spaces to normalize the routing data.
  • Context - equipment has valid routing information with scac codes and junction points:
    For Set Route Type 3 - CSXT to CPRS via DET:
    When first scac is csxt or ns, second scac is cprs, and junction point is det, and first scac is specifically csxt, then set route classification to type 3 and mark route as found.
    For Set Route Type 4 - NS to CPRS via DET:
    When first scac is csxt or ns, second scac is cprs, and junction point is det, and first scac is ns, then set route classification to type 4 and mark route as found.
  • Context - routing information has been extracted and cleaned:
    For Validate Route Fields Present?:
    When route information fields are checked for valid data, then if routing fields are spaces or low-values, skip pattern matching and use default classification.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill exists with routing information in RUT-INFO fields
GIVEN
A waybill exists with routing information in RUT-INFO fields
Applied to: Extract Routing Information from Waybill
WHEN
The system processes the waybill routing data
THEN
The routing information is extracted into working storage and exclamation marks are replaced with spaces for proper parsing
Context: Equipment routing classification process is starting
GIVEN
Equipment routing classification process is starting
Applied to: Initialize Route Search Variables
WHEN
The system begins route pattern analysis
THEN
Route search variables are initialized and route not found flag is set to true
Context: Equipment has routing information with CSXT as first carrier, CPRS as second carrier, and DET as junction
GIVEN
Equipment has routing information with CSXT as first carrier, CPRS as second carrier, and DET as junction
Applied to: Set Equipment Routing Flag = 3 for CSXT
WHEN
The system analyzes the route pattern
THEN
Equipment routing indicator is set to 3 and route found flag is set to true
Context: Equipment has routing information with NS as first carrier, CPRS as second carrier, and DET as junction
GIVEN
Equipment has routing information with NS as first carrier, CPRS as second carrier, and DET as junction
Applied to: Set Equipment Routing Flag = 4 for NS
WHEN
The system analyzes the route pattern
THEN
Equipment routing indicator is set to 4 and route found flag is set to true
Context: Equipment does not match CSXT-CPRS-DET or NS-CPRS-DET patterns and has hazardous materials indicator
GIVEN
Equipment does not match CSXT-CPRS-DET or NS-CPRS-DET patterns and has hazardous materials indicator
Applied to: Set Equipment Routing Flag = 2 for Haulage
WHEN
The system checks for hazmat classification
THEN
Equipment routing indicator is set to 2 and route found flag is set to true
Context: Equipment does not match any specific routing patterns or no routing information is found
GIVEN
Equipment does not match any specific routing patterns or no routing information is found
Applied to: Set Equipment Routing Flag = 1 for Empty/No Route
WHEN
The system completes route pattern analysis without finding a match
THEN
Equipment routing indicator is set to 1 as the default classification
Context: Equipment routing information is being processed
GIVEN
Equipment routing information is being processed
Applied to: Set Route Type 2 - Hazmat Routing
WHEN
The equipment IMA code equals 'HM' indicating hazmat material
THEN
Set route classification to type 2 (hazmat routing) and mark route as found
Applied to: Set Route Type 1 - No Special Routing
WHEN
Equipment is not hazmat and routing pattern doesn't match CSXT/NS to CPRS via Detroit
THEN
Set route classification to type 1 indicating no special routing requirements
Context: Raw routing information has been extracted from waybill
GIVEN
Raw routing information has been extracted from waybill
Applied to: Clean Routing Data - Replace Special Characters
WHEN
The routing information contains exclamation mark delimiters
THEN
Replace all exclamation marks with spaces to normalize the routing data
Context: Equipment has valid routing information with SCAC codes and junction points
GIVEN
Equipment has valid routing information with SCAC codes and junction points
Applied to: Set Route Type 3 - CSXT to CPRS via DET
WHEN
First SCAC is CSXT or NS, second SCAC is CPRS, and junction point is DET, and first SCAC is specifically CSXT
THEN
Set route classification to type 3 and mark route as found
Applied to: Set Route Type 4 - NS to CPRS via DET
WHEN
First SCAC is CSXT or NS, second SCAC is CPRS, and junction point is DET, and first SCAC is NS
THEN
Set route classification to type 4 and mark route as found
Context: Routing information has been extracted and cleaned
GIVEN
Routing information has been extracted and cleaned
Applied to: Validate Route Fields Present?
WHEN
Route information fields are checked for valid data
THEN
If routing fields are spaces or low-values, skip pattern matching and use default classification
R-GCX003-cbl-00431 (+12) File: GCX003.cbl EDI Train List Transmission Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI Train List Transmission':
  • Context - a train list is ready for edi transmission to us customs:
    For Set Background Processing Mode:
    When the edi transmission process is initiated, then the system must be configured for background processing mode.
  • Context - a validated train list exists with all required equipment and cargo information:
    For Call GCCU358T Module for EDI Transmission:
    When the edi transmission is executed through gccu358t module, then the train list data must be transmitted to us customs edi system.
  • Context - the gccu358t module has been called for edi transmission:
    For Validate Module Parameters:
    When the module execution completes, then the system must validate that the module parameters were valid and the transmission was successful, otherwise terminate with system error.
    For EDI Transmission Successful?:
    When the transmission process completes, then the system must verify the transmission was successful and if unsuccessful, trigger parameter validation error handling.
  • Context - a train list has been successfully transmitted via edi:
    For AEI Train Send Request?:
    When the system checks the train send type, then if the train send is marked as aei-enabled, additional aei logging must be performed.
  • Context - an aei train send request has been successfully transmitted:
    For Log AEI Send Activity:
    When aei logging is required, then the system must create an activity log record with train details, user information, timestamp, and aei send confirmation message.
  • Context - a validated train list with all equipment and cargo details and the system is configured for background processing:
    For Call GCCU358T Module for EDI Transmission:
    When the edi transmission is executed, then the gccu358t module must be called with the complete train list data for transmission to us customs.
  • Context - the edi transmission has failed:
    For Validate Module Parameters:
    When parameter validation is performed, then the system must validate all module parameters and if invalid, generate an abend condition with error message 'gccu358t module parameters invalid'.
  • Context - the edi transmission has completed successfully:
    For AEI Train Send Request?:
    When the system checks the request type, then if the request is an aei train send request, additional aei logging must be performed and if not an aei request, complete the transmission process normally.
  • Context - the transmission is confirmed as an aei train send request:
    For Log AEI Send Activity:
    When aei logging is performed, then the system must create an activity log entry with train id, user information, timestamp, and aei send confirmation message.
  • Context - the edi transmission is successful and any required aei logging is complete:
    For Complete EDI Transmission:
    When the transmission process is finalized, then the edi transmission process must be marked as complete and control returned to the calling process.
  • Context - edi module parameters have been validated and found to be invalid:
    For System Abend - Invalid Parameters:
    When the parameter validation fails, then the system must initiate an abend condition with the specific error message indicating invalid gccu358t module parameters.
👨‍💻 Technical ACs (Gherkin)
Context: A train list is ready for EDI transmission to US Customs
GIVEN
A train list is ready for EDI transmission to US Customs
Applied to: Set Background Processing Mode
WHEN
The EDI transmission process is initiated
THEN
The system must be configured for background processing mode
Context: A validated train list exists with all required equipment and cargo information
GIVEN
A validated train list exists with all required equipment and cargo information
Applied to: Call GCCU358T Module for EDI Transmission
WHEN
The EDI transmission is executed through GCCU358T module
THEN
The train list data must be transmitted to US Customs EDI system
Context: The GCCU358T module has been called for EDI transmission
GIVEN
The GCCU358T module has been called for EDI transmission
Applied to: Validate Module Parameters
WHEN
The module execution completes
THEN
The system must validate that the module parameters were valid and the transmission was successful, otherwise terminate with system error
Applied to: EDI Transmission Successful?
WHEN
The transmission process completes
THEN
The system must verify the transmission was successful AND if unsuccessful, trigger parameter validation error handling
Context: A train list has been successfully transmitted via EDI
GIVEN
A train list has been successfully transmitted via EDI
Applied to: AEI Train Send Request?
WHEN
The system checks the train send type
THEN
If the train send is marked as AEI-enabled, additional AEI logging must be performed
Context: An AEI train send request has been successfully transmitted
GIVEN
An AEI train send request has been successfully transmitted
Applied to: Log AEI Send Activity
WHEN
AEI logging is required
THEN
The system must create an activity log record with train details, user information, timestamp, and AEI send confirmation message
Context: A validated train list with all equipment and cargo details AND the system is configured for background processing
GIVEN
A validated train list with all equipment and cargo details AND the system is configured for background processing
Applied to: Call GCCU358T Module for EDI Transmission
WHEN
The EDI transmission is executed
THEN
The GCCU358T module must be called with the complete train list data for transmission to US Customs
Context: The EDI transmission has failed
GIVEN
The EDI transmission has failed
Applied to: Validate Module Parameters
WHEN
Parameter validation is performed
THEN
The system must validate all module parameters AND if invalid, generate an abend condition with error message 'GCCU358T MODULE PARAMETERS INVALID'
Context: The EDI transmission has completed successfully
GIVEN
The EDI transmission has completed successfully
Applied to: AEI Train Send Request?
WHEN
The system checks the request type
THEN
If the request is an AEI train send request, additional AEI logging must be performed AND if not an AEI request, complete the transmission process normally
Context: The transmission is confirmed as an AEI train send request
GIVEN
The transmission is confirmed as an AEI train send request
Applied to: Log AEI Send Activity
WHEN
AEI logging is performed
THEN
The system must create an activity log entry with train ID, user information, timestamp, and AEI send confirmation message
Context: The EDI transmission is successful AND any required AEI logging is complete
GIVEN
The EDI transmission is successful AND any required AEI logging is complete
Applied to: Complete EDI Transmission
WHEN
The transmission process is finalized
THEN
The EDI transmission process must be marked as complete and control returned to the calling process
Context: EDI module parameters have been validated and found to be invalid
GIVEN
EDI module parameters have been validated and found to be invalid
Applied to: System Abend - Invalid Parameters
WHEN
The parameter validation fails
THEN
The system must initiate an abend condition with the specific error message indicating invalid GCCU358T module parameters
R-GCX003-cbl-00436 (+14) File: GCX003.cbl Report Transmission to Customs Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Transmission to Customs':
  • Context - a train manifest processing request has been completed:
    For Build Report Header with Train Details:
    When the system prepares the customs report transmission, then the report header must include train id in header line 1, origin station name in header line 1, user id in header line 2, terminal id in header line 2, processing date in header line 2, processing hour in header line 2, and processing minute in header line 2.
  • Context - a train list has been processed and a us customs train id has been generated:
    For Set US Customs Train ID:
    When the system builds the report header for customs transmission, then the us customs train id from the train list must be assigned to header line 4.
  • Context - a train request contains eta date and time information:
    For Set ETA Date and Time Fields:
    When the system builds the report header for customs transmission, then the eta year must be set in header line 4, eta month must be set in header line 4, eta day must be set in header line 4, eta hour must be set in header line 4, and eta minute must be set in header line 4.
  • Context - equipment processing has been completed for a train manifest:
    For Add Equipment Total Count to Status Line:
    When the system prepares the status line for customs transmission, then the total equipment count must be moved to the status line and the status line must be assigned to email text line 5.
  • Context - report lines have been generated for a train manifest:
    For Format Report Lines for Email:
    When the system prepares the email transmission to customs, then report line 1 must be copied to email text line 1, report line 2 must be copied to email text line 2, report line 3 must be copied to email text line 3, report line 4 must be copied to email text line 4, detail header 1 must be copied to email text line 6, and detail header 2 must be copied to email text line 7.
  • Context - a customs report is ready for transmission:
    For Set Email Parameters:
    When the system prepares the email parameters, then keywords must be set to spaces, copy user code must be set to spaces, item number sequence must be set to spaces, item alpha sequence must be set to spaces, and return status flag must be initialized.
  • Context - a customs report is being prepared for transmission:
    For Set Sender as OM01247:
    When the system sets the email sender and recipient, then the from user code must be set to 'om01247' and the to user code must be set to 'om01247'.
  • Context - a customs report has been formatted with header information:
    For Set Report Subject Line:
    When the system sets the email subject line, then the email subject must be set to the content of report line 1.
  • Context - a customs report is being prepared for email transmission:
    For Set Email Width to 80 Characters:
    When the system sets the email formatting parameters, then the email item width must be set to '080' characters.
  • Context - a customs report has been formatted for transmission:
    For Report Size Check:
    When the system processes report lines for email transmission and the line count reaches 700 lines, then the system must send the current email batch, reset the email text, initialize line counter to zero, add continuation message as line 1, add detail header 1 as line 2, add detail header 2 as line 3, and increment line counter by 3.
  • Context - a customs report has been formatted and the total line count is 700 or fewer lines:
    For Send Single Email with Complete Report:
    When the system completes processing all report lines, then the system must call emcsend3 to transmit the complete email with all report content.
  • Context - a customs report exceeds 700 lines during processing:
    For Split Report into Multiple Emails:
    When the system reaches the line limit, then the system must send the current email batch, clear the email text, reset line counter, add continuation message, add report headers, and continue processing remaining lines.
  • Context - an email has been sent to customs using emcsend3:
    For Verify Email Send Success:
    When the system checks the email transmission result, then if the email return status is not successful, the system must handle the email send failure.
  • Context - an email transmission to customs has failed:
    For Handle Email Send Failure:
    When the system detects the email send failure, then the system must set the error message to 'send to file of om01247 failed' and perform system abend.
  • Context - an email has been successfully sent to customs:
    For Purge Message Queue:
    When the system completes the email transmission, then the system must initialize the accept status and call cims with purg to purge the alternate pcb message queue.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest processing request has been completed
GIVEN
A train manifest processing request has been completed
Applied to: Build Report Header with Train Details
WHEN
The system prepares the customs report transmission
THEN
The report header must include train ID in header line 1, origin station name in header line 1, user ID in header line 2, terminal ID in header line 2, processing date in header line 2, processing hour in header line 2, and processing minute in header line 2
Context: A train list has been processed and a US customs train ID has been generated
GIVEN
A train list has been processed and a US customs train ID has been generated
Applied to: Set US Customs Train ID
WHEN
The system builds the report header for customs transmission
THEN
The US customs train ID from the train list must be assigned to header line 4
Context: A train request contains ETA date and time information
GIVEN
A train request contains ETA date and time information
Applied to: Set ETA Date and Time Fields
WHEN
The system builds the report header for customs transmission
THEN
The ETA year must be set in header line 4, ETA month must be set in header line 4, ETA day must be set in header line 4, ETA hour must be set in header line 4, and ETA minute must be set in header line 4
Context: Equipment processing has been completed for a train manifest
GIVEN
Equipment processing has been completed for a train manifest
Applied to: Add Equipment Total Count to Status Line
WHEN
The system prepares the status line for customs transmission
THEN
The total equipment count must be moved to the status line and the status line must be assigned to email text line 5
Context: Report lines have been generated for a train manifest
GIVEN
Report lines have been generated for a train manifest
Applied to: Format Report Lines for Email
WHEN
The system prepares the email transmission to customs
THEN
Report line 1 must be copied to email text line 1, report line 2 must be copied to email text line 2, report line 3 must be copied to email text line 3, report line 4 must be copied to email text line 4, detail header 1 must be copied to email text line 6, and detail header 2 must be copied to email text line 7
Context: A customs report is ready for transmission
GIVEN
A customs report is ready for transmission
Applied to: Set Email Parameters
WHEN
The system prepares the email parameters
THEN
Keywords must be set to spaces, copy user code must be set to spaces, item number sequence must be set to spaces, item alpha sequence must be set to spaces, and return status flag must be initialized
Context: A customs report is being prepared for transmission
GIVEN
A customs report is being prepared for transmission
Applied to: Set Sender as OM01247
WHEN
The system sets the email sender and recipient
THEN
The from user code must be set to 'OM01247' and the to user code must be set to 'OM01247'
Context: A customs report has been formatted with header information
GIVEN
A customs report has been formatted with header information
Applied to: Set Report Subject Line
WHEN
The system sets the email subject line
THEN
The email subject must be set to the content of report line 1
Context: A customs report is being prepared for email transmission
GIVEN
A customs report is being prepared for email transmission
Applied to: Set Email Width to 80 Characters
WHEN
The system sets the email formatting parameters
THEN
The email item width must be set to '080' characters
Context: A customs report has been formatted for transmission
GIVEN
A customs report has been formatted for transmission
Applied to: Report Size Check
WHEN
The system processes report lines for email transmission and the line count reaches 700 lines
THEN
The system must send the current email batch, reset the email text, initialize line counter to zero, add continuation message as line 1, add detail header 1 as line 2, add detail header 2 as line 3, and increment line counter by 3
Context: A customs report has been formatted and the total line count is 700 or fewer lines
GIVEN
A customs report has been formatted and the total line count is 700 or fewer lines
Applied to: Send Single Email with Complete Report
WHEN
The system completes processing all report lines
THEN
The system must call EMCSEND3 to transmit the complete email with all report content
Context: A customs report exceeds 700 lines during processing
GIVEN
A customs report exceeds 700 lines during processing
Applied to: Split Report into Multiple Emails
WHEN
The system reaches the line limit
THEN
The system must send the current email batch, clear the email text, reset line counter, add continuation message, add report headers, and continue processing remaining lines
Context: An email has been sent to customs using EMCSEND3
GIVEN
An email has been sent to customs using EMCSEND3
Applied to: Verify Email Send Success
WHEN
The system checks the email transmission result
THEN
If the email return status is not successful, the system must handle the email send failure
Context: An email transmission to customs has failed
GIVEN
An email transmission to customs has failed
Applied to: Handle Email Send Failure
WHEN
The system detects the email send failure
THEN
The system must set the error message to 'SEND TO FILE OF OM01247 FAILED' and perform system abend
Context: An email has been successfully sent to customs
GIVEN
An email has been successfully sent to customs
Applied to: Purge Message Queue
WHEN
The system completes the email transmission
THEN
The system must initialize the accept status and call CIMS with PURG to purge the alternate PCB message queue
R-GCX003-cbl-00451 (+19) File: GCX003.cbl Large Report Email Pagination Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Large Report Email Pagination':
  • Context - a report needs to be sent via email:
    For Initialize Email Parameters:
    When email processing begins, then email parameters are initialized with sender as om01247, destination filename is set, item width is set to 080, and line counter is reset to zero.
  • Context - email processing is in progress with a current mail subscription counter:
    For More Report Lines to Process?:
    When the system checks for more lines to process, then continue processing if the current line is not empty or low-values and the mail subscription counter has not exceeded the maximum email line limit.
  • Context - a report line exists and needs to be added to the email:
    For Add Report Line to Email Message:
    When the line is processed for inclusion, then the report line is moved to the email text message line at the current line subscription position and the line subscription counter is incremented by 1 and the more email flag is set to true.
  • Context - lines are being added to an email message buffer:
    For Line Count > 699?:
    When the line subscription counter is evaluated, then if the line counter exceeds 699 lines, trigger email batch sending process.
    For Line Count > 699?:
    When the line count reaches or exceeds 699 lines, then the current email batch must be sent and a new batch must be started.
  • Context - the email message buffer contains 699 or more lines:
    For Send Current Email Batch:
    When the batch size limit is reached, then call emcsend3 to send the current email batch with all configured parameters including sender, recipient, subject, and message content.
  • Context - an email batch has been successfully sent:
    For Clear Email Message Buffer:
    When the system prepares for the next batch, then clear the email text message buffer by setting it to spaces.
  • Context - the email message buffer has been cleared after sending a batch:
    For Reset Line Counter to Zero:
    When preparing for the next batch of lines, then set the line subscription counter to zero.
  • Context - a new email batch is being prepared after sending a previous batch:
    For Add Continuation Header:
    When the continuation header needs to be added, then add 'continuation of report ....' message to the first line of the new email batch.
    For Add Continuation Header:
    When the system initializes the continuation email, then a continuation message 'continuation of report ....' is added as the first line, followed by report detail headers, and the line counter is incremented by 3.
  • Context - a continuation email batch is being prepared:
    For Add Report Detail Headers:
    When detail headers need to be added after the continuation message, then add the standard detail header line 1 to email text message line 2 and add the standard detail header line 2 to email text message line 3.
  • Context - continuation header and detail headers have been added to the email batch:
    For Add 3 to Line Counter:
    When the line counter needs to be updated, then add 3 to the line subscription counter to account for the added header lines.
  • Context - all report lines have been processed and the more email flag is true:
    For Send Final Email Batch:
    When no more lines remain to be processed, then call emcsend3 to send the final email batch with all remaining content.
  • Context - an email send operation has been attempted:
    For Email Send Successful?:
    When the email return status is evaluated, then if the email return status is not successful, trigger error handling process.
  • Context - an email send operation has failed:
    For Handle Email Send Error:
    When error handling is triggered, then clear the current recipient usercode and set aei9999 as the first recipient usercode and set om01247 as the second recipient usercode.
  • Context - email send has failed and alternative recipients have been configured:
    For Send Error Notification to Support:
    When error notification needs to be sent, then call emcsend3 to send error notification to support recipients and if this also fails, generate system abend with message 'send to file of om01247 failed'.
  • Context - a report line exists to be processed for email transmission:
    For Add Line to Email Message:
    When the system processes the report line for email inclusion, then the report line is added to the email message buffer and the line counter is incremented by 1.
  • Context - an email message buffer contains 699 or more lines of report data:
    For Send Current Email Batch:
    When the batch size limit is reached, then the email is sent using emcsend3 service, the message buffer is cleared, and the line counter is reset to zero.
  • Context - all report lines have been processed and there is remaining content in the email buffer:
    For Send Final Email Batch:
    When no more report lines exist to process, then the final email batch is sent using emcsend3 service with all remaining accumulated content.
  • Context - the system is iterating through report lines for email processing:
    For More Report Lines to Process?:
    When the system checks for more lines to process, then processing continues if the current line contains data and the maximum line limit has not been exceeded, otherwise processing stops.
👨‍💻 Technical ACs (Gherkin)
Context: A report needs to be sent via email
GIVEN
A report needs to be sent via email
Applied to: Initialize Email Parameters
WHEN
Email processing begins
THEN
Email parameters are initialized with sender as OM01247, destination filename is set, item width is set to 080, and line counter is reset to zero
Context: Email processing is in progress with a current mail subscription counter
GIVEN
Email processing is in progress with a current mail subscription counter
Applied to: More Report Lines to Process?
WHEN
The system checks for more lines to process
THEN
Continue processing if the current line is not empty or low-values AND the mail subscription counter has not exceeded the maximum email line limit
Context: A report line exists and needs to be added to the email
GIVEN
A report line exists and needs to be added to the email
Applied to: Add Report Line to Email Message
WHEN
The line is processed for inclusion
THEN
The report line is moved to the email text message line at the current line subscription position AND the line subscription counter is incremented by 1 AND the more email flag is set to true
Context: Lines are being added to an email message buffer
GIVEN
Lines are being added to an email message buffer
Applied to: Line Count > 699?
WHEN
The line subscription counter is evaluated
THEN
If the line counter exceeds 699 lines, trigger email batch sending process
Applied to: Line Count > 699?
WHEN
The line count reaches or exceeds 699 lines
THEN
The current email batch must be sent and a new batch must be started
Context: The email message buffer contains 699 or more lines
GIVEN
The email message buffer contains 699 or more lines
Applied to: Send Current Email Batch
WHEN
The batch size limit is reached
THEN
Call EMCSEND3 to send the current email batch with all configured parameters including sender, recipient, subject, and message content
Context: An email batch has been successfully sent
GIVEN
An email batch has been successfully sent
Applied to: Clear Email Message Buffer
WHEN
The system prepares for the next batch
THEN
Clear the email text message buffer by setting it to spaces
Context: The email message buffer has been cleared after sending a batch
GIVEN
The email message buffer has been cleared after sending a batch
Applied to: Reset Line Counter to Zero
WHEN
Preparing for the next batch of lines
THEN
Set the line subscription counter to zero
Context: A new email batch is being prepared after sending a previous batch
GIVEN
A new email batch is being prepared after sending a previous batch
Applied to: Add Continuation Header
WHEN
The continuation header needs to be added
THEN
Add 'CONTINUATION OF REPORT ....' message to the first line of the new email batch
Applied to: Add Continuation Header
WHEN
The system initializes the continuation email
THEN
A continuation message 'CONTINUATION OF REPORT ....' is added as the first line, followed by report detail headers, and the line counter is incremented by 3
Context: A continuation email batch is being prepared
GIVEN
A continuation email batch is being prepared
Applied to: Add Report Detail Headers
WHEN
Detail headers need to be added after the continuation message
THEN
Add the standard detail header line 1 to email text message line 2 AND add the standard detail header line 2 to email text message line 3
Context: Continuation header and detail headers have been added to the email batch
GIVEN
Continuation header and detail headers have been added to the email batch
Applied to: Add 3 to Line Counter
WHEN
The line counter needs to be updated
THEN
Add 3 to the line subscription counter to account for the added header lines
Context: All report lines have been processed and the more email flag is true
GIVEN
All report lines have been processed and the more email flag is true
Applied to: Send Final Email Batch
WHEN
No more lines remain to be processed
THEN
Call EMCSEND3 to send the final email batch with all remaining content
Context: An email send operation has been attempted
GIVEN
An email send operation has been attempted
Applied to: Email Send Successful?
WHEN
The email return status is evaluated
THEN
If the email return status is not successful, trigger error handling process
Context: An email send operation has failed
GIVEN
An email send operation has failed
Applied to: Handle Email Send Error
WHEN
Error handling is triggered
THEN
Clear the current recipient usercode AND set AEI9999 as the first recipient usercode AND set OM01247 as the second recipient usercode
Context: Email send has failed and alternative recipients have been configured
GIVEN
Email send has failed and alternative recipients have been configured
Applied to: Send Error Notification to Support
WHEN
Error notification needs to be sent
THEN
Call EMCSEND3 to send error notification to support recipients AND if this also fails, generate system abend with message 'SEND TO FILE OF OM01247 FAILED'
Context: A report line exists to be processed for email transmission
GIVEN
A report line exists to be processed for email transmission
Applied to: Add Line to Email Message
WHEN
The system processes the report line for email inclusion
THEN
The report line is added to the email message buffer and the line counter is incremented by 1
Context: An email message buffer contains 699 or more lines of report data
GIVEN
An email message buffer contains 699 or more lines of report data
Applied to: Send Current Email Batch
WHEN
The batch size limit is reached
THEN
The email is sent using EMCSEND3 service, the message buffer is cleared, and the line counter is reset to zero
Context: All report lines have been processed and there is remaining content in the email buffer
GIVEN
All report lines have been processed and there is remaining content in the email buffer
Applied to: Send Final Email Batch
WHEN
No more report lines exist to process
THEN
The final email batch is sent using EMCSEND3 service with all remaining accumulated content
Context: The system is iterating through report lines for email processing
GIVEN
The system is iterating through report lines for email processing
Applied to: More Report Lines to Process?
WHEN
The system checks for more lines to process
THEN
Processing continues if the current line contains data and the maximum line limit has not been exceeded, otherwise processing stops
R-GCX003-cbl-00465 (+19) File: GCX003.cbl Report Distribution to Originator Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Distribution to Originator':
  • Context - a train processing request is being evaluated:
    For Is AEI Train Send Request?:
    When the system checks if aei train send processing is enabled, then aei send report processing is triggered if aei train send is set to yes.
  • Context - an aei train send request requires email notification:
    For Retrieve Email Distribution List:
    When the system queries the customer email table using train origin as the key, then email addresses are retrieved for notification distribution or default addresses are used if none found.
  • Context - an aei email notification needs to be sent:
    For Generate Email Subject Line:
    When the system evaluates if there are errors in the report, then email subject is set to 'us train [train_id] not sent at [origin]' for errors or 'us train [train_id] sent at [origin]' for successful processing.
  • Context - aei email distribution list retrieval returns no entries or encounters an error:
    For Use Default Recipients:
    When the system cannot find specific email recipients for the train origin, then default merlin id is assigned as both sender and recipient for the email notification.
  • Context - an aei report is being prepared for email transmission:
    For Report Size Exceeds Limit?:
    When the report exceeds 699 lines, then the report is split into multiple emails with continuation headers and the current email is sent before starting a new one.
  • Context - an aei email transmission fails:
    For Handle Email Send Errors:
    When the email send operation returns an unsuccessful status, then an error notification is sent to aei9999 and om01247 support addresses, and if that also fails, the system abends with an error message.
  • Context - a report needs to be sent to the originating user:
    For Determine Destination Terminal:
    When the system checks if an alternate terminal is configured for the user, then the alternate terminal is used if available, otherwise the original terminal from the request is used.
  • Context - a report is being prepared for distribution:
    For Set Report Type Based on Action:
    When the system evaluates the request action type and error status, then report type is set to train-error for error conditions, train-sent for successful send actions, or train-report for report-only actions.
    For Request Action Type?:
    When the system evaluates the request action type and error append status, then the system sets train error type if error append is true, train sent type if action is send, or train report type if action is report.
  • Context - a report is ready for transmission to the originator:
    For Report Display Mode?:
    When the system evaluates if the report should show all details or selective content, then all report lines are sent for comprehensive reports, or selective content is sent based on warning conditions.
    For Report Display Mode?:
    When the system checks the report display mode setting, then the system sends all report lines if set to all report mode, otherwise sends summary based on warning status.
  • Context - a selective report display mode is active:
    For Has Warnings?:
    When the system checks for warning conditions in the report, then only header lines are sent if no warnings exist, otherwise header and warning lines from the equipment section are included.
  • Context - a train report distribution process is initiated:
    For Is AEI Train Send?:
    When the system checks if aei train send flag is set to yes, then the system processes aei send report if flag is yes, otherwise continues with standard report distribution.
  • Context - a report needs to be sent to an originator terminal:
    For Alternate Terminal Available?:
    When the system checks if an alternate terminal is configured and not empty, then the system uses the alternate terminal if available, otherwise uses the original terminal from the request.
  • Context - a summary report mode is selected and report content needs to be determined:
    For Has Warnings?:
    When the system checks if the report contains warning messages, then the system sends only header lines if no warnings exist, otherwise sends header plus all warning message lines.
  • Context - a report type has been determined and destination terminal is set:
    For Send Report Header Line:
    When the system initiates report transmission, then the system sends the report header line containing report identification and formatting information.
  • Context - report display mode is set to all report and header has been sent:
    For Send All Report Lines:
    When the system processes report line transmission, then the system iterates through and sends every report line from first line to last line.
  • Context - summary report mode is selected and no warning messages exist:
    For Send Header Lines Only:
    When the system determines report content to transmit, then the system sends only the first four header lines containing basic report information.
  • Context - summary report mode is selected and warning messages exist:
    For Send Warning Messages Only:
    When the system scans through report lines to identify warnings, then the system processes each warning message line and its preceding context line for transmission.
  • Context - all required report content has been transmitted to the destination terminal:
    For Send Report Wrap Command:
    When the system completes report line transmission, then the system sends a wrap command with user function code to properly terminate the report session.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request is being evaluated
GIVEN
A train processing request is being evaluated
Applied to: Is AEI Train Send Request?
WHEN
The system checks if AEI train send processing is enabled
THEN
AEI send report processing is triggered if AEI train send is set to YES
Context: An AEI train send request requires email notification
GIVEN
An AEI train send request requires email notification
Applied to: Retrieve Email Distribution List
WHEN
The system queries the customer email table using train origin as the key
THEN
Email addresses are retrieved for notification distribution or default addresses are used if none found
Context: An AEI email notification needs to be sent
GIVEN
An AEI email notification needs to be sent
Applied to: Generate Email Subject Line
WHEN
The system evaluates if there are errors in the report
THEN
Email subject is set to 'US TRAIN [train_id] NOT SENT AT [origin]' for errors or 'US TRAIN [train_id] SENT AT [origin]' for successful processing
Context: AEI email distribution list retrieval returns no entries or encounters an error
GIVEN
AEI email distribution list retrieval returns no entries or encounters an error
Applied to: Use Default Recipients
WHEN
The system cannot find specific email recipients for the train origin
THEN
Default Merlin ID is assigned as both sender and recipient for the email notification
Context: An AEI report is being prepared for email transmission
GIVEN
An AEI report is being prepared for email transmission
Applied to: Report Size Exceeds Limit?
WHEN
The report exceeds 699 lines
THEN
The report is split into multiple emails with continuation headers and the current email is sent before starting a new one
Context: An AEI email transmission fails
GIVEN
An AEI email transmission fails
Applied to: Handle Email Send Errors
WHEN
The email send operation returns an unsuccessful status
THEN
An error notification is sent to AEI9999 and OM01247 support addresses, and if that also fails, the system abends with an error message
Context: A report needs to be sent to the originating user
GIVEN
A report needs to be sent to the originating user
Applied to: Determine Destination Terminal
WHEN
The system checks if an alternate terminal is configured for the user
THEN
The alternate terminal is used if available, otherwise the original terminal from the request is used
Context: A report is being prepared for distribution
GIVEN
A report is being prepared for distribution
Applied to: Set Report Type Based on Action
WHEN
The system evaluates the request action type and error status
THEN
Report type is set to TRAIN-ERROR for error conditions, TRAIN-SENT for successful send actions, or TRAIN-REPORT for report-only actions
Applied to: Request Action Type?
WHEN
The system evaluates the request action type and error append status
THEN
The system sets train error type if error append is true, train sent type if action is send, or train report type if action is report
Context: A report is ready for transmission to the originator
GIVEN
A report is ready for transmission to the originator
Applied to: Report Display Mode?
WHEN
The system evaluates if the report should show all details or selective content
THEN
All report lines are sent for comprehensive reports, or selective content is sent based on warning conditions
Applied to: Report Display Mode?
WHEN
The system checks the report display mode setting
THEN
The system sends all report lines if set to all report mode, otherwise sends summary based on warning status
Context: A selective report display mode is active
GIVEN
A selective report display mode is active
Applied to: Has Warnings?
WHEN
The system checks for warning conditions in the report
THEN
Only header lines are sent if no warnings exist, otherwise header and warning lines from the equipment section are included
Context: A train report distribution process is initiated
GIVEN
A train report distribution process is initiated
Applied to: Is AEI Train Send?
WHEN
The system checks if AEI train send flag is set to YES
THEN
The system processes AEI send report if flag is YES, otherwise continues with standard report distribution
Context: A report needs to be sent to an originator terminal
GIVEN
A report needs to be sent to an originator terminal
Applied to: Alternate Terminal Available?
WHEN
The system checks if an alternate terminal is configured and not empty
THEN
The system uses the alternate terminal if available, otherwise uses the original terminal from the request
Context: A summary report mode is selected and report content needs to be determined
GIVEN
A summary report mode is selected and report content needs to be determined
Applied to: Has Warnings?
WHEN
The system checks if the report contains warning messages
THEN
The system sends only header lines if no warnings exist, otherwise sends header plus all warning message lines
Context: A report type has been determined and destination terminal is set
GIVEN
A report type has been determined and destination terminal is set
Applied to: Send Report Header Line
WHEN
The system initiates report transmission
THEN
The system sends the report header line containing report identification and formatting information
Context: Report display mode is set to all report and header has been sent
GIVEN
Report display mode is set to all report and header has been sent
Applied to: Send All Report Lines
WHEN
The system processes report line transmission
THEN
The system iterates through and sends every report line from first line to last line
Context: Summary report mode is selected and no warning messages exist
GIVEN
Summary report mode is selected and no warning messages exist
Applied to: Send Header Lines Only
WHEN
The system determines report content to transmit
THEN
The system sends only the first four header lines containing basic report information
Context: Summary report mode is selected and warning messages exist
GIVEN
Summary report mode is selected and warning messages exist
Applied to: Send Warning Messages Only
WHEN
The system scans through report lines to identify warnings
THEN
The system processes each warning message line and its preceding context line for transmission
Context: All required report content has been transmitted to the destination terminal
GIVEN
All required report content has been transmitted to the destination terminal
Applied to: Send Report Wrap Command
WHEN
The system completes report line transmission
THEN
The system sends a wrap command with user function code to properly terminate the report session
R-GCX003-cbl-00475 (+24) File: GCX003.cbl AEI Report Processing Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AEI Report Processing':
  • Context - a train processing request is received:
    For Check if AEI Train Send Request:
    When the request type equals the aei request type constant, then set aei train send flag to yes, otherwise set to no.
  • Context - an aei train send request is being processed:
    For Retrieve AEI Email Distribution List:
    When the system queries the aei work table using train origin as the key with record type 'cusemail', then return the configured email distribution list or indicate no entry found.
  • Context - aei email distribution retrieval has been attempted:
    For Email Distribution Found?:
    When the return code indicates successful retrieval, then use the retrieved email addresses for up to 10 recipients, otherwise use default merlin email address.
  • Context - no aei email distribution list was found or database error occurred:
    For Use Default MERLIN Email:
    When the system needs to assign email recipients, then set both sender and recipient to the default merlin id.
  • Context - aei email distribution list was successfully retrieved:
    For Set Multiple Email Recipients:
    When processing email recipient configuration, then set sender to default merlin id and assign up to 10 recipient email addresses from the distribution list until a blank entry is encountered.
  • Context - email recipients have been configured:
    For Build Email Subject Line:
    When building the email subject line, then if errors occurred, create subject 'us train [train_id] not sent at [origin]', otherwise create 'us train [train_id] sent at [origin]'.
  • Context - email subject line has been created:
    For Initialize Email Content:
    When preparing to build email content, then set line counter to 1, initialize email text structure, and set email parameters including destination filename and item width.
  • Context - email content is initialized and report lines are available:
    For Add Report Lines to Email:
    When processing each report line up to the last line, then add each report line to email text, increment line counter, and set more email flag to true.
  • Context - report lines are being added to email content:
    For Email Size Limit Reached?:
    When the line counter exceeds 699 lines, then trigger immediate email send and prepare for continuation email.
  • Context - email content has reached the 699 line limit:
    For Send Current Email Batch:
    When sending the current email batch using emcsend3, then if send fails, redirect to error notification addresses aei9999 and om01247, otherwise continue processing.
  • Context - a previous email batch was sent due to size limits:
    For Start New Email with Continuation Header:
    When starting a new continuation email, then clear email text, reset line counter to 1, add continuation message, and add detail headers starting at line 3.
  • Context - all report lines have been processed and more email flag is true:
    For Send Final Email Batch:
    When sending the final email batch using emcsend3, then if send fails, redirect to error notification addresses aei9999 and om01247.
  • Context - email transmission has failed:
    For Send Error Notification to Support:
    When the emcsend3 return status indicates failure, then clear recipient addresses, set error notification recipients to aei9999 and om01247, and attempt to send error notification.
  • Context - error notification email transmission has also failed:
    For Log Email Failure:
    When the system cannot send any email notifications, then generate system error message 'send to file of om01247 failed' and perform system abend.
  • Context - email processing has completed successfully or error handling is complete:
    For Purge Email Transaction:
    When performing transaction cleanup, then initialize accept status, call cims with purg function, and set destination filename to export file.
  • Context - an aei report needs to be distributed via email:
    For Initialize Email Parameters:
    When the system initializes email parameters, then email copy usercode, keywords, item sequence numbers, item alpha sequence, item width, and text content are cleared, and item width is set to 80 characters.
  • Context - a train origin station code is available:
    For Query AEI Email Distribution List:
    When the system queries the aei email distribution table using train origin as key with record type 'cusemail', then the system retrieves the email distribution configuration for that origin station.
  • Context - the aei email distribution query returns success status:
    For Email Distribution Found?:
    When the system processes the query results, then the system sets default merlin id as sender and populates up to 10 recipient email addresses from the distribution list, stopping when a blank recipient is encountered.
  • Context - the aei email distribution query fails or returns no entry status:
    For Use Default MERLIN Email:
    When the system cannot retrieve specific email distribution configuration, then the system uses default merlin id for both sender and recipient email addresses.
  • Context - a train processing result status and train identification information are available:
    For Build Email Subject Line:
    When the system builds the email subject line, then the subject contains 'us train [train_id] not sent at [origin]' if errors occurred, or 'us train [train_id] sent at [origin]' if processing was successful.
  • Context - report lines are available from train processing results:
    For Load Report Lines into Email:
    When the system loads report content into email message, then each report line is copied to email text lines sequentially, with line counter incremented, and email-more flag set to true.
  • Context - report lines are being loaded into email message:
    For Email Size Limit Reached?:
    When the email line count exceeds 699 lines, then the system sets no-more-email flag, sends current email batch, clears email text, resets line counter to 1, and adds continuation header lines.
  • Context - email content is prepared with recipients, subject, and message text:
    For Send Current Email Batch:
    When the system sends the email batch, then the email is transmitted to inbox destination using sender id, recipient list, subject line, and message content through the email service.
  • Context - an aei email send operation fails:
    For Send Error Notification to Support:
    When the system detects email transmission failure, then the system clears recipient list, sets aei9999 and om01247 as error recipients, and attempts to send error notification using the same email service.
  • Context - email processing is complete regardless of success or failure:
    For Purge Email Transaction:
    When the system finalizes email operations, then the system clears accept status and purges the email transaction using the alternate pcb.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request is received
GIVEN
A train processing request is received
Applied to: Check if AEI Train Send Request
WHEN
The request type equals the AEI request type constant
THEN
Set AEI train send flag to YES, otherwise set to NO
Context: An AEI train send request is being processed
GIVEN
An AEI train send request is being processed
Applied to: Retrieve AEI Email Distribution List
WHEN
The system queries the AEI work table using train origin as the key with record type 'CUSEMAIL'
THEN
Return the configured email distribution list or indicate no entry found
Context: AEI email distribution retrieval has been attempted
GIVEN
AEI email distribution retrieval has been attempted
Applied to: Email Distribution Found?
WHEN
The return code indicates successful retrieval
THEN
Use the retrieved email addresses for up to 10 recipients, otherwise use default MERLIN email address
Context: No AEI email distribution list was found or database error occurred
GIVEN
No AEI email distribution list was found or database error occurred
Applied to: Use Default MERLIN Email
WHEN
The system needs to assign email recipients
THEN
Set both sender and recipient to the default MERLIN ID
Context: AEI email distribution list was successfully retrieved
GIVEN
AEI email distribution list was successfully retrieved
Applied to: Set Multiple Email Recipients
WHEN
Processing email recipient configuration
THEN
Set sender to default MERLIN ID and assign up to 10 recipient email addresses from the distribution list until a blank entry is encountered
Context: Email recipients have been configured
GIVEN
Email recipients have been configured
Applied to: Build Email Subject Line
WHEN
Building the email subject line
THEN
If errors occurred, create subject 'US TRAIN [train_id] NOT SENT AT [origin]', otherwise create 'US TRAIN [train_id] SENT AT [origin]'
Context: Email subject line has been created
GIVEN
Email subject line has been created
Applied to: Initialize Email Content
WHEN
Preparing to build email content
THEN
Set line counter to 1, initialize email text structure, and set email parameters including destination filename and item width
Context: Email content is initialized and report lines are available
GIVEN
Email content is initialized and report lines are available
Applied to: Add Report Lines to Email
WHEN
Processing each report line up to the last line
THEN
Add each report line to email text, increment line counter, and set more email flag to true
Context: Report lines are being added to email content
GIVEN
Report lines are being added to email content
Applied to: Email Size Limit Reached?
WHEN
The line counter exceeds 699 lines
THEN
Trigger immediate email send and prepare for continuation email
Context: Email content has reached the 699 line limit
GIVEN
Email content has reached the 699 line limit
Applied to: Send Current Email Batch
WHEN
Sending the current email batch using EMCSEND3
THEN
If send fails, redirect to error notification addresses AEI9999 and OM01247, otherwise continue processing
Context: A previous email batch was sent due to size limits
GIVEN
A previous email batch was sent due to size limits
Applied to: Start New Email with Continuation Header
WHEN
Starting a new continuation email
THEN
Clear email text, reset line counter to 1, add continuation message, and add detail headers starting at line 3
Context: All report lines have been processed and more email flag is true
GIVEN
All report lines have been processed and more email flag is true
Applied to: Send Final Email Batch
WHEN
Sending the final email batch using EMCSEND3
THEN
If send fails, redirect to error notification addresses AEI9999 and OM01247
Context: Email transmission has failed
GIVEN
Email transmission has failed
Applied to: Send Error Notification to Support
WHEN
The EMCSEND3 return status indicates failure
THEN
Clear recipient addresses, set error notification recipients to AEI9999 and OM01247, and attempt to send error notification
Context: Error notification email transmission has also failed
GIVEN
Error notification email transmission has also failed
Applied to: Log Email Failure
WHEN
The system cannot send any email notifications
THEN
Generate system error message 'SEND TO FILE OF OM01247 FAILED' and perform system abend
Context: Email processing has completed successfully or error handling is complete
GIVEN
Email processing has completed successfully or error handling is complete
Applied to: Purge Email Transaction
WHEN
Performing transaction cleanup
THEN
Initialize accept status, call CIMS with PURG function, and set destination filename to export file
Context: An AEI report needs to be distributed via email
GIVEN
An AEI report needs to be distributed via email
Applied to: Initialize Email Parameters
WHEN
The system initializes email parameters
THEN
Email copy usercode, keywords, item sequence numbers, item alpha sequence, item width, and text content are cleared, and item width is set to 80 characters
Context: A train origin station code is available
GIVEN
A train origin station code is available
Applied to: Query AEI Email Distribution List
WHEN
The system queries the AEI email distribution table using train origin as key with record type 'CUSEMAIL'
THEN
The system retrieves the email distribution configuration for that origin station
Context: The AEI email distribution query returns success status
GIVEN
The AEI email distribution query returns success status
Applied to: Email Distribution Found?
WHEN
The system processes the query results
THEN
The system sets default MERLIN ID as sender and populates up to 10 recipient email addresses from the distribution list, stopping when a blank recipient is encountered
Context: The AEI email distribution query fails or returns no entry status
GIVEN
The AEI email distribution query fails or returns no entry status
Applied to: Use Default MERLIN Email
WHEN
The system cannot retrieve specific email distribution configuration
THEN
The system uses default MERLIN ID for both sender and recipient email addresses
Context: A train processing result status and train identification information are available
GIVEN
A train processing result status and train identification information are available
Applied to: Build Email Subject Line
WHEN
The system builds the email subject line
THEN
The subject contains 'US TRAIN [train_id] NOT SENT AT [origin]' if errors occurred, or 'US TRAIN [train_id] SENT AT [origin]' if processing was successful
Context: Report lines are available from train processing results
GIVEN
Report lines are available from train processing results
Applied to: Load Report Lines into Email
WHEN
The system loads report content into email message
THEN
Each report line is copied to email text lines sequentially, with line counter incremented, and email-more flag set to true
Context: Report lines are being loaded into email message
GIVEN
Report lines are being loaded into email message
Applied to: Email Size Limit Reached?
WHEN
The email line count exceeds 699 lines
THEN
The system sets no-more-email flag, sends current email batch, clears email text, resets line counter to 1, and adds continuation header lines
Context: Email content is prepared with recipients, subject, and message text
GIVEN
Email content is prepared with recipients, subject, and message text
Applied to: Send Current Email Batch
WHEN
The system sends the email batch
THEN
The email is transmitted to inbox destination using sender ID, recipient list, subject line, and message content through the email service
Context: An AEI email send operation fails
GIVEN
An AEI email send operation fails
Applied to: Send Error Notification to Support
WHEN
The system detects email transmission failure
THEN
The system clears recipient list, sets AEI9999 and OM01247 as error recipients, and attempts to send error notification using the same email service
Context: Email processing is complete regardless of success or failure
GIVEN
Email processing is complete regardless of success or failure
Applied to: Purge Email Transaction
WHEN
The system finalizes email operations
THEN
The system clears accept status and purges the email transaction using the alternate PCB
R-GCX003-cbl-00490 (+27) File: GCX003.cbl AEI Activity Logging Merged 28 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AEI Activity Logging':
  • Context - aei activity logging is triggered:
    For Initialize Log Entry Structure:
    When the system begins creating a log entry, then the log entry structure is initialized to prepare for data population.
  • Context - an aei log entry is being created:
    For Set Security Level to High:
    When security level needs to be assigned, then the security byte is set to high-values to indicate maximum security classification.
    For Set Sending Transaction ID:
    When the originating transaction needs to be identified, then the sending transaction is set to 'gct0031e' to identify the source transaction.
  • Context - an aei activity log entry is being prepared:
    For Set Record Type as US Train:
    When record type classification is required, then the record type is set to us-train to identify this as a us train activity log.
  • Context - an aei log entry requires an action code:
    For Set Action Code to ZZZ:
    When the action code field needs to be populated, then the action code is set to 'zzz' as the standard identifier for aei send activities.
  • Context - an aei activity is being logged:
    For Capture User ACF2 ID:
    When user identification is required for the log entry, then the acf2 user id from the current session is captured and stored in the log entry.
  • Context - an aei log entry requires a date timestamp:
    For Format Current Date:
    When the current date needs to be recorded, then the system date is formatted by concatenating machine century and machine date into the log entry date field.
  • Context - an aei activity log entry is being created:
    For Capture Current Time:
    When a time timestamp is required, then the current machine time is captured and stored in the log entry time field.
  • Context - an aei send activity is being logged:
    For Record Train ID from Customs:
    When the train identifier needs to be recorded, then the us customs train id from the train list is stored in the log entry.
  • Context - an aei activity log entry requires a descriptive message:
    For Set Standard AEI Send Message:
    When the message field needs to be populated, then the standard aei send log message is assigned to describe the activity.
  • Context - an aei log entry has been populated with all required data:
    For Prepare Log Message for Queue:
    When the log entry needs to be queued for processing, then the log input structure is moved to the message format for queue transmission.
  • Context - an aei log entry is prepared for transmission:
    For Send Log to Message Queue:
    When the log needs to be sent to the queue system, then the system calls the message queue service to transmit the log entry.
  • Context - an aei log entry has been queued:
    For Write Log Message to System:
    When the log message needs to be written to system storage, then the system writes the log message using the message logging service.
  • Context - an aei log message has been successfully written to the system:
    For Purge Message Queue:
    When queue cleanup is required, then the message queue is purged to remove the processed log entry.
  • Context - an aei train send operation has been completed successfully:
    For Initialize Activity Log Record:
    When the system begins the activity logging process, then a new activity log record is initialized with all fields cleared and ready for population.
  • Context - an aei activity log record is being created:
    For Set Security Byte to High-Values:
    When the security classification needs to be assigned, then the security byte is set to high-values to indicate maximum security level.
    For Set Action Code to 'ZZZ':
    When the action code needs to be assigned, then the action code is set to 'zzz' as the standard identifier for aei logging activities.
    For Capture Current System Date:
    When the date timestamp needs to be recorded, then the current system date from the machine century and date fields is captured and formatted for the log record.
    For Capture Current System Time:
    When the time timestamp needs to be recorded, then the current system time from the machine time field is captured and recorded in the log.
  • Context - an aei activity log record is being created for a train send operation:
    For Set Record Type as US-TRAIN:
    When the record type classification is being assigned, then the record type is set to 'us-train' to identify this as a us train activity.
    For Set Log Message as 'AEI SEND LOG MESSAGE':
    When the log message content needs to be assigned, then the message field is set to the predefined 'aei send log message' constant.
  • Context - an aei activity log record is being created from a train send operation:
    For Set Sending Transaction to 'GCT0031E':
    When the sending transaction identifier needs to be recorded, then the sending transaction is set to 'gct0031e' to identify the source transaction.
  • Context - an aei train send operation was initiated by a user:
    For Capture User ACF2 ID:
    When the activity log record is being populated, then the user's acf2 id from the common communication area is captured and recorded in the log.
  • Context - an aei train send operation has been completed for a specific train:
    For Record US Customs Train ID:
    When the activity log record is being populated with train information, then the us customs train id from the train list is recorded in the log as the train identifier.
  • Context - an aei activity log record has been populated with all required information:
    For Format Log Record for GCT1051E:
    When the record needs to be prepared for transmission, then the log input structure is formatted and moved to the gct1051e message format.
  • Context - an aei activity log record has been formatted for transmission:
    For Send Log Record to Message Queue:
    When the record needs to be sent to the logging system, then the system calls the message processing service to change the alternate pcb and queue the log record.
  • Context - an aei activity log record has been queued for processing:
    For Write Log Message to System:
    When the record needs to be permanently logged, then the system calls the message writing service with the log message code, content, length, and module name.
  • Context - an aei activity log record has been successfully written to the system log:
    For Purge Message Queue:
    When the logging transaction needs to be completed, then the system calls the message processing service to purge the alternate pcb and complete the transaction.
👨‍💻 Technical ACs (Gherkin)
Context: AEI activity logging is triggered
GIVEN
AEI activity logging is triggered
Applied to: Initialize Log Entry Structure
WHEN
The system begins creating a log entry
THEN
The log entry structure is initialized to prepare for data population
Context: An AEI log entry is being created
GIVEN
An AEI log entry is being created
Applied to: Set Security Level to High
WHEN
Security level needs to be assigned
THEN
The security byte is set to HIGH-VALUES to indicate maximum security classification
Applied to: Set Sending Transaction ID
WHEN
The originating transaction needs to be identified
THEN
The sending transaction is set to 'GCT0031E' to identify the source transaction
Context: An AEI activity log entry is being prepared
GIVEN
An AEI activity log entry is being prepared
Applied to: Set Record Type as US Train
WHEN
Record type classification is required
THEN
The record type is set to US-TRAIN to identify this as a US train activity log
Context: An AEI log entry requires an action code
GIVEN
An AEI log entry requires an action code
Applied to: Set Action Code to ZZZ
WHEN
The action code field needs to be populated
THEN
The action code is set to 'ZZZ' as the standard identifier for AEI send activities
Context: An AEI activity is being logged
GIVEN
An AEI activity is being logged
Applied to: Capture User ACF2 ID
WHEN
User identification is required for the log entry
THEN
The ACF2 user ID from the current session is captured and stored in the log entry
Context: An AEI log entry requires a date timestamp
GIVEN
An AEI log entry requires a date timestamp
Applied to: Format Current Date
WHEN
The current date needs to be recorded
THEN
The system date is formatted by concatenating machine century and machine date into the log entry date field
Context: An AEI activity log entry is being created
GIVEN
An AEI activity log entry is being created
Applied to: Capture Current Time
WHEN
A time timestamp is required
THEN
The current machine time is captured and stored in the log entry time field
Context: An AEI send activity is being logged
GIVEN
An AEI send activity is being logged
Applied to: Record Train ID from Customs
WHEN
The train identifier needs to be recorded
THEN
The US Customs train ID from the train list is stored in the log entry
Context: An AEI activity log entry requires a descriptive message
GIVEN
An AEI activity log entry requires a descriptive message
Applied to: Set Standard AEI Send Message
WHEN
The message field needs to be populated
THEN
The standard AEI send log message is assigned to describe the activity
Context: An AEI log entry has been populated with all required data
GIVEN
An AEI log entry has been populated with all required data
Applied to: Prepare Log Message for Queue
WHEN
The log entry needs to be queued for processing
THEN
The log input structure is moved to the message format for queue transmission
Context: An AEI log entry is prepared for transmission
GIVEN
An AEI log entry is prepared for transmission
Applied to: Send Log to Message Queue
WHEN
The log needs to be sent to the queue system
THEN
The system calls the message queue service to transmit the log entry
Context: An AEI log entry has been queued
GIVEN
An AEI log entry has been queued
Applied to: Write Log Message to System
WHEN
The log message needs to be written to system storage
THEN
The system writes the log message using the message logging service
Context: An AEI log message has been successfully written to the system
GIVEN
An AEI log message has been successfully written to the system
Applied to: Purge Message Queue
WHEN
Queue cleanup is required
THEN
The message queue is purged to remove the processed log entry
Context: An AEI train send operation has been completed successfully
GIVEN
An AEI train send operation has been completed successfully
Applied to: Initialize Activity Log Record
WHEN
The system begins the activity logging process
THEN
A new activity log record is initialized with all fields cleared and ready for population
Context: An AEI activity log record is being created
GIVEN
An AEI activity log record is being created
Applied to: Set Security Byte to High-Values
WHEN
The security classification needs to be assigned
THEN
The security byte is set to high-values to indicate maximum security level
Applied to: Set Action Code to 'ZZZ'
WHEN
The action code needs to be assigned
THEN
The action code is set to 'ZZZ' as the standard identifier for AEI logging activities
Applied to: Capture Current System Date
WHEN
The date timestamp needs to be recorded
THEN
The current system date from the machine century and date fields is captured and formatted for the log record
Applied to: Capture Current System Time
WHEN
The time timestamp needs to be recorded
THEN
The current system time from the machine time field is captured and recorded in the log
Context: An AEI activity log record is being created for a train send operation
GIVEN
An AEI activity log record is being created for a train send operation
Applied to: Set Record Type as US-TRAIN
WHEN
The record type classification is being assigned
THEN
The record type is set to 'US-TRAIN' to identify this as a US train activity
Applied to: Set Log Message as 'AEI SEND LOG MESSAGE'
WHEN
The log message content needs to be assigned
THEN
The message field is set to the predefined 'AEI SEND LOG MESSAGE' constant
Context: An AEI activity log record is being created from a train send operation
GIVEN
An AEI activity log record is being created from a train send operation
Applied to: Set Sending Transaction to 'GCT0031E'
WHEN
The sending transaction identifier needs to be recorded
THEN
The sending transaction is set to 'GCT0031E' to identify the source transaction
Context: An AEI train send operation was initiated by a user
GIVEN
An AEI train send operation was initiated by a user
Applied to: Capture User ACF2 ID
WHEN
The activity log record is being populated
THEN
The user's ACF2 ID from the common communication area is captured and recorded in the log
Context: An AEI train send operation has been completed for a specific train
GIVEN
An AEI train send operation has been completed for a specific train
Applied to: Record US Customs Train ID
WHEN
The activity log record is being populated with train information
THEN
The US Customs Train ID from the train list is recorded in the log as the train identifier
Context: An AEI activity log record has been populated with all required information
GIVEN
An AEI activity log record has been populated with all required information
Applied to: Format Log Record for GCT1051E
WHEN
The record needs to be prepared for transmission
THEN
The log input structure is formatted and moved to the GCT1051E message format
Context: An AEI activity log record has been formatted for transmission
GIVEN
An AEI activity log record has been formatted for transmission
Applied to: Send Log Record to Message Queue
WHEN
The record needs to be sent to the logging system
THEN
The system calls the message processing service to change the alternate PCB and queue the log record
Context: An AEI activity log record has been queued for processing
GIVEN
An AEI activity log record has been queued for processing
Applied to: Write Log Message to System
WHEN
The record needs to be permanently logged
THEN
The system calls the message writing service with the log message code, content, length, and module name
Context: An AEI activity log record has been successfully written to the system log
GIVEN
An AEI activity log record has been successfully written to the system log
Applied to: Purge Message Queue
WHEN
The logging transaction needs to be completed
THEN
The system calls the message processing service to purge the alternate PCB and complete the transaction
R-GCX003-cbl-00504 (+14) File: GCX003.cbl Canadian Export Report Generation Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Export Report Generation':
  • Context - a train processing request has been completed:
    For Check if Train Successfully Sent:
    When the system evaluates the train processing outcome, then canadian export report generation is triggered only if the train was successfully sent without errors and without spawn conditions.
  • Context - canadian export report generation has been triggered:
    For Initialize GCX141 Message Parameters:
    When the system prepares the export report message, then all gcx141 input parameters are cleared and reset to initial state.
  • Context - gcx141 message parameters have been initialized:
    For Set Message Function Name Flag:
    When the system configures the message function type, then the message function name flag is set to indicate export report generation.
  • Context - export report message function has been configured:
    For Set Security Byte to High Values:
    When the system sets security parameters for the message, then the security byte is set to high values to ensure proper authorization level.
  • Context - export report security has been configured:
    For Move US Customs Train ID to Message:
    When the system populates the train identifier in the message, then the us customs train id from the train list is assigned to the gcx141 train id field.
  • Context - train identifier has been assigned to the export report message:
    For Set Message Function Length Flag:
    When the system finalizes message configuration, then the message function length flag is set to indicate proper message sizing.
  • Context - all gcx141 message parameters have been configured:
    For Move Input Parameters to Message Output:
    When the system prepares the message for transmission, then the complete gcx141 input structure is moved to the message output text field.
  • Context - export report message has been prepared with all required parameters:
    For Insert GCX141 Message to Queue:
    When the system sends the message to the gcx141 processing queue, then the message is inserted into the queue for canadian export report generation.
  • Context - a canadian export report needs to be generated:
    For Initialize GCX141 Message Parameters:
    When the system begins the report generation process, then all gcx141 input parameters are initialized to blank values.
  • Context - gcx141 message parameters are initialized:
    For Set Message Function Name Flag:
    When the system configures the message type, then the message function name flag is set to true.
  • Context - a canadian export message is being prepared:
    For Set Security Byte to High Values:
    When security parameters need to be established, then the security byte is set to high values for maximum security clearance.
  • Context - a train list contains a valid us customs train id:
    For Move US Customs Train ID to GCX141 Train ID:
    When a canadian export message is being prepared for that train, then the us customs train id is copied to the gcx141 train id field.
  • Context - train id has been set in the gcx141 message:
    For Set Message Function Length Flag:
    When message length parameters need to be configured, then the message function length flag is set to true.
  • Context - gcx141 input parameters are fully configured with train id and flags:
    For Move GCX141 Input to Message Output Text:
    When the message needs to be prepared for output, then the complete gcx141 input is moved to the message output text field.
  • Context - a complete canadian export message is prepared in the output text field:
    For Insert GCX141 Message to Queue:
    When the message needs to be queued for processing, then the gcx141 message is inserted into the processing queue via z750-isrt-gcx141-msg procedure.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request has been completed
GIVEN
A train processing request has been completed
Applied to: Check if Train Successfully Sent
WHEN
The system evaluates the train processing outcome
THEN
Canadian export report generation is triggered only if the train was successfully sent without errors and without spawn conditions
Context: Canadian export report generation has been triggered
GIVEN
Canadian export report generation has been triggered
Applied to: Initialize GCX141 Message Parameters
WHEN
The system prepares the export report message
THEN
All GCX141 input parameters are cleared and reset to initial state
Context: GCX141 message parameters have been initialized
GIVEN
GCX141 message parameters have been initialized
Applied to: Set Message Function Name Flag
WHEN
The system configures the message function type
THEN
The message function name flag is set to indicate export report generation
Context: Export report message function has been configured
GIVEN
Export report message function has been configured
Applied to: Set Security Byte to High Values
WHEN
The system sets security parameters for the message
THEN
The security byte is set to high values to ensure proper authorization level
Context: Export report security has been configured
GIVEN
Export report security has been configured
Applied to: Move US Customs Train ID to Message
WHEN
The system populates the train identifier in the message
THEN
The US customs train ID from the train list is assigned to the GCX141 train ID field
Context: Train identifier has been assigned to the export report message
GIVEN
Train identifier has been assigned to the export report message
Applied to: Set Message Function Length Flag
WHEN
The system finalizes message configuration
THEN
The message function length flag is set to indicate proper message sizing
Context: All GCX141 message parameters have been configured
GIVEN
All GCX141 message parameters have been configured
Applied to: Move Input Parameters to Message Output
WHEN
The system prepares the message for transmission
THEN
The complete GCX141 input structure is moved to the message output text field
Context: Export report message has been prepared with all required parameters
GIVEN
Export report message has been prepared with all required parameters
Applied to: Insert GCX141 Message to Queue
WHEN
The system sends the message to the GCX141 processing queue
THEN
The message is inserted into the queue for Canadian export report generation
Context: A Canadian export report needs to be generated
GIVEN
A Canadian export report needs to be generated
Applied to: Initialize GCX141 Message Parameters
WHEN
The system begins the report generation process
THEN
All GCX141 input parameters are initialized to blank values
Context: GCX141 message parameters are initialized
GIVEN
GCX141 message parameters are initialized
Applied to: Set Message Function Name Flag
WHEN
The system configures the message type
THEN
The message function name flag is set to TRUE
Context: A Canadian export message is being prepared
GIVEN
A Canadian export message is being prepared
Applied to: Set Security Byte to High Values
WHEN
Security parameters need to be established
THEN
The security byte is set to high values for maximum security clearance
Context: A train list contains a valid US customs train ID
GIVEN
A train list contains a valid US customs train ID
Applied to: Move US Customs Train ID to GCX141 Train ID
WHEN
A Canadian export message is being prepared for that train
THEN
The US customs train ID is copied to the GCX141 train ID field
Context: Train ID has been set in the GCX141 message
GIVEN
Train ID has been set in the GCX141 message
Applied to: Set Message Function Length Flag
WHEN
Message length parameters need to be configured
THEN
The message function length flag is set to TRUE
Context: GCX141 input parameters are fully configured with train ID and flags
GIVEN
GCX141 input parameters are fully configured with train ID and flags
Applied to: Move GCX141 Input to Message Output Text
WHEN
The message needs to be prepared for output
THEN
The complete GCX141 input is moved to the message output text field
Context: A complete Canadian export message is prepared in the output text field
GIVEN
A complete Canadian export message is prepared in the output text field
Applied to: Insert GCX141 Message to Queue
WHEN
The message needs to be queued for processing
THEN
The GCX141 message is inserted into the processing queue via Z750-ISRT-GCX141-MSG procedure
R-GCX003-cbl-00512 (+14) File: GCX003.cbl Enhanced Report Generation Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Enhanced Report Generation':
  • Context - a train processing request is being finalized:
    For Check if Laredo TX Station:
    When the system checks the crossing port station code, then enhanced report generation is triggered only for laredo tx station (cst-laredo-tx-station).
  • Context - enhanced report generation is active for laredo tx station:
    For Build Header Line 1 - Train ID and Car Counts:
    When the system builds the first header line, then the header includes us customer train id, total loaded cars count, and total empty cars count and the header includes the us customer train id, total loaded cars count, and total empty cars count.
  • Context - enhanced report generation is active and first header is complete:
    For Build Header Line 2 - ETA Date/Time and Container Counts:
    When the system builds the second header line, then the header includes eta century (19 for years >94, 20 otherwise), eta year/month/day/hour/minute, total loaded containers count, and total empty containers count.
  • Context - enhanced report generation is active and previous headers are complete:
    For Build Header Line 3 - Port Code/Name and Locomotive Count:
    When the system builds the third header line, then the header includes us station code, us station name, total locomotives count, and calculated total equipment count (cars + containers + locomotives).
  • Context - individual equipment counts are available (loaded cars, empty cars, loaded containers, empty containers, locomotives):
    For Calculate Total Equipment Count:
    When the system calculates total equipment, then total equals the sum of loaded cars + empty cars + loaded containers + empty containers + locomotives.
  • Context - enhanced report content is ready for distribution:
    For Initialize Email Parameters:
    When the system initializes email parameters, then email sender and recipient are set to om01247, line width is set to 80 characters, and subject includes train id.
  • Context - enhanced report lines are being added to email message:
    For Email Message Size Limit Reached?:
    When the system checks if message size limit is reached, then if line count exceeds 699 lines, send current batch and initialize continuation email with headers.
  • Context - email message size limit of 699 lines has been reached:
    For Initialize Continuation Email:
    When the system initializes a continuation email, then email message is cleared, line counter is reset, continuation message is added, and detail headers are re-added.
  • Context - a train export request is being processed:
    For Check Location:
    When the system checks the train crossing location, then enhanced report generation is enabled only for laredo tx station, otherwise the process is skipped.
  • Context - enhanced report generation is active:
    For Build Header Line 2 - ETA Date/Time and Container Counts:
    When the system builds the second header line, then the header includes eta date with century calculation (19xx for years >94, 20xx otherwise), eta time, loaded container count, and empty container count.
    For Build Header Line 3 - Port Information and Totals:
    When the system builds the third header line, then the header includes port code, port name, locomotive count, and total equipment count (sum of cars, containers, and locomotives).
  • Context - enhanced report lines are being processed for email transmission:
    For Line Count > 699?:
    When the line count reaches 699 lines, then the current email batch is sent, email buffer is reset, continuation header is added, and processing continues with remaining lines.
  • Context - enhanced report content is ready for transmission:
    For Send Email Batch:
    When the system sends the email batch, then email is sent to om01247 usercode with 80-character line width and appropriate subject line containing train id.
  • Context - enhanced report email transmission fails:
    For Handle Email Error:
    When the email send operation is unsuccessful, then the system terminates processing with error message 'send to file of om01247 failed'.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request is being finalized
GIVEN
A train processing request is being finalized
Applied to: Check if Laredo TX Station
WHEN
The system checks the crossing port station code
THEN
Enhanced report generation is triggered only for Laredo TX station (CST-LAREDO-TX-STATION)
Context: Enhanced report generation is active for Laredo TX station
GIVEN
Enhanced report generation is active for Laredo TX station
Applied to: Build Header Line 1 - Train ID and Car Counts
WHEN
The system builds the first header line
THEN
The header includes US customer train ID, total loaded cars count, and total empty cars count AND The header includes the US customer train ID, total loaded cars count, and total empty cars count
Context: Enhanced report generation is active and first header is complete
GIVEN
Enhanced report generation is active and first header is complete
Applied to: Build Header Line 2 - ETA Date/Time and Container Counts
WHEN
The system builds the second header line
THEN
The header includes ETA century (19 for years >94, 20 otherwise), ETA year/month/day/hour/minute, total loaded containers count, and total empty containers count
Context: Enhanced report generation is active and previous headers are complete
GIVEN
Enhanced report generation is active and previous headers are complete
Applied to: Build Header Line 3 - Port Code/Name and Locomotive Count
WHEN
The system builds the third header line
THEN
The header includes US station code, US station name, total locomotives count, and calculated total equipment count (cars + containers + locomotives)
Context: Individual equipment counts are available (loaded cars, empty cars, loaded containers, empty containers, locomotives)
GIVEN
Individual equipment counts are available (loaded cars, empty cars, loaded containers, empty containers, locomotives)
Applied to: Calculate Total Equipment Count
WHEN
The system calculates total equipment
THEN
Total equals the sum of loaded cars + empty cars + loaded containers + empty containers + locomotives
Context: Enhanced report content is ready for distribution
GIVEN
Enhanced report content is ready for distribution
Applied to: Initialize Email Parameters
WHEN
The system initializes email parameters
THEN
Email sender and recipient are set to OM01247, line width is set to 80 characters, and subject includes train ID
Context: Enhanced report lines are being added to email message
GIVEN
Enhanced report lines are being added to email message
Applied to: Email Message Size Limit Reached?
WHEN
The system checks if message size limit is reached
THEN
If line count exceeds 699 lines, send current batch and initialize continuation email with headers
Context: Email message size limit of 699 lines has been reached
GIVEN
Email message size limit of 699 lines has been reached
Applied to: Initialize Continuation Email
WHEN
The system initializes a continuation email
THEN
Email message is cleared, line counter is reset, continuation message is added, and detail headers are re-added
Context: A train export request is being processed
GIVEN
A train export request is being processed
Applied to: Check Location
WHEN
The system checks the train crossing location
THEN
Enhanced report generation is enabled only for Laredo TX station, otherwise the process is skipped
Context: Enhanced report generation is active
GIVEN
Enhanced report generation is active
Applied to: Build Header Line 2 - ETA Date/Time and Container Counts
WHEN
The system builds the second header line
THEN
The header includes ETA date with century calculation (19xx for years >94, 20xx otherwise), ETA time, loaded container count, and empty container count
Applied to: Build Header Line 3 - Port Information and Totals
WHEN
The system builds the third header line
THEN
The header includes port code, port name, locomotive count, and total equipment count (sum of cars, containers, and locomotives)
Context: Enhanced report lines are being processed for email transmission
GIVEN
Enhanced report lines are being processed for email transmission
Applied to: Line Count > 699?
WHEN
The line count reaches 699 lines
THEN
The current email batch is sent, email buffer is reset, continuation header is added, and processing continues with remaining lines
Context: Enhanced report content is ready for transmission
GIVEN
Enhanced report content is ready for transmission
Applied to: Send Email Batch
WHEN
The system sends the email batch
THEN
Email is sent to OM01247 usercode with 80-character line width and appropriate subject line containing train ID
Context: Enhanced report email transmission fails
GIVEN
Enhanced report email transmission fails
Applied to: Handle Email Error
WHEN
The email send operation is unsuccessful
THEN
The system terminates processing with error message 'SEND TO FILE OF OM01247 FAILED'
R-GCX003-cbl-00520 (+10) File: GCX003.cbl PDF Report Generation Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PDF Report Generation':
  • Context - pdf report generation is initiated:
    For Start PDF Report Generation:
    When the system starts the pdf generation process, then the report message data should be cleared to prepare for new content.
  • Context - a pre-exit report needs to be generated:
    For Prepare Pre-Exit Report Data:
    When preparing the report data, then the report message should be populated with the existing email text content and email subject should be set from the first report line.
  • Context - a pre-exit report is being configured:
    For Set Report Title: 'Pre-Exit Report':
    When setting up the report parameters, then the report title should be set to 'pre-exit report', report type to 'export', pdf length to 80 characters, train id from the train list, and number of lines from the current report.
  • Context - pre-exit report data is prepared and configured:
    For Call GCX904R for Pre-Exit PDF:
    When generating the pdf document, then the gcx904r service should be called to create the pdf with the prepared report data.
  • Context - an export train report needs to be generated:
    For Prepare Export Train Report Data:
    When preparing the report data, then the report message should be populated with the new report table content and email subject should be set from the new report subject.
  • Context - an export train report is being configured:
    For Set Report Title: 'Export Train Report':
    When setting up the report parameters, then the report title should be set to 'export train report', report type to 'export', pdf length to 132 characters, train id from the train list, and number of lines from the new report.
  • Context - export train report data is prepared and configured:
    For Call GCX904R for Export Train PDF:
    When generating the pdf document, then the gcx904r service should be called to create the pdf with the prepared report data.
  • Context - a train export report has been processed and report data is available:
    For Call GCX904R for Pre-Exit PDF:
    When the system initiates pdf report generation for pre-exit documentation, then the system should prepare report data, set report title to 'pre-exit report', set report type to 'export', configure pdf line length to 80 characters, calculate total number of report lines, and call gcx904r module to generate the pdf report.
  • Context - a pre-exit pdf report has been generated:
    For Laredo TX Station?:
    When the system checks if the current station is laredo tx station, then if the station is laredo tx, the system should proceed to generate an enhanced report format, otherwise pdf generation should be marked as complete.
  • Context - the processing station is laredo tx and pre-exit pdf has been generated:
    For Call GCX904R for Enhanced PDF:
    When the system initiates enhanced pdf report generation, then the system should prepare enhanced report data, set report title to 'export train report', maintain report type as 'export', configure pdf line length to 132 characters, calculate enhanced report line count, and call gcx904r module to generate the enhanced pdf report.
  • Context - train processing has completed and report generation is requested:
    For Prepare Pre-Exit Report Data:
    When the system prepares data for pdf report creation, then the system should extract train id for report identification, use email subject line as pdf subject, format report content for pdf output, and include report statistics with line count calculations.
👨‍💻 Technical ACs (Gherkin)
Context: PDF report generation is initiated
GIVEN
PDF report generation is initiated
Applied to: Start PDF Report Generation
WHEN
the system starts the PDF generation process
THEN
the report message data should be cleared to prepare for new content
Context: a pre-exit report needs to be generated
GIVEN
a pre-exit report needs to be generated
Applied to: Prepare Pre-Exit Report Data
WHEN
preparing the report data
THEN
the report message should be populated with the existing email text content and email subject should be set from the first report line
Context: a pre-exit report is being configured
GIVEN
a pre-exit report is being configured
Applied to: Set Report Title: 'Pre-Exit Report'
WHEN
setting up the report parameters
THEN
the report title should be set to 'Pre-Exit Report', report type to 'EXPORT', PDF length to 80 characters, train ID from the train list, and number of lines from the current report
Context: pre-exit report data is prepared and configured
GIVEN
pre-exit report data is prepared and configured
Applied to: Call GCX904R for Pre-Exit PDF
WHEN
generating the PDF document
THEN
the GCX904R service should be called to create the PDF with the prepared report data
Context: an export train report needs to be generated
GIVEN
an export train report needs to be generated
Applied to: Prepare Export Train Report Data
WHEN
preparing the report data
THEN
the report message should be populated with the new report table content and email subject should be set from the new report subject
Context: an export train report is being configured
GIVEN
an export train report is being configured
Applied to: Set Report Title: 'Export Train Report'
WHEN
setting up the report parameters
THEN
the report title should be set to 'Export Train Report', report type to 'EXPORT', PDF length to 132 characters, train ID from the train list, and number of lines from the new report
Context: export train report data is prepared and configured
GIVEN
export train report data is prepared and configured
Applied to: Call GCX904R for Export Train PDF
WHEN
generating the PDF document
THEN
the GCX904R service should be called to create the PDF with the prepared report data
Context: A train export report has been processed and report data is available
GIVEN
A train export report has been processed and report data is available
Applied to: Call GCX904R for Pre-Exit PDF
WHEN
The system initiates PDF report generation for pre-exit documentation
THEN
The system should prepare report data, set report title to 'Pre-Exit Report', set report type to 'EXPORT', configure PDF line length to 80 characters, calculate total number of report lines, and call GCX904R module to generate the PDF report
Context: A pre-exit PDF report has been generated
GIVEN
A pre-exit PDF report has been generated
Applied to: Laredo TX Station?
WHEN
The system checks if the current station is Laredo TX station
THEN
If the station is Laredo TX, the system should proceed to generate an enhanced report format, otherwise PDF generation should be marked as complete
Context: The processing station is Laredo TX and pre-exit PDF has been generated
GIVEN
The processing station is Laredo TX and pre-exit PDF has been generated
Applied to: Call GCX904R for Enhanced PDF
WHEN
The system initiates enhanced PDF report generation
THEN
The system should prepare enhanced report data, set report title to 'Export Train Report', maintain report type as 'EXPORT', configure PDF line length to 132 characters, calculate enhanced report line count, and call GCX904R module to generate the enhanced PDF report
Context: Train processing has completed and report generation is requested
GIVEN
Train processing has completed and report generation is requested
Applied to: Prepare Pre-Exit Report Data
WHEN
The system prepares data for PDF report creation
THEN
The system should extract train ID for report identification, use email subject line as PDF subject, format report content for PDF output, and include report statistics with line count calculations
R-GCX003-cbl-00527 (+25) File: GCX003.cbl Error Message Processing Merged 26 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Message Processing':
  • Context - a cargo is found and classified as empty equipment:
    For Check Equipment Type:
    When the origin-destination country codes are not 'camx' or 'mxca', then generate message twenty-seven indicating empty equipment issue.
  • Context - cargo is found with it bond type and special manifest origin is not set:
    For Check Bond Type:
    When the cargo requires it bond processing, then execute crowley process for it bond handling.
  • Context - waybill and cargo are found with special manifest origin flag set:
    For Check Special Conditions:
    When the crossing port is woburn pq station, then continue processing without generating error messages.
  • Context - waybill and cargo are found with special manifest special flag set:
    For Check Special Conditions:
    When the crossing port is not woburn pq station, then continue processing without generating error messages.
  • Context - waybill and cargo are found with export type and us-mexico country codes and special 88 flag:
    For Check Special Conditions:
    When the crossing port is not laredo tx station, then set us-mexico 88 found flag and continue processing.
  • Context - waybill and cargo are found with us-canada-us type and special tr flag:
    For Check Special Conditions:
    When the crossing port is laredo tx station, then set special tr found flag and continue processing.
  • Context - waybill is not found and container is found:
    For Generate Equipment Type Error:
    When processing equipment validation, then continue processing without generating specific error for this condition.
  • Context - waybill is not found and container is not found and equipment is loaded:
    For Generate Equipment Type Error:
    When equipment is not a unit sbu van, then generate message ten indicating waybill not found.
  • Context - waybill status is neither found nor not found:
    For Generate Equipment Type Error:
    When processing waybill validation, then generate message twenty-six indicating waybill processing error.
  • Context - waybill is found and no cargo is found and idler indicator is not spaces:
    For Generate Cargo Status Error:
    When processing cargo validation, then generate message fifteen with waybill root key and date.
  • Context - waybill is found and no cargo is found and residue weight threshold is greater than 7 and equipment is empty:
    For Generate Load Status Warning:
    When idler indicator is not 'i', then generate message forty-four with waybill root key and date.
  • Context - waybill is found and no cargo is found and origin state is us and destination state is us and equipment is loaded:
    For Check Load Status Consistent:
    When equipment is not a conveying car, then execute detour process.
  • Context - waybill is found and no cargo is found and origin state is us and destination state is us and equipment is empty and residue weight is greater than 0 and er is found:
    For Check Load Status Consistent:
    When equipment is not a conveying car, then execute detour process.
  • Context - waybill is found and no cargo is found and container is not found and equipment is loaded:
    For Generate Documentation Warning:
    When equipment is not conveying car and idler indicator is not 'i', then generate message fifteen with waybill root key and date.
  • Context - cargo is found with cp cargo status:
    For Generate Cargo Status Error:
    When status is pending, deleted, or error, then generate message sixteen indicating invalid cargo status.
  • Context - cargo is found with tr bond type:
    For Generate Bond Type Error:
    When cargo status description equals export status, then generate message twelve indicating tr bond export issue.
  • Context - cargo is found with mt bond type and vessel name is not 'train' and not spaces:
    For Generate Bond Type Error:
    When station code matches cargo location id, then generate message twenty-five indicating mt bond location issue.
  • Context - cargo is found with te bond type:
    For Generate Bond Type Error:
    When vessel name character at position 23 is 't', then generate message seventeen indicating invalid vessel name.
  • Context - cargo is found with bond type not te and not mt:
    For Generate Bond Type Error:
    When vessel name is not 'train', then generate message seventeen indicating invalid vessel name.
  • Context - cargo is found at laredo tx station with cargo status description equal to hold border:
    For Generate Port Requirement Error:
    When dsp hold status is yes, then generate message fifty-two indicating hold border with dsp hold.
  • Context - cargo is found at laredo tx station:
    For Generate Port Requirement Error:
    When dsp hold status is yes, then generate message forty-nine indicating dsp hold.
    For Generate Port Requirement Error:
    When cargo status description equals hold border, then generate message forty-eight indicating hold border without dsp.
  • Context - cargo is found at laredo tx station and segment 02 is found:
    For Generate Documentation Warning:
    When fen reference number is not found in segment data, then generate message forty-six indicating missing fen reference.
    For Generate Documentation Warning:
    When kcm reference number is not found in segment data, then generate message forty-seven indicating missing kcm reference.
  • Context - cargo is found with transport export type and not created for it and not export status and bills as cprs:
    For Check Special Conditions:
    When cargo location id does not match station code, then execute detour process for te bond.
  • Context - a message has been generated during processing:
    For Categorize Message Type:
    When the message type is determined, then set appropriate error, warning, or info flag and increment corresponding counter.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo is found and classified as empty equipment
GIVEN
A cargo is found and classified as empty equipment
Applied to: Check Equipment Type
WHEN
The origin-destination country codes are not 'CAMX' or 'MXCA'
THEN
Generate message twenty-seven indicating empty equipment issue
Context: Cargo is found with IT bond type and special manifest origin is not set
GIVEN
Cargo is found with IT bond type and special manifest origin is not set
Applied to: Check Bond Type
WHEN
The cargo requires IT bond processing
THEN
Execute Crowley process for IT bond handling
Context: Waybill and cargo are found with special manifest origin flag set
GIVEN
Waybill and cargo are found with special manifest origin flag set
Applied to: Check Special Conditions
WHEN
The crossing port is Woburn PQ station
THEN
Continue processing without generating error messages
Context: Waybill and cargo are found with special manifest special flag set
GIVEN
Waybill and cargo are found with special manifest special flag set
Applied to: Check Special Conditions
WHEN
The crossing port is not Woburn PQ station
THEN
Continue processing without generating error messages
Context: Waybill and cargo are found with export type and US-Mexico country codes and special 88 flag
GIVEN
Waybill and cargo are found with export type and US-Mexico country codes and special 88 flag
Applied to: Check Special Conditions
WHEN
The crossing port is not Laredo TX station
THEN
Set US-Mexico 88 found flag and continue processing
Context: Waybill and cargo are found with US-Canada-US type and special TR flag
GIVEN
Waybill and cargo are found with US-Canada-US type and special TR flag
Applied to: Check Special Conditions
WHEN
The crossing port is Laredo TX station
THEN
Set special TR found flag and continue processing
Context: Waybill is not found and container is found
GIVEN
Waybill is not found and container is found
Applied to: Generate Equipment Type Error
WHEN
Processing equipment validation
THEN
Continue processing without generating specific error for this condition
Context: Waybill is not found and container is not found and equipment is loaded
GIVEN
Waybill is not found and container is not found and equipment is loaded
Applied to: Generate Equipment Type Error
WHEN
Equipment is not a unit SBU van
THEN
Generate message ten indicating waybill not found
Context: Waybill status is neither found nor not found
GIVEN
Waybill status is neither found nor not found
Applied to: Generate Equipment Type Error
WHEN
Processing waybill validation
THEN
Generate message twenty-six indicating waybill processing error
Context: Waybill is found and no cargo is found and idler indicator is not spaces
GIVEN
Waybill is found and no cargo is found and idler indicator is not spaces
Applied to: Generate Cargo Status Error
WHEN
Processing cargo validation
THEN
Generate message fifteen with waybill root key and date
Context: Waybill is found and no cargo is found and residue weight threshold is greater than 7 and equipment is empty
GIVEN
Waybill is found and no cargo is found and residue weight threshold is greater than 7 and equipment is empty
Applied to: Generate Load Status Warning
WHEN
Idler indicator is not 'I'
THEN
Generate message forty-four with waybill root key and date
Context: Waybill is found and no cargo is found and origin state is US and destination state is US and equipment is loaded
GIVEN
Waybill is found and no cargo is found and origin state is US and destination state is US and equipment is loaded
Applied to: Check Load Status Consistent
WHEN
Equipment is not a conveying car
THEN
Execute detour process
Context: Waybill is found and no cargo is found and origin state is US and destination state is US and equipment is empty and residue weight is greater than 0 and ER is found
GIVEN
Waybill is found and no cargo is found and origin state is US and destination state is US and equipment is empty and residue weight is greater than 0 and ER is found
Applied to: Check Load Status Consistent
WHEN
Equipment is not a conveying car
THEN
Execute detour process
Context: Waybill is found and no cargo is found and container is not found and equipment is loaded
GIVEN
Waybill is found and no cargo is found and container is not found and equipment is loaded
Applied to: Generate Documentation Warning
WHEN
Equipment is not conveying car and idler indicator is not 'I'
THEN
Generate message fifteen with waybill root key and date
Context: Cargo is found with CP cargo status
GIVEN
Cargo is found with CP cargo status
Applied to: Generate Cargo Status Error
WHEN
Status is pending, deleted, or error
THEN
Generate message sixteen indicating invalid cargo status
Context: Cargo is found with TR bond type
GIVEN
Cargo is found with TR bond type
Applied to: Generate Bond Type Error
WHEN
Cargo status description equals export status
THEN
Generate message twelve indicating TR bond export issue
Context: Cargo is found with MT bond type and vessel name is not 'TRAIN' and not spaces
GIVEN
Cargo is found with MT bond type and vessel name is not 'TRAIN' and not spaces
Applied to: Generate Bond Type Error
WHEN
Station code matches cargo location ID
THEN
Generate message twenty-five indicating MT bond location issue
Context: Cargo is found with TE bond type
GIVEN
Cargo is found with TE bond type
Applied to: Generate Bond Type Error
WHEN
Vessel name character at position 23 is 'T'
THEN
Generate message seventeen indicating invalid vessel name
Context: Cargo is found with bond type not TE and not MT
GIVEN
Cargo is found with bond type not TE and not MT
Applied to: Generate Bond Type Error
WHEN
Vessel name is not 'TRAIN'
THEN
Generate message seventeen indicating invalid vessel name
Context: Cargo is found at Laredo TX station with cargo status description equal to hold border
GIVEN
Cargo is found at Laredo TX station with cargo status description equal to hold border
Applied to: Generate Port Requirement Error
WHEN
DSP hold status is yes
THEN
Generate message fifty-two indicating hold border with DSP hold
Context: Cargo is found at Laredo TX station
GIVEN
Cargo is found at Laredo TX station
Applied to: Generate Port Requirement Error
WHEN
DSP hold status is yes
THEN
Generate message forty-nine indicating DSP hold
Applied to: Generate Port Requirement Error
WHEN
Cargo status description equals hold border
THEN
Generate message forty-eight indicating hold border without DSP
Context: Cargo is found at Laredo TX station and segment 02 is found
GIVEN
Cargo is found at Laredo TX station and segment 02 is found
Applied to: Generate Documentation Warning
WHEN
FEN reference number is not found in segment data
THEN
Generate message forty-six indicating missing FEN reference
Applied to: Generate Documentation Warning
WHEN
KCM reference number is not found in segment data
THEN
Generate message forty-seven indicating missing KCM reference
Context: Cargo is found with transport export type and not created for IT and not export status and bills as CPRS
GIVEN
Cargo is found with transport export type and not created for IT and not export status and bills as CPRS
Applied to: Check Special Conditions
WHEN
Cargo location ID does not match station code
THEN
Execute detour process for TE bond
Context: A message has been generated during processing
GIVEN
A message has been generated during processing
Applied to: Categorize Message Type
WHEN
The message type is determined
THEN
Set appropriate error, warning, or info flag and increment corresponding counter
R-GCX003-cbl-00553 (+3) File: GCX003.cbl Duplicate Equipment Removal Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Duplicate Equipment Removal':
  • Context - a report contains multiple lines with equipment information and message lines:
    For Remove duplicate car entries from reports while preserving messages:
    When the system scans through report lines up to position 700 and encounters equipment entries with car ids, then the system should remove duplicate car id entries while preserving all message lines (error, warning, information) and maintain the first occurrence of each unique car id.
  • Context - the system is processing report lines for duplicate removal:
    For Get Current Report Line:
    When a report line contains an empty car id or represents a message line with prefixes 'err>', 'wrn>', or 'inf>', then the system should skip processing this line and continue to the next report line without any duplicate checking.
  • Context - the system encounters a valid car id that is different from the previously stored car id:
    For Store Car ID as Previous:
    When the car id is not empty and not a message line, then the system should store this car id as the new reference for subsequent duplicate comparisons.
  • Context - the system finds a car id that matches the previously stored car id reference:
    For Clear Duplicate Car ID from Report:
    When the current car id is identical to the held car id from previous processing, then the system should clear the car id from the current report line by setting it to spaces, effectively removing the duplicate entry.
👨‍💻 Technical ACs (Gherkin)
Context: A report contains multiple lines with equipment information and message lines
GIVEN
A report contains multiple lines with equipment information and message lines
Applied to: Remove duplicate car entries from reports while preserving messages
WHEN
The system scans through report lines up to position 700 and encounters equipment entries with car IDs
THEN
The system should remove duplicate car ID entries while preserving all message lines (error, warning, information) and maintain the first occurrence of each unique car ID
Context: The system is processing report lines for duplicate removal
GIVEN
The system is processing report lines for duplicate removal
Applied to: Get Current Report Line
WHEN
A report line contains an empty car ID or represents a message line with prefixes 'ERR>', 'WRN>', or 'INF>'
THEN
The system should skip processing this line and continue to the next report line without any duplicate checking
Context: The system encounters a valid car ID that is different from the previously stored car ID
GIVEN
The system encounters a valid car ID that is different from the previously stored car ID
Applied to: Store Car ID as Previous
WHEN
The car ID is not empty and not a message line
THEN
The system should store this car ID as the new reference for subsequent duplicate comparisons
Context: The system finds a car ID that matches the previously stored car ID reference
GIVEN
The system finds a car ID that matches the previously stored car ID reference
Applied to: Clear Duplicate Car ID from Report
WHEN
The current car ID is identical to the held car ID from previous processing
THEN
The system should clear the car ID from the current report line by setting it to spaces, effectively removing the duplicate entry
R-GCX003-cbl-00557 (+16) File: GCX003.cbl Activity Audit Logging Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Activity Audit Logging':
  • Context - a cargo record needs to be logged for audit purposes:
    For Check if Cargo Record is Valid:
    When the system checks if the cargo record contains valid us ccn data, then the cargo record is considered valid if us ccn is not spaces and logging proceeds, otherwise the record is skipped.
  • Context - a valid cargo record needs to be logged:
    For Initialize Audit Log Entry:
    When the system prepares to create an audit log entry, then the gcx105 input structure is initialized to clear any previous data.
  • Context - an audit log entry is being created:
    For Set Security Byte to High Values:
    When the system sets security parameters for the log entry, then the security byte is set to high values to ensure proper security classification.
    For Set Action Code to ZZZ:
    When the system assigns an action code to categorize the audit activity, then the action code is set to 'zzz' as the standard code for this type of audit logging.
    For Set Sending Transaction ID:
    When the system records the source transaction information, then the sending transaction is set to 'gct0031e' to identify the originating transaction type.
    For Capture User ACF2 ID:
    When the system records user identification information, then the acf2 user id from the common communication area is captured in the audit log.
    For Capture Current Date & Capture Current Time:
    When the system records timestamp information, then the current machine date including century and date components are concatenated and stored in the audit log and the current machine time is captured and stored in the audit log.
    For Set Log Message Type:
    When the system categorizes the type of audit message, then the message type is set to the predefined 'car-added-log-message' to indicate cargo addition activity.
  • Context - an audit log entry is being created for cargo operations:
    For Set Record Type to US Cargo:
    When the system sets the record type classification, then the record type is set to 'us-cargo' to identify this as a cargo-related audit entry.
  • Context - an audit log entry is being created for a cargo record:
    For Set Cargo CCN as Train/CCN ID:
    When the system sets the primary identifier for the audit entry, then the us ccn from the cargo record is used as the train or ccn identifier in the audit log.
  • Context - all audit log components have been populated:
    For Format Complete Log Message:
    When the system prepares the final audit message, then the complete gcx105 input structure is moved to the gct1051e message format for transmission.
  • Context - a complete audit log message has been formatted:
    For Send Log to Message Queue:
    When the system sends the message to the queue, then the message is sent using cims with chng function to the alternate pcb for the gct1051e message type.
  • Context - an audit log message has been queued:
    For Write Log Message to System:
    When the system writes the message to the system log, then the message is written using writmsgl with the message code, content, length, and module name.
  • Context - an audit log message has been written to the system log:
    For Purge Message Queue:
    When the system completes the logging process, then the message queue is purged using cims with purg function to clean up the alternate pcb.
  • Context - the current cargo record has been processed for audit logging:
    For Move to Next Cargo Record:
    When the system continues processing the cargo collection, then the cargo counter is incremented to move to the next cargo record in the added us ccn table.
  • Context - the system is processing cargo records for audit logging:
    For More Cargo Records to Log?:
    When the system checks for more records to process, then processing continues if the current cargo ccn is not spaces and the counter has not exceeded 2499 records.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record needs to be logged for audit purposes
GIVEN
A cargo record needs to be logged for audit purposes
Applied to: Check if Cargo Record is Valid
WHEN
The system checks if the cargo record contains valid US CCN data
THEN
The cargo record is considered valid if US CCN is not spaces and logging proceeds, otherwise the record is skipped
Context: A valid cargo record needs to be logged
GIVEN
A valid cargo record needs to be logged
Applied to: Initialize Audit Log Entry
WHEN
The system prepares to create an audit log entry
THEN
The GCX105 input structure is initialized to clear any previous data
Context: An audit log entry is being created
GIVEN
An audit log entry is being created
Applied to: Set Security Byte to High Values
WHEN
The system sets security parameters for the log entry
THEN
The security byte is set to high values to ensure proper security classification
Applied to: Set Action Code to ZZZ
WHEN
The system assigns an action code to categorize the audit activity
THEN
The action code is set to 'ZZZ' as the standard code for this type of audit logging
Applied to: Set Sending Transaction ID
WHEN
The system records the source transaction information
THEN
The sending transaction is set to 'GCT0031E' to identify the originating transaction type
Applied to: Capture User ACF2 ID
WHEN
The system records user identification information
THEN
The ACF2 user ID from the common communication area is captured in the audit log
Applied to: Capture Current Date & Capture Current Time
WHEN
The system records timestamp information
THEN
The current machine date including century and date components are concatenated and stored in the audit log AND The current machine time is captured and stored in the audit log
Applied to: Set Log Message Type
WHEN
The system categorizes the type of audit message
THEN
The message type is set to the predefined 'CAR-ADDED-LOG-MESSAGE' to indicate cargo addition activity
Context: An audit log entry is being created for cargo operations
GIVEN
An audit log entry is being created for cargo operations
Applied to: Set Record Type to US Cargo
WHEN
The system sets the record type classification
THEN
The record type is set to 'US-CARGO' to identify this as a cargo-related audit entry
Context: An audit log entry is being created for a cargo record
GIVEN
An audit log entry is being created for a cargo record
Applied to: Set Cargo CCN as Train/CCN ID
WHEN
The system sets the primary identifier for the audit entry
THEN
The US CCN from the cargo record is used as the train or CCN identifier in the audit log
Context: All audit log components have been populated
GIVEN
All audit log components have been populated
Applied to: Format Complete Log Message
WHEN
The system prepares the final audit message
THEN
The complete GCX105 input structure is moved to the GCT1051E message format for transmission
Context: A complete audit log message has been formatted
GIVEN
A complete audit log message has been formatted
Applied to: Send Log to Message Queue
WHEN
The system sends the message to the queue
THEN
The message is sent using CIMS with CHNG function to the alternate PCB for the GCT1051E message type
Context: An audit log message has been queued
GIVEN
An audit log message has been queued
Applied to: Write Log Message to System
WHEN
The system writes the message to the system log
THEN
The message is written using WRITMSGL with the message code, content, length, and module name
Context: An audit log message has been written to the system log
GIVEN
An audit log message has been written to the system log
Applied to: Purge Message Queue
WHEN
The system completes the logging process
THEN
The message queue is purged using CIMS with PURG function to clean up the alternate PCB
Context: The current cargo record has been processed for audit logging
GIVEN
The current cargo record has been processed for audit logging
Applied to: Move to Next Cargo Record
WHEN
The system continues processing the cargo collection
THEN
The cargo counter is incremented to move to the next cargo record in the added US CCN table
Context: The system is processing cargo records for audit logging
GIVEN
The system is processing cargo records for audit logging
Applied to: More Cargo Records to Log?
WHEN
The system checks for more records to process
THEN
Processing continues if the current cargo CCN is not spaces and the counter has not exceeded 2499 records
R-GCX003-cbl-00574 (+3) File: GCX003.cbl Database Rollback Processing Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database Rollback Processing':
  • Context - a train manifest processing operation is in progress with database changes pending:
    For Error Detected During Processing:
    When an error is detected during processing that requires transaction rollback, then the system should execute database rollback to undo all uncommitted changes and restore the database to its previous consistent state.
  • Context - a database rollback operation needs to be performed:
    For Initialize Rollback Status:
    When the rollback process is initiated, then the system should initialize the accept status to prepare for rollback command execution.
  • Context - the rollback status has been initialized:
    For Execute Database Rollback Command:
    When the database rollback command is executed, then the system should call the database rollback function to undo all pending changes.
  • Context - train manifest processing is executing with potential for errors:
    For Processing Error Occurred?:
    When the system evaluates whether processing errors have occurred, then if no errors occurred, continue normal processing; if errors occurred, trigger rollback processing.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest processing operation is in progress with database changes pending
GIVEN
A train manifest processing operation is in progress with database changes pending
Applied to: Error Detected During Processing
WHEN
An error is detected during processing that requires transaction rollback
THEN
The system should execute database rollback to undo all uncommitted changes and restore the database to its previous consistent state
Context: A database rollback operation needs to be performed
GIVEN
A database rollback operation needs to be performed
Applied to: Initialize Rollback Status
WHEN
The rollback process is initiated
THEN
The system should initialize the accept status to prepare for rollback command execution
Context: The rollback status has been initialized
GIVEN
The rollback status has been initialized
Applied to: Execute Database Rollback Command
WHEN
The database rollback command is executed
THEN
The system should call the database rollback function to undo all pending changes
Context: Train manifest processing is executing with potential for errors
GIVEN
Train manifest processing is executing with potential for errors
Applied to: Processing Error Occurred?
WHEN
The system evaluates whether processing errors have occurred
THEN
If no errors occurred, continue normal processing; if errors occurred, trigger rollback processing
R-GCX003-cbl-00578 (+12) File: GCX003.cbl Port Automation Classification Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Port Automation Classification':
  • Context - a cargo record with scac code and train origin station:
    For CPRS SCAC and Origin ≠ 9089?:
    When the cargo scac is 'cprs' and the train origin is not '9089', then the port is classified as automated for processing.
    For UPRR SCAC and Origin = 9089?:
    When the cargo scac is 'uprr' and the train origin is '9089', then the port is classified as automated for processing.
  • Context - a cargo that does not meet cprs or uprr automated port criteria:
    For Lookup Port in Reference Table:
    When the system needs to determine port automation status, then look up the port configuration in gcstbrt ss segment using cargo scac and station code.
  • Context - a port configuration record retrieved from reference table:
    For Automated Carrier Flag = 'Y'?:
    When the automated carrier flag is evaluated, then if flag equals 'y' then classify port as automated, otherwise classify as paper-based.
  • Context - a cargo record with automated haulage flag and a paper-based port classification:
    For Update Haulage Flag to Manual 'N':
    When the request action is send and the cargo has haulage processing, then update the cargo haulage automated flag to 'n' for manual processing.
  • Context - a cargo record with manual haulage flag and an automated port classification:
    For Update Haulage Flag to Automated 'Y':
    When the request action is send and the cargo has haulage processing, then update the cargo haulage automated flag to 'y' for automated processing.
  • Context - a cargo record with scac code and a train request with origin station:
    For CPRS Carrier AND Origin ≠ 9089?:
    When the cargo scac is 'cprs' and the train origin is not '9089', then the port is classified as automated.
    For UPRR Carrier AND Origin = 9089?:
    When the cargo scac is 'uprr' and the train origin is '9089', then the port is classified as automated.
  • Context - a cargo scac code and a crossing port station code:
    For Look Up Port in Reference Table:
    When the port automation status needs to be determined from reference data, then look up the port in gcstbrt table using scac and station code combination.
  • Context - a port record retrieved from reference table with automation flag:
    For Automation Flag = 'Y'?:
    When the automation flag is evaluated, then if flag equals 'y' then classify as automated, otherwise classify as paper.
  • Context - a port that is either not found in reference table or has automation flag not equal to 'y':
    For Set Port as PAPER:
    When port classification is being determined, then the port is classified as paper.
  • Context - a cargo with haulage automation flag and a classified port type:
    For Current Haulage Status vs Port Type Mismatch?:
    When the request action is send and cargo is haulage type, then check if automated haulage with paper port or manual haulage with automated port creates a mismatch.
  • Context - a haulage cargo with automation status that conflicts with port classification:
    For Update Haulage Automation Flag:
    When a mismatch is detected between haulage status and port type, then update haulage automation flag to 'n' for paper ports or 'y' for automated ports.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with SCAC code and train origin station
GIVEN
A cargo record with SCAC code and train origin station
Applied to: CPRS SCAC and Origin ≠ 9089?
WHEN
The cargo SCAC is 'CPRS' and the train origin is not '9089'
THEN
The port is classified as automated for processing
Applied to: UPRR SCAC and Origin = 9089?
WHEN
The cargo SCAC is 'UPRR' and the train origin is '9089'
THEN
The port is classified as automated for processing
Context: A cargo that does not meet CPRS or UPRR automated port criteria
GIVEN
A cargo that does not meet CPRS or UPRR automated port criteria
Applied to: Lookup Port in Reference Table
WHEN
The system needs to determine port automation status
THEN
Look up the port configuration in GCSTBRT SS segment using cargo SCAC and station code
Context: A port configuration record retrieved from reference table
GIVEN
A port configuration record retrieved from reference table
Applied to: Automated Carrier Flag = 'Y'?
WHEN
The automated carrier flag is evaluated
THEN
If flag equals 'Y' then classify port as automated, otherwise classify as paper-based
Context: A cargo record with automated haulage flag and a paper-based port classification
GIVEN
A cargo record with automated haulage flag and a paper-based port classification
Applied to: Update Haulage Flag to Manual 'N'
WHEN
The request action is SEND and the cargo has haulage processing
THEN
Update the cargo haulage automated flag to 'N' for manual processing
Context: A cargo record with manual haulage flag and an automated port classification
GIVEN
A cargo record with manual haulage flag and an automated port classification
Applied to: Update Haulage Flag to Automated 'Y'
WHEN
The request action is SEND and the cargo has haulage processing
THEN
Update the cargo haulage automated flag to 'Y' for automated processing
Context: A cargo record with SCAC code and a train request with origin station
GIVEN
A cargo record with SCAC code and a train request with origin station
Applied to: CPRS Carrier AND Origin ≠ 9089?
WHEN
The cargo SCAC is 'CPRS' AND the train origin is not '9089'
THEN
The port is classified as AUTOMATED
Applied to: UPRR Carrier AND Origin = 9089?
WHEN
The cargo SCAC is 'UPRR' AND the train origin is '9089'
THEN
The port is classified as AUTOMATED
Context: A cargo SCAC code and a crossing port station code
GIVEN
A cargo SCAC code and a crossing port station code
Applied to: Look Up Port in Reference Table
WHEN
The port automation status needs to be determined from reference data
THEN
Look up the port in GCSTBRT table using SCAC and station code combination
Context: A port record retrieved from reference table with automation flag
GIVEN
A port record retrieved from reference table with automation flag
Applied to: Automation Flag = 'Y'?
WHEN
The automation flag is evaluated
THEN
If flag equals 'Y' then classify as AUTOMATED, otherwise classify as PAPER
Context: A port that is either not found in reference table or has automation flag not equal to 'Y'
GIVEN
A port that is either not found in reference table or has automation flag not equal to 'Y'
Applied to: Set Port as PAPER
WHEN
Port classification is being determined
THEN
The port is classified as PAPER
Context: A cargo with haulage automation flag and a classified port type
GIVEN
A cargo with haulage automation flag and a classified port type
Applied to: Current Haulage Status vs Port Type Mismatch?
WHEN
The request action is SEND AND cargo is haulage type
THEN
Check if automated haulage with paper port OR manual haulage with automated port creates a mismatch
Context: A haulage cargo with automation status that conflicts with port classification
GIVEN
A haulage cargo with automation status that conflicts with port classification
Applied to: Update Haulage Automation Flag
WHEN
A mismatch is detected between haulage status and port type
THEN
Update haulage automation flag to 'N' for paper ports or 'Y' for automated ports
R-GCX003-cbl-00584 File: GCX003.cbl AEI Request Type Classification
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AEI Request Type Classification':
  • Context - a train export request is received with a specific request type code:
    For Check Request Type:
    When the system evaluates the request type against the aei request type constant, then if the request type equals the aei request type constant, the aei train send flag is set to yes, otherwise the aei train send flag is set to no.
👨‍💻 Technical ACs (Gherkin)
Context: A train export request is received with a specific request type code
GIVEN
A train export request is received with a specific request type code
Applied to: Check Request Type
WHEN
The system evaluates the request type against the AEI request type constant
THEN
If the request type equals the AEI request type constant, the AEI train send flag is set to YES, otherwise the AEI train send flag is set to NO
R-GCX003-cbl-00585 (+2) File: GCX003.cbl Equipment Limit Validation Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Limit Validation':
  • Context - a train manifest request is being processed and no errors have occurred so far:
    For First Equipment Entry Empty?:
    When the first equipment entry in the request is empty (req-no-more-eqp(1) is true), then the system sets error message msg-five and adds it to the report index to indicate no equipment was provided.
    For Equipment Count > 499?:
    When the equipment list contains more than 499 items (not req-no-more-eqp(500) is true), then the system sets error message msg-five and adds it to the report index to indicate too many equipment items were provided.
  • Context - a train manifest request is being processed:
    For Check if No Errors So Far:
    When previous validation steps have resulted in errors (rpt-no-error is false), then the system skips equipment limit validation and continues with subsequent processing.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest request is being processed and no errors have occurred so far
GIVEN
A train manifest request is being processed and no errors have occurred so far
Applied to: First Equipment Entry Empty?
WHEN
The first equipment entry in the request is empty (REQ-NO-MORE-EQP(1) is true)
THEN
The system sets error message MSG-FIVE and adds it to the report index to indicate no equipment was provided
Applied to: Equipment Count > 499?
WHEN
The equipment list contains more than 499 items (NOT REQ-NO-MORE-EQP(500) is true)
THEN
The system sets error message MSG-FIVE and adds it to the report index to indicate too many equipment items were provided
Context: A train manifest request is being processed
GIVEN
A train manifest request is being processed
Applied to: Check if No Errors So Far
WHEN
Previous validation steps have resulted in errors (RPT-NO-ERROR is false)
THEN
The system skips equipment limit validation and continues with subsequent processing
R-GCX003-cbl-00588 (+5) File: GCX003.cbl Double Stack Container Counting Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Double Stack Container Counting':
  • Context - a waybill is found and equipment type code is available:
    For Equipment Type = 'SK' Double Stack?:
    When the equipment type code is evaluated, then if equipment type is 'sk' then proceed to double stack counting, otherwise continue with normal equipment processing.
  • Context - equipment type is confirmed as double stack ('sk') and waybill root key is available:
    For Call GCCDBL Module with Waybill Number:
    When the gccdbl module is called with the waybill number, then double stack traffic type and count information is returned for further processing.
  • Context - double stack container information is retrieved and traffic type is determined:
    For Increment CPRS Double Stack Count:
    When the traffic type is cprs double stack traffic, then add the double stack count to the cprs double stack counter in the train list.
    For Increment CSXT Double Stack Count:
    When the traffic type is csxt double stack traffic, then add the double stack count to the csxt double stack counter in the train list.
    For Increment NS Double Stack Count:
    When the traffic type is ns double stack traffic, then add the double stack count to the ns double stack counter in the train list.
    For Increment HAUL Double Stack Count:
    When the traffic type is haul double stack traffic, then add the double stack count to the haul double stack counter in the train list.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill is found and equipment type code is available
GIVEN
A waybill is found and equipment type code is available
Applied to: Equipment Type = 'SK' Double Stack?
WHEN
The equipment type code is evaluated
THEN
If equipment type is 'SK' then proceed to double stack counting, otherwise continue with normal equipment processing
Context: Equipment type is confirmed as double stack ('SK') and waybill root key is available
GIVEN
Equipment type is confirmed as double stack ('SK') and waybill root key is available
Applied to: Call GCCDBL Module with Waybill Number
WHEN
The GCCDBL module is called with the waybill number
THEN
Double stack traffic type and count information is returned for further processing
Context: Double stack container information is retrieved and traffic type is determined
GIVEN
Double stack container information is retrieved and traffic type is determined
Applied to: Increment CPRS Double Stack Count
WHEN
The traffic type is CPRS double stack traffic
THEN
Add the double stack count to the CPRS double stack counter in the train list
Applied to: Increment CSXT Double Stack Count
WHEN
The traffic type is CSXT double stack traffic
THEN
Add the double stack count to the CSXT double stack counter in the train list
Applied to: Increment NS Double Stack Count
WHEN
The traffic type is NS double stack traffic
THEN
Add the double stack count to the NS double stack counter in the train list
Applied to: Increment HAUL Double Stack Count
WHEN
The traffic type is HAUL double stack traffic
THEN
Add the double stack count to the HAUL double stack counter in the train list
R-GCX003-cbl-00594 (+6) File: GCX003.cbl Equipment Routing Analysis Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Routing Analysis':
  • Context - a waybill exists with routing information in rut-info fields:
    For Extract Routing Information from Waybill:
    When the system processes the waybill routing data, then the routing information is extracted from three rut-info positions and all '!' characters are replaced with spaces.
  • Context - routing information has been extracted from waybill:
    For Initialize Route Search Variables:
    When the system begins route analysis, then route search variables are set to initial state with route not found status and starting position.
  • Context - route analysis variables are initialized and routing information is available:
    For Check Route Entry:
    When the system processes each route entry up to 9 positions or until route is found, then scac code and junction/r260 code are extracted from current route position for evaluation.
  • Context - route entry contains scac codes and junction information:
    For Set Equipment Type 3 - CSXT Haulage:
    When first route scac is csxt and second route scac is cprs and junction is det, then equipment is classified as type 3 for csxt haulage and marked for report inclusion with route found status.
    For Set Equipment Type 4 - NS Haulage:
    When first route scac is ns and second route scac is cprs and junction is det, then equipment is classified as type 4 for ns haulage and marked for report inclusion with route found status.
  • Context - equipment routing does not match csxt or ns to cprs patterns:
    For Set Equipment Type 2 - Hazmat:
    When equipment ima code equals 'hm' indicating hazardous materials, then equipment is classified as type 2 for hazmat and marked for report inclusion with route found status.
  • Context - equipment has been analyzed for routing patterns and hazmat status:
    For Mark Equipment as Empty - Exclude from Report:
    When equipment does not match csxt haulage, ns haulage, or hazmat criteria and no route is found after checking all positions, then equipment empty indicator is set to 1 to exclude from detailed manifest reporting.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill exists with routing information in RUT-INFO fields
GIVEN
A waybill exists with routing information in RUT-INFO fields
Applied to: Extract Routing Information from Waybill
WHEN
The system processes the waybill routing data
THEN
The routing information is extracted from three RUT-INFO positions and all '!' characters are replaced with spaces
Context: Routing information has been extracted from waybill
GIVEN
Routing information has been extracted from waybill
Applied to: Initialize Route Search Variables
WHEN
The system begins route analysis
THEN
Route search variables are set to initial state with route not found status and starting position
Context: Route analysis variables are initialized and routing information is available
GIVEN
Route analysis variables are initialized and routing information is available
Applied to: Check Route Entry
WHEN
The system processes each route entry up to 9 positions or until route is found
THEN
SCAC code and junction/R260 code are extracted from current route position for evaluation
Context: Route entry contains SCAC codes and junction information
GIVEN
Route entry contains SCAC codes and junction information
Applied to: Set Equipment Type 3 - CSXT Haulage
WHEN
First route SCAC is CSXT and second route SCAC is CPRS and junction is DET
THEN
Equipment is classified as type 3 for CSXT haulage and marked for report inclusion with route found status
Applied to: Set Equipment Type 4 - NS Haulage
WHEN
First route SCAC is NS and second route SCAC is CPRS and junction is DET
THEN
Equipment is classified as type 4 for NS haulage and marked for report inclusion with route found status
Context: Equipment routing does not match CSXT or NS to CPRS patterns
GIVEN
Equipment routing does not match CSXT or NS to CPRS patterns
Applied to: Set Equipment Type 2 - Hazmat
WHEN
Equipment IMA code equals 'HM' indicating hazardous materials
THEN
Equipment is classified as type 2 for hazmat and marked for report inclusion with route found status
Context: Equipment has been analyzed for routing patterns and hazmat status
GIVEN
Equipment has been analyzed for routing patterns and hazmat status
Applied to: Mark Equipment as Empty - Exclude from Report
WHEN
Equipment does not match CSXT haulage, NS haulage, or hazmat criteria and no route is found after checking all positions
THEN
Equipment empty indicator is set to 1 to exclude from detailed manifest reporting
R-GCX003-cbl-00601 (+5) File: GCX003.cbl Special Handling Code Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Handling Code Processing':
  • Context - equipment has been retrieved from waybill and shipment commodity information is available:
    For Check if Equipment is Empty and Has Residue Weight:
    When the equipment load indicator is 'e' (empty) and the residue weight in shipment commodity is greater than 0, then initialize special handling code processing for empty residue validation.
  • Context - equipment is empty with residue weight greater than 0 and special handling codes are available in shipment commodity:
    For Special Handling Code = ER Threshold Code?:
    When any special handling code (positions 1-8) equals the er threshold code, then set er found flag to true to indicate empty residue threshold validation is required.
  • Context - equipment is empty with residue weight and er threshold code is found in special handling codes:
    For ER Weight Threshold > 7?:
    When the residue weight is greater than 7 units, then set er weight threshold greater than 7 flag for subsequent error message generation.
  • Context - equipment is empty and has residue weight greater than 7 and er threshold code is found and equipment load indicator is 'e' and idler indicator is not 'i':
    For Generate Error Message 44 - Empty Residue Threshold Exceeded:
    When no cargo is found for the waybill, then generate error message 44 with waybill root key and date information.
  • Context - equipment has residue weight greater than 0 and er threshold code is found in special handling codes:
    For Skip Equipment from Report:
    When the equipment meets empty residue criteria for special processing, then skip the equipment from standard cargo attachment and report generation processes.
  • Context - cargo is found and cargo type is empty residue:
    For Continue Normal Processing:
    When the cargo qualifies as empty residue type in the cargo classification, then continue with normal cargo processing and report generation without applying empty residue restrictions.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment has been retrieved from waybill and shipment commodity information is available
GIVEN
Equipment has been retrieved from waybill and shipment commodity information is available
Applied to: Check if Equipment is Empty and Has Residue Weight
WHEN
The equipment load indicator is 'E' (empty) AND the residue weight in shipment commodity is greater than 0
THEN
Initialize special handling code processing for empty residue validation
Context: Equipment is empty with residue weight greater than 0 AND special handling codes are available in shipment commodity
GIVEN
Equipment is empty with residue weight greater than 0 AND special handling codes are available in shipment commodity
Applied to: Special Handling Code = ER Threshold Code?
WHEN
Any special handling code (positions 1-8) equals the ER threshold code
THEN
Set ER found flag to true to indicate empty residue threshold validation is required
Context: Equipment is empty with residue weight AND ER threshold code is found in special handling codes
GIVEN
Equipment is empty with residue weight AND ER threshold code is found in special handling codes
Applied to: ER Weight Threshold > 7?
WHEN
The residue weight is greater than 7 units
THEN
Set ER weight threshold greater than 7 flag for subsequent error message generation
Context: Equipment is empty AND has residue weight greater than 7 AND ER threshold code is found AND equipment load indicator is 'E' AND idler indicator is not 'I'
GIVEN
Equipment is empty AND has residue weight greater than 7 AND ER threshold code is found AND equipment load indicator is 'E' AND idler indicator is not 'I'
Applied to: Generate Error Message 44 - Empty Residue Threshold Exceeded
WHEN
No cargo is found for the waybill
THEN
Generate error message 44 with waybill root key and date information
Context: Equipment has residue weight greater than 0 AND ER threshold code is found in special handling codes
GIVEN
Equipment has residue weight greater than 0 AND ER threshold code is found in special handling codes
Applied to: Skip Equipment from Report
WHEN
The equipment meets empty residue criteria for special processing
THEN
Skip the equipment from standard cargo attachment and report generation processes
Context: Cargo is found AND cargo type is empty residue
GIVEN
Cargo is found AND cargo type is empty residue
Applied to: Continue Normal Processing
WHEN
The cargo qualifies as empty residue type in the cargo classification
THEN
Continue with normal cargo processing and report generation without applying empty residue restrictions
R-GCX003-cbl-00607 (+11) File: GCX003.cbl Equipment Type Description Retrieval Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Type Description Retrieval':
  • Context - a container has been found in the waybill system:
    For Set Equipment ID for Container:
    When the system processes the container equipment, then the equipment id should be set to the container id from the equipment record and the container id should be assigned to the car type validation input parameter.
  • Context - a car equipment is being processed from the request:
    For Set Equipment ID for Car:
    When the system processes the car equipment, then the equipment id should be constructed from the request car id and assigned to the car type validation input parameter.
  • Context - container equipment is being processed:
    For Set Equipment Type Flag - Container:
    When the system prepares for equipment type validation, then the equipment type flag should be set to container type.
  • Context - car equipment is being processed:
    For Set Equipment Type Flag - Car:
    When the system prepares for equipment type validation, then the equipment type flag should be set to car type.
  • Context - a container equipment is being processed and the shipment record indicates trailer type:
    For Set Trailer Flag for Container:
    When the system checks for special equipment characteristics, then the trailer flag should be set in addition to the container flag.
  • Context - equipment id and type flags have been set:
    For Call Equipment Type Validation Service:
    When the system needs to validate equipment type, then the gcccartp service should be called with the equipment parameters.
  • Context - the equipment type validation service has been called:
    For Equipment Type Call Successful?:
    When the system checks the service response, then if the call was not successful, an equipment error should be generated, otherwise processing should continue with type code retrieval.
  • Context - the equipment type validation service call has failed:
    For Generate Equipment Error Message:
    When the system processes the validation failure, then if the equipment is a container, message 35 should be generated, otherwise message 36 should be generated, and the equipment error flag should be set.
  • Context - the equipment type validation service call was successful:
    For Retrieve Equipment Type Code:
    When the system processes the validation response, then the equipment type code should be retrieved from the service response.
  • Context - an equipment type code has been retrieved from the validation service:
    For Look Up Equipment Type Description in Reference Table:
    When the system needs to get the equipment type description, then the gcstbrt-vi reference table should be queried using the equipment type code.
  • Context - the equipment type description lookup was successful:
    For Assign Equipment Type Description:
    When the system processes the lookup result, then the equipment type description should be assigned to the us ccn report field.
  • Context - the equipment type description lookup was not successful:
    For Set Default Description as Spaces:
    When the system processes the lookup failure, then the equipment type description should be set to spaces as default.
👨‍💻 Technical ACs (Gherkin)
Context: A container has been found in the waybill system
GIVEN
A container has been found in the waybill system
Applied to: Set Equipment ID for Container
WHEN
The system processes the container equipment
THEN
The equipment ID should be set to the container ID from the equipment record and the container ID should be assigned to the car type validation input parameter
Context: A car equipment is being processed from the request
GIVEN
A car equipment is being processed from the request
Applied to: Set Equipment ID for Car
WHEN
The system processes the car equipment
THEN
The equipment ID should be constructed from the request car ID and assigned to the car type validation input parameter
Context: Container equipment is being processed
GIVEN
Container equipment is being processed
Applied to: Set Equipment Type Flag - Container
WHEN
The system prepares for equipment type validation
THEN
The equipment type flag should be set to container type
Context: Car equipment is being processed
GIVEN
Car equipment is being processed
Applied to: Set Equipment Type Flag - Car
WHEN
The system prepares for equipment type validation
THEN
The equipment type flag should be set to car type
Context: A container equipment is being processed and the shipment record indicates trailer type
GIVEN
A container equipment is being processed and the shipment record indicates trailer type
Applied to: Set Trailer Flag for Container
WHEN
The system checks for special equipment characteristics
THEN
The trailer flag should be set in addition to the container flag
Context: Equipment ID and type flags have been set
GIVEN
Equipment ID and type flags have been set
Applied to: Call Equipment Type Validation Service
WHEN
The system needs to validate equipment type
THEN
The GCCCARTP service should be called with the equipment parameters
Context: The equipment type validation service has been called
GIVEN
The equipment type validation service has been called
Applied to: Equipment Type Call Successful?
WHEN
The system checks the service response
THEN
If the call was not successful, an equipment error should be generated, otherwise processing should continue with type code retrieval
Context: The equipment type validation service call has failed
GIVEN
The equipment type validation service call has failed
Applied to: Generate Equipment Error Message
WHEN
The system processes the validation failure
THEN
If the equipment is a container, message 35 should be generated, otherwise message 36 should be generated, and the equipment error flag should be set
Context: The equipment type validation service call was successful
GIVEN
The equipment type validation service call was successful
Applied to: Retrieve Equipment Type Code
WHEN
The system processes the validation response
THEN
The equipment type code should be retrieved from the service response
Context: An equipment type code has been retrieved from the validation service
GIVEN
An equipment type code has been retrieved from the validation service
Applied to: Look Up Equipment Type Description in Reference Table
WHEN
The system needs to get the equipment type description
THEN
The GCSTBRT-VI reference table should be queried using the equipment type code
Context: The equipment type description lookup was successful
GIVEN
The equipment type description lookup was successful
Applied to: Assign Equipment Type Description
WHEN
The system processes the lookup result
THEN
The equipment type description should be assigned to the US CCN report field
Context: The equipment type description lookup was not successful
GIVEN
The equipment type description lookup was not successful
Applied to: Set Default Description as Spaces
WHEN
The system processes the lookup failure
THEN
The equipment type description should be set to spaces as default
R-GCX003-cbl-00619 (+9) File: GCX003.cbl Locomotive and Equipment Counting Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Locomotive and Equipment Counting':
  • Context - an equipment item with a car type code:
    For Count as Locomotive:
    When the car type code is 'lo' or 'et', then the equipment is classified as a locomotive and added to the locomotive count.
  • Context - an equipment item with a car type code that is not a locomotive:
    For Container Equipment?:
    When the car type code is 'cn', then the equipment is classified as container equipment for container-specific counting.
  • Context - an equipment item classified as container equipment:
    For Count Loaded Container:
    When the load/empty indicator is 'l' (loaded), then add 1 to the total loaded container count.
    For Count Empty Container:
    When the load/empty indicator is 'e' (empty), then add 1 to the total empty container count.
  • Context - an equipment item that is not a locomotive or container:
    For Count Loaded Car:
    When the load/empty indicator is 'l' (loaded), then add 1 to the total loaded car count.
    For Count Empty Car:
    When the load/empty indicator is 'e' (empty), then add 1 to the total empty car count.
  • Context - an equipment item with associated cargo information:
    For Empty Residue Found?:
    When the cargo is classified as empty residue or empty equipment type, then the equipment requires adjustment from loaded to empty status in counts.
  • Context - a container equipment with empty residue cargo and current loaded status:
    For Adjust Container Counts:
    When the load/empty indicator was 'l' but cargo indicates empty residue, then subtract 1 from loaded container count and add 1 to empty container count.
  • Context - a car equipment with empty residue cargo and current loaded status:
    For Adjust Car Counts:
    When the load/empty indicator was 'l' but cargo indicates empty residue, then subtract 1 from loaded car count and add 1 to empty car count.
  • Context - an equipment item with empty residue cargo:
    For Update Equipment Status to Empty:
    When the cargo type indicates empty residue or empty equipment, then update the equipment load/empty indicator to 'e' (empty) for both report and new report formats.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item with a car type code
GIVEN
An equipment item with a car type code
Applied to: Count as Locomotive
WHEN
The car type code is 'LO' or 'ET'
THEN
The equipment is classified as a locomotive and added to the locomotive count
Context: An equipment item with a car type code that is not a locomotive
GIVEN
An equipment item with a car type code that is not a locomotive
Applied to: Container Equipment?
WHEN
The car type code is 'CN'
THEN
The equipment is classified as container equipment for container-specific counting
Context: An equipment item classified as container equipment
GIVEN
An equipment item classified as container equipment
Applied to: Count Loaded Container
WHEN
The load/empty indicator is 'L' (loaded)
THEN
Add 1 to the total loaded container count
Applied to: Count Empty Container
WHEN
The load/empty indicator is 'E' (empty)
THEN
Add 1 to the total empty container count
Context: An equipment item that is not a locomotive or container
GIVEN
An equipment item that is not a locomotive or container
Applied to: Count Loaded Car
WHEN
The load/empty indicator is 'L' (loaded)
THEN
Add 1 to the total loaded car count
Applied to: Count Empty Car
WHEN
The load/empty indicator is 'E' (empty)
THEN
Add 1 to the total empty car count
Context: An equipment item with associated cargo information
GIVEN
An equipment item with associated cargo information
Applied to: Empty Residue Found?
WHEN
The cargo is classified as empty residue or empty equipment type
THEN
The equipment requires adjustment from loaded to empty status in counts
Context: A container equipment with empty residue cargo and current loaded status
GIVEN
A container equipment with empty residue cargo and current loaded status
Applied to: Adjust Container Counts
WHEN
The load/empty indicator was 'L' but cargo indicates empty residue
THEN
Subtract 1 from loaded container count and add 1 to empty container count
Context: A car equipment with empty residue cargo and current loaded status
GIVEN
A car equipment with empty residue cargo and current loaded status
Applied to: Adjust Car Counts
WHEN
The load/empty indicator was 'L' but cargo indicates empty residue
THEN
Subtract 1 from loaded car count and add 1 to empty car count
Context: An equipment item with empty residue cargo
GIVEN
An equipment item with empty residue cargo
Applied to: Update Equipment Status to Empty
WHEN
The cargo type indicates empty residue or empty equipment
THEN
Update the equipment load/empty indicator to 'E' (empty) for both report and new report formats
R-GCX003-cbl-00629 (+3) File: GCX003.cbl International Service Unit Processing Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'International Service Unit Processing':
  • Context - an equipment item is being processed in the train manifest:
    For Is Equipment SBU Van?:
    When the system checks the equipment type classification, then the equipment is identified as either sbu van type or regular equipment type.
  • Context - an equipment item is identified as sbu van type:
    For Set Load/Empty to 'E' - Empty:
    When the system processes the load/empty indicator, then the load/empty indicator is set to 'e' for empty status.
    For Is Load/Empty Indicator 'E'?:
    When the system checks the current load/empty indicator value, then the system determines if the indicator is already set to 'e' for empty.
  • Context - an equipment item is sbu van type and has empty load status:
    For Set Equipment Info to 'INTERNATIONAL SERVICE':
    When the system assigns equipment information description, then the equipment information field is set to 'international service'.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed in the train manifest
GIVEN
An equipment item is being processed in the train manifest
Applied to: Is Equipment SBU Van?
WHEN
The system checks the equipment type classification
THEN
The equipment is identified as either SBU van type or regular equipment type
Context: An equipment item is identified as SBU van type
GIVEN
An equipment item is identified as SBU van type
Applied to: Set Load/Empty to 'E' - Empty
WHEN
The system processes the load/empty indicator
THEN
The load/empty indicator is set to 'E' for Empty status
Applied to: Is Load/Empty Indicator 'E'?
WHEN
The system checks the current load/empty indicator value
THEN
The system determines if the indicator is already set to 'E' for Empty
Context: An equipment item is SBU van type and has empty load status
GIVEN
An equipment item is SBU van type and has empty load status
Applied to: Set Equipment Info to 'INTERNATIONAL SERVICE'
WHEN
The system assigns equipment information description
THEN
The equipment information field is set to 'INTERNATIONAL SERVICE'
R-GCX003-cbl-00633 (+4) File: GCX003.cbl Conveying Flat Car Identification Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Conveying Flat Car Identification':
  • Context - a waybill is found for the equipment:
    For Set Equipment Status to Empty:
    When the equipment is identified as a conveying car (shrt-conveying-car is true), then the equipment load/empty indicator is set to 'e' (empty).
  • Context - the equipment is identified as a conveying car and no cargo is found:
    For Set Info Field to 'CONVEYING FLAT CAR':
    When the system processes the equipment information field, then the information field is set to 'conveying flat car'.
  • Context - the equipment is a conveying flat car and the load/empty indicator is 'e' (empty):
    For Skip Cargo Processing for Empty Conveying Car:
    When the system determines cargo processing requirements, then normal cargo processing is bypassed and the system proceeds to format equipment information.
  • Context - the equipment is either not a conveying car or is a conveying car with containers loaded:
    For Continue Normal Processing:
    When the system determines the processing path, then standard equipment and cargo processing procedures are executed.
  • Context - a conveying flat car has containers loaded on it:
    For Retrieve Container Information:
    When the system processes the equipment, then container information is retrieved and processed through the container handling procedures.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill is found for the equipment
GIVEN
A waybill is found for the equipment
Applied to: Set Equipment Status to Empty
WHEN
The equipment is identified as a conveying car (SHRT-CONVEYING-CAR is true)
THEN
The equipment load/empty indicator is set to 'E' (empty)
Context: The equipment is identified as a conveying car and no cargo is found
GIVEN
The equipment is identified as a conveying car and no cargo is found
Applied to: Set Info Field to 'CONVEYING FLAT CAR'
WHEN
The system processes the equipment information field
THEN
The information field is set to 'CONVEYING FLAT CAR'
Context: The equipment is a conveying flat car and the load/empty indicator is 'E' (empty)
GIVEN
The equipment is a conveying flat car and the load/empty indicator is 'E' (empty)
Applied to: Skip Cargo Processing for Empty Conveying Car
WHEN
The system determines cargo processing requirements
THEN
Normal cargo processing is bypassed and the system proceeds to format equipment information
Context: The equipment is either not a conveying car or is a conveying car with containers loaded
GIVEN
The equipment is either not a conveying car or is a conveying car with containers loaded
Applied to: Continue Normal Processing
WHEN
The system determines the processing path
THEN
Standard equipment and cargo processing procedures are executed
Context: A conveying flat car has containers loaded on it
GIVEN
A conveying flat car has containers loaded on it
Applied to: Retrieve Container Information
WHEN
The system processes the equipment
THEN
Container information is retrieved and processed through the container handling procedures
R-GCX003-cbl-00638 (+7) File: GCX003.cbl Bond Number Extraction and Formatting Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Number Extraction and Formatting':
  • Context - a cargo record is being processed for bond information display:
    For Extract Bond Number from Entry Number:
    When the entry number field contains a valid non-space value, then the entry number should be extracted and stored as the bond number for formatting.
    For Set Bond Number to Spaces:
    When both the entry number and in-bond control number fields are empty or contain spaces, then the bond number should be set to spaces.
  • Context - a cargo record is being processed for bond information display and the entry number is not available:
    For Extract Bond Number from In-Bond Control Number:
    When the in-bond control number field contains a valid non-space value, then the in-bond control number should be extracted and stored as the bond number for formatting.
  • Context - a cargo record has bond information to be formatted for display:
    For Format as 'AMS IT [Bond Number]':
    When the in-bond type code is 'it', then the bond information should be formatted as 'ams it [bond number]' in the report info field.
    For Format as 'AMS IE [Bond Number]':
    When the in-bond type code is 'ie', then the bond information should be formatted as 'ams ie [bond number]' in the report info field.
    For Format as 'AMS 7512 TE [Bond Number]':
    When the in-bond type code is 'te', then the bond information should be formatted as 'ams 7512 te [bond number]' in the report info field.
    For Format as 'AMS 7512 TR [Bond Number]':
    When the in-bond type code is 'tr', then the bond information should be formatted as 'ams 7512 tr [bond number]' in the report info field.
    For Format as 'AMS 7512 MT [Bond Number]':
    When the in-bond type code is 'mt', then the bond information should be formatted as 'ams 7512 mt [bond number]' in the report info field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for bond information display
GIVEN
A cargo record is being processed for bond information display
Applied to: Extract Bond Number from Entry Number
WHEN
The entry number field contains a valid non-space value
THEN
The entry number should be extracted and stored as the bond number for formatting
Applied to: Set Bond Number to Spaces
WHEN
Both the entry number and in-bond control number fields are empty or contain spaces
THEN
The bond number should be set to spaces
Context: A cargo record is being processed for bond information display and the entry number is not available
GIVEN
A cargo record is being processed for bond information display and the entry number is not available
Applied to: Extract Bond Number from In-Bond Control Number
WHEN
The in-bond control number field contains a valid non-space value
THEN
The in-bond control number should be extracted and stored as the bond number for formatting
Context: A cargo record has bond information to be formatted for display
GIVEN
A cargo record has bond information to be formatted for display
Applied to: Format as 'AMS IT [Bond Number]'
WHEN
The in-bond type code is 'IT'
THEN
The bond information should be formatted as 'AMS IT [bond number]' in the report info field
Applied to: Format as 'AMS IE [Bond Number]'
WHEN
The in-bond type code is 'IE'
THEN
The bond information should be formatted as 'AMS IE [bond number]' in the report info field
Applied to: Format as 'AMS 7512 TE [Bond Number]'
WHEN
The in-bond type code is 'TE'
THEN
The bond information should be formatted as 'AMS 7512 TE [bond number]' in the report info field
Applied to: Format as 'AMS 7512 TR [Bond Number]'
WHEN
The in-bond type code is 'TR'
THEN
The bond information should be formatted as 'AMS 7512 TR [bond number]' in the report info field
Applied to: Format as 'AMS 7512 MT [Bond Number]'
WHEN
The in-bond type code is 'MT'
THEN
The bond information should be formatted as 'AMS 7512 MT [bond number]' in the report info field
R-GCX003-cbl-00646 File: GCX003.cbl Paper Port 7512 Processing
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Paper Port 7512 Processing':
  • Context - a cargo record is being processed for report formatting:
    For Check Bill Type Code:
    When the cargo bill type code equals '15', then the system sets the cargo information field to 'ppr 7512 15 us-ca-us' to indicate paper port 7512 processing for us-canada-us movement.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for report formatting
GIVEN
A cargo record is being processed for report formatting
Applied to: Check Bill Type Code
WHEN
The cargo bill type code equals '15'
THEN
The system sets the cargo information field to 'PPR 7512 15 US-CA-US' to indicate paper port 7512 processing for US-Canada-US movement
R-GCX003-cbl-00647 (+10) File: GCX003.cbl Special Equipment Description Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Equipment Description Processing':
  • Context - an equipment item is classified as sbu van unit and has empty load indicator:
    For Process International Service Unit:
    When the system processes the equipment description, then the equipment description is set to 'international service' and processing completes.
  • Context - no cargo is found for the equipment or cargo is classified as empty equipment type:
    For Process Empty Equipment:
    When the system determines the equipment description, then the equipment description is set to 'empty' and load indicator is set to 'e'.
  • Context - equipment is classified as conveying car and no cargo is found:
    For Process Conveying Flat Car:
    When the system processes the equipment description, then the equipment description is set to 'conveying flat car'.
  • Context - cargo has a valid entry number in m1202 field:
    For Extract Bond Number from Entry Number:
    When the system processes bond information, then the entry number is saved as the bond number for description formatting.
  • Context - cargo entry number is blank and in-bond control number m1206 field contains data:
    For Extract Bond Number from In-Bond Control Number:
    When the system processes bond information, then the in-bond control number is saved as the bond number for description formatting.
  • Context - cargo has bill of lading type code equal to '15':
    For Format Paper 7512 US-CA-US Description:
    When the system formats the equipment description, then the description is set to 'ppr 7512 15 us-ca-us'.
  • Context - cargo has in-bond type code of 'it' or 'ie':
    For Format AMS IT/IE Bond Description:
    When the system formats the equipment description, then the description is formatted as 'ams' followed by the bond type and bond number.
  • Context - cargo has in-bond type code of 'te', 'tr', or 'mt':
    For Format AMS 7512 TE/TR/MT Bond Description:
    When the system formats the equipment description, then the description is formatted as 'ams 7512' followed by the bond type and bond number.
  • Context - equipment description is blank and segment 07 data contains valid equipment descriptions:
    For Process Segment 07 Equipment Descriptions:
    When the system processes segment 07 entries, then each valid segment 07 description is formatted as a separate report line with equipment totals incremented.
  • Context - station table contains special handling type entries for the cargo and type code is 'sfe' for us country:
    For Process Special Handling Type Entries:
    When the system processes special handling entries, then the special handling description replaces the current equipment description as a new report line.
  • Context - cargo is classified as empty equipment or empty residue and equipment was previously counted as loaded:
    For Format Empty Equipment Description:
    When the system reclassifies the equipment as empty, then the loaded equipment count is decremented and empty equipment count is incremented for the appropriate equipment type.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is classified as SBU Van unit and has empty load indicator
GIVEN
An equipment item is classified as SBU Van unit and has empty load indicator
Applied to: Process International Service Unit
WHEN
The system processes the equipment description
THEN
The equipment description is set to 'INTERNATIONAL SERVICE' and processing completes
Context: No cargo is found for the equipment or cargo is classified as empty equipment type
GIVEN
No cargo is found for the equipment or cargo is classified as empty equipment type
Applied to: Process Empty Equipment
WHEN
The system determines the equipment description
THEN
The equipment description is set to 'EMPTY' and load indicator is set to 'E'
Context: Equipment is classified as conveying car and no cargo is found
GIVEN
Equipment is classified as conveying car and no cargo is found
Applied to: Process Conveying Flat Car
WHEN
The system processes the equipment description
THEN
The equipment description is set to 'CONVEYING FLAT CAR'
Context: Cargo has a valid entry number in M1202 field
GIVEN
Cargo has a valid entry number in M1202 field
Applied to: Extract Bond Number from Entry Number
WHEN
The system processes bond information
THEN
The entry number is saved as the bond number for description formatting
Context: Cargo entry number is blank and in-bond control number M1206 field contains data
GIVEN
Cargo entry number is blank and in-bond control number M1206 field contains data
Applied to: Extract Bond Number from In-Bond Control Number
WHEN
The system processes bond information
THEN
The in-bond control number is saved as the bond number for description formatting
Context: Cargo has bill of lading type code equal to '15'
GIVEN
Cargo has bill of lading type code equal to '15'
Applied to: Format Paper 7512 US-CA-US Description
WHEN
The system formats the equipment description
THEN
The description is set to 'PPR 7512 15 US-CA-US'
Context: Cargo has in-bond type code of 'IT' or 'IE'
GIVEN
Cargo has in-bond type code of 'IT' or 'IE'
Applied to: Format AMS IT/IE Bond Description
WHEN
The system formats the equipment description
THEN
The description is formatted as 'AMS' followed by the bond type and bond number
Context: Cargo has in-bond type code of 'TE', 'TR', or 'MT'
GIVEN
Cargo has in-bond type code of 'TE', 'TR', or 'MT'
Applied to: Format AMS 7512 TE/TR/MT Bond Description
WHEN
The system formats the equipment description
THEN
The description is formatted as 'AMS 7512' followed by the bond type and bond number
Context: Equipment description is blank and segment 07 data contains valid equipment descriptions
GIVEN
Equipment description is blank and segment 07 data contains valid equipment descriptions
Applied to: Process Segment 07 Equipment Descriptions
WHEN
The system processes segment 07 entries
THEN
Each valid segment 07 description is formatted as a separate report line with equipment totals incremented
Context: Station table contains special handling type entries for the cargo and type code is 'SFE' for US country
GIVEN
Station table contains special handling type entries for the cargo and type code is 'SFE' for US country
Applied to: Process Special Handling Type Entries
WHEN
The system processes special handling entries
THEN
The special handling description replaces the current equipment description as a new report line
Context: Cargo is classified as empty equipment or empty residue and equipment was previously counted as loaded
GIVEN
Cargo is classified as empty equipment or empty residue and equipment was previously counted as loaded
Applied to: Format Empty Equipment Description
WHEN
The system reclassifies the equipment as empty
THEN
The loaded equipment count is decremented and empty equipment count is incremented for the appropriate equipment type
R-GCX003-cbl-00658 (+9) File: GCX003.cbl Segment 07 Data Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Segment 07 Data Processing':
  • Context - a cargo record needs segment data retrieval:
    For Initialize Segment Retrieval Parameters:
    When the system begins segment data processing, then the system sets accept status to 'ge', clears working storage areas, enables underscore processing, sets function to get unqualified, disables index usage, and enables retrieval of segments 07, 02, and 08.
  • Context - segment retrieval parameters are initialized:
    For Call Cargo Segment Retrieval Service:
    When the system calls the cargo segment retrieval service gccusio2, then the system retrieves all requested segments (07, 02, 08) and their associated data arrays in one service call.
  • Context - cargo segment retrieval service returns successfully with no error number:
    For Move Retrieved Segment 07 Data to Working Storage:
    When the system processes the retrieved segment data, then the system moves the first occurrence of segment 03, 06, 07, 08, 09, and 12 data from arrays into individual working storage variables.
  • Context - segment 02 data has been retrieved from the cargo system:
    For Set Segment 02 Found Flag:
    When the system checks if segment 02 data contains spaces or low-values, then if segment 02 data is spaces or low-values, set segment 02 not found flag, otherwise set segment 02 found flag.
  • Context - segment 07 data has been retrieved from the cargo system:
    For Set Segment 07 Found Flag:
    When the system checks if segment 07 data contains spaces or low-values, then if segment 07 data is spaces or low-values, set segment 07 not found flag, otherwise set segment 07 found flag.
  • Context - segment 08 data has been retrieved from the cargo system:
    For Set Segment 08 Found Flag - Hazmat Indicator:
    When the system checks if segment 08 data contains spaces or low-values, then if segment 08 data is spaces or low-values, set segment 08 not found flag indicating no hazmat, otherwise set segment 08 found flag indicating hazmat present.
  • Context - segment 07 data contains multiple commodity description entries and cargo creation conditions are not met:
    For Loop Through All Segment 07 Entries:
    When the system processes segment 07 entries sequentially from 1 to maximum sequence number, then for each entry that is not spaces or low-values, extract commodity description, create report line, add to equipment count if first entry, and continue until all entries processed or report maximum reached.
  • Context - a valid segment 07 entry contains commodity description data:
    For Extract Commodity Description from Each Entry:
    When the system processes the segment 07 entry for report generation, then the system moves the segment 07 data to working storage, extracts the commodity description field, and formats it for report display.
  • Context - segment 07 processing is complete and station table lookup is required:
    For Retrieve Station Table Information:
    When the system retrieves station table data using commodity code id and 'st' qualifier, then if station table data is found successfully, move data to station segment working storage, otherwise set station segment to spaces.
  • Context - station table data is available with type code entries:
    For Check for Special Freight Equipment Type:
    When the system processes station type entries from 1 to 3 and finds type code 'sfe' with country 'us' or spaces, then if report info is not spaces, add current report line to output and increment report index, then move station type description to report info and set segment indicator to n.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record needs segment data retrieval
GIVEN
A cargo record needs segment data retrieval
Applied to: Initialize Segment Retrieval Parameters
WHEN
The system begins segment data processing
THEN
The system sets accept status to 'GE', clears working storage areas, enables underscore processing, sets function to Get Unqualified, disables index usage, and enables retrieval of segments 07, 02, and 08
Context: Segment retrieval parameters are initialized
GIVEN
Segment retrieval parameters are initialized
Applied to: Call Cargo Segment Retrieval Service
WHEN
The system calls the cargo segment retrieval service GCCUSIO2
THEN
The system retrieves all requested segments (07, 02, 08) and their associated data arrays in one service call
Context: Cargo segment retrieval service returns successfully with no error number
GIVEN
Cargo segment retrieval service returns successfully with no error number
Applied to: Move Retrieved Segment 07 Data to Working Storage
WHEN
The system processes the retrieved segment data
THEN
The system moves the first occurrence of segment 03, 06, 07, 08, 09, and 12 data from arrays into individual working storage variables
Context: Segment 02 data has been retrieved from the cargo system
GIVEN
Segment 02 data has been retrieved from the cargo system
Applied to: Set Segment 02 Found Flag
WHEN
The system checks if segment 02 data contains spaces or low-values
THEN
If segment 02 data is spaces or low-values, set segment 02 not found flag, otherwise set segment 02 found flag
Context: Segment 07 data has been retrieved from the cargo system
GIVEN
Segment 07 data has been retrieved from the cargo system
Applied to: Set Segment 07 Found Flag
WHEN
The system checks if segment 07 data contains spaces or low-values
THEN
If segment 07 data is spaces or low-values, set segment 07 not found flag, otherwise set segment 07 found flag
Context: Segment 08 data has been retrieved from the cargo system
GIVEN
Segment 08 data has been retrieved from the cargo system
Applied to: Set Segment 08 Found Flag - Hazmat Indicator
WHEN
The system checks if segment 08 data contains spaces or low-values
THEN
If segment 08 data is spaces or low-values, set segment 08 not found flag indicating no hazmat, otherwise set segment 08 found flag indicating hazmat present
Context: Segment 07 data contains multiple commodity description entries and cargo creation conditions are not met
GIVEN
Segment 07 data contains multiple commodity description entries and cargo creation conditions are not met
Applied to: Loop Through All Segment 07 Entries
WHEN
The system processes segment 07 entries sequentially from 1 to maximum sequence number
THEN
For each entry that is not spaces or low-values, extract commodity description, create report line, add to equipment count if first entry, and continue until all entries processed or report maximum reached
Context: A valid segment 07 entry contains commodity description data
GIVEN
A valid segment 07 entry contains commodity description data
Applied to: Extract Commodity Description from Each Entry
WHEN
The system processes the segment 07 entry for report generation
THEN
The system moves the segment 07 data to working storage, extracts the commodity description field, and formats it for report display
Context: Segment 07 processing is complete and station table lookup is required
GIVEN
Segment 07 processing is complete and station table lookup is required
Applied to: Retrieve Station Table Information
WHEN
The system retrieves station table data using commodity code ID and 'ST' qualifier
THEN
If station table data is found successfully, move data to station segment working storage, otherwise set station segment to spaces
Context: Station table data is available with type code entries
GIVEN
Station table data is available with type code entries
Applied to: Check for Special Freight Equipment Type
WHEN
The system processes station type entries from 1 to 3 and finds type code 'SFE' with country 'US' or spaces
THEN
If report info is not spaces, add current report line to output and increment report index, then move station type description to report info and set segment indicator to N
R-GCX003-cbl-00668 (+6) File: GCX003.cbl Double Stack Container Classification Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Double Stack Container Classification':
  • Context - equipment processing has retrieved car type code from equipment validation:
    For Is Equipment Type 'SK' Double Stack?:
    When the car type code equals 'sk', then the equipment is classified as double stack container and double stack counting process is initiated.
  • Context - equipment is identified as double stack container type 'sk' and waybill information is available:
    For Call GCCDBL Module with Waybill Number:
    When gccdbl module is called with the waybill number from shipment root, then double stack container count and traffic type information is retrieved from the module.
  • Context - double stack container count is retrieved and traffic type is determined as cprs:
    For Add Count to CPRS Traffic Counter:
    When gccdbl module indicates cprs double stack traffic, then the container count is added to the cprs double stack counter in train header.
  • Context - double stack container count is retrieved and traffic type is determined as csxt:
    For Add Count to CSXT Traffic Counter:
    When gccdbl module indicates csxt double stack traffic, then the container count is added to the csxt double stack counter in train header.
  • Context - double stack container count is retrieved and traffic type is determined as ns:
    For Add Count to NS Traffic Counter:
    When gccdbl module indicates ns double stack traffic, then the container count is added to the ns double stack counter in train header.
  • Context - double stack container count is retrieved and traffic type is determined as haul:
    For Add Count to HAUL Traffic Counter:
    When gccdbl module indicates haul double stack traffic, then the container count is added to the haul traffic counter in train header.
  • Context - double stack counters in train header contain spaces or low values:
    For Store Counts in Train Header Record:
    When counter initialization is performed for cprs, csxt, ns, or haul traffic types, then each counter is set to zero before accumulating double stack container counts.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment processing has retrieved car type code from equipment validation
GIVEN
Equipment processing has retrieved car type code from equipment validation
Applied to: Is Equipment Type 'SK' Double Stack?
WHEN
The car type code equals 'SK'
THEN
The equipment is classified as double stack container and double stack counting process is initiated
Context: Equipment is identified as double stack container type 'SK' and waybill information is available
GIVEN
Equipment is identified as double stack container type 'SK' and waybill information is available
Applied to: Call GCCDBL Module with Waybill Number
WHEN
GCCDBL module is called with the waybill number from shipment root
THEN
Double stack container count and traffic type information is retrieved from the module
Context: Double stack container count is retrieved and traffic type is determined as CPRS
GIVEN
Double stack container count is retrieved and traffic type is determined as CPRS
Applied to: Add Count to CPRS Traffic Counter
WHEN
GCCDBL module indicates CPRS double stack traffic
THEN
The container count is added to the CPRS double stack counter in train header
Context: Double stack container count is retrieved and traffic type is determined as CSXT
GIVEN
Double stack container count is retrieved and traffic type is determined as CSXT
Applied to: Add Count to CSXT Traffic Counter
WHEN
GCCDBL module indicates CSXT double stack traffic
THEN
The container count is added to the CSXT double stack counter in train header
Context: Double stack container count is retrieved and traffic type is determined as NS
GIVEN
Double stack container count is retrieved and traffic type is determined as NS
Applied to: Add Count to NS Traffic Counter
WHEN
GCCDBL module indicates NS double stack traffic
THEN
The container count is added to the NS double stack counter in train header
Context: Double stack container count is retrieved and traffic type is determined as HAUL
GIVEN
Double stack container count is retrieved and traffic type is determined as HAUL
Applied to: Add Count to HAUL Traffic Counter
WHEN
GCCDBL module indicates HAUL double stack traffic
THEN
The container count is added to the HAUL traffic counter in train header
Context: Double stack counters in train header contain spaces or low values
GIVEN
Double stack counters in train header contain spaces or low values
Applied to: Store Counts in Train Header Record
WHEN
Counter initialization is performed for CPRS, CSXT, NS, or HAUL traffic types
THEN
Each counter is set to zero before accumulating double stack container counts
R-GCX003-cbl-00675 (+9) File: GCX003.cbl Equipment Load/Empty Status Counting Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Load/Empty Status Counting':
  • Context - an equipment item with a car type code:
    For Equipment Type = Locomotive?:
    When the car type code is 'lo' or 'et', then the equipment is classified as a locomotive and added to the locomotive count.
  • Context - an equipment item with a car type code that is not a locomotive:
    For Equipment Type = Container?:
    When the car type code is 'cn', then the equipment is classified as a container for load/empty status counting.
  • Context - an equipment item classified as a locomotive:
    For Add 1 to Total Locomotives Count:
    When the equipment type is locomotive (lo or et), then add 1 to the total locomotives counter.
  • Context - an equipment item classified as a container:
    For Load/Empty Indicator = Loaded?:
    When the load/empty indicator is evaluated, then route to loaded container count if indicator is 'l', otherwise route to empty container count.
  • Context - a container equipment with load/empty indicator:
    For Add 1 to Total Loaded Containers:
    When the load/empty indicator is 'l' (loaded), then add 1 to the total loaded containers counter.
    For Add 1 to Total Empty Containers:
    When the load/empty indicator is 'e' (empty), then add 1 to the total empty containers counter.
  • Context - an equipment item classified as a regular car (not locomotive or container):
    For Load/Empty Indicator = Loaded?:
    When the load/empty indicator is evaluated, then route to loaded car count if indicator is 'l', otherwise route to empty car count.
  • Context - a regular car equipment with load/empty indicator:
    For Add 1 to Total Loaded Cars:
    When the load/empty indicator is 'l' (loaded), then add 1 to the total loaded cars counter.
    For Add 1 to Total Empty Cars:
    When the load/empty indicator is 'e' (empty), then add 1 to the total empty cars counter.
  • Context - an equipment item has been classified and its specific counter incremented:
    For Update Equipment Summary Counters:
    When the equipment counting process is complete for the item, then all equipment summary counters are updated to reflect the current totals.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item with a car type code
GIVEN
An equipment item with a car type code
Applied to: Equipment Type = Locomotive?
WHEN
The car type code is 'LO' or 'ET'
THEN
The equipment is classified as a locomotive and added to the locomotive count
Context: An equipment item with a car type code that is not a locomotive
GIVEN
An equipment item with a car type code that is not a locomotive
Applied to: Equipment Type = Container?
WHEN
The car type code is 'CN'
THEN
The equipment is classified as a container for load/empty status counting
Context: An equipment item classified as a locomotive
GIVEN
An equipment item classified as a locomotive
Applied to: Add 1 to Total Locomotives Count
WHEN
The equipment type is locomotive (LO or ET)
THEN
Add 1 to the total locomotives counter
Context: An equipment item classified as a container
GIVEN
An equipment item classified as a container
Applied to: Load/Empty Indicator = Loaded?
WHEN
The load/empty indicator is evaluated
THEN
Route to loaded container count if indicator is 'L', otherwise route to empty container count
Context: A container equipment with load/empty indicator
GIVEN
A container equipment with load/empty indicator
Applied to: Add 1 to Total Loaded Containers
WHEN
The load/empty indicator is 'L' (loaded)
THEN
Add 1 to the total loaded containers counter
Applied to: Add 1 to Total Empty Containers
WHEN
The load/empty indicator is 'E' (empty)
THEN
Add 1 to the total empty containers counter
Context: An equipment item classified as a regular car (not locomotive or container)
GIVEN
An equipment item classified as a regular car (not locomotive or container)
Applied to: Load/Empty Indicator = Loaded?
WHEN
The load/empty indicator is evaluated
THEN
Route to loaded car count if indicator is 'L', otherwise route to empty car count
Context: A regular car equipment with load/empty indicator
GIVEN
A regular car equipment with load/empty indicator
Applied to: Add 1 to Total Loaded Cars
WHEN
The load/empty indicator is 'L' (loaded)
THEN
Add 1 to the total loaded cars counter
Applied to: Add 1 to Total Empty Cars
WHEN
The load/empty indicator is 'E' (empty)
THEN
Add 1 to the total empty cars counter
Context: An equipment item has been classified and its specific counter incremented
GIVEN
An equipment item has been classified and its specific counter incremented
Applied to: Update Equipment Summary Counters
WHEN
The equipment counting process is complete for the item
THEN
All equipment summary counters are updated to reflect the current totals
R-GCX003-cbl-00685 (+15) File: GCX003.cbl Cargo Bond Type Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Bond Type Processing':
  • Context - a cargo processing request is initiated:
    For Cargo Found?:
    When the system checks for cargo existence, then if no cargo is found, skip bond type processing and end the process.
  • Context - cargo is found and bond type code is available:
    For Bond Type = IT or IE?:
    When the bond type code equals 'it' or 'ie', then process as it/ie bond, validate entry number or in-bond control number, extract bond number, and format as 'ams [bond_type] [bond_number]' display.
    For Bond Type = TE?:
    When the bond type code equals 'te', then process as te bond, validate transport export requirements, check if port change is required, and format as 'ams 7512 te [bond_number]' display.
    For Bond Type = TR?:
    When the bond type code equals 'tr', then process as tr bond, validate transit bond requirements, check if diversion is required, and format as 'ams 7512 tr [bond_number]' display.
    For Bond Type = MT?:
    When the bond type code equals 'mt', then process as mt bond, validate marine terminal requirements, check vessel name compliance, and format as 'ams 7512 mt [bond_number]' display.
  • Context - a bond type requires bond number extraction:
    For Extract Bond Number:
    When entry number is not spaces, then use entry number as bond number, otherwise if in-bond control number is not spaces, use in-bond control number as bond number, otherwise set bond number to spaces.
  • Context - cargo has it bond type and is not already created for it:
    For Check Special Manifest Original:
    When special manifest original flag is not set, then if action is send and user is not authorized for special manifest, generate error message 43, otherwise generate message 23 and set it export spawn flag for special manifest creation.
  • Context - cargo has te bond type and is not created for it and cargo status is not export and cargo is billed as cprs:
    For Check Port Change Conditions:
    When location id1 does not match the station crossing port code, then if action is report, generate message 19 with station code, otherwise if action is send and user is not authorized for special manifest, generate error message 43, otherwise generate message 20 and set port change spawn flag.
  • Context - cargo has tr bond type and is not created for it:
    For Check Release Status:
    When cargo short description equals release status, then if action is report, generate message 18, otherwise if action is send and user is not authorized for special manifest, generate error message 43, otherwise generate message 23 and set detour spawn flag.
  • Context - cargo has mt bond type:
    For Check Vessel Name = TRAIN:
    When vessel name is not 'train' and not spaces and station crossing port code equals cargo location id, then generate error message 25 for invalid vessel name and location combination.
  • Context - cargo has te bond type:
    For Check Vessel Name:
    When vessel name character at position 23 is 't', then generate error message 17 for invalid te vessel name format.
  • Context - cargo bond type is not te and not mt:
    For Check Vessel Name:
    When vessel name is not 'train', then generate error message 17 for invalid vessel name.
  • Context - cargo is found with empty equipment or export bond type:
    For Default Bond Processing:
    When bond type code is spaces or cargo is empty equipment or export type, then skip bond number processing and continue with default cargo information display.
  • Context - cargo is found with specific bond type:
    For Default Bond Processing:
    When bol type code equals '15', then format display as 'ppr 7512 15 us-ca-us' for the cargo information.
  • Context - cargo has default bond type and is not created for it:
    For Check Special Manifest Requirements:
    When cargo short description equals release status, then if action is report, generate message 18, otherwise if action is send and user is not authorized for special manifest, generate error message 43, otherwise generate message 23 and set detour spawn flag.
  • Context - cargo has export bond type and special manifest flag is spaces and origin-destination country codes equal 'usmx':
    For Check Special Manifest Requirements:
    When action is report, then generate message 50, otherwise if action is send and user is not authorized for special manifest, generate error message 43, otherwise generate message 23 and set 88 tr detour spawn flag.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo processing request is initiated
GIVEN
A cargo processing request is initiated
Applied to: Cargo Found?
WHEN
The system checks for cargo existence
THEN
If no cargo is found, skip bond type processing and end the process
Context: Cargo is found and bond type code is available
GIVEN
Cargo is found and bond type code is available
Applied to: Bond Type = IT or IE?
WHEN
The bond type code equals 'IT' or 'IE'
THEN
Process as IT/IE bond, validate entry number or in-bond control number, extract bond number, and format as 'AMS [bond_type] [bond_number]' display
Applied to: Bond Type = TE?
WHEN
The bond type code equals 'TE'
THEN
Process as TE bond, validate transport export requirements, check if port change is required, and format as 'AMS 7512 TE [bond_number]' display
Applied to: Bond Type = TR?
WHEN
The bond type code equals 'TR'
THEN
Process as TR bond, validate transit bond requirements, check if diversion is required, and format as 'AMS 7512 TR [bond_number]' display
Applied to: Bond Type = MT?
WHEN
The bond type code equals 'MT'
THEN
Process as MT bond, validate marine terminal requirements, check vessel name compliance, and format as 'AMS 7512 MT [bond_number]' display
Context: A bond type requires bond number extraction
GIVEN
A bond type requires bond number extraction
Applied to: Extract Bond Number
WHEN
Entry number is not spaces
THEN
Use entry number as bond number, otherwise if in-bond control number is not spaces, use in-bond control number as bond number, otherwise set bond number to spaces
Context: Cargo has IT bond type and is not already created for IT
GIVEN
Cargo has IT bond type and is not already created for IT
Applied to: Check Special Manifest Original
WHEN
Special manifest original flag is not set
THEN
If action is SEND and user is not authorized for special manifest, generate error message 43, otherwise generate message 23 and set IT export spawn flag for special manifest creation
Context: Cargo has TE bond type and is not created for IT and cargo status is not export and cargo is billed as CPRS
GIVEN
Cargo has TE bond type and is not created for IT and cargo status is not export and cargo is billed as CPRS
Applied to: Check Port Change Conditions
WHEN
Location ID1 does not match the station crossing port code
THEN
If action is REPORT, generate message 19 with station code, otherwise if action is SEND and user is not authorized for special manifest, generate error message 43, otherwise generate message 20 and set port change spawn flag
Context: Cargo has TR bond type and is not created for IT
GIVEN
Cargo has TR bond type and is not created for IT
Applied to: Check Release Status
WHEN
Cargo short description equals release status
THEN
If action is REPORT, generate message 18, otherwise if action is SEND and user is not authorized for special manifest, generate error message 43, otherwise generate message 23 and set detour spawn flag
Context: Cargo has MT bond type
GIVEN
Cargo has MT bond type
Applied to: Check Vessel Name = TRAIN
WHEN
Vessel name is not 'TRAIN' and not spaces and station crossing port code equals cargo location ID
THEN
Generate error message 25 for invalid vessel name and location combination
Context: Cargo has TE bond type
GIVEN
Cargo has TE bond type
Applied to: Check Vessel Name
WHEN
Vessel name character at position 23 is 'T'
THEN
Generate error message 17 for invalid TE vessel name format
Context: Cargo bond type is not TE and not MT
GIVEN
Cargo bond type is not TE and not MT
Applied to: Check Vessel Name
WHEN
Vessel name is not 'TRAIN'
THEN
Generate error message 17 for invalid vessel name
Context: Cargo is found with empty equipment or export bond type
GIVEN
Cargo is found with empty equipment or export bond type
Applied to: Default Bond Processing
WHEN
Bond type code is spaces or cargo is empty equipment or export type
THEN
Skip bond number processing and continue with default cargo information display
Context: Cargo is found with specific bond type
GIVEN
Cargo is found with specific bond type
Applied to: Default Bond Processing
WHEN
BOL type code equals '15'
THEN
Format display as 'PPR 7512 15 US-CA-US' for the cargo information
Context: Cargo has default bond type and is not created for IT
GIVEN
Cargo has default bond type and is not created for IT
Applied to: Check Special Manifest Requirements
WHEN
Cargo short description equals release status
THEN
If action is REPORT, generate message 18, otherwise if action is SEND and user is not authorized for special manifest, generate error message 43, otherwise generate message 23 and set detour spawn flag
Context: Cargo has export bond type and special manifest flag is spaces and origin-destination country codes equal 'USMX'
GIVEN
Cargo has export bond type and special manifest flag is spaces and origin-destination country codes equal 'USMX'
Applied to: Check Special Manifest Requirements
WHEN
Action is REPORT
THEN
Generate message 50, otherwise if action is SEND and user is not authorized for special manifest, generate error message 43, otherwise generate message 23 and set 88 TR detour spawn flag
R-GCX003-cbl-00701 (+8) File: GCX003.cbl Special Manifest Creation Triggers Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Manifest Creation Triggers':
  • Context - cargo is found and has it bond type (m1201-in-bond-typ-cde = 'it'):
    For Create IT Export Special Manifest:
    When special manifest original flag is set (gcusrt-special-mfst-orig is true) and user is authorized for special manifests, then create it export special manifest, generate message 23, and spawn gcx101 process with it export flag.
  • Context - cargo is found and has te bond type (88-gcusrt-m1201-transp-export is true):
    For Create TE Bond Special Manifest:
    When tr was not created for it (gcusrt-tr-created-for-it not = 'y') and cargo status is not export and cargo is billed as cprs and port location differs from manifest location, then create port change special manifest, generate message 20, and spawn gcx101 process with port change flag.
  • Context - cargo is found and has us-can-us bond type (88-gcusrt-m1201-us-can-us is true) and does not have special tr flag:
    For Create TR Bond Diversion Special Manifest:
    When tr was not created for it (gcusrt-tr-created-for-it = spaces) and cargo status equals release status (gcusrt-rt21-uscargo-short-desc = ws-gcusrt-rt21-uscargo-release), then create detour special manifest, generate message 23, and spawn gcx101 process with detour flag.
  • Context - cargo is found and has default bond type (88-gcusrt-m1109-default is true):
    For Create Border Clearance Special Manifest:
    When tr was not created for it (gcusrt-tr-created-for-it = spaces) and cargo status equals release status and special manifest original flag is not set, then create detour special manifest, generate message 23, and spawn gcx101 process with detour flag.
  • Context - cargo is found and has export bond type (88-gcusrt-m1109-export is true) and country codes equal 'usmx' and station is not laredo:
    For Create US-MX Export Special Manifest:
    When special manifest flag is spaces (gcusrt-usmx-special-mfst = spaces) and does not have special 88 flag, then create 88 tr detour special manifest, generate message 23, and spawn gcx101 process with 88 tr detour flag.
  • Context - waybill is found but no cargo is found and both origin and destination are us locations:
    For Create US-US Movement Special Manifest:
    When equipment is loaded or equipment is empty with residue weight greater than zero and residue found and not conveying car, then create us-us detour special manifest, generate message 23, and spawn gcx101 process with us-us detour flag.
  • Context - cargo has te bond type and tr was not created for it and cargo status is not export and cargo is billed as cprs:
    For Create Port Change Special Manifest:
    When cargo location (gcusrt-m1203-location-id1) differs from train crossing port (gcstbrt-sc-us-stat-code-x) and action is send and user is authorized for special manifests, then create port change special manifest, generate message 20, and spawn gcx101 process with port change flag.
  • Context - cargo has tr bond type and bol type is not '15' and train origin is not spaces:
    For Create TR Diversion Special Manifest:
    When train crossing port (gcstbrt-sc-us-stat-code-x) differs from cargo location (gcusrt-p401-location-id) and action is send, then create diversion special manifest, generate message 20, and spawn gcx101 process with diversion flag.
  • Context - cargo processing is complete:
    For No Special Manifest Required:
    When none of the special manifest trigger conditions are satisfied (it export, te bond changes, tr diversions, border clearance, us-mx export, or us-us movements), then continue with normal cargo processing without creating special manifests.
👨‍💻 Technical ACs (Gherkin)
Context: Cargo is found and has IT bond type (M1201-IN-BOND-TYP-CDE = 'IT')
GIVEN
Cargo is found and has IT bond type (M1201-IN-BOND-TYP-CDE = 'IT')
Applied to: Create IT Export Special Manifest
WHEN
Special manifest original flag is set (GCUSRT-SPECIAL-MFST-ORIG is true) and user is authorized for special manifests
THEN
Create IT export special manifest, generate message 23, and spawn GCX101 process with IT export flag
Context: Cargo is found and has TE bond type (88-GCUSRT-M1201-TRANSP-EXPORT is true)
GIVEN
Cargo is found and has TE bond type (88-GCUSRT-M1201-TRANSP-EXPORT is true)
Applied to: Create TE Bond Special Manifest
WHEN
TR was not created for IT (GCUSRT-TR-CREATED-FOR-IT not = 'Y') and cargo status is not export and cargo is billed as CPRS and port location differs from manifest location
THEN
Create port change special manifest, generate message 20, and spawn GCX101 process with port change flag
Context: Cargo is found and has US-CAN-US bond type (88-GCUSRT-M1201-US-CAN-US is true) and does not have special TR flag
GIVEN
Cargo is found and has US-CAN-US bond type (88-GCUSRT-M1201-US-CAN-US is true) and does not have special TR flag
Applied to: Create TR Bond Diversion Special Manifest
WHEN
TR was not created for IT (GCUSRT-TR-CREATED-FOR-IT = SPACES) and cargo status equals release status (GCUSRT-RT21-USCARGO-SHORT-DESC = WS-GCUSRT-RT21-USCARGO-RELEASE)
THEN
Create detour special manifest, generate message 23, and spawn GCX101 process with detour flag
Context: Cargo is found and has default bond type (88-GCUSRT-M1109-DEFAULT is true)
GIVEN
Cargo is found and has default bond type (88-GCUSRT-M1109-DEFAULT is true)
Applied to: Create Border Clearance Special Manifest
WHEN
TR was not created for IT (GCUSRT-TR-CREATED-FOR-IT = SPACES) and cargo status equals release status and special manifest original flag is not set
THEN
Create detour special manifest, generate message 23, and spawn GCX101 process with detour flag
Context: Cargo is found and has export bond type (88-GCUSRT-M1109-EXPORT is true) and country codes equal 'USMX' and station is not Laredo
GIVEN
Cargo is found and has export bond type (88-GCUSRT-M1109-EXPORT is true) and country codes equal 'USMX' and station is not Laredo
Applied to: Create US-MX Export Special Manifest
WHEN
Special manifest flag is spaces (GCUSRT-USMX-SPECIAL-MFST = SPACES) and does not have special 88 flag
THEN
Create 88 TR detour special manifest, generate message 23, and spawn GCX101 process with 88 TR detour flag
Context: Waybill is found but no cargo is found and both origin and destination are US locations
GIVEN
Waybill is found but no cargo is found and both origin and destination are US locations
Applied to: Create US-US Movement Special Manifest
WHEN
Equipment is loaded or equipment is empty with residue weight greater than zero and residue found and not conveying car
THEN
Create US-US detour special manifest, generate message 23, and spawn GCX101 process with US-US detour flag
Context: Cargo has TE bond type and TR was not created for IT and cargo status is not export and cargo is billed as CPRS
GIVEN
Cargo has TE bond type and TR was not created for IT and cargo status is not export and cargo is billed as CPRS
Applied to: Create Port Change Special Manifest
WHEN
Cargo location (GCUSRT-M1203-LOCATION-ID1) differs from train crossing port (GCSTBRT-SC-US-STAT-CODE-X) and action is send and user is authorized for special manifests
THEN
Create port change special manifest, generate message 20, and spawn GCX101 process with port change flag
Context: Cargo has TR bond type and BOL type is not '15' and train origin is not spaces
GIVEN
Cargo has TR bond type and BOL type is not '15' and train origin is not spaces
Applied to: Create TR Diversion Special Manifest
WHEN
Train crossing port (GCSTBRT-SC-US-STAT-CODE-X) differs from cargo location (GCUSRT-P401-LOCATION-ID) and action is send
THEN
Create diversion special manifest, generate message 20, and spawn GCX101 process with diversion flag
Context: Cargo processing is complete
GIVEN
Cargo processing is complete
Applied to: No Special Manifest Required
WHEN
None of the special manifest trigger conditions are satisfied (IT export, TE bond changes, TR diversions, border clearance, US-MX export, or US-US movements)
THEN
Continue with normal cargo processing without creating special manifests
R-GCX003-cbl-00710 (+18) File: GCX003.cbl Equipment Information Field Formatting Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Information Field Formatting':
  • Context - equipment information is being processed for reporting:
    For Count Locomotives - LO/ET Types:
    When equipment type is lo (locomotive) or et (end of train), then add 1 to total locomotive counter.
  • Context - equipment type is cn (container):
    For Count Containers - CN Type:
    When load/empty indicator is l (loaded), then add 1 to total loaded container counter.
    For Count Containers - CN Type:
    When load/empty indicator is e (empty), then add 1 to total empty container counter.
  • Context - equipment type is not lo, et, or cn:
    For Count Cars - Other Types:
    When load/empty indicator is l (loaded), then add 1 to total loaded car counter.
    For Count Cars - Other Types:
    When load/empty indicator is e (empty), then add 1 to total empty car counter.
  • Context - equipment is an sbu van unit:
    For Format International Service Unit Description:
    When load/empty indicator is e (empty), then set equipment information description to 'international service'.
  • Context - no cargo data is available for equipment:
    For Format Conveying Flat Car Description:
    When equipment is classified as a conveying car, then set equipment information description to 'conveying flat car'.
  • Context - no cargo data is available for equipment and equipment is not a conveying car:
    For Format Empty Equipment Description:
    When load/empty indicator is e (empty), then set equipment information description to 'empty'.
  • Context - cargo data is available for equipment:
    For Extract from Entry Number:
    When entry number field is not spaces, then use entry number as the saved bond number.
  • Context - cargo data is available and entry number is spaces:
    For Extract from In-Bond Control Number:
    When in-bond control number field is not spaces, then use in-bond control number as the saved bond number.
  • Context - cargo type is empty equipment:
    For Format Empty Equipment Info:
    When equipment information is being formatted, then set equipment information to 'empty' and set load/empty indicator to 'e'.
  • Context - cargo type is empty residue:
    For Format Empty Residue Info:
    When equipment was previously counted as loaded container, then subtract 1 from loaded container counter and add 1 to empty container counter.
  • Context - cargo type is empty residue and equipment type is not cn:
    For Format Empty Residue Info:
    When equipment was previously counted as loaded car, then subtract 1 from loaded car counter and add 1 to empty car counter.
  • Context - cargo bol type code is '15':
    For Format Paper Port 7512 Description:
    When equipment information is being formatted, then set equipment information to 'ppr 7512 15 us-ca-us'.
  • Context - in-bond type code is 'it' or 'ie':
    For Format AMS IT/IE Bond Description:
    When equipment information is being formatted, then concatenate 'ams ', bond type code, space, and saved bond number into equipment information.
  • Context - in-bond type code is 'te', 'tr', or 'mt':
    For Format AMS 7512 TE/TR/MT Bond Description:
    When equipment information is being formatted, then concatenate 'ams 7512 ', bond type code, space, and saved bond number into equipment information.
  • Context - equipment information is spaces and segment 07 data is available:
    For Format Equipment Description from Segment 07:
    When segment 07 data entry is not spaces or low-values, then use segment 07 sed field as equipment information description.
  • Context - multiple segment 07 data entries exist:
    For Process Multiple Description Lines:
    When processing each segment 07 entry that is not spaces or low-values, then create separate report line for each description and increment equipment counter only for first description.
  • Context - station table entry type is 'sfe' and country is 'us' or spaces:
    For Format Special Facility Equipment Description:
    When equipment information is being processed, then use station table type description as equipment information and create additional report line if equipment information already exists.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment information is being processed for reporting
GIVEN
Equipment information is being processed for reporting
Applied to: Count Locomotives - LO/ET Types
WHEN
Equipment type is LO (Locomotive) or ET (End of Train)
THEN
Add 1 to total locomotive counter
Context: Equipment type is CN (Container)
GIVEN
Equipment type is CN (Container)
Applied to: Count Containers - CN Type
WHEN
Load/empty indicator is L (Loaded)
THEN
Add 1 to total loaded container counter
Applied to: Count Containers - CN Type
WHEN
Load/empty indicator is E (Empty)
THEN
Add 1 to total empty container counter
Context: Equipment type is not LO, ET, or CN
GIVEN
Equipment type is not LO, ET, or CN
Applied to: Count Cars - Other Types
WHEN
Load/empty indicator is L (Loaded)
THEN
Add 1 to total loaded car counter
Applied to: Count Cars - Other Types
WHEN
Load/empty indicator is E (Empty)
THEN
Add 1 to total empty car counter
Context: Equipment is an SBU van unit
GIVEN
Equipment is an SBU van unit
Applied to: Format International Service Unit Description
WHEN
Load/empty indicator is E (Empty)
THEN
Set equipment information description to 'INTERNATIONAL SERVICE'
Context: No cargo data is available for equipment
GIVEN
No cargo data is available for equipment
Applied to: Format Conveying Flat Car Description
WHEN
Equipment is classified as a conveying car
THEN
Set equipment information description to 'CONVEYING FLAT CAR'
Context: No cargo data is available for equipment and equipment is not a conveying car
GIVEN
No cargo data is available for equipment and equipment is not a conveying car
Applied to: Format Empty Equipment Description
WHEN
Load/empty indicator is E (Empty)
THEN
Set equipment information description to 'EMPTY'
Context: Cargo data is available for equipment
GIVEN
Cargo data is available for equipment
Applied to: Extract from Entry Number
WHEN
Entry number field is not spaces
THEN
Use entry number as the saved bond number
Context: Cargo data is available and entry number is spaces
GIVEN
Cargo data is available and entry number is spaces
Applied to: Extract from In-Bond Control Number
WHEN
In-bond control number field is not spaces
THEN
Use in-bond control number as the saved bond number
Context: Cargo type is empty equipment
GIVEN
Cargo type is empty equipment
Applied to: Format Empty Equipment Info
WHEN
Equipment information is being formatted
THEN
Set equipment information to 'EMPTY' and set load/empty indicator to 'E'
Context: Cargo type is empty residue
GIVEN
Cargo type is empty residue
Applied to: Format Empty Residue Info
WHEN
Equipment was previously counted as loaded container
THEN
Subtract 1 from loaded container counter and add 1 to empty container counter
Context: Cargo type is empty residue and equipment type is not CN
GIVEN
Cargo type is empty residue and equipment type is not CN
Applied to: Format Empty Residue Info
WHEN
Equipment was previously counted as loaded car
THEN
Subtract 1 from loaded car counter and add 1 to empty car counter
Context: Cargo BOL type code is '15'
GIVEN
Cargo BOL type code is '15'
Applied to: Format Paper Port 7512 Description
WHEN
Equipment information is being formatted
THEN
Set equipment information to 'PPR 7512 15 US-CA-US'
Context: In-bond type code is 'IT' or 'IE'
GIVEN
In-bond type code is 'IT' or 'IE'
Applied to: Format AMS IT/IE Bond Description
WHEN
Equipment information is being formatted
THEN
Concatenate 'AMS ', bond type code, space, and saved bond number into equipment information
Context: In-bond type code is 'TE', 'TR', or 'MT'
GIVEN
In-bond type code is 'TE', 'TR', or 'MT'
Applied to: Format AMS 7512 TE/TR/MT Bond Description
WHEN
Equipment information is being formatted
THEN
Concatenate 'AMS 7512 ', bond type code, space, and saved bond number into equipment information
Context: Equipment information is spaces and segment 07 data is available
GIVEN
Equipment information is spaces and segment 07 data is available
Applied to: Format Equipment Description from Segment 07
WHEN
Segment 07 data entry is not spaces or low-values
THEN
Use segment 07 SED field as equipment information description
Context: Multiple segment 07 data entries exist
GIVEN
Multiple segment 07 data entries exist
Applied to: Process Multiple Description Lines
WHEN
Processing each segment 07 entry that is not spaces or low-values
THEN
Create separate report line for each description and increment equipment counter only for first description
Context: Station table entry type is 'SFE' and country is 'US' or spaces
GIVEN
Station table entry type is 'SFE' and country is 'US' or spaces
Applied to: Format Special Facility Equipment Description
WHEN
Equipment information is being processed
THEN
Use station table type description as equipment information and create additional report line if equipment information already exists
R-GCX003-cbl-00729 (+12) File: GCX003.cbl Segment 07 Data Processing for Equipment Description Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Segment 07 Data Processing for Equipment Description':
  • Context - a cargo record exists for processing:
    For B250-RETRIEVE-SEG07: Initialize Segment Retrieval:
    When the system begins segment data retrieval, then the system should initialize cargo segment retrieval parameters and set function to get unique operation.
  • Context - segment retrieval is being initialized:
    For Set Segment Types: SEG07, SEG02, SEG08:
    When the system configures segment types for retrieval, then the system should set flags to retrieve seg07 equipment descriptions, seg02 reference numbers, and seg08 hazmat data.
  • Context - segment retrieval parameters are configured:
    For Call GCCUSIO2 to Retrieve Segments:
    When the system calls the cargo i/o module to retrieve segment data, then the system should execute the database call to fetch seg07, seg02, and seg08 segment information.
  • Context - cargo segment data retrieval has been attempted:
    For Segment Retrieval Successful?:
    When the system checks the retrieval operation result, then the system should determine if segment data was successfully retrieved based on error status being empty.
  • Context - segment data retrieval was successful:
    For Move Retrieved Data to Working Storage Arrays:
    When the system processes the retrieved data, then the system should move seg03, seg06, seg07, seg08, seg09, and seg12 data from arrays to individual segment structures.
  • Context - segment data has been retrieved and processed:
    For SEG07 Data Found?:
    When the system checks for seg07 data availability, then the system should set seg07-found flag if data exists or seg07-not-found flag if data is spaces or low-values.
    For Check SEG07 Data Availability:
    When the system checks for seg02 data availability, then the system should set seg02-found flag if data exists or seg02-not-found flag if data is spaces or low-values.
    For Check SEG07 Data Availability:
    When the system checks for seg08 data availability, then the system should set seg08-found flag if data exists or seg08-not-found flag if data is spaces or low-values.
  • Context - equipment description field is empty and seg07 data processing is required:
    For Initialize SEG07 Processing Counter:
    When the system initializes seg07 processing, then the system should set seg07 written counter to zero and prepare for iterating through seg07 data array.
  • Context - a seg07 entry is being processed:
    For SEG07 Entry Valid?:
    When the system validates the entry data quality, then the system should determine the entry is invalid if the seg07 description is spaces or low-values.
  • Context - a valid seg07 entry with equipment description exists:
    For Move SEG07 Description to Report Info Field:
    When the system processes the equipment description, then the system should move the seg07 description to both report info field and new report info field, and set seg07 processing flag to yes.
  • Context - a seg07 entry has been processed and added to the report:
    For First SEG07 Entry?:
    When the system checks if this is the first seg07 entry written, then the system should increment the total equipment count only if the seg07 written counter equals 1.
  • Context - station table data is available for processing:
    For Process Station Entries for Special Descriptions:
    When the system processes station entries for special descriptions, then the system should check for sfe type codes with us country designation and populate special descriptions in report fields while setting seg07 processing flag to no.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists for processing
GIVEN
A cargo record exists for processing
Applied to: B250-RETRIEVE-SEG07: Initialize Segment Retrieval
WHEN
The system begins segment data retrieval
THEN
The system should initialize cargo segment retrieval parameters and set function to Get Unique operation
Context: Segment retrieval is being initialized
GIVEN
Segment retrieval is being initialized
Applied to: Set Segment Types: SEG07, SEG02, SEG08
WHEN
The system configures segment types for retrieval
THEN
The system should set flags to retrieve SEG07 equipment descriptions, SEG02 reference numbers, and SEG08 hazmat data
Context: Segment retrieval parameters are configured
GIVEN
Segment retrieval parameters are configured
Applied to: Call GCCUSIO2 to Retrieve Segments
WHEN
The system calls the cargo I/O module to retrieve segment data
THEN
The system should execute the database call to fetch SEG07, SEG02, and SEG08 segment information
Context: Cargo segment data retrieval has been attempted
GIVEN
Cargo segment data retrieval has been attempted
Applied to: Segment Retrieval Successful?
WHEN
The system checks the retrieval operation result
THEN
The system should determine if segment data was successfully retrieved based on error status being empty
Context: Segment data retrieval was successful
GIVEN
Segment data retrieval was successful
Applied to: Move Retrieved Data to Working Storage Arrays
WHEN
The system processes the retrieved data
THEN
The system should move SEG03, SEG06, SEG07, SEG08, SEG09, and SEG12 data from arrays to individual segment structures
Context: Segment data has been retrieved and processed
GIVEN
Segment data has been retrieved and processed
Applied to: SEG07 Data Found?
WHEN
The system checks for SEG07 data availability
THEN
The system should set SEG07-FOUND flag if data exists or SEG07-NOT-FOUND flag if data is spaces or low-values
Applied to: Check SEG07 Data Availability
WHEN
The system checks for SEG02 data availability
THEN
The system should set SEG02-FOUND flag if data exists or SEG02-NOT-FOUND flag if data is spaces or low-values
Applied to: Check SEG07 Data Availability
WHEN
The system checks for SEG08 data availability
THEN
The system should set SEG08-FOUND flag if data exists or SEG08-NOT-FOUND flag if data is spaces or low-values
Context: Equipment description field is empty and SEG07 data processing is required
GIVEN
Equipment description field is empty and SEG07 data processing is required
Applied to: Initialize SEG07 Processing Counter
WHEN
The system initializes SEG07 processing
THEN
The system should set SEG07 written counter to zero and prepare for iterating through SEG07 data array
Context: A SEG07 entry is being processed
GIVEN
A SEG07 entry is being processed
Applied to: SEG07 Entry Valid?
WHEN
The system validates the entry data quality
THEN
The system should determine the entry is invalid if the SEG07 description is spaces or low-values
Context: A valid SEG07 entry with equipment description exists
GIVEN
A valid SEG07 entry with equipment description exists
Applied to: Move SEG07 Description to Report Info Field
WHEN
The system processes the equipment description
THEN
The system should move the SEG07 description to both report info field and new report info field, and set SEG07 processing flag to yes
Context: A SEG07 entry has been processed and added to the report
GIVEN
A SEG07 entry has been processed and added to the report
Applied to: First SEG07 Entry?
WHEN
The system checks if this is the first SEG07 entry written
THEN
The system should increment the total equipment count only if the SEG07 written counter equals 1
Context: Station table data is available for processing
GIVEN
Station table data is available for processing
Applied to: Process Station Entries for Special Descriptions
WHEN
The system processes station entries for special descriptions
THEN
The system should check for SFE type codes with US country designation and populate special descriptions in report fields while setting SEG07 processing flag to no
R-GCX003-cbl-00742 (+10) File: GCX003.cbl Container Retrieval from Multiple Sources Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Retrieval from Multiple Sources':
  • Context - a container retrieval process is initiated and container was not previously found:
    For Container Found in Primary System?:
    When the system checks if container exists in primary waybill system, then container found status is determined based on primary system availability.
  • Context - container is found in primary waybill system:
    For Get Container Equipment ID:
    When container data is successfully retrieved, then equipment id is set to the container's equipment id value.
  • Context - container data is successfully retrieved from shiproot database:
    For Set Container Found Status:
    When container information is available in primary system, then container found status is set to true.
  • Context - container is not found in primary waybill system:
    For Fallback to Inquiry System:
    When primary system retrieval fails or returns no data, then system initiates inquiry system search process.
  • Context - fallback to inquiry system is activated:
    For Access FWCIROOT Database:
    When system needs original waybill information for container search, then fwciroot database is accessed using car id from container inquiry root.
  • Context - original waybill information is retrieved from fwciroot:
    For Access FWIQROOT Database:
    When system needs to find container cross-reference data, then fwiqroot database is accessed using road number, station number, and waybill number.
  • Context - fwiqroot database access is successful:
    For Retrieve Container Cross-Reference Data:
    When system processes inquiry bottom line records, then container cross-reference data is extracted from fwiqbotl records up to maximum of 30 entries.
  • Context - container cross-reference data is available from inquiry system:
    For Parse Container Cross-Reference Information:
    When inquiry bottom line record contains 't/c xref' in first 8 characters, then container id is extracted from positions 28-39, road number from positions 10-12, station number from positions 14-19, and waybill number from positions 21-26.
  • Context - container information is successfully parsed from inquiry system:
    For Set Container Found from Inquiry System:
    When at least one valid container id is extracted from cross-reference data, then container found status is set to true and container iq found status is set to true with first container id assigned as equipment id.
  • Context - container retrieval fails from both primary waybill system and inquiry system:
    For Set Container Not Found Status:
    When no valid container information is available from either source, then container not found status is set and container iq not found status is set.
  • Context - container retrieval process is completed for current container:
    For Continue with Next Container Processing:
    When container status is determined (found or not found), then system proceeds to next container in the processing sequence.
👨‍💻 Technical ACs (Gherkin)
Context: A container retrieval process is initiated and container was not previously found
GIVEN
A container retrieval process is initiated and container was not previously found
Applied to: Container Found in Primary System?
WHEN
The system checks if container exists in primary waybill system
THEN
Container found status is determined based on primary system availability
Context: Container is found in primary waybill system
GIVEN
Container is found in primary waybill system
Applied to: Get Container Equipment ID
WHEN
Container data is successfully retrieved
THEN
Equipment ID is set to the container's equipment ID value
Context: Container data is successfully retrieved from SHIPROOT database
GIVEN
Container data is successfully retrieved from SHIPROOT database
Applied to: Set Container Found Status
WHEN
Container information is available in primary system
THEN
Container found status is set to true
Context: Container is not found in primary waybill system
GIVEN
Container is not found in primary waybill system
Applied to: Fallback to Inquiry System
WHEN
Primary system retrieval fails or returns no data
THEN
System initiates inquiry system search process
Context: Fallback to inquiry system is activated
GIVEN
Fallback to inquiry system is activated
Applied to: Access FWCIROOT Database
WHEN
System needs original waybill information for container search
THEN
FWCIROOT database is accessed using car ID from container inquiry root
Context: Original waybill information is retrieved from FWCIROOT
GIVEN
Original waybill information is retrieved from FWCIROOT
Applied to: Access FWIQROOT Database
WHEN
System needs to find container cross-reference data
THEN
FWIQROOT database is accessed using road number, station number, and waybill number
Context: FWIQROOT database access is successful
GIVEN
FWIQROOT database access is successful
Applied to: Retrieve Container Cross-Reference Data
WHEN
System processes inquiry bottom line records
THEN
Container cross-reference data is extracted from FWIQBOTL records up to maximum of 30 entries
Context: Container cross-reference data is available from inquiry system
GIVEN
Container cross-reference data is available from inquiry system
Applied to: Parse Container Cross-Reference Information
WHEN
Inquiry bottom line record contains 'T/C XREF' in first 8 characters
THEN
Container ID is extracted from positions 28-39, road number from positions 10-12, station number from positions 14-19, and waybill number from positions 21-26
Context: Container information is successfully parsed from inquiry system
GIVEN
Container information is successfully parsed from inquiry system
Applied to: Set Container Found from Inquiry System
WHEN
At least one valid container ID is extracted from cross-reference data
THEN
Container found status is set to true and container IQ found status is set to true with first container ID assigned as equipment ID
Context: Container retrieval fails from both primary waybill system and inquiry system
GIVEN
Container retrieval fails from both primary waybill system and inquiry system
Applied to: Set Container Not Found Status
WHEN
No valid container information is available from either source
THEN
Container not found status is set and container IQ not found status is set
Context: Container retrieval process is completed for current container
GIVEN
Container retrieval process is completed for current container
Applied to: Continue with Next Container Processing
WHEN
Container status is determined (found or not found)
THEN
System proceeds to next container in the processing sequence
R-GCX003-cbl-00753 (+42) File: GCX003.cbl Train List Database Storage Merged 43 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train List Database Storage':
  • Context - a train transmission has been successfully validated and approved for sending:
    For Initialize Train Header Information:
    When the system begins the train list storage process, then the train header information is initialized and cleared of any previous data to prepare for new train data storage.
  • Context - train header information has been initialized:
    For Set Train Identification Data:
    When setting train identification data, then train number, train day, train origin, and consist number are copied from the request to the train list structure.
    For Set Train Identification Data:
    When setting train identification data for database storage, then train number, train day, train origin, and consist number are stored in the train list record.
  • Context - train identification data has been set:
    For Set Origin Station Details:
    When setting origin station details, then us station code, station name, and firms code are stored from the validated station information and origin station us code, station name, and firms code are stored in the train record.
  • Context - origin station details have been set:
    For Set ETA Information:
    When setting eta information, then eta date and eta time are stored from the validated request data and eta date and eta time are stored in the train record.
  • Context - eta information has been set:
    For Set AEI Send Flag:
    When the request type indicates aei transmission, then the aei send flag is set to true, otherwise it is set to false.
  • Context - aei send flag has been set:
    For Initialize Equipment Counter:
    When beginning equipment processing, then equipment quantity counter is initialized to zero.
    For Initialize Equipment Counter:
    When initializing equipment processing, then equipment quantity counter is initialized to zero.
  • Context - equipment processing is in progress:
    For More Equipment to Process?:
    When checking for more equipment items, then continue processing if report index is within bounds, equipment table is not full, and current line contains valid equipment data (not message, end report, or blank line).
  • Context - a valid equipment line has been identified for processing:
    For Extract Equipment Details:
    When extracting equipment details, then equipment counter is incremented and equipment identification data is prepared for type-specific processing.
  • Context - equipment details are being extracted:
    For Equipment Type?:
    When determining equipment type, then if container id exists, process as container; otherwise process as railcar.
  • Context - equipment has been identified as a container:
    For Store Container Information:
    When storing container information, then container id is stored as equipment id and container flag is set to true.
  • Context - equipment has been identified as a railcar:
    For Store Car Information:
    When storing car information, then car initials and number are combined to form complete equipment id for storage.
  • Context - equipment id has been stored:
    For Set Equipment Type Code:
    When setting equipment type code, then equipment type code from the report working storage is stored in the train list equipment record.
  • Context - equipment type code has been set:
    For Determine Load/Empty Status:
    When determining load/empty status, then if cargo control number exists, use load/empty indicator from report; otherwise set status to empty and if report us ccn key is spaces, then load/empty indicator is set to 'e' (empty), otherwise load/empty indicator is set from report load/empty indicator.
  • Context - load/empty status has been determined:
    For Store Cargo Control Number:
    When storing cargo control number, then us cargo control number from the report working storage is stored in the equipment record and us ccn key from report working storage is stored in train equipment us ccn key field.
  • Context - cargo control number has been stored:
    For Store Condition Response Code:
    When storing condition response code, then cargo condition response code from the report working storage is stored in the equipment record and cargo condition response code from report working storage is stored in train equipment condition response code field.
  • Context - condition response code has been stored:
    For Store Empty Car Indicator:
    When storing empty car indicator, then empty car routing indicator from the report working storage is stored in the equipment record and empty car indicator from report working storage is stored in train equipment empty car indicator field.
  • Context - all equipment details have been stored for current item:
    For Increment Equipment Counter:
    When completing equipment storage, then equipment quantity counter is incremented by one.
  • Context - equipment counter has been incremented:
    For Equipment Table Full?:
    When checking table capacity, then if equipment quantity equals maximum capacity and more report lines exist, abort with table overflow error; otherwise continue processing.
    For Equipment Table Full?:
    When checking equipment table capacity, then if equipment quantity equals equipment maximum and report index is not greater than report last line, then table overflow error occurs, otherwise continue processing.
  • Context - all equipment has been processed and stored in the train list structure:
    For Insert Train Record to Database:
    When inserting train record to database, then complete train list with header and equipment details is inserted into gcsutrt database.
  • Context - train record insert has been attempted:
    For Database Insert Successful?:
    When checking insert operation result, then if insert failed or record already exists, abort with insert failure error; otherwise complete storage process successfully.
  • Context - database insert has completed successfully:
    For Train List Storage Complete:
    When finalizing storage process, then train list storage process completes and control returns to main processing flow.
  • Context - equipment table has reached maximum capacity with more items to process:
    For Abort - Table Overflow:
    When table overflow condition is detected, then system aborts with train list table overflow error message.
  • Context - database insert operation has failed or record already exists:
    For Abort - Insert Failed:
    When insert failure condition is detected, then system aborts with database insert failure error message.
  • Context - a train transmission has been successfully processed:
    For Initialize Train Header Information:
    When the system begins train list storage process, then the train header information structure is initialized to empty values.
  • Context - eta information has been set and aei train send status is determined:
    For Set AEI Send Flag:
    When setting aei send flag, then if aei train send is yes, then aei send flag is set to true, otherwise aei send flag is set to false.
  • Context - equipment counter has been initialized and report processing is in progress:
    For More Equipment to Process?:
    When checking for more equipment to process, then if report index is less than or equal to report last line and report index is less than or equal to maximum report line and equipment quantity is less than equipment maximum, then continue processing, otherwise stop processing.
  • Context - more equipment exists to process:
    For Extract Equipment Details:
    When extracting equipment details from report, then if report line is not a message line and not an end report line and not a blank line, then increment equipment quantity and extract equipment information.
  • Context - equipment details have been extracted from report:
    For Equipment Type?:
    When determining equipment type, then if report shows container information, then process as container, otherwise process as car.
  • Context - equipment type is determined to be container:
    For Store Container Information:
    When storing container information, then container id is stored as equipment id and container flag is set to true.
  • Context - equipment type is determined to be car:
    For Store Car Information:
    When storing car information, then car initials are moved to equipment initials, zeros are moved to equipment number prefix, car number is moved to equipment number, and constructed equipment id is stored.
  • Context - equipment information has been stored (container or car):
    For Set Equipment Type Code:
    When setting equipment type code, then equipment type code from report working storage is stored in train equipment record.
  • Context - equipment details have been fully stored:
    For Increment Equipment Counter:
    When incrementing equipment counter, then equipment quantity counter is incremented by 1.
  • Context - all equipment has been processed and table capacity is not exceeded:
    For Insert Train Record to Database:
    When inserting train record to database, then train list record with all equipment details is inserted into the database using gccutrio module.
  • Context - train record insert operation has been attempted:
    For Database Insert Successful?:
    When validating database insert success, then if gccutrio return indicates already exists error, then system abend with insert failed message, otherwise insertion is successful.
👨‍💻 Technical ACs (Gherkin)
Context: A train transmission has been successfully validated and approved for sending
GIVEN
A train transmission has been successfully validated and approved for sending
Applied to: Initialize Train Header Information
WHEN
The system begins the train list storage process
THEN
The train header information is initialized and cleared of any previous data to prepare for new train data storage
Context: Train header information has been initialized
GIVEN
Train header information has been initialized
Applied to: Set Train Identification Data
WHEN
Setting train identification data
THEN
Train number, train day, train origin, and consist number are copied from the request to the train list structure
Applied to: Set Train Identification Data
WHEN
Setting train identification data for database storage
THEN
Train number, train day, train origin, and consist number are stored in the train list record
Context: Train identification data has been set
GIVEN
Train identification data has been set
Applied to: Set Origin Station Details
WHEN
Setting origin station details
THEN
US station code, station name, and FIRMS code are stored from the validated station information AND Origin station US code, station name, and FIRMS code are stored in the train record
Context: Origin station details have been set
GIVEN
Origin station details have been set
Applied to: Set ETA Information
WHEN
Setting ETA information
THEN
ETA date and ETA time are stored from the validated request data AND ETA date and ETA time are stored in the train record
Context: ETA information has been set
GIVEN
ETA information has been set
Applied to: Set AEI Send Flag
WHEN
The request type indicates AEI transmission
THEN
The AEI send flag is set to true, otherwise it is set to false
Context: AEI send flag has been set
GIVEN
AEI send flag has been set
Applied to: Initialize Equipment Counter
WHEN
Beginning equipment processing
THEN
Equipment quantity counter is initialized to zero
Applied to: Initialize Equipment Counter
WHEN
Initializing equipment processing
THEN
Equipment quantity counter is initialized to zero
Context: Equipment processing is in progress
GIVEN
Equipment processing is in progress
Applied to: More Equipment to Process?
WHEN
Checking for more equipment items
THEN
Continue processing if report index is within bounds, equipment table is not full, and current line contains valid equipment data (not message, end report, or blank line)
Context: A valid equipment line has been identified for processing
GIVEN
A valid equipment line has been identified for processing
Applied to: Extract Equipment Details
WHEN
Extracting equipment details
THEN
Equipment counter is incremented and equipment identification data is prepared for type-specific processing
Context: Equipment details are being extracted
GIVEN
Equipment details are being extracted
Applied to: Equipment Type?
WHEN
Determining equipment type
THEN
If container ID exists, process as container; otherwise process as railcar
Context: Equipment has been identified as a container
GIVEN
Equipment has been identified as a container
Applied to: Store Container Information
WHEN
Storing container information
THEN
Container ID is stored as equipment ID and container flag is set to true
Context: Equipment has been identified as a railcar
GIVEN
Equipment has been identified as a railcar
Applied to: Store Car Information
WHEN
Storing car information
THEN
Car initials and number are combined to form complete equipment ID for storage
Context: Equipment ID has been stored
GIVEN
Equipment ID has been stored
Applied to: Set Equipment Type Code
WHEN
Setting equipment type code
THEN
Equipment type code from the report working storage is stored in the train list equipment record
Context: Equipment type code has been set
GIVEN
Equipment type code has been set
Applied to: Determine Load/Empty Status
WHEN
Determining load/empty status
THEN
If cargo control number exists, use load/empty indicator from report; otherwise set status to empty AND If report US CCN key is spaces, then load/empty indicator is set to 'E' (empty), otherwise load/empty indicator is set from report load/empty indicator
Context: Load/empty status has been determined
GIVEN
Load/empty status has been determined
Applied to: Store Cargo Control Number
WHEN
Storing cargo control number
THEN
US cargo control number from the report working storage is stored in the equipment record AND US CCN key from report working storage is stored in train equipment US CCN key field
Context: Cargo control number has been stored
GIVEN
Cargo control number has been stored
Applied to: Store Condition Response Code
WHEN
Storing condition response code
THEN
Cargo condition response code from the report working storage is stored in the equipment record AND Cargo condition response code from report working storage is stored in train equipment condition response code field
Context: Condition response code has been stored
GIVEN
Condition response code has been stored
Applied to: Store Empty Car Indicator
WHEN
Storing empty car indicator
THEN
Empty car routing indicator from the report working storage is stored in the equipment record AND Empty car indicator from report working storage is stored in train equipment empty car indicator field
Context: All equipment details have been stored for current item
GIVEN
All equipment details have been stored for current item
Applied to: Increment Equipment Counter
WHEN
Completing equipment storage
THEN
Equipment quantity counter is incremented by one
Context: Equipment counter has been incremented
GIVEN
Equipment counter has been incremented
Applied to: Equipment Table Full?
WHEN
Checking table capacity
THEN
If equipment quantity equals maximum capacity and more report lines exist, abort with table overflow error; otherwise continue processing
Applied to: Equipment Table Full?
WHEN
Checking equipment table capacity
THEN
If equipment quantity equals equipment maximum AND report index is not greater than report last line, then table overflow error occurs, otherwise continue processing
Context: All equipment has been processed and stored in the train list structure
GIVEN
All equipment has been processed and stored in the train list structure
Applied to: Insert Train Record to Database
WHEN
Inserting train record to database
THEN
Complete train list with header and equipment details is inserted into GCSUTRT database
Context: Train record insert has been attempted
GIVEN
Train record insert has been attempted
Applied to: Database Insert Successful?
WHEN
Checking insert operation result
THEN
If insert failed or record already exists, abort with insert failure error; otherwise complete storage process successfully
Context: Database insert has completed successfully
GIVEN
Database insert has completed successfully
Applied to: Train List Storage Complete
WHEN
Finalizing storage process
THEN
Train list storage process completes and control returns to main processing flow
Context: Equipment table has reached maximum capacity with more items to process
GIVEN
Equipment table has reached maximum capacity with more items to process
Applied to: Abort - Table Overflow
WHEN
Table overflow condition is detected
THEN
System aborts with train list table overflow error message
Context: Database insert operation has failed or record already exists
GIVEN
Database insert operation has failed or record already exists
Applied to: Abort - Insert Failed
WHEN
Insert failure condition is detected
THEN
System aborts with database insert failure error message
Context: A train transmission has been successfully processed
GIVEN
A train transmission has been successfully processed
Applied to: Initialize Train Header Information
WHEN
The system begins train list storage process
THEN
The train header information structure is initialized to empty values
Context: ETA information has been set and AEI train send status is determined
GIVEN
ETA information has been set and AEI train send status is determined
Applied to: Set AEI Send Flag
WHEN
Setting AEI send flag
THEN
If AEI train send is YES, then AEI send flag is set to TRUE, otherwise AEI send flag is set to FALSE
Context: Equipment counter has been initialized and report processing is in progress
GIVEN
Equipment counter has been initialized and report processing is in progress
Applied to: More Equipment to Process?
WHEN
Checking for more equipment to process
THEN
If report index is less than or equal to report last line AND report index is less than or equal to maximum report line AND equipment quantity is less than equipment maximum, then continue processing, otherwise stop processing
Context: More equipment exists to process
GIVEN
More equipment exists to process
Applied to: Extract Equipment Details
WHEN
Extracting equipment details from report
THEN
If report line is not a message line AND not an end report line AND not a blank line, then increment equipment quantity and extract equipment information
Context: Equipment details have been extracted from report
GIVEN
Equipment details have been extracted from report
Applied to: Equipment Type?
WHEN
Determining equipment type
THEN
If report shows container information, then process as container, otherwise process as car
Context: Equipment type is determined to be container
GIVEN
Equipment type is determined to be container
Applied to: Store Container Information
WHEN
Storing container information
THEN
Container ID is stored as equipment ID and container flag is set to TRUE
Context: Equipment type is determined to be car
GIVEN
Equipment type is determined to be car
Applied to: Store Car Information
WHEN
Storing car information
THEN
Car initials are moved to equipment initials, zeros are moved to equipment number prefix, car number is moved to equipment number, and constructed equipment ID is stored
Context: Equipment information has been stored (container or car)
GIVEN
Equipment information has been stored (container or car)
Applied to: Set Equipment Type Code
WHEN
Setting equipment type code
THEN
Equipment type code from report working storage is stored in train equipment record
Context: Equipment details have been fully stored
GIVEN
Equipment details have been fully stored
Applied to: Increment Equipment Counter
WHEN
Incrementing equipment counter
THEN
Equipment quantity counter is incremented by 1
Context: All equipment has been processed and table capacity is not exceeded
GIVEN
All equipment has been processed and table capacity is not exceeded
Applied to: Insert Train Record to Database
WHEN
Inserting train record to database
THEN
Train list record with all equipment details is inserted into the database using GCCUTRIO module
Context: Train record insert operation has been attempted
GIVEN
Train record insert operation has been attempted
Applied to: Database Insert Successful?
WHEN
Validating database insert success
THEN
If GCCUTRIO return indicates already exists error, then system abend with insert failed message, otherwise insertion is successful
R-GCX003-cbl-00776 (+18) File: GCX003.cbl Report Finalization and Header Generation Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Finalization and Header Generation':
  • Context - a report is being finalized:
    For Set Report End Marker:
    When the current report line at rpt-idx is blank, then set the report end marker flag for that line.
    For Calculate Report Last Line Index:
    When the report processing is complete, then set the report last line index to the current rpt-idx value and set the new report last line index to the current new-rpt-idx value and set rpt-last-line to the current rpt-idx value and new-rpt-last-line to the current new-rpt-idx value.
    For Generate Header Line 1 - Train Information & Generate Header Line 2 - User Information:
    When generating report headers, then set header line 1 flag, populate train id from request, and populate origin station name from station code table and set header line 2 flag, populate user id from cccom, populate terminal from cccom, populate machine date from cccom, populate machine hour from cccom, and populate machine minutes from cccom and set header line 1 flag, populate train id from request, and set origin station name from station code table and set header line 2 flag, populate user id, terminal id, machine date, hour, and minute from system information.
    For Determine Request Action Type & Processing Results:
    When the request action is other, then set request type in header and set result abort flag and set request type in header and mark result as abort.
    For Generate Header Line 4 - Train Details:
    When generating detailed train headers, then set header line 4 flag, populate us customs train id from train list, populate eta year from request, populate eta month from request, populate eta day from request, populate eta hour from request, and populate eta minutes from request and set header line 4 flag, populate us customs train id, and set eta year, month, day, hour, and minute components.
    For Generate Detail Headers:
    When setting up detail section headers, then set detail header line 1 flag and set detail header line 2 flag.
    For Generate Detail Headers:
    When setting up report structure, then set detail header 1 flag for line 6 and detail header 2 flag for line 7.
  • Context - a report action is being processed:
    For Check Processing Status:
    When there are errors or warnings, then set message result flag, populate warning count, populate error count, and populate dsp count.
    For Set NO MESSAGE Result:
    When there are no errors (rpt-no-error) and no warnings (rpt-no-wrn), then set the result status to no message.
    For Set MESSAGE Result with Counts:
    When there are errors or warnings present, then set result status to message, populate warning count, error count, and dsp count in the header.
  • Context - report headers have been generated:
    For Copy Headers to Report Lines:
    When finalizing report output, then copy report line 1 to email text line 1, copy report line 2 to email text line 2, copy report line 3 to email text line 3, copy report line 4 to email text line 4, and copy report line 5 to email text line 5 and copy report lines 1 through 5 to corresponding email text lines.
👨‍💻 Technical ACs (Gherkin)
Context: A report is being finalized
GIVEN
A report is being finalized
Applied to: Set Report End Marker
WHEN
The current report line at RPT-IDX is blank
THEN
Set the report end marker flag for that line
Applied to: Calculate Report Last Line Index
WHEN
The report processing is complete
THEN
Set the report last line index to the current RPT-IDX value and set the new report last line index to the current NEW-RPT-IDX value AND Set RPT-LAST-LINE to the current RPT-IDX value and NEW-RPT-LAST-LINE to the current NEW-RPT-IDX value
Applied to: Generate Header Line 1 - Train Information & Generate Header Line 2 - User Information
WHEN
Generating report headers
THEN
Set header line 1 flag, populate train ID from request, and populate origin station name from station code table AND Set header line 2 flag, populate user ID from CCCOM, populate terminal from CCCOM, populate machine date from CCCOM, populate machine hour from CCCOM, and populate machine minutes from CCCOM AND Set header line 1 flag, populate train ID from request, and set origin station name from station code table AND Set header line 2 flag, populate user ID, terminal ID, machine date, hour, and minute from system information
Applied to: Determine Request Action Type & Processing Results
WHEN
The request action is OTHER
THEN
Set request type in header and set result abort flag AND Set request type in header and mark result as abort
Applied to: Generate Header Line 4 - Train Details
WHEN
Generating detailed train headers
THEN
Set header line 4 flag, populate US customs train ID from train list, populate ETA year from request, populate ETA month from request, populate ETA day from request, populate ETA hour from request, and populate ETA minutes from request AND Set header line 4 flag, populate US customs train ID, and set ETA year, month, day, hour, and minute components
Applied to: Generate Detail Headers
WHEN
Setting up detail section headers
THEN
Set detail header line 1 flag and set detail header line 2 flag
Applied to: Generate Detail Headers
WHEN
Setting up report structure
THEN
Set detail header 1 flag for line 6 and detail header 2 flag for line 7
Context: A report action is being processed
GIVEN
A report action is being processed
Applied to: Check Processing Status
WHEN
There are errors or warnings
THEN
Set message result flag, populate warning count, populate error count, and populate DSP count
Applied to: Set NO MESSAGE Result
WHEN
There are no errors (RPT-NO-ERROR) and no warnings (RPT-NO-WRN)
THEN
Set the result status to no message
Applied to: Set MESSAGE Result with Counts
WHEN
There are errors or warnings present
THEN
Set result status to message, populate warning count, error count, and DSP count in the header
Context: Report headers have been generated
GIVEN
Report headers have been generated
Applied to: Copy Headers to Report Lines
WHEN
Finalizing report output
THEN
Copy report line 1 to email text line 1, copy report line 2 to email text line 2, copy report line 3 to email text line 3, copy report line 4 to email text line 4, and copy report line 5 to email text line 5 AND Copy report lines 1 through 5 to corresponding email text lines
R-GCX003-cbl-00785 (+16) File: GCX003.cbl Processing Result Classification Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Processing Result Classification':
  • Context - train processing has completed:
    For Set Result Status: SENT:
    When there are no processing errors and there are no spawn messages, then set result status to sent and record warning message count.
  • Context - train processing has completed with no processing errors:
    For Set Result Status: NOT SENT:
    When there are spawn messages present, then set result status to not sent and count warning messages and add spawn count to error count and set total error count.
  • Context - train processing completed successfully with spawn messages:
    For Trigger Special Manifest Processing:
    When spawn messages need to be processed, then execute special manifest processing for each spawn message from 1 to spawn count.
  • Context - train processing has errors and no spawn messages are present:
    For Convert Spawn Messages to Report Messages:
    When message lines contain spawn division messages or spawn ite messages, then convert spawn division messages to message nineteen with station code and convert spawn ite messages to message eighteen.
  • Context - train processing has errors and spawn messages are present:
    For Convert Spawn Messages to Warning Messages:
    When final message processing occurs, then add spawn count to warning message count.
  • Context - train processing has errors and no spawn messages and message type is 43 (special authorization error):
    For Convert Spawn Messages to Report Messages:
    When total error count equals the count of type 43 errors, then convert message 43 to message eighteen and increment warning count and decrement error count.
  • Context - train processing has encountered errors:
    For Set Result Status: NOT SENT:
    When final result classification is performed, then set result status to not sent and record final warning message count and record final error message count.
  • Context - a train manifest processing request has been completed:
    For Any Processing Errors?:
    When the system checks for any processing errors in the report, then if no errors exist (rpt-no-error is true), proceed to check for spawn messages, otherwise proceed to spawn message evaluation for error handling.
  • Context - train manifest processing completed with no errors and no spawn messages:
    For Set Result Status: SENT:
    When the system determines the final processing result status, then set the result status to sent and record warning count for reporting.
  • Context - train manifest processing completed with no errors but spawn messages exist:
    For Set Result Status: NOT SENT:
    When the system determines the final processing result status, then set the result status to not sent, add spawn count to error count, and trigger special manifest processing.
  • Context - train manifest processing completed successfully:
    For Count Warning Messages:
    When the system prepares the final result classification, then count all warning messages and record the warning count in the result status.
  • Context - train manifest processing has spawn messages that require special processing:
    For Add Spawn Count to Error Count:
    When the system calculates the total error count for reporting, then add the spawn message count to the existing error count to get the total error count.
  • Context - train manifest processing resulted in spawn messages requiring special handling:
    For Trigger Special Manifest Processing:
    When the system needs to process spawned items, then execute special manifest processing for each spawned item using gcx101 module.
  • Context - train manifest processing has errors but no spawn messages exist:
    For Convert Error Messages to Warning Messages:
    When the system evaluates message types for final classification, then convert specific error messages (type 43) to warning messages if error count matches the count of type 43 messages, otherwise keep as warnings.
  • Context - error messages have been evaluated and potentially converted to warnings:
    For Update Message Counts:
    When the system finalizes message counts for reporting, then increment warning count by 1 and decrement error count by 1 for each converted message.
  • Context - train manifest processing has both errors and spawn messages:
    For Convert Error Messages to Warning Messages:
    When the system processes spawn-related messages for final reporting, then convert diversion spawn messages to message type 19 and it export spawn messages to message type 18, then add spawn count to warning count.
  • Context - all processing result classifications and message counts have been determined:
    For Generate Report Header with Status:
    When the system generates the final report header, then create report header line 4 with train id, eta information, and set the appropriate result status (sent, not sent, or aborted) with final warning and error counts.
👨‍💻 Technical ACs (Gherkin)
Context: Train processing has completed
GIVEN
Train processing has completed
Applied to: Set Result Status: SENT
WHEN
There are no processing errors AND there are no spawn messages
THEN
Set result status to SENT AND record warning message count
Context: Train processing has completed with no processing errors
GIVEN
Train processing has completed with no processing errors
Applied to: Set Result Status: NOT SENT
WHEN
There are spawn messages present
THEN
Set result status to NOT SENT AND count warning messages AND add spawn count to error count AND set total error count
Context: Train processing completed successfully with spawn messages
GIVEN
Train processing completed successfully with spawn messages
Applied to: Trigger Special Manifest Processing
WHEN
Spawn messages need to be processed
THEN
Execute special manifest processing for each spawn message from 1 to spawn count
Context: Train processing has errors AND no spawn messages are present
GIVEN
Train processing has errors AND no spawn messages are present
Applied to: Convert Spawn Messages to Report Messages
WHEN
Message lines contain spawn division messages OR spawn ITE messages
THEN
Convert spawn division messages to message nineteen with station code AND convert spawn ITE messages to message eighteen
Context: Train processing has errors AND spawn messages are present
GIVEN
Train processing has errors AND spawn messages are present
Applied to: Convert Spawn Messages to Warning Messages
WHEN
Final message processing occurs
THEN
Add spawn count to warning message count
Context: Train processing has errors AND no spawn messages AND message type is 43 (special authorization error)
GIVEN
Train processing has errors AND no spawn messages AND message type is 43 (special authorization error)
Applied to: Convert Spawn Messages to Report Messages
WHEN
Total error count equals the count of type 43 errors
THEN
Convert message 43 to message eighteen AND increment warning count AND decrement error count
Context: Train processing has encountered errors
GIVEN
Train processing has encountered errors
Applied to: Set Result Status: NOT SENT
WHEN
Final result classification is performed
THEN
Set result status to NOT SENT AND record final warning message count AND record final error message count
Context: A train manifest processing request has been completed
GIVEN
A train manifest processing request has been completed
Applied to: Any Processing Errors?
WHEN
The system checks for any processing errors in the report
THEN
If no errors exist (RPT-NO-ERROR is true), proceed to check for spawn messages, otherwise proceed to spawn message evaluation for error handling
Context: Train manifest processing completed with no errors and no spawn messages
GIVEN
Train manifest processing completed with no errors and no spawn messages
Applied to: Set Result Status: SENT
WHEN
The system determines the final processing result status
THEN
Set the result status to SENT and record warning count for reporting
Context: Train manifest processing completed with no errors but spawn messages exist
GIVEN
Train manifest processing completed with no errors but spawn messages exist
Applied to: Set Result Status: NOT SENT
WHEN
The system determines the final processing result status
THEN
Set the result status to NOT SENT, add spawn count to error count, and trigger special manifest processing
Context: Train manifest processing completed successfully
GIVEN
Train manifest processing completed successfully
Applied to: Count Warning Messages
WHEN
The system prepares the final result classification
THEN
Count all warning messages and record the warning count in the result status
Context: Train manifest processing has spawn messages that require special processing
GIVEN
Train manifest processing has spawn messages that require special processing
Applied to: Add Spawn Count to Error Count
WHEN
The system calculates the total error count for reporting
THEN
Add the spawn message count to the existing error count to get the total error count
Context: Train manifest processing resulted in spawn messages requiring special handling
GIVEN
Train manifest processing resulted in spawn messages requiring special handling
Applied to: Trigger Special Manifest Processing
WHEN
The system needs to process spawned items
THEN
Execute special manifest processing for each spawned item using GCX101 module
Context: Train manifest processing has errors but no spawn messages exist
GIVEN
Train manifest processing has errors but no spawn messages exist
Applied to: Convert Error Messages to Warning Messages
WHEN
The system evaluates message types for final classification
THEN
Convert specific error messages (type 43) to warning messages if error count matches the count of type 43 messages, otherwise keep as warnings
Context: Error messages have been evaluated and potentially converted to warnings
GIVEN
Error messages have been evaluated and potentially converted to warnings
Applied to: Update Message Counts
WHEN
The system finalizes message counts for reporting
THEN
Increment warning count by 1 and decrement error count by 1 for each converted message
Context: Train manifest processing has both errors and spawn messages
GIVEN
Train manifest processing has both errors and spawn messages
Applied to: Convert Error Messages to Warning Messages
WHEN
The system processes spawn-related messages for final reporting
THEN
Convert diversion spawn messages to message type 19 and IT export spawn messages to message type 18, then add spawn count to warning count
Context: All processing result classifications and message counts have been determined
GIVEN
All processing result classifications and message counts have been determined
Applied to: Generate Report Header with Status
WHEN
The system generates the final report header
THEN
Create report header line 4 with train ID, ETA information, and set the appropriate result status (SENT, NOT SENT, or ABORTED) with final warning and error counts
R-GCX003-cbl-00792 (+14) File: GCX003.cbl Request Termination Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Request Termination Processing':
  • Context - a train processing request has been completed with equipment processed and report lines generated:
    For Finalize Report Headers and Summary:
    When the system finalizes the report for transmission, then the system sets the end report marker if the last line is blank, records the last line index, creates header lines with train id and origin station, adds user id and terminal information with current date and time, and formats the result status based on the request action type.
  • Context - a train processing request has been finalized with a specific action type and error status:
    For Evaluate Request Action Type:
    When the system evaluates the request for final processing, then if the action is send with no errors and no spawns, perform full transmission processing; if the action is report, perform report-only processing; otherwise perform error handling with database rollback.
  • Context - a send request has been validated successfully with no errors and no spawns required:
    For Store Train List in Database:
    When the system processes the train list for storage, then the system saves the train header information including train number, day, origin, consist number, crossing port, station details, eta date and time, aei send flag, and all equipment details with their load/empty status and cargo information to the database.
  • Context - a train list has been successfully stored in the database:
    For Transmit Train List to US Customs EDI:
    When the system transmits the train information to customs, then the system calls the customs edi transmission module (gccu358t) in background mode with the complete train list data, and if aei send flag is set, logs the aei transmission activity.
  • Context - a report has been generated with potential duplicate equipment entries:
    For Remove Duplicate Equipment Entries:
    When the system scans for duplicates, then for each equipment entry, if the car id matches the previously held car id, clear the current car id to spaces; otherwise update the held car id with the current car id, excluding error, warning, and information message lines from duplicate checking.
  • Context - a train report has been finalized and duplicates removed:
    For Send Report to Customs MERLIN System:
    When the system sends the report to customs, then the system formats the report with equipment totals in the status line, sets the sender and recipient to om01247, uses the first report line as the subject, sets item width to 080, and transmits up to 699 lines per email with continuation handling for larger reports.
  • Context - a train report has been sent to the customs merlin system:
    For Generate PDF Report:
    When the system generates the pdf report, then the system calls the pdf generation module (gcx904r) with the report message content, email subject from the first report line, train id, report title as 'pre-exit report', report type as 'export', pdf length of 80 characters, and the total number of report lines.
  • Context - a pdf report has been generated for the train processing:
    For Is Laredo TX Station?:
    When the system determines the station-specific report format, then if the crossing port is laredo tx station, generate an enhanced format report; otherwise generate a canadian export report.
  • Context - the processing station is laredo tx:
    For Generate Enhanced Format Report:
    When the system generates the enhanced report, then the system creates header lines with train id, car and container counts by load/empty status, eta date and time, port code and name, locomotive count, and total equipment count, formats detail lines for each equipment item, and prepares the report for pdf generation.
  • Context - an enhanced format report has been generated for laredo station:
    For Generate Second PDF Report:
    When the system creates the second pdf report, then the system calls the pdf generation module (gcx904r) with the enhanced report table, new report subject, train id, report title as 'export train report', report type as 'export', pdf length of 132 characters, and the enhanced report line count.
  • Context - the processing station is not laredo tx:
    For Spawn Canadian Export Report:
    When the system spawns the export report, then the system creates a gcx141 message with function name flag, train id, and message length, then inserts the message to trigger the canadian export report generation process.
  • Context - all transmission and reporting processes have completed successfully for a send request:
    For Set Acknowledgment Only Flag:
    When the system prepares the originator response, then the system sets the acknowledgment only flag to true to indicate that only a brief confirmation should be sent rather than the full detailed report.
  • Context - a train processing request has completed with final status determined:
    For Send Report to Originator Terminal:
    When the system sends the response to the originator, then if aei send flag is set, send aei-specific report; determine destination terminal from alternate terminal or original terminal; set call letters based on error status and action type; send header line first, then send appropriate report content based on acknowledgment flag and warning status, and finally send wrap-up message.
  • Context - a send request has completed successfully with cargo items added:
    For Send Activity Audit Logs:
    When the system generates audit logs, then for each added us ccn (up to 2499 entries), create a log entry with security byte, us cargo flag, action code 'zzz', sending transaction 'gct0031e', user acf2 id, current date and time, the us ccn key, and car added log message, then transmit the log entry.
  • Context - a train processing request has encountered errors or is not a successful send action:
    For Perform Database Rollback:
    When the system handles the error condition, then the system performs a database rollback operation to undo all changes made during the current processing session.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request has been completed with equipment processed and report lines generated
GIVEN
A train processing request has been completed with equipment processed and report lines generated
Applied to: Finalize Report Headers and Summary
WHEN
The system finalizes the report for transmission
THEN
The system sets the end report marker if the last line is blank, records the last line index, creates header lines with train ID and origin station, adds user ID and terminal information with current date and time, and formats the result status based on the request action type
Context: A train processing request has been finalized with a specific action type and error status
GIVEN
A train processing request has been finalized with a specific action type and error status
Applied to: Evaluate Request Action Type
WHEN
The system evaluates the request for final processing
THEN
If the action is SEND with no errors and no spawns, perform full transmission processing; if the action is REPORT, perform report-only processing; otherwise perform error handling with database rollback
Context: A SEND request has been validated successfully with no errors and no spawns required
GIVEN
A SEND request has been validated successfully with no errors and no spawns required
Applied to: Store Train List in Database
WHEN
The system processes the train list for storage
THEN
The system saves the train header information including train number, day, origin, consist number, crossing port, station details, ETA date and time, AEI send flag, and all equipment details with their load/empty status and cargo information to the database
Context: A train list has been successfully stored in the database
GIVEN
A train list has been successfully stored in the database
Applied to: Transmit Train List to US Customs EDI
WHEN
The system transmits the train information to customs
THEN
The system calls the customs EDI transmission module (GCCU358T) in background mode with the complete train list data, and if AEI send flag is set, logs the AEI transmission activity
Context: A report has been generated with potential duplicate equipment entries
GIVEN
A report has been generated with potential duplicate equipment entries
Applied to: Remove Duplicate Equipment Entries
WHEN
The system scans for duplicates
THEN
For each equipment entry, if the car ID matches the previously held car ID, clear the current car ID to spaces; otherwise update the held car ID with the current car ID, excluding error, warning, and information message lines from duplicate checking
Context: A train report has been finalized and duplicates removed
GIVEN
A train report has been finalized and duplicates removed
Applied to: Send Report to Customs MERLIN System
WHEN
The system sends the report to customs
THEN
The system formats the report with equipment totals in the status line, sets the sender and recipient to OM01247, uses the first report line as the subject, sets item width to 080, and transmits up to 699 lines per email with continuation handling for larger reports
Context: A train report has been sent to the customs MERLIN system
GIVEN
A train report has been sent to the customs MERLIN system
Applied to: Generate PDF Report
WHEN
The system generates the PDF report
THEN
The system calls the PDF generation module (GCX904R) with the report message content, email subject from the first report line, train ID, report title as 'Pre-Exit Report', report type as 'EXPORT', PDF length of 80 characters, and the total number of report lines
Context: A PDF report has been generated for the train processing
GIVEN
A PDF report has been generated for the train processing
Applied to: Is Laredo TX Station?
WHEN
The system determines the station-specific report format
THEN
If the crossing port is Laredo TX station, generate an enhanced format report; otherwise generate a Canadian export report
Context: The processing station is Laredo TX
GIVEN
The processing station is Laredo TX
Applied to: Generate Enhanced Format Report
WHEN
The system generates the enhanced report
THEN
The system creates header lines with train ID, car and container counts by load/empty status, ETA date and time, port code and name, locomotive count, and total equipment count, formats detail lines for each equipment item, and prepares the report for PDF generation
Context: An enhanced format report has been generated for Laredo station
GIVEN
An enhanced format report has been generated for Laredo station
Applied to: Generate Second PDF Report
WHEN
The system creates the second PDF report
THEN
The system calls the PDF generation module (GCX904R) with the enhanced report table, new report subject, train ID, report title as 'Export Train Report', report type as 'EXPORT', PDF length of 132 characters, and the enhanced report line count
Context: The processing station is not Laredo TX
GIVEN
The processing station is not Laredo TX
Applied to: Spawn Canadian Export Report
WHEN
The system spawns the export report
THEN
The system creates a GCX141 message with function name flag, train ID, and message length, then inserts the message to trigger the Canadian export report generation process
Context: All transmission and reporting processes have completed successfully for a SEND request
GIVEN
All transmission and reporting processes have completed successfully for a SEND request
Applied to: Set Acknowledgment Only Flag
WHEN
The system prepares the originator response
THEN
The system sets the acknowledgment only flag to true to indicate that only a brief confirmation should be sent rather than the full detailed report
Context: A train processing request has completed with final status determined
GIVEN
A train processing request has completed with final status determined
Applied to: Send Report to Originator Terminal
WHEN
The system sends the response to the originator
THEN
If AEI send flag is set, send AEI-specific report; determine destination terminal from alternate terminal or original terminal; set call letters based on error status and action type; send header line first, then send appropriate report content based on acknowledgment flag and warning status, and finally send wrap-up message
Context: A SEND request has completed successfully with cargo items added
GIVEN
A SEND request has completed successfully with cargo items added
Applied to: Send Activity Audit Logs
WHEN
The system generates audit logs
THEN
For each added US CCN (up to 2499 entries), create a log entry with security byte, US cargo flag, action code 'ZZZ', sending transaction 'GCT0031E', user ACF2 ID, current date and time, the US CCN key, and car added log message, then transmit the log entry
Context: A train processing request has encountered errors or is not a successful SEND action
GIVEN
A train processing request has encountered errors or is not a successful SEND action
Applied to: Perform Database Rollback
WHEN
The system handles the error condition
THEN
The system performs a database rollback operation to undo all changes made during the current processing session
R-GCX003-cbl-00926 (+4) File: GCX003.cbl Haulage Automation Flag Management Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Haulage Automation Flag Management':
  • Context - a cargo record with scac code and train origin location:
    For Determine Port Automation Status:
    When the system evaluates port automation status and ((scac is cprs and train origin is not 9089) or (scac is uprr and train origin is 9089)), then set port as automated, otherwise set port as paper mode.
  • Context - a cargo record that doesn't meet standard automated port criteria and station table contains port configuration data:
    For Determine Port Automation Status:
    When the system looks up the scac and port combination in the station table, then set port automation status based on the automated carrier flag from station table (y for automated, otherwise paper).
  • Context - a cargo record with haulage indicator and cargo has automated haulage flag and port is determined to be paper mode and request action is send:
    For Update Haulage Flag to Manual - Set 'N':
    When the system detects mismatch between automated haulage and paper port, then update the haulage automation flag to 'n' (manual) and replace the cargo record.
  • Context - a cargo record with haulage indicator and cargo has manual haulage flag and port is determined to be automated mode and request action is send:
    For Update Haulage Flag to Automated - Set 'Y':
    When the system detects mismatch between manual haulage and automated port, then update the haulage automation flag to 'y' (automated) and replace the cargo record.
  • Context - a cargo record being processed for haulage automation flags:
    For Is Cargo Haulage?:
    When the cargo does not have haulage indicator set, then skip all haulage automation flag processing and continue with next processing step.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with SCAC code and train origin location
GIVEN
A cargo record with SCAC code and train origin location
Applied to: Determine Port Automation Status
WHEN
The system evaluates port automation status AND ((SCAC is CPRS and train origin is not 9089) OR (SCAC is UPRR and train origin is 9089))
THEN
Set port as automated, otherwise set port as paper mode
Context: A cargo record that doesn't meet standard automated port criteria AND station table contains port configuration data
GIVEN
A cargo record that doesn't meet standard automated port criteria AND station table contains port configuration data
Applied to: Determine Port Automation Status
WHEN
The system looks up the SCAC and port combination in the station table
THEN
Set port automation status based on the automated carrier flag from station table (Y for automated, otherwise paper)
Context: A cargo record with haulage indicator AND cargo has automated haulage flag AND port is determined to be paper mode AND request action is SEND
GIVEN
A cargo record with haulage indicator AND cargo has automated haulage flag AND port is determined to be paper mode AND request action is SEND
Applied to: Update Haulage Flag to Manual - Set 'N'
WHEN
The system detects mismatch between automated haulage and paper port
THEN
Update the haulage automation flag to 'N' (manual) and replace the cargo record
Context: A cargo record with haulage indicator AND cargo has manual haulage flag AND port is determined to be automated mode AND request action is SEND
GIVEN
A cargo record with haulage indicator AND cargo has manual haulage flag AND port is determined to be automated mode AND request action is SEND
Applied to: Update Haulage Flag to Automated - Set 'Y'
WHEN
The system detects mismatch between manual haulage and automated port
THEN
Update the haulage automation flag to 'Y' (automated) and replace the cargo record
Context: A cargo record being processed for haulage automation flags
GIVEN
A cargo record being processed for haulage automation flags
Applied to: Is Cargo Haulage?
WHEN
The cargo does not have haulage indicator set
THEN
Skip all haulage automation flag processing and continue with next processing step
R-GCX003-cbl-00931 (+9) File: GCX003.cbl Report Message Classification and Counting Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Message Classification and Counting':
  • Context - a report line has been added to the report at a specific index position:
    For Is Message Line?:
    When the system checks if the line contains a message using the message line indicator, then the system identifies whether the line is a message line that requires classification or a regular report line that should be skipped for message counting.
  • Context - a message line has been identified in the report:
    For Is Spawn Message?:
    When the system checks if the message is a spawn message type, then if it is a spawn message, skip the message counting process and proceed to increment report index, otherwise continue with message classification.
  • Context - a non-spawn message line has been identified:
    For Increment Error Count:
    When the message type is classified as an error message, then the system increments the error count by 1 for report statistics.
    For Increment Warning Count:
    When the message type is classified as a warning message, then the system increments the warning count by 1 for report statistics.
    For Increment Info Count:
    When the message type is classified as an informational message, then the system increments the information count by 1 for report statistics.
  • Context - an error message has been identified and error count has been incremented:
    For Check if Message Type 43:
    When the message type indicator equals 43, then the system increments the type 43 error count by 1 in addition to the general error count.
  • Context - a warning message has been identified and warning count has been incremented:
    For Warning Type 49 or 52?:
    When the message type indicator equals 49 or 52, then the system increments the dsp count by 1 in addition to the general warning count.
  • Context - a report line has been processed (either message classified or non-message line handled):
    For Increment Report Index:
    When the system completes processing of the current report line, then the system increments the report index by 1 to move to the next report line position.
  • Context - the report index has been incremented to the next position:
    For Report Maximum Reached?:
    When the system checks if the report has reached its maximum capacity, then if maximum capacity is reached, set an overflow message indicator, otherwise continue normal processing.
  • Context - the report has reached its maximum capacity:
    For Set Overflow Message:
    When the system detects report overflow condition, then the system sets message type 9 (overflow message) at the current report index position to indicate report truncation.
👨‍💻 Technical ACs (Gherkin)
Context: A report line has been added to the report at a specific index position
GIVEN
A report line has been added to the report at a specific index position
Applied to: Is Message Line?
WHEN
The system checks if the line contains a message using the message line indicator
THEN
The system identifies whether the line is a message line that requires classification or a regular report line that should be skipped for message counting
Context: A message line has been identified in the report
GIVEN
A message line has been identified in the report
Applied to: Is Spawn Message?
WHEN
The system checks if the message is a spawn message type
THEN
If it is a spawn message, skip the message counting process and proceed to increment report index, otherwise continue with message classification
Context: A non-spawn message line has been identified
GIVEN
A non-spawn message line has been identified
Applied to: Increment Error Count
WHEN
The message type is classified as an error message
THEN
The system increments the error count by 1 for report statistics
Applied to: Increment Warning Count
WHEN
The message type is classified as a warning message
THEN
The system increments the warning count by 1 for report statistics
Applied to: Increment Info Count
WHEN
The message type is classified as an informational message
THEN
The system increments the information count by 1 for report statistics
Context: An error message has been identified and error count has been incremented
GIVEN
An error message has been identified and error count has been incremented
Applied to: Check if Message Type 43
WHEN
The message type indicator equals 43
THEN
The system increments the Type 43 error count by 1 in addition to the general error count
Context: A warning message has been identified and warning count has been incremented
GIVEN
A warning message has been identified and warning count has been incremented
Applied to: Warning Type 49 or 52?
WHEN
The message type indicator equals 49 or 52
THEN
The system increments the DSP count by 1 in addition to the general warning count
Context: A report line has been processed (either message classified or non-message line handled)
GIVEN
A report line has been processed (either message classified or non-message line handled)
Applied to: Increment Report Index
WHEN
The system completes processing of the current report line
THEN
The system increments the report index by 1 to move to the next report line position
Context: The report index has been incremented to the next position
GIVEN
The report index has been incremented to the next position
Applied to: Report Maximum Reached?
WHEN
The system checks if the report has reached its maximum capacity
THEN
If maximum capacity is reached, set an overflow message indicator, otherwise continue normal processing
Context: The report has reached its maximum capacity
GIVEN
The report has reached its maximum capacity
Applied to: Set Overflow Message
WHEN
The system detects report overflow condition
THEN
The system sets message type 9 (overflow message) at the current report index position to indicate report truncation
R-GCX003-cbl-00941 (+14) File: GCX003.cbl Email Report Pagination Management Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email Report Pagination Management':
  • Context - an email report needs to be sent with pagination support:
    For Initialize Email Parameters:
    When the email report process begins, then email parameters are initialized with default usercode, destination filename, subject, keywords, item specifications, and return status flag are cleared.
  • Context - email pagination process is starting or a new email batch is beginning:
    For Set Line Counter to Zero:
    When line counting needs to be reset, then the line counter is set to zero to start counting lines for the current email batch.
  • Context - email report processing is active with lines to send:
    For Set Email Status to More Email:
    When email status needs to be set for active processing, then email status is set to 'more email' indicating active processing state.
  • Context - a report line exists in the report table and email message buffer has capacity:
    For Add Line to Email Message:
    When a report line needs to be added to the email, then the report line is moved to the email text message line at the current line position.
  • Context - a line has been added to the email message buffer:
    For Increment Line Counter:
    When line counting needs to be updated, then the line counter is incremented by 1 and email status is set to 'more email'.
  • Context - lines have been added to the current email batch:
    For Line Count > 699?:
    When the line counter is evaluated against the maximum limit, then if line counter exceeds 699, trigger email batch sending, otherwise continue adding lines.
  • Context - the email line counter has exceeded 699 lines:
    For Set No More Email Status:
    When the current email batch needs to be marked as complete, then email status is set to 'no more email' indicating the batch is ready for sending.
  • Context - an email batch is ready for transmission with accumulated report lines:
    For Send Current Email Batch:
    When email batch sending is triggered, then the email is sent using emcsend3 with all configured parameters and accumulated message lines.
  • Context - an email batch has been sent and a new batch needs to be prepared:
    For Clear Email Message Buffer:
    When email message buffer needs to be cleared, then the email text message buffer is cleared to spaces.
  • Context - an email batch has been sent and line counter needs reset for next batch:
    For Reset Line Counter to Zero:
    When line counter reset is required, then the line counter is set to zero to begin counting lines for the new email batch.
  • Context - a new email batch is starting after reaching line limits:
    For Add Continuation Header Line:
    When continuation header needs to be added, then the message 'continuation of report ....' is added as the first line of the new email batch.
  • Context - a continuation email batch is being prepared:
    For Add Report Detail Headers:
    When report structure headers need to be included, then report detail header lines are added to the email message to maintain column structure.
  • Context - continuation header and detail headers have been added to new email batch:
    For Update Line Counter for Headers:
    When line counter needs to reflect added headers, then line counter is updated to account for the header lines added to the email batch.
  • Context - email processing is in progress:
    For More Lines to Process?:
    When system needs to determine if more lines exist to process, then if more report lines exist, continue processing loop, otherwise proceed to send final email batch.
  • Context - all report lines have been processed and final email batch is ready:
    For Send Final Email Batch:
    When final email transmission is required, then the final email batch is sent using emcsend3 with all remaining accumulated message lines.
👨‍💻 Technical ACs (Gherkin)
Context: An email report needs to be sent with pagination support
GIVEN
An email report needs to be sent with pagination support
Applied to: Initialize Email Parameters
WHEN
The email report process begins
THEN
Email parameters are initialized with default usercode, destination filename, subject, keywords, item specifications, and return status flag are cleared
Context: Email pagination process is starting or a new email batch is beginning
GIVEN
Email pagination process is starting or a new email batch is beginning
Applied to: Set Line Counter to Zero
WHEN
Line counting needs to be reset
THEN
The line counter is set to zero to start counting lines for the current email batch
Context: Email report processing is active with lines to send
GIVEN
Email report processing is active with lines to send
Applied to: Set Email Status to More Email
WHEN
Email status needs to be set for active processing
THEN
Email status is set to 'More Email' indicating active processing state
Context: A report line exists in the report table and email message buffer has capacity
GIVEN
A report line exists in the report table and email message buffer has capacity
Applied to: Add Line to Email Message
WHEN
A report line needs to be added to the email
THEN
The report line is moved to the email text message line at the current line position
Context: A line has been added to the email message buffer
GIVEN
A line has been added to the email message buffer
Applied to: Increment Line Counter
WHEN
Line counting needs to be updated
THEN
The line counter is incremented by 1 and email status is set to 'More Email'
Context: Lines have been added to the current email batch
GIVEN
Lines have been added to the current email batch
Applied to: Line Count > 699?
WHEN
The line counter is evaluated against the maximum limit
THEN
If line counter exceeds 699, trigger email batch sending, otherwise continue adding lines
Context: The email line counter has exceeded 699 lines
GIVEN
The email line counter has exceeded 699 lines
Applied to: Set No More Email Status
WHEN
The current email batch needs to be marked as complete
THEN
Email status is set to 'No More Email' indicating the batch is ready for sending
Context: An email batch is ready for transmission with accumulated report lines
GIVEN
An email batch is ready for transmission with accumulated report lines
Applied to: Send Current Email Batch
WHEN
Email batch sending is triggered
THEN
The email is sent using EMCSEND3 with all configured parameters and accumulated message lines
Context: An email batch has been sent and a new batch needs to be prepared
GIVEN
An email batch has been sent and a new batch needs to be prepared
Applied to: Clear Email Message Buffer
WHEN
Email message buffer needs to be cleared
THEN
The email text message buffer is cleared to spaces
Context: An email batch has been sent and line counter needs reset for next batch
GIVEN
An email batch has been sent and line counter needs reset for next batch
Applied to: Reset Line Counter to Zero
WHEN
Line counter reset is required
THEN
The line counter is set to zero to begin counting lines for the new email batch
Context: A new email batch is starting after reaching line limits
GIVEN
A new email batch is starting after reaching line limits
Applied to: Add Continuation Header Line
WHEN
Continuation header needs to be added
THEN
The message 'CONTINUATION OF REPORT ....' is added as the first line of the new email batch
Context: A continuation email batch is being prepared
GIVEN
A continuation email batch is being prepared
Applied to: Add Report Detail Headers
WHEN
Report structure headers need to be included
THEN
Report detail header lines are added to the email message to maintain column structure
Context: Continuation header and detail headers have been added to new email batch
GIVEN
Continuation header and detail headers have been added to new email batch
Applied to: Update Line Counter for Headers
WHEN
Line counter needs to reflect added headers
THEN
Line counter is updated to account for the header lines added to the email batch
Context: Email processing is in progress
GIVEN
Email processing is in progress
Applied to: More Lines to Process?
WHEN
System needs to determine if more lines exist to process
THEN
If more report lines exist, continue processing loop, otherwise proceed to send final email batch
Context: All report lines have been processed and final email batch is ready
GIVEN
All report lines have been processed and final email batch is ready
Applied to: Send Final Email Batch
WHEN
Final email transmission is required
THEN
The final email batch is sent using EMCSEND3 with all remaining accumulated message lines
R-GCX003-cbl-00956 (+9) File: GCX003.cbl Email Distribution List Management Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email Distribution List Management':
  • Context - email distribution list retrieval is required:
    For Initialize AELWRKTB Database Access:
    When system begins email distribution setup process, then database access structure aelwrktb is initialized to empty state.
  • Context - train origin location is available in request:
    For Build Database Key with Train Origin Location:
    When system needs to query email distribution database, then database record key is populated with train origin location in first 4 positions.
  • Context - database query key is being constructed:
    For Set Record Type to 'CUSEMAIL':
    When system prepares to retrieve email distribution list, then record type is set to 'cusemail' to identify email records.
  • Context - database key is constructed with train origin and record type:
    For Call AECWRKTB to Retrieve Email List:
    When system executes aecwrktb database call, then database query is performed and return code and sql code are captured.
  • Context - database query has been executed:
    For Database Access Successful?:
    When system checks database return code, then if return code equals success constant, processing continues with retrieved data, otherwise error handling is initiated.
  • Context - database query returned success status:
    For Process Retrieved Email Distribution List:
    When email distribution list is available for processing, then system sets default merlin id as sender and prepares to extract individual email addresses.
  • Context - email distribution list record is available and counter is within range 1 to 10:
    For Extract User Email ID from Database Record:
    When system processes each email address position, then if email address at current position is not spaces, it is added to distribution list.
  • Context - database query completed with return code:
    For Handle No Entry Found Condition:
    When return code indicates no entry found condition, then system continues processing without error and uses default email configuration.
    For Handle Database Error Occurred:
    When return code indicates error other than no entry found, then system initiates database error handling procedure.
  • Context - database lookup failed or returned no email addresses:
    For Set Default Email Recipients:
    When system needs to establish email distribution, then default merlin id is set as both sender and recipient for email notifications.
👨‍💻 Technical ACs (Gherkin)
Context: Email distribution list retrieval is required
GIVEN
Email distribution list retrieval is required
Applied to: Initialize AELWRKTB Database Access
WHEN
System begins email distribution setup process
THEN
Database access structure AELWRKTB is initialized to empty state
Context: Train origin location is available in request
GIVEN
Train origin location is available in request
Applied to: Build Database Key with Train Origin Location
WHEN
System needs to query email distribution database
THEN
Database record key is populated with train origin location in first 4 positions
Context: Database query key is being constructed
GIVEN
Database query key is being constructed
Applied to: Set Record Type to 'CUSEMAIL'
WHEN
System prepares to retrieve email distribution list
THEN
Record type is set to 'CUSEMAIL' to identify email records
Context: Database key is constructed with train origin and record type
GIVEN
Database key is constructed with train origin and record type
Applied to: Call AECWRKTB to Retrieve Email List
WHEN
System executes AECWRKTB database call
THEN
Database query is performed and return code and SQL code are captured
Context: Database query has been executed
GIVEN
Database query has been executed
Applied to: Database Access Successful?
WHEN
System checks database return code
THEN
If return code equals success constant, processing continues with retrieved data, otherwise error handling is initiated
Context: Database query returned success status
GIVEN
Database query returned success status
Applied to: Process Retrieved Email Distribution List
WHEN
Email distribution list is available for processing
THEN
System sets default MERLIN ID as sender and prepares to extract individual email addresses
Context: Email distribution list record is available and counter is within range 1 to 10
GIVEN
Email distribution list record is available and counter is within range 1 to 10
Applied to: Extract User Email ID from Database Record
WHEN
System processes each email address position
THEN
If email address at current position is not spaces, it is added to distribution list
Context: Database query completed with return code
GIVEN
Database query completed with return code
Applied to: Handle No Entry Found Condition
WHEN
Return code indicates no entry found condition
THEN
System continues processing without error and uses default email configuration
Applied to: Handle Database Error Occurred
WHEN
Return code indicates error other than no entry found
THEN
System initiates database error handling procedure
Context: Database lookup failed or returned no email addresses
GIVEN
Database lookup failed or returned no email addresses
Applied to: Set Default Email Recipients
WHEN
System needs to establish email distribution
THEN
Default MERLIN ID is set as both sender and recipient for email notifications
R-GCX003-cbl-00966 (+3) File: GCX003.cbl Report Subject Line Generation Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Subject Line Generation':
  • Context - a train processing request has completed with errors and rpt-error-append is true:
    For Generate 'NOT SENT' Subject Line:
    When the system generates an email subject line for aei notification, then the subject line should be formatted as 'us train [train_id] not sent at [origin_station]'.
  • Context - a train processing request has completed successfully and rpt-error-append is false:
    For Generate 'SENT' Subject Line:
    When the system generates an email subject line for aei notification, then the subject line should be formatted as 'us train [train_id] sent at [origin_station]'.
  • Context - an email subject template has been determined based on train send status:
    For Build Subject String with Train ID:
    When the system builds the complete subject line, then the train id from rpt-hdr-train-id should be inserted into the subject template.
  • Context - an email subject template with train id has been partially constructed:
    For Build Subject String with Origin Station:
    When the system completes the subject line building process, then the origin station from rpt-hdr-origin should be inserted into the subject template to complete the subject line.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request has completed with errors and RPT-ERROR-APPEND is true
GIVEN
A train processing request has completed with errors and RPT-ERROR-APPEND is true
Applied to: Generate 'NOT SENT' Subject Line
WHEN
The system generates an email subject line for AEI notification
THEN
The subject line should be formatted as 'US TRAIN [train_id] NOT SENT AT [origin_station]'
Context: A train processing request has completed successfully and RPT-ERROR-APPEND is false
GIVEN
A train processing request has completed successfully and RPT-ERROR-APPEND is false
Applied to: Generate 'SENT' Subject Line
WHEN
The system generates an email subject line for AEI notification
THEN
The subject line should be formatted as 'US TRAIN [train_id] SENT AT [origin_station]'
Context: An email subject template has been determined based on train send status
GIVEN
An email subject template has been determined based on train send status
Applied to: Build Subject String with Train ID
WHEN
The system builds the complete subject line
THEN
The train ID from RPT-HDR-TRAIN-ID should be inserted into the subject template
Context: An email subject template with train ID has been partially constructed
GIVEN
An email subject template with train ID has been partially constructed
Applied to: Build Subject String with Origin Station
WHEN
The system completes the subject line building process
THEN
The origin station from RPT-HDR-ORIGIN should be inserted into the subject template to complete the subject line
R-GCX003-cbl-00970 (+5) File: GCX003.cbl Database Error Notification Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database Error Notification':
  • Context - a database operation has been attempted:
    For Check Return Code:
    When the system checks the return code from the database operation, then the system should identify if the operation failed and determine if it is a db2 sqlcode error type.
  • Context - a database error has been detected:
    For Set Support Team as Recipient:
    When the system prepares error notification, then the email recipient should be set to the support team identifier and the sender should be set to the default merlin id.
  • Context - a db2 sqlcode error has occurred:
    For Format Error Subject Line with SQLCODE:
    When the system formats the error notification, then the subject line should contain 'gcx003 db2 sqlcode:' followed by the specific sqlcode value and the message text should contain the same error information.
  • Context - an error notification email is being prepared:
    For Set Email Destination to Support Inbox:
    When the system configures the email delivery settings, then the email destination should be set to the support inbox and email parameters should be initialized for sending.
  • Context - an error notification email has been sent to the support team:
    For Email Send Successful?:
    When the system checks the email delivery status, then if the email delivery fails, the system should trigger an abend condition, otherwise it should purge the email transaction and continue processing.
  • Context - a database error notification email has failed to send:
    For System Abend - Email Send Failed:
    When the email delivery validation detects the failure, then the system should set an error message indicating 'send to file of om01247 failed' and perform an abend to halt processing.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation has been attempted
GIVEN
A database operation has been attempted
Applied to: Check Return Code
WHEN
The system checks the return code from the database operation
THEN
The system should identify if the operation failed and determine if it is a DB2 SQLCODE error type
Context: A database error has been detected
GIVEN
A database error has been detected
Applied to: Set Support Team as Recipient
WHEN
The system prepares error notification
THEN
The email recipient should be set to the support team identifier and the sender should be set to the default Merlin ID
Context: A DB2 SQLCODE error has occurred
GIVEN
A DB2 SQLCODE error has occurred
Applied to: Format Error Subject Line with SQLCODE
WHEN
The system formats the error notification
THEN
The subject line should contain 'GCX003 DB2 SQLCODE:' followed by the specific SQLCODE value and the message text should contain the same error information
Context: An error notification email is being prepared
GIVEN
An error notification email is being prepared
Applied to: Set Email Destination to Support Inbox
WHEN
The system configures the email delivery settings
THEN
The email destination should be set to the support inbox and email parameters should be initialized for sending
Context: An error notification email has been sent to the support team
GIVEN
An error notification email has been sent to the support team
Applied to: Email Send Successful?
WHEN
The system checks the email delivery status
THEN
If the email delivery fails, the system should trigger an abend condition, otherwise it should purge the email transaction and continue processing
Context: A database error notification email has failed to send
GIVEN
A database error notification email has failed to send
Applied to: System Abend - Email Send Failed
WHEN
The email delivery validation detects the failure
THEN
The system should set an error message indicating 'SEND TO FILE OF OM01247 FAILED' and perform an abend to halt processing
R-GCX003-cbl-00976 (+8) File: GCX003.cbl Train List Database Operations Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train List Database Operations':
  • Context - a train list database operation is requested with operation type get and train identifier is provided:
    For Get Train List Record:
    When the system performs database retrieval operation using train identifier as key, then the system should retrieve the existing train record if found or return not found status.
  • Context - a train record exists in database and is marked as deleted with confirmation status:
    For Delete Train List Record:
    When the system performs delete operation on the train record, then the system should remove the train record from the database permanently.
  • Context - train request has been validated successfully with no errors and train list data is prepared with equipment details:
    For Insert Train List Record:
    When the system performs insert operation for new train record, then the system should create new train record with all equipment details in the database.
  • Context - train request contains scac code, train id, train origin, consist number and current system date:
    For Build Train List Key:
    When the system builds train list key for database operations, then the system should create unique train identifier by concatenating scac code, train id, origin, consist number and julian creation date.
  • Context - a specific database operation type is determined (get, delete, or insert):
    For Set Database Parameters:
    When the system sets database operation parameters, then the system should configure operation type flags, pcb reference, and data structure parameters appropriate for the requested operation.
  • Context - database operation parameters are properly configured and train list data structure is prepared:
    For Call Database Interface GCCUTRIO:
    When the system calls database interface gccutrio, then the system should execute the database operation and return operation status.
  • Context - database operation has been executed through gccutrio interface:
    For Operation Successful?:
    When the system checks operation success status, then the system should validate return code is successful and no invalid parameters, equipment limits, or other error conditions exist.
  • Context - database operation failed with invalid parameters, equipment limit exceeded, or other error conditions:
    For Handle Database Error:
    When the system handles database error, then the system should create detailed error message including operation type and train identifier, then terminate processing with abend.
  • Context - database operation has completed either successfully or with handled errors:
    For Log Operation Result:
    When the system logs operation result, then the system should record operation outcome and continue with next processing step.
👨‍💻 Technical ACs (Gherkin)
Context: A train list database operation is requested with operation type GET and train identifier is provided
GIVEN
A train list database operation is requested with operation type GET and train identifier is provided
Applied to: Get Train List Record
WHEN
The system performs database retrieval operation using train identifier as key
THEN
The system should retrieve the existing train record if found or return not found status
Context: A train record exists in database and is marked as deleted with confirmation status
GIVEN
A train record exists in database and is marked as deleted with confirmation status
Applied to: Delete Train List Record
WHEN
The system performs delete operation on the train record
THEN
The system should remove the train record from the database permanently
Context: Train request has been validated successfully with no errors and train list data is prepared with equipment details
GIVEN
Train request has been validated successfully with no errors and train list data is prepared with equipment details
Applied to: Insert Train List Record
WHEN
The system performs insert operation for new train record
THEN
The system should create new train record with all equipment details in the database
Context: Train request contains SCAC code, train ID, train origin, consist number and current system date
GIVEN
Train request contains SCAC code, train ID, train origin, consist number and current system date
Applied to: Build Train List Key
WHEN
The system builds train list key for database operations
THEN
The system should create unique train identifier by concatenating SCAC code, train ID, origin, consist number and Julian creation date
Context: A specific database operation type is determined (GET, DELETE, or INSERT)
GIVEN
A specific database operation type is determined (GET, DELETE, or INSERT)
Applied to: Set Database Parameters
WHEN
The system sets database operation parameters
THEN
The system should configure operation type flags, PCB reference, and data structure parameters appropriate for the requested operation
Context: Database operation parameters are properly configured and train list data structure is prepared
GIVEN
Database operation parameters are properly configured and train list data structure is prepared
Applied to: Call Database Interface GCCUTRIO
WHEN
The system calls database interface GCCUTRIO
THEN
The system should execute the database operation and return operation status
Context: Database operation has been executed through GCCUTRIO interface
GIVEN
Database operation has been executed through GCCUTRIO interface
Applied to: Operation Successful?
WHEN
The system checks operation success status
THEN
The system should validate return code is successful and no invalid parameters, equipment limits, or other error conditions exist
Context: Database operation failed with invalid parameters, equipment limit exceeded, or other error conditions
GIVEN
Database operation failed with invalid parameters, equipment limit exceeded, or other error conditions
Applied to: Handle Database Error
WHEN
The system handles database error
THEN
The system should create detailed error message including operation type and train identifier, then terminate processing with abend
Context: Database operation has completed either successfully or with handled errors
GIVEN
Database operation has completed either successfully or with handled errors
Applied to: Log Operation Result
WHEN
The system logs operation result
THEN
The system should record operation outcome and continue with next processing step
R-GCX003-cbl-00985 (+16) File: GCX003.cbl Cargo Record Database Operations Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Record Database Operations':
  • Context - a cargo record database operation is requested:
    For Initialize Database Parameters:
    When the system begins the database operation process, then database parameters are initialized and accept status is set to allow database operations.
  • Context - database parameters are initialized:
    For Set Cargo Segment Type:
    When the system prepares for cargo record access, then the cargo segment type is set to target cargo records in the database.
  • Context - the cargo segment type is set:
    For Set Database Function Code:
    When the system determines the type of database operation needed, then the appropriate function code is set for get first (gu), get next (gn), or replace (repl) operations.
  • Context - the operation type is determined to be get first record:
    For Set GU Function - Get First Record:
    When the system needs to retrieve the initial cargo record for an equipment, then the database function is set to gu (get unique) to fetch the first matching cargo record.
  • Context - the operation type is determined to be get next record:
    For Set GN Function - Get Next Record:
    When the system needs to retrieve additional cargo records for the same equipment, then the database function is set to gn (get next) to fetch the next sequential cargo record.
  • Context - the operation type is determined to be replace record:
    For Set REPL Function - Replace Record:
    When the system needs to update cargo record information, then the database function is set to repl (replace) to modify the existing cargo record.
  • Context - the database function code is set:
    For Set Index Type to Car-Waybill:
    When the system prepares to access cargo records, then the index type is set to car-waybill to enable efficient cargo record retrieval by equipment and waybill combination.
  • Context - the index type is set to car-waybill:
    For Set Operator to Greater Than:
    When the system needs to perform sequential cargo record searches, then the search operator is set to greater than (>) to enable sequential record retrieval.
  • Context - all database operation parameters are configured:
    For Call Database I/O Module GCCUSIO:
    When the system is ready to perform the cargo record database operation, then the gccusio database i/o module is called to execute the configured operation.
  • Context - the database i/o module has been called:
    For Database Call Successful?:
    When the system receives the operation result, then the system validates that no database errors occurred and the operation completed successfully.
  • Context - a cargo record is successfully retrieved from the database:
    For Check Equipment ID Match:
    When the system needs to verify the cargo belongs to the correct equipment, then the equipment id from the cargo record is compared with the expected equipment id to ensure they match.
  • Context - the equipment id match is verified:
    For Check Waybill Root Date Match:
    When the system needs to verify the cargo belongs to the correct waybill, then the waybill root date from the cargo record is compared with the expected waybill root date to ensure they match.
  • Context - both equipment id and waybill root date comparisons are completed:
    For Equipment and Waybill Match?:
    When the system needs to determine if the cargo record is valid, then if both equipment id and waybill root date match, the cargo record is considered valid for processing.
  • Context - both equipment id and waybill root date match the retrieved cargo record:
    For Set Cargo Found Status:
    When the system confirms the cargo record is valid, then the cargo status is set to found to indicate successful cargo record retrieval.
  • Context - either equipment id or waybill root date does not match the retrieved cargo record:
    For Set Cargo Not Found Status:
    When the system determines the cargo record is not valid for the current equipment and waybill, then the cargo status is set to not found to indicate no valid cargo record exists.
  • Context - the database operation fails or returns an error:
    For Handle Database Error:
    When the system detects a database operation failure, then error handling procedures are executed and appropriate error status is set for the cargo operation.
  • Context - the cargo record processing is completed (found, not found, or error):
    For Update Cargo Status Code:
    When the system needs to record the final status of the cargo operation, then the cargo status code is updated to reflect the outcome of the database operation.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record database operation is requested
GIVEN
A cargo record database operation is requested
Applied to: Initialize Database Parameters
WHEN
The system begins the database operation process
THEN
Database parameters are initialized and accept status is set to allow database operations
Context: Database parameters are initialized
GIVEN
Database parameters are initialized
Applied to: Set Cargo Segment Type
WHEN
The system prepares for cargo record access
THEN
The cargo segment type is set to target cargo records in the database
Context: The cargo segment type is set
GIVEN
The cargo segment type is set
Applied to: Set Database Function Code
WHEN
The system determines the type of database operation needed
THEN
The appropriate function code is set for get first (GU), get next (GN), or replace (REPL) operations
Context: The operation type is determined to be get first record
GIVEN
The operation type is determined to be get first record
Applied to: Set GU Function - Get First Record
WHEN
The system needs to retrieve the initial cargo record for an equipment
THEN
The database function is set to GU (Get Unique) to fetch the first matching cargo record
Context: The operation type is determined to be get next record
GIVEN
The operation type is determined to be get next record
Applied to: Set GN Function - Get Next Record
WHEN
The system needs to retrieve additional cargo records for the same equipment
THEN
The database function is set to GN (Get Next) to fetch the next sequential cargo record
Context: The operation type is determined to be replace record
GIVEN
The operation type is determined to be replace record
Applied to: Set REPL Function - Replace Record
WHEN
The system needs to update cargo record information
THEN
The database function is set to REPL (Replace) to modify the existing cargo record
Context: The database function code is set
GIVEN
The database function code is set
Applied to: Set Index Type to Car-Waybill
WHEN
The system prepares to access cargo records
THEN
The index type is set to car-waybill to enable efficient cargo record retrieval by equipment and waybill combination
Context: The index type is set to car-waybill
GIVEN
The index type is set to car-waybill
Applied to: Set Operator to Greater Than
WHEN
The system needs to perform sequential cargo record searches
THEN
The search operator is set to greater than (>) to enable sequential record retrieval
Context: All database operation parameters are configured
GIVEN
All database operation parameters are configured
Applied to: Call Database I/O Module GCCUSIO
WHEN
The system is ready to perform the cargo record database operation
THEN
The GCCUSIO database I/O module is called to execute the configured operation
Context: The database I/O module has been called
GIVEN
The database I/O module has been called
Applied to: Database Call Successful?
WHEN
The system receives the operation result
THEN
The system validates that no database errors occurred and the operation completed successfully
Context: A cargo record is successfully retrieved from the database
GIVEN
A cargo record is successfully retrieved from the database
Applied to: Check Equipment ID Match
WHEN
The system needs to verify the cargo belongs to the correct equipment
THEN
The equipment ID from the cargo record is compared with the expected equipment ID to ensure they match
Context: The equipment ID match is verified
GIVEN
The equipment ID match is verified
Applied to: Check Waybill Root Date Match
WHEN
The system needs to verify the cargo belongs to the correct waybill
THEN
The waybill root date from the cargo record is compared with the expected waybill root date to ensure they match
Context: Both equipment ID and waybill root date comparisons are completed
GIVEN
Both equipment ID and waybill root date comparisons are completed
Applied to: Equipment and Waybill Match?
WHEN
The system needs to determine if the cargo record is valid
THEN
If both equipment ID and waybill root date match, the cargo record is considered valid for processing
Context: Both equipment ID and waybill root date match the retrieved cargo record
GIVEN
Both equipment ID and waybill root date match the retrieved cargo record
Applied to: Set Cargo Found Status
WHEN
The system confirms the cargo record is valid
THEN
The cargo status is set to found to indicate successful cargo record retrieval
Context: Either equipment ID or waybill root date does not match the retrieved cargo record
GIVEN
Either equipment ID or waybill root date does not match the retrieved cargo record
Applied to: Set Cargo Not Found Status
WHEN
The system determines the cargo record is not valid for the current equipment and waybill
THEN
The cargo status is set to not found to indicate no valid cargo record exists
Context: The database operation fails or returns an error
GIVEN
The database operation fails or returns an error
Applied to: Handle Database Error
WHEN
The system detects a database operation failure
THEN
Error handling procedures are executed and appropriate error status is set for the cargo operation
Context: The cargo record processing is completed (found, not found, or error)
GIVEN
The cargo record processing is completed (found, not found, or error)
Applied to: Update Cargo Status Code
WHEN
The system needs to record the final status of the cargo operation
THEN
The cargo status code is updated to reflect the outcome of the database operation
R-GCX003-cbl-01002 (+10) File: GCX003.cbl Container Waybill Database Retrieval Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Waybill Database Retrieval':
  • Context - a container waybill retrieval process is initiated:
    For Container Found in Inquiry System?:
    When the system checks if container is found in inquiry system, then if container inquiry is found, retrieve from inquiry container database, otherwise check primary system.
  • Context - container is not found in inquiry system:
    For Container Found in Primary System?:
    When the system checks if container exists in primary system, then if container is found in primary system, retrieve from primary container database, otherwise search freight waybill inquiry system.
  • Context - container is not found in primary container system:
    For Search Freight Waybill Inquiry System:
    When the system searches freight waybill inquiry system using container inquiry root information, then retrieve waybill root information from fwiqroot database.
  • Context - a search has been performed in freight waybill inquiry system:
    For Waybill Found in Inquiry?:
    When the system checks the search results, then if waybill is found, proceed to get waybill root information, otherwise set container not found status.
  • Context - waybill root information has been retrieved successfully:
    For Extract Container Cross-Reference Data:
    When the system processes fwiqbotl segments to extract container cross-reference data, then identify and extract container ids, waybill railroad, station, and number information from t/c xref entries.
  • Context - container cross-reference data has been extracted from fwiqbotl:
    For Container Cross-Reference Found?:
    When the system validates the extracted cross-reference information, then if valid container cross-reference is found, get multiple container ids, otherwise proceed to map inquiry data to standard format.
  • Context - valid container cross-reference data is found:
    For Get Multiple Container IDs from Cross-Reference:
    When the system processes the cross-reference to extract multiple container ids, then store up to 30 container ids with their associated waybill information for sequential processing.
  • Context - waybill information has been retrieved from inquiry system:
    For Map Inquiry Data to Standard Format:
    When the system maps inquiry data to standard shiproot format, then convert railroad number, waybill number, car id, load/empty indicator, container indicator, and waybill date to standard format.
  • Context - waybill data has been mapped to standard format:
    For Get Routing Information from Inquiry:
    When the system retrieves routing information from fwiqinfo with segment type b1, then extract and parse routing fields including scac codes and junction information, then format into routing groups.
  • Context - container and waybill information has been successfully retrieved and processed:
    For Set Container Found Status:
    When the system completes the retrieval process, then set container found status to true and container inquiry found status based on the source system used.
  • Context - container information cannot be found in any available system:
    For Set Container Not Found Status:
    When all retrieval attempts have been exhausted, then set container not found status and container inquiry not found status to indicate unsuccessful retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: A container waybill retrieval process is initiated
GIVEN
A container waybill retrieval process is initiated
Applied to: Container Found in Inquiry System?
WHEN
The system checks if container is found in inquiry system
THEN
If container inquiry is found, retrieve from inquiry container database, otherwise check primary system
Context: Container is not found in inquiry system
GIVEN
Container is not found in inquiry system
Applied to: Container Found in Primary System?
WHEN
The system checks if container exists in primary system
THEN
If container is found in primary system, retrieve from primary container database, otherwise search freight waybill inquiry system
Context: Container is not found in primary container system
GIVEN
Container is not found in primary container system
Applied to: Search Freight Waybill Inquiry System
WHEN
The system searches freight waybill inquiry system using container inquiry root information
THEN
Retrieve waybill root information from FWIQROOT database
Context: A search has been performed in freight waybill inquiry system
GIVEN
A search has been performed in freight waybill inquiry system
Applied to: Waybill Found in Inquiry?
WHEN
The system checks the search results
THEN
If waybill is found, proceed to get waybill root information, otherwise set container not found status
Context: Waybill root information has been retrieved successfully
GIVEN
Waybill root information has been retrieved successfully
Applied to: Extract Container Cross-Reference Data
WHEN
The system processes FWIQBOTL segments to extract container cross-reference data
THEN
Identify and extract container IDs, waybill railroad, station, and number information from T/C XREF entries
Context: Container cross-reference data has been extracted from FWIQBOTL
GIVEN
Container cross-reference data has been extracted from FWIQBOTL
Applied to: Container Cross-Reference Found?
WHEN
The system validates the extracted cross-reference information
THEN
If valid container cross-reference is found, get multiple container IDs, otherwise proceed to map inquiry data to standard format
Context: Valid container cross-reference data is found
GIVEN
Valid container cross-reference data is found
Applied to: Get Multiple Container IDs from Cross-Reference
WHEN
The system processes the cross-reference to extract multiple container IDs
THEN
Store up to 30 container IDs with their associated waybill information for sequential processing
Context: Waybill information has been retrieved from inquiry system
GIVEN
Waybill information has been retrieved from inquiry system
Applied to: Map Inquiry Data to Standard Format
WHEN
The system maps inquiry data to standard SHIPROOT format
THEN
Convert railroad number, waybill number, car ID, load/empty indicator, container indicator, and waybill date to standard format
Context: Waybill data has been mapped to standard format
GIVEN
Waybill data has been mapped to standard format
Applied to: Get Routing Information from Inquiry
WHEN
The system retrieves routing information from FWIQINFO with segment type B1
THEN
Extract and parse routing fields including SCAC codes and junction information, then format into routing groups
Context: Container and waybill information has been successfully retrieved and processed
GIVEN
Container and waybill information has been successfully retrieved and processed
Applied to: Set Container Found Status
WHEN
The system completes the retrieval process
THEN
Set container found status to true and container inquiry found status based on the source system used
Context: Container information cannot be found in any available system
GIVEN
Container information cannot be found in any available system
Applied to: Set Container Not Found Status
WHEN
All retrieval attempts have been exhausted
THEN
Set container not found status and container inquiry not found status to indicate unsuccessful retrieval
R-GCX003-cbl-01013 (+10) File: GCX003.cbl Car Waybill Database Retrieval Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car Waybill Database Retrieval':
  • Context - a car waybill retrieval request is initiated:
    For First Call or Different Car ID?:
    When the system checks if this is the first call to the waybill retrieval function or the current car id is different from the previously processed car id, then if either condition is true, proceed with full waybill retrieval process, otherwise use cached information and exit.
  • Context - a new car waybill retrieval is required:
    For Initialize Car Waybill Parameters:
    When the system initializes waybill retrieval parameters, then set car type to all except 98-99, status to all status types, exclude edi incomplete records, include temporary waybills, exclude corrector waybills, return lead waybill, and use latest waybill date.
  • Context - waybill retrieval parameters are initialized with car id:
    For Call Primary Waybill System FWCARGET:
    When the system calls the primary waybill system fwcarget, then retrieve waybill data from the primary database and return the lookup status.
  • Context - a waybill record is found in the primary system:
    For Has Haulage Right Carrier?:
    When the system checks if the haulage right carrier field contains data, then if haulage right carrier is blank or spaces, accept the waybill as found, otherwise perform additional edi completion checks.
  • Context - a waybill has a haulage right carrier assigned:
    For EDI Complete Release Available?:
    When the system checks the edi completion release status, then if edi completion release equals 'y', accept the waybill as found, otherwise continue with duplicate key checking.
  • Context - a waybill key is returned from the primary system and edi release is not complete:
    For Same Waybill Key as Previous?:
    When the system compares the current waybill key feedback with the previously stored waybill key feedback, then if the keys are identical, mark waybill as not found and exit, otherwise update the stored key and continue with previous status search.
  • Context - current waybill does not have edi completion and is not a duplicate key:
    For Set Previous Status Date Flag:
    When the system sets the search criteria to previous status waybill date, then update the waybill key feedback tracker and repeat the primary waybill system search with previous status criteria.
  • Context - primary waybill system did not find a valid waybill record:
    For Call Inquiry System FWCIIO:
    When the system calls the container inquiry system fwciio using the car id, then retrieve container and waybill reference information from the inquiry database.
  • Context - container inquiry system returned valid reference data including railroad number, station number, and waybill number:
    For Call Waybill Inquiry FWIQIO:
    When the system calls waybill inquiry system fwiqio with the reference data, then retrieve detailed waybill information from the inquiry database.
  • Context - waybill inquiry system returned valid waybill data:
    For Extract Routing Information:
    When the system processes the routing information from the inquiry waybill, then extract routing details and populate routing information fields in the waybill structure.
  • Context - valid waybill data is retrieved from inquiry system:
    For Map Inquiry Data to Waybill Format:
    When the system maps inquiry fields to standard waybill structure, then map railroad number, waybill number, car id, convert billing code 'ze' to empty status 'e' otherwise to loaded status 'l', map tofc/cofc indicator, waybill date, and station number to corresponding waybill fields.
👨‍💻 Technical ACs (Gherkin)
Context: A car waybill retrieval request is initiated
GIVEN
A car waybill retrieval request is initiated
Applied to: First Call or Different Car ID?
WHEN
The system checks if this is the first call to the waybill retrieval function OR the current car ID is different from the previously processed car ID
THEN
If either condition is true, proceed with full waybill retrieval process, otherwise use cached information and exit
Context: A new car waybill retrieval is required
GIVEN
A new car waybill retrieval is required
Applied to: Initialize Car Waybill Parameters
WHEN
The system initializes waybill retrieval parameters
THEN
Set car type to all except 98-99, status to all status types, exclude EDI incomplete records, include temporary waybills, exclude corrector waybills, return lead waybill, and use latest waybill date
Context: Waybill retrieval parameters are initialized with car ID
GIVEN
Waybill retrieval parameters are initialized with car ID
Applied to: Call Primary Waybill System FWCARGET
WHEN
The system calls the primary waybill system FWCARGET
THEN
Retrieve waybill data from the primary database and return the lookup status
Context: A waybill record is found in the primary system
GIVEN
A waybill record is found in the primary system
Applied to: Has Haulage Right Carrier?
WHEN
The system checks if the haulage right carrier field contains data
THEN
If haulage right carrier is blank or spaces, accept the waybill as found, otherwise perform additional EDI completion checks
Context: A waybill has a haulage right carrier assigned
GIVEN
A waybill has a haulage right carrier assigned
Applied to: EDI Complete Release Available?
WHEN
The system checks the EDI completion release status
THEN
If EDI completion release equals 'Y', accept the waybill as found, otherwise continue with duplicate key checking
Context: A waybill key is returned from the primary system and EDI release is not complete
GIVEN
A waybill key is returned from the primary system and EDI release is not complete
Applied to: Same Waybill Key as Previous?
WHEN
The system compares the current waybill key feedback with the previously stored waybill key feedback
THEN
If the keys are identical, mark waybill as not found and exit, otherwise update the stored key and continue with previous status search
Context: Current waybill does not have EDI completion and is not a duplicate key
GIVEN
Current waybill does not have EDI completion and is not a duplicate key
Applied to: Set Previous Status Date Flag
WHEN
The system sets the search criteria to previous status waybill date
THEN
Update the waybill key feedback tracker and repeat the primary waybill system search with previous status criteria
Context: Primary waybill system did not find a valid waybill record
GIVEN
Primary waybill system did not find a valid waybill record
Applied to: Call Inquiry System FWCIIO
WHEN
The system calls the container inquiry system FWCIIO using the car ID
THEN
Retrieve container and waybill reference information from the inquiry database
Context: Container inquiry system returned valid reference data including railroad number, station number, and waybill number
GIVEN
Container inquiry system returned valid reference data including railroad number, station number, and waybill number
Applied to: Call Waybill Inquiry FWIQIO
WHEN
The system calls waybill inquiry system FWIQIO with the reference data
THEN
Retrieve detailed waybill information from the inquiry database
Context: Waybill inquiry system returned valid waybill data
GIVEN
Waybill inquiry system returned valid waybill data
Applied to: Extract Routing Information
WHEN
The system processes the routing information from the inquiry waybill
THEN
Extract routing details and populate routing information fields in the waybill structure
Context: Valid waybill data is retrieved from inquiry system
GIVEN
Valid waybill data is retrieved from inquiry system
Applied to: Map Inquiry Data to Waybill Format
WHEN
The system maps inquiry fields to standard waybill structure
THEN
Map railroad number, waybill number, car ID, convert billing code 'ZE' to empty status 'E' otherwise to loaded status 'L', map TOFC/COFC indicator, waybill date, and station number to corresponding waybill fields
R-GCX003-cbl-01024 (+12) File: GCX003.cbl Equipment Routing Information Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Routing Information Processing':
  • Context - a waybill inquiry record exists for equipment:
    For Access FWIQINFO Segment with B1 Key:
    When system accesses fwiqinfo segment with b1 key, then routing information fields are retrieved from the waybill inquiry database.
  • Context - routing information has been retrieved from waybill inquiry:
    For Routing Info Fields Available?:
    When system checks if routing info fields are spaces or low-values, then processing continues only if valid routing data is present, otherwise routing processing is skipped.
  • Context - valid routing information fields are available:
    For Initialize Field Processing Variables:
    When system begins routing field processing, then field processing variables are set to initial values with byte position 1, field number 1, and routing group cleared.
  • Context - system is processing routing information bytes:
    For Calculate Field Length:
    When system encounters non-space characters in routing fields, then field length counter is incremented until space character is found or maximum field length is reached.
  • Context - field length has been calculated for a routing field:
    For Field Length Valid?:
    When system checks if field length is less than 1, then field processing terminates if length is invalid, otherwise field extraction continues.
  • Context - field number is 1 and field length is valid:
    For Extract SCAC1 Code:
    When system processes the first routing field, then first carrier scac code is extracted and stored, and field number is incremented to 2.
  • Context - field number is 2 and field length is valid:
    For Extract Junction1/R260 Code:
    When system processes the second routing field, then first junction/r260 code is extracted and stored, and field number is incremented to 3.
  • Context - field number is 3 and field length is valid:
    For Extract SCAC2 Code:
    When system processes the third routing field, then second carrier scac code is extracted and stored, and field number is incremented to 4.
  • Context - field number is 4 and field length is valid:
    For Extract Junction2/R260 Code:
    When system processes the fourth routing field, then second junction/r260 code is extracted and stored, and field number is incremented to 5.
  • Context - field number is 5 and field length is valid:
    For Extract SCAC3 Code:
    When system processes the fifth routing field, then third carrier scac code is extracted and stored, and field number is incremented to 6.
  • Context - field number is 6 and field length is valid:
    For Extract Junction3/R260 Code:
    When system processes the sixth routing field, then third junction/r260 code is extracted and stored, and field number is incremented to 7.
  • Context - field number is 7 and field length is valid:
    For Extract SCAC4 Code:
    When system processes the seventh routing field, then fourth carrier scac code is extracted and stored, and field processing terminates.
  • Context - routing information fields have been successfully extracted and processed:
    For Move Routing Group to Shiproot:
    When system completes routing field processing, then complete routing information group is moved to the equipment shiproot record for further processing.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill inquiry record exists for equipment
GIVEN
A waybill inquiry record exists for equipment
Applied to: Access FWIQINFO Segment with B1 Key
WHEN
System accesses FWIQINFO segment with B1 key
THEN
Routing information fields are retrieved from the waybill inquiry database
Context: Routing information has been retrieved from waybill inquiry
GIVEN
Routing information has been retrieved from waybill inquiry
Applied to: Routing Info Fields Available?
WHEN
System checks if routing info fields are spaces or low-values
THEN
Processing continues only if valid routing data is present, otherwise routing processing is skipped
Context: Valid routing information fields are available
GIVEN
Valid routing information fields are available
Applied to: Initialize Field Processing Variables
WHEN
System begins routing field processing
THEN
Field processing variables are set to initial values with byte position 1, field number 1, and routing group cleared
Context: System is processing routing information bytes
GIVEN
System is processing routing information bytes
Applied to: Calculate Field Length
WHEN
System encounters non-space characters in routing fields
THEN
Field length counter is incremented until space character is found or maximum field length is reached
Context: Field length has been calculated for a routing field
GIVEN
Field length has been calculated for a routing field
Applied to: Field Length Valid?
WHEN
System checks if field length is less than 1
THEN
Field processing terminates if length is invalid, otherwise field extraction continues
Context: Field number is 1 and field length is valid
GIVEN
Field number is 1 and field length is valid
Applied to: Extract SCAC1 Code
WHEN
System processes the first routing field
THEN
First carrier SCAC code is extracted and stored, and field number is incremented to 2
Context: Field number is 2 and field length is valid
GIVEN
Field number is 2 and field length is valid
Applied to: Extract Junction1/R260 Code
WHEN
System processes the second routing field
THEN
First junction/R260 code is extracted and stored, and field number is incremented to 3
Context: Field number is 3 and field length is valid
GIVEN
Field number is 3 and field length is valid
Applied to: Extract SCAC2 Code
WHEN
System processes the third routing field
THEN
Second carrier SCAC code is extracted and stored, and field number is incremented to 4
Context: Field number is 4 and field length is valid
GIVEN
Field number is 4 and field length is valid
Applied to: Extract Junction2/R260 Code
WHEN
System processes the fourth routing field
THEN
Second junction/R260 code is extracted and stored, and field number is incremented to 5
Context: Field number is 5 and field length is valid
GIVEN
Field number is 5 and field length is valid
Applied to: Extract SCAC3 Code
WHEN
System processes the fifth routing field
THEN
Third carrier SCAC code is extracted and stored, and field number is incremented to 6
Context: Field number is 6 and field length is valid
GIVEN
Field number is 6 and field length is valid
Applied to: Extract Junction3/R260 Code
WHEN
System processes the sixth routing field
THEN
Third junction/R260 code is extracted and stored, and field number is incremented to 7
Context: Field number is 7 and field length is valid
GIVEN
Field number is 7 and field length is valid
Applied to: Extract SCAC4 Code
WHEN
System processes the seventh routing field
THEN
Fourth carrier SCAC code is extracted and stored, and field processing terminates
Context: Routing information fields have been successfully extracted and processed
GIVEN
Routing information fields have been successfully extracted and processed
Applied to: Move Routing Group to Shiproot
WHEN
System completes routing field processing
THEN
Complete routing information group is moved to the equipment shiproot record for further processing
R-GCX003-cbl-01037 (+14) File: GCX003.cbl Container on Flat Car Database Retrieval Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container on Flat Car Database Retrieval':
  • Context - a container retrieval process is initiated:
    For Container Already Found?:
    When the system checks the container found status, then if container is already found, skip to next container processing, otherwise proceed with container database retrieval.
  • Context - container is not already found and waybill root key is available:
    For Access FWSWRWR Database with Waybill Root Key:
    When system performs database lookup in fwswrwr using the waybill root key, then container database record is retrieved if it exists.
  • Context - fwswrwr database lookup has been performed:
    For Container Found in FWSWRWR?:
    When system evaluates the database response status, then if container found, proceed to retrieve equipment details, otherwise access fwiq inquiry database.
  • Context - container record exists in fwswrwr database:
    For Retrieve Next Container Equipment Record:
    When system accesses fwswreq database for equipment details, then container equipment record is retrieved with detailed information.
  • Context - fwswreq database lookup has been performed:
    For Container Equipment Record Found?:
    When system evaluates the equipment record retrieval status, then if equipment record found, set container found status, otherwise generate container not found error.
  • Context - container not found in fwswrwr database:
    For Access FWIQ Inquiry Database:
    When system performs lookup in fwiq inquiry database using waybill information, then inquiry database records are accessed for container search.
  • Context - fwiq inquiry database lookup has been performed:
    For Container Found in FWIQ?:
    When system evaluates the inquiry database response, then if container found, proceed to scan bottom line records, otherwise generate container not found error.
  • Context - container exists in fwiq inquiry database:
    For Scan FWIQ Bottom Line Records:
    When system scans fwiqbotl bottom line records, then each bottom line record is examined for container cross-reference data.
  • Context - bottom line records are being scanned:
    For T/C XREF Record Found?:
    When system examines each record for 't/c xref' identifier in positions 1-8, then if t/c xref record found, extract container information, otherwise continue scanning records.
  • Context - t/c xref record is identified in bottom line data:
    For Extract Container ID and Waybill Information:
    When system processes the record data, then container id is extracted from positions 28-39, waybill railroad from positions 10-12, station from positions 14-19, and number from positions 21-26.
  • Context - container information has been successfully extracted or retrieved:
    For Set Container Found Status:
    When system updates container processing status, then container found flag is set to true and container id is stored for processing.
  • Context - container lookup has failed in all available databases:
    For Generate Container Not Found Error:
    When system determines container cannot be found, then error message 11 is generated indicating container not found.
  • Context - current container processing is complete (found or error generated):
    For Move to Next Container in Sequence:
    When system advances container processing sequence, then container sequence index is incremented to process next container.
  • Context - container sequence has been advanced:
    For More Containers to Process?:
    When system checks for remaining containers in the sequence, then if more containers exist and sequence index is within limits (≤30), continue processing, otherwise set no more containers flag.
  • Context - no more containers remain in the processing sequence:
    For Set No More Containers Flag:
    When system completes container sequence processing, then no more containers flag is set to terminate container retrieval process.
👨‍💻 Technical ACs (Gherkin)
Context: A container retrieval process is initiated
GIVEN
A container retrieval process is initiated
Applied to: Container Already Found?
WHEN
The system checks the container found status
THEN
If container is already found, skip to next container processing, otherwise proceed with container database retrieval
Context: Container is not already found and waybill root key is available
GIVEN
Container is not already found and waybill root key is available
Applied to: Access FWSWRWR Database with Waybill Root Key
WHEN
System performs database lookup in FWSWRWR using the waybill root key
THEN
Container database record is retrieved if it exists
Context: FWSWRWR database lookup has been performed
GIVEN
FWSWRWR database lookup has been performed
Applied to: Container Found in FWSWRWR?
WHEN
System evaluates the database response status
THEN
If container found, proceed to retrieve equipment details, otherwise access FWIQ inquiry database
Context: Container record exists in FWSWRWR database
GIVEN
Container record exists in FWSWRWR database
Applied to: Retrieve Next Container Equipment Record
WHEN
System accesses FWSWREQ database for equipment details
THEN
Container equipment record is retrieved with detailed information
Context: FWSWREQ database lookup has been performed
GIVEN
FWSWREQ database lookup has been performed
Applied to: Container Equipment Record Found?
WHEN
System evaluates the equipment record retrieval status
THEN
If equipment record found, set container found status, otherwise generate container not found error
Context: Container not found in FWSWRWR database
GIVEN
Container not found in FWSWRWR database
Applied to: Access FWIQ Inquiry Database
WHEN
System performs lookup in FWIQ inquiry database using waybill information
THEN
Inquiry database records are accessed for container search
Context: FWIQ inquiry database lookup has been performed
GIVEN
FWIQ inquiry database lookup has been performed
Applied to: Container Found in FWIQ?
WHEN
System evaluates the inquiry database response
THEN
If container found, proceed to scan bottom line records, otherwise generate container not found error
Context: Container exists in FWIQ inquiry database
GIVEN
Container exists in FWIQ inquiry database
Applied to: Scan FWIQ Bottom Line Records
WHEN
System scans FWIQBOTL bottom line records
THEN
Each bottom line record is examined for container cross-reference data
Context: Bottom line records are being scanned
GIVEN
Bottom line records are being scanned
Applied to: T/C XREF Record Found?
WHEN
System examines each record for 'T/C XREF' identifier in positions 1-8
THEN
If T/C XREF record found, extract container information, otherwise continue scanning records
Context: T/C XREF record is identified in bottom line data
GIVEN
T/C XREF record is identified in bottom line data
Applied to: Extract Container ID and Waybill Information
WHEN
System processes the record data
THEN
Container ID is extracted from positions 28-39, waybill railroad from positions 10-12, station from positions 14-19, and number from positions 21-26
Context: Container information has been successfully extracted or retrieved
GIVEN
Container information has been successfully extracted or retrieved
Applied to: Set Container Found Status
WHEN
System updates container processing status
THEN
Container found flag is set to true and container ID is stored for processing
Context: Container lookup has failed in all available databases
GIVEN
Container lookup has failed in all available databases
Applied to: Generate Container Not Found Error
WHEN
System determines container cannot be found
THEN
Error message 11 is generated indicating container not found
Context: Current container processing is complete (found or error generated)
GIVEN
Current container processing is complete (found or error generated)
Applied to: Move to Next Container in Sequence
WHEN
System advances container processing sequence
THEN
Container sequence index is incremented to process next container
Context: Container sequence has been advanced
GIVEN
Container sequence has been advanced
Applied to: More Containers to Process?
WHEN
System checks for remaining containers in the sequence
THEN
If more containers exist and sequence index is within limits (≤30), continue processing, otherwise set no more containers flag
Context: No more containers remain in the processing sequence
GIVEN
No more containers remain in the processing sequence
Applied to: Set No More Containers Flag
WHEN
System completes container sequence processing
THEN
No more containers flag is set to terminate container retrieval process
R-GCX003-cbl-01052 (+15) File: GCX003.cbl Waybill Inquiry System Integration Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Waybill Inquiry System Integration':
  • Context - equipment information is not found in the primary waybill system:
    For Initialize Inquiry System Parameters:
    When the system needs to query the inquiry database for missing equipment details, then initialize inquiry system parameters and clear all status codes and segment data.
  • Context - container root data contains origin road number, station number, and waybill number:
    For Set Waybill Number from Container Root:
    When building the inquiry system key for waybill lookup, then set inquiry road number from container origin road number, inquiry station number from container origin station number, and inquiry waybill number from container waybill number.
  • Context - inquiry system parameters are properly initialized with waybill key information:
    For Call Waybill Inquiry System - FWIQIO:
    When executing waybill inquiry system call with fwiqio module, then call fwiqio module using inquiry parameters and waybill root segment to retrieve equipment data.
  • Context - waybill inquiry system call has been executed:
    For Inquiry System Response?:
    When checking the response status from the inquiry system, then if status code is blank then inquiry was successful, otherwise inquiry failed and equipment information is not available.
  • Context - waybill inquiry system returned valid equipment data:
    For Map Inquiry Data to Standard Format:
    When converting inquiry data to standard equipment format, then map inquiry origin road number to standard origin road number, inquiry waybill number to standard waybill number, inquiry car id to standard car id, and determine load/empty status where 'ze' billing code means empty otherwise loaded.
  • Context - inquiry system returned equipment data with billing code:
    For Extract Car ID and Load Status:
    When determining equipment load status, then if billing code equals 'ze' then set equipment status to empty, otherwise set equipment status to loaded.
  • Context - inquiry system returned valid waybill information:
    For Extract Waybill Date Information:
    When extracting temporal and location data, then set waybill date from inquiry waybill date and set origin station number from inquiry origin station number.
  • Context - basic waybill information has been successfully retrieved:
    For Retrieve Additional Routing Information:
    When requesting detailed routing information from inquiry system, then set inquiry segment type to 'fwiqinfo', set inquiry key to 'b1', and call inquiry system to retrieve routing details.
  • Context - routing information string contains space-separated routing fields:
    For Parse Routing Fields into Structured Format:
    When parsing routing information into individual components, then if routing information is not blank then iterate through each space-separated field and extract field length by counting characters until space or end of string.
  • Context - routing fields have been parsed into individual components:
    For Extract SCAC Codes and Junction Points:
    When extracting routing components in sequence, then set field 1 as primary scac code, field 2 as first junction r260 code, field 3 as secondary scac code, field 4 as second junction r260 code, field 5 as tertiary scac code, and field 6 as final junction code.
  • Context - waybill inquiry system is available for container cross-reference lookup:
    For Read Container Cross-Reference:
    When querying for container cross-reference information, then set inquiry segment type to 'fwiqbotl', clear inquiry key, set function to 'gnp', and call inquiry system repeatedly until no more container cross-reference records found or maximum 30 records reached.
  • Context - inquiry system returned bottom line data:
    For Container Cross-Reference Found?:
    When checking for container cross-reference information, then if inquiry bottom line starts with 't/c xref' then container cross-reference record is found, otherwise continue searching.
  • Context - container cross-reference record is identified in inquiry bottom line:
    For Extract Container ID:
    When extracting container and waybill cross-reference data, then extract container id from positions 28-39, waybill road number from positions 10-12, waybill station number from positions 14-19, waybill number from positions 21-26, and replace all spaces in waybill information with zeros.
  • Context - all inquiry system calls have been completed and data has been extracted:
    For Build Complete Equipment Record:
    When building the final equipment record, then combine waybill information, equipment details, routing data, and container cross-references into a complete equipment record with all fields properly populated.
  • Context - waybill inquiry system call returned an error status:
    For Log Inquiry System Error:
    When handling inquiry system errors, then set waybill indicator to the error status code and set equipment not found status.
  • Context - inquiry system failed to retrieve equipment information or returned errors:
    For Set Equipment Not Found Status:
    When setting final equipment status, then set container not found status and container inquiry not found status to indicate equipment information is unavailable.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment information is not found in the primary waybill system
GIVEN
Equipment information is not found in the primary waybill system
Applied to: Initialize Inquiry System Parameters
WHEN
The system needs to query the inquiry database for missing equipment details
THEN
Initialize inquiry system parameters and clear all status codes and segment data
Context: Container root data contains origin road number, station number, and waybill number
GIVEN
Container root data contains origin road number, station number, and waybill number
Applied to: Set Waybill Number from Container Root
WHEN
Building the inquiry system key for waybill lookup
THEN
Set inquiry road number from container origin road number, inquiry station number from container origin station number, and inquiry waybill number from container waybill number
Context: Inquiry system parameters are properly initialized with waybill key information
GIVEN
Inquiry system parameters are properly initialized with waybill key information
Applied to: Call Waybill Inquiry System - FWIQIO
WHEN
Executing waybill inquiry system call with FWIQIO module
THEN
Call FWIQIO module using inquiry parameters and waybill root segment to retrieve equipment data
Context: Waybill inquiry system call has been executed
GIVEN
Waybill inquiry system call has been executed
Applied to: Inquiry System Response?
WHEN
Checking the response status from the inquiry system
THEN
If status code is blank then inquiry was successful, otherwise inquiry failed and equipment information is not available
Context: Waybill inquiry system returned valid equipment data
GIVEN
Waybill inquiry system returned valid equipment data
Applied to: Map Inquiry Data to Standard Format
WHEN
Converting inquiry data to standard equipment format
THEN
Map inquiry origin road number to standard origin road number, inquiry waybill number to standard waybill number, inquiry car ID to standard car ID, and determine load/empty status where 'ZE' billing code means empty otherwise loaded
Context: Inquiry system returned equipment data with billing code
GIVEN
Inquiry system returned equipment data with billing code
Applied to: Extract Car ID and Load Status
WHEN
Determining equipment load status
THEN
If billing code equals 'ZE' then set equipment status to empty, otherwise set equipment status to loaded
Context: Inquiry system returned valid waybill information
GIVEN
Inquiry system returned valid waybill information
Applied to: Extract Waybill Date Information
WHEN
Extracting temporal and location data
THEN
Set waybill date from inquiry waybill date and set origin station number from inquiry origin station number
Context: Basic waybill information has been successfully retrieved
GIVEN
Basic waybill information has been successfully retrieved
Applied to: Retrieve Additional Routing Information
WHEN
Requesting detailed routing information from inquiry system
THEN
Set inquiry segment type to 'FWIQINFO', set inquiry key to 'B1', and call inquiry system to retrieve routing details
Context: Routing information string contains space-separated routing fields
GIVEN
Routing information string contains space-separated routing fields
Applied to: Parse Routing Fields into Structured Format
WHEN
Parsing routing information into individual components
THEN
If routing information is not blank then iterate through each space-separated field and extract field length by counting characters until space or end of string
Context: Routing fields have been parsed into individual components
GIVEN
Routing fields have been parsed into individual components
Applied to: Extract SCAC Codes and Junction Points
WHEN
Extracting routing components in sequence
THEN
Set field 1 as primary SCAC code, field 2 as first junction R260 code, field 3 as secondary SCAC code, field 4 as second junction R260 code, field 5 as tertiary SCAC code, and field 6 as final junction code
Context: Waybill inquiry system is available for container cross-reference lookup
GIVEN
Waybill inquiry system is available for container cross-reference lookup
Applied to: Read Container Cross-Reference
WHEN
Querying for container cross-reference information
THEN
Set inquiry segment type to 'FWIQBOTL', clear inquiry key, set function to 'GNP', and call inquiry system repeatedly until no more container cross-reference records found or maximum 30 records reached
Context: Inquiry system returned bottom line data
GIVEN
Inquiry system returned bottom line data
Applied to: Container Cross-Reference Found?
WHEN
Checking for container cross-reference information
THEN
If inquiry bottom line starts with 'T/C XREF' then container cross-reference record is found, otherwise continue searching
Context: Container cross-reference record is identified in inquiry bottom line
GIVEN
Container cross-reference record is identified in inquiry bottom line
Applied to: Extract Container ID
WHEN
Extracting container and waybill cross-reference data
THEN
Extract container ID from positions 28-39, waybill road number from positions 10-12, waybill station number from positions 14-19, waybill number from positions 21-26, and replace all spaces in waybill information with zeros
Context: All inquiry system calls have been completed and data has been extracted
GIVEN
All inquiry system calls have been completed and data has been extracted
Applied to: Build Complete Equipment Record
WHEN
Building the final equipment record
THEN
Combine waybill information, equipment details, routing data, and container cross-references into a complete equipment record with all fields properly populated
Context: Waybill inquiry system call returned an error status
GIVEN
Waybill inquiry system call returned an error status
Applied to: Log Inquiry System Error
WHEN
Handling inquiry system errors
THEN
Set waybill indicator to the error status code and set equipment not found status
Context: Inquiry system failed to retrieve equipment information or returned errors
GIVEN
Inquiry system failed to retrieve equipment information or returned errors
Applied to: Set Equipment Not Found Status
WHEN
Setting final equipment status
THEN
Set container not found status and container inquiry not found status to indicate equipment information is unavailable
R-GCX003-cbl-01068 (+16) File: GCX003.cbl Equipment Information Consolidation Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Information Consolidation':
  • Context - an equipment item needs to be processed:
    For Equipment Type Check:
    When the system checks if container information exists in the equipment record, then route to container processing if container found, otherwise route to car processing.
  • Context - equipment is identified as a container type:
    For Retrieve Container Information from FWSWRWR:
    When system searches fwswrwr database using waybill root key, then retrieve container segment information and set container status indicator.
  • Context - equipment is identified as a car type:
    For Retrieve Car Information from SHIPROOT:
    When system searches shiproot using car identification details, then retrieve waybill information and set waybill status indicator.
  • Context - system has attempted to retrieve waybill information from primary sources:
    For Primary Waybill Found?:
    When system evaluates the waybill retrieval status, then proceed to consolidation if found, otherwise attempt inquiry system retrieval.
  • Context - primary waybill data was not found:
    For Retrieve from Inquiry System FWCIROOT:
    When system searches fwciroot inquiry system using equipment id, then retrieve inquiry data and set inquiry status indicator.
  • Context - system has searched the inquiry system for equipment data:
    For Inquiry Data Found?:
    When system evaluates the inquiry retrieval status, then process inquiry data if found, otherwise attempt waybill inquiry database.
  • Context - both primary and inquiry systems did not return equipment data:
    For Retrieve from FWIQROOT Database:
    When system searches fwiqroot database using waybill details, then retrieve waybill inquiry data and set final retrieval status.
  • Context - equipment data has been retrieved from inquiry systems:
    For Move Inquiry Data to Shiproot Format:
    When system processes the inquiry data format, then convert and map inquiry fields to shiproot structure including load/empty status, dates, and identifiers.
  • Context - equipment data has been successfully retrieved and converted:
    For Extract Routing Information from FWIQINFO:
    When system accesses fwiqinfo database for routing details, then extract routing information and prepare for field parsing.
  • Context - raw routing information has been extracted from the database:
    For Parse Routing Fields into Structured Format:
    When system processes the routing information string, then parse into structured fields including scac codes, junction points, and route segments up to 4 routing entries.
  • Context - equipment data has been retrieved from one or more data sources:
    For Consolidate Equipment Details:
    When system consolidates all available equipment information, then create unified equipment record with all available details from primary and inquiry sources.
  • Context - consolidated equipment record contains equipment type code:
    For Validate Equipment Type and Description:
    When system validates the equipment type against reference tables, then retrieve equipment type description and validate type code exists in system tables.
  • Context - equipment record has been consolidated with cargo information:
    For Set Load/Empty Status:
    When system evaluates cargo presence and equipment characteristics, then set load/empty indicator based on cargo data, with special handling for conveying cars and international service units.
  • Context - equipment has been validated and status determined:
    For Apply Business Rules for Equipment Classification:
    When system applies classification business rules, then apply double-stack container counting for sk car types, validate routing information, and set empty indicators based on routing patterns.
  • Context - all equipment information has been consolidated and business rules applied:
    For Create Unified Equipment Record:
    When system creates the final equipment record, then generate unified record with equipment id, type, status, routing, and all relevant business attributes.
  • Context - container equipment requires cross-reference validation:
    For Handle Container Cross-Reference Data:
    When system processes fwiqbotl cross-reference data, then extract container ids and associated waybill information from cross-reference records.
  • Context - equipment may have multiple container associations:
    For Process Multiple Container Sources:
    When system processes all container source references, then handle up to 30 container cross-references and manage container sequence processing.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item needs to be processed
GIVEN
An equipment item needs to be processed
Applied to: Equipment Type Check
WHEN
The system checks if container information exists in the equipment record
THEN
Route to container processing if container found, otherwise route to car processing
Context: Equipment is identified as a container type
GIVEN
Equipment is identified as a container type
Applied to: Retrieve Container Information from FWSWRWR
WHEN
System searches FWSWRWR database using waybill root key
THEN
Retrieve container segment information and set container status indicator
Context: Equipment is identified as a car type
GIVEN
Equipment is identified as a car type
Applied to: Retrieve Car Information from SHIPROOT
WHEN
System searches SHIPROOT using car identification details
THEN
Retrieve waybill information and set waybill status indicator
Context: System has attempted to retrieve waybill information from primary sources
GIVEN
System has attempted to retrieve waybill information from primary sources
Applied to: Primary Waybill Found?
WHEN
System evaluates the waybill retrieval status
THEN
Proceed to consolidation if found, otherwise attempt inquiry system retrieval
Context: Primary waybill data was not found
GIVEN
Primary waybill data was not found
Applied to: Retrieve from Inquiry System FWCIROOT
WHEN
System searches FWCIROOT inquiry system using equipment ID
THEN
Retrieve inquiry data and set inquiry status indicator
Context: System has searched the inquiry system for equipment data
GIVEN
System has searched the inquiry system for equipment data
Applied to: Inquiry Data Found?
WHEN
System evaluates the inquiry retrieval status
THEN
Process inquiry data if found, otherwise attempt waybill inquiry database
Context: Both primary and inquiry systems did not return equipment data
GIVEN
Both primary and inquiry systems did not return equipment data
Applied to: Retrieve from FWIQROOT Database
WHEN
System searches FWIQROOT database using waybill details
THEN
Retrieve waybill inquiry data and set final retrieval status
Context: Equipment data has been retrieved from inquiry systems
GIVEN
Equipment data has been retrieved from inquiry systems
Applied to: Move Inquiry Data to Shiproot Format
WHEN
System processes the inquiry data format
THEN
Convert and map inquiry fields to shiproot structure including load/empty status, dates, and identifiers
Context: Equipment data has been successfully retrieved and converted
GIVEN
Equipment data has been successfully retrieved and converted
Applied to: Extract Routing Information from FWIQINFO
WHEN
System accesses FWIQINFO database for routing details
THEN
Extract routing information and prepare for field parsing
Context: Raw routing information has been extracted from the database
GIVEN
Raw routing information has been extracted from the database
Applied to: Parse Routing Fields into Structured Format
WHEN
System processes the routing information string
THEN
Parse into structured fields including SCAC codes, junction points, and route segments up to 4 routing entries
Context: Equipment data has been retrieved from one or more data sources
GIVEN
Equipment data has been retrieved from one or more data sources
Applied to: Consolidate Equipment Details
WHEN
System consolidates all available equipment information
THEN
Create unified equipment record with all available details from primary and inquiry sources
Context: Consolidated equipment record contains equipment type code
GIVEN
Consolidated equipment record contains equipment type code
Applied to: Validate Equipment Type and Description
WHEN
System validates the equipment type against reference tables
THEN
Retrieve equipment type description and validate type code exists in system tables
Context: Equipment record has been consolidated with cargo information
GIVEN
Equipment record has been consolidated with cargo information
Applied to: Set Load/Empty Status
WHEN
System evaluates cargo presence and equipment characteristics
THEN
Set load/empty indicator based on cargo data, with special handling for conveying cars and international service units
Context: Equipment has been validated and status determined
GIVEN
Equipment has been validated and status determined
Applied to: Apply Business Rules for Equipment Classification
WHEN
System applies classification business rules
THEN
Apply double-stack container counting for SK car types, validate routing information, and set empty indicators based on routing patterns
Context: All equipment information has been consolidated and business rules applied
GIVEN
All equipment information has been consolidated and business rules applied
Applied to: Create Unified Equipment Record
WHEN
System creates the final equipment record
THEN
Generate unified record with equipment ID, type, status, routing, and all relevant business attributes
Context: Container equipment requires cross-reference validation
GIVEN
Container equipment requires cross-reference validation
Applied to: Handle Container Cross-Reference Data
WHEN
System processes FWIQBOTL cross-reference data
THEN
Extract container IDs and associated waybill information from cross-reference records
Context: Equipment may have multiple container associations
GIVEN
Equipment may have multiple container associations
Applied to: Process Multiple Container Sources
WHEN
System processes all container source references
THEN
Handle up to 30 container cross-references and manage container sequence processing
R-GCX003-cbl-01085 (+14) File: GCX003.cbl Equipment Routing Information Extraction Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Routing Information Extraction':
  • Context - a waybill inquiry record exists in the system:
    For Access FWIQINFO Segment with Key 'B1':
    When the system needs to access routing information using segment key 'b1', then the fwiqinfo segment is retrieved with routing information fields populated.
  • Context - fwiqinfo segment has been accessed:
    For Routing Info Fields Available?:
    When the routing information fields are checked for data availability, then processing continues only if routing fields are not spaces or low-values, otherwise routing extraction is skipped.
  • Context - valid routing information fields are available:
    For Initialize Field Parsing Variables:
    When field parsing begins, then field length counter is set to 0, byte position counters are set to 1, and field number is set to 1.
  • Context - field parsing is in progress:
    For More Fields to Process?:
    When the system checks for more fields to process, then processing continues if current byte position is 34 or less and current field is not spaces, otherwise field processing ends.
  • Context - a routing field is being processed:
    For Calculate Field Length by Finding Space Delimiter:
    When field length calculation is performed, then the system scans from current position until a space is found or position exceeds 34, incrementing both byte position and field length counters.
  • Context - field length has been calculated:
    For Field Length Valid?:
    When field length validation is performed, then field processing continues only if length is 1 or greater, otherwise field processing terminates.
  • Context - a valid routing field has been extracted:
    For Which Field Number?:
    When field number evaluation is performed, then field 1 maps to scac1, field 2 to junction1, field 3 to scac2, field 4 to junction2, field 5 to scac3, field 6 to junction3, and field 7 to scac4.
  • Context - field number 1 is being processed with valid field length:
    For Extract SCAC Code 1:
    When scac code 1 extraction is performed, then the field value is moved to scac1 position in routing group and field number is incremented to 2.
  • Context - field number 2 is being processed with valid field length:
    For Extract Junction/R260 Code 1:
    When junction code 1 extraction is performed, then the field value is moved to junction1 position in routing group and field number is incremented to 3.
  • Context - field number 3 is being processed with valid field length:
    For Extract SCAC Code 2:
    When scac code 2 extraction is performed, then the field value is moved to scac2 position in routing group and field number is incremented to 4.
  • Context - field number 4 is being processed with valid field length:
    For Extract Junction/R260 Code 2:
    When junction code 2 extraction is performed, then the field value is moved to junction2 position in routing group and field number is incremented to 5.
  • Context - field number 5 is being processed with valid field length:
    For Extract SCAC Code 3:
    When scac code 3 extraction is performed, then the field value is moved to scac3 position in routing group and field number is incremented to 6.
  • Context - field number 6 is being processed with valid field length:
    For Extract Junction/R260 Code 3:
    When junction code 3 extraction is performed, then the field value is moved to junction3 position in routing group and field number is incremented to 7.
  • Context - field number 7 is being processed with valid field length:
    For Extract SCAC Code 4:
    When scac code 4 extraction is performed, then the field value is moved to scac4 position in routing group and byte position is set to 35 to terminate processing.
  • Context - routing information has been successfully parsed into structured format:
    For Store Structured Routing Group in SHIPROOT:
    When routing information storage is performed, then the structured routing group containing scac codes and junction points is moved to the shiproot routing information field.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill inquiry record exists in the system
GIVEN
A waybill inquiry record exists in the system
Applied to: Access FWIQINFO Segment with Key 'B1'
WHEN
The system needs to access routing information using segment key 'B1'
THEN
The FWIQINFO segment is retrieved with routing information fields populated
Context: FWIQINFO segment has been accessed
GIVEN
FWIQINFO segment has been accessed
Applied to: Routing Info Fields Available?
WHEN
The routing information fields are checked for data availability
THEN
Processing continues only if routing fields are not spaces or low-values, otherwise routing extraction is skipped
Context: Valid routing information fields are available
GIVEN
Valid routing information fields are available
Applied to: Initialize Field Parsing Variables
WHEN
Field parsing begins
THEN
Field length counter is set to 0, byte position counters are set to 1, and field number is set to 1
Context: Field parsing is in progress
GIVEN
Field parsing is in progress
Applied to: More Fields to Process?
WHEN
The system checks for more fields to process
THEN
Processing continues if current byte position is 34 or less and current field is not spaces, otherwise field processing ends
Context: A routing field is being processed
GIVEN
A routing field is being processed
Applied to: Calculate Field Length by Finding Space Delimiter
WHEN
Field length calculation is performed
THEN
The system scans from current position until a space is found or position exceeds 34, incrementing both byte position and field length counters
Context: Field length has been calculated
GIVEN
Field length has been calculated
Applied to: Field Length Valid?
WHEN
Field length validation is performed
THEN
Field processing continues only if length is 1 or greater, otherwise field processing terminates
Context: A valid routing field has been extracted
GIVEN
A valid routing field has been extracted
Applied to: Which Field Number?
WHEN
Field number evaluation is performed
THEN
Field 1 maps to SCAC1, Field 2 to Junction1, Field 3 to SCAC2, Field 4 to Junction2, Field 5 to SCAC3, Field 6 to Junction3, and Field 7 to SCAC4
Context: Field number 1 is being processed with valid field length
GIVEN
Field number 1 is being processed with valid field length
Applied to: Extract SCAC Code 1
WHEN
SCAC Code 1 extraction is performed
THEN
The field value is moved to SCAC1 position in routing group and field number is incremented to 2
Context: Field number 2 is being processed with valid field length
GIVEN
Field number 2 is being processed with valid field length
Applied to: Extract Junction/R260 Code 1
WHEN
Junction Code 1 extraction is performed
THEN
The field value is moved to Junction1 position in routing group and field number is incremented to 3
Context: Field number 3 is being processed with valid field length
GIVEN
Field number 3 is being processed with valid field length
Applied to: Extract SCAC Code 2
WHEN
SCAC Code 2 extraction is performed
THEN
The field value is moved to SCAC2 position in routing group and field number is incremented to 4
Context: Field number 4 is being processed with valid field length
GIVEN
Field number 4 is being processed with valid field length
Applied to: Extract Junction/R260 Code 2
WHEN
Junction Code 2 extraction is performed
THEN
The field value is moved to Junction2 position in routing group and field number is incremented to 5
Context: Field number 5 is being processed with valid field length
GIVEN
Field number 5 is being processed with valid field length
Applied to: Extract SCAC Code 3
WHEN
SCAC Code 3 extraction is performed
THEN
The field value is moved to SCAC3 position in routing group and field number is incremented to 6
Context: Field number 6 is being processed with valid field length
GIVEN
Field number 6 is being processed with valid field length
Applied to: Extract Junction/R260 Code 3
WHEN
Junction Code 3 extraction is performed
THEN
The field value is moved to Junction3 position in routing group and field number is incremented to 7
Context: Field number 7 is being processed with valid field length
GIVEN
Field number 7 is being processed with valid field length
Applied to: Extract SCAC Code 4
WHEN
SCAC Code 4 extraction is performed
THEN
The field value is moved to SCAC4 position in routing group and byte position is set to 35 to terminate processing
Context: Routing information has been successfully parsed into structured format
GIVEN
Routing information has been successfully parsed into structured format
Applied to: Store Structured Routing Group in SHIPROOT
WHEN
Routing information storage is performed
THEN
The structured routing group containing SCAC codes and junction points is moved to the SHIPROOT routing information field
R-GCX003-cbl-01115 (+10) File: GCX003.cbl Special Manifest Type Classification Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Manifest Type Classification':
  • Context - a cargo record exists with bond type and special manifest flags:
    For Bond Type = IT?:
    When the cargo bond type is it and the special manifest original flag is set, then the system should set it special manifest found flag to true.
    For Bond Type = TE?:
    When the cargo bond type is te and the special manifest special flag is set, then the system should set te special manifest found flag to true.
    For Bond Type = US-CAN-US?:
    When the cargo bond type is us-canada-us and the special tr flag is set, then the system should set tr special manifest found flag to true.
    For Bond Type = Export?:
    When the cargo bond type is export and the special 88 flag is set, then the system should set us-mx 88 special manifest found flag to true.
  • Context - a request action is send and it cargo requires special manifest processing:
    For User Authorized for Special Manifests?:
    When the user is not authorized for special manifests, then the system should generate authorization error message 43 instead of creating the special manifest.
  • Context - it cargo requires special manifest processing and user is authorized:
    For Create IT Export Special Manifest:
    When the request action is send, then the system should generate message 23, create report line, and set it export spawn flag for gcx101 processing.
  • Context - te cargo has location mismatch and user is authorized for special manifests:
    For Create TE Port Change Special Manifest:
    When the request action is send and cargo location does not match crossing port, then the system should generate message 20, create report line, and set port change spawn flag for gcx101 processing.
  • Context - tr cargo requires detour processing and user is authorized for special manifests:
    For Create TR Detour Special Manifest:
    When the request action is send and cargo has release status, then the system should generate message 23, create report line, and set detour spawn flag for gcx101 processing.
  • Context - us domestic cargo requires detour processing and user is authorized for special manifests:
    For Create US-US Detour Special Manifest:
    When the request action is send and waybill found with no cargo for us origin and destination, then the system should generate message 23, create report line, and set us-us detour spawn flag for gcx101 processing.
  • Context - export cargo for us-mexico route without existing special manifest and user is authorized:
    For Create 88-TR Export Special Manifest:
    When the request action is send and cargo is export type with no special manifest flag, then the system should generate message 23, create report line, and set 88-tr detour spawn flag for gcx101 processing.
  • Context - special manifest processing is required:
    For Generate Report-Only Message:
    When the request action is report instead of send, then the system should generate appropriate report messages (18, 19, 24, 50) without creating special manifests.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with bond type and special manifest flags
GIVEN
A cargo record exists with bond type and special manifest flags
Applied to: Bond Type = IT?
WHEN
The cargo bond type is IT and the special manifest original flag is set
THEN
The system should set IT special manifest found flag to true
Applied to: Bond Type = TE?
WHEN
The cargo bond type is TE and the special manifest special flag is set
THEN
The system should set TE special manifest found flag to true
Applied to: Bond Type = US-CAN-US?
WHEN
The cargo bond type is US-Canada-US and the special TR flag is set
THEN
The system should set TR special manifest found flag to true
Applied to: Bond Type = Export?
WHEN
The cargo bond type is Export and the special 88 flag is set
THEN
The system should set US-MX 88 special manifest found flag to true
Context: A request action is SEND and IT cargo requires special manifest processing
GIVEN
A request action is SEND and IT cargo requires special manifest processing
Applied to: User Authorized for Special Manifests?
WHEN
The user is not authorized for special manifests
THEN
The system should generate authorization error message 43 instead of creating the special manifest
Context: IT cargo requires special manifest processing and user is authorized
GIVEN
IT cargo requires special manifest processing and user is authorized
Applied to: Create IT Export Special Manifest
WHEN
The request action is SEND
THEN
The system should generate message 23, create report line, and set IT export spawn flag for GCX101 processing
Context: TE cargo has location mismatch and user is authorized for special manifests
GIVEN
TE cargo has location mismatch and user is authorized for special manifests
Applied to: Create TE Port Change Special Manifest
WHEN
The request action is SEND and cargo location does not match crossing port
THEN
The system should generate message 20, create report line, and set port change spawn flag for GCX101 processing
Context: TR cargo requires detour processing and user is authorized for special manifests
GIVEN
TR cargo requires detour processing and user is authorized for special manifests
Applied to: Create TR Detour Special Manifest
WHEN
The request action is SEND and cargo has release status
THEN
The system should generate message 23, create report line, and set detour spawn flag for GCX101 processing
Context: US domestic cargo requires detour processing and user is authorized for special manifests
GIVEN
US domestic cargo requires detour processing and user is authorized for special manifests
Applied to: Create US-US Detour Special Manifest
WHEN
The request action is SEND and waybill found with no cargo for US origin and destination
THEN
The system should generate message 23, create report line, and set US-US detour spawn flag for GCX101 processing
Context: Export cargo for US-Mexico route without existing special manifest and user is authorized
GIVEN
Export cargo for US-Mexico route without existing special manifest and user is authorized
Applied to: Create 88-TR Export Special Manifest
WHEN
The request action is SEND and cargo is export type with no special manifest flag
THEN
The system should generate message 23, create report line, and set 88-TR detour spawn flag for GCX101 processing
Context: Special manifest processing is required
GIVEN
Special manifest processing is required
Applied to: Generate Report-Only Message
WHEN
The request action is REPORT instead of SEND
THEN
The system should generate appropriate report messages (18, 19, 24, 50) without creating special manifests
R-GCX003-cbl-01126 (+14) File: GCX003.cbl Activity Log Message Generation Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Activity Log Message Generation':
  • Context - a cargo attachment or manifest creation activity needs to be logged:
    For Check if US CCN exists for logging:
    When the system checks if the us ccn from the added cargo list is not blank or spaces, then if us ccn exists, proceed with log message creation, otherwise skip logging process.
  • Context - a valid us ccn exists for logging:
    For Initialize Log Message Structure:
    When the system initializes the log message structure, then the gcx105-input structure is cleared and ready for data population.
  • Context - the log message structure is initialized:
    For Set Security Byte to High Values:
    When the system configures security settings for the log message, then the gcx105-security-byte is set to high-values.
  • Context - the security byte is configured:
    For Set Record Type to US Cargo:
    When the system sets the record type for the log message, then the gcx105-us-cargo flag is set to true to indicate us cargo logging.
  • Context - the record type is set to us cargo:
    For Set Action Code to ZZZ:
    When the system assigns an action code to the log message, then the gcx105-action-code is set to 'zzz'.
  • Context - the action code is set to zzz:
    For Set Sending Transaction ID:
    When the system assigns a transaction identifier, then the gcx105-sending-transaction is set to 'gct0031e'.
  • Context - the transaction identifier is assigned:
    For Capture User ACF2 ID:
    When the system captures user identification information, then the gcx105-acf2-id is populated with cc-acf2-userid from cccom.
  • Context - the user acf2 id is captured:
    For Format Current Date from System:
    When the system formats the current date for logging, then the gcx105-date is populated by concatenating cc-machine-century and cc-machine-date from cccom.
  • Context - the current date is formatted:
    For Capture Current Time from System:
    When the system captures the current time, then the gcx105-time is populated with cc-machine-time from cccom.
  • Context - the current time is captured:
    For Set Train or US CCN Identifier:
    When the system assigns the train or ccn identifier, then the gcx105-train-or-us-ccn is populated with added-us-ccn from the cargo counter.
  • Context - the train or ccn identifier is assigned:
    For Set Log Message Text:
    When the system sets the log message text, then the gcx105-message is populated with car-added-log-message.
  • Context - the log message text is assigned:
    For Move Log Data to Message Structure:
    When the system prepares the final message structure, then the gcx105-input is moved to gct1051e-msg.
  • Context - the log data is transferred to the message structure:
    For Send Log Message to Alt PCB:
    When the system sends the log message, then cims is called with chng function using alt-pcb and gct1051e structure.
  • Context - the log message is sent to alt pcb:
    For Write Log Message to System:
    When the system writes the log message, then writmsgl is called with alt-pcb, message code, message content, message length, and module name.
  • Context - the log message is written to the system:
    For Purge Message from Queue:
    When the system purges the message from queue, then cims is called with purg function using alt-pcb to clear the message.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo attachment or manifest creation activity needs to be logged
GIVEN
A cargo attachment or manifest creation activity needs to be logged
Applied to: Check if US CCN exists for logging
WHEN
The system checks if the US CCN from the added cargo list is not blank or spaces
THEN
If US CCN exists, proceed with log message creation, otherwise skip logging process
Context: A valid US CCN exists for logging
GIVEN
A valid US CCN exists for logging
Applied to: Initialize Log Message Structure
WHEN
The system initializes the log message structure
THEN
The GCX105-INPUT structure is cleared and ready for data population
Context: The log message structure is initialized
GIVEN
The log message structure is initialized
Applied to: Set Security Byte to High Values
WHEN
The system configures security settings for the log message
THEN
The GCX105-SECURITY-BYTE is set to HIGH-VALUES
Context: The security byte is configured
GIVEN
The security byte is configured
Applied to: Set Record Type to US Cargo
WHEN
The system sets the record type for the log message
THEN
The GCX105-US-CARGO flag is set to TRUE to indicate US cargo logging
Context: The record type is set to US cargo
GIVEN
The record type is set to US cargo
Applied to: Set Action Code to ZZZ
WHEN
The system assigns an action code to the log message
THEN
The GCX105-ACTION-CODE is set to 'ZZZ'
Context: The action code is set to ZZZ
GIVEN
The action code is set to ZZZ
Applied to: Set Sending Transaction ID
WHEN
The system assigns a transaction identifier
THEN
The GCX105-SENDING-TRANSACTION is set to 'GCT0031E'
Context: The transaction identifier is assigned
GIVEN
The transaction identifier is assigned
Applied to: Capture User ACF2 ID
WHEN
The system captures user identification information
THEN
The GCX105-ACF2-ID is populated with CC-ACF2-USERID from CCCOM
Context: The user ACF2 ID is captured
GIVEN
The user ACF2 ID is captured
Applied to: Format Current Date from System
WHEN
The system formats the current date for logging
THEN
The GCX105-DATE is populated by concatenating CC-MACHINE-CENTURY and CC-MACHINE-DATE from CCCOM
Context: The current date is formatted
GIVEN
The current date is formatted
Applied to: Capture Current Time from System
WHEN
The system captures the current time
THEN
The GCX105-TIME is populated with CC-MACHINE-TIME from CCCOM
Context: The current time is captured
GIVEN
The current time is captured
Applied to: Set Train or US CCN Identifier
WHEN
The system assigns the train or CCN identifier
THEN
The GCX105-TRAIN-OR-US-CCN is populated with ADDED-US-CCN from the cargo counter
Context: The train or CCN identifier is assigned
GIVEN
The train or CCN identifier is assigned
Applied to: Set Log Message Text
WHEN
The system sets the log message text
THEN
The GCX105-MESSAGE is populated with CAR-ADDED-LOG-MESSAGE
Context: The log message text is assigned
GIVEN
The log message text is assigned
Applied to: Move Log Data to Message Structure
WHEN
The system prepares the final message structure
THEN
The GCX105-INPUT is moved to GCT1051E-MSG
Context: The log data is transferred to the message structure
GIVEN
The log data is transferred to the message structure
Applied to: Send Log Message to Alt PCB
WHEN
The system sends the log message
THEN
CIMS is called with CHNG function using ALT-PCB and GCT1051E structure
Context: The log message is sent to Alt PCB
GIVEN
The log message is sent to Alt PCB
Applied to: Write Log Message to System
WHEN
The system writes the log message
THEN
WRITMSGL is called with ALT-PCB, message code, message content, message length, and module name
Context: The log message is written to the system
GIVEN
The log message is written to the system
Applied to: Purge Message from Queue
WHEN
The system purges the message from queue
THEN
CIMS is called with PURG function using ALT-PCB to clear the message
R-GCX003-cbl-01141 (+8) File: GCX003.cbl Report Duplicate Equipment Detection Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Duplicate Equipment Detection':
  • Context - a report contains equipment entries that need to be scanned for duplicates:
    For Start Duplicate Equipment Detection:
    When the duplicate detection process is initiated, then the scan counter is set to 1 and the scanning process begins for up to 700 report entries.
  • Context - the duplicate detection process is running with a current scan counter value:
    For Scan Counter ≤ 700?:
    When the system checks if more entries need to be processed, then continue scanning if scan counter is 700 or less, otherwise end the process.
  • Context - a valid scan counter position within the report range:
    For Get Equipment Entry at Current Position:
    When the system needs to examine an equipment entry, then the equipment entry at the current scan position is retrieved for analysis.
  • Context - an equipment entry is being examined for duplicate detection:
    For Equipment ID is Blank or Error/Warning/Info Message?:
    When the equipment id is blank or the entry contains error messages (err>), warning messages (wrn>), or info messages (inf>), then skip this entry and move to the next scan position without duplicate processing.
  • Context - a valid equipment entry with a non-blank equipment id:
    For Equipment ID Different from Previously Held ID?:
    When the current equipment id is compared with the previously held equipment id, then if the ids are different, update the held id; if the ids are the same, mark as duplicate.
  • Context - the current equipment id is different from the previously held equipment id:
    For Update Held Equipment ID with Current ID:
    When a new unique equipment id is encountered, then update the held equipment id with the current equipment id for future duplicate comparisons.
  • Context - the current equipment id matches the previously held equipment id:
    For Mark Current Equipment Entry as Duplicate by Clearing ID:
    When a duplicate equipment entry is detected, then clear the equipment id field to mark the entry as a duplicate while keeping the entry in the report.
  • Context - an equipment entry has been processed for duplicate detection:
    For Increment Scan Counter:
    When the current entry processing is complete, then increment the scan counter by 1 to move to the next equipment entry position.
  • Context - all equipment entries up to position 700 have been scanned for duplicates:
    For End Duplicate Detection Process:
    When the scan counter exceeds 700 or all entries have been processed, then complete the duplicate detection process and return control to the calling procedure.
👨‍💻 Technical ACs (Gherkin)
Context: A report contains equipment entries that need to be scanned for duplicates
GIVEN
A report contains equipment entries that need to be scanned for duplicates
Applied to: Start Duplicate Equipment Detection
WHEN
The duplicate detection process is initiated
THEN
The scan counter is set to 1 and the scanning process begins for up to 700 report entries
Context: The duplicate detection process is running with a current scan counter value
GIVEN
The duplicate detection process is running with a current scan counter value
Applied to: Scan Counter ≤ 700?
WHEN
The system checks if more entries need to be processed
THEN
Continue scanning if scan counter is 700 or less, otherwise end the process
Context: A valid scan counter position within the report range
GIVEN
A valid scan counter position within the report range
Applied to: Get Equipment Entry at Current Position
WHEN
The system needs to examine an equipment entry
THEN
The equipment entry at the current scan position is retrieved for analysis
Context: An equipment entry is being examined for duplicate detection
GIVEN
An equipment entry is being examined for duplicate detection
Applied to: Equipment ID is Blank or Error/Warning/Info Message?
WHEN
The equipment ID is blank or the entry contains error messages (ERR>), warning messages (WRN>), or info messages (INF>)
THEN
Skip this entry and move to the next scan position without duplicate processing
Context: A valid equipment entry with a non-blank equipment ID
GIVEN
A valid equipment entry with a non-blank equipment ID
Applied to: Equipment ID Different from Previously Held ID?
WHEN
The current equipment ID is compared with the previously held equipment ID
THEN
If the IDs are different, update the held ID; if the IDs are the same, mark as duplicate
Context: The current equipment ID is different from the previously held equipment ID
GIVEN
The current equipment ID is different from the previously held equipment ID
Applied to: Update Held Equipment ID with Current ID
WHEN
A new unique equipment ID is encountered
THEN
Update the held equipment ID with the current equipment ID for future duplicate comparisons
Context: The current equipment ID matches the previously held equipment ID
GIVEN
The current equipment ID matches the previously held equipment ID
Applied to: Mark Current Equipment Entry as Duplicate by Clearing ID
WHEN
A duplicate equipment entry is detected
THEN
Clear the equipment ID field to mark the entry as a duplicate while keeping the entry in the report
Context: An equipment entry has been processed for duplicate detection
GIVEN
An equipment entry has been processed for duplicate detection
Applied to: Increment Scan Counter
WHEN
The current entry processing is complete
THEN
Increment the scan counter by 1 to move to the next equipment entry position
Context: All equipment entries up to position 700 have been scanned for duplicates
GIVEN
All equipment entries up to position 700 have been scanned for duplicates
Applied to: End Duplicate Detection Process
WHEN
The scan counter exceeds 700 or all entries have been processed
THEN
Complete the duplicate detection process and return control to the calling procedure
R-GCX003-cbl-01150 (+14) File: GCX003.cbl Station Code Table Lookup Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Code Table Lookup':
  • Context - a station code lookup request is initiated:
    For Initialize GCSTBRT Key Structure:
    When the system prepares to search the station reference table, then the gcstbrt key structure is cleared and initialized to spaces.
  • Context - a station code validation is required:
    For Set Table Type to SC - Station Code:
    When the system determines the lookup table type, then the table type is set to sc for station code lookup.
  • Context - a train origin station code exists in the request:
    For Move Station Code to Search Key:
    When the system prepares to validate the station code, then the train origin code is moved to the station search key field.
  • Context - the station search key is populated with a station code:
    For Call GCCTBIO to Retrieve Station Data:
    When the system executes the table lookup operation, then the gcctbio module is called to retrieve matching station data.
  • Context - a station code table lookup has been executed:
    For Station Record Found?:
    When the system checks the lookup results, then the system determines if a matching station record was successfully found.
  • Context - a valid station record has been found in the table lookup:
    For Move Station Segment Data to Working Storage:
    When the system processes the retrieved station data, then the station segment data is moved to the working storage area.
  • Context - station segment data is available in working storage:
    For Extract US Station Code:
    When the system extracts station identification information, then the us station code is extracted from the station record.
  • Context - station segment data contains station details:
    For Extract Station Name:
    When the system processes station information, then the station name is extracted from the station record.
  • Context - station record contains time zone data:
    For Extract Time Zone Information:
    When the system processes station geographic information, then the time zone information is extracted for eta calculations.
  • Context - station record contains customs-related codes:
    For Extract FIRMS Code:
    When the system processes customs information, then the firms code is extracted from the station record.
  • Context - a us station code has been extracted from the station record:
    For US Station Code Valid?:
    When the system validates the station code content, then the us station code must not be spaces or empty to be considered valid.
  • Context - a valid us station code exists in the station record:
    For Set Station Validation Success:
    When the system completes station validation, then the station validation status is set to successful.
  • Context - a station code lookup has been performed:
    For Set Station Not Found Error:
    When no matching station record is found in the reference table, then a station not found error is set with message code 2.
  • Context - a station record has been found but the us station code is spaces or empty:
    For Set Invalid US Station Code Error:
    When the system validates the us station code content, then an invalid us station code error is set with message code 2.
  • Context - station validation processing has completed:
    For Return Station Information:
    When the system finalizes the station lookup operation, then the station information and validation status are returned to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A station code lookup request is initiated
GIVEN
A station code lookup request is initiated
Applied to: Initialize GCSTBRT Key Structure
WHEN
The system prepares to search the station reference table
THEN
The GCSTBRT key structure is cleared and initialized to spaces
Context: A station code validation is required
GIVEN
A station code validation is required
Applied to: Set Table Type to SC - Station Code
WHEN
The system determines the lookup table type
THEN
The table type is set to SC for station code lookup
Context: A train origin station code exists in the request
GIVEN
A train origin station code exists in the request
Applied to: Move Station Code to Search Key
WHEN
The system prepares to validate the station code
THEN
The train origin code is moved to the station search key field
Context: The station search key is populated with a station code
GIVEN
The station search key is populated with a station code
Applied to: Call GCCTBIO to Retrieve Station Data
WHEN
The system executes the table lookup operation
THEN
The GCCTBIO module is called to retrieve matching station data
Context: A station code table lookup has been executed
GIVEN
A station code table lookup has been executed
Applied to: Station Record Found?
WHEN
The system checks the lookup results
THEN
The system determines if a matching station record was successfully found
Context: A valid station record has been found in the table lookup
GIVEN
A valid station record has been found in the table lookup
Applied to: Move Station Segment Data to Working Storage
WHEN
The system processes the retrieved station data
THEN
The station segment data is moved to the working storage area
Context: Station segment data is available in working storage
GIVEN
Station segment data is available in working storage
Applied to: Extract US Station Code
WHEN
The system extracts station identification information
THEN
The US station code is extracted from the station record
Context: Station segment data contains station details
GIVEN
Station segment data contains station details
Applied to: Extract Station Name
WHEN
The system processes station information
THEN
The station name is extracted from the station record
Context: Station record contains time zone data
GIVEN
Station record contains time zone data
Applied to: Extract Time Zone Information
WHEN
The system processes station geographic information
THEN
The time zone information is extracted for ETA calculations
Context: Station record contains customs-related codes
GIVEN
Station record contains customs-related codes
Applied to: Extract FIRMS Code
WHEN
The system processes customs information
THEN
The FIRMS code is extracted from the station record
Context: A US station code has been extracted from the station record
GIVEN
A US station code has been extracted from the station record
Applied to: US Station Code Valid?
WHEN
The system validates the station code content
THEN
The US station code must not be spaces or empty to be considered valid
Context: A valid US station code exists in the station record
GIVEN
A valid US station code exists in the station record
Applied to: Set Station Validation Success
WHEN
The system completes station validation
THEN
The station validation status is set to successful
Context: A station code lookup has been performed
GIVEN
A station code lookup has been performed
Applied to: Set Station Not Found Error
WHEN
No matching station record is found in the reference table
THEN
A station not found error is set with message code 2
Context: A station record has been found but the US station code is spaces or empty
GIVEN
A station record has been found but the US station code is spaces or empty
Applied to: Set Invalid US Station Code Error
WHEN
The system validates the US station code content
THEN
An invalid US station code error is set with message code 2
Context: Station validation processing has completed
GIVEN
Station validation processing has completed
Applied to: Return Station Information
WHEN
The system finalizes the station lookup operation
THEN
The station information and validation status are returned to the calling process
R-GCX003-cbl-01165 (+26) File: GCX003.cbl Equipment Processing Loop Merged 27 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Processing Loop':
  • Context - a train request contains equipment items to be processed:
    For More Equipment to Process? REQ-IDX ≤ 499:
    When the system processes equipment items in sequence, then processing stops when either all equipment is processed or the 499 item limit is reached.
  • Context - a request contains equipment items at specific index positions:
    For Get Equipment ID from Request:
    When the system processes an equipment item at current index, then the equipment id is extracted and prepared with size 12 for formatting validation.
  • Context - an equipment id has been extracted from the request:
    For Equipment Format Valid?:
    When the equipment formatter gcccarfm is called to validate the format, then if format is invalid, equipment error message 34 is generated and processing continues to next equipment.
    For Equipment Format Valid?:
    When the system calls the equipment formatter gcccarfm, then the system must check if gccarfm-rc-success is true to determine if the equipment format is valid.
  • Context - equipment has been successfully formatted and validated:
    For Container Found?:
    When the system checks the equipment type in the waybill database, then if equipment is identified as a container, container-specific waybill retrieval is performed, otherwise car waybill retrieval is used.
  • Context - equipment is identified as a container type:
    For Retrieve Container Waybill:
    When the system searches for waybill information, then container waybill data is retrieved from shiproot using container id as the key.
  • Context - equipment is identified as a railcar (not container):
    For Retrieve Car Waybill with Fallback:
    When the system searches for waybill information, then primary waybill lookup is attempted, and if not found, inquiry system (fwciroot) is searched as fallback.
  • Context - a waybill has been located for equipment:
    For Waybill Found?:
    When the equipment is marked as empty (e) and the waybill shows loaded status (l), then the waybill is treated as not found to prevent incorrect cargo association.
  • Context - a valid waybill has been found for the equipment:
    For Retrieve First Cargo Record:
    When the system searches for associated cargo records, then the first cargo record is retrieved using waybill root key, waybill date, and equipment id as search criteria.
  • Context - the system has searched for cargo records associated with the waybill:
    For Cargo Found?:
    When cargo retrieval operation completes, then if no cargo is found, the no-cargo-found flag is set and error message processing is triggered.
  • Context - a cargo record has been found for the equipment:
    For Retrieve Segment 07 Data:
    When the system retrieves detailed segment information, then seg07 (commodity description), seg02 (reference numbers), and seg08 (hazmat) data are retrieved and availability flags are set.
  • Context - equipment and cargo data have been processed:
    For Build Equipment Report Line:
    When the system builds report output, then detailed report lines are created with equipment details, cargo information, and appropriate formatting for manifest display.
  • Context - the request action is send and cargo has been processed without errors:
    For Attach Cargo to Train SEND Action Only:
    When the system evaluates cargo for train attachment, then cargo is attached unless it is immediate transport, already created for it, us-canada-us with release status, default with release status, empty equipment, or special manifest cargo.
  • Context - a cargo record has been processed for the current equipment:
    For Retrieve Next Cargo Record:
    When the system searches for additional cargo records, then the next cargo record with matching waybill and equipment criteria is retrieved for processing.
  • Context - cargo processing is in progress for current equipment:
    For More Cargo Records?:
    When the system checks for additional cargo records, then if more cargo records exist with matching waybill and equipment id, processing continues, otherwise cargo processing completes.
  • Context - equipment processing has completed for waybill and cargo retrieval:
    For Generate Error Messages:
    When the system evaluates processing results against business rules, then appropriate error messages are generated for conditions like missing waybills, cargo status issues, bond type mismatches, or regulatory violations.
  • Context - equipment processing indicates container on flat car scenario or waybill shows conveying car with loaded status:
    For Retrieve Container on Flat Car:
    When the system searches for container information, then container data is retrieved from fwswrwr database or inquiry system, and if not found, error message 11 is generated.
  • Context - container retrieval processing has been attempted:
    For Container on Flat Car?:
    When the system checks container processing results, then if containers are found, processing continues with next container, otherwise container processing completes for current equipment.
  • Context - current equipment processing has completed (successful or with errors):
    For Increment Equipment Index:
    When the system prepares for next equipment item, then equipment index is incremented and new report index is advanced for next equipment processing cycle.
  • Context - a train request is being processed with multiple equipment items:
    For Equipment Index <= 499?:
    When the system processes equipment items in sequence, then the system must stop processing when the equipment index exceeds 499 items.
  • Context - the system is processing equipment items in a loop:
    For More Equipment to Process?:
    When the system checks for the next equipment item to process, then the system must verify that req-no-more-eqp flag is not set for the current equipment index.
  • Context - an equipment item needs to be processed:
    For Get Equipment ID from Request:
    When the system extracts equipment information from the request, then the system must move the equipment id from req-eqp-id array to gccarfm-input and set the size to 12 characters.
  • Context - an equipment item has passed format validation:
    For Process Equipment with B000-PROCESS-EQUIPMENT:
    When the system processes the equipment, then the system must perform b000-process-equipment with test after until ws-no-more-container is true.
  • Context - equipment processing is in progress:
    For More Containers on Equipment?:
    When the system checks for additional containers on the equipment, then the system must continue processing while ws-no-more-container is false.
  • Context - an equipment item fails format validation:
    For Add Equipment Error Message:
    When the system handles the format error, then the system must move req-eqp-id to rpt-car-id and req-le-ind to rpt-le-ind at the current report index.
  • Context - equipment format validation has failed and error details have been recorded:
    For Set Equipment Error Flag MSG-THIRTY-FOUR:
    When the system sets error flags, then the system must set msg-thirty-four flag to true at the current report index and increment the report index.
  • Context - processing of the current equipment item is complete:
    For Increment Equipment Index:
    When the system prepares to process the next equipment item, then the system must increment the equipment index req-idx by 1 to move to the next equipment item.
👨‍💻 Technical ACs (Gherkin)
Context: A train request contains equipment items to be processed
GIVEN
A train request contains equipment items to be processed
Applied to: More Equipment to Process? REQ-IDX ≤ 499
WHEN
The system processes equipment items in sequence
THEN
Processing stops when either all equipment is processed or the 499 item limit is reached
Context: A request contains equipment items at specific index positions
GIVEN
A request contains equipment items at specific index positions
Applied to: Get Equipment ID from Request
WHEN
The system processes an equipment item at current index
THEN
The equipment ID is extracted and prepared with size 12 for formatting validation
Context: An equipment ID has been extracted from the request
GIVEN
An equipment ID has been extracted from the request
Applied to: Equipment Format Valid?
WHEN
The equipment formatter GCCCARFM is called to validate the format
THEN
If format is invalid, equipment error message 34 is generated and processing continues to next equipment
Applied to: Equipment Format Valid?
WHEN
The system calls the equipment formatter GCCCARFM
THEN
The system must check if GCCARFM-RC-SUCCESS is true to determine if the equipment format is valid
Context: Equipment has been successfully formatted and validated
GIVEN
Equipment has been successfully formatted and validated
Applied to: Container Found?
WHEN
The system checks the equipment type in the waybill database
THEN
If equipment is identified as a container, container-specific waybill retrieval is performed, otherwise car waybill retrieval is used
Context: Equipment is identified as a container type
GIVEN
Equipment is identified as a container type
Applied to: Retrieve Container Waybill
WHEN
The system searches for waybill information
THEN
Container waybill data is retrieved from SHIPROOT using container ID as the key
Context: Equipment is identified as a railcar (not container)
GIVEN
Equipment is identified as a railcar (not container)
Applied to: Retrieve Car Waybill with Fallback
WHEN
The system searches for waybill information
THEN
Primary waybill lookup is attempted, and if not found, inquiry system (FWCIROOT) is searched as fallback
Context: A waybill has been located for equipment
GIVEN
A waybill has been located for equipment
Applied to: Waybill Found?
WHEN
The equipment is marked as empty (E) and the waybill shows loaded status (L)
THEN
The waybill is treated as not found to prevent incorrect cargo association
Context: A valid waybill has been found for the equipment
GIVEN
A valid waybill has been found for the equipment
Applied to: Retrieve First Cargo Record
WHEN
The system searches for associated cargo records
THEN
The first cargo record is retrieved using waybill root key, waybill date, and equipment ID as search criteria
Context: The system has searched for cargo records associated with the waybill
GIVEN
The system has searched for cargo records associated with the waybill
Applied to: Cargo Found?
WHEN
Cargo retrieval operation completes
THEN
If no cargo is found, the no-cargo-found flag is set and error message processing is triggered
Context: A cargo record has been found for the equipment
GIVEN
A cargo record has been found for the equipment
Applied to: Retrieve Segment 07 Data
WHEN
The system retrieves detailed segment information
THEN
SEG07 (commodity description), SEG02 (reference numbers), and SEG08 (hazmat) data are retrieved and availability flags are set
Context: Equipment and cargo data have been processed
GIVEN
Equipment and cargo data have been processed
Applied to: Build Equipment Report Line
WHEN
The system builds report output
THEN
Detailed report lines are created with equipment details, cargo information, and appropriate formatting for manifest display
Context: The request action is SEND and cargo has been processed without errors
GIVEN
The request action is SEND and cargo has been processed without errors
Applied to: Attach Cargo to Train SEND Action Only
WHEN
The system evaluates cargo for train attachment
THEN
Cargo is attached unless it is immediate transport, already created for IT, US-Canada-US with release status, default with release status, empty equipment, or special manifest cargo
Context: A cargo record has been processed for the current equipment
GIVEN
A cargo record has been processed for the current equipment
Applied to: Retrieve Next Cargo Record
WHEN
The system searches for additional cargo records
THEN
The next cargo record with matching waybill and equipment criteria is retrieved for processing
Context: Cargo processing is in progress for current equipment
GIVEN
Cargo processing is in progress for current equipment
Applied to: More Cargo Records?
WHEN
The system checks for additional cargo records
THEN
If more cargo records exist with matching waybill and equipment ID, processing continues, otherwise cargo processing completes
Context: Equipment processing has completed for waybill and cargo retrieval
GIVEN
Equipment processing has completed for waybill and cargo retrieval
Applied to: Generate Error Messages
WHEN
The system evaluates processing results against business rules
THEN
Appropriate error messages are generated for conditions like missing waybills, cargo status issues, bond type mismatches, or regulatory violations
Context: Equipment processing indicates container on flat car scenario or waybill shows conveying car with loaded status
GIVEN
Equipment processing indicates container on flat car scenario or waybill shows conveying car with loaded status
Applied to: Retrieve Container on Flat Car
WHEN
The system searches for container information
THEN
Container data is retrieved from FWSWRWR database or inquiry system, and if not found, error message 11 is generated
Context: Container retrieval processing has been attempted
GIVEN
Container retrieval processing has been attempted
Applied to: Container on Flat Car?
WHEN
The system checks container processing results
THEN
If containers are found, processing continues with next container, otherwise container processing completes for current equipment
Context: Current equipment processing has completed (successful or with errors)
GIVEN
Current equipment processing has completed (successful or with errors)
Applied to: Increment Equipment Index
WHEN
The system prepares for next equipment item
THEN
Equipment index is incremented and new report index is advanced for next equipment processing cycle
Context: A train request is being processed with multiple equipment items
GIVEN
A train request is being processed with multiple equipment items
Applied to: Equipment Index <= 499?
WHEN
The system processes equipment items in sequence
THEN
The system must stop processing when the equipment index exceeds 499 items
Context: The system is processing equipment items in a loop
GIVEN
The system is processing equipment items in a loop
Applied to: More Equipment to Process?
WHEN
The system checks for the next equipment item to process
THEN
The system must verify that REQ-NO-MORE-EQP flag is not set for the current equipment index
Context: An equipment item needs to be processed
GIVEN
An equipment item needs to be processed
Applied to: Get Equipment ID from Request
WHEN
The system extracts equipment information from the request
THEN
The system must move the equipment ID from REQ-EQP-ID array to GCCARFM-INPUT and set the size to 12 characters
Context: An equipment item has passed format validation
GIVEN
An equipment item has passed format validation
Applied to: Process Equipment with B000-PROCESS-EQUIPMENT
WHEN
The system processes the equipment
THEN
The system must perform B000-PROCESS-EQUIPMENT with TEST AFTER until WS-NO-MORE-CONTAINER is true
Context: Equipment processing is in progress
GIVEN
Equipment processing is in progress
Applied to: More Containers on Equipment?
WHEN
The system checks for additional containers on the equipment
THEN
The system must continue processing while WS-NO-MORE-CONTAINER is false
Context: An equipment item fails format validation
GIVEN
An equipment item fails format validation
Applied to: Add Equipment Error Message
WHEN
The system handles the format error
THEN
The system must move REQ-EQP-ID to RPT-CAR-ID and REQ-LE-IND to RPT-LE-IND at the current report index
Context: Equipment format validation has failed and error details have been recorded
GIVEN
Equipment format validation has failed and error details have been recorded
Applied to: Set Equipment Error Flag MSG-THIRTY-FOUR
WHEN
The system sets error flags
THEN
The system must set MSG-THIRTY-FOUR flag to true at the current report index and increment the report index
Context: Processing of the current equipment item is complete
GIVEN
Processing of the current equipment item is complete
Applied to: Increment Equipment Index
WHEN
The system prepares to process the next equipment item
THEN
The system must increment the equipment index REQ-IDX by 1 to move to the next equipment item
R-GCX003-cbl-01183 (+4) File: GCX003.cbl SCAC Access Permission Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'SCAC Access Permission Validation':
  • Context - a user with acf2 user id attempts to access train processing functionality:
    For SCAC Access Valid?:
    When the system validates scac access permission for canadian pacific (cst-cp-scac) through gccscac security module, then if scac access is invalid and it is not an aei train send request, then set access denied message and deny user access.
  • Context - a user has invalid scac access permission:
    For AEI Train Send Request?:
    When the request type equals aei request type (aei-train-send-yes is true), then allow the user to continue processing despite invalid scac access.
  • Context - a user has valid scac access or aei exception applies:
    For User Profile Found?:
    When the system searches for user security profile in gcstbrt table using acf2 user id, then if profile is found, load user security settings; otherwise set default security settings to spaces.
  • Context - a user requests to perform a send action (req-action-send is true):
    For User Has Send Permission?:
    When the system checks user's utf-add permission in security profile, then if user does not have 'u' or 's' authorization and it is not an aei train send request, then set send permission denied message and deny access.
  • Context - a user has valid send permissions and no errors have occurred:
    For User Authorized for Special Manifests?:
    When the system checks user's utf-spec-mani permission for special manifest authorization, then if user does not have 's' authorization and it is not an aei train send request, then set user not authorized for special manifest flag.
👨‍💻 Technical ACs (Gherkin)
Context: A user with ACF2 user ID attempts to access train processing functionality
GIVEN
A user with ACF2 user ID attempts to access train processing functionality
Applied to: SCAC Access Valid?
WHEN
The system validates SCAC access permission for Canadian Pacific (CST-CP-SCAC) through GCCSCAC security module
THEN
If SCAC access is invalid AND it is not an AEI train send request, then set access denied message and deny user access
Context: A user has invalid SCAC access permission
GIVEN
A user has invalid SCAC access permission
Applied to: AEI Train Send Request?
WHEN
The request type equals AEI request type (AEI-TRAIN-SEND-YES is true)
THEN
Allow the user to continue processing despite invalid SCAC access
Context: A user has valid SCAC access or AEI exception applies
GIVEN
A user has valid SCAC access or AEI exception applies
Applied to: User Profile Found?
WHEN
The system searches for user security profile in GCSTBRT table using ACF2 user ID
THEN
If profile is found, load user security settings; otherwise set default security settings to spaces
Context: A user requests to perform a send action (REQ-ACTION-SEND is true)
GIVEN
A user requests to perform a send action (REQ-ACTION-SEND is true)
Applied to: User Has Send Permission?
WHEN
The system checks user's UTF-ADD permission in security profile
THEN
If user does not have 'U' or 'S' authorization AND it is not an AEI train send request, then set send permission denied message and deny access
Context: A user has valid send permissions and no errors have occurred
GIVEN
A user has valid send permissions and no errors have occurred
Applied to: User Authorized for Special Manifests?
WHEN
The system checks user's UTF-SPEC-MANI permission for special manifest authorization
THEN
If user does not have 'S' authorization AND it is not an AEI train send request, then set user not authorized for special manifest flag
R-GCX003-cbl-01188 (+4) File: GCX003.cbl Train Send Authority Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train Send Authority Validation':
  • Context - a user attempts to access train send functionality:
    For SCAC Access Valid?:
    When the system validates scac access permissions and the request is not an aei request type and scac access is invalid, then set user access denied flag and generate access denied message.
  • Context - a valid user id exists in the system:
    For User Profile Found?:
    When the system attempts to retrieve user profile from gcstbrt security table, then load user profile segment if found, otherwise initialize with default empty profile settings.
  • Context - a user requests to send train information and the request action is send:
    For User Has Send Authority 'U' or 'S'?:
    When the system checks user's utf-add field for send authority, then allow operation if user has 'u' or 's' authority or if request is aei type, otherwise deny access and generate unauthorized message.
  • Context - a user has valid send authority and the request is not an aei type:
    For User Has Special Manifest Authority 'S'?:
    When the system checks user's utf-spec-mani field for special manifest authority, then set special manifest authorization flag based on whether user has 's' authority.
  • Context - a request has invalid scac access permissions:
    For AEI Request Override:
    When the request type is identified as aei request type, then allow the request to proceed despite invalid scac access.
👨‍💻 Technical ACs (Gherkin)
Context: A user attempts to access train send functionality
GIVEN
A user attempts to access train send functionality
Applied to: SCAC Access Valid?
WHEN
The system validates SCAC access permissions AND the request is not an AEI request type AND SCAC access is invalid
THEN
Set user access denied flag and generate access denied message
Context: A valid user ID exists in the system
GIVEN
A valid user ID exists in the system
Applied to: User Profile Found?
WHEN
The system attempts to retrieve user profile from GCSTBRT security table
THEN
Load user profile segment if found, otherwise initialize with default empty profile settings
Context: A user requests to send train information AND the request action is SEND
GIVEN
A user requests to send train information AND the request action is SEND
Applied to: User Has Send Authority 'U' or 'S'?
WHEN
The system checks user's UTF-ADD field for send authority
THEN
Allow operation if user has 'U' or 'S' authority OR if request is AEI type, otherwise deny access and generate unauthorized message
Context: A user has valid send authority AND the request is not an AEI type
GIVEN
A user has valid send authority AND the request is not an AEI type
Applied to: User Has Special Manifest Authority 'S'?
WHEN
The system checks user's UTF-SPEC-MANI field for special manifest authority
THEN
Set special manifest authorization flag based on whether user has 'S' authority
Context: A request has invalid SCAC access permissions
GIVEN
A request has invalid SCAC access permissions
Applied to: AEI Request Override
WHEN
The request type is identified as AEI request type
THEN
Allow the request to proceed despite invalid SCAC access
R-GCX003-cbl-01193 (+13) File: GCX003.cbl Train ID Component Assembly Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Train ID Component Assembly':
  • Context - a train manifest is being processed:
    For Get SCAC Code from Constants:
    When the system needs to create a unique customs train identifier, then the scac code 'cprs' (canadian pacific railway) is assigned as the carrier identifier component.
    For Get Current Machine Date:
    When the system needs to create a time-stamped unique identifier, then the current machine date is captured from the system for inclusion in the train id.
  • Context - a train manifest request is received:
    For Get Train ID from Request:
    When the system processes the request for customs train id creation, then the train id from the request is extracted and used as a component in the unique identifier.
  • Context - a train manifest request contains origin station information:
    For Get Train Origin from Request:
    When the system builds the unique customs train identifier, then the train origin station code is extracted from the request and included as a component.
  • Context - a train manifest request includes a consist number:
    For Get Consist Number from Request:
    When the system creates the customs train identifier, then the consist number is extracted from the request and used as an identifier component.
  • Context - the current machine date has been captured:
    For Convert Date to Julian Format:
    When the date needs to be formatted for the customs train identifier, then the date is converted to julian format (5-digit format) for consistent date representation.
  • Context - scac code, train id, origin, consist number, and julian date are available:
    For Combine Components into US Customs Train ID:
    When the system creates the final customs identifier, then all components are combined with export indicator 't' to form the complete us customs train id.
  • Context - a train identifier is being formatted for customs:
    For Format: SCAC + Train ID + Origin + Consist + Julian Date + Export Indicator:
    When the final identifier format is applied, then the export indicator 't' is appended to signify this is an export train manifest.
  • Context - the us customs train id has been successfully assembled:
    For Store Assembled Train ID:
    When the identifier needs to be persisted for processing, then the assembled train id is stored in the train header structure for further use.
  • Context - a unique customs train id has been assembled:
    For Check for Existing Train ID in Database:
    When the system needs to ensure uniqueness, then the database is queried to check if the train id already exists.
  • Context - a train id exists in the database and is marked as deleted:
    For Delete Existing Record if Marked for Deletion:
    When the same train id is being created again, then the existing deleted record is removed from the database to allow the new train creation.
  • Context - a train id already exists in the database as an active record:
    For Generate Error - Duplicate Train ID:
    When an attempt is made to create a new train with the same identifier, then an error message (msg-six) is generated indicating the train id already exists.
  • Context - a unique train id has been validated and confirmed as available:
    For Initialize Train Header with New ID:
    When a new train record needs to be created, then the train header structure is initialized with the new customs train identifier.
  • Context - a new train header has been successfully initialized:
    For Mark Train as Added to System:
    When the train creation process is completed, then the train is marked as added to the system for status tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest is being processed
GIVEN
A train manifest is being processed
Applied to: Get SCAC Code from Constants
WHEN
The system needs to create a unique customs train identifier
THEN
The SCAC code 'CPRS' (Canadian Pacific Railway) is assigned as the carrier identifier component
Applied to: Get Current Machine Date
WHEN
The system needs to create a time-stamped unique identifier
THEN
The current machine date is captured from the system for inclusion in the train ID
Context: A train manifest request is received
GIVEN
A train manifest request is received
Applied to: Get Train ID from Request
WHEN
The system processes the request for customs train ID creation
THEN
The train ID from the request is extracted and used as a component in the unique identifier
Context: A train manifest request contains origin station information
GIVEN
A train manifest request contains origin station information
Applied to: Get Train Origin from Request
WHEN
The system builds the unique customs train identifier
THEN
The train origin station code is extracted from the request and included as a component
Context: A train manifest request includes a consist number
GIVEN
A train manifest request includes a consist number
Applied to: Get Consist Number from Request
WHEN
The system creates the customs train identifier
THEN
The consist number is extracted from the request and used as an identifier component
Context: The current machine date has been captured
GIVEN
The current machine date has been captured
Applied to: Convert Date to Julian Format
WHEN
The date needs to be formatted for the customs train identifier
THEN
The date is converted to Julian format (5-digit format) for consistent date representation
Context: SCAC code, train ID, origin, consist number, and Julian date are available
GIVEN
SCAC code, train ID, origin, consist number, and Julian date are available
Applied to: Combine Components into US Customs Train ID
WHEN
The system creates the final customs identifier
THEN
All components are combined with export indicator 'T' to form the complete US customs train ID
Context: A train identifier is being formatted for customs
GIVEN
A train identifier is being formatted for customs
Applied to: Format: SCAC + Train ID + Origin + Consist + Julian Date + Export Indicator
WHEN
The final identifier format is applied
THEN
The export indicator 'T' is appended to signify this is an export train manifest
Context: The US customs train ID has been successfully assembled
GIVEN
The US customs train ID has been successfully assembled
Applied to: Store Assembled Train ID
WHEN
The identifier needs to be persisted for processing
THEN
The assembled train ID is stored in the train header structure for further use
Context: A unique customs train ID has been assembled
GIVEN
A unique customs train ID has been assembled
Applied to: Check for Existing Train ID in Database
WHEN
The system needs to ensure uniqueness
THEN
The database is queried to check if the train ID already exists
Context: A train ID exists in the database and is marked as deleted
GIVEN
A train ID exists in the database and is marked as deleted
Applied to: Delete Existing Record if Marked for Deletion
WHEN
The same train ID is being created again
THEN
The existing deleted record is removed from the database to allow the new train creation
Context: A train ID already exists in the database as an active record
GIVEN
A train ID already exists in the database as an active record
Applied to: Generate Error - Duplicate Train ID
WHEN
An attempt is made to create a new train with the same identifier
THEN
An error message (MSG-SIX) is generated indicating the train ID already exists
Context: A unique train ID has been validated and confirmed as available
GIVEN
A unique train ID has been validated and confirmed as available
Applied to: Initialize Train Header with New ID
WHEN
A new train record needs to be created
THEN
The train header structure is initialized with the new customs train identifier
Context: A new train header has been successfully initialized
GIVEN
A new train header has been successfully initialized
Applied to: Mark Train as Added to System
WHEN
The train creation process is completed
THEN
The train is marked as added to the system for status tracking purposes
R-GCX003-cbl-01207 (+9) File: GCX003.cbl Existing Train Record Validation Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Existing Train Record Validation':
  • Context - a train request with carrier scac code, train id, origin station, consist number, and current system date:
    For Build US Customs Train ID:
    When the system processes the train identification request, then the system creates a us customs train id by concatenating carrier scac, train id, origin station, consist number, creation date in julian format, and export indicator 't'.
  • Context - current system date in yymmdd format and century indicator:
    For Generate Train Creation Date:
    When the system needs to create a train creation timestamp, then the system converts the date to 8-digit format, then to julian date format, and extracts 5-digit julian date for train id construction.
  • Context - a new train record being created for us customs processing:
    For Set Export Indicator to 'T':
    When the system initializes the train export indicator, then the system sets the export indicator to 't' to designate this as an export train.
  • Context - a constructed us customs train id:
    For Search Database for Existing Train Record:
    When the system searches the gcsutrt database for existing train records, then the system performs a database lookup using the train id as the search key and returns the record status.
  • Context - a database search result for a specific train id:
    For Train Record Found?:
    When the system evaluates the search outcome, then if a matching train record is found in the database, the system proceeds to deletion status check, otherwise it continues to create a new train record.
  • Context - an existing train record found in the database:
    For Record Marked for Deletion?:
    When the system checks the deletion confirmation status of the record, then if the record is marked for deletion, the system proceeds to remove it, otherwise it generates a duplicate train id error.
  • Context - an existing train record marked for deletion:
    For Delete Existing Train Record:
    When the system processes the deletion request, then the system removes the existing train record from the gcsutrt database and allows the train id to be reused.
  • Context - an existing train record that is not marked for deletion:
    For Generate Duplicate Train ID Error:
    When the system attempts to create a new train with the same identifier, then the system generates error message 6 indicating a duplicate train id conflict and prevents the creation of the new record.
  • Context - validation that no conflicting train record exists or existing record has been removed:
    For Initialize New Train Header:
    When the system prepares to create a new train record, then the system initializes a new train header structure with default values and clears any previous data.
  • Context - a successfully initialized train header and validated train id:
    For Set Train ID for Processing:
    When the system prepares the train record for further processing, then the system assigns the constructed us customs train id to both the train header and the added train tracking table for continued processing.
👨‍💻 Technical ACs (Gherkin)
Context: A train request with carrier SCAC code, train ID, origin station, consist number, and current system date
GIVEN
A train request with carrier SCAC code, train ID, origin station, consist number, and current system date
Applied to: Build US Customs Train ID
WHEN
The system processes the train identification request
THEN
The system creates a US customs train ID by concatenating carrier SCAC, train ID, origin station, consist number, creation date in Julian format, and export indicator 'T'
Context: Current system date in YYMMDD format and century indicator
GIVEN
Current system date in YYMMDD format and century indicator
Applied to: Generate Train Creation Date
WHEN
The system needs to create a train creation timestamp
THEN
The system converts the date to 8-digit format, then to Julian date format, and extracts 5-digit Julian date for train ID construction
Context: A new train record being created for US customs processing
GIVEN
A new train record being created for US customs processing
Applied to: Set Export Indicator to 'T'
WHEN
The system initializes the train export indicator
THEN
The system sets the export indicator to 'T' to designate this as an export train
Context: A constructed US customs train ID
GIVEN
A constructed US customs train ID
Applied to: Search Database for Existing Train Record
WHEN
The system searches the GCSUTRT database for existing train records
THEN
The system performs a database lookup using the train ID as the search key and returns the record status
Context: A database search result for a specific train ID
GIVEN
A database search result for a specific train ID
Applied to: Train Record Found?
WHEN
The system evaluates the search outcome
THEN
If a matching train record is found in the database, the system proceeds to deletion status check, otherwise it continues to create a new train record
Context: An existing train record found in the database
GIVEN
An existing train record found in the database
Applied to: Record Marked for Deletion?
WHEN
The system checks the deletion confirmation status of the record
THEN
If the record is marked for deletion, the system proceeds to remove it, otherwise it generates a duplicate train ID error
Context: An existing train record marked for deletion
GIVEN
An existing train record marked for deletion
Applied to: Delete Existing Train Record
WHEN
The system processes the deletion request
THEN
The system removes the existing train record from the GCSUTRT database and allows the train ID to be reused
Context: An existing train record that is not marked for deletion
GIVEN
An existing train record that is not marked for deletion
Applied to: Generate Duplicate Train ID Error
WHEN
The system attempts to create a new train with the same identifier
THEN
The system generates error message 6 indicating a duplicate train ID conflict and prevents the creation of the new record
Context: Validation that no conflicting train record exists or existing record has been removed
GIVEN
Validation that no conflicting train record exists or existing record has been removed
Applied to: Initialize New Train Header
WHEN
The system prepares to create a new train record
THEN
The system initializes a new train header structure with default values and clears any previous data
Context: A successfully initialized train header and validated train ID
GIVEN
A successfully initialized train header and validated train ID
Applied to: Set Train ID for Processing
WHEN
The system prepares the train record for further processing
THEN
The system assigns the constructed US customs train ID to both the train header and the added train tracking table for continued processing
R-GCX003-cbl-01217 (+5) File: GCX003.cbl Equipment Format Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Format Validation':
  • Context - an equipment id from the request and equipment id length set to 12 characters:
    For Call GCCCARFM Service for Format Validation:
    When the gcccarfm service is called to validate the equipment format, then the system determines if the equipment format is valid or invalid for further processing.
  • Context - equipment format validation has been performed:
    For Equipment Format Valid - Continue Processing:
    When gcccarfm validation returns successful status, then the equipment is marked as valid and processing continues to the next step.
    For Mark as Equipment Format Error:
    When gcccarfm validation returns unsuccessful status, then the equipment is marked with format error status and added to report with load/empty indicator.
  • Context - equipment format validation has failed and equipment type is container:
    For Set Container Error Message 35:
    When the system determines the equipment is a container type, then error message 35 is set for the container format validation failure.
  • Context - equipment format validation has failed and equipment type is car:
    For Set Car Error Message 36:
    When the system determines the equipment is a car type, then error message 36 is set for the car format validation failure.
  • Context - equipment format validation has failed and appropriate error message has been generated:
    For Skip Further Equipment Processing:
    When the error has been added to the report, then further processing of this equipment item is skipped and control returns to process the next equipment.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment ID from the request and equipment ID length set to 12 characters
GIVEN
An equipment ID from the request and equipment ID length set to 12 characters
Applied to: Call GCCCARFM Service for Format Validation
WHEN
The GCCCARFM service is called to validate the equipment format
THEN
The system determines if the equipment format is valid or invalid for further processing
Context: Equipment format validation has been performed
GIVEN
Equipment format validation has been performed
Applied to: Equipment Format Valid - Continue Processing
WHEN
GCCCARFM validation returns successful status
THEN
The equipment is marked as valid and processing continues to the next step
Applied to: Mark as Equipment Format Error
WHEN
GCCCARFM validation returns unsuccessful status
THEN
The equipment is marked with format error status and added to report with load/empty indicator
Context: Equipment format validation has failed and equipment type is container
GIVEN
Equipment format validation has failed and equipment type is container
Applied to: Set Container Error Message 35
WHEN
The system determines the equipment is a container type
THEN
Error message 35 is set for the container format validation failure
Context: Equipment format validation has failed and equipment type is car
GIVEN
Equipment format validation has failed and equipment type is car
Applied to: Set Car Error Message 36
WHEN
The system determines the equipment is a car type
THEN
Error message 36 is set for the car format validation failure
Context: Equipment format validation has failed and appropriate error message has been generated
GIVEN
Equipment format validation has failed and appropriate error message has been generated
Applied to: Skip Further Equipment Processing
WHEN
The error has been added to the report
THEN
Further processing of this equipment item is skipped and control returns to process the next equipment
R-GCX003-cbl-01223 (+24) File: GCX003.cbl Equipment Processing Workflow Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Processing Workflow':
  • Context - equipment processing is starting for a new equipment item:
    For Initialize Equipment Processing Flags:
    When the system begins processing equipment, then all processing state flags are set to their initial values: tr bond not found, tr not created for it, te bond not found, te not created for te, special location codes not found, us-mx export not found, and segment indicators reset.
  • Context - an equipment item is being processed:
    For Container Found?:
    When the system needs to retrieve waybill information, then if container is found, use container-specific waybill retrieval, otherwise use car-specific waybill retrieval method.
  • Context - equipment is identified as a container:
    For Retrieve Container Waybill:
    When waybill retrieval is performed, then system retrieves waybill using container id through shiproot container lookup or iq container cross-reference if standard lookup fails.
  • Context - equipment is identified as a car (not container):
    For Retrieve Car Waybill with Fallback:
    When waybill retrieval is performed, then system attempts shiproot car lookup first, then falls back to fwcarget with specific parameters, and finally tries inquiry database lookup if needed.
  • Context - waybill retrieval has been attempted for equipment:
    For Waybill Found?:
    When system checks waybill status, then if waybill found and equipment is loaded empty car (el='l' and empty indicator), treat as waybill not found, otherwise proceed with found waybill.
  • Context - a waybill has been found for the equipment:
    For Check if Conveying Car:
    When system processes the waybill information, then if equipment is identified as conveying car type, set the load/empty indicator to 'e' (empty).
  • Context - equipment has a valid waybill:
    For Retrieve First Cargo Record:
    When cargo processing begins, then system retrieves first cargo record using waybill root key and equipment id, setting cargo found status appropriately.
  • Context - cargo processing is in progress for equipment:
    For More Cargo Records?:
    When system checks for more cargo records, then if more cargo records exist for the same equipment and waybill combination, continue processing, otherwise complete cargo processing for this equipment.
  • Context - a cargo record is being processed:
    For Retrieve Segment 07 Data:
    When detailed cargo information is needed, then system retrieves segment 07 (cargo details), segment 02 (reference numbers), and segment 08 (hazmat information) and sets appropriate found/not found indicators.
  • Context - equipment and cargo data has been retrieved:
    For Build Equipment Detail Report Line:
    When report generation is performed, then system creates detail line with equipment id, load/empty status, cargo descriptions, bond information, and special handling codes formatted for report output.
  • Context - equipment processing is complete and cargo exists:
    For Send Action and No Errors?:
    When system evaluates cargo attachment, then if request action is send and no errors exist and no spawn conditions are met and cargo is not empty residue, proceed with cargo attachment.
  • Context - cargo is eligible for attachment to train:
    For Attach Cargo to Train:
    When cargo attachment processing occurs, then skip attachment for immediate transport cargo, cargo already created for it, us-canada-us cargo with release status, default cargo with release status, empty equipment cargo, special manifest cargo at specific stations, or export cargo at non-laredo stations.
  • Context - current cargo record processing is complete:
    For Retrieve Next Cargo Record:
    When system continues cargo processing, then retrieve next cargo record using same equipment and waybill criteria, updating cargo found status.
  • Context - all cargo records for equipment have been processed:
    For Check for Special Bond Processing:
    When special bond processing evaluation occurs, then check for tr bond creation for it cargo, te bond creation for te cargo, special it manifest requirements, and us-mx export conditions.
  • Context - equipment processing found it cargo that should have tr bond:
    For TR Bond Created for IT?:
    When tr bond validation occurs, then if tr bond was created for it cargo but tr bond not found during processing, generate message 22 warning and add to report.
  • Context - tr bond is required but not found for it cargo:
    For Add TR Bond Warning Message:
    When warning message generation occurs, then add message 22 to report with equipment details and increment total equipment count.
  • Context - equipment processing found te cargo that should have te bond:
    For TE Bond Created for TE?:
    When te bond validation occurs, then if te bond was created for te cargo but te bond not found during processing, generate message 32 warning and add to report.
  • Context - te bond is required but not found for te cargo:
    For Add TE Bond Warning Message:
    When warning message generation occurs, then add message 32 to report with equipment details and increment total equipment count.
  • Context - equipment processing found special it manifest location code:
    For Special IT Manifest Found?:
    When special manifest validation occurs, then if special it manifest found but corresponding te manifest location not found, generate message 45 warning and add to report.
  • Context - special it manifest found but te manifest requirements not met:
    For Add Special Manifest Message:
    When special manifest warning generation occurs, then add message 45 to report with equipment details and increment total equipment count.
  • Context - equipment processing found us-mx export type 88 cargo:
    For US-MX Export Found?:
    When export manifest validation occurs, then if us-mx export type 88 found but tr manifest location not found, generate message 51 warning and add to report.
  • Context - us-mx export type 88 found but tr manifest requirements not met:
    For Add Export Message:
    When export warning generation occurs, then add message 51 to report with equipment details and increment total equipment count.
  • Context - no waybill was found for equipment:
    For Waybill Not Found and Loaded Equipment?:
    When equipment status evaluation occurs, then if equipment is loaded and not sbu van type, or if container not found, generate appropriate error messages and build report line.
  • Context - loaded equipment has no waybill and is not container or sbu van:
    For Add Equipment Not Found Error:
    When error message generation occurs, then add message 10 (waybill not found) or message 11 (container not found) to report based on equipment type.
  • Context - equipment processing is complete or container found on flat car:
    For Process Container on Flat Car:
    When container processing occurs, then if container found or waybill indicates conveying car with loaded status, retrieve and process container information.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment processing is starting for a new equipment item
GIVEN
Equipment processing is starting for a new equipment item
Applied to: Initialize Equipment Processing Flags
WHEN
The system begins processing equipment
THEN
All processing state flags are set to their initial values: TR bond not found, TR not created for IT, TE bond not found, TE not created for TE, special location codes not found, US-MX export not found, and segment indicators reset
Context: An equipment item is being processed
GIVEN
An equipment item is being processed
Applied to: Container Found?
WHEN
The system needs to retrieve waybill information
THEN
If container is found, use container-specific waybill retrieval, otherwise use car-specific waybill retrieval method
Context: Equipment is identified as a container
GIVEN
Equipment is identified as a container
Applied to: Retrieve Container Waybill
WHEN
Waybill retrieval is performed
THEN
System retrieves waybill using container ID through SHIPROOT container lookup or IQ container cross-reference if standard lookup fails
Context: Equipment is identified as a car (not container)
GIVEN
Equipment is identified as a car (not container)
Applied to: Retrieve Car Waybill with Fallback
WHEN
Waybill retrieval is performed
THEN
System attempts SHIPROOT car lookup first, then falls back to FWCARGET with specific parameters, and finally tries inquiry database lookup if needed
Context: Waybill retrieval has been attempted for equipment
GIVEN
Waybill retrieval has been attempted for equipment
Applied to: Waybill Found?
WHEN
System checks waybill status
THEN
If waybill found and equipment is loaded empty car (EL='L' and empty indicator), treat as waybill not found, otherwise proceed with found waybill
Context: A waybill has been found for the equipment
GIVEN
A waybill has been found for the equipment
Applied to: Check if Conveying Car
WHEN
System processes the waybill information
THEN
If equipment is identified as conveying car type, set the load/empty indicator to 'E' (empty)
Context: Equipment has a valid waybill
GIVEN
Equipment has a valid waybill
Applied to: Retrieve First Cargo Record
WHEN
Cargo processing begins
THEN
System retrieves first cargo record using waybill root key and equipment ID, setting cargo found status appropriately
Context: Cargo processing is in progress for equipment
GIVEN
Cargo processing is in progress for equipment
Applied to: More Cargo Records?
WHEN
System checks for more cargo records
THEN
If more cargo records exist for the same equipment and waybill combination, continue processing, otherwise complete cargo processing for this equipment
Context: A cargo record is being processed
GIVEN
A cargo record is being processed
Applied to: Retrieve Segment 07 Data
WHEN
Detailed cargo information is needed
THEN
System retrieves segment 07 (cargo details), segment 02 (reference numbers), and segment 08 (hazmat information) and sets appropriate found/not found indicators
Context: Equipment and cargo data has been retrieved
GIVEN
Equipment and cargo data has been retrieved
Applied to: Build Equipment Detail Report Line
WHEN
Report generation is performed
THEN
System creates detail line with equipment ID, load/empty status, cargo descriptions, bond information, and special handling codes formatted for report output
Context: Equipment processing is complete and cargo exists
GIVEN
Equipment processing is complete and cargo exists
Applied to: Send Action and No Errors?
WHEN
System evaluates cargo attachment
THEN
If request action is SEND and no errors exist and no spawn conditions are met and cargo is not empty residue, proceed with cargo attachment
Context: Cargo is eligible for attachment to train
GIVEN
Cargo is eligible for attachment to train
Applied to: Attach Cargo to Train
WHEN
Cargo attachment processing occurs
THEN
Skip attachment for immediate transport cargo, cargo already created for IT, US-Canada-US cargo with release status, default cargo with release status, empty equipment cargo, special manifest cargo at specific stations, or export cargo at non-Laredo stations
Context: Current cargo record processing is complete
GIVEN
Current cargo record processing is complete
Applied to: Retrieve Next Cargo Record
WHEN
System continues cargo processing
THEN
Retrieve next cargo record using same equipment and waybill criteria, updating cargo found status
Context: All cargo records for equipment have been processed
GIVEN
All cargo records for equipment have been processed
Applied to: Check for Special Bond Processing
WHEN
Special bond processing evaluation occurs
THEN
Check for TR bond creation for IT cargo, TE bond creation for TE cargo, special IT manifest requirements, and US-MX export conditions
Context: Equipment processing found IT cargo that should have TR bond
GIVEN
Equipment processing found IT cargo that should have TR bond
Applied to: TR Bond Created for IT?
WHEN
TR bond validation occurs
THEN
If TR bond was created for IT cargo but TR bond not found during processing, generate message 22 warning and add to report
Context: TR bond is required but not found for IT cargo
GIVEN
TR bond is required but not found for IT cargo
Applied to: Add TR Bond Warning Message
WHEN
Warning message generation occurs
THEN
Add message 22 to report with equipment details and increment total equipment count
Context: Equipment processing found TE cargo that should have TE bond
GIVEN
Equipment processing found TE cargo that should have TE bond
Applied to: TE Bond Created for TE?
WHEN
TE bond validation occurs
THEN
If TE bond was created for TE cargo but TE bond not found during processing, generate message 32 warning and add to report
Context: TE bond is required but not found for TE cargo
GIVEN
TE bond is required but not found for TE cargo
Applied to: Add TE Bond Warning Message
WHEN
Warning message generation occurs
THEN
Add message 32 to report with equipment details and increment total equipment count
Context: Equipment processing found special IT manifest location code
GIVEN
Equipment processing found special IT manifest location code
Applied to: Special IT Manifest Found?
WHEN
Special manifest validation occurs
THEN
If special IT manifest found but corresponding TE manifest location not found, generate message 45 warning and add to report
Context: Special IT manifest found but TE manifest requirements not met
GIVEN
Special IT manifest found but TE manifest requirements not met
Applied to: Add Special Manifest Message
WHEN
Special manifest warning generation occurs
THEN
Add message 45 to report with equipment details and increment total equipment count
Context: Equipment processing found US-MX export type 88 cargo
GIVEN
Equipment processing found US-MX export type 88 cargo
Applied to: US-MX Export Found?
WHEN
Export manifest validation occurs
THEN
If US-MX export type 88 found but TR manifest location not found, generate message 51 warning and add to report
Context: US-MX export type 88 found but TR manifest requirements not met
GIVEN
US-MX export type 88 found but TR manifest requirements not met
Applied to: Add Export Message
WHEN
Export warning generation occurs
THEN
Add message 51 to report with equipment details and increment total equipment count
Context: No waybill was found for equipment
GIVEN
No waybill was found for equipment
Applied to: Waybill Not Found and Loaded Equipment?
WHEN
Equipment status evaluation occurs
THEN
If equipment is loaded and not SBU van type, or if container not found, generate appropriate error messages and build report line
Context: Loaded equipment has no waybill and is not container or SBU van
GIVEN
Loaded equipment has no waybill and is not container or SBU van
Applied to: Add Equipment Not Found Error
WHEN
Error message generation occurs
THEN
Add message 10 (waybill not found) or message 11 (container not found) to report based on equipment type
Context: Equipment processing is complete or container found on flat car
GIVEN
Equipment processing is complete or container found on flat car
Applied to: Process Container on Flat Car
WHEN
Container processing occurs
THEN
If container found or waybill indicates conveying car with loaded status, retrieve and process container information
R-GCX003-cbl-01248 (+28) File: GCX003.cbl Container Cross Merged 29 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Container Cross':
  • Context - a container is not found in the primary system and container inquiry root data exists with original railroad number, station number, and waybill number:
    For Access Inquiry Root Database FWCIROOT:
    When the system accesses the inquiry root database fwciroot, then the system retrieves container information from the inquiry root database for further processing.
  • Context - the system has attempted to access the inquiry root database fwciroot:
    For Container Found in Inquiry Root?:
    When the database access returns a status code, then if status code is not spaces, container is not found and processing stops, otherwise container is found and processing continues to waybill inquiry.
  • Context - container is found in inquiry root database with valid railroad number, station number, and waybill number:
    For Access Inquiry Detail Database FWIQROOT:
    When the system accesses the waybill inquiry database fwiqroot using the extracted identifiers, then the system retrieves waybill information from the inquiry database for validation.
  • Context - the system has attempted to access the waybill inquiry database fwiqroot:
    For Waybill Found in Inquiry?:
    When the database access returns a status code, then if status code is not spaces, waybill is not found and container is marked as not found, otherwise waybill is found and processing continues to cross-reference scanning.
  • Context - waybill is found in inquiry database:
    For Scan for Container Cross-References FWIQBOTL:
    When the system scans the inquiry bottom line database fwiqbotl for cross-reference entries, then the system retrieves cross-reference data for evaluation.
  • Context - the system has retrieved data from inquiry bottom line database:
    For Cross-Reference Entry Found?:
    When the first 8 characters of the inquiry bottom line are evaluated, then if the first 8 characters equal 't/c xref', a cross-reference entry is found and container data is extracted, otherwise continue scanning for more entries.
  • Context - a valid cross-reference entry with 't/c xref' identifier is found:
    For Extract Container ID from Cross-Reference:
    When the system extracts container information from the cross-reference entry, then the container id is extracted from positions 28-39 of the inquiry bottom line.
    For Extract Waybill Information:
    When the system extracts waybill information from the cross-reference entry, then railroad number is extracted from positions 10-12, station number from positions 14-19, waybill number from positions 21-26, and all spaces in the waybill information are replaced with zeros.
  • Context - container id and waybill information have been extracted from a cross-reference entry:
    For Store Container Cross-Reference Data:
    When the system stores the cross-reference data, then the container id and waybill information are stored in the cross-reference table at the current index position.
  • Context - container cross-reference data has been successfully stored:
    For Set Container Found Status:
    When the system updates the container status, then the container status is set to found and the container is marked as an inquiry container for subsequent processing.
  • Context - a cross-reference entry has been processed:
    For Continue with Next Cross-Reference:
    When the system prepares to process the next entry, then the cross-reference index counter is incremented by 1.
  • Context - the system has processed a cross-reference entry:
    For More Cross-References?:
    When the system checks for more cross-reference entries, then if database status code is spaces and index is 30 or less, more cross-references are available and scanning continues, otherwise cross-reference resolution is complete.
  • Context - no more cross-reference entries are available for processing or the maximum index limit of 30 is reached:
    For Container Cross-Reference Resolution Complete:
    When the cross-reference resolution process completes, then the system finalizes the container cross-reference data and makes it available for subsequent waybill processing.
  • Context - container is not found in inquiry root database or waybill is not found in inquiry database:
    For Container Not Found - Set Not Found Status:
    When the system determines container cannot be resolved, then the container status is set to not found and inquiry container status is set to not found.
  • Context - a waybill exists with railroad number, station number, and waybill number from container inquiry root:
    For Access Inquiry System with Waybill Information:
    When the system accesses the inquiry system using the waybill key information, then the inquiry system is accessed with the waybill railroad number, station number, and waybill number to retrieve container cross-reference data.
  • Context - container cross-reference processing is starting:
    For Initialize Container Cross-Reference Table:
    When the system begins container cross-reference extraction, then the container cross-reference table is cleared and the processing counter is set to position 1.
  • Context - an inquiry bottom line is being processed:
    For Line Contains 'T/C XREF'?:
    When the system checks if the line contains 't/c xref' in positions 1-8, then if the line contains 't/c xref', it is identified as a container cross-reference line for further processing, otherwise it is skipped.
  • Context - a valid container cross-reference line containing 't/c xref':
    For Extract Container ID from Position 28-39:
    When the system processes the container cross-reference information, then the container id is extracted from positions 28-39 of the inquiry bottom line and stored in the container cross-reference table.
    For Extract Waybill Railroad from Position 10-12 & Extract Waybill Station from Position 14-19 & Extract Waybill Number from Position 21-26:
    When the system processes the waybill information, then the waybill railroad code is extracted from positions 10-12 of the inquiry bottom line and stored in the container cross-reference entry and the waybill station code is extracted from positions 14-19 of the inquiry bottom line and stored in the container cross-reference entry and the waybill number is extracted from positions 21-26 of the inquiry bottom line and stored in the container cross-reference entry.
  • Context - waybill railroad, station, and number have been extracted from the container cross-reference line:
    For Replace Spaces with Zeros in Waybill Fields:
    When the system processes the extracted waybill information, then all spaces in the waybill identification fields are replaced with zeros to create a standardized waybill key.
  • Context - container id and waybill information have been successfully extracted and formatted:
    For Store Container Cross-Reference Entry:
    When the system creates a container cross-reference entry, then the container id and associated waybill information are stored in the container cross-reference table at the current counter position.
  • Context - a container cross-reference entry has been successfully stored:
    For Increment Cross-Reference Counter:
    When the system completes processing of a container cross-reference line, then the cross-reference counter is incremented by 1 to prepare for the next container entry.
  • Context - container cross-reference entries are being processed and stored:
    For Counter Exceeds 30 Containers?:
    When the system checks the current cross-reference counter, then if the counter exceeds 30 containers, processing stops to prevent system overload, otherwise processing continues.
  • Context - all inquiry bottom lines have been processed for container cross-references:
    For Any Container Cross-References Found?:
    When the system evaluates the results of the container cross-reference extraction, then if the first container id entry is not spaces or low-values, container cross-references are considered found, otherwise none were found.
  • Context - container cross-references have been found in the inquiry system:
    For Set First Container as Active Equipment:
    When the system needs to establish the active equipment for processing, then the first container id from the cross-reference table is assigned as the active equipment id and the container cross-reference status is set to found.
  • Context - valid container cross-references have been extracted and the first container has been set as active equipment:
    For Mark Container Cross-Reference as Found:
    When the system completes successful container cross-reference processing, then the container cross-reference status is marked as found and the container status is set to found.
  • Context - no valid container cross-references were found during inquiry processing or the waybill was not found in the inquiry system:
    For Set Container Cross-Reference Not Found:
    When the system completes container cross-reference processing without finding valid entries, then the container cross-reference status is set to not found and the container status is set to not found.
👨‍💻 Technical ACs (Gherkin)
Context: A container is not found in the primary system and container inquiry root data exists with original railroad number, station number, and waybill number
GIVEN
A container is not found in the primary system and container inquiry root data exists with original railroad number, station number, and waybill number
Applied to: Access Inquiry Root Database FWCIROOT
WHEN
The system accesses the inquiry root database FWCIROOT
THEN
The system retrieves container information from the inquiry root database for further processing
Context: The system has attempted to access the inquiry root database FWCIROOT
GIVEN
The system has attempted to access the inquiry root database FWCIROOT
Applied to: Container Found in Inquiry Root?
WHEN
The database access returns a status code
THEN
If status code is not spaces, container is not found and processing stops, otherwise container is found and processing continues to waybill inquiry
Context: Container is found in inquiry root database with valid railroad number, station number, and waybill number
GIVEN
Container is found in inquiry root database with valid railroad number, station number, and waybill number
Applied to: Access Inquiry Detail Database FWIQROOT
WHEN
The system accesses the waybill inquiry database FWIQROOT using the extracted identifiers
THEN
The system retrieves waybill information from the inquiry database for validation
Context: The system has attempted to access the waybill inquiry database FWIQROOT
GIVEN
The system has attempted to access the waybill inquiry database FWIQROOT
Applied to: Waybill Found in Inquiry?
WHEN
The database access returns a status code
THEN
If status code is not spaces, waybill is not found and container is marked as not found, otherwise waybill is found and processing continues to cross-reference scanning
Context: Waybill is found in inquiry database
GIVEN
Waybill is found in inquiry database
Applied to: Scan for Container Cross-References FWIQBOTL
WHEN
The system scans the inquiry bottom line database FWIQBOTL for cross-reference entries
THEN
The system retrieves cross-reference data for evaluation
Context: The system has retrieved data from inquiry bottom line database
GIVEN
The system has retrieved data from inquiry bottom line database
Applied to: Cross-Reference Entry Found?
WHEN
The first 8 characters of the inquiry bottom line are evaluated
THEN
If the first 8 characters equal 'T/C XREF', a cross-reference entry is found and container data is extracted, otherwise continue scanning for more entries
Context: A valid cross-reference entry with 'T/C XREF' identifier is found
GIVEN
A valid cross-reference entry with 'T/C XREF' identifier is found
Applied to: Extract Container ID from Cross-Reference
WHEN
The system extracts container information from the cross-reference entry
THEN
The container ID is extracted from positions 28-39 of the inquiry bottom line
Applied to: Extract Waybill Information
WHEN
The system extracts waybill information from the cross-reference entry
THEN
Railroad number is extracted from positions 10-12, station number from positions 14-19, waybill number from positions 21-26, and all spaces in the waybill information are replaced with zeros
Context: Container ID and waybill information have been extracted from a cross-reference entry
GIVEN
Container ID and waybill information have been extracted from a cross-reference entry
Applied to: Store Container Cross-Reference Data
WHEN
The system stores the cross-reference data
THEN
The container ID and waybill information are stored in the cross-reference table at the current index position
Context: Container cross-reference data has been successfully stored
GIVEN
Container cross-reference data has been successfully stored
Applied to: Set Container Found Status
WHEN
The system updates the container status
THEN
The container status is set to found and the container is marked as an inquiry container for subsequent processing
Context: A cross-reference entry has been processed
GIVEN
A cross-reference entry has been processed
Applied to: Continue with Next Cross-Reference
WHEN
The system prepares to process the next entry
THEN
The cross-reference index counter is incremented by 1
Context: The system has processed a cross-reference entry
GIVEN
The system has processed a cross-reference entry
Applied to: More Cross-References?
WHEN
The system checks for more cross-reference entries
THEN
If database status code is spaces and index is 30 or less, more cross-references are available and scanning continues, otherwise cross-reference resolution is complete
Context: No more cross-reference entries are available for processing or the maximum index limit of 30 is reached
GIVEN
No more cross-reference entries are available for processing or the maximum index limit of 30 is reached
Applied to: Container Cross-Reference Resolution Complete
WHEN
The cross-reference resolution process completes
THEN
The system finalizes the container cross-reference data and makes it available for subsequent waybill processing
Context: Container is not found in inquiry root database or waybill is not found in inquiry database
GIVEN
Container is not found in inquiry root database or waybill is not found in inquiry database
Applied to: Container Not Found - Set Not Found Status
WHEN
The system determines container cannot be resolved
THEN
The container status is set to not found and inquiry container status is set to not found
Context: A waybill exists with railroad number, station number, and waybill number from container inquiry root
GIVEN
A waybill exists with railroad number, station number, and waybill number from container inquiry root
Applied to: Access Inquiry System with Waybill Information
WHEN
The system accesses the inquiry system using the waybill key information
THEN
The inquiry system is accessed with the waybill railroad number, station number, and waybill number to retrieve container cross-reference data
Context: Container cross-reference processing is starting
GIVEN
Container cross-reference processing is starting
Applied to: Initialize Container Cross-Reference Table
WHEN
The system begins container cross-reference extraction
THEN
The container cross-reference table is cleared and the processing counter is set to position 1
Context: An inquiry bottom line is being processed
GIVEN
An inquiry bottom line is being processed
Applied to: Line Contains 'T/C XREF'?
WHEN
The system checks if the line contains 'T/C XREF' in positions 1-8
THEN
If the line contains 'T/C XREF', it is identified as a container cross-reference line for further processing, otherwise it is skipped
Context: A valid container cross-reference line containing 'T/C XREF'
GIVEN
A valid container cross-reference line containing 'T/C XREF'
Applied to: Extract Container ID from Position 28-39
WHEN
The system processes the container cross-reference information
THEN
The container ID is extracted from positions 28-39 of the inquiry bottom line and stored in the container cross-reference table
Applied to: Extract Waybill Railroad from Position 10-12 & Extract Waybill Station from Position 14-19 & Extract Waybill Number from Position 21-26
WHEN
The system processes the waybill information
THEN
The waybill railroad code is extracted from positions 10-12 of the inquiry bottom line and stored in the container cross-reference entry AND The waybill station code is extracted from positions 14-19 of the inquiry bottom line and stored in the container cross-reference entry AND The waybill number is extracted from positions 21-26 of the inquiry bottom line and stored in the container cross-reference entry
Context: Waybill railroad, station, and number have been extracted from the container cross-reference line
GIVEN
Waybill railroad, station, and number have been extracted from the container cross-reference line
Applied to: Replace Spaces with Zeros in Waybill Fields
WHEN
The system processes the extracted waybill information
THEN
All spaces in the waybill identification fields are replaced with zeros to create a standardized waybill key
Context: Container ID and waybill information have been successfully extracted and formatted
GIVEN
Container ID and waybill information have been successfully extracted and formatted
Applied to: Store Container Cross-Reference Entry
WHEN
The system creates a container cross-reference entry
THEN
The container ID and associated waybill information are stored in the container cross-reference table at the current counter position
Context: A container cross-reference entry has been successfully stored
GIVEN
A container cross-reference entry has been successfully stored
Applied to: Increment Cross-Reference Counter
WHEN
The system completes processing of a container cross-reference line
THEN
The cross-reference counter is incremented by 1 to prepare for the next container entry
Context: Container cross-reference entries are being processed and stored
GIVEN
Container cross-reference entries are being processed and stored
Applied to: Counter Exceeds 30 Containers?
WHEN
The system checks the current cross-reference counter
THEN
If the counter exceeds 30 containers, processing stops to prevent system overload, otherwise processing continues
Context: All inquiry bottom lines have been processed for container cross-references
GIVEN
All inquiry bottom lines have been processed for container cross-references
Applied to: Any Container Cross-References Found?
WHEN
The system evaluates the results of the container cross-reference extraction
THEN
If the first container ID entry is not spaces or low-values, container cross-references are considered found, otherwise none were found
Context: Container cross-references have been found in the inquiry system
GIVEN
Container cross-references have been found in the inquiry system
Applied to: Set First Container as Active Equipment
WHEN
The system needs to establish the active equipment for processing
THEN
The first container ID from the cross-reference table is assigned as the active equipment ID and the container cross-reference status is set to found
Context: Valid container cross-references have been extracted and the first container has been set as active equipment
GIVEN
Valid container cross-references have been extracted and the first container has been set as active equipment
Applied to: Mark Container Cross-Reference as Found
WHEN
The system completes successful container cross-reference processing
THEN
The container cross-reference status is marked as found and the container status is set to found
Context: No valid container cross-references were found during inquiry processing OR the waybill was not found in the inquiry system
GIVEN
No valid container cross-references were found during inquiry processing OR the waybill was not found in the inquiry system
Applied to: Set Container Cross-Reference Not Found
WHEN
The system completes container cross-reference processing without finding valid entries
THEN
The container cross-reference status is set to not found and the container status is set to not found
R-GCX003-cbl-01262 (+9) File: GCX003.cbl Primary Waybill Retrieval Logic Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Primary Waybill Retrieval Logic':
  • Context - a waybill retrieval request is initiated for an equipment id:
    For First Call or Different Equipment ID?:
    When the system checks if this is the first fwcarget call or the current equipment id is different from the previously held equipment id, then the system proceeds with waybill retrieval if either condition is true, otherwise skips the retrieval process.
  • Context - a waybill retrieval is proceeding for a specific equipment id:
    For Set Equipment ID as Current:
    When the system needs to track the current equipment id for future comparison, then the system stores the current equipment id as the held equipment id and marks that this is no longer the first call.
  • Context - the system needs to retrieve waybill information for an equipment:
    For Set Retrieval Criteria:
    When fwcarget parameters are being configured, then the system sets all waybill types except 98 and 99, includes all status types, excludes edi incomplete waybills, includes temporary waybills, excludes corrector waybills, returns lead waybill, and gets latest waybill date.
  • Context - fwcarget parameters are properly configured for an equipment id:
    For Execute FWCARGET Call:
    When the system executes the fwcarget service call, then the system invokes fwcarget service and receives waybill information or error status.
  • Context - fwcarget service call has completed:
    For FWCARGET Error or Not Found?:
    When the system checks the return status from fwcarget, then if fwcarget returned an error or not found status, the system terminates the retrieval loop, otherwise continues with waybill validation.
  • Context - a waybill record has been retrieved successfully from fwcarget:
    For Haulage Right Carrier Empty?:
    When the system checks if the haulage right carrier field is empty or spaces, then if haulage right carrier is empty, the system accepts the waybill and terminates the loop, otherwise continues with additional validation.
  • Context - a waybill record has haulage right carrier populated:
    For EDI Complete Release = 'Y'?:
    When the system checks if edi complete 418 release flag equals 'y', then if edi complete release is 'y', the system accepts the waybill and terminates the loop, otherwise continues with duplicate check.
  • Context - a waybill record does not have edi complete release status:
    For Same FWBX Key as Previous?:
    When the system compares the current fwbx key feedback with the previously stored fwbx key feedback, then if the fwbx keys are identical, the system sets not found status and terminates the loop, otherwise updates the stored key and continues.
  • Context - the current waybill is not acceptable and fwbx key is different from previous:
    For Set Previous Status Waybill Date:
    When the system needs to search for an alternative waybill, then the system sets fwcarget to retrieve previous status waybill date and updates the stored fwbx key feedback.
  • Context - fwcarget has completed processing but no acceptable waybill was found:
    For Execute Inquiry Fallback Logic:
    When the system determines that waybill was not found through primary method, then the system executes inquiry fallback logic to attempt waybill retrieval through alternative database queries.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill retrieval request is initiated for an equipment ID
GIVEN
A waybill retrieval request is initiated for an equipment ID
Applied to: First Call or Different Equipment ID?
WHEN
The system checks if this is the first FWCARGET call OR the current equipment ID is different from the previously held equipment ID
THEN
The system proceeds with waybill retrieval if either condition is true, otherwise skips the retrieval process
Context: A waybill retrieval is proceeding for a specific equipment ID
GIVEN
A waybill retrieval is proceeding for a specific equipment ID
Applied to: Set Equipment ID as Current
WHEN
The system needs to track the current equipment ID for future comparison
THEN
The system stores the current equipment ID as the held equipment ID and marks that this is no longer the first call
Context: The system needs to retrieve waybill information for an equipment
GIVEN
The system needs to retrieve waybill information for an equipment
Applied to: Set Retrieval Criteria
WHEN
FWCARGET parameters are being configured
THEN
The system sets all waybill types except 98 and 99, includes all status types, excludes EDI incomplete waybills, includes temporary waybills, excludes corrector waybills, returns lead waybill, and gets latest waybill date
Context: FWCARGET parameters are properly configured for an equipment ID
GIVEN
FWCARGET parameters are properly configured for an equipment ID
Applied to: Execute FWCARGET Call
WHEN
The system executes the FWCARGET service call
THEN
The system invokes FWCARGET service and receives waybill information or error status
Context: FWCARGET service call has completed
GIVEN
FWCARGET service call has completed
Applied to: FWCARGET Error or Not Found?
WHEN
The system checks the return status from FWCARGET
THEN
If FWCARGET returned an error or not found status, the system terminates the retrieval loop, otherwise continues with waybill validation
Context: A waybill record has been retrieved successfully from FWCARGET
GIVEN
A waybill record has been retrieved successfully from FWCARGET
Applied to: Haulage Right Carrier Empty?
WHEN
The system checks if the haulage right carrier field is empty or spaces
THEN
If haulage right carrier is empty, the system accepts the waybill and terminates the loop, otherwise continues with additional validation
Context: A waybill record has haulage right carrier populated
GIVEN
A waybill record has haulage right carrier populated
Applied to: EDI Complete Release = 'Y'?
WHEN
The system checks if EDI complete 418 release flag equals 'Y'
THEN
If EDI complete release is 'Y', the system accepts the waybill and terminates the loop, otherwise continues with duplicate check
Context: A waybill record does not have EDI complete release status
GIVEN
A waybill record does not have EDI complete release status
Applied to: Same FWBX Key as Previous?
WHEN
The system compares the current FWBX key feedback with the previously stored FWBX key feedback
THEN
If the FWBX keys are identical, the system sets not found status and terminates the loop, otherwise updates the stored key and continues
Context: The current waybill is not acceptable and FWBX key is different from previous
GIVEN
The current waybill is not acceptable and FWBX key is different from previous
Applied to: Set Previous Status Waybill Date
WHEN
The system needs to search for an alternative waybill
THEN
The system sets FWCARGET to retrieve previous status waybill date and updates the stored FWBX key feedback
Context: FWCARGET has completed processing but no acceptable waybill was found
GIVEN
FWCARGET has completed processing but no acceptable waybill was found
Applied to: Execute Inquiry Fallback Logic
WHEN
The system determines that waybill was not found through primary method
THEN
The system executes inquiry fallback logic to attempt waybill retrieval through alternative database queries
R-GCX003-cbl-01272 (+15) File: GCX003.cbl Inquiry System Fallback Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Inquiry System Fallback Processing':
  • Context - equipment waybill lookup has failed in primary system:
    For Primary Waybill System Failed:
    When system determines waybill was not found and container is not found, then initiate inquiry system fallback processing.
  • Context - equipment id is available for lookup:
    For Access Inquiry System FWCIROOT:
    When system accesses fwciroot with equipment car id, then retrieve container inquiry root record or return not found status.
  • Context - container inquiry system has been accessed:
    For Inquiry Root Record Found?:
    When system checks for valid inquiry root record, then continue processing if found, otherwise return waybill not found.
  • Context - valid inquiry root record exists:
    For Extract Road/Station/Waybill Numbers:
    When system processes the inquiry root data, then extract original road number, csc station number, and waybill number for further processing.
  • Context - road number, station number, and waybill number are available:
    For Retrieve Waybill from FWIQROOT:
    When system accesses fwiqroot with these key components, then retrieve waybill inquiry record or return not found status.
  • Context - waybill inquiry system has been accessed:
    For Waybill Found in Inquiry?:
    When system checks for valid waybill inquiry record, then continue processing if found, otherwise return waybill not found.
  • Context - waybill inquiry record contains billing code:
    For Convert Load/Empty Status:
    When billing code equals 'ze', then set equipment status to 'e' for empty, otherwise set to 'l' for loaded.
  • Context - valid waybill inquiry record exists:
    For Map Date and Origin Information:
    When system maps inquiry data to standard format, then transfer road number, waybill number, car id, load/empty status, tofc/cofc indicator, waybill date, and origin station to standard waybill structure.
  • Context - inquiry data has been successfully mapped:
    For Map Inquiry Data to Standard Format:
    When system transfers data to standard format, then populate shipment root structure with all waybill information for downstream processing.
  • Context - valid waybill exists in inquiry system:
    For Retrieve Routing Information:
    When system accesses fwiqinfo with waybill key and routing segment 'b1', then retrieve routing information or continue without routing data.
  • Context - routing information system has been accessed:
    For Routing Info Available?:
    When system checks if routing info fields contain data, then process routing data if available, otherwise complete waybill processing without routing information.
  • Context - routing information contains data:
    For Extract Routing Fields:
    When system parses routing info fields by spaces, then extract individual routing fields with their lengths for further processing.
  • Context - individual routing fields have been extracted:
    For Parse SCAC and Junction Data:
    When system processes each field sequentially, then assign fields to scac codes and junction r260 codes in alternating pattern up to 4 scac entries.
  • Context - scac codes and junction data have been parsed:
    For Build Routing Information Array:
    When system builds routing information structure, then create routing information array with scac and junction pairs for shipment root structure.
  • Context - waybill data has been successfully retrieved and mapped:
    For Return Waybill Data Success:
    When all processing steps complete successfully, then return waybill found status with complete waybill and routing information.
  • Context - waybill lookup has failed in inquiry system:
    For Return Waybill Not Found:
    When either inquiry root record or waybill inquiry record is not found, then return waybill not found status to calling process.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment waybill lookup has failed in primary system
GIVEN
Equipment waybill lookup has failed in primary system
Applied to: Primary Waybill System Failed
WHEN
System determines waybill was not found and container is not found
THEN
Initiate inquiry system fallback processing
Context: Equipment ID is available for lookup
GIVEN
Equipment ID is available for lookup
Applied to: Access Inquiry System FWCIROOT
WHEN
System accesses FWCIROOT with equipment car ID
THEN
Retrieve container inquiry root record or return not found status
Context: Container inquiry system has been accessed
GIVEN
Container inquiry system has been accessed
Applied to: Inquiry Root Record Found?
WHEN
System checks for valid inquiry root record
THEN
Continue processing if found, otherwise return waybill not found
Context: Valid inquiry root record exists
GIVEN
Valid inquiry root record exists
Applied to: Extract Road/Station/Waybill Numbers
WHEN
System processes the inquiry root data
THEN
Extract original road number, CSC station number, and waybill number for further processing
Context: Road number, station number, and waybill number are available
GIVEN
Road number, station number, and waybill number are available
Applied to: Retrieve Waybill from FWIQROOT
WHEN
System accesses FWIQROOT with these key components
THEN
Retrieve waybill inquiry record or return not found status
Context: Waybill inquiry system has been accessed
GIVEN
Waybill inquiry system has been accessed
Applied to: Waybill Found in Inquiry?
WHEN
System checks for valid waybill inquiry record
THEN
Continue processing if found, otherwise return waybill not found
Context: Waybill inquiry record contains billing code
GIVEN
Waybill inquiry record contains billing code
Applied to: Convert Load/Empty Status
WHEN
Billing code equals 'ZE'
THEN
Set equipment status to 'E' for empty, otherwise set to 'L' for loaded
Context: Valid waybill inquiry record exists
GIVEN
Valid waybill inquiry record exists
Applied to: Map Date and Origin Information
WHEN
System maps inquiry data to standard format
THEN
Transfer road number, waybill number, car ID, load/empty status, TOFC/COFC indicator, waybill date, and origin station to standard waybill structure
Context: Inquiry data has been successfully mapped
GIVEN
Inquiry data has been successfully mapped
Applied to: Map Inquiry Data to Standard Format
WHEN
System transfers data to standard format
THEN
Populate shipment root structure with all waybill information for downstream processing
Context: Valid waybill exists in inquiry system
GIVEN
Valid waybill exists in inquiry system
Applied to: Retrieve Routing Information
WHEN
System accesses FWIQINFO with waybill key and routing segment 'B1'
THEN
Retrieve routing information or continue without routing data
Context: Routing information system has been accessed
GIVEN
Routing information system has been accessed
Applied to: Routing Info Available?
WHEN
System checks if routing info fields contain data
THEN
Process routing data if available, otherwise complete waybill processing without routing information
Context: Routing information contains data
GIVEN
Routing information contains data
Applied to: Extract Routing Fields
WHEN
System parses routing info fields by spaces
THEN
Extract individual routing fields with their lengths for further processing
Context: Individual routing fields have been extracted
GIVEN
Individual routing fields have been extracted
Applied to: Parse SCAC and Junction Data
WHEN
System processes each field sequentially
THEN
Assign fields to SCAC codes and junction R260 codes in alternating pattern up to 4 SCAC entries
Context: SCAC codes and junction data have been parsed
GIVEN
SCAC codes and junction data have been parsed
Applied to: Build Routing Information Array
WHEN
System builds routing information structure
THEN
Create routing information array with SCAC and junction pairs for shipment root structure
Context: Waybill data has been successfully retrieved and mapped
GIVEN
Waybill data has been successfully retrieved and mapped
Applied to: Return Waybill Data Success
WHEN
All processing steps complete successfully
THEN
Return waybill found status with complete waybill and routing information
Context: Waybill lookup has failed in inquiry system
GIVEN
Waybill lookup has failed in inquiry system
Applied to: Return Waybill Not Found
WHEN
Either inquiry root record or waybill inquiry record is not found
THEN
Return waybill not found status to calling process
R-GCX003-cbl-01288 (+8) File: GCX003.cbl Cargo Attachment Eligibility Check Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Attachment Eligibility Check':
  • Context - a cargo record exists with bond type classification:
    For Is Cargo Immediate Transport Bond?:
    When the cargo bond type is classified as immediate transport (m1201), then skip cargo attachment and mark for special processing.
  • Context - a cargo record with tr bond status indicator:
    For Is TR Bond Created for IT?:
    When the tr created for it flag equals 'y', then skip cargo attachment and mark for special processing.
  • Context - a cargo record with us-canada-us bond type, empty tr created for it status, and cargo status information:
    For Is Bond Type US-CAN-US? AND Is TR Created for IT Empty? AND Is Cargo Status Release?:
    When the bond type is us-can-us and tr created for it is empty and cargo short description equals release status, then skip cargo attachment and mark for special processing.
  • Context - a cargo record with default bond type, empty tr created for it status, and cargo status information:
    For Is Bond Type Default? AND Is TR Created for IT Empty? AND Is Cargo Status Release?:
    When the bond type is default (m1109) and tr created for it is empty and cargo short description equals release status, then skip cargo attachment and mark for special processing.
  • Context - a cargo record with bond type classification:
    For Is Bond Type Empty Equipment?:
    When the cargo bond type is classified as empty equipment (m1109), then skip cargo attachment and mark for special processing.
  • Context - a cargo record with special manifest status and current station information:
    For Is Special Manifest Original? AND Is Station Woburn PQ?:
    When the cargo has special manifest original status and the current station is woburn pq, then skip cargo attachment and mark for special processing.
    For Is Special Manifest Special? AND Is Station NOT Woburn PQ?:
    When the cargo has special manifest special status and the current station is not woburn pq, then skip cargo attachment and mark for special processing.
  • Context - a cargo record with export bond type, origin-destination country codes, and current station information:
    For Is Bond Type Export? AND Is Origin-Destination US-MX? AND Is Station NOT Laredo TX?:
    When the bond type is export (m1109) and origin-destination codes equal 'usmx' and the current station is not laredo tx, then skip cargo attachment and mark for special processing.
  • Context - a cargo record that has been evaluated against all skip criteria:
    For Attach Cargo to Train:
    When the cargo does not meet any of the skip conditions for special processing, then attach the cargo to the train for standard manifest processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with bond type classification
GIVEN
A cargo record exists with bond type classification
Applied to: Is Cargo Immediate Transport Bond?
WHEN
The cargo bond type is classified as immediate transport (M1201)
THEN
Skip cargo attachment and mark for special processing
Context: A cargo record with TR bond status indicator
GIVEN
A cargo record with TR bond status indicator
Applied to: Is TR Bond Created for IT?
WHEN
The TR created for IT flag equals 'Y'
THEN
Skip cargo attachment and mark for special processing
Context: A cargo record with US-Canada-US bond type, empty TR created for IT status, and cargo status information
GIVEN
A cargo record with US-Canada-US bond type, empty TR created for IT status, and cargo status information
Applied to: Is Bond Type US-CAN-US? AND Is TR Created for IT Empty? AND Is Cargo Status Release?
WHEN
The bond type is US-CAN-US AND TR created for IT is empty AND cargo short description equals release status
THEN
Skip cargo attachment and mark for special processing
Context: A cargo record with default bond type, empty TR created for IT status, and cargo status information
GIVEN
A cargo record with default bond type, empty TR created for IT status, and cargo status information
Applied to: Is Bond Type Default? AND Is TR Created for IT Empty? AND Is Cargo Status Release?
WHEN
The bond type is default (M1109) AND TR created for IT is empty AND cargo short description equals release status
THEN
Skip cargo attachment and mark for special processing
Context: A cargo record with bond type classification
GIVEN
A cargo record with bond type classification
Applied to: Is Bond Type Empty Equipment?
WHEN
The cargo bond type is classified as empty equipment (M1109)
THEN
Skip cargo attachment and mark for special processing
Context: A cargo record with special manifest status and current station information
GIVEN
A cargo record with special manifest status and current station information
Applied to: Is Special Manifest Original? AND Is Station Woburn PQ?
WHEN
The cargo has special manifest original status AND the current station is Woburn PQ
THEN
Skip cargo attachment and mark for special processing
Applied to: Is Special Manifest Special? AND Is Station NOT Woburn PQ?
WHEN
The cargo has special manifest special status AND the current station is NOT Woburn PQ
THEN
Skip cargo attachment and mark for special processing
Context: A cargo record with export bond type, origin-destination country codes, and current station information
GIVEN
A cargo record with export bond type, origin-destination country codes, and current station information
Applied to: Is Bond Type Export? AND Is Origin-Destination US-MX? AND Is Station NOT Laredo TX?
WHEN
The bond type is export (M1109) AND origin-destination codes equal 'USMX' AND the current station is NOT Laredo TX
THEN
Skip cargo attachment and mark for special processing
Context: A cargo record that has been evaluated against all skip criteria
GIVEN
A cargo record that has been evaluated against all skip criteria
Applied to: Attach Cargo to Train
WHEN
The cargo does not meet any of the skip conditions for special processing
THEN
Attach the cargo to the train for standard manifest processing
R-GCX003-cbl-01297 (+18) File: GCX003.cbl Equipment Information Assembly Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Information Assembly':
  • Context - an equipment item is being processed:
    For Equipment Type?:
    When the system evaluates equipment characteristics, then equipment is classified as either container or car type for appropriate processing.
  • Context - equipment is classified as a container:
    For Process Container Equipment:
    When container processing is initiated, then container id is set from equipment id, load/empty indicator is set from shipment root, and container flag is activated with trailer flag if applicable.
  • Context - equipment is classified as a car:
    For Process Car Equipment:
    When car processing is initiated, then car id is set from request equipment id, load/empty indicator is set from request, car flag is activated, and equipment id components are parsed.
  • Context - equipment id and type flags are set:
    For Call Equipment Type Validation Service:
    When equipment type validation is required, then gcccartp service is called with equipment parameters to validate and retrieve equipment type information.
  • Context - equipment type validation service call fails:
    For Generate Equipment Error Message:
    When validation failure is detected, then error message 35 is generated for container validation failure or error message 36 for car validation failure, equipment error flag is set, and processing continues to next equipment.
  • Context - equipment validation is successful:
    For Retrieve Equipment Type Description:
    When equipment type information is needed, then equipment car code is retrieved from validation service, station table is queried for equipment type description, and description is stored in report fields.
  • Context - equipment has a waybill and car code is available:
    For Check Double Stack Container Classification:
    When car code equals 'sk', then equipment is classified as double stack container for traffic counting.
  • Context - equipment is classified as double stack container:
    For Count by Traffic Type - CPRS/CSXT/NS/HAUL:
    When double stack counting service is called, then container count is added to appropriate traffic type counter (cprs, csxt, ns, or haul) based on traffic classification.
  • Context - equipment has an associated waybill:
    For Extract Waybill Routing Information:
    When routing information is needed, then routing information is extracted from shipment root, exclamation marks are replaced with spaces, and routing analysis is prepared.
  • Context - routing information is available from waybill:
    For Analyze Equipment Routing Patterns:
    When routing pattern analysis is performed, then system checks for specific routing patterns including csxt/ns to cprs via det junction and sets appropriate routing indicators.
  • Context - equipment routing information is not available or waybill is not found:
    For Set Empty Equipment Indicator:
    When equipment processing continues, then empty equipment indicator is set to 1 in report fields.
  • Context - equipment type information is available:
    For Equipment Category?:
    When equipment categorization is needed, then equipment is classified as locomotive, container, or car based on car type code.
  • Context - equipment car type is 'lo' or 'et':
    For Count Locomotives:
    When equipment counting is performed, then total locomotive count is incremented by 1.
  • Context - equipment car type is 'cn' (container):
    For Count Loaded/Empty Containers:
    When container counting is performed, then if load indicator is 'l' then loaded container count is incremented, otherwise if load indicator is 'e' then empty container count is incremented.
  • Context - equipment car type is not locomotive or container:
    For Count Loaded/Empty Cars:
    When car counting is performed, then if load indicator is 'l' then loaded car count is incremented, otherwise if load indicator is 'e' then empty car count is incremented.
  • Context - equipment information is assembled:
    For Special Equipment Type?:
    When special equipment evaluation is performed, then equipment is classified as sbu van, conveying car, or regular equipment for appropriate processing.
  • Context - equipment is classified as sbu van unit:
    For Process International Service Unit:
    When load indicator is 'e' (empty), then equipment description is set to 'international service' and processing is completed.
  • Context - equipment is classified as conveying car:
    For Process Conveying Flat Car:
    When conveying car processing is initiated, then equipment description is set to 'conveying flat car' and load indicator is set to 'e'.
  • Context - equipment processing is complete and cargo information is available:
    For Set Equipment Load/Empty Status:
    When final load status determination is needed, then load indicator is set based on cargo presence, equipment type, and special conditions with appropriate status adjustments for empty residue and empty equipment cargo.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed
GIVEN
An equipment item is being processed
Applied to: Equipment Type?
WHEN
The system evaluates equipment characteristics
THEN
Equipment is classified as either container or car type for appropriate processing
Context: Equipment is classified as a container
GIVEN
Equipment is classified as a container
Applied to: Process Container Equipment
WHEN
Container processing is initiated
THEN
Container ID is set from equipment ID, load/empty indicator is set from shipment root, and container flag is activated with trailer flag if applicable
Context: Equipment is classified as a car
GIVEN
Equipment is classified as a car
Applied to: Process Car Equipment
WHEN
Car processing is initiated
THEN
Car ID is set from request equipment ID, load/empty indicator is set from request, car flag is activated, and equipment ID components are parsed
Context: Equipment ID and type flags are set
GIVEN
Equipment ID and type flags are set
Applied to: Call Equipment Type Validation Service
WHEN
Equipment type validation is required
THEN
GCCCARTP service is called with equipment parameters to validate and retrieve equipment type information
Context: Equipment type validation service call fails
GIVEN
Equipment type validation service call fails
Applied to: Generate Equipment Error Message
WHEN
Validation failure is detected
THEN
Error message 35 is generated for container validation failure or error message 36 for car validation failure, equipment error flag is set, and processing continues to next equipment
Context: Equipment validation is successful
GIVEN
Equipment validation is successful
Applied to: Retrieve Equipment Type Description
WHEN
Equipment type information is needed
THEN
Equipment car code is retrieved from validation service, station table is queried for equipment type description, and description is stored in report fields
Context: Equipment has a waybill and car code is available
GIVEN
Equipment has a waybill and car code is available
Applied to: Check Double Stack Container Classification
WHEN
Car code equals 'SK'
THEN
Equipment is classified as double stack container for traffic counting
Context: Equipment is classified as double stack container
GIVEN
Equipment is classified as double stack container
Applied to: Count by Traffic Type - CPRS/CSXT/NS/HAUL
WHEN
Double stack counting service is called
THEN
Container count is added to appropriate traffic type counter (CPRS, CSXT, NS, or HAUL) based on traffic classification
Context: Equipment has an associated waybill
GIVEN
Equipment has an associated waybill
Applied to: Extract Waybill Routing Information
WHEN
Routing information is needed
THEN
Routing information is extracted from shipment root, exclamation marks are replaced with spaces, and routing analysis is prepared
Context: Routing information is available from waybill
GIVEN
Routing information is available from waybill
Applied to: Analyze Equipment Routing Patterns
WHEN
Routing pattern analysis is performed
THEN
System checks for specific routing patterns including CSXT/NS to CPRS via DET junction and sets appropriate routing indicators
Context: Equipment routing information is not available or waybill is not found
GIVEN
Equipment routing information is not available or waybill is not found
Applied to: Set Empty Equipment Indicator
WHEN
Equipment processing continues
THEN
Empty equipment indicator is set to 1 in report fields
Context: Equipment type information is available
GIVEN
Equipment type information is available
Applied to: Equipment Category?
WHEN
Equipment categorization is needed
THEN
Equipment is classified as locomotive, container, or car based on car type code
Context: Equipment car type is 'LO' or 'ET'
GIVEN
Equipment car type is 'LO' or 'ET'
Applied to: Count Locomotives
WHEN
Equipment counting is performed
THEN
Total locomotive count is incremented by 1
Context: Equipment car type is 'CN' (container)
GIVEN
Equipment car type is 'CN' (container)
Applied to: Count Loaded/Empty Containers
WHEN
Container counting is performed
THEN
If load indicator is 'L' then loaded container count is incremented, otherwise if load indicator is 'E' then empty container count is incremented
Context: Equipment car type is not locomotive or container
GIVEN
Equipment car type is not locomotive or container
Applied to: Count Loaded/Empty Cars
WHEN
Car counting is performed
THEN
If load indicator is 'L' then loaded car count is incremented, otherwise if load indicator is 'E' then empty car count is incremented
Context: Equipment information is assembled
GIVEN
Equipment information is assembled
Applied to: Special Equipment Type?
WHEN
Special equipment evaluation is performed
THEN
Equipment is classified as SBU van, conveying car, or regular equipment for appropriate processing
Context: Equipment is classified as SBU van unit
GIVEN
Equipment is classified as SBU van unit
Applied to: Process International Service Unit
WHEN
Load indicator is 'E' (empty)
THEN
Equipment description is set to 'INTERNATIONAL SERVICE' and processing is completed
Context: Equipment is classified as conveying car
GIVEN
Equipment is classified as conveying car
Applied to: Process Conveying Flat Car
WHEN
Conveying car processing is initiated
THEN
Equipment description is set to 'CONVEYING FLAT CAR' and load indicator is set to 'E'
Context: Equipment processing is complete and cargo information is available
GIVEN
Equipment processing is complete and cargo information is available
Applied to: Set Equipment Load/Empty Status
WHEN
Final load status determination is needed
THEN
Load indicator is set based on cargo presence, equipment type, and special conditions with appropriate status adjustments for empty residue and empty equipment cargo
R-GCX003-cbl-01316 (+9) File: GCX003.cbl Cargo Information Integration Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Information Integration':
  • Context - a cargo record with bond type code is being processed:
    For Bond Type Classification:
    When the system evaluates the bond type code from the cargo record, then the system should classify the bond as it (immediate transport), te (transport export), tr (transit), ie (immediate export), or mt (marine transport) and apply corresponding processing rules.
  • Context - a cargo record is being processed for bond information:
    For Extract Entry Number for Bond Display:
    When the system checks for entry number or in-bond control number availability, then the system should extract the entry number if available, otherwise use the in-bond control number, or set to spaces if neither is available.
  • Context - a cargo record with load/empty status code is being processed:
    For Process Load/Empty Status Code:
    When the system extracts the vid10 load/empty code from the cargo record, then the system should set the equipment load/empty indicator and apply corresponding validation rules based on the status.
  • Context - a cargo record is being evaluated for empty equipment status:
    For Process Empty Residue Handling:
    When the cargo has bol type code indicating empty equipment or empty residue, then the system should classify the cargo as empty, update load/empty indicators, adjust equipment counts, and set appropriate display information.
  • Context - a cargo record is being evaluated for special manifest requirements:
    For Set Special Manifest Flags:
    When the cargo has special manifest origin flag or special manifest special flag set, then the system should set corresponding special manifest processing flags (it found, te found, tr found, or usmx 88 found) based on cargo type and routing.
  • Context - a cargo record with bond type and control numbers is being processed:
    For Process AMS Bond Information:
    When the system formats cargo information for display, then the system should format bond information as 'ams [bond_type] [bond_number]' for it/ie types or 'ams 7512 [bond_type] [bond_number]' for te/tr/mt types, or 'ppr 7512 15 us-ca-us' for bol type 15.
  • Context - a cargo record with status indicators is being processed:
    For Validate Cargo Status Codes:
    When the system checks cargo status codes for pending, deleted, or error conditions, then the system should generate appropriate error messages (message 16) if cargo is in pending, deleted, or error status.
  • Context - a cargo record is being processed at laredo tx station with segment 02 data:
    For Process FEN Reference Numbers:
    When the system searches for fen and kcm reference number qualifiers in the segment data, then the system should set fen found flag if fen qualifier exists with non-blank reference number, and kcm found flag if kcm qualifier exists with non-blank reference number.
  • Context - a cargo record with haulage information is being processed for send action:
    For Set Haulage Automation Flags:
    When the system determines port type (automated or paper) and current haulage automation status, then the system should update haulage automation flag to 'n' if automated haulage at paper port, or to 'y' if manual haulage at automated port.
  • Context - a cargo record is being processed for condition information:
    For Extract Cargo Condition Response Code:
    When the system extracts the m1011 condition response code from the cargo record, then the system should store the condition response code in the report working storage for equipment tracking.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with bond type code is being processed
GIVEN
A cargo record with bond type code is being processed
Applied to: Bond Type Classification
WHEN
The system evaluates the bond type code from the cargo record
THEN
The system should classify the bond as IT (Immediate Transport), TE (Transport Export), TR (Transit), IE (Immediate Export), or MT (Marine Transport) and apply corresponding processing rules
Context: A cargo record is being processed for bond information
GIVEN
A cargo record is being processed for bond information
Applied to: Extract Entry Number for Bond Display
WHEN
The system checks for entry number or in-bond control number availability
THEN
The system should extract the entry number if available, otherwise use the in-bond control number, or set to spaces if neither is available
Context: A cargo record with load/empty status code is being processed
GIVEN
A cargo record with load/empty status code is being processed
Applied to: Process Load/Empty Status Code
WHEN
The system extracts the VID10 load/empty code from the cargo record
THEN
The system should set the equipment load/empty indicator and apply corresponding validation rules based on the status
Context: A cargo record is being evaluated for empty equipment status
GIVEN
A cargo record is being evaluated for empty equipment status
Applied to: Process Empty Residue Handling
WHEN
The cargo has BOL type code indicating empty equipment or empty residue
THEN
The system should classify the cargo as empty, update load/empty indicators, adjust equipment counts, and set appropriate display information
Context: A cargo record is being evaluated for special manifest requirements
GIVEN
A cargo record is being evaluated for special manifest requirements
Applied to: Set Special Manifest Flags
WHEN
The cargo has special manifest origin flag or special manifest special flag set
THEN
The system should set corresponding special manifest processing flags (IT found, TE found, TR found, or USMX 88 found) based on cargo type and routing
Context: A cargo record with bond type and control numbers is being processed
GIVEN
A cargo record with bond type and control numbers is being processed
Applied to: Process AMS Bond Information
WHEN
The system formats cargo information for display
THEN
The system should format bond information as 'AMS [bond_type] [bond_number]' for IT/IE types or 'AMS 7512 [bond_type] [bond_number]' for TE/TR/MT types, or 'PPR 7512 15 US-CA-US' for BOL type 15
Context: A cargo record with status indicators is being processed
GIVEN
A cargo record with status indicators is being processed
Applied to: Validate Cargo Status Codes
WHEN
The system checks cargo status codes for pending, deleted, or error conditions
THEN
The system should generate appropriate error messages (message 16) if cargo is in pending, deleted, or error status
Context: A cargo record is being processed at Laredo TX station with segment 02 data
GIVEN
A cargo record is being processed at Laredo TX station with segment 02 data
Applied to: Process FEN Reference Numbers
WHEN
The system searches for FEN and KCM reference number qualifiers in the segment data
THEN
The system should set FEN found flag if FEN qualifier exists with non-blank reference number, and KCM found flag if KCM qualifier exists with non-blank reference number
Context: A cargo record with haulage information is being processed for send action
GIVEN
A cargo record with haulage information is being processed for send action
Applied to: Set Haulage Automation Flags
WHEN
The system determines port type (automated or paper) and current haulage automation status
THEN
The system should update haulage automation flag to 'N' if automated haulage at paper port, or to 'Y' if manual haulage at automated port
Context: A cargo record is being processed for condition information
GIVEN
A cargo record is being processed for condition information
Applied to: Extract Cargo Condition Response Code
WHEN
The system extracts the M1011 condition response code from the cargo record
THEN
The system should store the condition response code in the report working storage for equipment tracking
R-GCX003-cbl-01326 (+5) File: GCX003.cbl IT Bond Special Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'IT Bond Special Processing':
  • Context - an it bond cargo is detected for processing:
    For IT Bond Already Created for Train?:
    When the system checks if tr (transport record) has already been created for it bond (gcusrt-tr-created-for-it equals 'y'), then skip it bond processing and continue with next equipment item.
  • Context - an it bond cargo requires processing and no tr has been created yet:
    For Request Action Type?:
    When the request action is evaluated (req-action-send vs req-action-report), then route to either authorization check for send actions or generate report-only message for report actions.
  • Context - a send action is requested for it bond processing:
    For User Authorized for Special Manifests?:
    When the system checks user authorization flag (ws-user-not-auth-4-spcl-manif), then if user is not authorized, generate authorization error message (43), otherwise proceed with special manifest creation.
    For Generate Authorization Error Message:
    When user is not authorized for special manifests (ws-user-not-auth-4-spcl-manif is true), then generate message 43 (authorization error) and add equipment line to report without creating special manifest.
  • Context - user is authorized for special manifests and request action is send:
    For Generate Special Manifest Creation Message:
    When it bond processing requires special manifest creation, then generate message 23 (special manifest creation), set it export spawn flag, and initiate special manifest creation process.
  • Context - it bond cargo requires processing and no tr has been created:
    For Generate Report-Only Message:
    When the request action is report (not send), then generate message 24 (report-only notification) and add equipment line to report.
👨‍💻 Technical ACs (Gherkin)
Context: An IT bond cargo is detected for processing
GIVEN
An IT bond cargo is detected for processing
Applied to: IT Bond Already Created for Train?
WHEN
The system checks if TR (Transport Record) has already been created for IT bond (GCUSRT-TR-CREATED-FOR-IT equals 'Y')
THEN
Skip IT bond processing and continue with next equipment item
Context: An IT bond cargo requires processing and no TR has been created yet
GIVEN
An IT bond cargo requires processing and no TR has been created yet
Applied to: Request Action Type?
WHEN
The request action is evaluated (REQ-ACTION-SEND vs REQ-ACTION-REPORT)
THEN
Route to either authorization check for SEND actions or generate report-only message for REPORT actions
Context: A SEND action is requested for IT bond processing
GIVEN
A SEND action is requested for IT bond processing
Applied to: User Authorized for Special Manifests?
WHEN
The system checks user authorization flag (WS-USER-NOT-AUTH-4-SPCL-MANIF)
THEN
If user is not authorized, generate authorization error message (43), otherwise proceed with special manifest creation
Applied to: Generate Authorization Error Message
WHEN
User is not authorized for special manifests (WS-USER-NOT-AUTH-4-SPCL-MANIF is true)
THEN
Generate message 43 (authorization error) and add equipment line to report without creating special manifest
Context: User is authorized for special manifests and request action is SEND
GIVEN
User is authorized for special manifests and request action is SEND
Applied to: Generate Special Manifest Creation Message
WHEN
IT bond processing requires special manifest creation
THEN
Generate message 23 (special manifest creation), set IT export spawn flag, and initiate special manifest creation process
Context: IT bond cargo requires processing and no TR has been created
GIVEN
IT bond cargo requires processing and no TR has been created
Applied to: Generate Report-Only Message
WHEN
The request action is REPORT (not SEND)
THEN
Generate message 24 (report-only notification) and add equipment line to report
R-GCX003-cbl-01332 (+21) File: GCX003.cbl TE Bond Port Change Processing Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'TE Bond Port Change Processing':
  • Context - a cargo record is being processed for port change validation:
    For Cargo Found with TE Bond Type?:
    When the system checks if cargo exists and has transport export (te) bond type, then processing continues only if cargo is found and bond type is te, otherwise port change processing is skipped.
    For Is TE Bond Cargo?:
    When the system checks the cargo's in-bond type code, then if the cargo is not te (transport export) bond type, skip port change processing and exit.
  • Context - a te bond cargo is being evaluated for port change:
    For TR Created for IT = Spaces?:
    When the system checks the tr created for it field, then port change processing continues only if tr created for it field is empty (spaces), otherwise processing is skipped.
  • Context - a te bond cargo with empty tr created for it field is being processed:
    For Cargo Status ≠ Export Status?:
    When the system compares cargo short description with export status value, then port change processing continues only if cargo status does not equal export status, otherwise processing is skipped.
  • Context - a te bond cargo that meets previous validation criteria is being processed:
    For Cargo Billed as CPRS?:
    When the system checks if cargo is billed as cprs, then port change processing continues only if cargo is billed as cprs, otherwise processing is skipped.
  • Context - a te bond cargo that is billed as cprs is being processed:
    For Location ID1 ≠ Current Station?:
    When the system compares cargo location id1 with current station code, then port change processing is triggered only if location id1 does not match current station code, otherwise processing is skipped.
  • Context - a te bond cargo requires port change processing due to location mismatch:
    For Request Action = REPORT?:
    When the request action is report, then generate port change warning message (message 19) with station information and add to report without creating special manifest.
  • Context - a te bond cargo requires port change processing and request action is not report:
    For Request Action = SEND?:
    When the system checks if request action is send, then proceed to authorization validation if action is send, otherwise skip port change processing.
  • Context - a te bond cargo requires port change processing and request action is send:
    For User Authorized for Special Manifests?:
    When the system checks user authorization for special manifests, then if user is not authorized, generate authorization error message (message 43) and add to report; if authorized, proceed with port change notification.
  • Context - a te bond cargo requires port change and user is authorized for special manifests:
    For Generate Port Change Notification Message:
    When the system generates port change notification, then create port change notification message (message 20) and add to report.
  • Context - port change notification has been generated for authorized user:
    For Set Port Change Spawn Flag:
    When the system sets processing flags, then set port change spawn flag to true to trigger special manifest creation.
  • Context - port change spawn flag has been set for te bond cargo:
    For Create Special Manifest Request:
    When the system creates special manifest request, then execute special manifest creation process (z870-create-special-manifest) to generate required documentation for port change.
  • Context - a te bond cargo is being processed for port change:
    For TR Created for IT = Spaces?:
    When the system checks if a tr record was previously created for it purposes, then if tr was already created for it (field is not spaces), skip port change processing and exit.
  • Context - a te bond cargo with no tr created for it is being processed:
    For Cargo Status ≠ Export?:
    When the system checks the cargo's short description status, then if the cargo status equals export status, skip port change processing and exit.
  • Context - a te bond cargo that is not in export status and has no tr created for it:
    For Is CPRS Bill?:
    When the system checks if the cargo is billed as cprs, then if the cargo is not billed as cprs, skip port change processing and exit.
  • Context - a te bond cargo that is cprs billed and meets all previous validation criteria:
    For Location ID1 ≠ Current Port?:
    When the system compares the cargo's location id1 with the current station crossing port code, then if the locations match, skip port change processing and exit; if they differ, proceed with port change handling.
  • Context - a port location mismatch is detected for te bond cargo:
    For Generate Port Change Warning Message:
    When the request action is set to report, then generate message nineteen with the current station crossing port code and add the report line to output.
  • Context - a port location mismatch is detected and the request action is send:
    For User Authorized for Special Manifest?:
    When the system checks if the user is authorized for special manifest creation, then if not authorized, generate authorization error message and exit; if authorized, proceed with port change processing.
  • Context - a user attempts to process a port change with send action:
    For Generate Authorization Error Message:
    When the user is not authorized for special manifest creation, then generate message forty-three, add the report line to output, and exit port change processing.
  • Context - an authorized user is processing a port change with send action:
    For Generate Port Change Processing Message:
    When all validation criteria are met for port change processing, then generate message twenty, add the report line to output, and prepare for special manifest creation.
  • Context - port change processing message has been generated for authorized user:
    For Set Port Change Spawn Flag:
    When the system prepares to create a special manifest for the port change, then set the port change spawn flag to true to trigger special manifest creation.
  • Context - the port change spawn flag has been set to true:
    For Create Special Manifest for Port Change:
    When the system needs to create a special manifest for the port change, then call the special manifest creation procedure to handle the port change scenario.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for port change validation
GIVEN
A cargo record is being processed for port change validation
Applied to: Cargo Found with TE Bond Type?
WHEN
The system checks if cargo exists and has Transport Export (TE) bond type
THEN
Processing continues only if cargo is found and bond type is TE, otherwise port change processing is skipped
Applied to: Is TE Bond Cargo?
WHEN
The system checks the cargo's in-bond type code
THEN
If the cargo is not TE (Transport Export) bond type, skip port change processing and exit
Context: A TE bond cargo is being evaluated for port change
GIVEN
A TE bond cargo is being evaluated for port change
Applied to: TR Created for IT = Spaces?
WHEN
The system checks the TR Created for IT field
THEN
Port change processing continues only if TR Created for IT field is empty (spaces), otherwise processing is skipped
Context: A TE bond cargo with empty TR Created for IT field is being processed
GIVEN
A TE bond cargo with empty TR Created for IT field is being processed
Applied to: Cargo Status ≠ Export Status?
WHEN
The system compares cargo short description with export status value
THEN
Port change processing continues only if cargo status does not equal export status, otherwise processing is skipped
Context: A TE bond cargo that meets previous validation criteria is being processed
GIVEN
A TE bond cargo that meets previous validation criteria is being processed
Applied to: Cargo Billed as CPRS?
WHEN
The system checks if cargo is billed as CPRS
THEN
Port change processing continues only if cargo is billed as CPRS, otherwise processing is skipped
Context: A TE bond cargo that is billed as CPRS is being processed
GIVEN
A TE bond cargo that is billed as CPRS is being processed
Applied to: Location ID1 ≠ Current Station?
WHEN
The system compares cargo Location ID1 with current station code
THEN
Port change processing is triggered only if Location ID1 does not match current station code, otherwise processing is skipped
Context: A TE bond cargo requires port change processing due to location mismatch
GIVEN
A TE bond cargo requires port change processing due to location mismatch
Applied to: Request Action = REPORT?
WHEN
The request action is REPORT
THEN
Generate port change warning message (Message 19) with station information and add to report without creating special manifest
Context: A TE bond cargo requires port change processing and request action is not REPORT
GIVEN
A TE bond cargo requires port change processing and request action is not REPORT
Applied to: Request Action = SEND?
WHEN
The system checks if request action is SEND
THEN
Proceed to authorization validation if action is SEND, otherwise skip port change processing
Context: A TE bond cargo requires port change processing and request action is SEND
GIVEN
A TE bond cargo requires port change processing and request action is SEND
Applied to: User Authorized for Special Manifests?
WHEN
The system checks user authorization for special manifests
THEN
If user is not authorized, generate authorization error message (Message 43) and add to report; if authorized, proceed with port change notification
Context: A TE bond cargo requires port change and user is authorized for special manifests
GIVEN
A TE bond cargo requires port change and user is authorized for special manifests
Applied to: Generate Port Change Notification Message
WHEN
The system generates port change notification
THEN
Create port change notification message (Message 20) and add to report
Context: Port change notification has been generated for authorized user
GIVEN
Port change notification has been generated for authorized user
Applied to: Set Port Change Spawn Flag
WHEN
The system sets processing flags
THEN
Set port change spawn flag to TRUE to trigger special manifest creation
Context: Port change spawn flag has been set for TE bond cargo
GIVEN
Port change spawn flag has been set for TE bond cargo
Applied to: Create Special Manifest Request
WHEN
The system creates special manifest request
THEN
Execute special manifest creation process (Z870-CREATE-SPECIAL-MANIFEST) to generate required documentation for port change
Context: A TE bond cargo is being processed for port change
GIVEN
A TE bond cargo is being processed for port change
Applied to: TR Created for IT = Spaces?
WHEN
The system checks if a TR record was previously created for IT purposes
THEN
If TR was already created for IT (field is not spaces), skip port change processing and exit
Context: A TE bond cargo with no TR created for IT is being processed
GIVEN
A TE bond cargo with no TR created for IT is being processed
Applied to: Cargo Status ≠ Export?
WHEN
The system checks the cargo's short description status
THEN
If the cargo status equals export status, skip port change processing and exit
Context: A TE bond cargo that is not in export status and has no TR created for IT
GIVEN
A TE bond cargo that is not in export status and has no TR created for IT
Applied to: Is CPRS Bill?
WHEN
The system checks if the cargo is billed as CPRS
THEN
If the cargo is not billed as CPRS, skip port change processing and exit
Context: A TE bond cargo that is CPRS billed and meets all previous validation criteria
GIVEN
A TE bond cargo that is CPRS billed and meets all previous validation criteria
Applied to: Location ID1 ≠ Current Port?
WHEN
The system compares the cargo's location ID1 with the current station crossing port code
THEN
If the locations match, skip port change processing and exit; if they differ, proceed with port change handling
Context: A port location mismatch is detected for TE bond cargo
GIVEN
A port location mismatch is detected for TE bond cargo
Applied to: Generate Port Change Warning Message
WHEN
The request action is set to REPORT
THEN
Generate message nineteen with the current station crossing port code and add the report line to output
Context: A port location mismatch is detected and the request action is SEND
GIVEN
A port location mismatch is detected and the request action is SEND
Applied to: User Authorized for Special Manifest?
WHEN
The system checks if the user is authorized for special manifest creation
THEN
If not authorized, generate authorization error message and exit; if authorized, proceed with port change processing
Context: A user attempts to process a port change with send action
GIVEN
A user attempts to process a port change with send action
Applied to: Generate Authorization Error Message
WHEN
The user is not authorized for special manifest creation
THEN
Generate message forty-three, add the report line to output, and exit port change processing
Context: An authorized user is processing a port change with send action
GIVEN
An authorized user is processing a port change with send action
Applied to: Generate Port Change Processing Message
WHEN
All validation criteria are met for port change processing
THEN
Generate message twenty, add the report line to output, and prepare for special manifest creation
Context: Port change processing message has been generated for authorized user
GIVEN
Port change processing message has been generated for authorized user
Applied to: Set Port Change Spawn Flag
WHEN
The system prepares to create a special manifest for the port change
THEN
Set the port change spawn flag to true to trigger special manifest creation
Context: The port change spawn flag has been set to true
GIVEN
The port change spawn flag has been set to true
Applied to: Create Special Manifest for Port Change
WHEN
The system needs to create a special manifest for the port change
THEN
Call the special manifest creation procedure to handle the port change scenario
R-GCX003-cbl-01343 (+19) File: GCX003.cbl TR Bond Diversion Processing Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'TR Bond Diversion Processing':
  • Context - a cargo record is being processed for tr bond diversion:
    For Cargo Found with TR Bond Type?:
    When the system checks if cargo exists and has tr bond type, then processing continues only if cargo is found and bond type is tr, otherwise diversion processing is skipped.
  • Context - cargo with tr bond type exists:
    For TR Created for IT = Spaces?:
    When the system checks the tr created for it field, then diversion processing continues only if tr created for it field is spaces (not already created), otherwise processing is skipped.
  • Context - cargo with tr bond type exists and tr has not been created for it:
    For Cargo Status = Release?:
    When the system checks the cargo short description status, then diversion processing continues only if cargo status equals release status, otherwise processing is skipped.
  • Context - cargo qualifies for tr bond diversion processing:
    For Request Action Type?:
    When the system evaluates the request action type, then if action is report, generate report message; if action is send, proceed to authorization check.
  • Context - cargo qualifies for tr bond diversion and request action is report:
    For Generate Message 18 - TR Bond Diversion Report:
    When the system processes the diversion for reporting, then message 18 is generated indicating tr bond diversion detected and added to report lines.
  • Context - cargo qualifies for tr bond diversion and request action is send:
    For User Authorized for Special Manifest?:
    When the system checks user authorization for special manifest creation, then if user is not authorized, generate error message 43; if authorized, proceed with manifest creation.
  • Context - user attempts to send tr bond diversion but lacks special manifest authorization:
    For Generate Message 43 - Not Authorized Error:
    When the system validates user permissions, then message 43 is generated indicating user is not authorized for special manifest creation and processing continues without manifest creation.
  • Context - user is authorized to create special manifests for tr bond diversion:
    For Generate Message 23 - TR Bond Diversion Send:
    When the system processes the send request, then message 23 is generated confirming tr bond diversion will be sent and special manifest creation is initiated.
  • Context - authorized tr bond diversion send request is being processed:
    For Set Detour Spawn Flag:
    When the system prepares for special manifest creation, then detour spawn flag is set to trigger subsequent special manifest processing workflow.
  • Context - detour spawn flag is set for tr bond diversion:
    For Create Special Manifest for TR Diversion:
    When the system initiates special manifest creation, then special manifest creation process is invoked to handle the tr bond diversion with appropriate cargo and equipment details.
  • Context - a cargo record is being processed for detour evaluation:
    For Cargo Found with TR Bond Type?:
    When the system checks the cargo bond type code, then if cargo has bond type 'us-can-us' and is not flagged with special usmx tr processing, proceed with tr bond detour processing, otherwise skip tr bond processing.
  • Context - cargo with tr bond type is being evaluated for detour processing:
    For TR Created for IT Flag = Spaces?:
    When the system checks the tr created for it flag, then if the tr created for it flag is blank (spaces), continue with tr bond detour processing, otherwise skip processing as tr already exists.
  • Context - tr bond cargo with blank tr created flag is being processed:
    For Cargo Status = Release?:
    When the system compares the cargo short description with the release status constant, then if cargo short description equals the release status value, proceed with action-based processing, otherwise skip tr bond detour processing.
  • Context - tr bond cargo with release status is ready for detour processing:
    For Request Action Type?:
    When the system evaluates the request action type, then if action is report, generate warning message 18 for tr bond detour detection; if action is send, check user authorization for special manifests.
  • Context - a send request requires tr bond detour processing:
    For User Authorized for Special Manifests?:
    When the system checks if user is authorized for special manifest creation, then if user is not authorized for special manifests, generate error message 43 for unauthorized access; if authorized, proceed with special manifest creation.
  • Context - request action is report and tr bond detour conditions are met:
    For Generate Warning Message 18:
    When the system processes the tr bond detour for reporting, then generate warning message 18 indicating tr bond detour detected and add report line to output.
  • Context - a send request requires special manifest creation but user lacks authorization:
    For Generate Error Message 43:
    When the system attempts to create a special manifest, then generate error message 43 for user not authorized for special manifests and add to report output.
  • Context - user is authorized for special manifests and send action is requested:
    For Generate Information Message 23:
    When the system creates a tr bond special manifest, then generate information message 23 indicating tr bond special manifest created, set detour spawn flag, and add report line to output.
  • Context - tr bond special manifest creation is authorized and initiated:
    For Set Detour Spawn Flag:
    When the system prepares for special manifest processing, then set the detour spawn flag to true to trigger subsequent special manifest creation workflow.
  • Context - detour spawn flag is set for tr bond processing:
    For Create Special Manifest Entry:
    When the system creates the special manifest entry, then call special manifest creation procedure to generate appropriate manifest entry for the tr bond detour scenario.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for TR bond diversion
GIVEN
A cargo record is being processed for TR bond diversion
Applied to: Cargo Found with TR Bond Type?
WHEN
The system checks if cargo exists and has TR bond type
THEN
Processing continues only if cargo is found and bond type is TR, otherwise diversion processing is skipped
Context: Cargo with TR bond type exists
GIVEN
Cargo with TR bond type exists
Applied to: TR Created for IT = Spaces?
WHEN
The system checks the TR created for IT field
THEN
Diversion processing continues only if TR created for IT field is spaces (not already created), otherwise processing is skipped
Context: Cargo with TR bond type exists and TR has not been created for IT
GIVEN
Cargo with TR bond type exists and TR has not been created for IT
Applied to: Cargo Status = Release?
WHEN
The system checks the cargo short description status
THEN
Diversion processing continues only if cargo status equals release status, otherwise processing is skipped
Context: Cargo qualifies for TR bond diversion processing
GIVEN
Cargo qualifies for TR bond diversion processing
Applied to: Request Action Type?
WHEN
The system evaluates the request action type
THEN
If action is REPORT, generate report message; if action is SEND, proceed to authorization check
Context: Cargo qualifies for TR bond diversion and request action is REPORT
GIVEN
Cargo qualifies for TR bond diversion and request action is REPORT
Applied to: Generate Message 18 - TR Bond Diversion Report
WHEN
The system processes the diversion for reporting
THEN
Message 18 is generated indicating TR bond diversion detected and added to report lines
Context: Cargo qualifies for TR bond diversion and request action is SEND
GIVEN
Cargo qualifies for TR bond diversion and request action is SEND
Applied to: User Authorized for Special Manifest?
WHEN
The system checks user authorization for special manifest creation
THEN
If user is not authorized, generate error message 43; if authorized, proceed with manifest creation
Context: User attempts to send TR bond diversion but lacks special manifest authorization
GIVEN
User attempts to send TR bond diversion but lacks special manifest authorization
Applied to: Generate Message 43 - Not Authorized Error
WHEN
The system validates user permissions
THEN
Message 43 is generated indicating user is not authorized for special manifest creation and processing continues without manifest creation
Context: User is authorized to create special manifests for TR bond diversion
GIVEN
User is authorized to create special manifests for TR bond diversion
Applied to: Generate Message 23 - TR Bond Diversion Send
WHEN
The system processes the send request
THEN
Message 23 is generated confirming TR bond diversion will be sent and special manifest creation is initiated
Context: Authorized TR bond diversion send request is being processed
GIVEN
Authorized TR bond diversion send request is being processed
Applied to: Set Detour Spawn Flag
WHEN
The system prepares for special manifest creation
THEN
Detour spawn flag is set to trigger subsequent special manifest processing workflow
Context: Detour spawn flag is set for TR bond diversion
GIVEN
Detour spawn flag is set for TR bond diversion
Applied to: Create Special Manifest for TR Diversion
WHEN
The system initiates special manifest creation
THEN
Special manifest creation process is invoked to handle the TR bond diversion with appropriate cargo and equipment details
Context: A cargo record is being processed for detour evaluation
GIVEN
A cargo record is being processed for detour evaluation
Applied to: Cargo Found with TR Bond Type?
WHEN
The system checks the cargo bond type code
THEN
If cargo has bond type 'US-CAN-US' and is not flagged with special USMX TR processing, proceed with TR bond detour processing, otherwise skip TR bond processing
Context: Cargo with TR bond type is being evaluated for detour processing
GIVEN
Cargo with TR bond type is being evaluated for detour processing
Applied to: TR Created for IT Flag = Spaces?
WHEN
The system checks the TR created for IT flag
THEN
If the TR created for IT flag is blank (spaces), continue with TR bond detour processing, otherwise skip processing as TR already exists
Context: TR bond cargo with blank TR created flag is being processed
GIVEN
TR bond cargo with blank TR created flag is being processed
Applied to: Cargo Status = Release?
WHEN
The system compares the cargo short description with the release status constant
THEN
If cargo short description equals the release status value, proceed with action-based processing, otherwise skip TR bond detour processing
Context: TR bond cargo with release status is ready for detour processing
GIVEN
TR bond cargo with release status is ready for detour processing
Applied to: Request Action Type?
WHEN
The system evaluates the request action type
THEN
If action is REPORT, generate warning message 18 for TR bond detour detection; if action is SEND, check user authorization for special manifests
Context: A SEND request requires TR bond detour processing
GIVEN
A SEND request requires TR bond detour processing
Applied to: User Authorized for Special Manifests?
WHEN
The system checks if user is authorized for special manifest creation
THEN
If user is not authorized for special manifests, generate error message 43 for unauthorized access; if authorized, proceed with special manifest creation
Context: Request action is REPORT and TR bond detour conditions are met
GIVEN
Request action is REPORT and TR bond detour conditions are met
Applied to: Generate Warning Message 18
WHEN
The system processes the TR bond detour for reporting
THEN
Generate warning message 18 indicating TR bond detour detected and add report line to output
Context: A SEND request requires special manifest creation but user lacks authorization
GIVEN
A SEND request requires special manifest creation but user lacks authorization
Applied to: Generate Error Message 43
WHEN
The system attempts to create a special manifest
THEN
Generate error message 43 for user not authorized for special manifests and add to report output
Context: User is authorized for special manifests and SEND action is requested
GIVEN
User is authorized for special manifests and SEND action is requested
Applied to: Generate Information Message 23
WHEN
The system creates a TR bond special manifest
THEN
Generate information message 23 indicating TR bond special manifest created, set detour spawn flag, and add report line to output
Context: TR bond special manifest creation is authorized and initiated
GIVEN
TR bond special manifest creation is authorized and initiated
Applied to: Set Detour Spawn Flag
WHEN
The system prepares for special manifest processing
THEN
Set the detour spawn flag to true to trigger subsequent special manifest creation workflow
Context: Detour spawn flag is set for TR bond processing
GIVEN
Detour spawn flag is set for TR bond processing
Applied to: Create Special Manifest Entry
WHEN
The system creates the special manifest entry
THEN
Call special manifest creation procedure to generate appropriate manifest entry for the TR bond detour scenario
R-GCX003-cbl-01353 (+7) File: GCX003.cbl Special Manifest Authorization Check Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Manifest Authorization Check':
  • Context - a user is processing a non-aei train request and user security check is complete:
    For Check User Special Manifest Authorization Flag:
    When the system checks the user's special manifest authorization flag in the user security table, then if the user's special manifest flag is not 's' and the request is not an aei train send, then set the user not authorized for special manifest flag to true.
  • Context - a user is not authorized for special manifests and the action type is send and there are no existing errors:
    For Generate Authorization Error Message:
    When the system processes it bond cargo that requires special manifest creation or processes te bond cargo requiring port change or processes tr/default bond cargo requiring detour processing, then generate error message 43 indicating user is not authorized for special manifest operations and add the message to the report.
  • Context - a train request is being processed:
    For User Authorized for Special Manifests?:
    When the request type equals the aei request type constant, then set aei train send flag to yes and bypass special manifest authorization checks.
  • Context - cargo is found with it bond type and cargo is not already created for it and cargo does not have special manifest origin flag set:
    For Bond Type Requires Special Manifest?:
    When the system processes the cargo for special manifest requirements, then if user is authorized for special manifests or action is not send, then create special manifest and generate message 23 or 24, otherwise generate authorization error message 43.
  • Context - cargo has te bond type and cargo is not created for it and cargo location does not match train crossing port and user is processing the cargo:
    For Action Type is SEND?:
    When the action type is send and user is not authorized for special manifests, then generate authorization error message 43 and do not create port change manifest, otherwise if action is send and user is authorized, generate message 20 and create port change spawn.
  • Context - cargo has us-canada-us bond type and cargo is not created for it and cargo has release status and cargo does not have special tr flag:
    For Allow Special Manifest Creation:
    When the action type is send and user is not authorized for special manifests, then generate authorization error message 43 and do not create detour manifest, otherwise if action is send and user is authorized, generate message 23 and create detour spawn.
  • Context - cargo has default bond type and cargo is not created for it and cargo does not have special manifest origin flag:
    For Continue Processing:
    When cargo has release status and action type is send and user is not authorized for special manifests, then generate authorization error message 43 and do not create detour manifest, otherwise if cargo has release status and action is send and user is authorized, generate message 23 and create detour spawn, or if cargo does not have release status, generate message 31.
  • Context - cargo has export bond type and cargo does not have special 88 flag and origin-destination country codes are us-mexico and train crossing port is not laredo texas station:
    For End Authorization Check:
    When cargo does not have special manifest flag and action type is send and user is not authorized for special manifests, then generate authorization error message 43 and do not create special manifest, otherwise if action is send and user is authorized, generate message 23 and create 88-tr detour spawn, or if cargo has special manifest flag, generate message 31.
👨‍💻 Technical ACs (Gherkin)
Context: A user is processing a non-AEI train request and user security check is complete
GIVEN
A user is processing a non-AEI train request and user security check is complete
Applied to: Check User Special Manifest Authorization Flag
WHEN
The system checks the user's special manifest authorization flag in the user security table
THEN
If the user's special manifest flag is not 'S' and the request is not an AEI train send, then set the user not authorized for special manifest flag to true
Context: A user is not authorized for special manifests and the action type is SEND and there are no existing errors
GIVEN
A user is not authorized for special manifests and the action type is SEND and there are no existing errors
Applied to: Generate Authorization Error Message
WHEN
The system processes IT bond cargo that requires special manifest creation or processes TE bond cargo requiring port change or processes TR/default bond cargo requiring detour processing
THEN
Generate error message 43 indicating user is not authorized for special manifest operations and add the message to the report
Context: A train request is being processed
GIVEN
A train request is being processed
Applied to: User Authorized for Special Manifests?
WHEN
The request type equals the AEI request type constant
THEN
Set AEI train send flag to YES and bypass special manifest authorization checks
Context: Cargo is found with IT bond type and cargo is not already created for IT and cargo does not have special manifest origin flag set
GIVEN
Cargo is found with IT bond type and cargo is not already created for IT and cargo does not have special manifest origin flag set
Applied to: Bond Type Requires Special Manifest?
WHEN
The system processes the cargo for special manifest requirements
THEN
If user is authorized for special manifests or action is not SEND, then create special manifest and generate message 23 or 24, otherwise generate authorization error message 43
Context: Cargo has TE bond type and cargo is not created for IT and cargo location does not match train crossing port and user is processing the cargo
GIVEN
Cargo has TE bond type and cargo is not created for IT and cargo location does not match train crossing port and user is processing the cargo
Applied to: Action Type is SEND?
WHEN
The action type is SEND and user is not authorized for special manifests
THEN
Generate authorization error message 43 and do not create port change manifest, otherwise if action is SEND and user is authorized, generate message 20 and create port change spawn
Context: Cargo has US-Canada-US bond type and cargo is not created for IT and cargo has release status and cargo does not have special TR flag
GIVEN
Cargo has US-Canada-US bond type and cargo is not created for IT and cargo has release status and cargo does not have special TR flag
Applied to: Allow Special Manifest Creation
WHEN
The action type is SEND and user is not authorized for special manifests
THEN
Generate authorization error message 43 and do not create detour manifest, otherwise if action is SEND and user is authorized, generate message 23 and create detour spawn
Context: Cargo has default bond type and cargo is not created for IT and cargo does not have special manifest origin flag
GIVEN
Cargo has default bond type and cargo is not created for IT and cargo does not have special manifest origin flag
Applied to: Continue Processing
WHEN
Cargo has release status and action type is SEND and user is not authorized for special manifests
THEN
Generate authorization error message 43 and do not create detour manifest, otherwise if cargo has release status and action is SEND and user is authorized, generate message 23 and create detour spawn, or if cargo does not have release status, generate message 31
Context: Cargo has export bond type and cargo does not have special 88 flag and origin-destination country codes are US-Mexico and train crossing port is not Laredo Texas station
GIVEN
Cargo has export bond type and cargo does not have special 88 flag and origin-destination country codes are US-Mexico and train crossing port is not Laredo Texas station
Applied to: End Authorization Check
WHEN
Cargo does not have special manifest flag and action type is SEND and user is not authorized for special manifests
THEN
Generate authorization error message 43 and do not create special manifest, otherwise if action is SEND and user is authorized, generate message 23 and create 88-TR detour spawn, or if cargo has special manifest flag, generate message 31
R-GCX003-cbl-01361 (+12) File: GCX003.cbl Special Manifest Creation Logic Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Manifest Creation Logic':
  • Context - a cargo record exists with bond type and special manifest flags:
    For IT Bond Type?:
    When the cargo has it bond type and the special manifest original flag is set, then set it export spawn flag and trigger special manifest creation.
    For TE Bond Type?:
    When the cargo has te bond type and the special manifest special flag is set, then set te port change spawn flag and trigger special manifest creation.
  • Context - a cargo record exists with export bond type and routing information:
    For Export Bond with USMX Route?:
    When the cargo is export type and has usmx country codes and has special 88 flag set, then set 88 tr detour spawn flag and trigger special manifest creation.
  • Context - a cargo record exists with bond type and special flags:
    For US-CAN-US Bond with Special TR Flag?:
    When the cargo has us-canada-us bond type and has special tr flag set, then set tr detour spawn flag and trigger special manifest creation.
  • Context - a cargo record exists with bond type classification:
    For Default Bond Type?:
    When the cargo has default bond type, then set detour spawn flag and trigger special manifest creation.
  • Context - a waybill exists without associated cargo and movement type information:
    For Original US-US Movement?:
    When the waybill represents original us-us domestic movement, then set us-us detour spawn flag and trigger special manifest creation.
  • Context - a special manifest record needs to be created for diversion processing:
    For Set Diversion Type in Manifest:
    When the manifest type is determined to be diversion, then set diversion flag in manifest record and populate equipment id, waybill number, and waybill date.
  • Context - a special manifest record needs to be created for it export processing:
    For Set IT Export Type in Manifest:
    When the manifest type is determined to be it export, then set it export flag in manifest record and populate equipment id, waybill number, and waybill date.
  • Context - a special manifest record needs to be created for port change processing:
    For Set Port Change Type in Manifest:
    When the manifest type is determined to be port change, then set port change flag in manifest record and populate equipment id.
  • Context - a special manifest record needs to be created for export tr processing:
    For Set Export TR Type in Manifest:
    When the manifest type is determined to be export tr, then set export tr flag in manifest record and populate equipment id, waybill number, and waybill date.
  • Context - a special manifest record needs to be created for us-us detour processing:
    For Set US-US Detour Type in Manifest:
    When the manifest type is determined to be us-us detour, then set us-us detour flag in manifest record, clear ccn field, and populate equipment id, waybill number, and waybill date.
  • Context - a special manifest record is being configured with routing information:
    For Add Border and Country Codes:
    When border and country code information is available, then populate manifest with border code, border name, origin country, and destination country codes.
  • Context - a special manifest record has been fully configured with all required information:
    For Queue Manifest for Processing:
    When the manifest is ready for processing, then add manifest to gcx101 spawn table and increment spawn counter for batch processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with bond type and special manifest flags
GIVEN
A cargo record exists with bond type and special manifest flags
Applied to: IT Bond Type?
WHEN
The cargo has IT bond type AND the special manifest original flag is set
THEN
Set IT export spawn flag and trigger special manifest creation
Applied to: TE Bond Type?
WHEN
The cargo has TE bond type AND the special manifest special flag is set
THEN
Set TE port change spawn flag and trigger special manifest creation
Context: A cargo record exists with export bond type and routing information
GIVEN
A cargo record exists with export bond type and routing information
Applied to: Export Bond with USMX Route?
WHEN
The cargo is export type AND has USMX country codes AND has special 88 flag set
THEN
Set 88 TR detour spawn flag and trigger special manifest creation
Context: A cargo record exists with bond type and special flags
GIVEN
A cargo record exists with bond type and special flags
Applied to: US-CAN-US Bond with Special TR Flag?
WHEN
The cargo has US-Canada-US bond type AND has special TR flag set
THEN
Set TR detour spawn flag and trigger special manifest creation
Context: A cargo record exists with bond type classification
GIVEN
A cargo record exists with bond type classification
Applied to: Default Bond Type?
WHEN
The cargo has default bond type
THEN
Set detour spawn flag and trigger special manifest creation
Context: A waybill exists without associated cargo and movement type information
GIVEN
A waybill exists without associated cargo and movement type information
Applied to: Original US-US Movement?
WHEN
The waybill represents original US-US domestic movement
THEN
Set US-US detour spawn flag and trigger special manifest creation
Context: A special manifest record needs to be created for diversion processing
GIVEN
A special manifest record needs to be created for diversion processing
Applied to: Set Diversion Type in Manifest
WHEN
The manifest type is determined to be diversion
THEN
Set diversion flag in manifest record and populate equipment ID, waybill number, and waybill date
Context: A special manifest record needs to be created for IT export processing
GIVEN
A special manifest record needs to be created for IT export processing
Applied to: Set IT Export Type in Manifest
WHEN
The manifest type is determined to be IT export
THEN
Set IT export flag in manifest record and populate equipment ID, waybill number, and waybill date
Context: A special manifest record needs to be created for port change processing
GIVEN
A special manifest record needs to be created for port change processing
Applied to: Set Port Change Type in Manifest
WHEN
The manifest type is determined to be port change
THEN
Set port change flag in manifest record and populate equipment ID
Context: A special manifest record needs to be created for export TR processing
GIVEN
A special manifest record needs to be created for export TR processing
Applied to: Set Export TR Type in Manifest
WHEN
The manifest type is determined to be export TR
THEN
Set export TR flag in manifest record and populate equipment ID, waybill number, and waybill date
Context: A special manifest record needs to be created for US-US detour processing
GIVEN
A special manifest record needs to be created for US-US detour processing
Applied to: Set US-US Detour Type in Manifest
WHEN
The manifest type is determined to be US-US detour
THEN
Set US-US detour flag in manifest record, clear CCN field, and populate equipment ID, waybill number, and waybill date
Context: A special manifest record is being configured with routing information
GIVEN
A special manifest record is being configured with routing information
Applied to: Add Border and Country Codes
WHEN
Border and country code information is available
THEN
Populate manifest with border code, border name, origin country, and destination country codes
Context: A special manifest record has been fully configured with all required information
GIVEN
A special manifest record has been fully configured with all required information
Applied to: Queue Manifest for Processing
WHEN
The manifest is ready for processing
THEN
Add manifest to GCX101 spawn table and increment spawn counter for batch processing
R-GCX003-cbl-01374 (+6) File: GCX003.cbl Detour Condition Analysis Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Detour Condition Analysis':
  • Context - a cargo record exists for the equipment:
    For Empty Equipment or Empty Residue?:
    When the cargo is classified as empty equipment (m1109 bol type) or empty residue, then skip detour processing and continue with normal flow.
  • Context - cargo has it bond type and cargo is found:
    For Special Manifest Original?:
    When the cargo has special manifest original flag set, then skip detour processing and continue with normal flow.
  • Context - cargo has te (transport export) bond type and cargo is found:
    For Trigger TE Bond Port Change Processing:
    When the cargo does not have special manifest original flag or tr created for it flag is set, then trigger te bond port change processing through detour mechanism.
  • Context - cargo has us-canada-us bond type or default bond type and cargo is found:
    For Trigger TR Bond Diversion Processing:
    When tr created for it flag is spaces (not set) and cargo status equals release status, then trigger tr bond diversion processing through detour mechanism.
  • Context - cargo has export bond type and cargo is found:
    For Trigger US-MX Export Detour Processing:
    When origin-destination country codes equal 'usmx' and current station is not laredo tx station, then trigger us-mexico export detour processing through detour mechanism.
  • Context - no cargo is found for the equipment:
    For Trigger Original US-US Movement Detour Processing:
    When origin province state is us and destination province state is us and equipment is loaded and equipment is not a conveying car, then trigger original us-us movement detour processing through detour mechanism.
  • Context - cargo and equipment information is available for processing:
    For No Detour Required:
    When none of the detour trigger conditions are met (empty cargo, special manifests, bond mismatches, or routing issues), then continue with normal cargo processing without invoking detour procedures.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists for the equipment
GIVEN
A cargo record exists for the equipment
Applied to: Empty Equipment or Empty Residue?
WHEN
The cargo is classified as empty equipment (M1109 BOL type) or empty residue
THEN
Skip detour processing and continue with normal flow
Context: Cargo has IT bond type and cargo is found
GIVEN
Cargo has IT bond type and cargo is found
Applied to: Special Manifest Original?
WHEN
The cargo has special manifest original flag set
THEN
Skip detour processing and continue with normal flow
Context: Cargo has TE (Transport Export) bond type and cargo is found
GIVEN
Cargo has TE (Transport Export) bond type and cargo is found
Applied to: Trigger TE Bond Port Change Processing
WHEN
The cargo does not have special manifest original flag OR TR created for IT flag is set
THEN
Trigger TE bond port change processing through detour mechanism
Context: Cargo has US-Canada-US bond type or Default bond type and cargo is found
GIVEN
Cargo has US-Canada-US bond type or Default bond type and cargo is found
Applied to: Trigger TR Bond Diversion Processing
WHEN
TR created for IT flag is spaces (not set) AND cargo status equals release status
THEN
Trigger TR bond diversion processing through detour mechanism
Context: Cargo has Export bond type and cargo is found
GIVEN
Cargo has Export bond type and cargo is found
Applied to: Trigger US-MX Export Detour Processing
WHEN
Origin-destination country codes equal 'USMX' AND current station is not Laredo TX station
THEN
Trigger US-Mexico export detour processing through detour mechanism
Context: No cargo is found for the equipment
GIVEN
No cargo is found for the equipment
Applied to: Trigger Original US-US Movement Detour Processing
WHEN
Origin province state is US AND destination province state is US AND equipment is loaded AND equipment is not a conveying car
THEN
Trigger original US-US movement detour processing through detour mechanism
Context: Cargo and equipment information is available for processing
GIVEN
Cargo and equipment information is available for processing
Applied to: No Detour Required
WHEN
None of the detour trigger conditions are met (empty cargo, special manifests, bond mismatches, or routing issues)
THEN
Continue with normal cargo processing without invoking detour procedures
R-GCX003-cbl-01381 (+12) File: GCX003.cbl Detour Manifest Generation Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Detour Manifest Generation':
  • Context - a request for detour processing is initiated:
    For Cargo Found?:
    When the system checks for cargo existence, then if cargo is found, proceed to bond type classification; if no cargo is found, proceed to original us-us movement detour processing.
  • Context - cargo exists and detour processing is required:
    For Bond Type Classification:
    When the system evaluates the cargo bond type, then if bond type is te (transport export), route to te bond detour processing; if bond type is tr (transit), route to tr bond detour processing; if bond type is default, route to border clearance detour processing; if bond type is export, route to us-mx export detour processing.
  • Context - te bond cargo is being processed and cargo is not created for it and cargo status is not export and cargo is billable as cprs:
    For Port Change Required?:
    When the system compares the cargo location id with the station code, then if the cargo location id does not match the station code, proceed to release status check; otherwise, end detour processing.
  • Context - cargo requires detour processing and port change conditions are met:
    For Release Status Check:
    When the system checks the cargo release status, then if cargo status is not export status and meets release criteria, proceed to user authorization check; otherwise, continue with standard processing.
  • Context - detour processing requires special manifest creation:
    For User Authorization Check:
    When the system validates user authorization for special manifests, then if user is authorized for special manifests, proceed to request action type check; if user is not authorized, generate authorization error message.
  • Context - user is authorized and detour processing is required:
    For Request Action Type?:
    When the system evaluates the request action type, then if request action is send, proceed to create special manifest spawn; if request action is report, create warning message only.
  • Context - request action is send and user is authorized:
    For Create Special Manifest Spawn:
    When the system creates a special manifest spawn, then set appropriate manifest type flags and generate corresponding manifest based on detour classification.
  • Context - request action is report or user lacks special manifest authorization:
    For Create Warning Message:
    When the system processes the detour requirement, then generate appropriate warning message indicating the detour condition without creating special manifest.
  • Context - te bond cargo requires port change and user is authorized:
    For Generate Port Change Manifest:
    When the system generates a port change manifest, then create gcx101 spawn with port change flag set and include cargo details for manifest processing.
  • Context - tr bond cargo is not created for it and has release status:
    For Generate TR Bond Detour Manifest:
    When the system generates a tr bond detour manifest, then create gcx101 spawn with detour flag set and include cargo and equipment details for manifest processing.
  • Context - default bond cargo is not created for it and has release status:
    For Generate Border Clearance Manifest:
    When the system generates a border clearance manifest, then create gcx101 spawn with detour flag set for border clearance processing.
  • Context - export cargo with us-mx country codes at non-laredo station and special manifest field is empty:
    For Generate US-MX Export Manifest:
    When the system generates a us-mx export manifest, then create gcx101 spawn with export tr flag set for special manifest processing.
  • Context - waybill is found but no cargo exists and origin and destination are both us states:
    For Generate US-US Detour Manifest:
    When the system generates a us-us movement detour manifest, then create gcx101 spawn with us-us detour flag set and include waybill details for manifest processing.
👨‍💻 Technical ACs (Gherkin)
Context: A request for detour processing is initiated
GIVEN
A request for detour processing is initiated
Applied to: Cargo Found?
WHEN
The system checks for cargo existence
THEN
If cargo is found, proceed to bond type classification; if no cargo is found, proceed to original US-US movement detour processing
Context: Cargo exists and detour processing is required
GIVEN
Cargo exists and detour processing is required
Applied to: Bond Type Classification
WHEN
The system evaluates the cargo bond type
THEN
If bond type is TE (Transport Export), route to TE bond detour processing; if bond type is TR (Transit), route to TR bond detour processing; if bond type is default, route to border clearance detour processing; if bond type is export, route to US-MX export detour processing
Context: TE bond cargo is being processed and cargo is not created for IT and cargo status is not export and cargo is billable as CPRS
GIVEN
TE bond cargo is being processed and cargo is not created for IT and cargo status is not export and cargo is billable as CPRS
Applied to: Port Change Required?
WHEN
The system compares the cargo location ID with the station code
THEN
If the cargo location ID does not match the station code, proceed to release status check; otherwise, end detour processing
Context: Cargo requires detour processing and port change conditions are met
GIVEN
Cargo requires detour processing and port change conditions are met
Applied to: Release Status Check
WHEN
The system checks the cargo release status
THEN
If cargo status is not export status and meets release criteria, proceed to user authorization check; otherwise, continue with standard processing
Context: Detour processing requires special manifest creation
GIVEN
Detour processing requires special manifest creation
Applied to: User Authorization Check
WHEN
The system validates user authorization for special manifests
THEN
If user is authorized for special manifests, proceed to request action type check; if user is not authorized, generate authorization error message
Context: User is authorized and detour processing is required
GIVEN
User is authorized and detour processing is required
Applied to: Request Action Type?
WHEN
The system evaluates the request action type
THEN
If request action is SEND, proceed to create special manifest spawn; if request action is REPORT, create warning message only
Context: Request action is SEND and user is authorized
GIVEN
Request action is SEND and user is authorized
Applied to: Create Special Manifest Spawn
WHEN
The system creates a special manifest spawn
THEN
Set appropriate manifest type flags and generate corresponding manifest based on detour classification
Context: Request action is REPORT or user lacks special manifest authorization
GIVEN
Request action is REPORT or user lacks special manifest authorization
Applied to: Create Warning Message
WHEN
The system processes the detour requirement
THEN
Generate appropriate warning message indicating the detour condition without creating special manifest
Context: TE bond cargo requires port change and user is authorized
GIVEN
TE bond cargo requires port change and user is authorized
Applied to: Generate Port Change Manifest
WHEN
The system generates a port change manifest
THEN
Create GCX101 spawn with port change flag set and include cargo details for manifest processing
Context: TR bond cargo is not created for IT and has release status
GIVEN
TR bond cargo is not created for IT and has release status
Applied to: Generate TR Bond Detour Manifest
WHEN
The system generates a TR bond detour manifest
THEN
Create GCX101 spawn with detour flag set and include cargo and equipment details for manifest processing
Context: Default bond cargo is not created for IT and has release status
GIVEN
Default bond cargo is not created for IT and has release status
Applied to: Generate Border Clearance Manifest
WHEN
The system generates a border clearance manifest
THEN
Create GCX101 spawn with detour flag set for border clearance processing
Context: Export cargo with US-MX country codes at non-Laredo station and special manifest field is empty
GIVEN
Export cargo with US-MX country codes at non-Laredo station and special manifest field is empty
Applied to: Generate US-MX Export Manifest
WHEN
The system generates a US-MX export manifest
THEN
Create GCX101 spawn with export TR flag set for special manifest processing
Context: Waybill is found but no cargo exists and origin and destination are both US states
GIVEN
Waybill is found but no cargo exists and origin and destination are both US states
Applied to: Generate US-US Detour Manifest
WHEN
The system generates a US-US movement detour manifest
THEN
Create GCX101 spawn with US-US detour flag set and include waybill details for manifest processing
R-GCX003-cbl-01394 (+14) File: GCX003.cbl Report Header Assembly Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Header Assembly':
  • Context - a report is being finalized:
    For Set Report End Marker:
    When the current report line at the report index is blank, then set the report end marker flag for that line to indicate end of report.
  • Context - a report has been built with multiple lines:
    For Capture Report Line Count:
    When finalizing the report structure, then set the last line number to the current report index and new report index.
  • Context - a train manifest report is being generated:
    For Build Header Line 1 - Train Information & Build Header Line 2 - User Information:
    When building the report header, then set header line 1 flag, populate train id from request, and set origin station name from station table and set header line 2 flag and populate user id, terminal id, processing date, hour, and minutes from system session.
    For Build Header Line 4 - Train Details:
    When building the detailed train information header, then set header line 4 flag and populate us customs train id and eta components (year, month, day, hour, minutes).
  • Context - a train manifest is being processed:
    For Determine Request Action Type:
    When building the processing status header, then evaluate the request action type and branch to appropriate header processing logic.
  • Context - a train manifest processing request:
    For Set SEND Action Header:
    When the request action type is send, then set the header to indicate send action type.
    For Set REPORT Action Header:
    When the request action type is report, then set the header to indicate report action and determine result status based on errors and warnings.
    For Set OTHER Action Header:
    When the request action type is neither send nor report, then set the header to show the request type and mark result as abort.
  • Context - a send action has been processed:
    For Check Processing Results:
    When determining the processing results, then if no errors and no spawns occurred, set sent status with warning count, otherwise set not sent status with error and warning counts.
  • Context - a send action completed without errors or spawns:
    For Set SENT Status with Warning Count:
    When setting the processing result status, then set result as sent and include the warning count in the header.
  • Context - a send action encountered errors or spawns:
    For Set NOT SENT Status with Error/Warning Counts:
    When setting the processing result status, then set result as not sent and include both error count and warning count in the header.
  • Context - a report action has been processed:
    For Set REPORT Action Header:
    When setting the processing result status, then if no errors and no warnings, set result as no message, otherwise set result as message with warning and error counts including dsp count.
  • Context - a train manifest report structure is being finalized:
    For Build Detail Headers:
    When setting up the detail section headers, then set detail header line 1 and detail header line 2 flags to create column headers for equipment and cargo details.
  • Context - all report header lines have been constructed:
    For Copy Headers to Report Lines:
    When finalizing the report structure, then copy the first five report lines to the corresponding email text lines for output.
👨‍💻 Technical ACs (Gherkin)
Context: A report is being finalized
GIVEN
A report is being finalized
Applied to: Set Report End Marker
WHEN
The current report line at the report index is blank
THEN
Set the report end marker flag for that line to indicate end of report
Context: A report has been built with multiple lines
GIVEN
A report has been built with multiple lines
Applied to: Capture Report Line Count
WHEN
Finalizing the report structure
THEN
Set the last line number to the current report index and new report index
Context: A train manifest report is being generated
GIVEN
A train manifest report is being generated
Applied to: Build Header Line 1 - Train Information & Build Header Line 2 - User Information
WHEN
Building the report header
THEN
Set header line 1 flag, populate train ID from request, and set origin station name from station table AND Set header line 2 flag and populate user ID, terminal ID, processing date, hour, and minutes from system session
Applied to: Build Header Line 4 - Train Details
WHEN
Building the detailed train information header
THEN
Set header line 4 flag and populate US customs train ID and ETA components (year, month, day, hour, minutes)
Context: A train manifest is being processed
GIVEN
A train manifest is being processed
Applied to: Determine Request Action Type
WHEN
Building the processing status header
THEN
Evaluate the request action type and branch to appropriate header processing logic
Context: A train manifest processing request
GIVEN
A train manifest processing request
Applied to: Set SEND Action Header
WHEN
The request action type is SEND
THEN
Set the header to indicate SEND action type
Applied to: Set REPORT Action Header
WHEN
The request action type is REPORT
THEN
Set the header to indicate REPORT action and determine result status based on errors and warnings
Applied to: Set OTHER Action Header
WHEN
The request action type is neither SEND nor REPORT
THEN
Set the header to show the request type and mark result as ABORT
Context: A SEND action has been processed
GIVEN
A SEND action has been processed
Applied to: Check Processing Results
WHEN
Determining the processing results
THEN
If no errors and no spawns occurred, set SENT status with warning count, otherwise set NOT SENT status with error and warning counts
Context: A SEND action completed without errors or spawns
GIVEN
A SEND action completed without errors or spawns
Applied to: Set SENT Status with Warning Count
WHEN
Setting the processing result status
THEN
Set result as SENT and include the warning count in the header
Context: A SEND action encountered errors or spawns
GIVEN
A SEND action encountered errors or spawns
Applied to: Set NOT SENT Status with Error/Warning Counts
WHEN
Setting the processing result status
THEN
Set result as NOT SENT and include both error count and warning count in the header
Context: A REPORT action has been processed
GIVEN
A REPORT action has been processed
Applied to: Set REPORT Action Header
WHEN
Setting the processing result status
THEN
If no errors and no warnings, set result as NO MESSAGE, otherwise set result as MESSAGE with warning and error counts including DSP count
Context: A train manifest report structure is being finalized
GIVEN
A train manifest report structure is being finalized
Applied to: Build Detail Headers
WHEN
Setting up the detail section headers
THEN
Set detail header line 1 and detail header line 2 flags to create column headers for equipment and cargo details
Context: All report header lines have been constructed
GIVEN
All report header lines have been constructed
Applied to: Copy Headers to Report Lines
WHEN
Finalizing the report structure
THEN
Copy the first five report lines to the corresponding email text lines for output
R-GCX003-cbl-01409 (+10) File: GCX003.cbl Processing Result Determination Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Processing Result Determination':
  • Context - a train manifest processing request has been completed:
    For Any Processing Errors?:
    When the system checks for any processing errors in the report, then the system branches to either successful processing path or error handling path based on error presence.
  • Context - train manifest processing has completed with no errors and no spawn messages:
    For Set Result Status: SENT:
    When the system determines the final result status, then the result status is set to sent indicating successful transmission to customs.
  • Context - train manifest processing has completed with no errors but has spawn messages:
    For Set Result Status: NOT SENT:
    When the system determines the final result status, then the result status is set to not sent indicating special processing is required.
  • Context - train manifest processing has completed successfully:
    For Copy Warning Count to Display:
    When the system prepares the result display information, then the warning count is copied to the appropriate display field for the success scenario.
  • Context - train manifest processing has spawn messages that need special handling:
    For Add Spawn Count to Error Count:
    When the system calculates the total error count for display, then the spawn count is added to the existing error count to show total issues.
  • Context - train manifest processing completed successfully but generated spawn messages:
    For Trigger Special Manifest Processing:
    When the system needs to handle special processing requirements, then special manifest processing is triggered using gcx101 spawn functionality.
  • Context - train manifest processing has errors but no spawn messages:
    For Convert Error Messages to Warning Messages:
    When the system processes error messages for final reporting, then specific error messages (type 43) are converted to warning messages if error count matches type 43 count.
  • Context - train manifest processing has both errors and spawn messages:
    For Convert Spawn Messages to Diversion Messages:
    When the system processes messages for final reporting, then spawn diversion messages are converted to message 19 (diversion) and spawn ite messages are converted to message 18 (detour).
    For Add Spawn Count to Warning Count:
    When the system calculates final warning count for display, then the spawn count is added to the existing warning count.
  • Context - train manifest processing result determination is complete:
    For Set Train Header Information:
    When the system prepares the final report header, then the train header line 4 is set and us customer train id is populated from the train list.
  • Context - train header information has been set:
    For Set ETA Information in Header:
    When the system completes the header information, then eta year, month, day, hour, and minute are populated in the report header from the request data.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest processing request has been completed
GIVEN
A train manifest processing request has been completed
Applied to: Any Processing Errors?
WHEN
The system checks for any processing errors in the report
THEN
The system branches to either successful processing path or error handling path based on error presence
Context: Train manifest processing has completed with no errors and no spawn messages
GIVEN
Train manifest processing has completed with no errors and no spawn messages
Applied to: Set Result Status: SENT
WHEN
The system determines the final result status
THEN
The result status is set to SENT indicating successful transmission to customs
Context: Train manifest processing has completed with no errors but has spawn messages
GIVEN
Train manifest processing has completed with no errors but has spawn messages
Applied to: Set Result Status: NOT SENT
WHEN
The system determines the final result status
THEN
The result status is set to NOT SENT indicating special processing is required
Context: Train manifest processing has completed successfully
GIVEN
Train manifest processing has completed successfully
Applied to: Copy Warning Count to Display
WHEN
The system prepares the result display information
THEN
The warning count is copied to the appropriate display field for the success scenario
Context: Train manifest processing has spawn messages that need special handling
GIVEN
Train manifest processing has spawn messages that need special handling
Applied to: Add Spawn Count to Error Count
WHEN
The system calculates the total error count for display
THEN
The spawn count is added to the existing error count to show total issues
Context: Train manifest processing completed successfully but generated spawn messages
GIVEN
Train manifest processing completed successfully but generated spawn messages
Applied to: Trigger Special Manifest Processing
WHEN
The system needs to handle special processing requirements
THEN
Special manifest processing is triggered using GCX101 spawn functionality
Context: Train manifest processing has errors but no spawn messages
GIVEN
Train manifest processing has errors but no spawn messages
Applied to: Convert Error Messages to Warning Messages
WHEN
The system processes error messages for final reporting
THEN
Specific error messages (type 43) are converted to warning messages if error count matches type 43 count
Context: Train manifest processing has both errors and spawn messages
GIVEN
Train manifest processing has both errors and spawn messages
Applied to: Convert Spawn Messages to Diversion Messages
WHEN
The system processes messages for final reporting
THEN
Spawn diversion messages are converted to message 19 (diversion) and spawn ITE messages are converted to message 18 (detour)
Applied to: Add Spawn Count to Warning Count
WHEN
The system calculates final warning count for display
THEN
The spawn count is added to the existing warning count
Context: Train manifest processing result determination is complete
GIVEN
Train manifest processing result determination is complete
Applied to: Set Train Header Information
WHEN
The system prepares the final report header
THEN
The train header line 4 is set and US customer train ID is populated from the train list
Context: Train header information has been set
GIVEN
Train header information has been set
Applied to: Set ETA Information in Header
WHEN
The system completes the header information
THEN
ETA year, month, day, hour, and minute are populated in the report header from the request data
R-GCX003-cbl-01420 (+18) File: GCX003.cbl Report Content Formatting Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Content Formatting':
  • Context - a train manifest processing request is being finalized:
    For Initialize Report Headers and Status Lines:
    When the system begins report formatting, then report index is set to last line position, new report index is set to last line position, and all header lines are prepared for content.
  • Context - report headers are being initialized:
    For Set Report Header Line 1 - Train ID and Origin:
    When the system formats header line 1, then header line 1 is marked as header type, train id is populated from request, and origin station name is populated from station table.
  • Context - header line 1 has been formatted:
    For Set Report Header Line 2 - User Info and Timestamp:
    When the system formats header line 2, then header line 2 is marked as header type, user id is populated from system context, terminal id is populated, machine date is populated, and machine time components (hour and minute) are populated.
  • Context - header lines 1 and 2 have been formatted:
    For Set Report Header Line 3 - Action Type and Results:
    When the system evaluates the request action type, then if action is send then send report formatting is applied, else if action is report then report formatting is applied, else other/abort formatting is applied.
  • Context - request action type is send:
    For Format SEND Report Header with Train ID and ETA:
    When the system formats the send report header, then header line 3 is marked as send type, header line 4 is marked as header type, us customer train id is populated, and eta components (year, month, day, hour, minute) are populated from request.
  • Context - request action type is report:
    For Format REPORT Header with Message Counts:
    When the system formats the report header, then header line 3 is marked as report type, and if no errors and no warnings then result is set to no messages, else result is set to show messages with warning count and error count populated.
  • Context - request action type is neither send nor report:
    For Format OTHER/ABORT Header with Request Type:
    When the system formats the other action header, then request type is populated in header and result is set to abort status.
  • Context - report action headers have been formatted:
    For Set Detail Header Lines 1 and 2:
    When the system sets up detail headers, then detail header line 1 is marked as detail header type and detail header line 2 is marked as detail header type.
  • Context - all header lines have been formatted:
    For Copy Header Lines to Email Text Lines:
    When the system prepares email content, then report lines 1 through 5 are copied to corresponding email text lines.
  • Context - header lines have been copied to email format:
    For Format Status Line with Equipment Totals:
    When the system formats the status line, then total equipment count is populated in status line and status line is copied to email text line 5.
  • Context - report content has been formatted:
    For Set Email Parameters - From/To User Codes:
    When the system sets up email parameters, then from user code is set to om01247, to user code is set to om01247, keywords are cleared, and copy user code is cleared.
  • Context - email parameters have been configured:
    For Set Email Subject Line from Report Header:
    When the system sets the email subject, then email subject is populated from report line 1 content.
  • Context - email subject has been set:
    For Set Email Item Width to 080 Characters:
    When the system configures email formatting, then email item width is set to 080 characters, item sequence numbers are cleared, and item alpha sequence is cleared.
  • Context - email formatting has been configured:
    For Initialize Email Return Status Flags:
    When the system initializes status tracking, then email return status flags are cleared and no-more-email flag is set to true and line counter is reset to zero.
  • Context - email status has been initialized and report content is being processed:
    For Large Report Check - Lines > 699?:
    When the system checks current line count, then if line counter exceeds 699 then report must be split into multiple parts, else report can be sent as single email.
  • Context - report line count exceeds 699 lines:
    For Split Report into Multiple Email Parts:
    When the system splits the report, then no-more-email flag is set to true, current email segment is sent, email text is cleared, and line counter is reset to zero.
  • Context - a report has been split and new email segment is starting:
    For Add Continuation Header for Next Part:
    When the system adds continuation header, then continuation message is added to line 1, detail header 1 is added to line 2, detail header 2 is added to line 3, and line counter is incremented by 3.
  • Context - report line count is 699 or fewer and more-email flag is true:
    For Format Single Email with All Content:
    When the system formats single email, then complete report content is prepared for transmission in single email message.
  • Context - email content has been formatted (single or multi-part):
    For Set Email Destination to OM01247:
    When the system sets final destination, then email destination is confirmed as om01247 for customs authority delivery.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest processing request is being finalized
GIVEN
A train manifest processing request is being finalized
Applied to: Initialize Report Headers and Status Lines
WHEN
The system begins report formatting
THEN
Report index is set to last line position, new report index is set to last line position, and all header lines are prepared for content
Context: Report headers are being initialized
GIVEN
Report headers are being initialized
Applied to: Set Report Header Line 1 - Train ID and Origin
WHEN
The system formats header line 1
THEN
Header line 1 is marked as header type, train ID is populated from request, and origin station name is populated from station table
Context: Header line 1 has been formatted
GIVEN
Header line 1 has been formatted
Applied to: Set Report Header Line 2 - User Info and Timestamp
WHEN
The system formats header line 2
THEN
Header line 2 is marked as header type, user ID is populated from system context, terminal ID is populated, machine date is populated, and machine time components (hour and minute) are populated
Context: Header lines 1 and 2 have been formatted
GIVEN
Header lines 1 and 2 have been formatted
Applied to: Set Report Header Line 3 - Action Type and Results
WHEN
The system evaluates the request action type
THEN
If action is SEND then SEND report formatting is applied, else if action is REPORT then REPORT formatting is applied, else OTHER/ABORT formatting is applied
Context: Request action type is SEND
GIVEN
Request action type is SEND
Applied to: Format SEND Report Header with Train ID and ETA
WHEN
The system formats the SEND report header
THEN
Header line 3 is marked as SEND type, header line 4 is marked as header type, US customer train ID is populated, and ETA components (year, month, day, hour, minute) are populated from request
Context: Request action type is REPORT
GIVEN
Request action type is REPORT
Applied to: Format REPORT Header with Message Counts
WHEN
The system formats the REPORT header
THEN
Header line 3 is marked as REPORT type, and if no errors and no warnings then result is set to no messages, else result is set to show messages with warning count and error count populated
Context: Request action type is neither SEND nor REPORT
GIVEN
Request action type is neither SEND nor REPORT
Applied to: Format OTHER/ABORT Header with Request Type
WHEN
The system formats the OTHER action header
THEN
Request type is populated in header and result is set to ABORT status
Context: Report action headers have been formatted
GIVEN
Report action headers have been formatted
Applied to: Set Detail Header Lines 1 and 2
WHEN
The system sets up detail headers
THEN
Detail header line 1 is marked as detail header type and detail header line 2 is marked as detail header type
Context: All header lines have been formatted
GIVEN
All header lines have been formatted
Applied to: Copy Header Lines to Email Text Lines
WHEN
The system prepares email content
THEN
Report lines 1 through 5 are copied to corresponding email text lines
Context: Header lines have been copied to email format
GIVEN
Header lines have been copied to email format
Applied to: Format Status Line with Equipment Totals
WHEN
The system formats the status line
THEN
Total equipment count is populated in status line and status line is copied to email text line 5
Context: Report content has been formatted
GIVEN
Report content has been formatted
Applied to: Set Email Parameters - From/To User Codes
WHEN
The system sets up email parameters
THEN
From user code is set to OM01247, to user code is set to OM01247, keywords are cleared, and copy user code is cleared
Context: Email parameters have been configured
GIVEN
Email parameters have been configured
Applied to: Set Email Subject Line from Report Header
WHEN
The system sets the email subject
THEN
Email subject is populated from report line 1 content
Context: Email subject has been set
GIVEN
Email subject has been set
Applied to: Set Email Item Width to 080 Characters
WHEN
The system configures email formatting
THEN
Email item width is set to 080 characters, item sequence numbers are cleared, and item alpha sequence is cleared
Context: Email formatting has been configured
GIVEN
Email formatting has been configured
Applied to: Initialize Email Return Status Flags
WHEN
The system initializes status tracking
THEN
Email return status flags are cleared and no-more-email flag is set to true and line counter is reset to zero
Context: Email status has been initialized and report content is being processed
GIVEN
Email status has been initialized and report content is being processed
Applied to: Large Report Check - Lines > 699?
WHEN
The system checks current line count
THEN
If line counter exceeds 699 then report must be split into multiple parts, else report can be sent as single email
Context: Report line count exceeds 699 lines
GIVEN
Report line count exceeds 699 lines
Applied to: Split Report into Multiple Email Parts
WHEN
The system splits the report
THEN
No-more-email flag is set to true, current email segment is sent, email text is cleared, and line counter is reset to zero
Context: A report has been split and new email segment is starting
GIVEN
A report has been split and new email segment is starting
Applied to: Add Continuation Header for Next Part
WHEN
The system adds continuation header
THEN
Continuation message is added to line 1, detail header 1 is added to line 2, detail header 2 is added to line 3, and line counter is incremented by 3
Context: Report line count is 699 or fewer and more-email flag is true
GIVEN
Report line count is 699 or fewer and more-email flag is true
Applied to: Format Single Email with All Content
WHEN
The system formats single email
THEN
Complete report content is prepared for transmission in single email message
Context: Email content has been formatted (single or multi-part)
GIVEN
Email content has been formatted (single or multi-part)
Applied to: Set Email Destination to OM01247
WHEN
The system sets final destination
THEN
Email destination is confirmed as OM01247 for customs authority delivery
R-GCX003-cbl-01439 (+16) File: GCX003.cbl Email Transmission Management Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Email Transmission Management':
  • Context - a customs report needs to be transmitted via email:
    For Initialize Email Parameters:
    When the email transmission process is initiated, then the system shall set the sender as om01247, clear recipient and copy fields, set item width to 080 characters, and initialize return status flags.
  • Context - email parameters have been initialized for report transmission:
    For Set Email Headers and Subject:
    When email headers and subject are being configured, then the system shall set the sender and recipient to om01247, clear keywords and copy fields, use the first report line as the subject, and clear item sequence numbers.
  • Context - email headers have been configured:
    For Initialize Line Counter:
    When the line counting process is initialized, then the system shall set the line counter to zero and establish email continuation flags.
  • Context - report lines are being processed for email transmission:
    For More Report Lines to Process?:
    When the system checks for remaining lines to process, then the system shall continue processing if the current line is not empty or low-values and the maximum email line limit has not been exceeded.
  • Context - a report line is available for processing and email buffer has capacity:
    For Add Line to Email Message:
    When the line is added to the email message, then the system shall copy the report line to the corresponding email text line position.
  • Context - a report line has been added to the email message:
    For Increment Line Counter:
    When the line counter is updated, then the system shall increment the line counter by one and set the email continuation flag to indicate more content exists.
  • Context - lines have been added to the email message buffer:
    For Line Count > 699?:
    When the system checks the current line count, then the system shall trigger email transmission if the line count exceeds 699 lines.
  • Context - an email message is ready for transmission with proper headers and content:
    For Send Current Email Batch:
    When the email send operation is executed, then the system shall call the email service with all configured parameters including sender, recipient, subject, content, and formatting options.
  • Context - an email transmission attempt has been completed:
    For Email Send Successful?:
    When the system evaluates the transmission result, then the system shall check the email return status flag to determine if the transmission was successful.
  • Context - an email transmission has failed:
    For Handle Email Failure:
    When the failure handling process is initiated, then the system shall clear the recipient usercode field and prepare alternative recipient addresses for error notification.
  • Context - an email transmission has failed and error handling is in progress:
    For Send Error Notification to Support:
    When error notification is sent to support, then the system shall set aei9999 as the first recipient, om01247 as the second recipient, and attempt to send the error notification.
  • Context - an email batch has been sent successfully or after error handling:
    For Reset Email Message Buffer:
    When the message buffer is reset for continuation, then the system shall clear the email text content and reset the line counter to zero.
  • Context - a large report requires multiple email messages and a new message is being prepared:
    For Add Continuation Header:
    When continuation headers are added, then the system shall add 'continuation of report ....' as the first line and increment the line counter to 1.
  • Context - a continuation email is being prepared with continuation header already added:
    For Add Report Headers to New Email:
    When report headers are added to the new email, then the system shall add the detail header lines as the second and third lines and increment the line counter to 3.
  • Context - all report lines have been processed and the final email batch is ready:
    For Send Final Email Batch:
    When the final email transmission is executed, then the system shall send the email using the same transmission service with all configured parameters.
  • Context - an email has been successfully transmitted to the customs system:
    For Log Email Success:
    When success logging is performed, then the system shall record the successful transmission without generating error messages.
  • Context - email transmission has been completed successfully:
    For Purge Message Queue:
    When message queue purging is performed, then the system shall clear the accept status and call the message purge service to clean up communication resources.
👨‍💻 Technical ACs (Gherkin)
Context: A customs report needs to be transmitted via email
GIVEN
A customs report needs to be transmitted via email
Applied to: Initialize Email Parameters
WHEN
The email transmission process is initiated
THEN
The system shall set the sender as OM01247, clear recipient and copy fields, set item width to 080 characters, and initialize return status flags
Context: Email parameters have been initialized for report transmission
GIVEN
Email parameters have been initialized for report transmission
Applied to: Set Email Headers and Subject
WHEN
Email headers and subject are being configured
THEN
The system shall set the sender and recipient to OM01247, clear keywords and copy fields, use the first report line as the subject, and clear item sequence numbers
Context: Email headers have been configured
GIVEN
Email headers have been configured
Applied to: Initialize Line Counter
WHEN
The line counting process is initialized
THEN
The system shall set the line counter to zero and establish email continuation flags
Context: Report lines are being processed for email transmission
GIVEN
Report lines are being processed for email transmission
Applied to: More Report Lines to Process?
WHEN
The system checks for remaining lines to process
THEN
The system shall continue processing if the current line is not empty or low-values and the maximum email line limit has not been exceeded
Context: A report line is available for processing and email buffer has capacity
GIVEN
A report line is available for processing and email buffer has capacity
Applied to: Add Line to Email Message
WHEN
The line is added to the email message
THEN
The system shall copy the report line to the corresponding email text line position
Context: A report line has been added to the email message
GIVEN
A report line has been added to the email message
Applied to: Increment Line Counter
WHEN
The line counter is updated
THEN
The system shall increment the line counter by one and set the email continuation flag to indicate more content exists
Context: Lines have been added to the email message buffer
GIVEN
Lines have been added to the email message buffer
Applied to: Line Count > 699?
WHEN
The system checks the current line count
THEN
The system shall trigger email transmission if the line count exceeds 699 lines
Context: An email message is ready for transmission with proper headers and content
GIVEN
An email message is ready for transmission with proper headers and content
Applied to: Send Current Email Batch
WHEN
The email send operation is executed
THEN
The system shall call the email service with all configured parameters including sender, recipient, subject, content, and formatting options
Context: An email transmission attempt has been completed
GIVEN
An email transmission attempt has been completed
Applied to: Email Send Successful?
WHEN
The system evaluates the transmission result
THEN
The system shall check the email return status flag to determine if the transmission was successful
Context: An email transmission has failed
GIVEN
An email transmission has failed
Applied to: Handle Email Failure
WHEN
The failure handling process is initiated
THEN
The system shall clear the recipient usercode field and prepare alternative recipient addresses for error notification
Context: An email transmission has failed and error handling is in progress
GIVEN
An email transmission has failed and error handling is in progress
Applied to: Send Error Notification to Support
WHEN
Error notification is sent to support
THEN
The system shall set AEI9999 as the first recipient, OM01247 as the second recipient, and attempt to send the error notification
Context: An email batch has been sent successfully or after error handling
GIVEN
An email batch has been sent successfully or after error handling
Applied to: Reset Email Message Buffer
WHEN
The message buffer is reset for continuation
THEN
The system shall clear the email text content and reset the line counter to zero
Context: A large report requires multiple email messages and a new message is being prepared
GIVEN
A large report requires multiple email messages and a new message is being prepared
Applied to: Add Continuation Header
WHEN
Continuation headers are added
THEN
The system shall add 'CONTINUATION OF REPORT ....' as the first line and increment the line counter to 1
Context: A continuation email is being prepared with continuation header already added
GIVEN
A continuation email is being prepared with continuation header already added
Applied to: Add Report Headers to New Email
WHEN
Report headers are added to the new email
THEN
The system shall add the detail header lines as the second and third lines and increment the line counter to 3
Context: All report lines have been processed and the final email batch is ready
GIVEN
All report lines have been processed and the final email batch is ready
Applied to: Send Final Email Batch
WHEN
The final email transmission is executed
THEN
The system shall send the email using the same transmission service with all configured parameters
Context: An email has been successfully transmitted to the customs system
GIVEN
An email has been successfully transmitted to the customs system
Applied to: Log Email Success
WHEN
Success logging is performed
THEN
The system shall record the successful transmission without generating error messages
Context: Email transmission has been completed successfully
GIVEN
Email transmission has been completed successfully
Applied to: Purge Message Queue
WHEN
Message queue purging is performed
THEN
The system shall clear the accept status and call the message purge service to clean up communication resources
R-GCX003-cbl-01456 (+11) File: GCX003.cbl Report Distribution Logic Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Report Distribution Logic':
  • Context - a train request is being processed:
    For Is AEI Train Send Request?:
    When the request type equals the aei request type constant, then set aei train send flag to yes, otherwise set to no.
  • Context - an aei train send request is being processed:
    For Retrieve AEI Email Distribution List:
    When the system calls aecwrktb with train origin as record key and cusemail as record type, then return the email distribution configuration for the specified origin.
  • Context - aei email distribution retrieval has been attempted:
    For Email Distribution Found?:
    When the return code equals aei success constant, then use retrieved email recipients, otherwise use default merlin recipients.
  • Context - aei email distribution list was successfully retrieved:
    For Use Retrieved Email Recipients:
    When processing email recipients from cusemail user ids, then assign each non-blank cusemail user id to email recipient list up to maximum of 10 recipients.
  • Context - aei email distribution list retrieval failed or returned no entry:
    For Use Default MERLIN Recipients:
    When no specific email recipients are configured, then set both from and to email addresses to default merlin id constant.
  • Context - report distribution is being configured:
    For Alternate Terminal Configured?:
    When the alternate terminal field in gcstbrt terminal configuration is not blank, then use the alternate terminal, otherwise use the original request terminal.
  • Context - a report is being prepared for distribution:
    For Request Action Type?:
    When the request action type and error status are evaluated, then set train error classification if errors exist, train sent classification for send actions, or train report classification for report actions.
  • Context - report classification has been determined:
    For Report Distribution Mode?:
    When the report distribution mode is evaluated, then send all report lines for full reports, or send selective lines based on warning presence for summary reports.
  • Context - selective report distribution mode is active:
    For Any Warnings Present?:
    When the report warning status is evaluated, then send header lines only if no warnings exist, otherwise send header plus warning lines.
  • Context - report distribution parameters are being finalized:
    For Report Status?:
    When the report transmission status is evaluated, then generate 'not sent' subject line for errors or failed transmissions, otherwise generate 'sent' subject line for successful transmissions.
  • Context - an aei train report was successfully transmitted:
    For Generate _SENT_ Subject:
    When generating the email subject line, then create subject line with format 'us train [train_id] sent at [origin]' using report header train id and origin.
  • Context - an aei train report failed transmission or contains errors:
    For Generate _NOT SENT_ Subject:
    When generating the email subject line, then create subject line with format 'us train [train_id] not sent at [origin]' using report header train id and origin.
👨‍💻 Technical ACs (Gherkin)
Context: A train request is being processed
GIVEN
A train request is being processed
Applied to: Is AEI Train Send Request?
WHEN
The request type equals the AEI request type constant
THEN
Set AEI train send flag to YES, otherwise set to NO
Context: An AEI train send request is being processed
GIVEN
An AEI train send request is being processed
Applied to: Retrieve AEI Email Distribution List
WHEN
The system calls AECWRKTB with train origin as record key and CUSEMAIL as record type
THEN
Return the email distribution configuration for the specified origin
Context: AEI email distribution retrieval has been attempted
GIVEN
AEI email distribution retrieval has been attempted
Applied to: Email Distribution Found?
WHEN
The return code equals AEI success constant
THEN
Use retrieved email recipients, otherwise use default MERLIN recipients
Context: AEI email distribution list was successfully retrieved
GIVEN
AEI email distribution list was successfully retrieved
Applied to: Use Retrieved Email Recipients
WHEN
Processing email recipients from CUSEMAIL user IDs
THEN
Assign each non-blank CUSEMAIL user ID to email recipient list up to maximum of 10 recipients
Context: AEI email distribution list retrieval failed or returned no entry
GIVEN
AEI email distribution list retrieval failed or returned no entry
Applied to: Use Default MERLIN Recipients
WHEN
No specific email recipients are configured
THEN
Set both FROM and TO email addresses to default MERLIN ID constant
Context: Report distribution is being configured
GIVEN
Report distribution is being configured
Applied to: Alternate Terminal Configured?
WHEN
The alternate terminal field in GCSTBRT terminal configuration is not blank
THEN
Use the alternate terminal, otherwise use the original request terminal
Context: A report is being prepared for distribution
GIVEN
A report is being prepared for distribution
Applied to: Request Action Type?
WHEN
The request action type and error status are evaluated
THEN
Set train error classification if errors exist, train sent classification for send actions, or train report classification for report actions
Context: Report classification has been determined
GIVEN
Report classification has been determined
Applied to: Report Distribution Mode?
WHEN
The report distribution mode is evaluated
THEN
Send all report lines for full reports, or send selective lines based on warning presence for summary reports
Context: Selective report distribution mode is active
GIVEN
Selective report distribution mode is active
Applied to: Any Warnings Present?
WHEN
The report warning status is evaluated
THEN
Send header lines only if no warnings exist, otherwise send header plus warning lines
Context: Report distribution parameters are being finalized
GIVEN
Report distribution parameters are being finalized
Applied to: Report Status?
WHEN
The report transmission status is evaluated
THEN
Generate 'NOT SENT' subject line for errors or failed transmissions, otherwise generate 'SENT' subject line for successful transmissions
Context: An AEI train report was successfully transmitted
GIVEN
An AEI train report was successfully transmitted
Applied to: Generate _SENT_ Subject
WHEN
Generating the email subject line
THEN
Create subject line with format 'US TRAIN [train_id] SENT AT [origin]' using report header train ID and origin
Context: An AEI train report failed transmission or contains errors
GIVEN
An AEI train report failed transmission or contains errors
Applied to: Generate _NOT SENT_ Subject
WHEN
Generating the email subject line
THEN
Create subject line with format 'US TRAIN [train_id] NOT SENT AT [origin]' using report header train ID and origin
R-GCX003-cbl-01468 (+6) File: GCX003.cbl Message Type Classification Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Type Classification':
  • Context - a message line has been added to the report:
    For Is Spawn Message?:
    When the message is identified as a spawn message, then skip all message type classification and counting processes.
  • Context - a non-spawn message line exists in the report:
    For Error Message?:
    When the message is classified as an error message (msg-err), then increment the total error count by 1.
    For Warning Message?:
    When the message is classified as a warning message (msg-wrn), then increment the total warning count by 1.
    For Information Message?:
    When the message is classified as an information message (msg-inf), then increment the total information count by 1.
  • Context - an error message has been identified:
    For Check if Message Type 43:
    When the message type indicator equals 43, then increment the type 43 error count by 1.
  • Context - a warning message has been identified:
    For DSP Message Type 49 or 52?:
    When the message type indicator equals 49 or 52, then increment the dispatcher count by 1.
  • Context - an entry has been added to the report:
    For Is Message Line?:
    When the entry is evaluated for message line status, then continue with message type classification if it is a message line, otherwise skip processing.
👨‍💻 Technical ACs (Gherkin)
Context: A message line has been added to the report
GIVEN
A message line has been added to the report
Applied to: Is Spawn Message?
WHEN
The message is identified as a spawn message
THEN
Skip all message type classification and counting processes
Context: A non-spawn message line exists in the report
GIVEN
A non-spawn message line exists in the report
Applied to: Error Message?
WHEN
The message is classified as an error message (MSG-ERR)
THEN
Increment the total error count by 1
Applied to: Warning Message?
WHEN
The message is classified as a warning message (MSG-WRN)
THEN
Increment the total warning count by 1
Applied to: Information Message?
WHEN
The message is classified as an information message (MSG-INF)
THEN
Increment the total information count by 1
Context: An error message has been identified
GIVEN
An error message has been identified
Applied to: Check if Message Type 43
WHEN
The message type indicator equals 43
THEN
Increment the type 43 error count by 1
Context: A warning message has been identified
GIVEN
A warning message has been identified
Applied to: DSP Message Type 49 or 52?
WHEN
The message type indicator equals 49 or 52
THEN
Increment the dispatcher count by 1
Context: An entry has been added to the report
GIVEN
An entry has been added to the report
Applied to: Is Message Line?
WHEN
The entry is evaluated for message line status
THEN
Continue with message type classification if it is a message line, otherwise skip processing
R-GCX003-cbl-01475 (+7) File: GCX003.cbl Message Counter Management Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Counter Management':
  • Context - a message line is being processed for counter updates:
    For Skip Counter Update:
    When the message line is identified as a spawn message type, then the system skips all counter updates and proceeds to report index management.
  • Context - a message line is classified as an error message and is not a spawn message:
    For Increment Error Counter:
    When the message type is determined to be an error, then the system adds 1 to the error message counter.
  • Context - an error message is being processed:
    For Increment ERR-43 Counter:
    When the message type indicator equals 43, then the system adds 1 to the err-43 counter in addition to the general error counter.
  • Context - a message line is classified as a warning message and is not a spawn message:
    For Increment Warning Counter:
    When the message type is determined to be a warning, then the system adds 1 to the warning message counter.
  • Context - a warning message is being processed:
    For Increment DSP Counter:
    When the message type indicator is 49 or 52, then the system adds 1 to the dsp counter in addition to the warning counter.
  • Context - a message line is classified as an informational message and is not a spawn message:
    For Increment Info Counter:
    When the message type is determined to be informational, then the system adds 1 to the informational message counter.
  • Context - a message line has been processed for counter updates:
    For Update Report Index:
    When counter processing is complete, then the system adds 1 to the report line index.
  • Context - the report line index is being updated:
    For Set Overflow Message:
    When the maximum number of report lines has been reached, then the system sets message type 9 as an overflow indicator.
👨‍💻 Technical ACs (Gherkin)
Context: A message line is being processed for counter updates
GIVEN
A message line is being processed for counter updates
Applied to: Skip Counter Update
WHEN
The message line is identified as a spawn message type
THEN
The system skips all counter updates and proceeds to report index management
Context: A message line is classified as an error message and is not a spawn message
GIVEN
A message line is classified as an error message and is not a spawn message
Applied to: Increment Error Counter
WHEN
The message type is determined to be an error
THEN
The system adds 1 to the error message counter
Context: An error message is being processed
GIVEN
An error message is being processed
Applied to: Increment ERR-43 Counter
WHEN
The message type indicator equals 43
THEN
The system adds 1 to the ERR-43 counter in addition to the general error counter
Context: A message line is classified as a warning message and is not a spawn message
GIVEN
A message line is classified as a warning message and is not a spawn message
Applied to: Increment Warning Counter
WHEN
The message type is determined to be a warning
THEN
The system adds 1 to the warning message counter
Context: A warning message is being processed
GIVEN
A warning message is being processed
Applied to: Increment DSP Counter
WHEN
The message type indicator is 49 or 52
THEN
The system adds 1 to the DSP counter in addition to the warning counter
Context: A message line is classified as an informational message and is not a spawn message
GIVEN
A message line is classified as an informational message and is not a spawn message
Applied to: Increment Info Counter
WHEN
The message type is determined to be informational
THEN
The system adds 1 to the informational message counter
Context: A message line has been processed for counter updates
GIVEN
A message line has been processed for counter updates
Applied to: Update Report Index
WHEN
Counter processing is complete
THEN
The system adds 1 to the report line index
Context: The report line index is being updated
GIVEN
The report line index is being updated
Applied to: Set Overflow Message
WHEN
The maximum number of report lines has been reached
THEN
The system sets message type 9 as an overflow indicator
R-GCX003-cbl-01483 (+14) File: GCX003.cbl Action Type Processing Coordination Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Action Type Processing Coordination':
  • Context - a train manifest request with action type send:
    For SEND Action with No Errors and No Spawns?:
    When the request has no validation errors and no spawn processing requirements, then execute the full transmission workflow including database storage, edi transmission, duplicate removal, customs reporting, pdf generation, station-specific processing, acknowledgment, and audit logging.
  • Context - a validated train manifest with send action and no errors:
    For Store Train List in Database:
    When the system processes the successful request, then store the train list data in the gcsutrt database table with all equipment and cargo details.
  • Context - a train list stored in the database:
    For Transmit Train List to US Customs EDI:
    When the system processes the transmission step, then call gccu358t module to transmit the train list data via edi to us customs.
  • Context - a processed train manifest report with potential duplicate equipment entries:
    For Remove Duplicate Equipment Entries:
    When the system performs duplicate checking, then scan through report lines and remove duplicate car ids while preserving the first occurrence.
  • Context - a processed train manifest with complete report data:
    For Send Report to Customs MERLIN System:
    When the system sends the report to customs, then format and send the report via emcsend3 to usercode om01247 with train details, equipment counts, and cargo information.
  • Context - a processed train manifest with report data:
    For Generate PDF Report:
    When the system generates pdf documentation, then call gcx904r module to create pdf report with pre-exit report title and export type.
  • Context - a train manifest with a defined crossing station:
    For Is Laredo TX Station?:
    When the system checks the station location, then if the station is laredo tx, execute enhanced reporting; otherwise, execute standard canadian export processing.
  • Context - a train manifest crossing at laredo tx station:
    For Generate Enhanced Format Report:
    When the system processes laredo-specific reporting, then generate new format report with detailed equipment counts, port information, and enhanced layout.
  • Context - an enhanced format report generated for laredo tx station:
    For Generate Second PDF Report:
    When the system creates the second pdf, then call gcx904r module to create pdf with export train report title and 132-character width.
  • Context - a train manifest crossing at a station other than laredo tx:
    For Spawn Canadian Export Report:
    When the system processes export reporting, then send message to gcx141 queue to spawn canadian export report processing.
  • Context - a successfully processed and transmitted train manifest:
    For Set Acknowledgment Only Flag:
    When the system prepares the originator response, then set the report flag to rpt-ack-only to indicate acknowledgment-only response.
  • Context - a processed train manifest request with determined response type:
    For Send Report to Originator:
    When the system sends the response to the originator, then call gcstonly module to send formatted report to the originating terminal with appropriate status indicators.
  • Context - a successfully processed train manifest with cargo additions:
    For Send Activity Audit Logs:
    When the system creates audit trails, then for each added us ccn, create audit log entry with user id, timestamp, and cargo addition message via gct1051e.
  • Context - a train manifest request with action type report:
    For REPORT Action?:
    When the system processes the report-only request, then execute duplicate removal and send report to originator without database storage or edi transmission.
  • Context - a train manifest request that encountered processing errors:
    For Rollback Database Changes:
    When the system handles the error condition, then execute database rollback operation to undo any partial changes made during processing.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest request with action type SEND
GIVEN
A train manifest request with action type SEND
Applied to: SEND Action with No Errors and No Spawns?
WHEN
The request has no validation errors AND no spawn processing requirements
THEN
Execute the full transmission workflow including database storage, EDI transmission, duplicate removal, customs reporting, PDF generation, station-specific processing, acknowledgment, and audit logging
Context: A validated train manifest with SEND action and no errors
GIVEN
A validated train manifest with SEND action and no errors
Applied to: Store Train List in Database
WHEN
The system processes the successful request
THEN
Store the train list data in the GCSUTRT database table with all equipment and cargo details
Context: A train list stored in the database
GIVEN
A train list stored in the database
Applied to: Transmit Train List to US Customs EDI
WHEN
The system processes the transmission step
THEN
Call GCCU358T module to transmit the train list data via EDI to US Customs
Context: A processed train manifest report with potential duplicate equipment entries
GIVEN
A processed train manifest report with potential duplicate equipment entries
Applied to: Remove Duplicate Equipment Entries
WHEN
The system performs duplicate checking
THEN
Scan through report lines and remove duplicate car IDs while preserving the first occurrence
Context: A processed train manifest with complete report data
GIVEN
A processed train manifest with complete report data
Applied to: Send Report to Customs MERLIN System
WHEN
The system sends the report to customs
THEN
Format and send the report via EMCSEND3 to usercode OM01247 with train details, equipment counts, and cargo information
Context: A processed train manifest with report data
GIVEN
A processed train manifest with report data
Applied to: Generate PDF Report
WHEN
The system generates PDF documentation
THEN
Call GCX904R module to create PDF report with Pre-Exit Report title and EXPORT type
Context: A train manifest with a defined crossing station
GIVEN
A train manifest with a defined crossing station
Applied to: Is Laredo TX Station?
WHEN
The system checks the station location
THEN
If the station is Laredo TX, execute enhanced reporting; otherwise, execute standard Canadian export processing
Context: A train manifest crossing at Laredo TX station
GIVEN
A train manifest crossing at Laredo TX station
Applied to: Generate Enhanced Format Report
WHEN
The system processes Laredo-specific reporting
THEN
Generate new format report with detailed equipment counts, port information, and enhanced layout
Context: An enhanced format report generated for Laredo TX station
GIVEN
An enhanced format report generated for Laredo TX station
Applied to: Generate Second PDF Report
WHEN
The system creates the second PDF
THEN
Call GCX904R module to create PDF with Export Train Report title and 132-character width
Context: A train manifest crossing at a station other than Laredo TX
GIVEN
A train manifest crossing at a station other than Laredo TX
Applied to: Spawn Canadian Export Report
WHEN
The system processes export reporting
THEN
Send message to GCX141 queue to spawn Canadian export report processing
Context: A successfully processed and transmitted train manifest
GIVEN
A successfully processed and transmitted train manifest
Applied to: Set Acknowledgment Only Flag
WHEN
The system prepares the originator response
THEN
Set the report flag to RPT-ACK-ONLY to indicate acknowledgment-only response
Context: A processed train manifest request with determined response type
GIVEN
A processed train manifest request with determined response type
Applied to: Send Report to Originator
WHEN
The system sends the response to the originator
THEN
Call GCSTONLY module to send formatted report to the originating terminal with appropriate status indicators
Context: A successfully processed train manifest with cargo additions
GIVEN
A successfully processed train manifest with cargo additions
Applied to: Send Activity Audit Logs
WHEN
The system creates audit trails
THEN
For each added US CCN, create audit log entry with user ID, timestamp, and cargo addition message via GCT1051E
Context: A train manifest request with action type REPORT
GIVEN
A train manifest request with action type REPORT
Applied to: REPORT Action?
WHEN
The system processes the report-only request
THEN
Execute duplicate removal and send report to originator without database storage or EDI transmission
Context: A train manifest request that encountered processing errors
GIVEN
A train manifest request that encountered processing errors
Applied to: Rollback Database Changes
WHEN
The system handles the error condition
THEN
Execute database rollback operation to undo any partial changes made during processing
R-GCX003-cbl-01498 (+14) File: GCX003.cbl Final Processing Steps Execution Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Final Processing Steps Execution':
  • Context - a train processing request has been completed with processing results available:
    For Generate Final Report Headers and Summary:
    When the system generates the final report headers and summary, then the report must include train id in header line 1, user id and terminal info in header line 2, action type and result status in header line 3, us customer train id and eta details in header line 4, detail headers in lines 6-7, and all header lines must be copied to email text lines.
  • Context - a train processing request with a specific action type:
    For Evaluate Request Action Type:
    When the system evaluates the request action type and error status, then if action is send with no errors and no spawns, execute full send processing; if action is report, execute report-only processing; otherwise execute error processing with database rollback.
  • Context - a send action request with no errors and no spawn conditions:
    For SEND Action Processing:
    When the system processes the send action, then the system must store train list in database, transmit via edi, check for duplicates, send reports to customs, generate export reports, send acknowledgment to originator, and create audit logs.
  • Context - a validated train list with equipment details and no processing errors:
    For Store Train List in Database:
    When the system stores the train list in the database, then the train header information including train number, day, origin, consist number, crossing port, eta details, and all equipment records with their cargo information must be inserted into the database.
  • Context - a stored train list ready for customs transmission:
    For Transmit Train List via EDI:
    When the system transmits the train list via edi, then the complete train manifest must be sent to customs system via gccu358t module in background mode, and if aei send is enabled, an aei send log entry must be created.
  • Context - a completed report with potential duplicate equipment entries:
    For Remove Duplicate Equipment Entries:
    When the system scans for duplicate equipment, then if the same car id appears multiple times consecutively, all subsequent occurrences must be blanked out while preserving the first occurrence.
  • Context - a finalized train manifest report ready for customs distribution:
    For Send Report to Customs MERLIN System:
    When the system sends the report to customs merlin system, then the report must be sent to om01247 usercode via emcsend3 module with proper formatting, and if the report exceeds 699 lines, it must be split into multiple emails with continuation headers.
  • Context - a processed train manifest for laredo tx station crossing:
    For Generate Canadian Export Reports:
    When the system generates canadian export reports, then a new format report must be created with train id, equipment counts by type (cars loaded/empty, containers loaded/empty, locomotives), eta details, port information, and total equipment count.
  • Context - a processed train manifest for non-laredo station crossing:
    For Generate Enhanced Format Reports:
    When the system generates enhanced format reports, then a gcx141 message must be created with the us customer train id and sent via message queue for enhanced report generation.
  • Context - completed train manifest reports in text format:
    For Generate PDF Reports:
    When the system generates pdf reports, then two pdf reports must be created: a pre-exit report with 80-character width and an export train report with 132-character width, both containing the complete manifest data.
  • Context - a completed train processing request with results:
    For Send Acknowledgment to Originator:
    When the system sends acknowledgment to the originator, then the acknowledgment must include appropriate call letters based on processing result (error, sent, or report), complete report content based on report type (all lines for full report, headers only for summary), and be sent to the originating terminal or alternate terminal if specified.
  • Context - cargo records that were added during train processing:
    For Create Activity Audit Logs:
    When the system creates activity audit logs, then for each added cargo record, a log entry must be created with us cargo type, action code zzz, sending transaction gct0031e, user acf2 id, current date and time, cargo ccn number, and cargo added message.
  • Context - a report action request:
    For REPORT Action Processing:
    When the system processes the report action, then the system must check for duplicates, generate and send the report to originator without storing data or transmitting to customs.
  • Context - an invalid action type or error conditions during processing:
    For OTHER Action Processing:
    When the system executes error processing, then the system must perform database rollback to undo any changes, check for duplicates, and send error report to originator.
  • Context - an aei-enabled train request that has been processed:
    For Send Acknowledgment to Originator:
    When the system sends aei email notifications, then email notifications must be sent to configured aei users retrieved from database, or to default merlin id if no users configured, with subject indicating train sent or not sent status and complete report content.
👨‍💻 Technical ACs (Gherkin)
Context: A train processing request has been completed with processing results available
GIVEN
A train processing request has been completed with processing results available
Applied to: Generate Final Report Headers and Summary
WHEN
The system generates the final report headers and summary
THEN
The report must include train ID in header line 1, user ID and terminal info in header line 2, action type and result status in header line 3, US customer train ID and ETA details in header line 4, detail headers in lines 6-7, and all header lines must be copied to email text lines
Context: A train processing request with a specific action type
GIVEN
A train processing request with a specific action type
Applied to: Evaluate Request Action Type
WHEN
The system evaluates the request action type and error status
THEN
If action is SEND with no errors and no spawns, execute full send processing; if action is REPORT, execute report-only processing; otherwise execute error processing with database rollback
Context: A SEND action request with no errors and no spawn conditions
GIVEN
A SEND action request with no errors and no spawn conditions
Applied to: SEND Action Processing
WHEN
The system processes the SEND action
THEN
The system must store train list in database, transmit via EDI, check for duplicates, send reports to customs, generate export reports, send acknowledgment to originator, and create audit logs
Context: A validated train list with equipment details and no processing errors
GIVEN
A validated train list with equipment details and no processing errors
Applied to: Store Train List in Database
WHEN
The system stores the train list in the database
THEN
The train header information including train number, day, origin, consist number, crossing port, ETA details, and all equipment records with their cargo information must be inserted into the database
Context: A stored train list ready for customs transmission
GIVEN
A stored train list ready for customs transmission
Applied to: Transmit Train List via EDI
WHEN
The system transmits the train list via EDI
THEN
The complete train manifest must be sent to customs system via GCCU358T module in background mode, and if AEI send is enabled, an AEI send log entry must be created
Context: A completed report with potential duplicate equipment entries
GIVEN
A completed report with potential duplicate equipment entries
Applied to: Remove Duplicate Equipment Entries
WHEN
The system scans for duplicate equipment
THEN
If the same car ID appears multiple times consecutively, all subsequent occurrences must be blanked out while preserving the first occurrence
Context: A finalized train manifest report ready for customs distribution
GIVEN
A finalized train manifest report ready for customs distribution
Applied to: Send Report to Customs MERLIN System
WHEN
The system sends the report to customs MERLIN system
THEN
The report must be sent to OM01247 usercode via EMCSEND3 module with proper formatting, and if the report exceeds 699 lines, it must be split into multiple emails with continuation headers
Context: A processed train manifest for Laredo TX station crossing
GIVEN
A processed train manifest for Laredo TX station crossing
Applied to: Generate Canadian Export Reports
WHEN
The system generates Canadian export reports
THEN
A new format report must be created with train ID, equipment counts by type (cars loaded/empty, containers loaded/empty, locomotives), ETA details, port information, and total equipment count
Context: A processed train manifest for non-Laredo station crossing
GIVEN
A processed train manifest for non-Laredo station crossing
Applied to: Generate Enhanced Format Reports
WHEN
The system generates enhanced format reports
THEN
A GCX141 message must be created with the US customer train ID and sent via message queue for enhanced report generation
Context: Completed train manifest reports in text format
GIVEN
Completed train manifest reports in text format
Applied to: Generate PDF Reports
WHEN
The system generates PDF reports
THEN
Two PDF reports must be created: a pre-exit report with 80-character width and an export train report with 132-character width, both containing the complete manifest data
Context: A completed train processing request with results
GIVEN
A completed train processing request with results
Applied to: Send Acknowledgment to Originator
WHEN
The system sends acknowledgment to the originator
THEN
The acknowledgment must include appropriate call letters based on processing result (error, sent, or report), complete report content based on report type (all lines for full report, headers only for summary), and be sent to the originating terminal or alternate terminal if specified
Context: Cargo records that were added during train processing
GIVEN
Cargo records that were added during train processing
Applied to: Create Activity Audit Logs
WHEN
The system creates activity audit logs
THEN
For each added cargo record, a log entry must be created with US cargo type, action code ZZZ, sending transaction GCT0031E, user ACF2 ID, current date and time, cargo CCN number, and cargo added message
Context: A REPORT action request
GIVEN
A REPORT action request
Applied to: REPORT Action Processing
WHEN
The system processes the REPORT action
THEN
The system must check for duplicates, generate and send the report to originator without storing data or transmitting to customs
Context: An invalid action type or error conditions during processing
GIVEN
An invalid action type or error conditions during processing
Applied to: OTHER Action Processing
WHEN
The system executes error processing
THEN
The system must perform database rollback to undo any changes, check for duplicates, and send error report to originator
Context: An AEI-enabled train request that has been processed
GIVEN
An AEI-enabled train request that has been processed
Applied to: Send Acknowledgment to Originator
WHEN
The system sends AEI email notifications
THEN
Email notifications must be sent to configured AEI users retrieved from database, or to default MERLIN ID if no users configured, with subject indicating train sent or not sent status and complete report content
R-GCX003-cbl-01513 (+18) File: GCX003.cbl B520: Generate Error Messages Merged 19 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'B520: Generate Error Messages':
  • Context - a cargo record exists for processing:
    For Empty Residue Cargo?:
    When the cargo is classified as empty residue (88-gcusrt-m1109-empty-residue), then skip all error message generation and exit the error processing routine.
  • Context - no cargo is found for the equipment and residue weight is greater than 0 and emergency response code is not found or emergency response weight threshold is less than or equal to 7:
    For No Cargo Found with Residue Weight?:
    When the equipment is marked as empty, then skip error message generation and exit the error processing routine.
  • Context - cargo is found and cargo type is empty equipment (88-gcusrt-m1109-empty-equip):
    For Empty Equipment with Country Codes CAMX/MXCA?:
    When the origin-destination country codes are not 'camx' or 'mxca', then generate message 27 (empty equipment warning).
  • Context - cargo is found and bond type is 'it' (in-transit):
    For IT Bond Type Found?:
    When the cargo does not have special manifest original designation, then execute crowley process logic (b525-crowley-process).
  • Context - waybill is found and cargo is found and cargo has special manifest original designation:
    For Special Manifest at Woburn-PQ Station?:
    When the crossing port is woburn-pq station, then continue processing without generating error messages.
  • Context - waybill is found and cargo is found and cargo has special manifest special designation:
    For Special Manifest Special Type?:
    When the crossing port is not woburn-pq station, then continue processing without generating error messages.
  • Context - waybill is found and cargo is found and bond type is us-canada-us (88-gcusrt-m1201-us-can-us) and cargo has special tr designation:
    For US-CAN-US Bond with Special TR?:
    When the crossing port is laredo tx station, then set the special tr found flag to true.
  • Context - waybill is found and cargo is found and bond type is export (88-gcusrt-m1109-export) and cargo has special 88 designation:
    For Export Bond with Special 88?:
    When processing the cargo record, then set the us-mexico 88 found flag to true.
  • Context - waybill is found and cargo is found and bond type is export (88-gcusrt-m1109-export) and cargo does not have special 88 designation and origin-destination country codes are 'usmx':
    For Export Bond without Special 88?:
    When the crossing port is not laredo tx station, then execute us-mexico export detour process (b550-detour-process).
  • Context - waybill is found and cargo is found:
    For Cargo Found with Various Bond Conditions?:
    When bond type is transport export or us-canada-us (without special tr) or default type and specific cargo status conditions are met and cargo is marked for it creation, then execute appropriate detour processing logic and set corresponding creation flags.
  • Context - container is not found and equipment is marked as loaded and equipment is not a special business unit van:
    For Waybill Not Found Scenarios?:
    When waybill is not found or waybill is not found and container is not found, then generate message 10 (waybill not found error).
  • Context - waybill is found and no cargo is found and equipment is marked as loaded and equipment is not a conveying car and idler indicator is not 'i':
    For Waybill Found but No Cargo?:
    When container is not found or container is found but load/empty indicator is 'l', then generate message 15 (no cargo found error) with waybill root key and date.
  • Context - cargo is found:
    For Cargo Status Issues?:
    When cargo status is pending (88-gcusrt-rt10-cpcargo-pending) or deleted (88-gcusrt-rt10-cpcargo-deleted) or error (88-gcusrt-rt10-cpcargo-error), then generate message 16 (cargo status error).
    For Laredo Station Specific Checks?:
    When the crossing port is laredo tx station, then evaluate cargo hold status and border conditions to generate messages 46-52 (fen not found, kcm not found, hold border, hold apply, hold border apply).
  • Context - cargo is found and bond type is 'tr' (transit):
    For TR Bond Export Status?:
    When cargo status description equals export status constant, then generate message 12 (tr bond status error).
  • Context - cargo is found and bond type is 'mt' (merchandise in transit) and vessel name is not 'train' and not spaces:
    For MT Bond Vessel Issues?:
    When the crossing port station code equals the cargo location id, then generate message 25 (mt bond vessel error).
  • Context - cargo is found and bond type is 'te' (transport export):
    For TE Bond Vessel Issues?:
    When vessel name character 23 is 't', then generate message 17 (te bond vessel error).
  • Context - cargo is found and bond type is not 'te' and not 'mt':
    For Non-Train Vessel Issues?:
    When vessel name is not 'train', then generate message 17 (non-train vessel error).
  • Context - cargo is found and bond type is transport export and cargo is not created for it and cargo status is not export and cargo is billable as cprs:
    For TE Bond Port Change Conditions?:
    When cargo location id does not match the crossing port station code, then execute te bond detour processing (b551-detour-for-te-bond).
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists for processing
GIVEN
A cargo record exists for processing
Applied to: Empty Residue Cargo?
WHEN
The cargo is classified as empty residue (88-GCUSRT-M1109-EMPTY-RESIDUE)
THEN
Skip all error message generation and exit the error processing routine
Context: No cargo is found for the equipment AND residue weight is greater than 0 AND emergency response code is not found OR emergency response weight threshold is less than or equal to 7
GIVEN
No cargo is found for the equipment AND residue weight is greater than 0 AND emergency response code is not found OR emergency response weight threshold is less than or equal to 7
Applied to: No Cargo Found with Residue Weight?
WHEN
The equipment is marked as empty
THEN
Skip error message generation and exit the error processing routine
Context: Cargo is found AND cargo type is empty equipment (88-GCUSRT-M1109-EMPTY-EQUIP)
GIVEN
Cargo is found AND cargo type is empty equipment (88-GCUSRT-M1109-EMPTY-EQUIP)
Applied to: Empty Equipment with Country Codes CAMX/MXCA?
WHEN
The origin-destination country codes are NOT 'CAMX' or 'MXCA'
THEN
Generate message 27 (empty equipment warning)
Context: Cargo is found AND bond type is 'IT' (in-transit)
GIVEN
Cargo is found AND bond type is 'IT' (in-transit)
Applied to: IT Bond Type Found?
WHEN
The cargo does NOT have special manifest original designation
THEN
Execute Crowley process logic (B525-CROWLEY-PROCESS)
Context: Waybill is found AND cargo is found AND cargo has special manifest original designation
GIVEN
Waybill is found AND cargo is found AND cargo has special manifest original designation
Applied to: Special Manifest at Woburn-PQ Station?
WHEN
The crossing port is Woburn-PQ station
THEN
Continue processing without generating error messages
Context: Waybill is found AND cargo is found AND cargo has special manifest special designation
GIVEN
Waybill is found AND cargo is found AND cargo has special manifest special designation
Applied to: Special Manifest Special Type?
WHEN
The crossing port is NOT Woburn-PQ station
THEN
Continue processing without generating error messages
Context: Waybill is found AND cargo is found AND bond type is US-Canada-US (88-GCUSRT-M1201-US-CAN-US) AND cargo has special TR designation
GIVEN
Waybill is found AND cargo is found AND bond type is US-Canada-US (88-GCUSRT-M1201-US-CAN-US) AND cargo has special TR designation
Applied to: US-CAN-US Bond with Special TR?
WHEN
The crossing port is Laredo TX station
THEN
Set the special TR found flag to true
Context: Waybill is found AND cargo is found AND bond type is export (88-GCUSRT-M1109-EXPORT) AND cargo has special 88 designation
GIVEN
Waybill is found AND cargo is found AND bond type is export (88-GCUSRT-M1109-EXPORT) AND cargo has special 88 designation
Applied to: Export Bond with Special 88?
WHEN
Processing the cargo record
THEN
Set the US-Mexico 88 found flag to true
Context: Waybill is found AND cargo is found AND bond type is export (88-GCUSRT-M1109-EXPORT) AND cargo does NOT have special 88 designation AND origin-destination country codes are 'USMX'
GIVEN
Waybill is found AND cargo is found AND bond type is export (88-GCUSRT-M1109-EXPORT) AND cargo does NOT have special 88 designation AND origin-destination country codes are 'USMX'
Applied to: Export Bond without Special 88?
WHEN
The crossing port is NOT Laredo TX station
THEN
Execute US-Mexico export detour process (B550-DETOUR-PROCESS)
Context: Waybill is found AND cargo is found
GIVEN
Waybill is found AND cargo is found
Applied to: Cargo Found with Various Bond Conditions?
WHEN
Bond type is transport export OR US-Canada-US (without special TR) OR default type AND specific cargo status conditions are met AND cargo is marked for IT creation
THEN
Execute appropriate detour processing logic and set corresponding creation flags
Context: Container is not found AND equipment is marked as loaded AND equipment is not a special business unit van
GIVEN
Container is not found AND equipment is marked as loaded AND equipment is not a special business unit van
Applied to: Waybill Not Found Scenarios?
WHEN
Waybill is not found OR waybill is not found and container is not found
THEN
Generate message 10 (waybill not found error)
Context: Waybill is found AND no cargo is found AND equipment is marked as loaded AND equipment is not a conveying car AND idler indicator is not 'I'
GIVEN
Waybill is found AND no cargo is found AND equipment is marked as loaded AND equipment is not a conveying car AND idler indicator is not 'I'
Applied to: Waybill Found but No Cargo?
WHEN
Container is not found OR container is found but load/empty indicator is 'L'
THEN
Generate message 15 (no cargo found error) with waybill root key and date
Context: Cargo is found
GIVEN
Cargo is found
Applied to: Cargo Status Issues?
WHEN
Cargo status is pending (88-GCUSRT-RT10-CPCARGO-PENDING) OR deleted (88-GCUSRT-RT10-CPCARGO-DELETED) OR error (88-GCUSRT-RT10-CPCARGO-ERROR)
THEN
Generate message 16 (cargo status error)
Applied to: Laredo Station Specific Checks?
WHEN
The crossing port is Laredo TX station
THEN
Evaluate cargo hold status and border conditions to generate messages 46-52 (FEN not found, KCM not found, hold border, hold apply, hold border apply)
Context: Cargo is found AND bond type is 'TR' (transit)
GIVEN
Cargo is found AND bond type is 'TR' (transit)
Applied to: TR Bond Export Status?
WHEN
Cargo status description equals export status constant
THEN
Generate message 12 (TR bond status error)
Context: Cargo is found AND bond type is 'MT' (merchandise in transit) AND vessel name is not 'TRAIN' and not spaces
GIVEN
Cargo is found AND bond type is 'MT' (merchandise in transit) AND vessel name is not 'TRAIN' and not spaces
Applied to: MT Bond Vessel Issues?
WHEN
The crossing port station code equals the cargo location ID
THEN
Generate message 25 (MT bond vessel error)
Context: Cargo is found AND bond type is 'TE' (transport export)
GIVEN
Cargo is found AND bond type is 'TE' (transport export)
Applied to: TE Bond Vessel Issues?
WHEN
Vessel name character 23 is 'T'
THEN
Generate message 17 (TE bond vessel error)
Context: Cargo is found AND bond type is NOT 'TE' and NOT 'MT'
GIVEN
Cargo is found AND bond type is NOT 'TE' and NOT 'MT'
Applied to: Non-Train Vessel Issues?
WHEN
Vessel name is not 'TRAIN'
THEN
Generate message 17 (non-train vessel error)
Context: Cargo is found AND bond type is transport export AND cargo is not created for IT AND cargo status is not export AND cargo is billable as CPRS
GIVEN
Cargo is found AND bond type is transport export AND cargo is not created for IT AND cargo status is not export AND cargo is billable as CPRS
Applied to: TE Bond Port Change Conditions?
WHEN
Cargo location ID does not match the crossing port station code
THEN
Execute TE bond detour processing (B551-DETOUR-FOR-TE-BOND)
R-GCX003-cbl-01532 (+3) File: GCX003.cbl D: Call SCAC Security Module GCCSCAC Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'D: Call SCAC Security Module GCCSCAC':
  • Context - a user attempts to access the train manifest system with their acf2 user id and cp-scac code:
    For SCAC Access Valid?:
    When the scac access validation returns invalid and the request is not an aei train send request, then the system should set message fourteen as active, perform report index increment, set user access to denied, and terminate security validation.
  • Context - a user has passed scac access validation:
    For User Profile Found?:
    When the system attempts to retrieve the user's security profile from gcstbrt table using their acf2 user id, then if the profile is found successfully, load the user security segment data, otherwise initialize an empty security segment.
  • Context - a user requests to perform a send action on train manifest data:
    For User Has UTF-ADD Authority?:
    When the user does not have utf-add authority of 'u' or 's' and the request is not an aei train send request, then the system should set message thirteen as active, perform report index increment, and set user access to denied.
  • Context - a user has valid send action permissions and no errors have occurred:
    For User Has Special Manifest Authority?:
    When the user's utf special manifest authority is not 's' and the request is not an aei train send request, then the system should set the user as not authorized for special manifest processing.
👨‍💻 Technical ACs (Gherkin)
Context: A user attempts to access the train manifest system with their ACF2 user ID and CP-SCAC code
GIVEN
A user attempts to access the train manifest system with their ACF2 user ID and CP-SCAC code
Applied to: SCAC Access Valid?
WHEN
The SCAC access validation returns invalid AND the request is not an AEI train send request
THEN
The system should set message fourteen as active, perform report index increment, set user access to denied, and terminate security validation
Context: A user has passed SCAC access validation
GIVEN
A user has passed SCAC access validation
Applied to: User Profile Found?
WHEN
The system attempts to retrieve the user's security profile from GCSTBRT table using their ACF2 user ID
THEN
If the profile is found successfully, load the user security segment data, otherwise initialize an empty security segment
Context: A user requests to perform a send action on train manifest data
GIVEN
A user requests to perform a send action on train manifest data
Applied to: User Has UTF-ADD Authority?
WHEN
The user does not have UTF-ADD authority of 'U' or 'S' AND the request is not an AEI train send request
THEN
The system should set message thirteen as active, perform report index increment, and set user access to denied
Context: A user has valid send action permissions and no errors have occurred
GIVEN
A user has valid send action permissions and no errors have occurred
Applied to: User Has Special Manifest Authority?
WHEN
The user's UTF special manifest authority is not 'S' AND the request is not an AEI train send request
THEN
The system should set the user as not authorized for special manifest processing
R-GCX003-cbl-01536 (+14) File: GCX003.cbl O: Check for Special Bond Processing Merged 15 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'O: Check for Special Bond Processing':
  • Context - cargo exists for the equipment:
    For Bond Type = IT or IE?:
    When the cargo bond type code is 'it' or 'ie', then set it bond found flag to true for subsequent special manifest evaluation.
    For Bond Type = TE?:
    When the cargo bond type code is 'te', then set te bond found flag to true for subsequent port change evaluation.
    For Bond Type = TR?:
    When the cargo bond type code is 'tr', then set tr bond found flag to true for subsequent diversion evaluation.
  • Context - cargo has it bond type and tr created for it flag is not 'y' and special manifest original is not set:
    For Create IT Export Special Manifest:
    When action is send and user is authorized for special manifests, then generate message 23, add report line, set it export spawn flag, and perform special manifest creation.
  • Context - cargo has te bond type and tr created for it is spaces and cargo status is not export and cargo is billed as cprs and location id does not equal station code:
    For Create TE Port Change Manifest:
    When action is send and user is authorized for special manifests, then generate message 20, add report line, set port change spawn flag, and perform special manifest creation.
  • Context - cargo has tr bond type and tr created for it is spaces and cargo status equals release:
    For Create TR Diversion Manifest:
    When action is send and user is authorized for special manifests, then generate message 23, add report line, set detour spawn flag, and perform special manifest creation.
  • Context - cargo has default bond type and tr created for it is spaces and cargo status equals release and special manifest original is not set:
    For Create Border Clearance Manifest:
    When action is send and user is authorized for special manifests, then generate message 23, add report line, set detour spawn flag, and perform special manifest creation.
  • Context - cargo has export bond type and special manifest is spaces and origin-destination country codes equal 'usmx' and station is not laredo tx:
    For Create US-MX Export Manifest:
    When action is send and user is authorized for special manifests, then generate message 23, add report line, set 88 tr detour spawn flag, and perform special manifest creation.
  • Context - special manifest processing is required for any bond type:
    For Generate Authorization Error Message:
    When action is send and user is not authorized for special manifests, then generate message 43, add report line to output, and continue normal processing without creating special manifest.
  • Context - cargo exists with us-canada-us bond type and tr created for it is not 'y' and cargo is not usmx special tr:
    For Set TR Bond Found Flag:
    When processing cargo information, then set tr bond found flag to true.
  • Context - cargo exists with transport export bond type and tr created for it is not 'y':
    For Set TE Bond Found Flag:
    When processing cargo information, then set te bond found flag to true.
  • Context - cargo exists:
    For Set IT Bond Found Flag:
    When cargo special manifest original flag is set, then set special manifest it found flag to true.
  • Context - cargo exists with transport export bond type:
    For Set TE Bond Found Flag:
    When cargo special manifest special flag is set, then set special manifest te found flag to true.
  • Context - cargo exists with export bond type:
    For Set Special Manifest Spawn Flag:
    When cargo usmx special 88 flag is set, then set usmx 88 found flag to true.
  • Context - cargo exists with us-canada-us bond type:
    For Set Special Manifest Spawn Flag:
    When cargo usmx special tr flag is set, then set special tr found flag to true.
👨‍💻 Technical ACs (Gherkin)
Context: Cargo exists for the equipment
GIVEN
Cargo exists for the equipment
Applied to: Bond Type = IT or IE?
WHEN
The cargo bond type code is 'IT' or 'IE'
THEN
Set IT bond found flag to true for subsequent special manifest evaluation
Applied to: Bond Type = TE?
WHEN
The cargo bond type code is 'TE'
THEN
Set TE bond found flag to true for subsequent port change evaluation
Applied to: Bond Type = TR?
WHEN
The cargo bond type code is 'TR'
THEN
Set TR bond found flag to true for subsequent diversion evaluation
Context: Cargo has IT bond type and TR created for IT flag is not 'Y' and special manifest original is not set
GIVEN
Cargo has IT bond type and TR created for IT flag is not 'Y' and special manifest original is not set
Applied to: Create IT Export Special Manifest
WHEN
Action is SEND and user is authorized for special manifests
THEN
Generate message 23, add report line, set IT export spawn flag, and perform special manifest creation
Context: Cargo has TE bond type and TR created for IT is spaces and cargo status is not export and cargo is billed as CPRS and location ID does not equal station code
GIVEN
Cargo has TE bond type and TR created for IT is spaces and cargo status is not export and cargo is billed as CPRS and location ID does not equal station code
Applied to: Create TE Port Change Manifest
WHEN
Action is SEND and user is authorized for special manifests
THEN
Generate message 20, add report line, set port change spawn flag, and perform special manifest creation
Context: Cargo has TR bond type and TR created for IT is spaces and cargo status equals release
GIVEN
Cargo has TR bond type and TR created for IT is spaces and cargo status equals release
Applied to: Create TR Diversion Manifest
WHEN
Action is SEND and user is authorized for special manifests
THEN
Generate message 23, add report line, set detour spawn flag, and perform special manifest creation
Context: Cargo has default bond type and TR created for IT is spaces and cargo status equals release and special manifest original is not set
GIVEN
Cargo has default bond type and TR created for IT is spaces and cargo status equals release and special manifest original is not set
Applied to: Create Border Clearance Manifest
WHEN
Action is SEND and user is authorized for special manifests
THEN
Generate message 23, add report line, set detour spawn flag, and perform special manifest creation
Context: Cargo has export bond type and special manifest is spaces and origin-destination country codes equal 'USMX' and station is not Laredo TX
GIVEN
Cargo has export bond type and special manifest is spaces and origin-destination country codes equal 'USMX' and station is not Laredo TX
Applied to: Create US-MX Export Manifest
WHEN
Action is SEND and user is authorized for special manifests
THEN
Generate message 23, add report line, set 88 TR detour spawn flag, and perform special manifest creation
Context: Special manifest processing is required for any bond type
GIVEN
Special manifest processing is required for any bond type
Applied to: Generate Authorization Error Message
WHEN
Action is SEND and user is not authorized for special manifests
THEN
Generate message 43, add report line to output, and continue normal processing without creating special manifest
Context: Cargo exists with US-Canada-US bond type and TR created for IT is not 'Y' and cargo is not USMX special TR
GIVEN
Cargo exists with US-Canada-US bond type and TR created for IT is not 'Y' and cargo is not USMX special TR
Applied to: Set TR Bond Found Flag
WHEN
Processing cargo information
THEN
Set TR bond found flag to true
Context: Cargo exists with transport export bond type and TR created for IT is not 'Y'
GIVEN
Cargo exists with transport export bond type and TR created for IT is not 'Y'
Applied to: Set TE Bond Found Flag
WHEN
Processing cargo information
THEN
Set TE bond found flag to true
Context: Cargo exists
GIVEN
Cargo exists
Applied to: Set IT Bond Found Flag
WHEN
Cargo special manifest original flag is set
THEN
Set special manifest IT found flag to true
Context: Cargo exists with transport export bond type
GIVEN
Cargo exists with transport export bond type
Applied to: Set TE Bond Found Flag
WHEN
Cargo special manifest special flag is set
THEN
Set special manifest TE found flag to true
Context: Cargo exists with export bond type
GIVEN
Cargo exists with export bond type
Applied to: Set Special Manifest Spawn Flag
WHEN
Cargo USMX special 88 flag is set
THEN
Set USMX 88 found flag to true
Context: Cargo exists with US-Canada-US bond type
GIVEN
Cargo exists with US-Canada-US bond type
Applied to: Set Special Manifest Spawn Flag
WHEN
Cargo USMX special TR flag is set
THEN
Set special TR found flag to true
R-GCX003-cbl-01551 (+17) File: GCX003.cbl F: Scan for Container Cross Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'F: Scan for Container Cross':
  • Context - container cross-reference scanning process is starting:
    For Initialize Container Table and Counters:
    When system begins processing inquiry bottom line records, then container table is cleared, container counter is set to 1, and container cross-reference table is initialized to spaces.
  • Context - container processing has been initialized:
    For Position to First FWIQBOTL Record:
    When system needs to start reading inquiry bottom line records, then system positions to first fwiqbotl record with segment type 'fwiqbotl', clears key field, and sets function to gnp.
  • Context - system is processing inquiry bottom line records:
    For More FWIQBOTL Records Available?:
    When system checks for additional records to process, then processing continues if status code is spaces and container counter is 30 or less, otherwise processing stops.
  • Context - more inquiry records are available for processing:
    For Read Next FWIQBOTL Record:
    When system reads the next fwiqbotl record, then system calls fwiqio with gnp function to retrieve next inquiry bottom line record.
  • Context - an inquiry bottom line record has been retrieved:
    For Is Record Type 'T/C XREF'?:
    When system examines the record content, then record is processed as container cross-reference if positions 1-8 contain 't/c xref', otherwise record is skipped.
  • Context - record is confirmed as container cross-reference type:
    For Extract Container ID from Position 28-39:
    When system processes the container information, then container id is extracted from positions 28-39 of the inquiry bottom line record.
  • Context - container id has been extracted from the record:
    For Extract Waybill Railroad from Position 10-12:
    When system processes waybill reference information, then waybill railroad code is extracted from positions 10-12 of the inquiry record.
  • Context - waybill railroad code has been extracted:
    For Extract Waybill Station from Position 14-19:
    When system continues processing waybill reference information, then waybill station code is extracted from positions 14-19 of the inquiry record.
  • Context - waybill station code has been extracted:
    For Extract Waybill Number from Position 21-26:
    When system completes waybill reference extraction, then waybill number is extracted from positions 21-26 of the inquiry record.
  • Context - all waybill reference components have been extracted:
    For Replace Spaces with Zeros in Waybill Fields:
    When system standardizes the waybill reference format, then all spaces in the combined waybill reference are replaced with zeros.
  • Context - container id and standardized waybill reference have been extracted:
    For Store Container Cross-Reference Data:
    When system stores the cross-reference information, then container id and waybill reference are stored in the container cross-reference table at the current counter position.
  • Context - container cross-reference data has been stored:
    For Increment Container Counter:
    When system prepares for next container record, then container counter is incremented by 1.
  • Context - container counter has been incremented:
    For Container Counter > 30?:
    When system checks processing limits, then processing stops if container counter exceeds 30, otherwise processing continues with next record.
  • Context - record does not contain 't/c xref' in positions 1-8:
    For Skip Non-Container Record:
    When system processes the non-container record, then record is skipped and system continues to next available record.
  • Context - all available inquiry records have been processed:
    For Any Containers Found?:
    When system evaluates processing results, then container processing is successful if first container id is not spaces or low-values, otherwise no containers are found.
  • Context - at least one valid container cross-reference was found:
    For Set First Container as Current Equipment:
    When system initializes equipment processing, then first container id from the cross-reference table is set as current equipment id.
  • Context - first container has been set as current equipment:
    For Mark Container Found Status:
    When system updates processing status, then container found status and container iq found status are both set to true.
  • Context - no valid container cross-references were found:
    For Mark No Containers Found Status:
    When system updates processing status, then container not found status and container iq not found status are both set to true.
👨‍💻 Technical ACs (Gherkin)
Context: Container cross-reference scanning process is starting
GIVEN
Container cross-reference scanning process is starting
Applied to: Initialize Container Table and Counters
WHEN
System begins processing inquiry bottom line records
THEN
Container table is cleared, container counter is set to 1, and container cross-reference table is initialized to spaces
Context: Container processing has been initialized
GIVEN
Container processing has been initialized
Applied to: Position to First FWIQBOTL Record
WHEN
System needs to start reading inquiry bottom line records
THEN
System positions to first FWIQBOTL record with segment type 'FWIQBOTL', clears key field, and sets function to GNP
Context: System is processing inquiry bottom line records
GIVEN
System is processing inquiry bottom line records
Applied to: More FWIQBOTL Records Available?
WHEN
System checks for additional records to process
THEN
Processing continues if status code is spaces AND container counter is 30 or less, otherwise processing stops
Context: More inquiry records are available for processing
GIVEN
More inquiry records are available for processing
Applied to: Read Next FWIQBOTL Record
WHEN
System reads the next FWIQBOTL record
THEN
System calls FWIQIO with GNP function to retrieve next inquiry bottom line record
Context: An inquiry bottom line record has been retrieved
GIVEN
An inquiry bottom line record has been retrieved
Applied to: Is Record Type 'T/C XREF'?
WHEN
System examines the record content
THEN
Record is processed as container cross-reference if positions 1-8 contain 'T/C XREF', otherwise record is skipped
Context: Record is confirmed as container cross-reference type
GIVEN
Record is confirmed as container cross-reference type
Applied to: Extract Container ID from Position 28-39
WHEN
System processes the container information
THEN
Container ID is extracted from positions 28-39 of the inquiry bottom line record
Context: Container ID has been extracted from the record
GIVEN
Container ID has been extracted from the record
Applied to: Extract Waybill Railroad from Position 10-12
WHEN
System processes waybill reference information
THEN
Waybill railroad code is extracted from positions 10-12 of the inquiry record
Context: Waybill railroad code has been extracted
GIVEN
Waybill railroad code has been extracted
Applied to: Extract Waybill Station from Position 14-19
WHEN
System continues processing waybill reference information
THEN
Waybill station code is extracted from positions 14-19 of the inquiry record
Context: Waybill station code has been extracted
GIVEN
Waybill station code has been extracted
Applied to: Extract Waybill Number from Position 21-26
WHEN
System completes waybill reference extraction
THEN
Waybill number is extracted from positions 21-26 of the inquiry record
Context: All waybill reference components have been extracted
GIVEN
All waybill reference components have been extracted
Applied to: Replace Spaces with Zeros in Waybill Fields
WHEN
System standardizes the waybill reference format
THEN
All spaces in the combined waybill reference are replaced with zeros
Context: Container ID and standardized waybill reference have been extracted
GIVEN
Container ID and standardized waybill reference have been extracted
Applied to: Store Container Cross-Reference Data
WHEN
System stores the cross-reference information
THEN
Container ID and waybill reference are stored in the container cross-reference table at the current counter position
Context: Container cross-reference data has been stored
GIVEN
Container cross-reference data has been stored
Applied to: Increment Container Counter
WHEN
System prepares for next container record
THEN
Container counter is incremented by 1
Context: Container counter has been incremented
GIVEN
Container counter has been incremented
Applied to: Container Counter > 30?
WHEN
System checks processing limits
THEN
Processing stops if container counter exceeds 30, otherwise processing continues with next record
Context: Record does not contain 'T/C XREF' in positions 1-8
GIVEN
Record does not contain 'T/C XREF' in positions 1-8
Applied to: Skip Non-Container Record
WHEN
System processes the non-container record
THEN
Record is skipped and system continues to next available record
Context: All available inquiry records have been processed
GIVEN
All available inquiry records have been processed
Applied to: Any Containers Found?
WHEN
System evaluates processing results
THEN
Container processing is successful if first container ID is not spaces or low-values, otherwise no containers are found
Context: At least one valid container cross-reference was found
GIVEN
At least one valid container cross-reference was found
Applied to: Set First Container as Current Equipment
WHEN
System initializes equipment processing
THEN
First container ID from the cross-reference table is set as current equipment ID
Context: First container has been set as current equipment
GIVEN
First container has been set as current equipment
Applied to: Mark Container Found Status
WHEN
System updates processing status
THEN
Container found status and container IQ found status are both set to true
Context: No valid container cross-references were found
GIVEN
No valid container cross-references were found
Applied to: Mark No Containers Found Status
WHEN
System updates processing status
THEN
Container not found status and container IQ not found status are both set to true
R-GCX003-cbl-01569 (+19) File: GCX003.cbl F: Execute FWCARGET Call Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'F: Execute FWCARGET Call':
  • Context - a waybill retrieval request is initiated for an equipment id:
    For First Call or Different Equipment ID?:
    When the system checks if this is the first fwcarget call or if the current equipment id differs from the previously held equipment id, then the system proceeds with parameter initialization if it's a first call or different equipment, otherwise exits the process.
  • Context - a waybill retrieval operation needs to be performed:
    For Initialize FWCARGET Parameters:
    When the system initializes fwcarget parameters, then shiproot and fwwarget-parm structures are cleared and the current equipment id is stored as the held equipment id.
  • Context - fwcarget parameters are being configured:
    For Set Waybill Type Criteria - Exclude Types 98/99:
    When the system sets waybill type criteria, then waybill types 98 and 99 are excluded from the retrieval process.
    For Set Status Criteria - Include All Status Types:
    When the system sets status criteria, then all status types are included in the waybill retrieval process.
    For Set EDI Criteria - Exclude Incomplete EDI:
    When the system sets edi criteria, then waybills with incomplete edi processing are excluded from retrieval.
    For Include Temporary Waybills:
    When the system sets temporary waybill criteria, then temporary waybills are included in the retrieval process.
    For Exclude Corrector Waybills:
    When the system sets corrector waybill criteria, then corrector waybills are excluded from the retrieval process.
    For Request Latest Waybill Date:
    When the system sets date criteria, then the retrieval is configured to return the waybill with the latest date.
  • Context - all fwcarget parameters are properly configured:
    For Execute FWCARGET Call:
    When the system calls the fwcarget external program, then the waybill retrieval operation is executed and results are returned.
  • Context - fwcarget call has been executed:
    For FWCARGET Error or Not Found?:
    When the system evaluates the return status, then if error or not found condition exists, the system branches to error handling, otherwise continues with validation checks.
  • Context - a waybill has been successfully retrieved:
    For Haulage Right Carrier Present?:
    When the system checks the haulage right carrier field, then if haulage right carrier is blank or spaces, the waybill is accepted, otherwise additional edi validation is required.
  • Context - a waybill has a haulage right carrier specified:
    For EDI 418 Release Complete?:
    When the system checks the edi completion status, then if edi 418 release equals 'y', the waybill is accepted, otherwise the system continues searching for previous waybills.
  • Context - a waybill requires further processing due to incomplete edi:
    For Same Waybill Key as Previous?:
    When the system compares the current waybill key with the previously stored feedback key, then if keys match, the search is terminated as not found, otherwise the system continues with previous status search.
  • Context - current waybill has incomplete edi and is not a duplicate key:
    For Set Previous Status Waybill Date:
    When the system sets search criteria for previous status, then search parameters are updated to look for waybills with previous status and earlier waybill dates.
  • Context - a waybill key needs to be tracked for duplicate detection:
    For Update Waybill Key Feedback:
    When the system updates the feedback mechanism, then the current waybill key is stored in the feedback field for future comparison.
  • Context - waybill search has exhausted all possibilities or encountered duplicate keys:
    For Mark as Not Found and Exit:
    When the system determines no valid waybill exists, then the waybill status is set to not found and the process exits.
  • Context - fwcarget call has completed with error or not found status:
    For FWCARGET Error?:
    When the system evaluates the specific return condition, then if a system error occurred, fallback to inquiry system is attempted, otherwise waybill is marked as not found.
  • Context - fwcarget call has failed with a system error:
    For Fallback to Inquiry System:
    When the system initiates fallback processing, then alternative inquiry system is called to attempt waybill retrieval.
  • Context - waybill has been successfully retrieved and validated:
    For Return Waybill Found:
    When all validation criteria are met, then waybill status is set to found and waybill data is available for subsequent processing.
  • Context - all waybill retrieval attempts have been exhausted:
    For Return Waybill Not Found:
    When no valid waybill meeting criteria is found, then waybill status is set to not found and no waybill data is available.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill retrieval request is initiated for an equipment ID
GIVEN
A waybill retrieval request is initiated for an equipment ID
Applied to: First Call or Different Equipment ID?
WHEN
The system checks if this is the first FWCARGET call or if the current equipment ID differs from the previously held equipment ID
THEN
The system proceeds with parameter initialization if it's a first call or different equipment, otherwise exits the process
Context: A waybill retrieval operation needs to be performed
GIVEN
A waybill retrieval operation needs to be performed
Applied to: Initialize FWCARGET Parameters
WHEN
The system initializes FWCARGET parameters
THEN
SHIPROOT and FWWARGET-PARM structures are cleared and the current equipment ID is stored as the held equipment ID
Context: FWCARGET parameters are being configured
GIVEN
FWCARGET parameters are being configured
Applied to: Set Waybill Type Criteria - Exclude Types 98/99
WHEN
The system sets waybill type criteria
THEN
Waybill types 98 and 99 are excluded from the retrieval process
Applied to: Set Status Criteria - Include All Status Types
WHEN
The system sets status criteria
THEN
All status types are included in the waybill retrieval process
Applied to: Set EDI Criteria - Exclude Incomplete EDI
WHEN
The system sets EDI criteria
THEN
Waybills with incomplete EDI processing are excluded from retrieval
Applied to: Include Temporary Waybills
WHEN
The system sets temporary waybill criteria
THEN
Temporary waybills are included in the retrieval process
Applied to: Exclude Corrector Waybills
WHEN
The system sets corrector waybill criteria
THEN
Corrector waybills are excluded from the retrieval process
Applied to: Request Latest Waybill Date
WHEN
The system sets date criteria
THEN
The retrieval is configured to return the waybill with the latest date
Context: All FWCARGET parameters are properly configured
GIVEN
All FWCARGET parameters are properly configured
Applied to: Execute FWCARGET Call
WHEN
The system calls the FWCARGET external program
THEN
The waybill retrieval operation is executed and results are returned
Context: FWCARGET call has been executed
GIVEN
FWCARGET call has been executed
Applied to: FWCARGET Error or Not Found?
WHEN
The system evaluates the return status
THEN
If error or not found condition exists, the system branches to error handling, otherwise continues with validation checks
Context: A waybill has been successfully retrieved
GIVEN
A waybill has been successfully retrieved
Applied to: Haulage Right Carrier Present?
WHEN
The system checks the haulage right carrier field
THEN
If haulage right carrier is blank or spaces, the waybill is accepted, otherwise additional EDI validation is required
Context: A waybill has a haulage right carrier specified
GIVEN
A waybill has a haulage right carrier specified
Applied to: EDI 418 Release Complete?
WHEN
The system checks the EDI completion status
THEN
If EDI 418 release equals 'Y', the waybill is accepted, otherwise the system continues searching for previous waybills
Context: A waybill requires further processing due to incomplete EDI
GIVEN
A waybill requires further processing due to incomplete EDI
Applied to: Same Waybill Key as Previous?
WHEN
The system compares the current waybill key with the previously stored feedback key
THEN
If keys match, the search is terminated as not found, otherwise the system continues with previous status search
Context: Current waybill has incomplete EDI and is not a duplicate key
GIVEN
Current waybill has incomplete EDI and is not a duplicate key
Applied to: Set Previous Status Waybill Date
WHEN
The system sets search criteria for previous status
THEN
Search parameters are updated to look for waybills with previous status and earlier waybill dates
Context: A waybill key needs to be tracked for duplicate detection
GIVEN
A waybill key needs to be tracked for duplicate detection
Applied to: Update Waybill Key Feedback
WHEN
The system updates the feedback mechanism
THEN
The current waybill key is stored in the feedback field for future comparison
Context: Waybill search has exhausted all possibilities or encountered duplicate keys
GIVEN
Waybill search has exhausted all possibilities or encountered duplicate keys
Applied to: Mark as Not Found and Exit
WHEN
The system determines no valid waybill exists
THEN
The waybill status is set to not found and the process exits
Context: FWCARGET call has completed with error or not found status
GIVEN
FWCARGET call has completed with error or not found status
Applied to: FWCARGET Error?
WHEN
The system evaluates the specific return condition
THEN
If a system error occurred, fallback to inquiry system is attempted, otherwise waybill is marked as not found
Context: FWCARGET call has failed with a system error
GIVEN
FWCARGET call has failed with a system error
Applied to: Fallback to Inquiry System
WHEN
The system initiates fallback processing
THEN
Alternative inquiry system is called to attempt waybill retrieval
Context: Waybill has been successfully retrieved and validated
GIVEN
Waybill has been successfully retrieved and validated
Applied to: Return Waybill Found
WHEN
All validation criteria are met
THEN
Waybill status is set to found and waybill data is available for subsequent processing
Context: All waybill retrieval attempts have been exhausted
GIVEN
All waybill retrieval attempts have been exhausted
Applied to: Return Waybill Not Found
WHEN
No valid waybill meeting criteria is found
THEN
Waybill status is set to not found and no waybill data is available
R-GCX003-cbl-01589 (+8) File: GCX003.cbl N: Analyze Equipment Routing Patterns Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N: Analyze Equipment Routing Patterns':
  • Context - a waybill exists with routing information in rut-info fields:
    For Extract Routing Information from Waybill:
    When the system processes the waybill for routing analysis, then the routing information from rut-info fields 1, 2, and 3 is extracted and stored in working storage routing variables.
  • Context - routing information contains special characters including exclamation marks:
    For Clean Routing Data - Replace Special Characters:
    When the system processes the routing data, then all exclamation marks in the routing information are replaced with spaces.
  • Context - equipment routing analysis is starting:
    For Initialize Routing Variables:
    When the system initializes routing variables, then the route status is set to not found as the default state.
  • Context - equipment has an ima code in the waybill:
    For Check Hazmat Code 'HM'?:
    When the ima code equals 'hm', then the equipment empty indicator is set to 2 for hazmat routing and route found flag is set to true.
  • Context - a routing entry exists in the routing information array:
    For Validate Routing Entry Format:
    When the routing entry is spaces, low values, or empty, then the routing validation loop is terminated and processing moves to the next step.
  • Context - valid routing entries with scac carrier codes and junction information exist:
    For Analyze SCAC Carrier Patterns:
    When the system processes consecutive routing entries to identify carrier patterns, then the routing information is parsed into scac codes and junction codes for pattern analysis.
  • Context - routing shows first scac as csxt or ns, second scac as cprs, and junction as det:
    For Set CSXT Routing Classification:
    When the first scac is specifically csxt, then the equipment empty indicator is set to 3 for csxt routing classification and route found flag is set to true.
    For Set NS Routing Classification:
    When the first scac is specifically ns, then the equipment empty indicator is set to 4 for ns routing classification and route found flag is set to true.
  • Context - equipment processing is complete and no specific routing pattern was identified or no waybill was found:
    For Set Equipment Empty Indicator Based on Routing:
    When the route was not found or waybill is not available, then the equipment empty indicator is set to 1 as the default value.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill exists with routing information in RUT-INFO fields
GIVEN
A waybill exists with routing information in RUT-INFO fields
Applied to: Extract Routing Information from Waybill
WHEN
The system processes the waybill for routing analysis
THEN
The routing information from RUT-INFO fields 1, 2, and 3 is extracted and stored in working storage routing variables
Context: Routing information contains special characters including exclamation marks
GIVEN
Routing information contains special characters including exclamation marks
Applied to: Clean Routing Data - Replace Special Characters
WHEN
The system processes the routing data
THEN
All exclamation marks in the routing information are replaced with spaces
Context: Equipment routing analysis is starting
GIVEN
Equipment routing analysis is starting
Applied to: Initialize Routing Variables
WHEN
The system initializes routing variables
THEN
The route status is set to not found as the default state
Context: Equipment has an IMA code in the waybill
GIVEN
Equipment has an IMA code in the waybill
Applied to: Check Hazmat Code 'HM'?
WHEN
The IMA code equals 'HM'
THEN
The equipment empty indicator is set to 2 for hazmat routing and route found flag is set to true
Context: A routing entry exists in the routing information array
GIVEN
A routing entry exists in the routing information array
Applied to: Validate Routing Entry Format
WHEN
The routing entry is spaces, low values, or empty
THEN
The routing validation loop is terminated and processing moves to the next step
Context: Valid routing entries with SCAC carrier codes and junction information exist
GIVEN
Valid routing entries with SCAC carrier codes and junction information exist
Applied to: Analyze SCAC Carrier Patterns
WHEN
The system processes consecutive routing entries to identify carrier patterns
THEN
The routing information is parsed into SCAC codes and junction codes for pattern analysis
Context: Routing shows first SCAC as CSXT or NS, second SCAC as CPRS, and junction as DET
GIVEN
Routing shows first SCAC as CSXT or NS, second SCAC as CPRS, and junction as DET
Applied to: Set CSXT Routing Classification
WHEN
The first SCAC is specifically CSXT
THEN
The equipment empty indicator is set to 3 for CSXT routing classification and route found flag is set to true
Applied to: Set NS Routing Classification
WHEN
The first SCAC is specifically NS
THEN
The equipment empty indicator is set to 4 for NS routing classification and route found flag is set to true
Context: Equipment processing is complete and no specific routing pattern was identified OR no waybill was found
GIVEN
Equipment processing is complete and no specific routing pattern was identified OR no waybill was found
Applied to: Set Equipment Empty Indicator Based on Routing
WHEN
The route was not found or waybill is not available
THEN
The equipment empty indicator is set to 1 as the default value
R-GCX003-cbl-01598 (+6) File: GCX003.cbl P: Process Special Handling Codes Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'P: Process Special Handling Codes':
  • Context - equipment has empty status and contains residue weight greater than zero:
    For Check Equipment Load/Empty Status:
    When system processes equipment for special handling codes, then system initiates empty residue code scanning and weight threshold evaluation.
  • Context - equipment has residue weight and special handling codes exist:
    For Scan Special Handling Codes Array:
    When system scans through special handling codes array up to 8 positions, then system identifies if empty residue threshold code is present and sets appropriate flag.
  • Context - equipment contains residue weight:
    For Evaluate Residue Weight Against Threshold:
    When system evaluates residue weight against threshold of 7000 pounds, then system sets high residue weight flag if weight exceeds 7000 pounds, otherwise sets low residue weight flag.
  • Context - equipment cargo data is being processed:
    For Check Segment 08 Data for Hazmat:
    When system checks for segment 08 data availability, then system sets hazmat flag to yes if segment 08 data is found, otherwise sets hazmat flag to no.
  • Context - equipment has been evaluated for empty residue and weight thresholds:
    For Process Empty Residue Business Rules:
    When system processes empty residue business rules with cargo found status and weight classifications, then system determines appropriate processing path based on empty residue presence, weight threshold, and cargo availability.
  • Context - equipment has empty residue code found and residue weight exceeds 7000 pounds and equipment is empty and not idler:
    For Generate Empty Residue Error Message:
    When system processes waybill found with no cargo found condition, then system generates message 44 with waybill root key and date information.
  • Context - equipment is marked as loaded and has residue weight with empty residue code found but no cargo data available:
    For Generate Loaded Equipment Missing Cargo Message:
    When system processes equipment with waybill found but cargo not found condition, then system generates appropriate missing cargo message for loaded equipment.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment has empty status and contains residue weight greater than zero
GIVEN
Equipment has empty status and contains residue weight greater than zero
Applied to: Check Equipment Load/Empty Status
WHEN
System processes equipment for special handling codes
THEN
System initiates empty residue code scanning and weight threshold evaluation
Context: Equipment has residue weight and special handling codes exist
GIVEN
Equipment has residue weight and special handling codes exist
Applied to: Scan Special Handling Codes Array
WHEN
System scans through special handling codes array up to 8 positions
THEN
System identifies if empty residue threshold code is present and sets appropriate flag
Context: Equipment contains residue weight
GIVEN
Equipment contains residue weight
Applied to: Evaluate Residue Weight Against Threshold
WHEN
System evaluates residue weight against threshold of 7000 pounds
THEN
System sets high residue weight flag if weight exceeds 7000 pounds, otherwise sets low residue weight flag
Context: Equipment cargo data is being processed
GIVEN
Equipment cargo data is being processed
Applied to: Check Segment 08 Data for Hazmat
WHEN
System checks for Segment 08 data availability
THEN
System sets hazmat flag to Yes if Segment 08 data is found, otherwise sets hazmat flag to No
Context: Equipment has been evaluated for empty residue and weight thresholds
GIVEN
Equipment has been evaluated for empty residue and weight thresholds
Applied to: Process Empty Residue Business Rules
WHEN
System processes empty residue business rules with cargo found status and weight classifications
THEN
System determines appropriate processing path based on empty residue presence, weight threshold, and cargo availability
Context: Equipment has empty residue code found and residue weight exceeds 7000 pounds and equipment is empty and not idler
GIVEN
Equipment has empty residue code found and residue weight exceeds 7000 pounds and equipment is empty and not idler
Applied to: Generate Empty Residue Error Message
WHEN
System processes waybill found with no cargo found condition
THEN
System generates message 44 with waybill root key and date information
Context: Equipment is marked as loaded and has residue weight with empty residue code found but no cargo data available
GIVEN
Equipment is marked as loaded and has residue weight with empty residue code found but no cargo data available
Applied to: Generate Loaded Equipment Missing Cargo Message
WHEN
System processes equipment with waybill found but cargo not found condition
THEN
System generates appropriate missing cargo message for loaded equipment
R-GCX003-cbl-01605 (+9) File: GCX003.cbl E: User Authorized for Special Manifests Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'E: User Authorized for Special Manifests':
  • Context - a user acf2 id is provided for authorization check:
    For Read User Security Table GCSTBRT-US:
    When the system queries the user security table gcstbrt-us with the user's acf2 id, then the system retrieves the user's security record containing authorization flags and permissions.
  • Context - a query has been made to retrieve user security information:
    For User Record Found?:
    When the system checks if a valid user security record was returned from the database, then the system determines if the user has a valid security profile or should use default authorization settings.
  • Context - a valid user security record exists in the database:
    For Initialize User Authorization Flags:
    When the system processes the user security information, then the system copies the user security segment data to working storage for authorization processing.
  • Context - user security information is available for processing:
    For Check UTF-SPEC-MANI Field:
    When the system checks the utf-spec-mani field in the user's security profile, then the system determines if the field contains 's' indicating special manifest authorization or any other value indicating no authorization.
  • Context - the user's utf-spec-mani field contains 's':
    For Set User Authorized for Special Manifests:
    When the system evaluates special manifest authorization, then the system sets the user as authorized for special manifest creation.
  • Context - the user's utf-spec-mani field does not contain 's' or no user security record exists:
    For Set User NOT Authorized for Special Manifests:
    When the system evaluates special manifest authorization, then the system sets the user as not authorized for special manifest creation.
  • Context - user authorization status has been determined:
    For Special Manifest Required?:
    When the system evaluates if the current cargo or train processing requires special manifest creation, then the system determines whether special manifest authorization check is needed for the current operation.
  • Context - special manifest creation is required for the current operation:
    For User Authorized for Special Manifests?:
    When the system checks the user's special manifest authorization status, then the system determines if the user is authorized to proceed with special manifest creation or should be denied.
  • Context - special manifest is required and user is authorized for special manifests:
    For Allow Special Manifest Creation:
    When the system processes the authorization decision, then the system allows the special manifest creation process to continue.
  • Context - special manifest is required and user is not authorized for special manifests:
    For Generate Error Message 43 - Not Authorized:
    When the system processes the authorization decision, then the system generates error message 43 indicating the user is not authorized for special manifest creation.
👨‍💻 Technical ACs (Gherkin)
Context: A user ACF2 ID is provided for authorization check
GIVEN
A user ACF2 ID is provided for authorization check
Applied to: Read User Security Table GCSTBRT-US
WHEN
The system queries the user security table GCSTBRT-US with the user's ACF2 ID
THEN
The system retrieves the user's security record containing authorization flags and permissions
Context: A query has been made to retrieve user security information
GIVEN
A query has been made to retrieve user security information
Applied to: User Record Found?
WHEN
The system checks if a valid user security record was returned from the database
THEN
The system determines if the user has a valid security profile or should use default authorization settings
Context: A valid user security record exists in the database
GIVEN
A valid user security record exists in the database
Applied to: Initialize User Authorization Flags
WHEN
The system processes the user security information
THEN
The system copies the user security segment data to working storage for authorization processing
Context: User security information is available for processing
GIVEN
User security information is available for processing
Applied to: Check UTF-SPEC-MANI Field
WHEN
The system checks the UTF-SPEC-MANI field in the user's security profile
THEN
The system determines if the field contains 'S' indicating special manifest authorization or any other value indicating no authorization
Context: The user's UTF-SPEC-MANI field contains 'S'
GIVEN
The user's UTF-SPEC-MANI field contains 'S'
Applied to: Set User Authorized for Special Manifests
WHEN
The system evaluates special manifest authorization
THEN
The system sets the user as authorized for special manifest creation
Context: The user's UTF-SPEC-MANI field does not contain 'S' OR no user security record exists
GIVEN
The user's UTF-SPEC-MANI field does not contain 'S' OR no user security record exists
Applied to: Set User NOT Authorized for Special Manifests
WHEN
The system evaluates special manifest authorization
THEN
The system sets the user as not authorized for special manifest creation
Context: User authorization status has been determined
GIVEN
User authorization status has been determined
Applied to: Special Manifest Required?
WHEN
The system evaluates if the current cargo or train processing requires special manifest creation
THEN
The system determines whether special manifest authorization check is needed for the current operation
Context: Special manifest creation is required for the current operation
GIVEN
Special manifest creation is required for the current operation
Applied to: User Authorized for Special Manifests?
WHEN
The system checks the user's special manifest authorization status
THEN
The system determines if the user is authorized to proceed with special manifest creation or should be denied
Context: Special manifest is required AND user is authorized for special manifests
GIVEN
Special manifest is required AND user is authorized for special manifests
Applied to: Allow Special Manifest Creation
WHEN
The system processes the authorization decision
THEN
The system allows the special manifest creation process to continue
Context: Special manifest is required AND user is not authorized for special manifests
GIVEN
Special manifest is required AND user is not authorized for special manifests
Applied to: Generate Error Message 43 - Not Authorized
WHEN
The system processes the authorization decision
THEN
The system generates error message 43 indicating the user is not authorized for special manifest creation
R-GCX003-cbl-01615 (+8) File: GCX003.cbl C: Empty Equipment or Empty Residue Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'C: Empty Equipment or Empty Residue':
  • Context - a cargo record exists for the equipment:
    For Is Equipment Marked as Empty?:
    When the cargo bol type code indicates empty equipment (m1109 empty equipment condition), then the equipment should be processed as empty equipment cargo.
    For Check Equipment Load Indicator:
    When the cargo bol type code indicates empty residue (m1109 empty residue condition), then the equipment should be processed as empty residue cargo.
  • Context - an empty car has residue weight and special handling codes are present:
    For Validate Residue Weight Threshold:
    When the residue weight is greater than 7000 pounds, then the car should be flagged for special residue handling.
  • Context - a shipment has special handling codes and residue weight greater than 0:
    For Check Special Handling Codes:
    When one of the special handling codes equals 'er' (empty residue threshold code), then the empty residue condition should be flagged as found.
  • Context - equipment has empty equipment cargo and origin-destination country codes are available:
    For Route = CAMX or MXCA?:
    When the origin-destination country codes equal 'camx' or 'mxca', then empty equipment error message should be skipped and processing should continue.
  • Context - equipment has empty equipment cargo and route is not canada-mexico or mexico-canada:
    For Generate Empty Equipment Error Message:
    When the cargo is found and marked as empty equipment, then error message 27 (empty equipment message) should be generated.
  • Context - equipment is determined to be empty (either empty equipment or empty residue):
    For Set Equipment as Empty:
    When the equipment type is container and current load indicator is 'l' (loaded), then the load indicator should be changed to 'e' (empty), container loaded count should be decremented by 1, and container empty count should be incremented by 1.
  • Context - equipment is determined to be empty and equipment type is not container:
    For Update Load/Empty Counters:
    When the current load indicator is 'l' (loaded), then the load indicator should be changed to 'e' (empty), car loaded count should be decremented by 1, and car empty count should be incremented by 1.
  • Context - equipment is validated as empty equipment or empty residue:
    For Format Equipment Info Field:
    When the cargo type is empty equipment or empty residue, then the equipment information field should be set to 'empty' and load/empty indicator should be set to 'e'.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists for the equipment
GIVEN
A cargo record exists for the equipment
Applied to: Is Equipment Marked as Empty?
WHEN
The cargo BOL type code indicates empty equipment (M1109 empty equipment condition)
THEN
The equipment should be processed as empty equipment cargo
Applied to: Check Equipment Load Indicator
WHEN
The cargo BOL type code indicates empty residue (M1109 empty residue condition)
THEN
The equipment should be processed as empty residue cargo
Context: An empty car has residue weight and special handling codes are present
GIVEN
An empty car has residue weight and special handling codes are present
Applied to: Validate Residue Weight Threshold
WHEN
The residue weight is greater than 7000 pounds
THEN
The car should be flagged for special residue handling
Context: A shipment has special handling codes and residue weight greater than 0
GIVEN
A shipment has special handling codes and residue weight greater than 0
Applied to: Check Special Handling Codes
WHEN
One of the special handling codes equals 'ER' (Empty Residue threshold code)
THEN
The empty residue condition should be flagged as found
Context: Equipment has empty equipment cargo and origin-destination country codes are available
GIVEN
Equipment has empty equipment cargo and origin-destination country codes are available
Applied to: Route = CAMX or MXCA?
WHEN
The origin-destination country codes equal 'CAMX' or 'MXCA'
THEN
Empty equipment error message should be skipped and processing should continue
Context: Equipment has empty equipment cargo and route is not Canada-Mexico or Mexico-Canada
GIVEN
Equipment has empty equipment cargo and route is not Canada-Mexico or Mexico-Canada
Applied to: Generate Empty Equipment Error Message
WHEN
The cargo is found and marked as empty equipment
THEN
Error message 27 (empty equipment message) should be generated
Context: Equipment is determined to be empty (either empty equipment or empty residue)
GIVEN
Equipment is determined to be empty (either empty equipment or empty residue)
Applied to: Set Equipment as Empty
WHEN
The equipment type is container and current load indicator is 'L' (loaded)
THEN
The load indicator should be changed to 'E' (empty), container loaded count should be decremented by 1, and container empty count should be incremented by 1
Context: Equipment is determined to be empty and equipment type is not container
GIVEN
Equipment is determined to be empty and equipment type is not container
Applied to: Update Load/Empty Counters
WHEN
The current load indicator is 'L' (loaded)
THEN
The load indicator should be changed to 'E' (empty), car loaded count should be decremented by 1, and car empty count should be incremented by 1
Context: Equipment is validated as empty equipment or empty residue
GIVEN
Equipment is validated as empty equipment or empty residue
Applied to: Format Equipment Info Field
WHEN
The cargo type is empty equipment or empty residue
THEN
The equipment information field should be set to 'EMPTY' and load/empty indicator should be set to 'E'
R-GCX003-cbl-01624 (+8) File: GCX003.cbl Q: Check Processing Results Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Q: Check Processing Results':
  • Context - train processing has completed with potential errors and spawn activities:
    For Any Processing Errors?:
    When the system checks for any processing errors in the report, then if no errors exist, proceed to check spawn activities; if errors exist, proceed to error handling with spawn check.
  • Context - train processing has no errors and no spawn activities:
    For Set Result Status: SENT:
    When the system evaluates the final processing status, then set the result status to sent and count warning messages only.
  • Context - train processing has no errors but has spawn activities:
    For Set Result Status: NOT SENT:
    When the system evaluates the final processing status, then set the result status to not sent, count warnings, add spawn count to error count, and trigger special manifest processing.
  • Context - train processing has errors:
    For Any Spawn Activities?:
    When the system checks for spawn activities, then if no spawns exist, check message types for error classification; if spawns exist, check for diversion and it export messages.
  • Context - processing has errors with no spawn activities and message type 43 is found:
    For Convert Error 43 to Warning 18:
    When the system processes error message classification, then convert message type 43 to message type 18, increase warning count by 1, and decrease error count by 1.
  • Context - processing has errors with spawn activities and diversion messages are found:
    For Convert to Message 19 with Station Code:
    When the system processes spawn message conversion, then convert diversion messages to message 19 and include the station code from gcstbrt-sc-us-stat-code-x.
  • Context - processing has errors with spawn activities and it export messages are found:
    For Convert to Message 18:
    When the system processes spawn message conversion, then convert it export messages to message type 18.
  • Context - processing has errors with spawn activities and message conversion is complete:
    For Add Spawn Count to Warning Count:
    When the system calculates final warning count, then add the spawn count to the existing warning count to get the final warning total.
  • Context - processing result status has been determined and counts have been finalized:
    For Generate Report Header Line 4:
    When the system generates the final report header, then set header line 4 flag to true, populate us customer train id from gcwtl-m1005-us-cust-train-id, and set eta year, month, day, hour, and minute from request eta fields.
👨‍💻 Technical ACs (Gherkin)
Context: Train processing has completed with potential errors and spawn activities
GIVEN
Train processing has completed with potential errors and spawn activities
Applied to: Any Processing Errors?
WHEN
The system checks for any processing errors in the report
THEN
If no errors exist, proceed to check spawn activities; if errors exist, proceed to error handling with spawn check
Context: Train processing has no errors and no spawn activities
GIVEN
Train processing has no errors and no spawn activities
Applied to: Set Result Status: SENT
WHEN
The system evaluates the final processing status
THEN
Set the result status to SENT and count warning messages only
Context: Train processing has no errors but has spawn activities
GIVEN
Train processing has no errors but has spawn activities
Applied to: Set Result Status: NOT SENT
WHEN
The system evaluates the final processing status
THEN
Set the result status to NOT SENT, count warnings, add spawn count to error count, and trigger special manifest processing
Context: Train processing has errors
GIVEN
Train processing has errors
Applied to: Any Spawn Activities?
WHEN
The system checks for spawn activities
THEN
If no spawns exist, check message types for error classification; if spawns exist, check for diversion and IT export messages
Context: Processing has errors with no spawn activities and message type 43 is found
GIVEN
Processing has errors with no spawn activities and message type 43 is found
Applied to: Convert Error 43 to Warning 18
WHEN
The system processes error message classification
THEN
Convert message type 43 to message type 18, increase warning count by 1, and decrease error count by 1
Context: Processing has errors with spawn activities and diversion messages are found
GIVEN
Processing has errors with spawn activities and diversion messages are found
Applied to: Convert to Message 19 with Station Code
WHEN
The system processes spawn message conversion
THEN
Convert diversion messages to message 19 and include the station code from GCSTBRT-SC-US-STAT-CODE-X
Context: Processing has errors with spawn activities and IT export messages are found
GIVEN
Processing has errors with spawn activities and IT export messages are found
Applied to: Convert to Message 18
WHEN
The system processes spawn message conversion
THEN
Convert IT export messages to message type 18
Context: Processing has errors with spawn activities and message conversion is complete
GIVEN
Processing has errors with spawn activities and message conversion is complete
Applied to: Add Spawn Count to Warning Count
WHEN
The system calculates final warning count
THEN
Add the spawn count to the existing warning count to get the final warning total
Context: Processing result status has been determined and counts have been finalized
GIVEN
Processing result status has been determined and counts have been finalized
Applied to: Generate Report Header Line 4
WHEN
The system generates the final report header
THEN
Set header line 4 flag to true, populate US customer train ID from GCWTL-M1005-US-CUST-TRAIN-ID, and set ETA year, month, day, hour, and minute from request ETA fields
R-GCX003-cbl-01633 (+10) File: GCX003.cbl Q: Large Report Check Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Q: Large Report Check':
  • Context - an email report is being processed with multiple report lines:
    For Check Line Counter > 699?:
    When the line counter exceeds 699 lines in the current email message, then the system should send the current email batch, clear the message buffer, reset the line counter, and add continuation headers for the next batch.
  • Context - a report line is available for processing and the line counter is within limits:
    For Add Current Line to Email Message:
    When the system processes the current report line, then the report line should be added to the email message buffer at the current line position.
  • Context - a report line has been successfully added to the email message:
    For Increment Line Counter:
    When the line addition is complete, then the line counter should be incremented by one to track the current message size.
  • Context - an email message buffer contains report lines ready for transmission:
    For Send Current Email Batch via EMCSEND3:
    When the pagination limit is reached or all lines are processed, then the system should invoke emcsend3 to transmit the email batch to the designated recipients.
  • Context - an email batch has been successfully transmitted:
    For Clear Email Message Buffer:
    When the system needs to prepare for the next batch of report lines, then the email message buffer should be cleared and reset to spaces.
  • Context - an email batch has been sent and the buffer has been cleared:
    For Reset Line Counter to Zero:
    When the system prepares for the next batch of report lines, then the line counter should be reset to zero to start counting lines for the new batch.
  • Context - a new email batch is being prepared after pagination:
    For Add Continuation Header Line:
    When the system starts a continuation email, then a continuation header message should be added as the first line indicating this is a continuation of the report.
  • Context - a continuation email batch is being prepared:
    For Add Report Detail Headers:
    When the continuation header has been added, then the standard report detail headers should be added to maintain consistent report formatting across email batches.
  • Context - continuation header and report detail headers have been added to a new email batch:
    For Set Line Counter to 3:
    When the system prepares to continue adding report lines, then the line counter should be set to 3 to account for the three header lines already added.
  • Context - the system is processing report lines for email transmission:
    For More Report Lines to Process?:
    When a line has been processed or a batch has been sent, then the system should check if more report lines exist to determine whether to continue processing or finalize the email transmission.
  • Context - all report lines have been processed and added to the current email message:
    For Send Final Email Batch:
    When no more report lines remain to be processed, then the system should send the final email batch containing the remaining report lines.
👨‍💻 Technical ACs (Gherkin)
Context: An email report is being processed with multiple report lines
GIVEN
An email report is being processed with multiple report lines
Applied to: Check Line Counter > 699?
WHEN
The line counter exceeds 699 lines in the current email message
THEN
The system should send the current email batch, clear the message buffer, reset the line counter, and add continuation headers for the next batch
Context: A report line is available for processing and the line counter is within limits
GIVEN
A report line is available for processing and the line counter is within limits
Applied to: Add Current Line to Email Message
WHEN
The system processes the current report line
THEN
The report line should be added to the email message buffer at the current line position
Context: A report line has been successfully added to the email message
GIVEN
A report line has been successfully added to the email message
Applied to: Increment Line Counter
WHEN
The line addition is complete
THEN
The line counter should be incremented by one to track the current message size
Context: An email message buffer contains report lines ready for transmission
GIVEN
An email message buffer contains report lines ready for transmission
Applied to: Send Current Email Batch via EMCSEND3
WHEN
The pagination limit is reached or all lines are processed
THEN
The system should invoke EMCSEND3 to transmit the email batch to the designated recipients
Context: An email batch has been successfully transmitted
GIVEN
An email batch has been successfully transmitted
Applied to: Clear Email Message Buffer
WHEN
The system needs to prepare for the next batch of report lines
THEN
The email message buffer should be cleared and reset to spaces
Context: An email batch has been sent and the buffer has been cleared
GIVEN
An email batch has been sent and the buffer has been cleared
Applied to: Reset Line Counter to Zero
WHEN
The system prepares for the next batch of report lines
THEN
The line counter should be reset to zero to start counting lines for the new batch
Context: A new email batch is being prepared after pagination
GIVEN
A new email batch is being prepared after pagination
Applied to: Add Continuation Header Line
WHEN
The system starts a continuation email
THEN
A continuation header message should be added as the first line indicating this is a continuation of the report
Context: A continuation email batch is being prepared
GIVEN
A continuation email batch is being prepared
Applied to: Add Report Detail Headers
WHEN
The continuation header has been added
THEN
The standard report detail headers should be added to maintain consistent report formatting across email batches
Context: Continuation header and report detail headers have been added to a new email batch
GIVEN
Continuation header and report detail headers have been added to a new email batch
Applied to: Set Line Counter to 3
WHEN
The system prepares to continue adding report lines
THEN
The line counter should be set to 3 to account for the three header lines already added
Context: The system is processing report lines for email transmission
GIVEN
The system is processing report lines for email transmission
Applied to: More Report Lines to Process?
WHEN
A line has been processed or a batch has been sent
THEN
The system should check if more report lines exist to determine whether to continue processing or finalize the email transmission
Context: All report lines have been processed and added to the current email message
GIVEN
All report lines have been processed and added to the current email message
Applied to: Send Final Email Batch
WHEN
No more report lines remain to be processed
THEN
The system should send the final email batch containing the remaining report lines
R-GCX003-cbl-01644 (+9) File: GCX003.cbl D: Evaluate Message Type Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'D: Evaluate Message Type':
  • Context - a report entry has been added to the report index:
    For Is Message Line?:
    When the system checks if the entry is a message line, then the system identifies whether the entry contains a message that needs to be classified for counting purposes.
  • Context - a message line has been identified in the report:
    For Is Spawn Message?:
    When the system checks if the message is a spawn message, then spawn messages are excluded from error, warning, and information counting but still increment the report index.
  • Context - a non-spawn message line exists in the report:
    For Error Message - Add to Error Count:
    When the message is classified as an error type, then the system increments the error count by 1.
    For Warning Message - Add to Warning Count:
    When the message is classified as a warning type, then the system increments the warning count by 1.
    For Information Message - Add to Info Count:
    When the message is classified as an information type, then the system increments the information count by 1.
  • Context - an error message has been identified and counted:
    For Is Message Type 43?:
    When the error message type is 43 (authorization failure), then the system increments the special error count 43 by 1 in addition to the general error count.
  • Context - a warning message has been identified and counted:
    For Is Message Type 49 or 52?:
    When the warning message type is 49 or 52 (dsp hold conditions), then the system increments the dsp hold count by 1 in addition to the general warning count.
  • Context - a message has been processed and classified:
    For Increment Report Index:
    When the system completes message processing, then the report index is incremented by 1 to point to the next available report line.
  • Context - the report index has been incremented:
    For Report Index at Maximum?:
    When the report index reaches the maximum allowed report lines, then the system detects a report overflow condition.
  • Context - the report index has reached maximum capacity:
    For Set Report Overflow Message:
    When a report overflow condition is detected, then the system sets message type 9 (report overflow) to notify users that the report is truncated.
👨‍💻 Technical ACs (Gherkin)
Context: A report entry has been added to the report index
GIVEN
A report entry has been added to the report index
Applied to: Is Message Line?
WHEN
The system checks if the entry is a message line
THEN
The system identifies whether the entry contains a message that needs to be classified for counting purposes
Context: A message line has been identified in the report
GIVEN
A message line has been identified in the report
Applied to: Is Spawn Message?
WHEN
The system checks if the message is a spawn message
THEN
Spawn messages are excluded from error, warning, and information counting but still increment the report index
Context: A non-spawn message line exists in the report
GIVEN
A non-spawn message line exists in the report
Applied to: Error Message - Add to Error Count
WHEN
The message is classified as an error type
THEN
The system increments the error count by 1
Applied to: Warning Message - Add to Warning Count
WHEN
The message is classified as a warning type
THEN
The system increments the warning count by 1
Applied to: Information Message - Add to Info Count
WHEN
The message is classified as an information type
THEN
The system increments the information count by 1
Context: An error message has been identified and counted
GIVEN
An error message has been identified and counted
Applied to: Is Message Type 43?
WHEN
The error message type is 43 (authorization failure)
THEN
The system increments the special error count 43 by 1 in addition to the general error count
Context: A warning message has been identified and counted
GIVEN
A warning message has been identified and counted
Applied to: Is Message Type 49 or 52?
WHEN
The warning message type is 49 or 52 (DSP hold conditions)
THEN
The system increments the DSP hold count by 1 in addition to the general warning count
Context: A message has been processed and classified
GIVEN
A message has been processed and classified
Applied to: Increment Report Index
WHEN
The system completes message processing
THEN
The report index is incremented by 1 to point to the next available report line
Context: The report index has been incremented
GIVEN
The report index has been incremented
Applied to: Report Index at Maximum?
WHEN
The report index reaches the maximum allowed report lines
THEN
The system detects a report overflow condition
Context: The report index has reached maximum capacity
GIVEN
The report index has reached maximum capacity
Applied to: Set Report Overflow Message
WHEN
A report overflow condition is detected
THEN
The system sets message type 9 (report overflow) to notify users that the report is truncated
R-GCX003-cbl-01654 (+4) File: GCX003.cbl C: SEND Action with No Errors and No Spawns Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'C: SEND Action with No Errors and No Spawns':
  • Context - a send action is being processed for a train manifest:
    For Check Processing Status:
    When the system checks the processing status for errors and spawn conditions, then the system determines if the train can be transmitted based on error-free processing and no spawn requirements.
  • Context - train processing has completed with no errors and no spawn requirements:
    For Set RPT-RESULT-SENT Status:
    When the system sets the transmission result status, then the result status is set to sent and warning count is recorded.
  • Context - train processing has completed with no errors but has spawn requirements:
    For Set RPT-RESULT-NO-SENT Status:
    When the system evaluates the transmission eligibility, then the result status is set to no-sent, spawn count is added to error count, and special manifest processing is prepared.
  • Context - train processing has completed with errors:
    For Set RPT-RESULT-NO-SENT Status:
    When the system evaluates the transmission eligibility, then the result status is set to no-sent and both warning and error counts are recorded.
  • Context - train processing has spawn requirements that need special manifest generation:
    For Prepare Special Manifest Processing:
    When the system prepares to handle spawn processing, then special manifest processing is invoked for each spawn requirement.
👨‍💻 Technical ACs (Gherkin)
Context: A SEND action is being processed for a train manifest
GIVEN
A SEND action is being processed for a train manifest
Applied to: Check Processing Status
WHEN
The system checks the processing status for errors and spawn conditions
THEN
The system determines if the train can be transmitted based on error-free processing and no spawn requirements
Context: Train processing has completed with no errors and no spawn requirements
GIVEN
Train processing has completed with no errors and no spawn requirements
Applied to: Set RPT-RESULT-SENT Status
WHEN
The system sets the transmission result status
THEN
The result status is set to SENT and warning count is recorded
Context: Train processing has completed with no errors but has spawn requirements
GIVEN
Train processing has completed with no errors but has spawn requirements
Applied to: Set RPT-RESULT-NO-SENT Status
WHEN
The system evaluates the transmission eligibility
THEN
The result status is set to NO-SENT, spawn count is added to error count, and special manifest processing is prepared
Context: Train processing has completed with errors
GIVEN
Train processing has completed with errors
Applied to: Set RPT-RESULT-NO-SENT Status
WHEN
The system evaluates the transmission eligibility
THEN
The result status is set to NO-SENT and both warning and error counts are recorded
Context: Train processing has spawn requirements that need special manifest generation
GIVEN
Train processing has spawn requirements that need special manifest generation
Applied to: Prepare Special Manifest Processing
WHEN
The system prepares to handle spawn processing
THEN
Special manifest processing is invoked for each spawn requirement
R-GCX003-cbl-01659 (+5) File: GCX003.cbl J[Process Crowley IT Bond Logic] Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'J[Process Crowley IT Bond Logic]':
  • Context - an it bond cargo record exists in the system:
    For Is TR Already Created for IT?:
    When the system checks if tr has already been created for it cargo by evaluating gcusrt-tr-created-for-it field, then if tr is already created (gcusrt-tr-created-for-it = 'y'), skip further it bond processing and exit the crowley process.
  • Context - an it bond cargo requires processing and tr has not been created:
    For Is Request Action SEND?:
    When the system evaluates the request action type (req-action-send), then if request action is send, proceed to check user authorization for special manifests; if request action is report, generate report message msg-24.
  • Context - a send request for it bond cargo that requires special manifest creation:
    For User Authorized for Special Manifests?:
    When the system checks user authorization status (ws-user-not-auth-4-spcl-manif), then if user is not authorized for special manifests, generate authorization error msg-43; if user is authorized, proceed to create it export special manifest msg-23.
  • Context - a send request for it bond cargo from an authorized user:
    For Create IT Export Special Manifest MSG-23:
    When the system creates an it export special manifest, then generate message msg-23, set it export spawn flag (ws-it-export-spawn), and call special manifest creation process (z870-create-special-manifest).
  • Context - a send request for it bond cargo from an unauthorized user:
    For Generate Authorization Error MSG-43:
    When the system detects user is not authorized for special manifests (ws-user-not-auth-4-spcl-manif is true), then generate authorization error message msg-43 and add it to the report without creating special manifest.
  • Context - an it bond cargo with report action request and tr not already created:
    For Generate Report Message MSG-24:
    When the system processes a report action for it bond, then generate report message msg-24 and add it to the report without creating special manifest or spawn processes.
👨‍💻 Technical ACs (Gherkin)
Context: An IT bond cargo record exists in the system
GIVEN
An IT bond cargo record exists in the system
Applied to: Is TR Already Created for IT?
WHEN
The system checks if TR has already been created for IT cargo by evaluating GCUSRT-TR-CREATED-FOR-IT field
THEN
If TR is already created (GCUSRT-TR-CREATED-FOR-IT = 'Y'), skip further IT bond processing and exit the Crowley process
Context: An IT bond cargo requires processing and TR has not been created
GIVEN
An IT bond cargo requires processing and TR has not been created
Applied to: Is Request Action SEND?
WHEN
The system evaluates the request action type (REQ-ACTION-SEND)
THEN
If request action is SEND, proceed to check user authorization for special manifests; if request action is REPORT, generate report message MSG-24
Context: A SEND request for IT bond cargo that requires special manifest creation
GIVEN
A SEND request for IT bond cargo that requires special manifest creation
Applied to: User Authorized for Special Manifests?
WHEN
The system checks user authorization status (WS-USER-NOT-AUTH-4-SPCL-MANIF)
THEN
If user is not authorized for special manifests, generate authorization error MSG-43; if user is authorized, proceed to create IT export special manifest MSG-23
Context: A SEND request for IT bond cargo from an authorized user
GIVEN
A SEND request for IT bond cargo from an authorized user
Applied to: Create IT Export Special Manifest MSG-23
WHEN
The system creates an IT export special manifest
THEN
Generate message MSG-23, set IT export spawn flag (WS-IT-EXPORT-SPAWN), and call special manifest creation process (Z870-CREATE-SPECIAL-MANIFEST)
Context: A SEND request for IT bond cargo from an unauthorized user
GIVEN
A SEND request for IT bond cargo from an unauthorized user
Applied to: Generate Authorization Error MSG-43
WHEN
The system detects user is not authorized for special manifests (WS-USER-NOT-AUTH-4-SPCL-MANIF is true)
THEN
Generate authorization error message MSG-43 and add it to the report without creating special manifest
Context: An IT bond cargo with REPORT action request and TR not already created
GIVEN
An IT bond cargo with REPORT action request and TR not already created
Applied to: Generate Report Message MSG-24
WHEN
The system processes a REPORT action for IT bond
THEN
Generate report message MSG-24 and add it to the report without creating special manifest or spawn processes
R-GCX003-cbl-01665 (+5) File: GCX003.cbl N{User Has UTF Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N{User Has UTF':
  • Context - a user attempts to process a train request with their acf2 user id and the system needs to validate scac access for cp (canadian pacific) operations:
    For SCAC Access Valid?:
    When the system calls gccscac to validate scac access and the validation returns scac-access-invalid flag and the request is not an aei train send request, then the system sets user access to denied, generates error message fourteen, and prevents further processing.
  • Context - a user with valid scac access needs their security profile validated for train processing operations:
    For User Profile Found?:
    When the system performs a database lookup for the user's acf2 id in the gcstbrt-us table, then if the profile is found, the system loads the user segment data, otherwise initializes an empty profile with spaces.
  • Context - a user requests to send train data and the system has retrieved their security profile:
    For UTF-ADD = 'U' or 'S'?:
    When the request action is send and the user's utf-add field contains value 'u' (update) or 's' (special) or the request is an aei train send request, then the system grants send authorization and allows the user to proceed with sending train data.
  • Context - a user lacks standard utf-add authorization ('u' or 's') for send operations:
    For AEI Train Send Request?:
    When the request is identified as an aei train send request, then the system grants send authorization despite the lack of standard utf-add permissions.
  • Context - a user requests to send train data but lacks proper authorization:
    For Set No User Access - Send Not Authorized:
    When the request action is send and the user's utf-add field is not 'u' or 's' and the request is not an aei train send request, then the system sets user access to denied, generates error message thirteen, and prevents send operations.
  • Context - a user has been granted send authorization and the system needs to check special manifest permissions:
    For UTF-SPEC-MANI = 'S'?:
    When the user's utf-spec-mani field does not equal 's' (special) and the request is not an aei train send request, then the system sets the user as not authorized for special manifest operations.
👨‍💻 Technical ACs (Gherkin)
Context: A user attempts to process a train request with their ACF2 user ID and the system needs to validate SCAC access for CP (Canadian Pacific) operations
GIVEN
A user attempts to process a train request with their ACF2 user ID and the system needs to validate SCAC access for CP (Canadian Pacific) operations
Applied to: SCAC Access Valid?
WHEN
The system calls GCCSCAC to validate SCAC access and the validation returns SCAC-ACCESS-INVALID flag and the request is not an AEI train send request
THEN
The system sets user access to denied, generates error message fourteen, and prevents further processing
Context: A user with valid SCAC access needs their security profile validated for train processing operations
GIVEN
A user with valid SCAC access needs their security profile validated for train processing operations
Applied to: User Profile Found?
WHEN
The system performs a database lookup for the user's ACF2 ID in the GCSTBRT-US table
THEN
If the profile is found, the system loads the user segment data, otherwise initializes an empty profile with spaces
Context: A user requests to send train data and the system has retrieved their security profile
GIVEN
A user requests to send train data and the system has retrieved their security profile
Applied to: UTF-ADD = 'U' or 'S'?
WHEN
The request action is SEND and the user's UTF-ADD field contains value 'U' (Update) or 'S' (Special) or the request is an AEI train send request
THEN
The system grants send authorization and allows the user to proceed with sending train data
Context: A user lacks standard UTF-ADD authorization ('U' or 'S') for send operations
GIVEN
A user lacks standard UTF-ADD authorization ('U' or 'S') for send operations
Applied to: AEI Train Send Request?
WHEN
The request is identified as an AEI train send request
THEN
The system grants send authorization despite the lack of standard UTF-ADD permissions
Context: A user requests to send train data but lacks proper authorization
GIVEN
A user requests to send train data but lacks proper authorization
Applied to: Set No User Access - Send Not Authorized
WHEN
The request action is SEND and the user's UTF-ADD field is not 'U' or 'S' and the request is not an AEI train send request
THEN
The system sets user access to denied, generates error message thirteen, and prevents send operations
Context: A user has been granted send authorization and the system needs to check special manifest permissions
GIVEN
A user has been granted send authorization and the system needs to check special manifest permissions
Applied to: UTF-SPEC-MANI = 'S'?
WHEN
The user's UTF-SPEC-MANI field does not equal 'S' (Special) and the request is not an AEI train send request
THEN
The system sets the user as not authorized for special manifest operations
R-GCX003-cbl-01671 (+8) File: GCX003.cbl K[Check Special Manifest Conditions] Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'K[Check Special Manifest Conditions]':
  • Context - a cargo record exists with bond type classification:
    For Is Cargo Immediate Transport Bond?:
    When the cargo is classified as immediate transport bond (m1201 movement type), then the system skips cargo attachment and exits the attachment process.
  • Context - a cargo record with tr created for it indicator:
    For Is TR Created for IT = 'Y'?:
    When the tr created for it flag equals 'y', then the system skips cargo attachment and exits the attachment process.
  • Context - a cargo record with us-canada-us movement type, empty tr created for it indicator, and cargo short description:
    For Is Cargo US-Canada-US Movement? AND Is TR Created for IT Empty? AND Is Cargo Short Description = Release?:
    When the cargo is us-canada-us movement and tr created for it is empty and cargo short description equals release status, then the system skips cargo attachment and exits the attachment process.
  • Context - a cargo record with default movement type, empty tr created for it indicator, and cargo short description:
    For Is Cargo Default Movement? AND Is TR Created for IT Empty? AND Is Cargo Short Description = Release?:
    When the cargo is default movement and tr created for it is empty and cargo short description equals release status, then the system skips cargo attachment and exits the attachment process.
  • Context - a cargo record with equipment load status classification:
    For Is Cargo Empty Equipment?:
    When the cargo is classified as empty equipment, then the system skips cargo attachment and exits the attachment process.
  • Context - a cargo record with special manifest classification and current station location:
    For Is Special Manifest Original? AND Is Woburn PQ Station?:
    When the cargo has special manifest original status and the current station is woburn pq, then the system skips cargo attachment and exits the attachment process.
    For Is Special Manifest Special? AND Is NOT Woburn PQ Station?:
    When the cargo has special manifest special status and the current station is not woburn pq, then the system skips cargo attachment and exits the attachment process.
  • Context - a cargo record with export movement type, origin-destination country codes, and current station location:
    For Is Export Movement? AND Is Origin-Destination = US-Mexico? AND Is NOT Laredo TX Station?:
    When the cargo is export movement and origin-destination is us-mexico and the current station is not laredo tx, then the system skips cargo attachment and exits the attachment process.
  • Context - a cargo record that does not meet any skip attachment conditions:
    For Attach Cargo to Train:
    When none of the special manifest, bond type, or routing skip conditions are met, then the system proceeds with standard cargo attachment to the train manifest.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with bond type classification
GIVEN
A cargo record exists with bond type classification
Applied to: Is Cargo Immediate Transport Bond?
WHEN
The cargo is classified as immediate transport bond (M1201 movement type)
THEN
The system skips cargo attachment and exits the attachment process
Context: A cargo record with TR created for IT indicator
GIVEN
A cargo record with TR created for IT indicator
Applied to: Is TR Created for IT = 'Y'?
WHEN
The TR created for IT flag equals 'Y'
THEN
The system skips cargo attachment and exits the attachment process
Context: A cargo record with US-Canada-US movement type, empty TR created for IT indicator, and cargo short description
GIVEN
A cargo record with US-Canada-US movement type, empty TR created for IT indicator, and cargo short description
Applied to: Is Cargo US-Canada-US Movement? AND Is TR Created for IT Empty? AND Is Cargo Short Description = Release?
WHEN
The cargo is US-Canada-US movement AND TR created for IT is empty AND cargo short description equals release status
THEN
The system skips cargo attachment and exits the attachment process
Context: A cargo record with default movement type, empty TR created for IT indicator, and cargo short description
GIVEN
A cargo record with default movement type, empty TR created for IT indicator, and cargo short description
Applied to: Is Cargo Default Movement? AND Is TR Created for IT Empty? AND Is Cargo Short Description = Release?
WHEN
The cargo is default movement AND TR created for IT is empty AND cargo short description equals release status
THEN
The system skips cargo attachment and exits the attachment process
Context: A cargo record with equipment load status classification
GIVEN
A cargo record with equipment load status classification
Applied to: Is Cargo Empty Equipment?
WHEN
The cargo is classified as empty equipment
THEN
The system skips cargo attachment and exits the attachment process
Context: A cargo record with special manifest classification and current station location
GIVEN
A cargo record with special manifest classification and current station location
Applied to: Is Special Manifest Original? AND Is Woburn PQ Station?
WHEN
The cargo has special manifest original status AND the current station is Woburn PQ
THEN
The system skips cargo attachment and exits the attachment process
Applied to: Is Special Manifest Special? AND Is NOT Woburn PQ Station?
WHEN
The cargo has special manifest special status AND the current station is not Woburn PQ
THEN
The system skips cargo attachment and exits the attachment process
Context: A cargo record with export movement type, origin-destination country codes, and current station location
GIVEN
A cargo record with export movement type, origin-destination country codes, and current station location
Applied to: Is Export Movement? AND Is Origin-Destination = US-Mexico? AND Is NOT Laredo TX Station?
WHEN
The cargo is export movement AND origin-destination is US-Mexico AND the current station is not Laredo TX
THEN
The system skips cargo attachment and exits the attachment process
Context: A cargo record that does not meet any skip attachment conditions
GIVEN
A cargo record that does not meet any skip attachment conditions
Applied to: Attach Cargo to Train
WHEN
None of the special manifest, bond type, or routing skip conditions are met
THEN
The system proceeds with standard cargo attachment to the train manifest
R-GCX003-cbl-01680 (+7) File: GCX003.cbl F{Is Record Type 'T/C XREF'?} Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'F{Is Record Type 'T/C XREF'?}':
  • Context - an inquiry bottom line record is being processed:
    For Is Record Type 'T/C XREF'?:
    When the system checks the record type in the first 8 positions of the inquiry record, then the system should identify if the record contains container cross-reference data by matching 't/c xref' pattern.
  • Context - a valid 't/c xref' record is being processed:
    For Extract Container ID from Position 28-39:
    When the system extracts data from positions 28 through 39 of the inquiry record, then the system should capture the 12-character container id and store it in the container table.
    For Extract Waybill Railroad from Position 10-12:
    When the system extracts data from positions 10 through 12 of the inquiry record, then the system should capture the 3-character railroad code for the waybill reference.
    For Extract Waybill Station from Position 14-19:
    When the system extracts data from positions 14 through 19 of the inquiry record, then the system should capture the 6-character station code for the waybill reference.
    For Extract Waybill Number from Position 21-26:
    When the system extracts data from positions 21 through 26 of the inquiry record, then the system should capture the 6-character waybill number for the waybill reference.
  • Context - waybill reference data has been extracted from the container cross-reference record:
    For Replace Spaces with Zeros in Waybill Fields:
    When the system processes the combined waybill railroad, station, and number fields, then the system should replace all space characters with zero characters to create a standardized waybill reference.
  • Context - container id and waybill reference data have been successfully extracted and standardized:
    For Store Container Cross-Reference Data:
    When the system stores the cross-reference information, then the system should save the container id and associated waybill reference in the container table at the current index position.
  • Context - a container cross-reference record has been successfully processed and stored:
    For Increment Container Counter:
    When the system completes the storage of container cross-reference data, then the system should increment the container counter by one to prepare for processing the next container record.
👨‍💻 Technical ACs (Gherkin)
Context: An inquiry bottom line record is being processed
GIVEN
An inquiry bottom line record is being processed
Applied to: Is Record Type 'T/C XREF'?
WHEN
The system checks the record type in the first 8 positions of the inquiry record
THEN
The system should identify if the record contains container cross-reference data by matching 'T/C XREF' pattern
Context: A valid 'T/C XREF' record is being processed
GIVEN
A valid 'T/C XREF' record is being processed
Applied to: Extract Container ID from Position 28-39
WHEN
The system extracts data from positions 28 through 39 of the inquiry record
THEN
The system should capture the 12-character container ID and store it in the container table
Applied to: Extract Waybill Railroad from Position 10-12
WHEN
The system extracts data from positions 10 through 12 of the inquiry record
THEN
The system should capture the 3-character railroad code for the waybill reference
Applied to: Extract Waybill Station from Position 14-19
WHEN
The system extracts data from positions 14 through 19 of the inquiry record
THEN
The system should capture the 6-character station code for the waybill reference
Applied to: Extract Waybill Number from Position 21-26
WHEN
The system extracts data from positions 21 through 26 of the inquiry record
THEN
The system should capture the 6-character waybill number for the waybill reference
Context: Waybill reference data has been extracted from the container cross-reference record
GIVEN
Waybill reference data has been extracted from the container cross-reference record
Applied to: Replace Spaces with Zeros in Waybill Fields
WHEN
The system processes the combined waybill railroad, station, and number fields
THEN
The system should replace all space characters with zero characters to create a standardized waybill reference
Context: Container ID and waybill reference data have been successfully extracted and standardized
GIVEN
Container ID and waybill reference data have been successfully extracted and standardized
Applied to: Store Container Cross-Reference Data
WHEN
The system stores the cross-reference information
THEN
The system should save the container ID and associated waybill reference in the container table at the current index position
Context: A container cross-reference record has been successfully processed and stored
GIVEN
A container cross-reference record has been successfully processed and stored
Applied to: Increment Container Counter
WHEN
The system completes the storage of container cross-reference data
THEN
The system should increment the container counter by one to prepare for processing the next container record
R-GCX003-cbl-01688 (+9) File: GCX003.cbl L{Haulage Right Carrier Present?} Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'L{Haulage Right Carrier Present?}':
  • Context - a waybill retrieval request is initiated for equipment processing:
    For First Call or Different Equipment ID?:
    When the system checks if this is the first call to the waybill retrieval function or the current equipment id is different from the previously held equipment id, then if it is the first call or the equipment id has changed, proceed with waybill retrieval processing, otherwise skip the retrieval and exit.
  • Context - waybill retrieval is proceeding for an equipment id:
    For First Call or Different Equipment ID?:
    When the system processes the equipment id, then store the current equipment id as the held equipment id for future comparison and set the processing flag to indicate this is no longer the first call.
  • Context - waybill retrieval is initiated for a car equipment:
    For Set Car Retrieval Criteria:
    When the system sets up retrieval parameters, then configure retrieval to include all car types except 98 and 99 and include all status types and exclude edi incomplete records and include temporary waybills and exclude corrector waybills and return the latest waybill with the most recent date.
  • Context - waybill retrieval parameters are configured for an equipment id:
    For Call Waybill Retrieval System:
    When the system calls the external waybill retrieval service (fwcarget), then execute the waybill retrieval call and return the waybill information and processing status.
  • Context - a waybill retrieval operation has been executed:
    For Retrieval Error?:
    When the system checks the return status from the waybill retrieval service, then if the return status indicates an error or not found condition, set the waybill status to the error condition, otherwise continue processing.
  • Context - a waybill has been successfully retrieved:
    For Haulage Right Carrier Present?:
    When the system checks the haulage right carrier field in the waybill, then if the haulage right carrier field contains spaces or is empty, accept the waybill for processing, otherwise perform additional edi completion validation.
  • Context - a waybill has a haulage right carrier assigned:
    For EDI Completion Status Released?:
    When the system checks the edi completion release status (edi-comp-418-release), then if the edi completion status equals 'y' (released), accept the waybill for processing, otherwise perform waybill key comparison validation.
  • Context - a waybill with haulage right carrier has edi completion status not released:
    For Same Waybill Key as Previous?:
    When the system compares the current waybill feedback key with the previously processed waybill feedback key, then if the current waybill feedback key matches the previous waybill feedback key, set status to not found and stop processing, otherwise continue with previous waybill date processing.
  • Context - current waybill does not meet edi completion criteria and is not a duplicate key:
    For Set Previous Waybill Date Processing:
    When the system prepares to search for previous waybill versions, then set the retrieval parameter to search for previous status waybill date and update the feedback key tracking with the current waybill feedback key.
  • Context - primary waybill retrieval indicates no waybill found:
    For Waybill Found?:
    When the system determines that no waybill was located in the primary system, then initiate alternative waybill search using the inquiry root system (z450-gu-shiproot-inq) to locate waybill information.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill retrieval request is initiated for equipment processing
GIVEN
A waybill retrieval request is initiated for equipment processing
Applied to: First Call or Different Equipment ID?
WHEN
The system checks if this is the first call to the waybill retrieval function OR the current equipment ID is different from the previously held equipment ID
THEN
If it is the first call OR the equipment ID has changed, proceed with waybill retrieval processing, otherwise skip the retrieval and exit
Context: Waybill retrieval is proceeding for an equipment ID
GIVEN
Waybill retrieval is proceeding for an equipment ID
Applied to: First Call or Different Equipment ID?
WHEN
The system processes the equipment ID
THEN
Store the current equipment ID as the held equipment ID for future comparison AND set the processing flag to indicate this is no longer the first call
Context: Waybill retrieval is initiated for a car equipment
GIVEN
Waybill retrieval is initiated for a car equipment
Applied to: Set Car Retrieval Criteria
WHEN
The system sets up retrieval parameters
THEN
Configure retrieval to include all car types except 98 and 99 AND include all status types AND exclude EDI incomplete records AND include temporary waybills AND exclude corrector waybills AND return the latest waybill with the most recent date
Context: Waybill retrieval parameters are configured for an equipment ID
GIVEN
Waybill retrieval parameters are configured for an equipment ID
Applied to: Call Waybill Retrieval System
WHEN
The system calls the external waybill retrieval service (FWCARGET)
THEN
Execute the waybill retrieval call and return the waybill information and processing status
Context: A waybill retrieval operation has been executed
GIVEN
A waybill retrieval operation has been executed
Applied to: Retrieval Error?
WHEN
The system checks the return status from the waybill retrieval service
THEN
If the return status indicates an error OR not found condition, set the waybill status to the error condition, otherwise continue processing
Context: A waybill has been successfully retrieved
GIVEN
A waybill has been successfully retrieved
Applied to: Haulage Right Carrier Present?
WHEN
The system checks the haulage right carrier field in the waybill
THEN
If the haulage right carrier field contains spaces or is empty, accept the waybill for processing, otherwise perform additional EDI completion validation
Context: A waybill has a haulage right carrier assigned
GIVEN
A waybill has a haulage right carrier assigned
Applied to: EDI Completion Status Released?
WHEN
The system checks the EDI completion release status (EDI-COMP-418-RELEASE)
THEN
If the EDI completion status equals 'Y' (released), accept the waybill for processing, otherwise perform waybill key comparison validation
Context: A waybill with haulage right carrier has EDI completion status not released
GIVEN
A waybill with haulage right carrier has EDI completion status not released
Applied to: Same Waybill Key as Previous?
WHEN
The system compares the current waybill feedback key with the previously processed waybill feedback key
THEN
If the current waybill feedback key matches the previous waybill feedback key, set status to not found and stop processing, otherwise continue with previous waybill date processing
Context: Current waybill does not meet EDI completion criteria and is not a duplicate key
GIVEN
Current waybill does not meet EDI completion criteria and is not a duplicate key
Applied to: Set Previous Waybill Date Processing
WHEN
The system prepares to search for previous waybill versions
THEN
Set the retrieval parameter to search for previous status waybill date AND update the feedback key tracking with the current waybill feedback key
Context: Primary waybill retrieval indicates no waybill found
GIVEN
Primary waybill retrieval indicates no waybill found
Applied to: Waybill Found?
WHEN
The system determines that no waybill was located in the primary system
THEN
Initiate alternative waybill search using the inquiry root system (Z450-GU-SHIPROOT-INQ) to locate waybill information
R-GCX003-cbl-01698 (+9) File: GCX003.cbl L[Analyze SCAC Carrier Patterns] Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'L[Analyze SCAC Carrier Patterns]':
  • Context - a waybill exists with routing information in rut-info fields 1, 2, and 3:
    For Extract Routing Information from Waybill:
    When the system processes the waybill routing data, then the routing information is extracted into working storage fields and exclamation marks are replaced with spaces for proper parsing.
  • Context - routing information contains exclamation marks as field delimiters:
    For Replace Exclamation Marks with Spaces:
    When the system processes the routing data, then all exclamation marks in the routing information line are replaced with spaces.
  • Context - routing analysis is about to begin:
    For Initialize Route Search Variables:
    When the system starts route pattern analysis, then route not found flag is set to true and route search counter is initialized to begin pattern matching loop.
  • Context - a waybill has routing information to be analyzed:
    For Check Route Pattern Loop:
    When the ima code equals 'hm' indicating hazardous materials, then route type is set to 2 for hazmat, route found flag is set to true, and normal pattern analysis is bypassed.
  • Context - routing information fields contain carrier and junction data:
    For Extract SCAC Code from Route Info:
    When the system processes each routing field in sequence, then scac codes and junction codes are extracted from consecutive routing information array elements for pattern analysis.
  • Context - routing information contains carrier scac codes and junction information:
    For SCAC1 = CSXT or NS?:
    When first scac equals csxt or ns and second scac equals cprs and junction code equals det, then the routing pattern is recognized as a valid csxt/ns to cprs via detroit connection.
  • Context - a valid csxt to cprs via det routing pattern is identified:
    For Set Route Type = 3 - CSXT to CPRS via DET:
    When the first scac code is csxt, then route type is set to 3 and empty indicator is set to 3 to represent csxt to cprs via detroit routing.
  • Context - a valid ns to cprs via det routing pattern is identified:
    For Set Route Type = 4 - NS to CPRS via DET:
    When the first scac code is ns, then route type is set to 4 and empty indicator is set to 4 to represent ns to cprs via detroit routing.
  • Context - a valid carrier routing pattern has been identified:
    For Set Route Found Flag:
    When route type has been determined (hazmat, csxt, or ns pattern), then route found flag is set to true to indicate successful pattern matching and stop further search iterations.
  • Context - route search has completed all iterations without finding valid patterns:
    For Set Route Not Found Flag:
    When no hazmat code exists and no csxt/ns to cprs via det patterns are found, then route not found flag remains true and empty indicator is set to 1 to indicate no recognized routing pattern.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill exists with routing information in RUT-INFO fields 1, 2, and 3
GIVEN
A waybill exists with routing information in RUT-INFO fields 1, 2, and 3
Applied to: Extract Routing Information from Waybill
WHEN
The system processes the waybill routing data
THEN
The routing information is extracted into working storage fields and exclamation marks are replaced with spaces for proper parsing
Context: Routing information contains exclamation marks as field delimiters
GIVEN
Routing information contains exclamation marks as field delimiters
Applied to: Replace Exclamation Marks with Spaces
WHEN
The system processes the routing data
THEN
All exclamation marks in the routing information line are replaced with spaces
Context: Routing analysis is about to begin
GIVEN
Routing analysis is about to begin
Applied to: Initialize Route Search Variables
WHEN
The system starts route pattern analysis
THEN
Route not found flag is set to true and route search counter is initialized to begin pattern matching loop
Context: A waybill has routing information to be analyzed
GIVEN
A waybill has routing information to be analyzed
Applied to: Check Route Pattern Loop
WHEN
The IMA code equals 'HM' indicating hazardous materials
THEN
Route type is set to 2 for hazmat, route found flag is set to true, and normal pattern analysis is bypassed
Context: Routing information fields contain carrier and junction data
GIVEN
Routing information fields contain carrier and junction data
Applied to: Extract SCAC Code from Route Info
WHEN
The system processes each routing field in sequence
THEN
SCAC codes and junction codes are extracted from consecutive routing information array elements for pattern analysis
Context: Routing information contains carrier SCAC codes and junction information
GIVEN
Routing information contains carrier SCAC codes and junction information
Applied to: SCAC1 = CSXT or NS?
WHEN
First SCAC equals CSXT or NS AND second SCAC equals CPRS AND junction code equals DET
THEN
The routing pattern is recognized as a valid CSXT/NS to CPRS via Detroit connection
Context: A valid CSXT to CPRS via DET routing pattern is identified
GIVEN
A valid CSXT to CPRS via DET routing pattern is identified
Applied to: Set Route Type = 3 - CSXT to CPRS via DET
WHEN
The first SCAC code is CSXT
THEN
Route type is set to 3 and empty indicator is set to 3 to represent CSXT to CPRS via Detroit routing
Context: A valid NS to CPRS via DET routing pattern is identified
GIVEN
A valid NS to CPRS via DET routing pattern is identified
Applied to: Set Route Type = 4 - NS to CPRS via DET
WHEN
The first SCAC code is NS
THEN
Route type is set to 4 and empty indicator is set to 4 to represent NS to CPRS via Detroit routing
Context: A valid carrier routing pattern has been identified
GIVEN
A valid carrier routing pattern has been identified
Applied to: Set Route Found Flag
WHEN
Route type has been determined (hazmat, CSXT, or NS pattern)
THEN
Route found flag is set to true to indicate successful pattern matching and stop further search iterations
Context: Route search has completed all iterations without finding valid patterns
GIVEN
Route search has completed all iterations without finding valid patterns
Applied to: Set Route Not Found Flag
WHEN
No hazmat code exists AND no CSXT/NS to CPRS via DET patterns are found
THEN
Route not found flag remains true and empty indicator is set to 1 to indicate no recognized routing pattern
R-GCX003-cbl-01708 (+13) File: GCX003.cbl G[Evaluate Residue Weight Against Threshold] Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'G[Evaluate Residue Weight Against Threshold]':
  • Context - an equipment item is being processed for residue weight evaluation:
    For Is Equipment Empty?:
    When the equipment load/empty indicator is checked, then if equipment is empty, proceed to retrieve shipment comments for residue weight analysis, otherwise skip residue weight processing.
  • Context - empty equipment requires residue weight evaluation:
    For Retrieve SHIPCOMM Segment:
    When system attempts to retrieve shipcomm segment using waybill root key, then retrieve shipment comments data including residue weight and special handling codes for threshold analysis.
  • Context - system has attempted to retrieve shipcomm segment:
    For SHIPCOMM Retrieved Successfully?:
    When database status code is evaluated, then if retrieval successful, use retrieved data; if failed, initialize shipcomm to spaces to prevent processing errors.
  • Context - shipcomm segment retrieval has failed:
    For Initialize SHIPCOMM to Spaces:
    When system needs to continue processing without shipment comments data, then initialize shipcomm structure to spaces to ensure clean data state for subsequent processing.
  • Context - shipcomm data is available for processing:
    For Residue Weight > 0?:
    When residue weight value is evaluated, then if residue weight is greater than zero, proceed with special handling code analysis and threshold evaluation.
  • Context - equipment has residue weight greater than zero:
    For Check Special Handling Codes:
    When special handling codes array is scanned for er threshold code, then iterate through up to 8 special handling code positions to locate er threshold code indicator.
  • Context - special handling codes are being analyzed for er threshold code:
    For ER Threshold Code Found?:
    When each special handling code position is compared against er threshold code value, then if er threshold code is found in any position, set er found flag; otherwise set er not found flag.
  • Context - er threshold code has been located in special handling codes:
    For Set ER Found Flag:
    When system needs to record er code presence for threshold evaluation, then set er found indicator to true for subsequent weight threshold processing.
  • Context - er threshold code has not been found in special handling codes after complete scan:
    For Set ER Not Found Flag:
    When system needs to record er code absence for threshold evaluation, then set er found indicator to false for subsequent weight threshold processing.
  • Context - equipment has measurable residue weight and er code status is determined:
    For Residue Weight > 7000 lbs?:
    When residue weight value is compared against 7000 pound threshold, then if weight exceeds 7000 pounds, set weight threshold gt7 flag; otherwise set weight threshold le7 flag.
  • Context - residue weight has been determined to exceed 7000 pounds:
    For Set ER Weight Threshold GT7:
    When system needs to classify weight threshold status, then set weight threshold greater than 7000 indicator for subsequent compliance processing.
  • Context - residue weight has been determined to be 7000 pounds or less:
    For Set ER Weight Threshold LE7:
    When system needs to classify weight threshold status, then set weight threshold less than or equal to 7000 indicator for subsequent compliance processing.
  • Context - equipment has either er code present with weight at or below 7000 pounds, or er code absent with weight exceeding 7000 pounds:
    For Continue Processing - Within Threshold:
    When residue weight compliance status is evaluated, then continue normal equipment processing without generating threshold violation errors.
  • Context - equipment has either er code present with weight exceeding 7000 pounds, or er code absent with weight at or below 7000 pounds:
    For Generate Error Message - Threshold Exceeded:
    When residue weight compliance status indicates threshold violation, then generate appropriate error message for residue weight threshold non-compliance.
👨‍💻 Technical ACs (Gherkin)
Context: An equipment item is being processed for residue weight evaluation
GIVEN
An equipment item is being processed for residue weight evaluation
Applied to: Is Equipment Empty?
WHEN
The equipment load/empty indicator is checked
THEN
If equipment is empty, proceed to retrieve shipment comments for residue weight analysis, otherwise skip residue weight processing
Context: Empty equipment requires residue weight evaluation
GIVEN
Empty equipment requires residue weight evaluation
Applied to: Retrieve SHIPCOMM Segment
WHEN
System attempts to retrieve SHIPCOMM segment using waybill root key
THEN
Retrieve shipment comments data including residue weight and special handling codes for threshold analysis
Context: System has attempted to retrieve SHIPCOMM segment
GIVEN
System has attempted to retrieve SHIPCOMM segment
Applied to: SHIPCOMM Retrieved Successfully?
WHEN
Database status code is evaluated
THEN
If retrieval successful, use retrieved data; if failed, initialize SHIPCOMM to spaces to prevent processing errors
Context: SHIPCOMM segment retrieval has failed
GIVEN
SHIPCOMM segment retrieval has failed
Applied to: Initialize SHIPCOMM to Spaces
WHEN
System needs to continue processing without shipment comments data
THEN
Initialize SHIPCOMM structure to spaces to ensure clean data state for subsequent processing
Context: SHIPCOMM data is available for processing
GIVEN
SHIPCOMM data is available for processing
Applied to: Residue Weight > 0?
WHEN
Residue weight value is evaluated
THEN
If residue weight is greater than zero, proceed with special handling code analysis and threshold evaluation
Context: Equipment has residue weight greater than zero
GIVEN
Equipment has residue weight greater than zero
Applied to: Check Special Handling Codes
WHEN
Special handling codes array is scanned for ER threshold code
THEN
Iterate through up to 8 special handling code positions to locate ER threshold code indicator
Context: Special handling codes are being analyzed for ER threshold code
GIVEN
Special handling codes are being analyzed for ER threshold code
Applied to: ER Threshold Code Found?
WHEN
Each special handling code position is compared against ER threshold code value
THEN
If ER threshold code is found in any position, set ER found flag; otherwise set ER not found flag
Context: ER threshold code has been located in special handling codes
GIVEN
ER threshold code has been located in special handling codes
Applied to: Set ER Found Flag
WHEN
System needs to record ER code presence for threshold evaluation
THEN
Set ER found indicator to true for subsequent weight threshold processing
Context: ER threshold code has not been found in special handling codes after complete scan
GIVEN
ER threshold code has not been found in special handling codes after complete scan
Applied to: Set ER Not Found Flag
WHEN
System needs to record ER code absence for threshold evaluation
THEN
Set ER found indicator to false for subsequent weight threshold processing
Context: Equipment has measurable residue weight and ER code status is determined
GIVEN
Equipment has measurable residue weight and ER code status is determined
Applied to: Residue Weight > 7000 lbs?
WHEN
Residue weight value is compared against 7000 pound threshold
THEN
If weight exceeds 7000 pounds, set weight threshold GT7 flag; otherwise set weight threshold LE7 flag
Context: Residue weight has been determined to exceed 7000 pounds
GIVEN
Residue weight has been determined to exceed 7000 pounds
Applied to: Set ER Weight Threshold GT7
WHEN
System needs to classify weight threshold status
THEN
Set weight threshold greater than 7000 indicator for subsequent compliance processing
Context: Residue weight has been determined to be 7000 pounds or less
GIVEN
Residue weight has been determined to be 7000 pounds or less
Applied to: Set ER Weight Threshold LE7
WHEN
System needs to classify weight threshold status
THEN
Set weight threshold less than or equal to 7000 indicator for subsequent compliance processing
Context: Equipment has either ER code present with weight at or below 7000 pounds, or ER code absent with weight exceeding 7000 pounds
GIVEN
Equipment has either ER code present with weight at or below 7000 pounds, or ER code absent with weight exceeding 7000 pounds
Applied to: Continue Processing - Within Threshold
WHEN
Residue weight compliance status is evaluated
THEN
Continue normal equipment processing without generating threshold violation errors
Context: Equipment has either ER code present with weight exceeding 7000 pounds, or ER code absent with weight at or below 7000 pounds
GIVEN
Equipment has either ER code present with weight exceeding 7000 pounds, or ER code absent with weight at or below 7000 pounds
Applied to: Generate Error Message - Threshold Exceeded
WHEN
Residue weight compliance status indicates threshold violation
THEN
Generate appropriate error message for residue weight threshold non-compliance
R-GCX003-cbl-01722 (+2) File: GCX003.cbl E{Check UTF Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'E{Check UTF':
  • Context - a user is processing a train request with send action:
    For Check UTF-SPEC-MANI Field:
    When the system validates special manifest authorization and the request action is send and the user's utf-spec-mani field is not equal to 's' and the aei train send flag is set to no, then the system sets the user as not authorized for special manifest creation.
    For Set User Authorized for Special Manifest:
    When the system validates special manifest authorization and the request action is send and (the user's utf-spec-mani field equals 's' or the aei train send flag is set to yes), then the system sets the user as authorized for special manifest creation.
  • Context - a user is processing a train request:
    For Continue Processing:
    When the system validates special manifest authorization and the request action is not send, then the system continues processing without setting special manifest authorization status.
👨‍💻 Technical ACs (Gherkin)
Context: A user is processing a train request with send action
GIVEN
A user is processing a train request with send action
Applied to: Check UTF-SPEC-MANI Field
WHEN
The system validates special manifest authorization AND the request action is SEND AND the user's UTF-SPEC-MANI field is not equal to 'S' AND the AEI train send flag is set to NO
THEN
The system sets the user as NOT authorized for special manifest creation
Applied to: Set User Authorized for Special Manifest
WHEN
The system validates special manifest authorization AND the request action is SEND AND (the user's UTF-SPEC-MANI field equals 'S' OR the AEI train send flag is set to YES)
THEN
The system sets the user as authorized for special manifest creation
Context: A user is processing a train request
GIVEN
A user is processing a train request
Applied to: Continue Processing
WHEN
The system validates special manifest authorization AND the request action is NOT SEND
THEN
The system continues processing without setting special manifest authorization status
R-GCX003-cbl-01725 (+13) File: GCX003.cbl G[Check Special Handling Codes] Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'G[Check Special Handling Codes]':
  • Context - special handling code processing is starting:
    For Initialize ER Indicator to 'N':
    When the system begins to check for empty residue codes, then the er indicator should be set to 'n' as the default value.
  • Context - equipment has load/empty status and residue weight information:
    For Check if Equipment is Empty AND Residue Weight > 0?:
    When the equipment load indicator is 'e' for empty and the residue weight is greater than 0, then the system should proceed with special handling code array processing.
  • Context - equipment qualifies for special handling code processing with empty status and residue weight:
    For Start Loop Through Special Handling Codes Array:
    When the system starts processing the special handling codes array, then the system should initialize array processing from position 1 and set loop control variables.
  • Context - special handling codes array processing is in progress:
    For More Codes in Array AND ER Not Found?:
    When the current array position is less than or equal to 7 and er found flag is not set to true, then the system should continue processing the next code in the array.
  • Context - array iteration is continuing and current position is valid:
    For Get Next Special Handling Code from Array Position:
    When the system needs to examine the next special handling code, then the system should retrieve the special handling code from the current array position.
  • Context - a special handling code has been retrieved from the array:
    For Is Code = 'ER' Threshold Code?:
    When the special handling code equals 'er', then the system should identify this as an empty residue threshold code.
  • Context - the current special handling code equals 'er':
    For Set ER Found Flag to TRUE:
    When the empty residue threshold code is detected, then the system should set the er found flag to true.
  • Context - current special handling code has been processed:
    For Increment Array Position Counter:
    When the system needs to move to the next array position, then the array position counter should be incremented by 1.
  • Context - special handling codes array processing has completed:
    For ER Found?:
    When the er found flag is evaluated, then the system should determine the appropriate processing path based on whether er was found.
  • Context - empty residue threshold code 'er' was found in the special handling codes array:
    For Set ER Indicator to 'Y':
    When the er found flag is true, then the system should set the er indicator to 'y'.
  • Context - empty residue processing is active:
    For ER Weight Threshold <= 7?:
    When the empty residue weight threshold value is less than or equal to 7, then the system should classify this as low-level empty residue threshold.
  • Context - empty residue weight threshold is 7 or below:
    For Set ER Weight Threshold LE7 Flag:
    When the threshold level needs to be classified, then the system should set the er weight threshold le7 flag.
  • Context - empty residue processing is active and threshold is not le7:
    For ER Weight Threshold > 7?:
    When the empty residue weight threshold value is greater than 7, then the system should classify this as high-level empty residue threshold.
  • Context - empty residue weight threshold is above 7:
    For Set ER Weight Threshold GT7 Flag:
    When the threshold level needs to be classified as high-level, then the system should set the er weight threshold gt7 flag.
👨‍💻 Technical ACs (Gherkin)
Context: Special handling code processing is starting
GIVEN
Special handling code processing is starting
Applied to: Initialize ER Indicator to 'N'
WHEN
The system begins to check for empty residue codes
THEN
The ER indicator should be set to 'N' as the default value
Context: Equipment has load/empty status and residue weight information
GIVEN
Equipment has load/empty status and residue weight information
Applied to: Check if Equipment is Empty AND Residue Weight > 0?
WHEN
The equipment load indicator is 'E' for empty AND the residue weight is greater than 0
THEN
The system should proceed with special handling code array processing
Context: Equipment qualifies for special handling code processing with empty status and residue weight
GIVEN
Equipment qualifies for special handling code processing with empty status and residue weight
Applied to: Start Loop Through Special Handling Codes Array
WHEN
The system starts processing the special handling codes array
THEN
The system should initialize array processing from position 1 and set loop control variables
Context: Special handling codes array processing is in progress
GIVEN
Special handling codes array processing is in progress
Applied to: More Codes in Array AND ER Not Found?
WHEN
The current array position is less than or equal to 7 AND ER found flag is not set to true
THEN
The system should continue processing the next code in the array
Context: Array iteration is continuing and current position is valid
GIVEN
Array iteration is continuing and current position is valid
Applied to: Get Next Special Handling Code from Array Position
WHEN
The system needs to examine the next special handling code
THEN
The system should retrieve the special handling code from the current array position
Context: A special handling code has been retrieved from the array
GIVEN
A special handling code has been retrieved from the array
Applied to: Is Code = 'ER' Threshold Code?
WHEN
The special handling code equals 'ER'
THEN
The system should identify this as an empty residue threshold code
Context: The current special handling code equals 'ER'
GIVEN
The current special handling code equals 'ER'
Applied to: Set ER Found Flag to TRUE
WHEN
The empty residue threshold code is detected
THEN
The system should set the ER found flag to true
Context: Current special handling code has been processed
GIVEN
Current special handling code has been processed
Applied to: Increment Array Position Counter
WHEN
The system needs to move to the next array position
THEN
The array position counter should be incremented by 1
Context: Special handling codes array processing has completed
GIVEN
Special handling codes array processing has completed
Applied to: ER Found?
WHEN
The ER found flag is evaluated
THEN
The system should determine the appropriate processing path based on whether ER was found
Context: Empty residue threshold code 'ER' was found in the special handling codes array
GIVEN
Empty residue threshold code 'ER' was found in the special handling codes array
Applied to: Set ER Indicator to 'Y'
WHEN
The ER found flag is true
THEN
The system should set the ER indicator to 'Y'
Context: Empty residue processing is active
GIVEN
Empty residue processing is active
Applied to: ER Weight Threshold <= 7?
WHEN
The empty residue weight threshold value is less than or equal to 7
THEN
The system should classify this as low-level empty residue threshold
Context: Empty residue weight threshold is 7 or below
GIVEN
Empty residue weight threshold is 7 or below
Applied to: Set ER Weight Threshold LE7 Flag
WHEN
The threshold level needs to be classified
THEN
The system should set the ER weight threshold LE7 flag
Context: Empty residue processing is active and threshold is not LE7
GIVEN
Empty residue processing is active and threshold is not LE7
Applied to: ER Weight Threshold > 7?
WHEN
The empty residue weight threshold value is greater than 7
THEN
The system should classify this as high-level empty residue threshold
Context: Empty residue weight threshold is above 7
GIVEN
Empty residue weight threshold is above 7
Applied to: Set ER Weight Threshold GT7 Flag
WHEN
The threshold level needs to be classified as high-level
THEN
The system should set the ER weight threshold GT7 flag
R-GCX003-cbl-01739 (+15) File: GCX003.cbl L[Check Message Types for Error Classification] Merged 16 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'L[Check Message Types for Error Classification]':
  • Context - a report entry is being processed for error classification:
    For Is Message Line?:
    When the system checks if the entry is a message line, then the system identifies whether the entry contains message content that needs error type analysis.
  • Context - a message line has been identified for error classification:
    For Is Spawn Message?:
    When the system checks if the message is a spawn message, then if it is a spawn message, the system skips error counting and continues processing without incrementing counters.
  • Context - a non-spawn message line is being processed:
    For Message Type = Error?:
    When the system evaluates the message type indicator, then if the message type is error, the system proceeds to error-specific processing and counter increments.
  • Context - a non-spawn message line is not classified as an error:
    For Message Type = Warning?:
    When the system evaluates the message type indicator, then if the message type is warning, the system proceeds to warning-specific processing and counter increments.
  • Context - a non-spawn message line is not classified as error or warning:
    For Message Type = Info?:
    When the system evaluates the message type indicator, then if the message type is information, the system increments the information counter.
  • Context - a message has been classified as an error type:
    For Is Error Type 43?:
    When the system checks the specific error type indicator, then if the error type is 43, the system increments the error type 43 counter in addition to the general error counter.
    For Increment General Error Counter:
    When the system processes the error classification, then the system increments the general error counter by 1.
  • Context - an error message has been identified as type 43:
    For Increment Error Type 43 Counter:
    When the system processes the error classification, then the system increments the error type 43 counter by 1.
  • Context - a message has been classified as a warning type:
    For Is Warning Type 49 or 52?:
    When the system checks the specific warning type indicator, then if the warning type is 49 or 52, the system increments the dsp counter in addition to the warning counter.
    For Increment Warning Counter:
    When the system processes the warning classification, then the system increments the warning counter by 1.
  • Context - a warning message has been identified as type 49 or 52:
    For Increment DSP Counter:
    When the system processes the warning classification, then the system increments the dsp counter by 1.
  • Context - a message has been classified as an information type:
    For Increment Info Counter:
    When the system processes the information classification, then the system increments the information counter by 1.
  • Context - all message processing has been completed and counters have been updated:
    For Check Error 43 Count vs Total Errors:
    When the system compares the error type 43 count against the total error count, then if the error type 43 count equals the total error count, the system proceeds with error-to-warning conversion.
  • Context - all errors in the batch are identified as type 43:
    For Convert Error 43 to Warning Type 18:
    When the system performs error-to-warning conversion, then the system changes all error type 43 messages to warning type 18.
  • Context - error type 43 messages are being converted to warnings:
    For Adjust Error Counter Down & Adjust Warning Counter Up:
    When the system adjusts the counters for the conversion, then the system decrements the error counter by 1 for each converted message and the system increments the warning counter by 1 for each converted message.
👨‍💻 Technical ACs (Gherkin)
Context: A report entry is being processed for error classification
GIVEN
A report entry is being processed for error classification
Applied to: Is Message Line?
WHEN
The system checks if the entry is a message line
THEN
The system identifies whether the entry contains message content that needs error type analysis
Context: A message line has been identified for error classification
GIVEN
A message line has been identified for error classification
Applied to: Is Spawn Message?
WHEN
The system checks if the message is a spawn message
THEN
If it is a spawn message, the system skips error counting and continues processing without incrementing counters
Context: A non-spawn message line is being processed
GIVEN
A non-spawn message line is being processed
Applied to: Message Type = Error?
WHEN
The system evaluates the message type indicator
THEN
If the message type is error, the system proceeds to error-specific processing and counter increments
Context: A non-spawn message line is not classified as an error
GIVEN
A non-spawn message line is not classified as an error
Applied to: Message Type = Warning?
WHEN
The system evaluates the message type indicator
THEN
If the message type is warning, the system proceeds to warning-specific processing and counter increments
Context: A non-spawn message line is not classified as error or warning
GIVEN
A non-spawn message line is not classified as error or warning
Applied to: Message Type = Info?
WHEN
The system evaluates the message type indicator
THEN
If the message type is information, the system increments the information counter
Context: A message has been classified as an error type
GIVEN
A message has been classified as an error type
Applied to: Is Error Type 43?
WHEN
The system checks the specific error type indicator
THEN
If the error type is 43, the system increments the error type 43 counter in addition to the general error counter
Applied to: Increment General Error Counter
WHEN
The system processes the error classification
THEN
The system increments the general error counter by 1
Context: An error message has been identified as type 43
GIVEN
An error message has been identified as type 43
Applied to: Increment Error Type 43 Counter
WHEN
The system processes the error classification
THEN
The system increments the error type 43 counter by 1
Context: A message has been classified as a warning type
GIVEN
A message has been classified as a warning type
Applied to: Is Warning Type 49 or 52?
WHEN
The system checks the specific warning type indicator
THEN
If the warning type is 49 or 52, the system increments the DSP counter in addition to the warning counter
Applied to: Increment Warning Counter
WHEN
The system processes the warning classification
THEN
The system increments the warning counter by 1
Context: A warning message has been identified as type 49 or 52
GIVEN
A warning message has been identified as type 49 or 52
Applied to: Increment DSP Counter
WHEN
The system processes the warning classification
THEN
The system increments the DSP counter by 1
Context: A message has been classified as an information type
GIVEN
A message has been classified as an information type
Applied to: Increment Info Counter
WHEN
The system processes the information classification
THEN
The system increments the information counter by 1
Context: All message processing has been completed and counters have been updated
GIVEN
All message processing has been completed and counters have been updated
Applied to: Check Error 43 Count vs Total Errors
WHEN
The system compares the error type 43 count against the total error count
THEN
If the error type 43 count equals the total error count, the system proceeds with error-to-warning conversion
Context: All errors in the batch are identified as type 43
GIVEN
All errors in the batch are identified as type 43
Applied to: Convert Error 43 to Warning Type 18
WHEN
The system performs error-to-warning conversion
THEN
The system changes all error type 43 messages to warning type 18
Context: Error type 43 messages are being converted to warnings
GIVEN
Error type 43 messages are being converted to warnings
Applied to: Adjust Error Counter Down & Adjust Warning Counter Up
WHEN
The system adjusts the counters for the conversion
THEN
The system decrements the error counter by 1 for each converted message AND The system increments the warning counter by 1 for each converted message
R-GCX003-cbl-01755 (+6) File: GCX003.cbl I[Send Current Email Batch via EMCSEND3] Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'I[Send Current Email Batch via EMCSEND3]':
  • Context - an email message is being prepared for transmission:
    For Email Content Exceeds Line Limit?:
    When the system checks if the current line count exceeds 699 lines, then the system determines whether to split the email into multiple batches or send as a single transmission.
  • Context - an email message exceeds the 699 line limit:
    For Split Email into Batches:
    When the system processes the email for transmission, then the system sets no-more-email flag to true, clears the message buffer, resets line counter to zero, and prepares continuation header with report headers.
  • Context - an email has been sent via emcsend3 service:
    For Email Transmission Successful?:
    When the system checks the email return status flag, then the system determines if the transmission was successful based on the return status.
  • Context - an email transmission has failed:
    For Handle Transmission Failure:
    When the system processes the transmission failure, then the system clears the primary recipient, sets fallback recipients to 'aei9999' and 'om01247', and attempts retransmission.
  • Context - email content is prepared for transmission:
    For Call EMCSEND3 for Current Batch:
    When the system needs to send the email, then the system calls emcsend3 service with sender id, destination filename, recipient addresses, subject, keywords, message content, and formatting parameters.
  • Context - a retry email transmission attempt has been made with fallback recipients:
    For Retry Successful?:
    When the system checks the retry transmission status, then if retry fails, the system generates an error message 'send to file of om01247 failed' and abends the process.
  • Context - email transmission has been completed successfully:
    For Purge Message Queue:
    When the system finalizes the email process, then the system initializes accept status and calls cims with purg function to purge the alternate pcb message queue.
👨‍💻 Technical ACs (Gherkin)
Context: An email message is being prepared for transmission
GIVEN
An email message is being prepared for transmission
Applied to: Email Content Exceeds Line Limit?
WHEN
The system checks if the current line count exceeds 699 lines
THEN
The system determines whether to split the email into multiple batches or send as a single transmission
Context: An email message exceeds the 699 line limit
GIVEN
An email message exceeds the 699 line limit
Applied to: Split Email into Batches
WHEN
The system processes the email for transmission
THEN
The system sets no-more-email flag to true, clears the message buffer, resets line counter to zero, and prepares continuation header with report headers
Context: An email has been sent via EMCSEND3 service
GIVEN
An email has been sent via EMCSEND3 service
Applied to: Email Transmission Successful?
WHEN
The system checks the email return status flag
THEN
The system determines if the transmission was successful based on the return status
Context: An email transmission has failed
GIVEN
An email transmission has failed
Applied to: Handle Transmission Failure
WHEN
The system processes the transmission failure
THEN
The system clears the primary recipient, sets fallback recipients to 'AEI9999' and 'OM01247', and attempts retransmission
Context: Email content is prepared for transmission
GIVEN
Email content is prepared for transmission
Applied to: Call EMCSEND3 for Current Batch
WHEN
The system needs to send the email
THEN
The system calls EMCSEND3 service with sender ID, destination filename, recipient addresses, subject, keywords, message content, and formatting parameters
Context: A retry email transmission attempt has been made with fallback recipients
GIVEN
A retry email transmission attempt has been made with fallback recipients
Applied to: Retry Successful?
WHEN
The system checks the retry transmission status
THEN
If retry fails, the system generates an error message 'SEND TO FILE OF OM01247 FAILED' and abends the process
Context: Email transmission has been completed successfully
GIVEN
Email transmission has been completed successfully
Applied to: Purge Message Queue
WHEN
The system finalizes the email process
THEN
The system initializes accept status and calls CIMS with PURG function to purge the alternate PCB message queue
R-GCX003-cbl-01762 (+5) File: GCX003.cbl D{Message Type Classification} Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'D{Message Type Classification}':
  • Context - a report entry is being processed for message classification:
    For Is Message Line Type?:
    When the system checks if the report entry is a message line type, then if the entry is not a message line type, skip all message processing and complete classification.
  • Context - a message line is identified for processing:
    For Is Spawn Message?:
    When the message is classified as a spawn message type, then skip the severity classification and counter increment processing but continue with report index addition.
  • Context - a non-spawn message line is being processed:
    For Classify as Error Message:
    When the message severity is classified as error level, then increment the error counter by 1, and if the message type is 43, also increment the special error counter (err-43-cnt) by 1.
    For Classify as Warning Message:
    When the message severity is classified as warning level, then increment the warning counter by 1, and if the message type is 49 or 52, also increment the dsp counter by 1.
    For Classify as Information Message:
    When the message severity is classified as information level, then increment the information counter by 1.
  • Context - a message has been classified and counters updated:
    For Report Line Limit Reached?:
    When the report index is incremented by 1, then if the maximum report line limit is reached, set message type 9 (overflow message) at the current report index position.
👨‍💻 Technical ACs (Gherkin)
Context: A report entry is being processed for message classification
GIVEN
A report entry is being processed for message classification
Applied to: Is Message Line Type?
WHEN
The system checks if the report entry is a message line type
THEN
If the entry is not a message line type, skip all message processing and complete classification
Context: A message line is identified for processing
GIVEN
A message line is identified for processing
Applied to: Is Spawn Message?
WHEN
The message is classified as a spawn message type
THEN
Skip the severity classification and counter increment processing but continue with report index addition
Context: A non-spawn message line is being processed
GIVEN
A non-spawn message line is being processed
Applied to: Classify as Error Message
WHEN
The message severity is classified as error level
THEN
Increment the error counter by 1, and if the message type is 43, also increment the special error counter (ERR-43-CNT) by 1
Applied to: Classify as Warning Message
WHEN
The message severity is classified as warning level
THEN
Increment the warning counter by 1, and if the message type is 49 or 52, also increment the DSP counter by 1
Applied to: Classify as Information Message
WHEN
The message severity is classified as information level
THEN
Increment the information counter by 1
Context: A message has been classified and counters updated
GIVEN
A message has been classified and counters updated
Applied to: Report Line Limit Reached?
WHEN
The report index is incremented by 1
THEN
If the maximum report line limit is reached, set message type 9 (overflow message) at the current report index position
R-GCX003-cbl-01768 (+15) File: GCX003.cbl B{Check Processing Status} Merged 16 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'B{Check Processing Status}':
  • Context - a train manifest processing operation has completed all validation and processing steps:
    For Check RPT-NO-ERROR Flag:
    When the system checks the error accumulation status using the rpt-no-error flag, then the system determines whether any business rule violations or data validation errors have occurred during processing.
  • Context - train manifest processing has completed and error status has been evaluated:
    For Check RPT-NO-SPAWN Flag:
    When the system checks the spawn activity status using the rpt-no-spawn flag, then the system determines whether any special manifest creation processes were initiated during cargo processing.
  • Context - a train manifest request has been received and initial processing completed:
    For Check REQ-ACTION-SEND:
    When the system evaluates the request action type for send operations, then the system determines whether to proceed with customs transmission or generate reports only.
  • Context - a train manifest request has been received and is not a send action:
    For Check REQ-ACTION-REPORT:
    When the system evaluates the request action type for report operations, then the system determines whether to generate reports without customs transmission.
  • Context - train manifest processing completed with no errors, no spawn activities, and a send action request:
    For Set Processing Result: SENT:
    When the system determines the final processing result, then the system sets the processing result to sent indicating successful customs transmission.
  • Context - train manifest processing completed with either errors present or spawn activities triggered or both:
    For Set Processing Result: NOT SENT with Spawns:
    When the system determines the final processing result for send actions, then the system sets the processing result to not sent and indicates special processing activities occurred.
  • Context - a train manifest request specified report action type:
    For Set Processing Result: REPORT GENERATED:
    When the system determines the final processing result, then the system sets the processing result to report generated indicating successful report creation without customs transmission.
  • Context - a train manifest request has an action type that is neither send nor report:
    For Set Processing Result: ABORTED:
    When the system determines the final processing result, then the system sets the processing result to aborted indicating the request could not be processed.
  • Context - train manifest processing has completed and processing result has been determined:
    For Validate Error Count Accumulation:
    When the system validates the accumulated error count from all processing steps, then the system ensures accurate error count totals for reporting and decision making.
  • Context - error count validation has been completed:
    For Validate Warning Count Accumulation:
    When the system validates the accumulated warning count from all processing steps, then the system ensures accurate warning count totals for reporting purposes.
  • Context - warning count validation has been completed:
    For Validate Spawn Count Accumulation:
    When the system validates the accumulated spawn count from all processing steps, then the system ensures accurate spawn activity count totals for processing outcome determination.
  • Context - all count validations have been completed:
    For Calculate Final Error Statistics:
    When the system calculates final error statistics, then the system produces complete error metrics for inclusion in processing reports and audit trails.
  • Context - final error statistics calculation has been completed:
    For Calculate Final Warning Statistics:
    When the system calculates final warning statistics, then the system produces complete warning metrics for inclusion in processing reports.
  • Context - final warning statistics calculation has been completed:
    For Calculate Final Spawn Statistics:
    When the system calculates final spawn activity statistics, then the system produces complete spawn metrics for inclusion in processing reports and audit trails.
  • Context - all final statistics calculations have been completed:
    For Determine Processing Completion Status:
    When the system determines the overall processing completion status, then the system establishes whether processing completed successfully, with warnings, with errors, or was aborted.
  • Context - processing completion status has been determined:
    For Set Final Processing Outcome:
    When the system sets the final processing outcome, then the system assigns the appropriate outcome status that accurately reflects the processing results for user notification and audit purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A train manifest processing operation has completed all validation and processing steps
GIVEN
A train manifest processing operation has completed all validation and processing steps
Applied to: Check RPT-NO-ERROR Flag
WHEN
The system checks the error accumulation status using the RPT-NO-ERROR flag
THEN
The system determines whether any business rule violations or data validation errors have occurred during processing
Context: Train manifest processing has completed and error status has been evaluated
GIVEN
Train manifest processing has completed and error status has been evaluated
Applied to: Check RPT-NO-SPAWN Flag
WHEN
The system checks the spawn activity status using the RPT-NO-SPAWN flag
THEN
The system determines whether any special manifest creation processes were initiated during cargo processing
Context: A train manifest request has been received and initial processing completed
GIVEN
A train manifest request has been received and initial processing completed
Applied to: Check REQ-ACTION-SEND
WHEN
The system evaluates the request action type for send operations
THEN
The system determines whether to proceed with customs transmission or generate reports only
Context: A train manifest request has been received and is not a send action
GIVEN
A train manifest request has been received and is not a send action
Applied to: Check REQ-ACTION-REPORT
WHEN
The system evaluates the request action type for report operations
THEN
The system determines whether to generate reports without customs transmission
Context: Train manifest processing completed with no errors, no spawn activities, and a send action request
GIVEN
Train manifest processing completed with no errors, no spawn activities, and a send action request
Applied to: Set Processing Result: SENT
WHEN
The system determines the final processing result
THEN
The system sets the processing result to SENT indicating successful customs transmission
Context: Train manifest processing completed with either errors present or spawn activities triggered or both
GIVEN
Train manifest processing completed with either errors present or spawn activities triggered or both
Applied to: Set Processing Result: NOT SENT with Spawns
WHEN
The system determines the final processing result for send actions
THEN
The system sets the processing result to NOT SENT and indicates special processing activities occurred
Context: A train manifest request specified report action type
GIVEN
A train manifest request specified report action type
Applied to: Set Processing Result: REPORT GENERATED
WHEN
The system determines the final processing result
THEN
The system sets the processing result to REPORT GENERATED indicating successful report creation without customs transmission
Context: A train manifest request has an action type that is neither send nor report
GIVEN
A train manifest request has an action type that is neither send nor report
Applied to: Set Processing Result: ABORTED
WHEN
The system determines the final processing result
THEN
The system sets the processing result to ABORTED indicating the request could not be processed
Context: Train manifest processing has completed and processing result has been determined
GIVEN
Train manifest processing has completed and processing result has been determined
Applied to: Validate Error Count Accumulation
WHEN
The system validates the accumulated error count from all processing steps
THEN
The system ensures accurate error count totals for reporting and decision making
Context: Error count validation has been completed
GIVEN
Error count validation has been completed
Applied to: Validate Warning Count Accumulation
WHEN
The system validates the accumulated warning count from all processing steps
THEN
The system ensures accurate warning count totals for reporting purposes
Context: Warning count validation has been completed
GIVEN
Warning count validation has been completed
Applied to: Validate Spawn Count Accumulation
WHEN
The system validates the accumulated spawn count from all processing steps
THEN
The system ensures accurate spawn activity count totals for processing outcome determination
Context: All count validations have been completed
GIVEN
All count validations have been completed
Applied to: Calculate Final Error Statistics
WHEN
The system calculates final error statistics
THEN
The system produces complete error metrics for inclusion in processing reports and audit trails
Context: Final error statistics calculation has been completed
GIVEN
Final error statistics calculation has been completed
Applied to: Calculate Final Warning Statistics
WHEN
The system calculates final warning statistics
THEN
The system produces complete warning metrics for inclusion in processing reports
Context: Final warning statistics calculation has been completed
GIVEN
Final warning statistics calculation has been completed
Applied to: Calculate Final Spawn Statistics
WHEN
The system calculates final spawn activity statistics
THEN
The system produces complete spawn metrics for inclusion in processing reports and audit trails
Context: All final statistics calculations have been completed
GIVEN
All final statistics calculations have been completed
Applied to: Determine Processing Completion Status
WHEN
The system determines the overall processing completion status
THEN
The system establishes whether processing completed successfully, with warnings, with errors, or was aborted
Context: Processing completion status has been determined
GIVEN
Processing completion status has been determined
Applied to: Set Final Processing Outcome
WHEN
The system sets the final processing outcome
THEN
The system assigns the appropriate outcome status that accurately reflects the processing results for user notification and audit purposes
R-GCX003-cbl-01784 (+3) File: GCX003.cbl F[Create IT Export Special Manifest MSG Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'F[Create IT Export Special Manifest MSG':
  • Context - a user is attempting to create an it export special manifest for cargo with bond type 'it' and special manifest original flag is set:
    For Check User Authorization for Special Manifests?:
    When the request action is send and the system checks user authorization for special manifests, then if the user is not authorized for special manifests, set msg-43 unauthorized message and continue processing without creating the manifest.
  • Context - a cargo record is being processed for potential it export special manifest creation:
    For Check Cargo Bond Type = 'IT'?:
    When the system checks if the cargo bond type is 'it' and the special manifest original flag is not set, then only proceed with it export manifest creation if cargo bond type is 'it' and special manifest original flag is not set, otherwise continue normal processing.
  • Context - an it export special manifest is being created for cargo with bond type 'it' and special manifest original flag not set:
    For Check Request Action = SEND?:
    When the system checks the request action type, then if request action is send and user is authorized, create msg-23 and spawn special manifest; if request action is report, create msg-24 report-only message.
  • Context - user is authorized for special manifests, cargo bond type is 'it', special manifest original flag is not set, and request action is send:
    For Set IT Export Spawn Flag:
    When the system creates the it export special manifest, then set msg-23 message type, copy equipment line to report, add equipment to total count, set it export spawn flag, initialize special manifest parameters with gcx101 it export type, copy equipment id, waybill number, waybill date, border codes, ccn from cargo record, origin/destination codes, and queue special manifest for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A user is attempting to create an IT export special manifest for cargo with bond type 'IT' and special manifest original flag is set
GIVEN
A user is attempting to create an IT export special manifest for cargo with bond type 'IT' and special manifest original flag is set
Applied to: Check User Authorization for Special Manifests?
WHEN
The request action is SEND and the system checks user authorization for special manifests
THEN
If the user is not authorized for special manifests, set MSG-43 unauthorized message and continue processing without creating the manifest
Context: A cargo record is being processed for potential IT export special manifest creation
GIVEN
A cargo record is being processed for potential IT export special manifest creation
Applied to: Check Cargo Bond Type = 'IT'?
WHEN
The system checks if the cargo bond type is 'IT' and the special manifest original flag is not set
THEN
Only proceed with IT export manifest creation if cargo bond type is 'IT' and special manifest original flag is not set, otherwise continue normal processing
Context: An IT export special manifest is being created for cargo with bond type 'IT' and special manifest original flag not set
GIVEN
An IT export special manifest is being created for cargo with bond type 'IT' and special manifest original flag not set
Applied to: Check Request Action = SEND?
WHEN
The system checks the request action type
THEN
If request action is SEND and user is authorized, create MSG-23 and spawn special manifest; if request action is REPORT, create MSG-24 report-only message
Context: User is authorized for special manifests, cargo bond type is 'IT', special manifest original flag is not set, and request action is SEND
GIVEN
User is authorized for special manifests, cargo bond type is 'IT', special manifest original flag is not set, and request action is SEND
Applied to: Set IT Export Spawn Flag
WHEN
The system creates the IT export special manifest
THEN
Set MSG-23 message type, copy equipment line to report, add equipment to total count, set IT export spawn flag, initialize special manifest parameters with GCX101 IT export type, copy equipment ID, waybill number, waybill date, border codes, CCN from cargo record, origin/destination codes, and queue special manifest for processing
R-GCX003-cbl-01788 (+18) File: GCX003.cbl B[Retrieve User SCAC Access] Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'B[Retrieve User SCAC Access]':
  • Context - a user session is active in the system:
    For Get User ID from CCCOM:
    When the system needs to validate user access permissions, then the user id is retrieved from the system communication area.
  • Context - a train security validation is being performed:
    For Set SCAC Code to CP-SCAC:
    When the system needs to validate carrier access permissions, then the scac code is set to the canadian pacific carrier code.
  • Context - user id and scac code are available for validation:
    For Call GCCSCAC Security Module:
    When the system needs to verify carrier access permissions, then the gccscac security module is called with user and carrier parameters.
  • Context - the scac security module has been called:
    For SCAC Access Valid?:
    When the system evaluates the security validation result, then access is considered valid unless the scac flag indicates invalid access and the request is not an aei train send request.
  • Context - a train processing request is being validated:
    For Check if AEI Train Send Request:
    When the system needs to determine the request type, then the request is classified as aei if the request type equals the aei request type constant.
  • Context - scac access validation has failed:
    For Is AEI Request?:
    When the request is an aei train send request, then access validation continues without setting access denied flag.
  • Context - scac access validation has failed and the request is not an aei request:
    For Set Access Denied Flag:
    When the system processes the access validation result, then the no user access flag is set to true.
  • Context - user access has been denied due to invalid scac permissions:
    For Generate Security Error Message:
    When the system generates validation error messages, then message 14 is set to true and the report index is incremented.
  • Context - user id is available for security lookup:
    For Query User Security Table GCSTBRT-US:
    When the system needs to retrieve detailed user permissions, then the gcstbrt user security table is queried using the acf2 user id.
  • Context - the user security table has been queried:
    For User Found in Security Table?:
    When the system evaluates the query result, then the user is considered found if the database operation was successful.
  • Context - the user exists in the security table:
    For Load User Security Segment:
    When the system loads user permission data, then the security segment data is moved to the user security segment structure.
  • Context - the user does not exist in the security table:
    For Initialize Empty Security Segment:
    When the system initializes user permission data, then the user security segment is set to spaces.
  • Context - user security permissions have been loaded:
    For Check Send Action Authorization:
    When the request action is send, then authorization is checked based on utf-add permission level and aei request status.
  • Context - a send action is being authorized:
    For Permission Level U or S?:
    When the system checks user permission levels, then access is granted if utf-add equals 'u' or 's' or the request is an aei train send request.
  • Context - user does not have 'u' or 's' permission level and the request is not an aei request:
    For Set No User Access Flag:
    When the system evaluates send action authorization, then the no user access flag is set to true.
  • Context - user access has been denied due to insufficient permissions:
    For Generate Authorization Error:
    When the system generates authorization error messages, then message 13 is set to true and the report index is incremented.
  • Context - no errors have occurred in previous validations and the request action is send:
    For Check Special Manifest Authorization:
    When the system checks special manifest permissions, then authorization is evaluated if utf-spec-mani is not 's' and the request is not an aei request.
  • Context - user has 's' level special manifest permissions or the request is an aei request:
    For Set Special Manifest Auth Flag:
    When the system sets special manifest authorization, then the user is authorized for special manifest operations.
  • Context - user does not have 's' level special manifest permissions and the request is not an aei request:
    For Set No Special Manifest Auth Flag:
    When the system evaluates special manifest authorization, then the user not authorized for special manifest flag is set to true.
👨‍💻 Technical ACs (Gherkin)
Context: A user session is active in the system
GIVEN
A user session is active in the system
Applied to: Get User ID from CCCOM
WHEN
The system needs to validate user access permissions
THEN
The user ID is retrieved from the system communication area
Context: A train security validation is being performed
GIVEN
A train security validation is being performed
Applied to: Set SCAC Code to CP-SCAC
WHEN
The system needs to validate carrier access permissions
THEN
The SCAC code is set to the Canadian Pacific carrier code
Context: User ID and SCAC code are available for validation
GIVEN
User ID and SCAC code are available for validation
Applied to: Call GCCSCAC Security Module
WHEN
The system needs to verify carrier access permissions
THEN
The GCCSCAC security module is called with user and carrier parameters
Context: The SCAC security module has been called
GIVEN
The SCAC security module has been called
Applied to: SCAC Access Valid?
WHEN
The system evaluates the security validation result
THEN
Access is considered valid unless the SCAC flag indicates invalid access AND the request is not an AEI train send request
Context: A train processing request is being validated
GIVEN
A train processing request is being validated
Applied to: Check if AEI Train Send Request
WHEN
The system needs to determine the request type
THEN
The request is classified as AEI if the request type equals the AEI request type constant
Context: SCAC access validation has failed
GIVEN
SCAC access validation has failed
Applied to: Is AEI Request?
WHEN
The request is an AEI train send request
THEN
Access validation continues without setting access denied flag
Context: SCAC access validation has failed AND the request is not an AEI request
GIVEN
SCAC access validation has failed AND the request is not an AEI request
Applied to: Set Access Denied Flag
WHEN
The system processes the access validation result
THEN
The no user access flag is set to true
Context: User access has been denied due to invalid SCAC permissions
GIVEN
User access has been denied due to invalid SCAC permissions
Applied to: Generate Security Error Message
WHEN
The system generates validation error messages
THEN
Message 14 is set to true and the report index is incremented
Context: User ID is available for security lookup
GIVEN
User ID is available for security lookup
Applied to: Query User Security Table GCSTBRT-US
WHEN
The system needs to retrieve detailed user permissions
THEN
The GCSTBRT user security table is queried using the ACF2 user ID
Context: The user security table has been queried
GIVEN
The user security table has been queried
Applied to: User Found in Security Table?
WHEN
The system evaluates the query result
THEN
The user is considered found if the database operation was successful
Context: The user exists in the security table
GIVEN
The user exists in the security table
Applied to: Load User Security Segment
WHEN
The system loads user permission data
THEN
The security segment data is moved to the user security segment structure
Context: The user does not exist in the security table
GIVEN
The user does not exist in the security table
Applied to: Initialize Empty Security Segment
WHEN
The system initializes user permission data
THEN
The user security segment is set to spaces
Context: User security permissions have been loaded
GIVEN
User security permissions have been loaded
Applied to: Check Send Action Authorization
WHEN
The request action is SEND
THEN
Authorization is checked based on UTF-ADD permission level and AEI request status
Context: A send action is being authorized
GIVEN
A send action is being authorized
Applied to: Permission Level U or S?
WHEN
The system checks user permission levels
THEN
Access is granted if UTF-ADD equals 'U' or 'S' OR the request is an AEI train send request
Context: User does not have 'U' or 'S' permission level AND the request is not an AEI request
GIVEN
User does not have 'U' or 'S' permission level AND the request is not an AEI request
Applied to: Set No User Access Flag
WHEN
The system evaluates send action authorization
THEN
The no user access flag is set to true
Context: User access has been denied due to insufficient permissions
GIVEN
User access has been denied due to insufficient permissions
Applied to: Generate Authorization Error
WHEN
The system generates authorization error messages
THEN
Message 13 is set to true and the report index is incremented
Context: No errors have occurred in previous validations AND the request action is SEND
GIVEN
No errors have occurred in previous validations AND the request action is SEND
Applied to: Check Special Manifest Authorization
WHEN
The system checks special manifest permissions
THEN
Authorization is evaluated if UTF-SPEC-MANI is not 'S' AND the request is not an AEI request
Context: User has 'S' level special manifest permissions OR the request is an AEI request
GIVEN
User has 'S' level special manifest permissions OR the request is an AEI request
Applied to: Set Special Manifest Auth Flag
WHEN
The system sets special manifest authorization
THEN
The user is authorized for special manifest operations
Context: User does not have 'S' level special manifest permissions AND the request is not an AEI request
GIVEN
User does not have 'S' level special manifest permissions AND the request is not an AEI request
Applied to: Set No Special Manifest Auth Flag
WHEN
The system evaluates special manifest authorization
THEN
The user not authorized for special manifest flag is set to true
R-GCX003-cbl-01807 (+9) File: GCX003.cbl B{Is Cargo Immediate Transport Bond?} Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'B{Is Cargo Immediate Transport Bond?}':
  • Context - a cargo record with m1201 in-bond type code:
    For Is M1201 In-Bond Type Code = 'IT'?:
    When the system evaluates the bond type for immediate transport classification, then the cargo is classified as immediate transport bond if m1201 in-bond type code equals 'it' or 'ie'.
  • Context - a cargo record with immediate transport bond type and tr created for it indicator:
    For Is TR Created for IT = 'Y'?:
    When the system evaluates cargo attachment eligibility for immediate transport processing, then the cargo is marked for tr created for it processing if the tr created for it flag equals 'y', otherwise cargo attachment is skipped.
  • Context - a cargo record with us-canada-us bond type and tr created for it status as spaces and cargo short description:
    For Is Cargo Status Valid for IT Bond?:
    When the system evaluates cargo attachment eligibility for us-canada-us processing, then the cargo attachment is skipped if the cargo short description equals the release status value.
  • Context - a cargo record with default bond type and tr created for it status as spaces and cargo short description:
    For Is Cargo Status Valid for IT Bond?:
    When the system evaluates cargo attachment eligibility for default bond processing, then the cargo attachment is skipped if the cargo short description equals the release status value.
  • Context - a cargo record with empty equipment bond type classification:
    For Skip Cargo Attachment - IT Bond:
    When the system evaluates cargo attachment eligibility, then the cargo attachment processing is skipped for empty equipment bonds.
  • Context - a cargo record with special manifest origin indicator and crossing station information:
    For Is Special Manifest Required?:
    When the system evaluates cargo attachment eligibility for special manifest processing, then the cargo attachment is skipped if special manifest origin is true and the crossing station is woburn pq station.
  • Context - a cargo record with special manifest special indicator and crossing station information:
    For Is Special Manifest Required?:
    When the system evaluates cargo attachment eligibility for special manifest processing, then the cargo attachment is skipped if special manifest special is true and the crossing station is not woburn pq station.
  • Context - a cargo record with export bond type, us-mexico country codes, and station information:
    For Process IT Bond for Attachment:
    When the system evaluates cargo attachment eligibility for export processing, then the cargo attachment is skipped if the bond type is export and country codes are 'usmx' and the station is not laredo tx station.
  • Context - a cargo record with bond type of 'te', 'tr', or 'mt' and bond number information:
    For Process as AMS 7512 Bond Type:
    When the system formats the cargo information for reporting, then the bond information is formatted as 'ams 7512' followed by the bond type code and bond number.
  • Context - a cargo record with bond type of 'it' or 'ie' and bond number information:
    For Process as Standard AMS Bond Type:
    When the system formats the cargo information for reporting, then the bond information is formatted as 'ams' followed by the bond type code and bond number.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with M1201 in-bond type code
GIVEN
A cargo record with M1201 in-bond type code
Applied to: Is M1201 In-Bond Type Code = 'IT'?
WHEN
The system evaluates the bond type for immediate transport classification
THEN
The cargo is classified as immediate transport bond if M1201 in-bond type code equals 'IT' or 'IE'
Context: A cargo record with immediate transport bond type and TR created for IT indicator
GIVEN
A cargo record with immediate transport bond type and TR created for IT indicator
Applied to: Is TR Created for IT = 'Y'?
WHEN
The system evaluates cargo attachment eligibility for immediate transport processing
THEN
The cargo is marked for TR created for IT processing if the TR created for IT flag equals 'Y', otherwise cargo attachment is skipped
Context: A cargo record with US-Canada-US bond type and TR created for IT status as spaces and cargo short description
GIVEN
A cargo record with US-Canada-US bond type and TR created for IT status as spaces and cargo short description
Applied to: Is Cargo Status Valid for IT Bond?
WHEN
The system evaluates cargo attachment eligibility for US-Canada-US processing
THEN
The cargo attachment is skipped if the cargo short description equals the release status value
Context: A cargo record with default bond type and TR created for IT status as spaces and cargo short description
GIVEN
A cargo record with default bond type and TR created for IT status as spaces and cargo short description
Applied to: Is Cargo Status Valid for IT Bond?
WHEN
The system evaluates cargo attachment eligibility for default bond processing
THEN
The cargo attachment is skipped if the cargo short description equals the release status value
Context: A cargo record with empty equipment bond type classification
GIVEN
A cargo record with empty equipment bond type classification
Applied to: Skip Cargo Attachment - IT Bond
WHEN
The system evaluates cargo attachment eligibility
THEN
The cargo attachment processing is skipped for empty equipment bonds
Context: A cargo record with special manifest origin indicator and crossing station information
GIVEN
A cargo record with special manifest origin indicator and crossing station information
Applied to: Is Special Manifest Required?
WHEN
The system evaluates cargo attachment eligibility for special manifest processing
THEN
The cargo attachment is skipped if special manifest origin is true and the crossing station is Woburn PQ station
Context: A cargo record with special manifest special indicator and crossing station information
GIVEN
A cargo record with special manifest special indicator and crossing station information
Applied to: Is Special Manifest Required?
WHEN
The system evaluates cargo attachment eligibility for special manifest processing
THEN
The cargo attachment is skipped if special manifest special is true and the crossing station is not Woburn PQ station
Context: A cargo record with export bond type, US-Mexico country codes, and station information
GIVEN
A cargo record with export bond type, US-Mexico country codes, and station information
Applied to: Process IT Bond for Attachment
WHEN
The system evaluates cargo attachment eligibility for export processing
THEN
The cargo attachment is skipped if the bond type is export and country codes are 'USMX' and the station is not Laredo TX station
Context: A cargo record with bond type of 'TE', 'TR', or 'MT' and bond number information
GIVEN
A cargo record with bond type of 'TE', 'TR', or 'MT' and bond number information
Applied to: Process as AMS 7512 Bond Type
WHEN
The system formats the cargo information for reporting
THEN
The bond information is formatted as 'AMS 7512' followed by the bond type code and bond number
Context: A cargo record with bond type of 'IT' or 'IE' and bond number information
GIVEN
A cargo record with bond type of 'IT' or 'IE' and bond number information
Applied to: Process as Standard AMS Bond Type
WHEN
The system formats the cargo information for reporting
THEN
The bond information is formatted as 'AMS' followed by the bond type code and bond number
R-GCX003-cbl-01817 (+5) File: GCX003.cbl C[Extract Container ID from Position 28 Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'C[Extract Container ID from Position 28':
  • Context - a database record from the freight inquiry system is being processed:
    For Check Record Type at Position 1-8:
    When the system reads positions 1-8 of the record, then if the record type equals 't/c xref' then process as container cross-reference record, otherwise skip to next record.
  • Context - a valid container cross-reference record has been identified:
    For Extract Container ID from Position 28-39:
    When the system processes the record for container information, then extract the container id from positions 28-39 of the record and store it in the container work table.
  • Context - a container id has been successfully extracted from the record:
    For Extract Associated Waybill Information:
    When the system processes waybill reference information, then extract railroad number from positions 10-12, station number from positions 14-19, and waybill number from positions 21-26.
  • Context - waybill information has been extracted from the database record:
    For Replace Spaces with Zeroes in Waybill:
    When the waybill number contains space characters, then replace all space characters with zeroes in the waybill number to ensure consistent numeric format.
  • Context - a container has been successfully processed and stored:
    For Increment Container Counter:
    When the system updates the container tracking counter, then increment the container counter by 1 and ensure it does not exceed the maximum limit of 30 containers.
  • Context - container processing has been completed for all available records:
    For Mark Container as Invalid:
    When the system evaluates the container processing results, then if no valid containers were found or the first container id is spaces or low-values, then set container status to not found, otherwise set container status to found and mark as iq container type.
👨‍💻 Technical ACs (Gherkin)
Context: A database record from the freight inquiry system is being processed
GIVEN
A database record from the freight inquiry system is being processed
Applied to: Check Record Type at Position 1-8
WHEN
The system reads positions 1-8 of the record
THEN
If the record type equals 'T/C XREF' then process as container cross-reference record, otherwise skip to next record
Context: A valid container cross-reference record has been identified
GIVEN
A valid container cross-reference record has been identified
Applied to: Extract Container ID from Position 28-39
WHEN
The system processes the record for container information
THEN
Extract the container ID from positions 28-39 of the record and store it in the container work table
Context: A container ID has been successfully extracted from the record
GIVEN
A container ID has been successfully extracted from the record
Applied to: Extract Associated Waybill Information
WHEN
The system processes waybill reference information
THEN
Extract railroad number from positions 10-12, station number from positions 14-19, and waybill number from positions 21-26
Context: Waybill information has been extracted from the database record
GIVEN
Waybill information has been extracted from the database record
Applied to: Replace Spaces with Zeroes in Waybill
WHEN
The waybill number contains space characters
THEN
Replace all space characters with zeroes in the waybill number to ensure consistent numeric format
Context: A container has been successfully processed and stored
GIVEN
A container has been successfully processed and stored
Applied to: Increment Container Counter
WHEN
The system updates the container tracking counter
THEN
Increment the container counter by 1 and ensure it does not exceed the maximum limit of 30 containers
Context: Container processing has been completed for all available records
GIVEN
Container processing has been completed for all available records
Applied to: Mark Container as Invalid
WHEN
The system evaluates the container processing results
THEN
If no valid containers were found or the first container ID is spaces or low-values, then set container status to not found, otherwise set container status to found and mark as IQ container type
R-GCX003-cbl-01823 (+14) File: GCX003.cbl E[Call Waybill Retrieval System] Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'E[Call Waybill Retrieval System]':
  • Context - a waybill retrieval request is initiated for an equipment id:
    For First Call or Different Equipment ID?:
    When the system checks if this is the first call to fwcarget or if the current equipment id differs from the previously held equipment id, then the system proceeds with parameter initialization if it's a first call or new equipment id, otherwise skips to exit.
  • Context - waybill retrieval parameters need to be configured:
    For Set Retrieval Criteria:
    When the system initializes fwcarget parameters, then the system sets retrieval criteria to include all waybill types except 98-99, all status types, exclude edi incomplete waybills, include temporary waybills, exclude corrector waybills, return lead waybill, and get latest waybill date.
  • Context - equipment id is available for waybill lookup:
    For Set Equipment ID for Retrieval:
    When the system prepares for waybill retrieval, then the system assigns the equipment id to the carget-car-id parameter.
  • Context - fwcarget parameters are properly configured with equipment id and retrieval criteria:
    For Call FWCARGET Module:
    When the system needs to retrieve waybill information, then the system calls the fwcarget module and processes the return status.
  • Context - fwcarget module has been executed:
    For Waybill Found?:
    When the system checks the return status from waybill retrieval, then the system determines if a waybill was found or if an error occurred, and routes processing accordingly.
  • Context - a waybill has been successfully retrieved:
    For Has Haulage Right Carrier?:
    When the system examines the haulage right carrier field in the waybill, then if haulage right carrier is spaces, the system continues retrieval loop; otherwise proceeds to edi completion check.
  • Context - a waybill with haulage right carrier has been retrieved:
    For EDI Completion Status = 'Y'?:
    When the system checks the edi completion release status, then if edi completion release equals 'y', the system accepts the waybill; otherwise continues with duplicate key checking.
  • Context - a waybill with incomplete edi status has been retrieved:
    For Same Waybill Key as Previous?:
    When the system compares the current fwbx key feedback with the previously stored key, then if the keys match, the system marks as not found to exit the loop; otherwise updates the stored key and continues.
  • Context - current waybill key differs from previous key and edi is not complete:
    For Set Previous Waybill Date Status:
    When the system needs to retrieve an earlier waybill version, then the system sets carget to previous status waybill date mode.
  • Context - a new waybill key has been encountered:
    For Update Waybill Key Feedback:
    When the system processes waybill retrieval results, then the system stores the current fwbx key feedback for comparison in the next iteration.
  • Context - the current waybill key matches the previously processed key:
    For Mark as Not Found:
    When the system detects a potential infinite loop condition, then the system sets carget-not-found status to exit the retrieval loop.
  • Context - fwcarget module execution has completed:
    For Waybill Retrieval Error?:
    When the system evaluates the return status from waybill retrieval, then if carget-error is true, the system sets error status; otherwise checks for not found condition.
  • Context - an error has been detected in waybill retrieval:
    For Set Error Status:
    When the system processes the error condition, then the system moves the carget return flag to the waybill indicator status.
  • Context - no error occurred in waybill retrieval:
    For Check if Waybill Not Found:
    When the system checks the waybill retrieval results, then the system moves the carget return flag to waybill indicator and proceeds to inquiry fallback if waybill not found.
  • Context - primary waybill retrieval did not find a waybill:
    For Call Inquiry System Fallback:
    When the system needs to attempt alternative retrieval methods, then the system performs inquiry system fallback retrieval process.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill retrieval request is initiated for an equipment ID
GIVEN
A waybill retrieval request is initiated for an equipment ID
Applied to: First Call or Different Equipment ID?
WHEN
The system checks if this is the first call to FWCARGET or if the current equipment ID differs from the previously held equipment ID
THEN
The system proceeds with parameter initialization if it's a first call or new equipment ID, otherwise skips to exit
Context: Waybill retrieval parameters need to be configured
GIVEN
Waybill retrieval parameters need to be configured
Applied to: Set Retrieval Criteria
WHEN
The system initializes FWCARGET parameters
THEN
The system sets retrieval criteria to include all waybill types except 98-99, all status types, exclude EDI incomplete waybills, include temporary waybills, exclude corrector waybills, return lead waybill, and get latest waybill date
Context: Equipment ID is available for waybill lookup
GIVEN
Equipment ID is available for waybill lookup
Applied to: Set Equipment ID for Retrieval
WHEN
The system prepares for waybill retrieval
THEN
The system assigns the equipment ID to the CARGET-CAR-ID parameter
Context: FWCARGET parameters are properly configured with equipment ID and retrieval criteria
GIVEN
FWCARGET parameters are properly configured with equipment ID and retrieval criteria
Applied to: Call FWCARGET Module
WHEN
The system needs to retrieve waybill information
THEN
The system calls the FWCARGET module and processes the return status
Context: FWCARGET module has been executed
GIVEN
FWCARGET module has been executed
Applied to: Waybill Found?
WHEN
The system checks the return status from waybill retrieval
THEN
The system determines if a waybill was found or if an error occurred, and routes processing accordingly
Context: A waybill has been successfully retrieved
GIVEN
A waybill has been successfully retrieved
Applied to: Has Haulage Right Carrier?
WHEN
The system examines the haulage right carrier field in the waybill
THEN
If haulage right carrier is spaces, the system continues retrieval loop; otherwise proceeds to EDI completion check
Context: A waybill with haulage right carrier has been retrieved
GIVEN
A waybill with haulage right carrier has been retrieved
Applied to: EDI Completion Status = 'Y'?
WHEN
The system checks the EDI completion release status
THEN
If EDI completion release equals 'Y', the system accepts the waybill; otherwise continues with duplicate key checking
Context: A waybill with incomplete EDI status has been retrieved
GIVEN
A waybill with incomplete EDI status has been retrieved
Applied to: Same Waybill Key as Previous?
WHEN
The system compares the current FWBX key feedback with the previously stored key
THEN
If the keys match, the system marks as not found to exit the loop; otherwise updates the stored key and continues
Context: Current waybill key differs from previous key and EDI is not complete
GIVEN
Current waybill key differs from previous key and EDI is not complete
Applied to: Set Previous Waybill Date Status
WHEN
The system needs to retrieve an earlier waybill version
THEN
The system sets CARGET to previous status waybill date mode
Context: A new waybill key has been encountered
GIVEN
A new waybill key has been encountered
Applied to: Update Waybill Key Feedback
WHEN
The system processes waybill retrieval results
THEN
The system stores the current FWBX key feedback for comparison in the next iteration
Context: The current waybill key matches the previously processed key
GIVEN
The current waybill key matches the previously processed key
Applied to: Mark as Not Found
WHEN
The system detects a potential infinite loop condition
THEN
The system sets CARGET-NOT-FOUND status to exit the retrieval loop
Context: FWCARGET module execution has completed
GIVEN
FWCARGET module execution has completed
Applied to: Waybill Retrieval Error?
WHEN
The system evaluates the return status from waybill retrieval
THEN
If CARGET-ERROR is true, the system sets error status; otherwise checks for not found condition
Context: An error has been detected in waybill retrieval
GIVEN
An error has been detected in waybill retrieval
Applied to: Set Error Status
WHEN
The system processes the error condition
THEN
The system moves the CARGET return flag to the waybill indicator status
Context: No error occurred in waybill retrieval
GIVEN
No error occurred in waybill retrieval
Applied to: Check if Waybill Not Found
WHEN
The system checks the waybill retrieval results
THEN
The system moves the CARGET return flag to waybill indicator and proceeds to inquiry fallback if waybill not found
Context: Primary waybill retrieval did not find a waybill
GIVEN
Primary waybill retrieval did not find a waybill
Applied to: Call Inquiry System Fallback
WHEN
The system needs to attempt alternative retrieval methods
THEN
The system performs inquiry system fallback retrieval process
R-GCX003-cbl-01838 (+5) File: GCX003.cbl G[Extract SCAC Code from Route Info] Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'G[Extract SCAC Code from Route Info]':
  • Context - a waybill contains routing information in rut-info fields:
    For Get Routing Information from Waybill:
    When the system processes the waybill routing data, then the routing information is extracted from the first three rut-info positions and exclamation marks are replaced with spaces for proper parsing.
  • Context - route processing is in progress with a route segment counter:
    For More Route Segments to Process?:
    When the system checks for more route segments to process, then processing continues if route segment counter is 9 or less and route has not been found, otherwise processing stops.
  • Context - route information contains carrier and junction data in structured format:
    For Parse SCAC Code from Route Info:
    When the system parses route segment information, then scac codes are extracted to route scac positions and junction/r260 codes are extracted to corresponding route junction positions.
  • Context - route information contains scac codes and junction information:
    For CSXT/NS to CPRS via DET?:
    When the first route scac is csxt or ns, the second route scac is cprs, and the junction code is det, then the system sets equipment routing classification to 3 for csxt or 4 for ns and marks the route as found.
  • Context - a shipment has an ima code field:
    For Haulage Mark 'HM' Found?:
    When the ima code equals 'hm', then the system sets the equipment routing classification to 2 and marks the route as found.
  • Context - route processing has completed for an equipment item:
    For Set Empty Equipment Indicator:
    When no valid routing pattern has been found, then the system sets the empty equipment indicator to 1 to classify the equipment as having no defined route.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill contains routing information in RUT-INFO fields
GIVEN
A waybill contains routing information in RUT-INFO fields
Applied to: Get Routing Information from Waybill
WHEN
The system processes the waybill routing data
THEN
The routing information is extracted from the first three RUT-INFO positions and exclamation marks are replaced with spaces for proper parsing
Context: Route processing is in progress with a route segment counter
GIVEN
Route processing is in progress with a route segment counter
Applied to: More Route Segments to Process?
WHEN
The system checks for more route segments to process
THEN
Processing continues if route segment counter is 9 or less and route has not been found, otherwise processing stops
Context: Route information contains carrier and junction data in structured format
GIVEN
Route information contains carrier and junction data in structured format
Applied to: Parse SCAC Code from Route Info
WHEN
The system parses route segment information
THEN
SCAC codes are extracted to route SCAC positions and junction/R260 codes are extracted to corresponding route junction positions
Context: Route information contains SCAC codes and junction information
GIVEN
Route information contains SCAC codes and junction information
Applied to: CSXT/NS to CPRS via DET?
WHEN
The first route SCAC is CSXT or NS, the second route SCAC is CPRS, and the junction code is DET
THEN
The system sets equipment routing classification to 3 for CSXT or 4 for NS and marks the route as found
Context: A shipment has an IMA code field
GIVEN
A shipment has an IMA code field
Applied to: Haulage Mark 'HM' Found?
WHEN
The IMA code equals 'HM'
THEN
The system sets the equipment routing classification to 2 and marks the route as found
Context: Route processing has completed for an equipment item
GIVEN
Route processing has completed for an equipment item
Applied to: Set Empty Equipment Indicator
WHEN
No valid routing pattern has been found
THEN
The system sets the empty equipment indicator to 1 to classify the equipment as having no defined route
R-GCX003-cbl-01844 (+3) File: GCX003.cbl C{Is UTF Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'C{Is UTF':
  • Context - a train request is being processed and the report has no errors and the request action is send and the request is not an aei train send:
    For Is UTF-SPEC-MANI = 'S'?:
    When the system checks the user's utf special manifest authorization field, then if utf-spec-mani is not equal to 's', then set the user as not authorized for special manifest processing, otherwise allow the user to proceed with special manifest operations.
  • Context - a train request is being processed for special manifest authorization:
    For Report Has No Errors?:
    When the system evaluates the current report error status, then if the report has no errors, proceed to check request action type, otherwise skip the authorization validation process.
  • Context - a train request is being processed and the report has no errors:
    For Request Action is SEND?:
    When the system evaluates the request action type, then if the request action is send, proceed to check utf special manifest authorization, otherwise skip the authorization validation.
  • Context - a train request is being processed and the report has no errors and the request action is send and the user does not have utf special manifest authorization:
    For AEI Train Send = NO?:
    When the system checks the aei train send status, then if aei train send is no, set the user as not authorized for special manifest, otherwise allow the user to proceed as authorized.
👨‍💻 Technical ACs (Gherkin)
Context: A train request is being processed AND the report has no errors AND the request action is SEND AND the request is not an AEI train send
GIVEN
A train request is being processed AND the report has no errors AND the request action is SEND AND the request is not an AEI train send
Applied to: Is UTF-SPEC-MANI = 'S'?
WHEN
The system checks the user's UTF special manifest authorization field
THEN
If UTF-SPEC-MANI is not equal to 'S', then set the user as not authorized for special manifest processing, otherwise allow the user to proceed with special manifest operations
Context: A train request is being processed for special manifest authorization
GIVEN
A train request is being processed for special manifest authorization
Applied to: Report Has No Errors?
WHEN
The system evaluates the current report error status
THEN
If the report has no errors, proceed to check request action type, otherwise skip the authorization validation process
Context: A train request is being processed AND the report has no errors
GIVEN
A train request is being processed AND the report has no errors
Applied to: Request Action is SEND?
WHEN
The system evaluates the request action type
THEN
If the request action is SEND, proceed to check UTF special manifest authorization, otherwise skip the authorization validation
Context: A train request is being processed AND the report has no errors AND the request action is SEND AND the user does not have UTF special manifest authorization
GIVEN
A train request is being processed AND the report has no errors AND the request action is SEND AND the user does not have UTF special manifest authorization
Applied to: AEI Train Send = NO?
WHEN
The system checks the AEI train send status
THEN
If AEI train send is NO, set the user as not authorized for special manifest, otherwise allow the user to proceed as authorized
R-GCX003-cbl-01848 (+3) File: GCX003.cbl F[Get Next Special Handling Code from Array Position] Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'F[Get Next Special Handling Code from Array Position]':
  • Context - a shipment has commodity data with special handling codes array and residue weight is greater than 0 and equipment is marked as empty:
    For Get Next Special Handling Code from Array Position:
    When the system processes each special handling code in the array up to position 8 and finds a code matching the er threshold code, then the system sets the empty residue found flag to true and continues processing remaining codes in the array.
  • Context - a shipment requires special handling code processing for empty residue detection:
    For Get Next Special Handling Code from Array Position:
    When the system begins processing special handling codes, then the system sets empty residue indicator to 'n' and initializes array position counter sub1 to 1.
  • Context - special handling codes are being processed from an array with maximum 8 positions:
    For Get Next Special Handling Code from Array Position:
    When the system processes array positions and the current position sub1 reaches or exceeds 8, then the system stops processing and exits the special handling code loop.
  • Context - a special handling code has been processed at the current array position:
    For Get Next Special Handling Code from Array Position:
    When the system completes processing the current code regardless of whether it matches er threshold code, then the system increments the array position counter sub1 by 1 to move to the next code.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has commodity data with special handling codes array and residue weight is greater than 0 and equipment is marked as empty
GIVEN
A shipment has commodity data with special handling codes array and residue weight is greater than 0 and equipment is marked as empty
Applied to: Get Next Special Handling Code from Array Position
WHEN
The system processes each special handling code in the array up to position 8 and finds a code matching the ER threshold code
THEN
The system sets the empty residue found flag to true and continues processing remaining codes in the array
Context: A shipment requires special handling code processing for empty residue detection
GIVEN
A shipment requires special handling code processing for empty residue detection
Applied to: Get Next Special Handling Code from Array Position
WHEN
The system begins processing special handling codes
THEN
The system sets empty residue indicator to 'N' and initializes array position counter SUB1 to 1
Context: Special handling codes are being processed from an array with maximum 8 positions
GIVEN
Special handling codes are being processed from an array with maximum 8 positions
Applied to: Get Next Special Handling Code from Array Position
WHEN
The system processes array positions and the current position SUB1 reaches or exceeds 8
THEN
The system stops processing and exits the special handling code loop
Context: A special handling code has been processed at the current array position
GIVEN
A special handling code has been processed at the current array position
Applied to: Get Next Special Handling Code from Array Position
WHEN
The system completes processing the current code regardless of whether it matches ER threshold code
THEN
The system increments the array position counter SUB1 by 1 to move to the next code
R-GCX003-cbl-01852 (+9) File: GCX003.cbl D[Analyze Message Type Indicator] Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'D[Analyze Message Type Indicator]':
  • Context - a report entry at a specific index position:
    For Is Message Line?:
    When the system checks if the entry is classified as a message line, then the system identifies whether the entry contains message content that needs further analysis.
  • Context - a message line entry that has been identified:
    For Is Spawn Message?:
    When the message is classified as a spawn message type, then the system skips the statistical counting process and continues to index increment.
  • Context - a non-spawn message line that requires classification:
    For Classify as Error Message:
    When the message type indicator shows it is an error message, then the system increments the error count by one.
    For Classify as Warning Message:
    When the message type indicator shows it is a warning message, then the system increments the warning count by one.
    For Classify as Information Message:
    When the message type indicator shows it is an information message, then the system increments the information count by one.
  • Context - an error message that has been classified and counted:
    For Check Error Type 43?:
    When the message type indicator equals 43, then the system increments the special error type 43 counter by one.
  • Context - a warning message that has been classified and counted:
    For Check Warning Types 49/52?:
    When the message type indicator equals 49 or 52, then the system increments the dsp count by one.
  • Context - a message has been processed and classified:
    For Add to Report Index:
    When the message processing is complete, then the system increments the report index by one to move to the next entry.
  • Context - the report index has been incremented:
    For Check Report Limit?:
    When the system checks if the maximum report capacity has been reached, then the system determines whether to set an overflow condition or continue normal processing.
  • Context - the report has reached its maximum capacity:
    For Set Overflow Message:
    When an attempt is made to add another entry beyond the limit, then the system sets message type 9 as an overflow indicator.
👨‍💻 Technical ACs (Gherkin)
Context: A report entry at a specific index position
GIVEN
A report entry at a specific index position
Applied to: Is Message Line?
WHEN
The system checks if the entry is classified as a message line
THEN
The system identifies whether the entry contains message content that needs further analysis
Context: A message line entry that has been identified
GIVEN
A message line entry that has been identified
Applied to: Is Spawn Message?
WHEN
The message is classified as a spawn message type
THEN
The system skips the statistical counting process and continues to index increment
Context: A non-spawn message line that requires classification
GIVEN
A non-spawn message line that requires classification
Applied to: Classify as Error Message
WHEN
The message type indicator shows it is an error message
THEN
The system increments the error count by one
Applied to: Classify as Warning Message
WHEN
The message type indicator shows it is a warning message
THEN
The system increments the warning count by one
Applied to: Classify as Information Message
WHEN
The message type indicator shows it is an information message
THEN
The system increments the information count by one
Context: An error message that has been classified and counted
GIVEN
An error message that has been classified and counted
Applied to: Check Error Type 43?
WHEN
The message type indicator equals 43
THEN
The system increments the special error type 43 counter by one
Context: A warning message that has been classified and counted
GIVEN
A warning message that has been classified and counted
Applied to: Check Warning Types 49/52?
WHEN
The message type indicator equals 49 or 52
THEN
The system increments the DSP count by one
Context: A message has been processed and classified
GIVEN
A message has been processed and classified
Applied to: Add to Report Index
WHEN
The message processing is complete
THEN
The system increments the report index by one to move to the next entry
Context: The report index has been incremented
GIVEN
The report index has been incremented
Applied to: Check Report Limit?
WHEN
The system checks if the maximum report capacity has been reached
THEN
The system determines whether to set an overflow condition or continue normal processing
Context: The report has reached its maximum capacity
GIVEN
The report has reached its maximum capacity
Applied to: Set Overflow Message
WHEN
An attempt is made to add another entry beyond the limit
THEN
The system sets message type 9 as an overflow indicator
R-GCX003-cbl-01862 (+8) File: GCX003.cbl I[Call EMCSEND3 for Current Batch] Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'I[Call EMCSEND3 for Current Batch]':
  • Context - an email transmission process is initiated:
    For Initialize Email Parameters:
    When the system prepares email parameters, then from usercode is set to default merlin id, to usercode is set to default merlin id, subject line is cleared, message content is cleared, and item width is set to 080.
  • Context - email message content is being processed with accumulated lines:
    For Check Line Count > 699?:
    When the line count reaches or exceeds 699 lines, then the current batch must be transmitted immediately and a new batch started.
  • Context - email parameters are initialized and message content is prepared:
    For Call EMCSEND3 for Current Batch:
    When the system calls emcsend3 transmission module, then the email is transmitted with from usercode, destination filename, to usercode, copy usercode, subject, keywords, message text, item formatting parameters, and transmission status is returned.
  • Context - emcsend3 email transmission module has been called:
    For Transmission Successful?:
    When the transmission return status is evaluated, then if return status indicates success, continue normal processing; if return status indicates failure, initiate error notification process.
  • Context - an email batch has been successfully transmitted and line count exceeded 699:
    For Clear Message Buffer:
    When the system prepares for the next batch, then message buffer is cleared, continuation header 'continuation of report ....' is added, detail headers are added, and line counter is reset to 3.
  • Context - email transmission has failed:
    For Set Error Recipients:
    When the system handles transmission failure, then to usercode is cleared, error recipient 'aei9999' is set as first recipient, and 'om01247' is set as second recipient.
  • Context - primary email transmission has failed and error recipients are set:
    For Call EMCSEND3 for Error Notification:
    When the system calls emcsend3 for error notification, then error notification email is transmitted to designated error recipients with same message content and formatting parameters.
  • Context - error notification email has been transmitted via emcsend3:
    For Error Notification Successful?:
    When the error notification transmission status is evaluated, then if error notification succeeds, clear message buffer and continue; if error notification fails, trigger system abend with 'send to file of om01247 failed' message.
  • Context - both primary email transmission and error notification transmission have failed:
    For System Abend:
    When the system cannot recover from email transmission failures, then system abends with error message 'send to file of om01247 failed'.
👨‍💻 Technical ACs (Gherkin)
Context: An email transmission process is initiated
GIVEN
An email transmission process is initiated
Applied to: Initialize Email Parameters
WHEN
The system prepares email parameters
THEN
FROM usercode is set to default Merlin ID, TO usercode is set to default Merlin ID, subject line is cleared, message content is cleared, and item width is set to 080
Context: Email message content is being processed with accumulated lines
GIVEN
Email message content is being processed with accumulated lines
Applied to: Check Line Count > 699?
WHEN
The line count reaches or exceeds 699 lines
THEN
The current batch must be transmitted immediately and a new batch started
Context: Email parameters are initialized and message content is prepared
GIVEN
Email parameters are initialized and message content is prepared
Applied to: Call EMCSEND3 for Current Batch
WHEN
The system calls EMCSEND3 transmission module
THEN
The email is transmitted with FROM usercode, destination filename, TO usercode, copy usercode, subject, keywords, message text, item formatting parameters, and transmission status is returned
Context: EMCSEND3 email transmission module has been called
GIVEN
EMCSEND3 email transmission module has been called
Applied to: Transmission Successful?
WHEN
The transmission return status is evaluated
THEN
If return status indicates success, continue normal processing; if return status indicates failure, initiate error notification process
Context: An email batch has been successfully transmitted and line count exceeded 699
GIVEN
An email batch has been successfully transmitted and line count exceeded 699
Applied to: Clear Message Buffer
WHEN
The system prepares for the next batch
THEN
Message buffer is cleared, continuation header 'CONTINUATION OF REPORT ....' is added, detail headers are added, and line counter is reset to 3
Context: Email transmission has failed
GIVEN
Email transmission has failed
Applied to: Set Error Recipients
WHEN
The system handles transmission failure
THEN
TO usercode is cleared, error recipient 'AEI9999' is set as first recipient, and 'OM01247' is set as second recipient
Context: Primary email transmission has failed and error recipients are set
GIVEN
Primary email transmission has failed and error recipients are set
Applied to: Call EMCSEND3 for Error Notification
WHEN
The system calls EMCSEND3 for error notification
THEN
Error notification email is transmitted to designated error recipients with same message content and formatting parameters
Context: Error notification email has been transmitted via EMCSEND3
GIVEN
Error notification email has been transmitted via EMCSEND3
Applied to: Error Notification Successful?
WHEN
The error notification transmission status is evaluated
THEN
If error notification succeeds, clear message buffer and continue; if error notification fails, trigger system abend with 'SEND TO FILE OF OM01247 FAILED' message
Context: Both primary email transmission and error notification transmission have failed
GIVEN
Both primary email transmission and error notification transmission have failed
Applied to: System Abend
WHEN
The system cannot recover from email transmission failures
THEN
System abends with error message 'SEND TO FILE OF OM01247 FAILED'
R-GCX003-cbl-01871 (+6) File: GCX003.cbl E{Message Severity Classification} Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'E{Message Severity Classification}':
  • Context - a report line is being processed for message classification:
    For Is Message Line?:
    When the report line is not identified as a message line, then the system skips message classification and continues processing without incrementing any counters.
  • Context - a message line is being processed for severity classification:
    For Is Spawn Message?:
    When the message is identified as a spawn message, then the system skips severity classification and continues processing without incrementing any counters.
  • Context - a non-spawn message line is being processed for severity classification:
    For Error Message?:
    When the message is classified as an error message, then the system increments the error counter by 1.
  • Context - an error message is being processed:
    For Type 43 Error?:
    When the error message type indicator equals 43, then the system increments the type 43 error counter by 1.
  • Context - a non-spawn, non-error message line is being processed for severity classification:
    For Warning Message?:
    When the message is classified as a warning message, then the system increments the warning counter by 1.
  • Context - a warning message is being processed:
    For DSP Message Type 49 or 52?:
    When the message type indicator equals 49 or 52, then the system increments the dsp counter by 1.
  • Context - a non-spawn, non-error, non-warning message line is being processed for severity classification:
    For Information Message?:
    When the message is classified as an information message, then the system increments the information counter by 1.
👨‍💻 Technical ACs (Gherkin)
Context: A report line is being processed for message classification
GIVEN
A report line is being processed for message classification
Applied to: Is Message Line?
WHEN
The report line is not identified as a message line
THEN
The system skips message classification and continues processing without incrementing any counters
Context: A message line is being processed for severity classification
GIVEN
A message line is being processed for severity classification
Applied to: Is Spawn Message?
WHEN
The message is identified as a spawn message
THEN
The system skips severity classification and continues processing without incrementing any counters
Context: A non-spawn message line is being processed for severity classification
GIVEN
A non-spawn message line is being processed for severity classification
Applied to: Error Message?
WHEN
The message is classified as an error message
THEN
The system increments the error counter by 1
Context: An error message is being processed
GIVEN
An error message is being processed
Applied to: Type 43 Error?
WHEN
The error message type indicator equals 43
THEN
The system increments the Type 43 error counter by 1
Context: A non-spawn, non-error message line is being processed for severity classification
GIVEN
A non-spawn, non-error message line is being processed for severity classification
Applied to: Warning Message?
WHEN
The message is classified as a warning message
THEN
The system increments the warning counter by 1
Context: A warning message is being processed
GIVEN
A warning message is being processed
Applied to: DSP Message Type 49 or 52?
WHEN
The message type indicator equals 49 or 52
THEN
The system increments the DSP counter by 1
Context: A non-spawn, non-error, non-warning message line is being processed for severity classification
GIVEN
A non-spawn, non-error, non-warning message line is being processed for severity classification
Applied to: Information Message?
WHEN
The message is classified as an information message
THEN
The system increments the information counter by 1
R-GCX003-cbl-01878 (+13) File: GCX003.cbl J{Validate Error Count Accumulation} Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'J{Validate Error Count Accumulation}':
  • Context - a report line exists at a specific index position:
    For Message Line Type?:
    When the system evaluates the report line type, then the system identifies whether the line is a message line requiring error count processing or a non-message line to be skipped.
  • Context - a message line has been identified for processing:
    For Spawn Message?:
    When the system checks if the message is a spawn message type, then spawn messages are excluded from error counting while non-spawn messages proceed to error type classification.
  • Context - a non-spawn message line requires processing:
    For Error Type Classification:
    When the system evaluates the message type indicator, then messages are classified as errors (increment error counter), warnings (increment warning counter), or information (increment info counter).
  • Context - a message has been classified as an error type:
    For Increment Error Counter:
    When the system processes the error message, then the report error counter is incremented by one.
  • Context - an error message has been processed and error counter incremented:
    For Check Error Type 43:
    When the system checks if the message type indicator equals 43, then type 43 errors increment a special type 43 counter in addition to the general error counter.
  • Context - an error message has been identified as type 43:
    For Increment Type 43 Counter:
    When the system processes the type 43 error, then the err-43-cnt counter is incremented by one.
  • Context - a message has been classified as a warning type:
    For Increment Warning Counter:
    When the system processes the warning message, then the report warning counter is incremented by one.
  • Context - a warning message has been processed and warning counter incremented:
    For Warning Type 49 or 52?:
    When the system checks if the message type indicator is 49 or 52, then warning types 49 and 52 additionally increment the dsp counter by one.
  • Context - a warning message has been identified as type 49 or 52:
    For Increment DSP Counter:
    When the system processes the special warning type, then the rpt-dsp-cnt counter is incremented by one.
  • Context - a message has been classified as an information type:
    For Increment Info Counter:
    When the system processes the information message, then the report information counter is incremented by one.
  • Context - error counting is complete and type 43 error count exists:
    For Error Type 43 Count Check:
    When the system compares the total error count with the type 43 error count, then if error count equals type 43 count, processing continues normally; otherwise excess type 43 errors are converted to warnings with appropriate counter adjustments.
  • Context - type 43 error count validation has identified a count mismatch:
    For Convert Error to Warning:
    When the system processes the count correction, then excess type 43 error messages are converted to warning type 18 messages.
  • Context - type 43 errors are being converted to warnings:
    For Adjust Error Counter:
    When the system adjusts the error count, then the report error counter is decremented by one for each converted error.
  • Context - type 43 errors are being converted to warnings and error counter has been decremented:
    For Adjust Warning Counter:
    When the system adjusts the warning count, then the report warning counter is incremented by one for each converted error.
👨‍💻 Technical ACs (Gherkin)
Context: A report line exists at a specific index position
GIVEN
A report line exists at a specific index position
Applied to: Message Line Type?
WHEN
The system evaluates the report line type
THEN
The system identifies whether the line is a message line requiring error count processing or a non-message line to be skipped
Context: A message line has been identified for processing
GIVEN
A message line has been identified for processing
Applied to: Spawn Message?
WHEN
The system checks if the message is a spawn message type
THEN
Spawn messages are excluded from error counting while non-spawn messages proceed to error type classification
Context: A non-spawn message line requires processing
GIVEN
A non-spawn message line requires processing
Applied to: Error Type Classification
WHEN
The system evaluates the message type indicator
THEN
Messages are classified as errors (increment error counter), warnings (increment warning counter), or information (increment info counter)
Context: A message has been classified as an error type
GIVEN
A message has been classified as an error type
Applied to: Increment Error Counter
WHEN
The system processes the error message
THEN
The report error counter is incremented by one
Context: An error message has been processed and error counter incremented
GIVEN
An error message has been processed and error counter incremented
Applied to: Check Error Type 43
WHEN
The system checks if the message type indicator equals 43
THEN
Type 43 errors increment a special Type 43 counter in addition to the general error counter
Context: An error message has been identified as Type 43
GIVEN
An error message has been identified as Type 43
Applied to: Increment Type 43 Counter
WHEN
The system processes the Type 43 error
THEN
The ERR-43-CNT counter is incremented by one
Context: A message has been classified as a warning type
GIVEN
A message has been classified as a warning type
Applied to: Increment Warning Counter
WHEN
The system processes the warning message
THEN
The report warning counter is incremented by one
Context: A warning message has been processed and warning counter incremented
GIVEN
A warning message has been processed and warning counter incremented
Applied to: Warning Type 49 or 52?
WHEN
The system checks if the message type indicator is 49 or 52
THEN
Warning types 49 and 52 additionally increment the DSP counter by one
Context: A warning message has been identified as type 49 or 52
GIVEN
A warning message has been identified as type 49 or 52
Applied to: Increment DSP Counter
WHEN
The system processes the special warning type
THEN
The RPT-DSP-CNT counter is incremented by one
Context: A message has been classified as an information type
GIVEN
A message has been classified as an information type
Applied to: Increment Info Counter
WHEN
The system processes the information message
THEN
The report information counter is incremented by one
Context: Error counting is complete and Type 43 error count exists
GIVEN
Error counting is complete and Type 43 error count exists
Applied to: Error Type 43 Count Check
WHEN
The system compares the total error count with the Type 43 error count
THEN
If error count equals Type 43 count, processing continues normally; otherwise excess Type 43 errors are converted to warnings with appropriate counter adjustments
Context: Type 43 error count validation has identified a count mismatch
GIVEN
Type 43 error count validation has identified a count mismatch
Applied to: Convert Error to Warning
WHEN
The system processes the count correction
THEN
Excess Type 43 error messages are converted to warning type 18 messages
Context: Type 43 errors are being converted to warnings
GIVEN
Type 43 errors are being converted to warnings
Applied to: Adjust Error Counter
WHEN
The system adjusts the error count
THEN
The report error counter is decremented by one for each converted error
Context: Type 43 errors are being converted to warnings and error counter has been decremented
GIVEN
Type 43 errors are being converted to warnings and error counter has been decremented
Applied to: Adjust Warning Counter
WHEN
The system adjusts the warning count
THEN
The report warning counter is incremented by one for each converted error