🚀 Synthesized 21 highly-detailed Agile User Stories covering 21 EDI-active COBOL programs in CA Train.
🔍

Module: GCCADDCD 1 Consolidated Epic Story

Epic: GCCADDCD Complete EDI Specification Extracted from Legacy
Contains 225 distinct extracted legacy rules
EDI Epic Specification
As an EDI Gateway Service,
I want to orchestrate and execute all GCCADDCD EDI data mapping and validation logic,
So that I can ensure strict compliance with US Customs (P140) automated payload constraints in a single consolidated service.
Prerequisites & Setup
  • [Initialize Root Segment]
    Root segment structure needs initialization → The EMTZ-ROOT-SEGMENT should be initialized to default state
  • [Initialize FWCARGET Parameters]
    The system initializes FWCARGET parameters → All search criteria are set to include all waybill types except 98-99, all status types, exclude EDI incomplete records, include temporary waybills, exclude corrector waybills, return lead waybills, and use latest waybill date
  • [Initialize GCSCCRT Segment]
    The retrieve next cargo process begins → The GCSCCRT cargo record segment is initialized to clear any previous data
  • [Initialize GCX101 Input Structure]
    The message structure is being set up → The GCX101 input structure for the current index must be initialized to clear any previous data
  • [Initialize GCX101 Input Structure]
    Message preparation begins → The GCX101 input structure for the current index is initialized to clear any existing data
  • [Initialize Message Input Structure]
    The system initializes the message input structure → The system clears all fields in the message input structure for the current message index
  • [Initialize GCX101 Input Structure]
    The message structure needs to be prepared → The GCX101 input structure for the current index is initialized to clear any existing data
  • [Initialize GCX101 Input Structure]
    The system prepares the message structure → The GCX101 input structure is initialized to clear any previous data
  • [Call CIMS to Initialize Message]
    The system needs to establish communication with customs → The system calls CIMS with CHNG function and ALT-PCB to initialize the message channel
  • [Initialize Message Structure]
    The message processing system has been initialized → The WRITMSGL utility must be called with the message code, message content, message length, and module name to transmit the message to external customs systems
  • [Initialize Return Status Flag]
    The system prepares for MERLIN communication → The EMI return status flag is initialized to clear any previous status
Core Acceptance Criteria
  • [8:Build Report Detail Lines]
    Waybill is not found:
    • no cargo is found
    • detour manifest is required but not found
    → Build report with appropriate detail and message lines
  • [19:Retrieve Container from Flat Car]
    Container is not found → Use root key to retrieve flat car container relationship, then retrieve container equipment, otherwise retrieve container equipment directly. If flat car relationship exists without container equipment, generate system error. If no flat car relationship exists, set message eleven and increment report index
  • [21:Finalize Report Processing]
    No errors exist in report AND spawn processing is required → Process all pre-spawn entries and set error count to spawn count, otherwise when errors exist AND spawn processing is required, convert message twenty-eight to message nineteen and increment error count
  • [22:Spawn Customs Messages]
    Spawn processing is executed → Move input record to customs message, call customs interface system, write message to customs queue, and purge customs interface
  • [24:Send Report to Customs]
    Report transmission is initiated → Set customs user codes, set destination filename to 'REQUEST', populate subject with user ID and train information and timestamp, call email send service with report table, and purge interface system
  • [25:Determine Return Status]
    Information message count is greater than zero → Set status to no waybill, otherwise when error message count is greater than zero, set status to errors and send report to customs, otherwise set status to OK and return report table
  • [Call FWCARGET Module for Car Data]
    The system invokes FWCARGET module with parameters set to include all types except 98-99, all statuses, exclude EDI incomplete, include temporary waybills, exclude corrector waybills, return lead waybills, and get latest waybill date → The module returns waybill information in SHIPROOT segment for the specified car
  • [Retrieve Waybill by Root Key]
    The system calls FWCWBIO service with SHIPROOT segment type, equal operator, and container equipment key → The waybill information is retrieved and stored in SHIPROOT segment
  • [Check for Multiple Waybill Versions]
    The system checks if there are multiple waybill versions by evaluating haulage right carrier, EDI completion status, and feedback key → Continue processing until a valid waybill is found or no more versions exist
  • [More Waybill Versions?]
    If CARGET-ERROR or CARGET-NOT-FOUND is true, or if HAULAGE-RIGHT-CARRIER is spaces, or if EDI-COMP-418-RELEASE equals 'Y', or if CARGET-FWBX-KEY-FEEDBACK matches previous feedback key → Stop processing if any termination condition is met, otherwise continue with previous status waybill date and update feedback key
  • [Select Latest Valid Waybill]
    The system processes each version and finds one with valid haulage right carrier, completed EDI release, and unique feedback key → Set the processing flag to previous status waybill date and store the feedback key for comparison
  • [Set Previous Status Date]
    The system prepares for the next search iteration → Previous status waybill date flag is set and the current FWBX key feedback is stored for duplicate detection
  • [Set Search Parameters for All Waybill Types]
    The system initializes waybill search parameters → Search parameters are set to include all waybill types except 98-99, exclude EDI incomplete waybills, include temporary waybills, exclude corrector waybills, include returned lead waybills, and search for latest waybill date
  • [Same as Previous Version?]
    The system compares the current waybill feedback key with the previous version → If the feedback keys match, mark as not found and stop processing, otherwise continue to search previous versions
  • [Set to Search Previous Version]
    The system needs to search for previous waybill versions → Search parameters are updated to previous status waybill date and feedback key is stored for comparison
  • [Accept Current Waybill Version]
    The system completes waybill validation → The current waybill version is accepted and version checking process ends
  • [Call Z320-GN-CCRT-SEG to Get Next Cargo Record]
    The system needs to get the next cargo record → The Z320-GN-CCRT-SEG routine is called to retrieve the next cargo record from the Canadian Customs Cargo Records database
  • [Generate Message 27: Detour Manifest Missing]
    If error message generation conditions → Generate message 27 indicating detour manifest is missing AND include the detour CCN key in the error message
  • [Generate Message 28: Transit Code Mismatch - Return]
    If Canadian border crossing transit code conditions → Generate message 28 indicating transit code mismatch AND prepare GCT1011E change message for border crossing processing
  • [Generate Message 28: Transit Code Mismatch - Outbound]
    If Canadian border crossing transit code conditions → Generate message 28 indicating transit code mismatch AND prepare GCT1011E diversion message for border crossing processing
  • [Prepare GCT1011E Change Message]
    The system prepares border crossing messages → Set spawn flag to true AND increment pre-spawn index AND initialize GCX101 input structure AND set security byte to high values AND move cargo CCN key to message AND set Canadian flag to true AND set change flag to true AND move train crossing name and port to message
  • [Prepare GCT1011E Diversion Message]
    The system prepares border crossing messages → Set spawn flag to true AND increment pre-spawn index AND initialize GCX101 input structure AND set security byte to high values AND move cargo CCN key to message AND set Canadian flag to true AND set diversion flag to true AND move train crossing name and port to message
  • [Prepare GCT1011E Change Message for Customs]
    Error message 28 is set for the mismatch → Prepare GCT1011E message with change flag, Canadian flag, CCN key, border name, and border code for customs processing
  • [Prepare GCT1011E Diversion Message for Customs]
    Error message 28 is set for the mismatch → Prepare GCT1011E message with diversion flag, Canadian flag, CCN key, border name, and border code for customs processing
  • [Set GCX101 Spawned Flag to True]
    The system begins preparing the GCT1011E change message → The GCX101 spawned flag must be set to true to enable message generation
  • [Increment Pre-Spawn Index Counter]
    The message preparation process begins → The pre-spawn index counter must be incremented by 1 to track this message
  • [Set Security Byte to High Values]
    Security settings are being configured → The security byte must be set to high values to indicate maximum security level
  • [Move CCN Key to Message]
    The change message is being populated → The cargo's CCN key must be moved to the message CCN field
  • [Set Canadian Flag to True]
    Message classification is being set → The Canadian flag must be set to true to identify this as a Canadian border crossing message
  • [Set Change Message Type Flag]
    Message type classification is being set → The change flag must be set to true to identify this as a change message type
  • [Move Train Crossing Name to Border Name]
    Location details are being populated → The train crossing name must be moved to the border name field in the message
  • [Move Train Crossing Port to Border Code]
    Port identification is being populated → The train crossing port code must be moved to the border code field in the message
  • [Set GCX101 Spawned Flag to True]
    The diversion message preparation process begins → The GCX101 spawned flag is set to true to indicate message processing has started
  • [Increment Pre-Spawn Index Counter]
    The message preparation process starts → The pre-spawn index counter is incremented by 1 to track the new message
  • [Set Security Byte to High Values]
    Security settings are configured → The security byte in the GCX101 input structure is set to high values for maximum security clearance
  • [Move CCN Key to Message]
    The diversion message is being populated → The CCN key from the cargo record is moved to the GCX101 CCN field in the message
  • [Set Canadian Flag to True]
    Message routing flags are set → The Canadian flag in the GCX101 input structure is set to true
  • [Set Diversion Flag to True]
    Message type classification is performed → The diversion flag in the GCX101 input structure is set to true
  • [Move Train Crossing Name to Border Name]
    Border location information is populated in the message → The train crossing name is moved to the border name field in the GCX101 input structure
  • [Move Train Crossing Port to Border Code]
    Border processing information is populated in the message → The train crossing port code is moved to the border code field in the GCX101 input structure
  • [Waybill Found?]
    System checks the waybill indicator status → If waybill found, set waybill found status, otherwise proceed to generate no waybill messages
  • [Equipment is Container?]
    System checks if the equipment is a container → If container, generate container-specific message, otherwise generate car-specific message
  • [Generate Message: No Waybill for Container]
    System generates error messages for missing waybill → System sets message type 10 indicating no waybill found for container
  • [Generate Message: No Waybill for Car]
    System generates error messages for missing waybill → System sets message type 12 indicating no waybill found for car
  • [Generate Message: No Cargo Found for Loaded Equipment]
    System validates cargo consistency for loaded equipment → System sets message type 15 with waybill root key and date information
  • [Set Message Seventeen - Cargo Already Attached]
    The system processes the train attachment validation → Set message seventeen flag to true for the current report index to indicate cargo is already attached to another train
  • [Prepare GCT1011E Change Message]
    Error message 28 is triggered → Prepare GCT1011E message with change type, Canadian flag, CCN, border name and port for customs processing
  • [Prepare GCT1011E Diversion Message]
    Error message 28 is triggered → Prepare GCT1011E message with diversion type, Canadian flag, CCN, border name and port for customs processing
  • [Manifest TO Transit Code ≠ Train Crossing Port?]
    The system compares the manifest TO transit code with the train crossing port code → The system prepares a change message if the codes are different, otherwise checks outbound manifest codes
  • [Manifest FROM Transit Code ≠ Train Crossing Port?]
    The system compares the manifest FROM transit code with the train crossing port code → The system prepares a diversion message if the codes are different, otherwise completes processing without border crossing messages
  • [Build Change Message for GCT1011E]
    The system builds a GCT1011E change message → The system sets spawned flag, increments counter, initializes message structure, sets security level, copies CCN key, sets Canadian flag, sets change message type, and copies border crossing details
  • [Build Diversion Message for GCT1011E]
    The system builds a GCT1011E diversion message → The system sets spawned flag, increments counter, initializes message structure, sets security level, copies CCN key, sets Canadian flag, sets diversion message type, and copies border crossing details
  • [Set Message as Spawned]
    The system begins message preparation → The system sets the spawned status flag to indicate messages are being prepared
  • [Set Security Level to High Values]
    The system sets the security level for the message → The system assigns high values to the security byte field to indicate maximum security clearance required
  • [Copy CCN Key to Message]
    The system copies cargo identification data → The system moves the CCN key from the cargo record to the message CCN field
  • [Set Canadian Flag]
    The system sets processing flags for the message → The system sets the Canadian flag to indicate this message requires Canadian customs processing
  • [Set Change Message Type]
    The system sets the message type for change processing → The system sets the change flag to indicate this is a destination change message
  • [Set Diversion Message Type]
    The system sets the message type for diversion processing → The system sets the diversion flag to indicate this is an origin diversion message
  • [Copy Border Crossing Name]
    The system copies border crossing identification data → The system moves the train crossing name to the message border name field
  • [Copy Border Crossing Port Code]
    The system completes location identification data → The system moves the train crossing port code to the message border code field
  • [Increment Message Counter]
    The system finalizes message preparation → The system increments the pre-spawn message counter by 1 to track the total number of messages prepared
  • [Set GCX101 Spawned Flag to True]
    The system begins building the change message → The GCX101 spawned flag is set to true to indicate message processing is active
  • [Increment Pre-Spawn Index Counter]
    The message building process starts → The pre-spawn index counter is incremented by 1 to track the new message
  • [Set Security Byte to High Values]
    Security level needs to be assigned to the message → The security byte is set to high values to indicate maximum security level
  • [Move CCN Key to Message]
    The cargo identification needs to be included in the message → The CCN key from the cargo record is moved to the GCX101 message structure
  • [Set Canadian Flag to True]
    The message destination needs to be specified → The Canadian flag in the message is set to true
  • [Set Change Message Type Flag]
    The message type needs to be specified → The change flag in the GCX101 message is set to true
  • [Move Train Crossing Name to Border Name]
    Location identification needs to be included in the message → The train crossing name is moved to the border name field in the message
  • [Move Train Crossing Port to Border Code]
    Port identification needs to be included in the message → The train crossing port code is moved to the border code field in the message
  • [Set GCX101 Spawned Flag to True]
    The system begins building a diversion message → The GCX101 spawned flag is set to true to indicate message processing is active
  • [Increment Pre-Spawn Index Counter]
    The system needs to track multiple diversion messages → The pre-spawn index counter is incremented by 1
  • [Set Security Byte to High Values]
    Security level needs to be assigned to the message → The security byte is set to high values to ensure maximum security clearance
  • [Move CCN Key to Message]
    The diversion message is being populated with cargo information → The CCN key is moved to the diversion message structure
  • [Set Message Type to Canadian]
    The message type needs to be specified → The message type is set to Canadian to indicate Canadian border processing
  • [Set Message Type to Diversion]
    The specific message category is being assigned → The message type is set to diversion to indicate route change processing
  • [Move Train Crossing Name to Border Name]
    The border name field needs to be populated → The train crossing name is moved to the border name field in the message
  • [Move Train Crossing Port to Border Code]
    The border code field needs to be populated → The train crossing port code is moved to the border code field in the message
  • [Retrieve FWSWRWR Segment]
    The system queries the FWSWRWR database segment → Retrieve the waybill relationship record that links flat cars to containers
  • [Get FWSWREQ Segment for Container Details]
    The system queries the FWSWREQ database segment → Retrieve the container equipment record containing detailed container information
  • [Set Container Not Found Message]
    No container relationship is found for the given root key → Set message eleven indicating container relationship not found and add to report
  • [Is this a Message Line?]
    The system checks if the line contains a message → The system identifies whether this is a message line requiring categorization
  • [Type 28 Message?]
    The message type indicator equals 28 → The system routes this message for pre-spawn count processing instead of regular error count
  • [Add 1 to Pre-Spawn Count]
    The system processes the special message type → The pre-spawn count is incremented by 1
  • [Warning Message?]
    The system checks the message warning indicator → The system determines if this is a warning message requiring warning processing
  • [Informational Message?]
    The system checks the message informational indicator → The system determines if this is an informational message requiring info processing
  • [Add 1 to Info Count]
    The system processes the informational message → The information count is incremented by 1
  • [Request Message?]
    The system checks if the message has a request indicator → The system determines if this message requires request error count processing
  • [Increment Report Index]
    The system advances to the next report line → The report index is incremented by 1
  • [Set Maximum Reached Message]
    The system needs to indicate capacity exceeded → Message type 9 is set for the current report line
  • [Any Messages to Spawn?]
    The system checks for messages requiring spawn processing → If pre-spawn messages exist, process each spawn message, otherwise complete report processing
  • [Process Each Spawn Message]
    The system processes spawn messages → Each pre-spawn input is moved to the processing structure and spawn processing is performed
  • [Send GCT1011E Message to Customs]
    The system processes the spawn message → The GCT1011E message is sent to customs via CIMS and WRITMSGL calls
  • [Any Messages to Spawn?]
    The system checks for spawn processing requirements → If pre-spawn messages exist, review each report line for message type conversion, otherwise complete report processing
  • [Review Each Report Line]
    The system reviews report lines → Each report line from 1 to last line is examined for message type indicators
  • [Is Message Type 28?]
    The system checks the message type indicator → If message type is 28, convert to message type 19 and increment error count, otherwise continue to next line
  • [Convert to Message Type 19]
    The system processes the message conversion → Message type 28 is converted to message type 19
  • [Check Report Status]
    The system checks if there are any errors in the report → The system determines whether to proceed with spawning customs messages or convert error messages
  • [Pre-spawn Messages Exist?]
    The system checks if PRE-NO-SPAWN condition is false → If pre-spawn messages exist, process them for customs notification, otherwise complete spawn process
  • [Loop Through Pre-spawn Messages]
    The system processes messages from index 1 to PRE-IDX → Each message in the queue is processed sequentially for customs notification
  • [Prepare GCT1011E Message Structure]
    The system moves WS-GCX101-INPUT data to GCX101-INPUT structure → The message structure is prepared for customs system processing
  • [Send Message to Customs via CIMS]
    The system calls CIMS with CHNG function and ALT-PCB → The message is sent to the customs system for processing
  • [Write Message Log Entry]
    The system calls WRITMSGL with message details → The message transmission is logged with message code, content, length and module name
  • [Purge Message Queue]
    The system calls CIMS with PURG function → The message queue is purged to prepare for next message
  • [More Messages to Send?]
    The system checks if SPN-IDX is less than or equal to PRE-IDX → If more messages exist, continue processing, otherwise proceed to update error count
  • [Prepare GCT1011E Message Structure]
    The system needs to send a message to customs → The system moves the prepared input data to the GCT1011E message structure
  • [Clear Accept Status]
    The system prepares to initialize communication → The system clears the accept status to ensure clean communication channel
  • [Call WRITMSGL to Write Message]
    The system needs to transmit the message to customs → The system calls WRITMSGL with message code, content, length and module name to write the message to customs queue
  • [Call CIMS to Purge Message Queue]
    The message transmission is complete → The system calls CIMS with PURG function to purge the communication channel and clean up resources
  • [Move GCX101 Input Data to GCT1011E Message]
    The system needs to notify customs of cargo status changes → The GCX101 input data must be moved to the GCT1011E message structure to prepare for customs transmission
  • [Clear Accept Status]
    The message initialization process begins → The accept status field must be cleared to spaces to indicate a fresh transaction state
  • [Call CIMS with CHNG Function]
    The message has been prepared and status cleared → The CIMS system must be called with CHNG function, communication control block, and alternate PCB to initiate message processing
  • [Message Ready for Processing]
    The message transmission is complete → The CIMS system must be called with PURG function and alternate PCB to purge the message transaction and release system resources
  • [Move GCX101-INPUT to GCT1011E-MSG]
    The system needs to format the message for transmission → The GCX101 input data should be moved to the GCT1011E message structure
  • [Clear Accept Status]
    The system prepares to send the message → The accept status should be cleared to spaces to initialize communication state
  • [Call CIMS with CHNG Function]
    The system initiates message processing → A CIMS change transaction should be started using the alternate PCB
  • [Call WRITMSGL to Write Message]
    The system needs to transmit the message to customs → The WRITMSGL service should be called with message code, message text, message length, and module name
  • [Call CIMS with PURG Function]
    The message processing is complete → A CIMS purge transaction should be executed to commit the message
  • [Are there messages to spawn?]
    The system checks for available pre-spawn messages → The system determines whether to proceed with message conversion logic based on spawn message availability
  • [Loop through all report lines]
    The system processes each report line sequentially → Each report line is evaluated for message type conversion requirements
  • [Convert message type 28 to message type 19 Warning]
    The system performs error message conversion during error handling → The message type 28 is converted to message type 19 warning status
  • [Set MERLIN Message Parameters]
    The system prepares MERLIN message parameters → The from user code is set to OM01247, to user code is set to OM01247, and destination filename is set to REQUEST
  • [Build Message Subject with Train and Timestamp]
    The system builds the message subject → The subject includes ACF2 user ID, train number, year, month, day, hour, and minute from system timestamp
  • [Call MERLIN Messaging System]
    The system establishes MERLIN connection → CCISCOM utility is called with CCCOM and ISCOM parameters to establish messaging connection
  • [Send Report Table via EMCSEND2]
    The system transmits the report → EMCSEND2 utility is called with from user code, destination filename, to user code, copy user code, subject, keywords, report table, return status flag, segment numbers, and item type parameters
  • [Purge Message Queue]
    The system completes MERLIN communication → ISCCCOM utility is called with ISCOM and CCCOM parameters, accept status is initialized, and CIMS is called with PURG function to purge the alternate PCB message queue
  • [System Abend - Send Failed]
    The system detects transmission failure → The abend message is set to 'SEND TO MERLIN FAILED' and system abend procedure is performed
  • [Get Current User ID from System]
    The system processes the message subject creation → The current ACF2 user ID is extracted from the system control block and assigned to the message subject
  • [Extract Train Number from Input]
    The system builds the message subject → The train number is extracted from the input parameters and assigned to the message subject
  • [Extract Year Component]
    The system processes the date components → The current year is extracted from the system control block and assigned to the message subject
  • [Extract Month Component]
    The system processes the date components → The current month is extracted from the system control block and assigned to the message subject
  • [Extract Day Component]
    The system processes the date components → The current day is extracted from the system control block and assigned to the message subject
  • [Extract Hour Component]
    The system processes the time components → The current hour is extracted from the system control block and assigned to the message subject
  • [Extract Minute Component]
    The system processes the time components → The current minute is extracted from the system control block and assigned to the message subject
  • [Combine Train and Timestamp into Subject]
    The system creates the final message subject → All components are combined into the MERLIN-SUBJECT field for the customs notification message
  • [Extract Year from System Date]
    Preparing to send a report to customs system → The year component from machine date is extracted and stored for message subject formatting
  • [Extract Month from System Date]
    Preparing to send a report to customs system → The month component from machine date is extracted and stored for message subject formatting
  • [Extract Day from System Date]
    Preparing to send a report to customs system → The day component from machine date is extracted and stored for message subject formatting
  • [Extract Hour from System Time]
    Preparing to send a report to customs system → The hour component from machine time is extracted and stored for message subject formatting
  • [Extract Minutes from System Time]
    Preparing to send a report to customs system → The minutes component from machine time is extracted and stored for message subject formatting
  • [Format Time Components for Message Subject]
    Creating the complete message subject for customs notification → All components are formatted into the MERLIN-SUBJECT field for transmission to customs system
  • [Check Information Message Count]
    The system checks if any informational messages were generated during processing → If informational message count is greater than zero, set return status to NO-WAYBILL and terminate processing
  • [Set Return Status to OK]
    The system determines that processing completed without issues → Set return status to OK indicating successful processing
Structural Validations
  • [3:Retrieve Waybill Information]
    Car ID formatting is successful → Use formatted car ID to retrieve shiproot car waybill, otherwise generate invalid car ID error message
  • [11:Generate Error Messages]
    Detour manifest is required AND detour manifest is not found → Set message twenty-seven with detour CCN information
  • [11:Generate Error Messages]
    Waybill is not found AND container is found → Set message ten, otherwise when waybill is not found AND container is not found, set message twelve
  • [11:Generate Error Messages]
    Waybill is found AND no cargo is found AND container is not found AND equipment is not conveying car → Set message fifteen with root key and waybill date
  • [11:Generate Error Messages]
    Cargo status is pending:
    • error
    • reject
    • deleted
    → Set message sixteen, otherwise when user security level is not 'S' AND cargo status is blank OR reject OR error, set message sixteen, otherwise when cargo is linehaul AND status is manual, set message sixteen
  • [11:Generate Error Messages]
    Canadian customs north train ID is not spaces → Set message seventeen
  • [11:Generate Error Messages]
    Cargo is in return transit status AND CCN key starts with '6105E' AND manifest to transport code does not equal train crossing port → Set message twenty-eight and Execute pre-spawn processing for change, otherwise when cargo is not in return transit status AND CCN key starts with '6105E' AND manifest from transport code does not equal train crossing port, set message twenty-eight and Execute pre-spawn processing for diversion
  • [11:Generate Error Messages]
    Pre-spawn processing is initiated → Set spawn status to true, increment pre-index, initialize input record, set security byte to high values, populate CCN key, set Canadian flag, set diversion flag, and populate border name and code from train crossing information
  • [11:Generate Error Messages]
    Pre-spawn processing is initiated → Set spawn status to true, increment pre-index, initialize input record, set security byte to high values, populate CCN key, set Canadian flag, set change flag, and populate border name and code from train crossing information
  • [23:Handle Error Conditions]
    Spawn processing is required → For each report line with message type twenty-eight, convert to message nineteen and increment error count
  • [Retrieve Waybill for Current Equipment]
    Car ID formatting is successful → Use formatted car ID for shiproot car retrieval, otherwise generate invalid car ID error message
  • [Generate Invalid Car ID Error Message]
    The system needs to handle the validation failure → The system moves the error message 'ERR>>>> INVALID CAR ID' to the report line and performs report index addition
  • [Generate Invalid Car ID Error]
    GCCARFM-RC-SUCCESS is not true → Generate error message 'ERR>>>> INVALID CAR ID' in the report line and increment report index
  • [Handle FWCARGET Error]
    FWCARGET returns an error status → The system creates an error message containing FWCARGET parameters and terminates processing
  • [Check Haulage Right Carrier]
    The system checks the haulage right carrier field → If haulage right carrier is empty (spaces), the waybill is accepted; otherwise, additional EDI validation is required
  • [Check EDI Completion Status]
    The system checks the EDI completion status → If EDI completion release flag is 'Y', the waybill is accepted; otherwise, duplicate key validation is performed
  • [Check for Duplicate Key]
    The system compares the current FWBX key feedback with the previously processed key → If the keys match, set waybill as not found to terminate processing; otherwise, continue with previous status date processing
  • [Exclude EDI Incomplete Records]
    The system sets the EDI completeness criteria → Car search excludes records with incomplete EDI data
  • [EDI Complete Release = 'Y'?]
    The system checks the EDI completion release flag → If EDI completion release equals 'Y', the waybill is accepted, otherwise version checking continues
  • [Generate Invalid Car ID Error Message]
    The formatting operation does not return a success status → An error message 'ERR>>>> INVALID CAR ID' is generated and added to the report
  • [Handle Equipment Classification Error]
    The system receives an unsuccessful response from the equipment classification service → The system should create an error message containing the service name and parameters, then Execute system termination procedures
  • [Generate GCCCARTP Failure Error]
    The system processes the failure condition → An error message is constructed with failure details and interface parameters, and system termination is performed
  • [Generate Message 10: Container Without Waybill]
    If waybill validation conditions → Generate message 10 indicating container exists without proper waybill documentation
  • [Generate Message 12: Car Without Waybill]
    If waybill validation conditions → Generate message 12 indicating car exists without proper waybill documentation
  • [Generate Message 15: No Cargo for Loaded Equipment]
    If cargo validation conditions → Generate message 15 indicating no cargo found for loaded equipment AND include the root key and waybill date in the error message
  • [Generate Message 16: Invalid Cargo Status]
    If cargo status validation conditions → Generate message 16 indicating invalid cargo status prevents processing
  • [Generate Message 17: Cargo Already on Train]
    If cargo train assignment conditions → Generate message 17 indicating cargo is already assigned to another train
  • [Check Status: Pending]
    The cargo status is PENDING → Generate message sixteen indicating invalid cargo status
  • [Check Status: Error]
    The cargo status is ERROR → Generate message sixteen indicating invalid cargo status
  • [Check Status: Reject]
    The cargo status is REJECT → Generate message sixteen indicating invalid cargo status
  • [Check Status: Deleted]
    The cargo status is DELETED → Generate message sixteen indicating invalid cargo status
  • [Check User Security Level]
    The cargo status is BLANK or REJECT or ERROR → Generate message sixteen indicating invalid cargo status due to security restrictions
  • [Check Additional Status Conditions]
    The cargo status is MANUAL → Generate message sixteen indicating invalid cargo status
  • [User Security Level = 'S'?]
    The cargo status is BLANK, REJECT, or ERROR → The system should set error message MSG-SIXTEEN to deny access
  • [Is Cargo Already Attached to Another Train?]
    The cargo has a Canadian Customs North Train ID that is not empty spaces → Set Message 17 indicating the cargo is already attached to another train
  • [Is Cargo Linehaul Type? AND Is Cargo Status Manual?]
    The cargo is linehaul type AND the cargo status is manual → Set Message 16 indicating linehaul manual status error
  • [Manifest TO Transit Code ≠ Train Crossing Port?]
    The system compares manifest TO transit code with train crossing port → If manifest TO transit code does not equal train crossing port, set error message 28 and prepare change message for customs
  • [Manifest FROM Transit Code ≠ Train Crossing Port?]
    The system compares manifest FROM transit code with train crossing port → If manifest FROM transit code does not equal train crossing port, set error message 28 and prepare diversion message for customs
  • [Set Error Message 28 - Transit Code Mismatch]
    Either manifest TO or FROM transit code does not match train crossing port → Set message type 28 indicating transit code mismatch error
  • [Equipment has Cargo Records?]
    System checks for associated cargo records → If no cargo records found, generate no cargo message, otherwise continue processing
  • [Generate Error: Invalid Car ID Format]
    System processes the formatting failure → System generates error message 'ERR>>>> INVALID CAR ID' and adds to report
  • [Status = Pending?]
    The cargo status is checked and found to be pending → The system sets error message MSG-SIXTEEN to indicate invalid cargo status
  • [Status = Error?]
    The cargo status is checked and found to be error → The system sets error message MSG-SIXTEEN to indicate invalid cargo status
  • [Status = Reject?]
    The cargo status is checked and found to be reject → The system sets error message MSG-SIXTEEN to indicate invalid cargo status
  • [Status = Deleted?]
    The cargo status is checked and found to be deleted → The system sets error message MSG-SIXTEEN to indicate invalid cargo status
  • [User Security Level ≠ 'S'?]
    The cargo status is blank, reject, or error → The system sets error message MSG-SIXTEEN to indicate invalid cargo status for the user's security level
  • [Cargo Status Valid - Continue Processing]
    The cargo status is manual → The system sets error message MSG-SIXTEEN to indicate invalid cargo status
  • [Check CDN CUS North Train ID Field]
    The system checks the Canadian Customs North Train ID field in the cargo record → If the field is not empty (contains spaces), set message seventeen indicating the cargo is already attached to another train
  • [Check for linehaul manual manifest status and generate errors if found]
    The cargo is found AND the shipment is classified as linehaul type AND the cargo status is set to manual → The system generates error message MSG-SIXTEEN and sets an error flag to indicate the shipment requires manual intervention
  • [Check Return Status Transit Code]
    The manifest TO transit code is compared with the train crossing port → If codes do not match, trigger error message 28 and prepare change message; if codes match, continue normal processing
  • [Check Non-Return Status Transit Code]
    The manifest FROM transit code is compared with the train crossing port → If codes do not match, trigger error message 28 and prepare diversion message; if codes match, continue normal processing
  • [Check Cargo Status]
    The system checks if cargo data has been found and loaded → The system proceeds to transit status validation only if cargo is found, otherwise skips border crossing message preparation
  • [CCN Key = '6105E'?]
    The system checks if the CCN key starts with '6105E' → The system proceeds with Canadian border crossing validation if CCN starts with '6105E', otherwise skips border crossing message preparation
  • [Container Relationship Found?]
    The system checks the query results → If container relationship is found, proceed to retrieve container equipment data, otherwise set container not found message
  • [Generate Missing Container Relation Error]
    No container relation record is found in FWSWRWR database → Set message eleven error flag and add to report index
  • [Generate System Error - Missing Equipment]
    Container equipment details are not found in FWSWREQ database → Generate abend message indicating FWSWRWR segment exists without FWSWREQ segment and Execute system abend
  • [Error Message?]
    The system checks the message error indicator → The system determines if this is an error message requiring error processing
  • [Add 1 to Error Count]
    The system processes the regular error message → The error count is incremented by 1
  • [Add 1 to Error Count]
    The system processes the warning message → The error count is incremented by 1
  • [Add 1 to Request Error Count]
    The system processes the request message → The request error count is incremented by 1
  • [Add 1 to Request Error Count]
    The system processes the capacity exceeded condition → The request error count is incremented by 1
  • [Any Errors in Report?]
    The system checks for errors in the report → If no errors exist, proceed to spawn message processing, otherwise proceed to error handling path
  • [Set Error Count from Spawn Count]
    All spawn messages are completed → The pre-spawn count is moved to the report error count
  • [Increment Error Count]
    The conversion is completed → The report error count is incremented by 1
  • [Any Errors Found?]
    If RPT-NO-ERROR condition is true → If no errors exist, proceed with customs message spawning, otherwise convert error messages to warnings
  • [Update Error Count with Spawn Count]
    The system completes the spawn processing loop → The PRE-SPAWN-CNT is moved to RPT-ERROR-CNT to reflect spawned message count
  • [Convert Error Messages to Warnings]
    The system finds message type 28 in the report lines → Message type 28 is converted to message type 19 and error count is incremented
  • [Is message type 28 Transit Code Error?]
    If the message type indicator for the current report line → The system determines if the message is type 28 requiring conversion to a warning message
  • [Increment error count by 1]
    The system updates error tracking counters → The total error count is incremented by one to reflect the converted message
  • [Message Send Successful?]
    The system checks transmission status → If EMI return status is not successful, the system prepares for abend with 'SEND TO MERLIN FAILED' message
  • [Check Error Message Count]
    The system checks if any error messages were generated during processing → If error message count is greater than zero, set return status to ERRORS, otherwise proceed to success processing
  • [Set Return Status to ERRORS]
    The system determines that errors occurred during processing → Set return status to ERRORS and invoke customs reporting process to send error details to external customs system