As an EDI Gateway Service,
I want to orchestrate and execute all GCX016 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.
I want to orchestrate and execute all GCX016 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 MQ Message Arrays]
The system prepares for MQ message processing → MQ message arrays are initialized with proper structure and capacity for message handling - [Initialize for MQ Queue Processing]
The system initializes MQ queue processing → MQ-specific configuration parameters are set including queue names, connection settings, and message handling options - [Initialize for Direct GCW016 Input]
The system initializes direct GCW016 input processing → Direct input configuration parameters are set for handling GCW016 message format - [Initialize Transaction Set Processing]
The system initializes transaction set processing → The system should set up the transaction boundary and enable segment validation - [Initialize Array with Default Values]
The system creates an empty status array → The system initializes the array with default status values and proper sequence numbering - [Initialize KCSM Transmission File]
The system begins KCSM transmission preparation → The system initializes the KCSM transmission file with proper structure and parameters - [Initialize Secondary Record Search]
The system begins searching for payer of freight information → The system initializes the search process to examine N101 segments - [Initialize MQ Connection Parameters]
Queue reading process is initiated → MQ connection parameters are initialized with proper values for queue access - [Queue Open Successful?]
Queue open status is evaluated → If queue opened successfully, proceed to message reading; otherwise handle queue open error - [Initialize MQ Message Arrays]
The system processes the queue-based message → The system initializes MQ message arrays for train and cargo processing - [Open MQ Queue for Reading]
Queue open operation is initiated → Queue is opened for reading messages - [Queue Open Successful?]
Queue open status is evaluated → If queue opened successfully, proceed to get messages; if queue open failed, handle queue open error - [Initialize Message Array]
Message array initialization is performed → Message array is prepared to store message entries - [Initialize Message Arrays for EDI 350]
The system begins message array initialization → Message arrays are initialized with EDI 350 parameters and processing structure is established - [Initialize Arrays for Train Operations]
The system initializes processing arrays → Arrays are configured with train-specific parameters and processing capabilities - [Initialize Arrays for Standard Processing]
The system initializes processing arrays → Arrays are configured with standard parameters for general message processing - [Initialize Message Array Parameters]
The system initializes message array parameters → Message array is populated with message segments, processing flags, and transaction identifiers - [Initialize New Segment]
The system initializes a new segment → The system sets default values and prepares segment data before executing database call - [Initialize Transmission Control Parameters]
The system begins transmission root segment creation process → All transmission control parameters are initialized to default values and prepared for message processing - [Initialize Dependent Segment Structure]
The system begins creating dependent segments → The dependent segment structure must be initialized with default values and cleared of any previous data - [Initialize EDI Message Copy Variables]
The system begins EDI message copy creation process → All EDI message copy variables, counters, and data structures are initialized to their default values - [Initialize EDI Message Copy Process]
The system begins the KCSM message copying process → The system initializes all necessary structures and variables for EDI message duplication - [Initialize Transmission Parameters]
The system initializes transmission parameters → The system sets up EDI message parameters, transmission dates, and processing configuration for KCSM integration - [Initialize Transmission Parameters]
The system begins transmission root segment creation process → All transmission parameters are initialized to default values and system is ready for parameter setting - [Initialize Dependent Segment Structure]
The system begins creating dependent segments → The system initializes the A9DP dependent segment structure with default values and prepares it for data population - [Initialize Empty Status Array Structure]
The system needs to create status tracking for the cargo → The system initializes an empty status array structure - [Initialize S09 Segment Counter]
Beginning the status array replacement process → Set the S09 segment counter to zero to start tracking segment creation - [Initialize Empty S09A Status Array]
The system needs to create a new status array for processing → The system initializes an empty S09A status array structure - [Initialize Equipment Information]
Equipment fields need initialization → Set car ID, equipment type, and transportation unit information based on cargo type and N7 segment data - [Initialize Log Message Fields]
The system begins preparing the log message → All message fields are cleared and initialized to default values - [Initialize Message Header Fields]
Message header initialization is performed → Message header fields are set with standard Merlin format values - [Initialize Report Display Fields]
Report display field initialization is performed → All display fields are formatted with standard presentation templates - [Initialize MQ Message Arrays]
The system begins message queue initialization → Message queue arrays are cleared and prepared for train segment processing - [Initialize Message Array Entry]
A new message array entry is needed → System initializes array entry with proper structure and default values - [Open EDI Message Queue for Reading]
System attempts to open EDI message queue for reading → Queue is opened successfully for message retrieval or queue access failure is handled - [Initialize Message Array Parameters]
System initializes message array parameters → Message arrays are configured with proper parameters for EDI message storage - [Initialize Message Arrays]
System begins message processing operations → Message arrays are initialized and entry counters are reset to zero - [Open MQ Queue for Reading]
System attempts to open MQ queue for reading → MQ queue connection is established for message retrieval operations - [Initialize Entry Counter]
Message processing begins → The entry counter is set to zero to track the number of segments processed - [Initialize Transmission Parameters]
The system begins transmission parameter initialization → Transmission parameters are loaded from AECWRKTB work table - [Initialize A9DP Dependent Segment]
The system needs to create dependent segments for transmission → The system initializes a new A9DP dependent segment structure with default values
Core Acceptance Criteria
- [138:IMS Queue Reading]
The system checks for message availability AND the completion code is not OK AND the reason code equals 2033 → The system sets message not available status - [138:IMS Queue Reading]
The completion code is OK AND the message backout count != zero → The system sets skip message found status and does not process the message - [138:IMS Queue Reading]
The completion code is OK AND the message backout count equals zero → The system sets good message found status and proceeds with processing - [2:EDI Transaction Set Processing]
The segment type is evaluated → The system routes ST segments to header processing, M10 to manifest processing, P4 to port processing, V9 to event processing, K1 to remarks processing, X4 to customs release processing, N7 to equipment processing, and SE to trailer processing - [5:Event Detail Processing]
The event code is evaluated → The system executes HMI for hold train, HRE for release hold, POD/AAD for train arrival, RC for review completed, OCA for train not arrived, COC for cancel arrival, LCK for lock train, ULC for unlock train, SEI for seize train, or SER for release seizure - [21:Customs Release Information Processing]
The processing method is determined → The system processes cargo by bond number for grouped processing, by car and waybill for transportation unit processing, or individually for single cargo items - [99:New Cargo Record Creation]
Entry type code is evaluated → The system processes 61 as immediate transport, 62 as transport export, 63 as immediate export, 69 as US-Canada-US movement, and 00 as default border processing - [218:Disposition Code Table Lookup]
The disposition type is ARL (Auto Release) → The system generates auto release message and processes the release automatically - [92:Merlin Release Message Generation]
Release message generation is required → The system creates release message with car information, date, time, and quantity details - [92:Merlin Release Message Generation]
Export or cancel export processing is required → The system generates appropriate Merlin messages for export status changes - [92:Merlin Release Message Generation]
Arrival or cancel arrival processing is required → The system generates appropriate Merlin messages for arrival status changes - [174:KCSM Disposition Code Processing]
KCSM integration requirements are evaluated → The system determines if KCSM disposition code processing and EDI message copying is required - [175:EDI 350 Message Copying for KCSM]
EDI message copying is performed → The system copies the EDI 350 message structure for KCSM transaction processing - [312:KCSM Transaction Spawning]
Transaction spawning is required → The system spawns KCSM transaction with copied message data - [92:Merlin Release Message Generation]
Message type is evaluated → The system routes ERROR/ARRCANL to IN and USERR destinations, INFO to IN and station-specific Merlin IDs, UNRLSE to default and cancel-specific Merlin IDs, RLSE to station-specific Merlin IDs only, and EXPORT with equipment type validation - [Set Processing Parameters]
The system determines the message source type → Processing parameters are configured appropriately for the specific input method - [Message Source Type?]
The system checks the message source indicator → The system routes to either MQ queue processing or direct GCW016 input processing based on the message source type - [Load System Tables]
The system loads system tables → All required reference tables including disposition codes, broker information, and validation tables are loaded into memory - [Set Transaction Counters]
The system sets transaction counters → All counters for processed messages, errors, warnings, and cargo records are set to zero - [ST Segment Received]
The system processes the ST segment header → The system should set the header found flag and initialize transaction set processing - [Extract Transaction Set Control Number]
The system extracts the control number from the segment → The control number should be stored for transaction boundary validation - [Set Transaction Set Active Flag]
The system sets the transaction set active flag → The active flag should be set to enable subsequent segment processing within the transaction boundary - [Extract Train Information from M10]
The system processes the M10 segment → The system extracts SCAC code from M10-02, equipment initial from M10-03, and equipment number from M10-04 to build the train identification key - [Process Train Information Successfully]
The system processes the successful validation → The system marks the train processing as successful and prepares to continue processing other manifest segments - [Continue Processing Other Segments]
The system continues manifest processing → The system proceeds to process other segments in the manifest message to ensure complete message handling - [Log Train Not Found Event]
The system processes the logging requirement → Log the train not found event with timestamp and train identification details - [P4 Segment Received]
The system processes message segments → The system calls B200-PROCESS-P4-SEGMENT to handle port information processing - [HMI - Train Hold Operations]
The system processes the HMI disposition code → The train status is updated to HELD and VID segments are processed for equipment holds - [HRE - Train Release Operations]
The system processes the HRE disposition code → The train status is updated to RELEASED and VID segments are processed for equipment releases - [POD - Train Arrival at Port of Discharge]
The system processes the POD disposition code → The train status is set to ARRIVED and arrival date and location are updated - [AAD - Train Arrival at Destination]
The system processes the AAD disposition code → The train status is set to ARRIVED and arrival date and location are updated - [RC - Export Manifest Review Complete]
The system processes the RC disposition code → The export manifest is marked as reviewed and the train record is updated - [COC - Train Arrival Cancellation]
The system processes the COC disposition code → The previous arrival status is cancelled and the train record is updated with cancellation details - [LCK - Train Lock Operations]
The system processes the LCK disposition code → The train lock status is set and the train record is updated to prevent modifications - [ULC - Train Unlock Operations]
The system processes the ULC disposition code → The train lock status is removed and the train record is updated to allow modifications - [SEI - Train Seizure by Customs]
The system processes the SEI disposition code → The train seizure status is set by customs, VID segments are processed for equipment seizure, and the train record is updated - [SER - Train Seizure Release]
The system processes the SER disposition code → The train seizure status is removed, VID segments are processed for equipment release from seizure, and the train record is updated - [Extract Disposition Code from V9-02]
The system extracts the disposition code from V9-02 field → The disposition code is evaluated to determine which train operation to Execute (HMI, HRE, POD, AAD, RC, OCA, COC, LCK, ULC, SEI, or SER) - [More V9 Segments?]
The system checks if more V9 segments exist in the message → If more V9 segments exist, processing continues with the next segment, otherwise V9 processing is completed - [VID Segment Following HMI Code Received]
The system processes the message segments in sequence → VID segment processing is initiated for equipment hold operations - [Extract Equipment ID from VID Segment]
The system reads the VID segment data → Equipment ID is extracted from the VID segment for further processing - [Skip Invalid Equipment]
The system continues VID segment processing → Invalid equipment is skipped and processing continues with next VID segment - [More VID Segments?]
The system checks for remaining VID segments → System determines if more VID segments need processing or if hold processing is complete - [Equipment Hold Processing Complete]
The system finalizes hold processing → Equipment hold processing is marked as complete - [Read Next VID Segment]
The system reads the next VID segment in the message → The VID segment is retrieved and made available for equipment processing - [Extract Equipment ID from VID Segment]
The system processes the VID segment content → The equipment ID is extracted from the VID segment data - [Format Equipment ID using GCCCARFM]
The system calls GCCCARFM formatting routine → The equipment ID is formatted according to standard business rules for equipment identification - [Equipment Currently Held?]
The system checks the equipment's current hold status → If equipment is currently held, proceed with release processing, otherwise log equipment not found warning and continue to next VID segment - [More Equipment to Process?]
The system checks for additional VID segments in the message → If more VID segments exist, continue processing next VID segment, otherwise proceed to update train hold status - [Update Train Hold Status]
If the train's overall hold status → The train hold status is updated based on remaining held equipment count - [Log Equipment Not Found Warning]
The system processes the equipment not found condition → A warning is logged indicating equipment was not found in hold list and processing continues to next VID segment - [Continue to Next VID Segment]
The system continues with VID segment processing → Processing returns to read the next VID segment in the message - [Equipment Release Processing Complete]
The system finalizes equipment release processing → Equipment release processing is marked as complete and control returns to main message processing - [Extract Equipment ID from VID Segment]
The system processes the VID segment → The equipment ID is extracted from the VID segment for seizure processing - [Extract Equipment ID from VID Segment]
The system processes the VID segment → The equipment ID is extracted from the VID segment data - [Find Equipment on Train]
The system searches for the equipment on the train → The system determines if the equipment is found or not found on the train - [Check Overall Train Seizure Status]
The system checks the overall train seizure status → The system determines if any equipment still remains seized on the train - [VID Segments Follow?]
The system checks for additional message segments → The system determines if VID segments are present for equipment-specific hold processing - [Process VID Segment for Equipment Hold]
Each VID segment is processed → The system applies hold status to the specific equipment identified in the VID segment - [Increment Equipment Hold Counter]
The equipment hold is applied → The system increments the equipment hold counter by one - [More VID Segments?]
The system checks for more VID segments in the message → The system determines if additional VID segments exist and continues processing or proceeds to train record update - [Update Train Record with Hold Status]
Train hold processing is ready for database update → The system updates the train record with hold status in the GCSTBRT table - [Generate Hold Notification Message]
The system prepares notifications → The system generates a hold notification message containing train and equipment hold details - [Send Message to Customs/Brokers]
The system sends notifications → The system transmits the hold notification to customs authorities and affected brokers - [Process VID Segments for Equipment Release]
VID segments are present in the message → The system processes each VID segment to release individual equipment holds - [Release Individual Equipment/Cars]
The system processes each equipment item in the VID segments → The system removes hold status from each specified equipment or car - [Remove Train-Level Hold Status]
The system processes train-level hold removal → The system removes the train-level hold status - [Generate Train Release Notification]
The system generates notifications → The system creates a train release notification message - [Send Success Message to Requestor]
The system sends response messages → The system transmits success message to the original requestor - [Disposition Code Type?]
The disposition code is either POD or AAD → The system routes to appropriate train arrival processing - [Process RC - Export Manifest Review Complete]
The system processes the RC disposition code → The system initiates export manifest review complete processing - [Check for Additional V9 Segments]
The system checks for additional segments → The system determines if more V9 segments exist for processing - [Process Next V9 Segment]
The system processes the next segment → The next V9 segment is processed following the same validation and processing rules - [Complete Export Manifest Review Processing]
The system finalizes the processing → The export manifest review processing is marked as complete - [Include Manifest Information in Message]
The system includes manifest information in the message → The message contains manifest details associated with the train that has not arrived - [Set Message Keywords for Categorization]
The system sets message keywords → The message is tagged with appropriate keywords for OCA train not arrived categorization - [Send Notification to Configured Users]
The system sends notifications to configured users → All users configured to receive OCA train not arrived notifications receive the message - [Generate Train Arrival Cancellation Warning]
The system detects the train arrival status is not 'arrived' → Generate warning message 'Train arrival being cancelled by CBP. Contact CBP and re-arrive bonds if needed' and terminate processing - [KCSM Integration Required?]
The system checks KCSM integration requirements → If KCSM integration is required, copy EDI message for KCSM transmission, otherwise proceed to log cancellation - [Copy EDI Message for KCSM]
The system prepares KCSM transmission → Copy the EDI message to A9RT/A9DP KCSM transmission tables - [Create KCSM Transmission]
The system creates the KCSM transmission record → Create KCSM transmission record in A9RT/A9DP tables with appropriate transmission parameters - [Log Train Arrival Cancellation]
The system logs the cancellation event → Create log entry with train details, cancellation timestamp, and processing results - [V9 Segment with LCK Disposition Code Received]
The system processes the V9 segment → The system initiates train lock processing workflow - [Extract Train Information from M10 Segment]
The system processes the train lock request → The system extracts train identification and operational details from M10 segment - [K1 Remarks Present?]
The system checks for additional information → The system determines if K1 remarks segment is present in the message - [Process K1 Remarks for Train Lock]
The system processes the remarks → The system extracts lock reason, duration, AND additional operational notes from K1 segment - [Generate Train Lock Confirmation Message]
The system generates confirmation → The system creates a train lock confirmation message with train ID, lock timestamp, AND operation status - [Send Notification to Operations]
The system sends notifications → The system sends lock notification to operations team AND updates operational dashboards - [Check for VID Equipment Segments]
The system examines the message segments for VID equipment information → The system identifies whether VID segments are present and sets appropriate processing flags - [Process Individual Equipment Unlock]
The system processes individual equipment unlock operations → The system iterates through each VID segment and processes unlock operations for the specified equipment - [Update Equipment Status to Unlocked]
Each equipment item is processed for unlock → The system updates the equipment records to reflect unlocked status for each specified equipment item - [Generate Train Unlock Confirmation]
All unlock processing is finished → The system generates a confirmation message indicating successful train unlock completion - [Send Notification Messages]
The system processes notification distribution → The system sends unlock notification messages to relevant parties and connected systems - [Process SEI Train Seizure Code]
The V9 segment contains SEI disposition code → The system initiates train seizure processing and prepares for equipment seizure operations - [VID Segments Follow?]
The system checks for following VID segments in the message → The system determines whether to process individual equipment seizure or proceed with train-level seizure - [Process VID Segment for Equipment Seizure]
The system processes each VID segment → The system marks the specific equipment identified in the VID segment as seized - [Mark Specific Equipment as Seized]
The system processes the equipment seizure request → The system updates the equipment status to seized in the equipment records - [More VID Segments?]
The system checks for additional VID segments in the message → The system either continues processing more VID segments or proceeds to train status update - [Generate Seizure Notification Message]
The system prepares stakeholder notifications → The system generates seizure notification message with train and equipment details - [Update Train Record in Database]
The system persists the seizure operation results → The system updates the train record in the database with the new seizure status and related information - [Process SER - Train Seizure Release]
The system processes the SER disposition code → The system initiates train seizure release processing - [Check for Following VID Segments]
The system checks for VID segments following the V9 segment → The system identifies whether VID segments are present for individual equipment processing - [Process Each VID Segment for Equipment Release]
The system processes each VID segment → The system releases the specified equipment from seizure and decrements the seized equipment count - [Generate Train Seizure Release Notification]
The system completes seizure release processing → The system generates a train seizure release notification message - [Extract Equipment ID from VID Segment]
The system processes the VID segment to extract equipment information → The equipment ID is extracted from the VID segment data for further processing - [Format Equipment ID Using GCCCARFM]
The system calls GCCCARFM to format the equipment ID → The equipment ID is formatted according to standard car identification rules and validated for correctness - [More VID Segments?]
The system checks for additional VID segments in the message → If more VID segments exist, continue processing; if no more segments, proceed to train status determination - [Determine Overall Train Hold Status]
The system determines the overall train hold status → The train hold status is evaluated based on the number of equipment items held and train hold policies - [Receive VID Segment for HRE]
VID segments are present in the message → Each VID segment is processed for equipment release - [Extract Equipment ID from VID Segment]
The system reads the VID segment data → The equipment ID is extracted from the VID segment - [Locate Equipment in Train Equipment List]
The system searches the train equipment list → The system attempts to locate the equipment in the train list - [Continue to Next VID Segment]
Additional VID segments exist for processing → The system continues to the next VID segment - [Equipment Release Processing Complete]
No more VID segments remain → The equipment release processing is marked as complete - [Log Equipment Not Found Warning]
The equipment is not found in the train equipment list → A warning is logged indicating equipment not found - [Process VID Segments Following SEI]
The system processes the message segments following the SEI code → All VID segments in the message are identified and processed for equipment seizure - [Extract Equipment ID from VID Segment]
The system processes the VID segment → The equipment ID is extracted from the VID segment data for further validation and processing - [Mark Equipment as Seized by Customs]
The SEI disposition code is applied to the equipment → The equipment is marked as seized by customs in the system - [More VID Segments?]
The system checks for additional VID segments in the message → The system continues processing if more VID segments exist or proceeds to finalize seizure processing - [Update Overall Train Seizure Status]
The system finalizes seizure processing for the train → The overall train seizure status is updated to reflect the seizure of equipment - [SER Disposition Code Present?]
If the disposition code → If disposition code is 'SER', initiate equipment seizure release processing, otherwise skip seizure release processing - [Get Next VID Segment]
The system processes VID segments sequentially → Retrieve the next available VID segment containing equipment identification information - [Extract Equipment ID from VID]
The system processes the VID segment → Extract the equipment identification information from the VID segment data - [Format Equipment ID]
The system processes the equipment ID → Format the equipment ID according to standard equipment identification format for train registry lookup - [More VID Segments?]
The system checks for remaining VID segments → If more VID segments exist, continue processing the next VID segment, otherwise proceed to update train seizure status - [Equipment Not Found Warning]
The system cannot locate the equipment on the train → Generate a warning message indicating the equipment was not found on the train and continue processing remaining VID segments - [Update Train Seizure Status]
If the train's overall seizure status → Update the train seizure status based on remaining seized equipment count - [Skip - No SER Code]
The disposition code is not 'SER' → Skip all equipment seizure release processing and complete the seizure release workflow - [Processing Context?]
If the current processing context → The system routes K1 remarks to either train-level processing or cargo-level processing based on the active context - [178:K1 Remarks Processing for Train Operations]
The system processes the K1 segment for train operations → The system extracts the remarks from K1 segment AND associates them with the current train record AND logs the comments with train identification information - [179:K1 Remarks Processing for Cargo Operations]
The system processes the K1 segment for cargo operations → The system extracts the remarks from K1 segment AND stores the remarks in the associated cargo record AND makes the remarks available for cargo-related messaging - [106:K1 Comment Integration]
The system prepares messages for external communication → The system retrieves all stored K1 comments from the array AND integrates them into the appropriate message formats AND makes them available for inclusion in Merlin messages, release messages, and broker notifications - [Include Comments in Merlin Messages]
The system formats the Merlin message → The system includes all available K1 comments in the Merlin message AND formats them appropriately for Merlin message standards - [Include Comments in Release Messages]
The system formats the release message → The system includes all available K1 comments in the release message AND ensures comments are properly formatted for release message recipients - [Extract Customs Release Information]
The system processes the X4 segment → All customs release information including disposition code, entry number, release quantity, bond number, car ID, and waybill are extracted and stored - [Bond Number Present?]
The system checks for the presence of a bond number → If bond number is present, process all cargo with the same bond number; otherwise check for car ID and waybill combination - [Car ID and Waybill Present?]
The system checks for car ID and waybill information → If both car ID and waybill are present, process cargo by car/waybill combination; otherwise process using US-CCN directly - [Create New Foreign Bill Record]
The system determines a new record is needed → A new foreign bill record is created with information from the X4 segment and default status values - [Process In-Bond Entry Types]
The system processes entry types (61-Immediate Transport, 62-Transport Export, 63-Immediate Export, 69-US-Canada-US, 00-Border Processing) → Appropriate in-bond processing is applied based on the entry type with correct bond dates and destination handling - [Process Master In-Bond Entries]
The system processes the master in-bond requirement → Master in-bond flag is set, appropriate entry type processing is applied, and broker information is processed from K1 segments - [Log Processing Information]
The system logs processing information → All status changes, notifications sent, and processing actions are logged to GCX105 system for audit trail - [Extract Bond Control Number from X4 Segment]
The system processes the X4 segment for bond-based operations → The bond control number is extracted and stored for subsequent cargo processing - [Process Disposition Code for Cargo]
The system processes disposition code for the cargo → Disposition code is validated and appropriate cargo actions are determined - [Generate Cargo Messages if Required]
If message generation requirements → Appropriate cargo messages are generated if status changes require notification - [217:Status Array Persistence]
All disposition code processing is complete → The system updates the cargo S09 status segments with the modified status array information - [Add to Release Quantity]
The system processes the quantity addition → The system should add the X4 segment quantity to the current cargo release quantity - [Subtract from Release Quantity]
The system processes the quantity subtraction → The system should subtract the X4 segment quantity from the current cargo release quantity - [Generate Quantity Mismatch Notification]
The system processes the mismatch notification → The system should generate a detailed notification message and prepare it for broker delivery - [Extract Car ID from X4-01]
The system processes the X4-01 field → Car ID is extracted and stored for further processing - [Extract Waybill from X4-02]
The system processes the waybill data → Waybill number is extracted and prepared for cargo lookup - [Format Car ID using GCCCARFM]
The system calls GCCCARFM formatting module → Car ID is formatted according to standard business rules and validation is performed - [Process Disposition Codes]
The system processes disposition codes from X4 segment → Disposition codes are evaluated and appropriate cargo status changes are determined - [Car ID Available?]
System checks for car ID availability in the message data → If car ID is present, proceed with car ID search, otherwise create new foreign bill record - [B530: Attempt Car ID Only Search]
System executes car ID only search using GCCUSIO with car ID index → System retrieves cargo records matching the car identification - [Handle Master In-Bond Types 61,62,63,69]
System processes master in-bond entry type → Set master in-bond flag and apply specific processing rules: 61 for immediate transport, 62 for transport export, 63 for immediate export, 69 for US-Canada-US movement - [Map Transport Type Codes]
System maps transport type codes from message data → Assign appropriate transport category and processing flags based on transport type - [Build M10 Manifest Information]
Building manifest information for new cargo → Extract and assign manifest details from M10 segment to cargo record - [Map Entry Type to Transport Type]
Entry type is 61, 62, 63, 69, or 00 → Map to immediate transport, transport export, immediate export, US-Canada-US movement, or border processing respectively - [Entry Type Code?]
The entry type code is evaluated for master in-bond eligibility → Entry types 61, 62, 63, and 69 are classified as master in-bond entries requiring special processing, while all other entry types proceed to standard processing - [Entry Type 61 - Master In-Bond]
Master in-bond processing is initiated → The cargo is classified for immediate transport processing and master in-bond flag is set - [Entry Type 63 - Master In-Bond]
Master in-bond processing is initiated → The cargo is classified for immediate export processing and master in-bond flag is set - [Map Entry Type to Transport Type]
Transport type mapping is performed → Entry type 61 maps to immediate transport, 62 maps to transport export, 63 maps to immediate export, and 69 maps to US-Canada-US movement - [Extract SCAC Code from M10]
The system processes the M10 segment → The SCAC code is extracted from the M10 segment and stored for manifest processing - [Extract Transport Type]
The system processes the M10 segment → The transport type is extracted from the M10 segment and stored for manifest processing - [Extract Country Code]
The system processes the M10 segment → The country code is extracted from the M10 segment and stored for manifest processing - [Extract Vessel Name/Flight Number]
The system processes the M10 segment → The vessel name or flight number is extracted from the M10 segment and stored for manifest processing - [Extract Voyage/Flight Number]
The system processes the M10 segment → The voyage or flight number is extracted from the M10 segment and stored for manifest processing - [Extract Manifest Quantity]
The system processes the M10 segment → The manifest quantity is extracted from the M10 segment and stored for manifest processing - [Extract Manifest Type Code]
The system processes the M10 segment → The manifest type code is extracted from the M10 segment and stored for manifest processing - [Extract Condition Response Code]
The system processes the M10 segment → The condition response code is extracted from the M10 segment and stored for manifest processing - [All Required Fields Present?]
The system checks for required field completeness → If all required fields are present and valid, processing continues to build manifest record, otherwise missing data error is generated - [Build Manifest Information Record]
The system builds the manifest information record → A complete manifest record is constructed with SCAC code, transport type, country code, vessel information, voyage number, quantity, manifest type, and condition response code - [Retrieve Disposition Code from DC Table]
The system looks up the disposition code in the DC table → The disposition code details are retrieved including Merlin messages and processing flags - [ARL - Auto Release Processing]
The disposition code action is ARL → The system generates an auto release message and sets appropriate release flags - [Process Hold Codes with Location]
The disposition code action is DC hold → The system adds the hold code to status array and sets location information from the message - [Fetch S09 Segments from Database]
The system needs to manage cargo status information → The system fetches all existing S09 status segments associated with the cargo CCN key - [Create Empty S09A Status Array]
The system attempts to fetch cargo status information → The system creates a new empty S09A status array structure - [Populate S09A Array from S09 Segments]
The system retrieves the segments from the database → The system populates the S09A status array with all status entries from the retrieved segments - [Add New Disposition Code to Array]
The system processes a new disposition code from X4 segment → The system adds the disposition code with appropriate status flags, location information, and quantity details to the next available position in the status array - [Move S09A Array Data to S09 Segments]
The system needs to persist status changes → The system transfers all status entries from the S09A array back to properly formatted S09 database segments with correct sequence numbering - [Replace S09 Segments in Database]
The system completes status array processing → The system replaces the existing S09 segments in the database with the updated segment data - [Update Cargo Record with New Status]
The system completes status array management → The system updates the cargo record with the current status description and any related status indicators - [Log Overflow Condition]
Recording the overflow event → The system logs the overflow condition with relevant details for operational review - [Extract Equipment ID from N7 Segment]
The system processes the N7 segment → Equipment ID information is extracted and stored for cargo record updates - [Update Car ID Information in Cargo Records]
The system processes the car ID update → Car ID information is updated in all associated cargo records with equipment details from N7 segment - [Log Cargo Not Found Warning]
The system processes the cargo search failure → A cargo not found warning is logged and processing continues to next segment - [SE Segment Detected]
The segment type is identified as 'SE' → The system initiates SE segment processing for transaction set completion - [Valid SE Segment?]
The validation results are evaluated → If segment is valid, proceed to extract control data, otherwise generate validation error - [Extract Transaction Set Control Number]
The system extracts the transaction set control number → The control number is captured for comparison with the corresponding ST segment - [Extract Number of Included Segments]
The system extracts the segment count from SE segment → The segment count is captured for validation against actual processed segments - [Mark Transaction Set as Complete]
The system marks the transaction set as complete → The transaction set status is updated to indicate successful completion - [Log Control Number Mismatch]
The system logs the control number mismatch → An error is recorded indicating control number inconsistency between ST and SE segments - [Log Segment Count Mismatch]
The system logs the segment count mismatch → An error is recorded indicating inconsistency between declared and actual segment counts - [Extract Bond Control Number from X4 Segment]
The system extracts the bond control number from the X4 segment → The bond control number is captured and made available for validation and processing - [Apply Disposition Code to Cargo]
The system applies the disposition code to the cargo → Disposition code is validated against disposition code tables and applied to cargo status array - [Format Equipment ID using GCCCARFM]
The system needs to search for cargo by car and waybill → The car ID is formatted using standard equipment formatting rules to ensure consistent search keys - [Process Disposition Codes]
The system processes customs disposition codes → Disposition codes are evaluated and appropriate cargo status changes are determined based on customs requirements - [Generate Release Messages]
The system processes release notifications → Release messages are generated with cargo details, quantities, and routing information for broker and system notifications - [Call B561-GET-DC-TABLE-INFO]
The system needs to validate the disposition code → The system calls B561-GET-DC-TABLE-INFO to retrieve disposition code details from GCSTBRT IMS segment - [Call GCCTBIO to Access DC Table]
The system performs a table lookup using GCCTBIO to access the DC table → The system retrieves the disposition code record from GCSTBRT DC table segments - [Create New Status Array]
The system processes cargo status updates → A new S09 segment is created with cargo CCN key and sequence '0001' - [Load Existing Status Array]
The system processes cargo status updates → All S09 sequences and occurrences are loaded into the status array for modification - [Save Status Array to Database]
All status processing is complete → Updated status array is saved back to S09 segments in database - [Parse Location Code]
The system processes the location code field → The location code is parsed and prepared for location-specific processing - [Parse Processing Flags]
The system processes the flag fields → Processing flags are parsed and made available for cargo status determination - [Parse Regulatory Indicators]
The system processes regulatory indicator fields → Regulatory indicators are parsed and prepared for compliance processing - [268: Release Message Generation]
The system determines release message should be generated → The system creates detailed release messages including cargo status and quantities - [269: Export Message Generation]
The system determines export message is required → The system generates USCS export operations message and handles export cancellation scenarios - [270: Arrival Message Generation]
The system determines arrival message is required → The system generates USCS arrival operations message and handles arrival cancellation scenarios - [Process Canadian Manifest Coordination]
The system processes the manual release → The system must search for matching Canadian manifest records by waybill and generate appropriate coordination messages - [Generate Canadian Log Messages]
Cross-border coordination processing occurs → The system must generate Canadian log messages with cargo release information and cross-border status updates - [Update Cross-Border Status]
The cross-border coordination process completes → The system must update the cross-border status to reflect completed coordination and maintain accurate international shipment tracking - [Generate Cross-Border Log Message]
The system generates cross-border coordination log → The system creates a log message with US cargo details, Canadian cargo details, and coordination timestamp - [Send Notification to Canadian System]
The system sends notification to Canadian system → The system transmits notification message with cargo release details and coordination status to Canadian system - [Format Audit Trail Message]
The system formats the audit trail message → The message is structured with proper headers, cargo details, and status information according to cross-border communication protocols - [Include Equipment ID Information]
Equipment ID information is included in the message → Car initial, car number, and other equipment identifiers are added to enable proper cargo tracking across borders - [Add Release Status Details]
Release status details are added to the message → Release quantities, disposition codes, release dates, and customs clearance information are included in the log message - [Add Border Crossing Information]
Border crossing information is added to the message → Border location codes, crossing dates, and customs port information are included to complete the cross-border coordination data - [Generate Log Message for Canadian System]
The log message is generated for the Canadian system → A complete cross-border log message is created with all cargo details, status changes, and coordination information formatted for Canadian system consumption - [Send Message to Canadian CCN]
The message is sent to Canadian CCN → The cross-border log message is successfully transmitted to the Canadian system for cargo coordination and tracking - [Update Audit Trail]
The audit trail is updated → The cross-border log message transmission is recorded with timestamp, message content, and transmission status for compliance and tracking purposes - [Prepare Quantity Mismatch Email Message]
System prepares the notification message → System creates formatted email message with quantity mismatch details, broker entry numbers, and relevant cargo information - [Include Broker Entry Numbers and Quantities]
System formats the message content → System includes broker entry numbers, expected quantities, actual quantities, and variance details in the notification - [Format Mismatch Details for Report]
System formats the mismatch details → System creates structured report format showing discrepancies, affected cargo, and recommended actions for broker review - [Send Notification to Broker]
System sends the notification → System delivers notification to broker through selected method and confirms successful transmission - [Log Notification Activity]
System logs the activity → System records notification details including timestamp, broker ID, notification method, message content summary, and delivery status in audit logs - [Prepare CIH Hold Email Message]
The system prepares the CIH hold notification email content → The system formats cargo information, hold details, and disposition code information into the email message body - [Set Email Keywords for CIH Hold]
The system configures email routing and keyword parameters → The system sets appropriate email keywords, routing codes, and delivery parameters specific to CIH hold notifications - [Send Email to Broker]
The system initiates email transmission to the broker → The system sends the email notification and logs the transmission status - [Prepare Merlin Message for CIH Hold]
The system prepares the CIH hold notification for Merlin transmission → The system formats cargo details, hold information, and disposition codes into Merlin message format - [Route to Broker Merlin Basket]
The system routes the message to the broker's Merlin basket → The system delivers the message to the correct broker Merlin ID and logs the routing status - [Prepare CIH Hold Notification]
The system formats the notification message content including hold code details and cargo information → The system creates a complete notification message ready for routing - [111: Email vs Merlin Routing]
The system checks email routing preferences in routing tables → The system routes via internet email if preference available, otherwise uses traditional Merlin routing - [Send Notification to Payer]
The system sends the notification to the payer of freight → The system delivers the notification and logs the successful transmission - [Extract New Bonded-To Station from X4 Segment]
The system processes the X4 segment data → The system extracts the new bonded-to station code from the appropriate field in the X4 segment - [Generate Release Message with Quantity Details]
The system generates the release message → The message includes cargo identification, release quantities, and disposition code details - [Call Integration Services for Release Notification]
The system calls integration services → External systems are notified of the cargo release status change - [Call Integration Services]
The system calls integration services (GCCIIS) → External systems are notified of the cargo release for container/trailer equipment processing and customs clearance - [Skip Duplicate Code Processing]
The same disposition code is received again for the same cargo → The system should skip all processing for this code and continue to the next segment without making any changes - [Generate Hold Notification Message]
Notification is required for the hold action → The system should generate a hold notification message including cargo details, hold type, and location information - [Call Integration Services for Hold Notification]
External systems need to be notified of the hold status → The system should call integration services (GCCIIS) to notify equipment and other systems of the hold status - [Generate Status Message]
The system finalizes the database updates → The system generates a status message containing cargo details and processing results for distribution - [Route Message to Customs]
The system determines the appropriate customs routing destination → The system sends the message to the designated customs authority for their processing - [Retrieve N9 Reference Segments]
The system needs FDA reference information for compliance processing → The system retrieves all available N9 reference segments associated with the cargo - [N9 Segments Available?]
N9 segments are found and available for processing → The system proceeds with FDA reference number processing, otherwise generates FDA compliance error - [Process FDA Reference Numbers]
The system processes the N9 segments for FDA compliance → The system extracts FDA reference numbers and prepares them for qualifier validation - [Extract FDA Qualifier Information]
The system extracts qualifier information from the N9 segments → The system obtains FDA qualifier codes and associated compliance data for validation - [Validate FDA Compliance Requirements]
The system validates FDA compliance requirements → The system determines if all FDA requirements are met based on the qualifier codes and reference data - [Generate FDA Hold Message]
FDA hold message needs to be generated for stakeholder notification → The system creates FDA hold message with relevant compliance information and cargo details - [Route FDA Notification to Appropriate Parties]
FDA notification needs to be distributed to stakeholders → The system routes the notification to FDA, brokers, and other appropriate parties based on cargo and compliance requirements - [Is Disposition Code KCSM-eligible?]
If the disposition code for KCSM eligibility → The system determines whether KCSM processing is required based on the disposition code value - [KCSM Processing Required?]
If the configuration settings against current message context → The system decides to either proceed with KCSM processing or skip it entirely - [Copy Current EDI 350 Message]
The system initiates KCSM message preparation → The system creates a complete copy of the original EDI 350 message preserving all segment data and structure - [Create Transmission Root Segment A9RT]
The system creates the transmission structure → The system generates an A9RT root segment with proper transmission identifiers and routing information - [Set KCSM Transmission Parameters]
The system configures transmission parameters → The system sets routing codes, transmission priorities, and KCSM-specific processing flags based on configuration data - [Create Dependent Segment A9DP]
The system creates dependent segments → The system generates A9DP segments containing the EDI 350 message data with proper sequencing and linkage to the A9RT root - [Copy EDI Segment Data to Transmission File]
The system copies EDI segment data → The system transfers all segment data from the original EDI 350 message to the transmission file maintaining data integrity and segment relationships - [Set Transmission Status and Routing]
The system finalizes transmission preparation → The system sets transmission status to ready for processing and assigns appropriate routing codes for KCSM delivery - [Spawn GCT1091E Transaction for KCSM]
The system initiates KCSM transaction processing → The system spawns GCT1091E transaction with proper parameters for KCSM message handling and transmission - [Queue Message for KCSM Transmission]
The system queues the message for transmission → The system places the KCSM message in the transmission queue with proper priority and delivery scheduling - [Log KCSM Transmission Details]
The system logs transmission activity → The system records transmission details including message identifiers, routing information, and processing timestamps for audit trail - [Skip KCSM Processing]
The system determines KCSM processing should be skipped → The system bypasses all KCSM processing steps and continues with normal EDI 350 message processing - [Search for Disposition Code in KCSM Configuration]
The system searches for the disposition code in the KCSM configuration data → The system retrieves the KCSM configuration status for the disposition code - [Check Disposition Code for KCSM Processing]
The system checks the disposition code against KCSM processing requirements → The system determines whether KCSM transmission is required for this message - [Copy Original EDI 350 Message Segments]
The system processes the original EDI 350 message → The system copies all required message segments to the KCSM transmission structure - [Create Transmission Root Segment]
The system creates the transmission structure → The system creates a transmission root segment (A9RT) with proper identification and control information - [Create Transmission Dependent Segments]
The system builds the complete transmission structure → The system creates transmission dependent segments (A9DP) linked to the root segment - [Format EDI Data for KCSM System]
The system prepares data for KCSM transmission → The system formats all EDI data according to KCSM system specifications and requirements - [Write Message to KCSM Queue]
The system is ready to transmit the message → The system writes the formatted message to the KCSM message queue for processing - [Update Transmission Parameters]
The system completes the transmission preparation → The system updates transmission parameters including timestamps, sequence numbers, and control information - [Log KCSM Transmission Details]
The system completes KCSM message preparation → The system logs transmission details including message ID, timestamp, disposition code, and transmission status - [Spawn KCSM Integration Transaction]
The system is ready to initiate KCSM integration → The system spawns a KCSM integration transaction to handle the actual transmission and processing - [Skip KCSM Processing]
The validation criteria indicate KCSM processing is not required → The system skips all KCSM processing steps and continues with normal message processing - [In-Bond Type Code Processing?]
If in-bond type code processing is needed → If required, Execute SNP processing to convert EDI to internal codes, otherwise check for border entry type 00 - [SNP Processing - Convert EDI to Internal Codes]
SNP processing is initiated for code conversion → Convert EDI codes to internal system codes and proceed to border entry type evaluation - [Process Entry Types 61,62,63,69]
Entry types 61, 62, 63, or 69 are encountered → Apply type-specific processing rules: 61 for immediate transport, 62 for transport export, 63 for immediate export, 69 for US-Canada-US movement - [Lookup EDI to CPRAIL Conversion Table]
The system needs to convert the EDI code to internal CPRAIL format → The system looks up the conversion table to find the matching CPRAIL code for the EDI code - [Convert EDI 309 Value to Internal CPRAIL Code]
The system processes the EDI code conversion → The system transforms the EDI 309 value into the corresponding internal CPRAIL code format - [Create U1 Segment with Converted Code]
The system needs to store the converted code information → The system creates a new U1 segment record and populates it with the converted CPRAIL code - [Update Shipment Record with In-Bond Information]
The system processes the shipment record update → The system updates the shipment root record with the in-bond type information from the U1 segment - [Log Conversion Success]
The system finalizes the conversion process → The system creates a log entry recording the successful conversion of the EDI code to CPRAIL format - [Type 61: IT/BL In-Transit]
The entry type code is '61' → Set transport type to immediate transport and process as IT/BL in-transit cargo - [Type 63: IE Immediate Exportation]
The entry type code is '63' → Set transport type to immediate export and process as IE cargo - [FDA-Related Reference?]
If the reference qualifier code → The system determines if the reference is FDA-related based on predefined FDA qualifier codes - [Extract FDA Reference Number]
The system processes the N9 segment → The FDA reference number is extracted from the reference identification field - [Extract FDA Qualifier Code]
The system processes the FDA reference → The FDA qualifier code is extracted and stored for reference type identification - [Extract Bond Control Number from X4 Segment]
The system processes the X4 segment for bond-based cargo fetching → The bond control number is extracted from the X4 segment and prepared as search key - [Load Cargo Root Segment]
The system loads cargo data → The cargo root segment is loaded from GCSUSRT IMS segment - [Extract Car ID from N7 Segment]
The system processes the N7 segment for car identification → The car initial and car number are extracted and combined to form the complete car ID - [Extract Waybill Number from X4 Segment]
The system processes the X4 segment for waybill identification → The waybill number is extracted from the X4 segment data - [Format Equipment ID using GCCCARFM]
The system needs to format the equipment ID for database operations → The GCCCARFM utility is called to format the car ID into standard equipment format - [Find Matching Canadian Manifest]
Canadian manifest match is required for the cargo → The system finds the matching Canadian manifest AND generates log message for Canadian CCN - [Create New Cargo Record]
The system creates a new cargo record → The cargo record is initialized with default values including CCN key, waybill number, car information, and segment data from X4 - [Process Master In-Bond Entry Types 61, 62, 63, 69]
The system processes the entry type → The cargo is classified as immediate transport and appropriate transport flags are set - [Process Master In-Bond Entry Types 61, 62, 63, 69]
The system processes the entry type → The cargo is classified as immediate export and appropriate export flags are set - [Set SCAC Code]
The system builds manifest information → The SCAC code is set from the M10 segment SCAC field - [Set Transport Type]
The system sets transport information → The transport type is set according to the entry type code mapping (immediate transport, export, etc.) - [Set Vessel/Flight Information]
The system builds manifest data → The vessel name and flight information are set from the M10 segment data - [Set Quantity Information]
The system processes cargo quantities → The cargo quantity fields are populated from the X4 segment quantity data - [Extract Car ID from Equipment Information]
Car ID extraction process is initiated → Car ID is extracted from equipment segment and formatted using GCCCARFM utility for standardized format - [Prepare EDI 350 Message for Follower]
The system prepares the EDI message for the follower → The system sets special action code '350' and copies disposition code, quantity, and entry number from X4 segment - [Format Message with Follower Details]
The system formats the message with follower details → The system includes follower manifest CCN, cargo details, and processing instructions in the formatted message - [Spawn GCT0161E Transaction for Follower]
The system initiates follower processing → The system spawns GCT0161E transaction with the formatted follower message for independent processing - [Retrieve S09 Segments from Database]
The cargo has existing status segments in the database → The system retrieves all S09 status segments associated with the cargo record - [Create New Empty Status Array]
The cargo has no existing status segments in the database → The system creates a new empty S09A status array structure with initialized counters - [Populate Array from S09 Segments]
The system needs to process status information → The system copies all status codes, disposition codes, entry numbers, quantities, locations, and release flags from S09 segments into the S09A working array - [Move Array Back to S09 Segments]
The processing is complete and changes need to be persisted → The system moves all status information from the S09A array back to S09 database segments, distributing entries across multiple sequences as needed - [Replace Database Records]
Changes need to be committed to the database → The system replaces the existing S09 status segments in the database with the updated information - [Update Array Elements]
Car ID information needs to be updated in the status segments → For CPRS cargo records, the system clears the car ID, and for other cargo types, the system updates the car initial and number from N7 segment data if available - [Extract Disposition Code from X4 Segment]
The system needs to identify the disposition code → The disposition code is extracted from the X4 segment and stored for lookup processing - [Call GCCTBIO to Access DC Table]
The system needs to lookup disposition code details → The GCCTBIO table access routine is called to retrieve information from the DC table - [ARL Auto Release Request Received]
The disposition code equals 'ARL' → The system initiates auto release processing workflow - [Retrieve Current Status Array S09A]
The system needs current status information → Current S09A status array is retrieved from GCSUSS09 status segments - [Generate Release Notification]
The system completes the status update process → The system generates release notification messages to inform relevant parties of the manual release completion - [Is Disposition Code a Hold Code?]
If the disposition code type → The system determines if the code represents a hold action and proceeds to hold processing or skips to completion - [Retrieve Bond Information from Broker]
System processes K1 remarks containing bond details → System extracts bond control number and broker information for cargo processing - [Generate Proceed Notification]
System generates status notification → System creates Merlin message with proceed status, bond information, and cargo details for broker notification - [Process Broker Entry Numbers]
The entry number starts with 'V' prefix → The system places the entry number in the entry number field, otherwise places it in the in-bond control number field - [Tax Number Processing - Handle CPRS tax numbers for Canadian Pacific entities]
The system processes the X4 segment for in-bond processing → The system should lookup CPRS tax number for broker identification and prepare appropriate broker messages - [POD - Proof of Delivery Code]
The system processes the POD disposition code → The system sets arrival status and updates arrival date based on cargo location (border or destination) - [AAD - Arrival at Destination Code]
The system processes the AAD disposition code → The system sets destination arrival status and updates destination arrival date - [Send Train Arrival Notification]
The system processes train arrival notification → The system sends arrival notification message to appropriate recipients - [Generate Arrival Message]
The system generates arrival message → The system creates and formats arrival message with cargo and arrival details - [Log Arrival Processing]
The system logs arrival processing → The system creates audit log entry with arrival processing details and timestamp - [Check Current Cargo Status]
The system checks current cargo status from GCSUSS09 status segments → Current cargo status information is retrieved and made available for export evaluation - [Is Cargo Ready for Export?]
If cargo readiness for export based on status conditions → Export processing continues if cargo is ready, otherwise export conditions not met error is generated - [Generate Cross-Border Log Message]
The system generates cross-border log message → Cross-border coordination message is created and logged to Canadian manifest records - [Prepare Export Notification Message]
The system prepares export notification message → Export notification message is formatted and ready for routing - [Route Export Message to USEXP Basket]
The system routes export message to USEXP basket → Export notification message is delivered to USEXP basket for further processing - [Export Status Processing Complete]
The system completes export status processing → Export status processing workflow is finished and control returns to calling process - [Cancellation Type?]
If the message type and cargo current status → The system routes to either arrival cancellation processing or export cancellation processing based on the evaluation criteria - [Process Arrival Cancellation]
The system processes the arrival cancellation → The system prepares arrival cancellation message and sends it via Merlin messaging system - [Process Export Cancellation]
The system processes the export cancellation → The system prepares export cancellation message and sends it via Merlin messaging system - [Generate Cancellation Notice]
The system generates cancellation notices → The system creates formatted cancellation messages with cargo details, cancellation type, and routing information for distribution - [Add Action: Released Qty = Released Qty + X4 Quantity]
The system performs add quantity action → The system should calculate new released quantity as current released quantity plus X4 quantity - [Subtract Action: Released Qty = Released Qty - X4 Quantity]
The system performs subtract quantity action → The system should calculate new released quantity as current released quantity minus X4 quantity - [Format Hold Message with Location Details]
The system formats the hold message → The system includes appropriate location details in the message format based on hold location type - [Include Cargo Information]
The system adds cargo information to the message → The system includes car ID, waybill number, US-CCN key, and other cargo identifiers in the message - [Add Disposition Code Details]
The system adds disposition code details → The system includes the disposition code and its description from the DC table in the message - [Include Quantity Information]
The system adds quantity information → The system includes total cargo quantity and quantity affected by the hold in the message - [Add K1 Comments if Available]
The system checks for K1 comments availability → If K1 comments exist, the system adds the remarks to the hold message, otherwise proceeds without comments - [Message Routing Required?]
If routing requirements → If message routing is required, the system proceeds to determine recipients, otherwise logs the message generation - [Determine Message Recipients]
The system determines message recipients → The system identifies recipients including station Merlin IDs, broker contacts, and payer of freight based on cargo configuration - [Broker Notification Required?]
The system checks broker notification requirements → If broker notification is required, the system retrieves broker information, otherwise sends to multiple standard destinations - [Get Broker Information]
The system retrieves broker information → The system gets payer of freight broker information if available, otherwise uses cargo broker information - [Route via Email]
The system routes the message via email → The system sends the hold message to broker's email address and proceeds to send to payer of freight - [Route via Merlin]
The system routes the message via Merlin → The system sends the hold message to broker's Merlin ID and proceeds to send to payer of freight - [Send to Payer of Freight]
The system sends message to payer of freight → If payer of freight information exists, the system sends the hold message to payer of freight contact - [Send to Multiple Destinations]
The system sends message to multiple destinations → The system sends the hold message to station-specific Merlin IDs and other configured destinations - [Log Hold Message Generation]
The system logs the message generation → The system records the hold message generation event including recipients and message details for audit trail - [Generate Release Notification]
Notification generation is triggered → The system shall generate release notification messages AND send notifications to relevant parties AND include cargo details and release timestamp - [Generate FDA Hold Notification]
The system generates FDA hold notification → Appropriate notification messages are created for brokers, carriers, and other stakeholders about the FDA hold - [Generate PTT Status Message]
The system generates status messages → Create and send PTT status notification messages to relevant external systems and stakeholders - [Generate Hold Message with Location Details]
The system generates hold notification messages → The system creates detailed messages including hold type, location information, and relevant cargo details for broker notifications - [Generate Unrelease Notification]
The system calls C600-FORMAT-MERLIN-INFO to format the unrelease message → The system creates a formatted notification message containing disposition code, cargo details, and unrelease information - [Canadian Manifest Coordination Required?]
The system checks if cargo has Canadian manifest cross-references → If Canadian manifest coordination is required, proceed to Canadian manifest processing, otherwise proceed to message routing - [Route Unrelease Message to Appropriate Users]
The system calls Z110-PREP-EMCSEND with message type UNRLSE → Unrelease message is routed to default and cancel-specific Merlin IDs for appropriate user notification - [Broker Notification Required?]
The system checks broker notification requirements for the cargo → If broker notification is required, proceed to send broker notification, otherwise proceed to transaction logging - [Canadian Record Valid and Usable?]
The system checks if the record is usable for coordination → The system should proceed with log message creation if the record is valid and usable, otherwise terminate Canadian processing - [Create Cross-Border Log Message]
The system creates a cross-border coordination log message → The system should generate a properly formatted log message containing relevant cargo release information - [Place Log Message on Canadian CCN]
The system places the log message on the Canadian CCN → The system should successfully transmit and store the log message in the Canadian CCN system - [Update Canadian Manifest Status]
The system updates the Canadian manifest status → The system should update the Canadian manifest record to indicate successful cross-border coordination - [Generate Log Message for Canadian CCN]
The system generates a log message for Canadian CCN → The system should place the log message on the Canadian system - [Place Log Message on Canadian System]
The system places the log message on the Canadian system → The system should create an audit trail for the cross-border release - [Create Audit Trail for Cross-Border Release]
The system creates an audit trail for cross-border release → The Canadian notification process should be marked as complete - [Move S09A Array Data to Database Segments]
The system prepares to update cargo records in the database → The status array data is moved to the appropriate database segment structure - [Prepare Hold Notification Data]
The system prepares hold notification data → All required hold information including cargo details, hold reasons, and status descriptions are formatted for GCCIIS transmission - [Prepare Release Notification Data]
The system prepares release notification data → All required release information including cargo details, release quantities, and status descriptions are formatted for GCCIIS transmission - [Prepare Status Change Data]
The system prepares status change data → All required status change information including cargo details, new status, and change reasons are formatted for GCCIIS transmission - [Check Message Type]
If the message type for formatting → The system selects either standard release format or broker bond message format based on the message classification - [Include Cargo Information]
Cargo information needs to be included in the message → The system adds cargo status, identification numbers, and relevant cargo details to the message content - [Add Disposition Code Details]
Disposition code details need to be added → The system includes the disposition code, its description, and associated customs action details in the message - [Add Quantity Information]
Quantity information needs to be added → The system includes total quantities, release quantities, and remaining quantities in the message - [K1 Comments Available?]
The system checks for K1 comment segments → If K1 comments are available, the system proceeds to include them; otherwise, it continues to quantity action formatting - [Include Up to 4 K1 Comment Segments]
The system includes K1 comments in the message → The system adds up to 4 K1 comment segments to the release message content - [Show Add/Subtract Operations?]
If whether to show quantity operations → If quantity changes need to be displayed, the system shows add/subtract operations; otherwise, it proceeds to format equipment information - [Format Car ID and Waybill Info]
Car ID and waybill information is formatted → The system includes formatted car identification numbers and waybill details in the message - [Add US-CCN Information]
US-CCN information needs to be added → The system includes the US Customs Control Number and related identification details in the message - [Include Processing Timestamps]
Processing timestamps need to be included → The system adds the date and time when the release processing was performed - [Set Message Destination]
Message destination needs to be set → The system assigns the appropriate Merlin destination based on message type and routing requirements - [Prepare Final Message Format]
Final message format is prepared → The system formats the complete message according to Merlin system requirements with all components properly structured - [Send to Merlin System]
The message is sent to Merlin system → The system transmits the release message to the Merlin system for processing and distribution to recipients - [Receive N7 Equipment Segment]
The system processes the N7 segment → Equipment data including container type, car initial, and car number are extracted and made available for processing - [Extract Container/Equipment Type]
The system extracts container type from the segment → Container type code is identified and stored for validation and processing - [Update Equipment Information in Cargo Record]
The system updates cargo record with equipment information → Cargo record contains updated car initial, car number, and equipment type information from the N7 segment - [Set Export Message Type]
The system sets the export message type → The message type is configured for standard export processing - [Set Export Cancellation Message Type]
The system sets the export cancellation message type → The message type is configured for export cancellation processing - [Call Z110-PREP-EMCSEND Message Preparation]
The system calls the message preparation service Z110-PREP-EMCSEND → The export message is formatted and prepared for transmission - [Route to USEXP Baskets for Container Types]
The system routes the export message → The message is routed to USEXP baskets for container-specific processing - [Set Export Message Keywords]
The system sets export message keywords → The message is tagged with appropriate keywords for export processing - [Format Export Subject Line]
The system formats the export subject line → The subject line contains formatted cargo and export operation information - [Route to Default USEXP User]
The system routes to the default USEXP user → The export message is assigned to the default USEXP user for processing - [Send Export Notification Message]
The system sends the export notification message → The export notification is transmitted to the designated user - [Log Export Message Transaction]
The system logs the export message transaction → The export message transaction is recorded in the system logs - [Train Arrival Event Received]
The system processes the V9 event segment → The system identifies the event type and prepares for appropriate arrival or cancellation processing - [POD - Train Arrived at Port]
If the disposition code → The system sets arrival processing flags and prepares port arrival notification - [AAD - Train Arrived at Destination]
If the disposition code → The system sets arrival processing flags and prepares destination arrival notification - [COC - Cancel Train Arrival]
If the disposition code → The system sets cancellation processing flags and prepares arrival cancellation notification - [Set Arrival Message Type]
The system prepares message routing configuration → The system sets arrival message type flag and configures routing parameters - [Set Cancellation Message Type]
The system prepares message routing configuration → The system sets cancellation message type flag and configures routing parameters - [Prepare USCS Arrival Message]
The system formats the notification message → The system creates a properly formatted USCS arrival message with train and location details - [Prepare USCS Cancellation Message]
The system formats the notification message → The system creates a properly formatted USCS cancellation message with train and location details - [Format Message Content]
The system formats the message content → The system structures the message with proper headers, data fields, and formatting requirements - [Include Train Information]
The system adds train-specific information → The system includes train ID, vessel name, and current status in the message - [Include Port/Destination Details]
The system adds location details → The system includes appropriate port or destination information based on the event type (POD/AAD) - [Include Timestamp Information]
The system adds temporal information → The system includes event date, time, and timezone information in the notification message - [Message Routing Required?]
If routing requirements → The system determines if the message should be routed to USCS, brokers, or payer of freight based on message type and content - [Route to USCS System]
The system initiates USCS routing → The system sends the notification message to USCS system endpoints - [Route to Broker Notifications]
The system initiates broker routing → The system sends the notification message to identified brokers via configured communication channels - [Route to Payer of Freight]
The system initiates payer of freight routing → The system sends the notification message to payer of freight contacts via configured communication channels - [Send Arrival Notification]
The system transmits the arrival notification → The system successfully sends arrival messages to USCS, brokers, and payer of freight as configured - [Send Cancellation Notification]
The system transmits the cancellation notification → The system successfully sends cancellation messages to USCS, brokers, and payer of freight as configured - [Log Message Activity]
The system performs activity logging → The system records message transmission details, recipients, timestamps, and status in audit logs - [Update Train Status]
The system updates train status → The system modifies train status to reflect current arrival state and processing completion - [Arrival Notification Complete]
The system finalizes arrival notification processing → The system marks the arrival notification process as complete and returns to main message processing flow - [Search for N101 Segments]
The system searches for payer of freight information → The system iterates through secondary records to find N101 segments containing payer codes - [Extract Payer of Freight Code]
The system processes the N101 segment → The system extracts the payer of freight code from the segment data - [Check if Code Starts with 'PF=']
The payer code does not start with 'PF=' → The system treats it as a standard payer code - [Build M10 Manifest Information]
M10 manifest data needs to be populated → Build the manifest structure with vessel name, voyage number, and transportation details from the X4 segment - [Master In-Bond Processing Types 61,62,63,69]
The entry type code is 61 (immediate transport), 62 (transport export), 63 (immediate export), or 69 (US-Canada-US movement) → Set the M1109 master in-bond flag and process according to the specific entry type requirements - [Map Transport Type Codes]
The entry type code needs to be mapped to transport type → Map code 61 to immediate transport, 62 to transport export, 63 to immediate export, and 69 to US-Canada-US movement - [Set Manifest Data Fields]
Manifest fields need to be populated → Set manifest data fields from X4 segment including arrival date, arrival time, and manifest reference numbers - [Set SCAC Code]
SCAC code needs to be assigned → Set the SCAC code from the X4 segment to identify the transportation carrier - [Set Vessel/Flight Information]
Vessel or flight information needs to be set → Set vessel name, voyage number, or flight details from the M10 manifest segment - [Set Quantity Information]
Quantity information needs to be populated → Set total quantity, release quantity, and unit of measure from the X4 segment data - [Extract SCAC Code from M10-02]
The system processes the M10 segment for manifest data integration → The SCAC code is extracted from M10-02 field and stored for carrier identification - [Extract Transport Type from M10-03]
The system processes the M10 segment for manifest data integration → The transport type is extracted from M10-03 field and stored for transportation mode identification - [Extract Country Code from M10-04]
The system processes the M10 segment for manifest data integration → The country code is extracted from M10-04 field and stored for origin country identification - [Extract Vessel Name from M10-05]
The system processes the M10 segment for manifest data integration → The vessel name is extracted from M10-05 field and stored for carrier vessel identification - [Extract Flight/Voyage Number from M10-06]
The system processes the M10 segment for manifest data integration → The flight/voyage number is extracted from M10-06 field and stored for trip identification - [Extract Quantity from M10-07]
The system processes the M10 segment for manifest data integration → The quantity is extracted from M10-07 field and stored for cargo quantity tracking - [Extract Manifest Type Code from M10-08]
The system processes the M10 segment for manifest data integration → The manifest type code is extracted from M10-08 field and stored for manifest classification - [Extract Condition Response Code from M10-09]
The system processes the M10 segment for manifest data integration → The condition response code is extracted from M10-09 field and stored for manifest condition tracking - [Format Standard Disposition Message]
The system processes the message formatting request → The system creates a standard disposition message format with disposition code and cargo details - [Format Broker Bond Message]
The system processes the message formatting request → The system creates a broker bond message format with bond-specific information - [Add Disposition Code Information]
The system adds disposition code details to the message → The message includes the disposition code value and related processing information - [Add Disposition Description]
The system adds disposition description to the message → The message includes the descriptive text explaining the disposition code meaning - [Format Add Quantity Message]
The system formats the quantity action message → The message indicates that the specified quantity will be added to the cargo release amount - [Format Subtract Quantity Message]
The system formats the quantity action message → The message indicates that the specified quantity will be subtracted from the cargo release amount - [Format No Quantity Change Message]
The system formats the quantity action message → The message indicates that no quantity changes will be made to the cargo - [Include Entry Number Information]
The system includes entry number information in the message → The message contains the entry number for customs reference and tracking - [Add First K1 Comment]
The system adds the first K1 comment to the message → The message includes the first K1 comment text for additional context - [Add Second K1 Comment]
The system adds the second K1 comment to the message → The message includes the second K1 comment text for additional context - [Add Third K1 Comment]
The system adds the third K1 comment to the message → The message includes the third K1 comment text for additional context - [Add Fourth K1 Comment]
The system adds the fourth K1 comment to the message → The message includes the fourth K1 comment text for additional context - [Format Cargo Details]
The system formats cargo details for the message → The message includes formatted cargo identification and tracking information - [Add Car ID Information]
The system adds car ID information to the message → The message includes the railroad car identification for equipment tracking - [Add Waybill Information]
The system adds waybill information to the message → The message includes the waybill number for shipment tracking and reference - [Add US-CCN Information]
The system adds US-CCN information to the message → The message includes the US Customs Control Number for customs tracking and processing - [Add Processing Timestamp]
The system adds processing timestamp to the message → The message includes the current processing date and time for audit trail - [Finalize Message Format]
The system finalizes the message format → The message is properly formatted and ready for transmission to recipients - [Format ADD Quantity Message]
The system formats the quantity action message → A message is created showing the quantity that will be added to the release quantity - [Format SUBTRACT Quantity Message]
The system formats the quantity action message → A message is created showing the quantity that will be subtracted from the release quantity - [Format Quantity Action Display Message]
The system formats the quantity action display message → A formatted message is created containing all relevant quantity action information - [Include Current Released Quantity]
The system includes current quantity information → The current released quantity is added to the message for broker reference - [Include Broker Entry Number]
The system includes entry number information → The broker entry number is added to the message for cargo identification - [Include Quantity Change Amount]
The system includes the quantity change details → The exact amount being added or subtracted is included in the message - [Add to Merlin Message Buffer]
The system adds the message to the Merlin buffer → The message is appended to the buffer for subsequent transmission - [Continue Message Processing]
The system continues with message processing → Control returns to the main message processing flow for additional processing steps - [Processing Context?]
If the current processing context → The system routes K1 processing to either train-level operations or cargo-level operations based on the context - [Store K1 Comment in Train Log]
The system processes the K1 segment → The K1 comment is stored in the train log for future reference - [Add K1 Comment to Array]
The system processes the K1 comment → The K1 comment is added to the comment array for inclusion in messages - [Message Type?]
If the message type (Release, Hold, Status, or Error) → The system routes K1 comment formatting to the appropriate message type handler - [Format Free-Form Text]
The system formats the K1 comments for message inclusion → The K1 comments are formatted as free-form text appropriate for the specific message type - [Append to Message Body]
The system prepares the final message for transmission → The formatted K1 comments are appended to the message body - [Message from Canadian Pacific Entity?]
If the message source entity → The message is classified as either Canadian Pacific entity or standard entity for appropriate processing path - [Identify Broker-Created Bond]
The system analyzes the bond creation source → The bond is identified as broker-created and flagged for special handling - [Extract Bond Information]
The system processes the bond message content → Bond control numbers, broker information, and related bond details are extracted and stored - [Format Special Bond Message]
The system prepares the notification message → The message is formatted with special bond message structure including bond control numbers and broker details - [Apply Canadian Pacific Formatting Rules]
The message is from Canadian Pacific entity → Canadian Pacific specific formatting rules are applied including entity-specific message structure and content requirements - [Prepare Bond Notification]
The system finalizes the notification preparation → The bond notification is prepared with complete formatting, bond details, and ready for routing - [Route to Merlin Message System]
The system routes the message for delivery → The notification is sent to the Merlin message system for final delivery to appropriate recipients - [Standard Message Processing]
The system determines the processing path → The message is processed through standard message handling procedures without special bond formatting - [Prepare Status for Integration Service Call]
The system prepares the status for integration service transmission → The system formats and packages the status description for external integration service call - [Extract Notification Settings]
The system processes notification setting fields → The system extracts and stores broker notification settings for message routing - [Format Email Message]
The system prepares the message content → The system formats the message with cargo information, disposition codes, quantities, and broker-specific details for email delivery - [Set Email Keywords for Categorization]
The system prepares email routing parameters → The system sets appropriate keywords and categories based on message type and content for email gateway processing - [Format Merlin Message]
The system prepares the message content → The system formats the message with cargo information, disposition codes, quantities, and broker-specific details according to Merlin message standards - [Set Merlin User Codes]
The system prepares Merlin routing parameters → The system sets appropriate user codes, destination identifiers, and routing parameters based on broker location and message type - [Send via Email Gateway]
The system initiates email transmission → The system sends the notification through the email gateway to the broker's configured email address - [Send via Merlin Gateway]
The system initiates Merlin transmission → The system sends the notification through the Merlin gateway to the broker's configured Merlin user ID - [Log Routing Decision]
The transmission is completed → The system logs the routing method used, broker information, message type, and transmission status for audit trail - [Access Cargo Secondary Records GCSA2RT Segment]
The system needs to access secondary cargo information → The system retrieves GCSA2RT segment data from cargo secondary records - [Read N101 Segments from Secondary Records]
The system reads N101 segments from secondary records → The system retrieves N101 segment data for entity identification processing - [Check N101-01 Qualifier for Payer of Freight]
The system checks the N101-01 qualifier field → The system identifies the entity type for further processing based on the qualifier value - [Extract Payer of Freight Entity Information]
The system extracts payer of freight entity information → The system retrieves the payer entity identification data from the N101 segment - [Store Payer Entity ID in Working Storage]
The system stores the payer entity ID → The payer entity identification is saved in working storage for broker lookup processing - [Continue Search for Additional N101 Records]
The system continues searching for additional N101 records → The system examines remaining secondary records for more N101 segments - [More N101 Records?]
The system checks for more N101 records → The system determines if additional N101 records exist for processing or if the search should conclude - [Info Message Type]
The message type is identified as INFO → The system should set info message keywords and route the message to 'IN' destination and station-specific Merlin IDs - [Unrelease Message Type]
The message type is identified as UNRLSE (unrelease) → The system should set unrelease message keywords and route the message to cancel-specific Merlin IDs - [Release Message Type]
The message type is identified as RLSE (release) → The system should set release message keywords and route the message to station-specific Merlin IDs only - [Export Message Type]
The message type is identified as EXPORT → The system should set export message keywords and proceed to container type validation for appropriate routing - [Container Type Check]
The equipment type is container or trailer → The system should route the message to USEXP baskets for specialized container/trailer processing - [Container Type Check]
The equipment type is not container or trailer → The system should route the message to standard export users for general export processing - [Format Subject Line Based on Content]
The message content and type are determined → The system should format an appropriate subject line that reflects the message content and type - [Apply Message Categorization]
Message categorization needs to be applied → The system should apply the appropriate message category based on message type and content - [Prepare Final Email Message]
Final email preparation is required → The system should prepare the complete email message with all necessary headers, content, and routing information - [Route to Primary User]
The system processes the routing request → The error message is routed to the primary user destination - [Additional Recipients Required?]
If the message type and routing requirements → The system determines whether additional recipients are required for this message type - [Identify Secondary Recipients]
The system processes the secondary recipient identification logic → The system identifies all secondary recipients that should receive the error message - [Add Valid Secondary User to Route List]
The system processes the routing list update → The valid secondary user is added to the message routing list - [Set Message Keywords for Categorization]
The system processes message categorization requirements → Appropriate keywords are set for message categorization and proper routing - [Export Container Type?]
If the message content and type → The system determines if this is an export container type message - [Route to USEXP Basket]
The system processes the specialized routing requirement → The message is routed to the USEXP basket for export container processing - [Send Message to All Valid Destinations]
The system executes the message delivery process → The error message is successfully sent to all valid destinations in the routing list - [Log Routing Information]
The system processes the logging requirements → Routing information including destinations and delivery status is logged for audit purposes - [Set Info Message Keywords]
The system processes cargo status updates or general information messages → The system sets keywords 'CARGO_INFO' and 'STATUS_UPDATE' to ensure informational messages are routed to appropriate monitoring systems - [Set Unrelease Message Keywords]
The system processes messages that apply holds to cargo or reverse previous release actions → The system sets keywords 'UNRELEASE' and 'HOLD_APPLIED' to ensure hold notifications are properly categorized and routed - [Set Release Message Keywords]
The system processes messages that release cargo for movement or clear cargo holds → The system sets keywords 'RELEASE' and 'CARGO_CLEARED' to ensure release notifications are properly identified and routed - [Set Export Message Keywords]
The system processes messages related to cargo export operations or US export procedures → The system sets keywords 'EXPORT' and 'USEXP' to ensure export-related messages are properly categorized for customs and export processing systems - [Set Hold Message Keywords]
The system processes messages that place cargo on hold for customs examination or inspection → The system sets keywords 'HOLD' and 'EXAMINATION' to ensure hold notifications are properly routed to examination and inspection systems - [Set Broker Notification Keywords]
The system processes messages that notify brokers of quantity mismatches or other cargo-related issues → The system sets keywords 'BROKER' and 'QUANTITY_MISMATCH' to ensure broker notifications are properly categorized and delivered - [Set Train Operation Keywords]
The system processes messages related to train arrivals, train holds, or other train operational events → The system sets keywords 'TRAIN_ARRIVAL' and 'TRAIN_HOLD' to ensure train operation messages are properly categorized for train management systems - [Apply Container Type Keywords]
The system identifies the container or equipment type associated with the cargo → The system applies additional container type keywords to enhance message categorization and routing specificity - [Apply Disposition Code Keywords]
The system identifies the disposition code associated with the cargo processing action → The system applies disposition code keywords to provide additional context for message routing and processing - [Apply Cargo Status Keywords]
The system determines the current status of the cargo (held, released, in-transit, etc.) → The system applies cargo status keywords to indicate the current state of the cargo for proper message handling - [Set Routing Priority Keywords]
If the urgency and priority level of the message based on cargo status and disposition codes → The system sets routing priority keywords to ensure high-priority messages are processed and delivered with appropriate urgency - [Set User Category Keywords]
The system determines the appropriate recipient categories (brokers, customs officers, train operators, etc.) → The system sets user category keywords to ensure messages are delivered to the correct recipient groups - [Finalize Email Keywords]
The system has completed all keyword assignment steps → The system finalizes the complete set of email keywords to prepare the message for routing and delivery - [Determine Message Type]
If the message content and context → The message type is determined as one of: Error, Info, Release, Hold, Export, or Unrelease - [Info Message Subject]
The message routing process is executed → The message is sent to 'IN' destination and station-specific Merlin IDs with info-specific subject formatting - [Release Message Subject]
The message routing process is executed → The message is sent to station-specific Merlin IDs only with release-specific subject formatting - [Unrelease Message Subject]
The message routing process is executed → The message is sent to default and cancel-specific Merlin IDs with unrelease-specific subject formatting - [Export Message Subject]
The message routing process is executed and equipment type is validated → The message is sent with export-specific subject formatting after equipment type validation - [Message Type?]
If the message type → The message is classified as Error, Info, Unrelease, Release, or Export type for appropriate routing - [Set Info Message Routing]
The system configures routing destinations → The message is set to route to 'IN' destination and station-specific Merlin IDs - [Set Unrelease Message Routing]
The system configures routing destinations → The message is set to route with default Merlin IDs and cancel-specific Merlin IDs - [Set Release Message Routing]
The system configures routing destinations → The message is set to route to station-specific Merlin IDs only - [Route to Primary Destination]
The system routes the message → The message is routed to multiple destinations using the valid user code - [Container Type Specific?]
If the message is container type specific → Container type specific messages are routed to USEXP basket and non-container type messages are routed to standard basket - [Route to USEXP Basket]
The system routes the export message → The message is routed to the USEXP basket for specialized container processing - [Route to Standard Basket]
The system routes the message → The message is routed to the standard basket for general processing - [Set Message Keywords]
The system processes the message for final formatting → Appropriate keywords are assigned to the message for categorization - [Format Subject Line]
The system formats the message for delivery → The subject line is formatted according to the message type and content requirements - [Message Type = INFO?]
The system checks the message type → If message type equals INFO, proceed with info message distribution, otherwise skip info message processing - [Retrieve Configured User List]
The system needs to identify message recipients → Retrieve configured user list from GCSTBRT user configuration table for info message distribution - [Set Message Keywords for Categorization]
The system prepares the message for distribution → Set message keywords and categories based on message routing tables to enable proper message classification - [Format Subject Line for Info Message]
The system prepares the message subject line → Format subject line for info message according to business message formatting standards - [Send Message to Configured User]
The system delivers the informational message → Send message to the configured valid user - [Route to Default User with Notification]
The system needs to deliver the informational message → Route message to default user and include notification about invalid user configuration - [More Users to Process?]
The system checks for remaining users in the list → If more users exist in configured list, continue processing next user, otherwise proceed to message distribution logging - [Log Message Distribution]
The system completes info message distribution → Log message distribution details including recipients and delivery status - [Message Type = Unrelease?]
If the message type → The system identifies whether the message is an unrelease type and routes accordingly or completes processing for non-unrelease messages - [Set Unrelease Message Keywords]
The system prepares the message for routing → The system sets appropriate unrelease-specific keywords and message identifiers - [Determine Target Baskets]
If routing requirements → The system determines the appropriate target baskets for message delivery - [Multiple Destinations?]
If the number of required destinations → The system routes to either a single primary basket or multiple baskets based on the destination count - [Route to Primary Basket]
The primary basket has been identified → The system routes the unrelease message to the primary basket only - [Route to Multiple Baskets]
Multiple target baskets have been identified → The system routes the unrelease message to all designated baskets - [Route to Specified User]
The system processes user-specific routing → The system routes the unrelease message to the specified user - [Route to Default User]
The system processes default routing → The system routes the unrelease message to the default user - [Add User Code to Routing]
The system prepares routing information → The system adds the appropriate user code to the message routing configuration - [Additional Users Required?]
If additional user requirements → The system either adds secondary users or proceeds to set message priority based on requirements - [Add Secondary Users]
Secondary users are identified → The system adds all required secondary users to the message routing - [Set Message Priority]
The system configures message properties → The system sets the appropriate priority level for the unrelease message - [Format Subject Line for Unrelease]
The system prepares the message for delivery → The system formats the subject line with unrelease-specific information and identifiers - [Send Message to Basket]
The system executes message delivery → The system sends the message to all designated baskets and users - [Log Message Routing]
The system completes message delivery → The system logs the routing activity including destinations, users, and delivery status - [Message Routing Complete]
All routing activities are complete → The system marks the unrelease message routing as complete and returns control to the calling process - [Message Type Check]
If the message content and cargo status → The message is classified as either release, export, arrival, or cancellation type for proper routing - [Set Release Message Type]
The system processes the release action (release, export, arrival, or cancellation) → The appropriate message type flag is set to control downstream message formatting and routing - [Determine Target Users]
If broker configuration and payer of freight details → Target users are identified including cargo broker, payer of freight broker, and configured notification recipients - [Route to Configured Users]
The system processes the release message for delivery → Messages are routed to configured users based on their notification preferences - [Route to Default Users]
The system attempts to deliver release notifications → Messages are routed to default notification recipients to ensure delivery - [Email or Merlin?]
If user notification preferences and message characteristics → The appropriate delivery method (email or Merlin) is selected for each recipient - [Prepare Email Message]
The system prepares the message for email transmission → Email headers, subject line, and message body are formatted according to email standards - [Prepare Merlin Message]
The system prepares the message for Merlin transmission → Merlin message format, routing codes, and destination identifiers are properly configured - [Set Message Keywords]
The system processes message content for keyword assignment → Relevant keywords are assigned based on message type, cargo details, and disposition codes - [Format Subject Line]
The system formats the message subject line → Subject line includes cargo identifier, disposition code, and action type for easy identification - [Add Cargo Details]
The system adds cargo details to the message body → Cargo details including CCN, car ID, waybill number, and shipment information are included in the message - [Add Disposition Codes]
The system processes disposition code information for inclusion → Disposition codes and their business descriptions are added to provide context for the release action - [Add Quantity Information]
The system adds quantity details to the release message → Released quantities, total quantities, and remaining quantities are included to show the impact of the release action - [Add K1 Comments]
The system processes K1 comments for message inclusion → K1 remarks and special comments are added to provide additional context and instructions - [Send to Release Basket]
The system processes the message for release basket distribution → Message is sent to the release basket for general access and record keeping - [Send to Broker]
The system processes broker notification requirements → Release message is sent directly to the cargo broker using their configured notification method - [Send to Payer of Freight]
If payer of freight notification requirements → Release message is sent to the payer of freight if they differ from the cargo broker - [Log Message Distribution]
The system processes logging requirements for the distribution activity → Distribution details including recipients, delivery methods, and timestamps are logged for audit purposes - [Message Distribution Complete]
The system finalizes the distribution process → Distribution process is marked as complete and control returns to the calling process - [Set Export Message Keywords]
The system prepares the export message for USEXP processing → Appropriate export message keywords are set based on container type and export requirements - [Format Export Message Content]
The system formats the message content with cargo details, container information, and export requirements → The export message is properly formatted with all required fields for USEXP basket processing - [Determine Destination Basket]
If export processing type, customs clearance requirements, and documentation needs → The appropriate USEXP basket is selected from export processing, customs clearance, or documentation baskets - [Send to USEXP Processing]
The system transmits the export message to the selected USEXP basket → The export message is successfully sent to USEXP processing for customs clearance and documentation - [Route to Standard Export Processing]
The system processes the export message for non-USEXP qualified containers → The export message is routed to standard export processing workflows - [Log Export Message Routing]
The routing decision is completed → The system logs the routing decision, destination, container type, and processing path for audit purposes - [Route Message to Original User]
The user validation check passes → The message is routed to the original intended user - [Identify Message Type]
The user validation check fails → The system identifies the message type for appropriate rerouting - [Route to Default Info Users]
The message type is determined to be an informational message → The message is routed to the default info users - [Route to Default Release Users]
The message type is determined to be a release message → The message is routed to the default release users - [Route to Default Export Users]
The message type is determined to be an export message → The message is routed to the default export users - [Log Invalid User Notification]
The message rerouting is completed → The system logs an invalid user notification for audit purposes - [Update Message Routing History]
The logging process is completed → The system updates the message routing history with the rerouting details - [Send Notification to System Admin]
The routing history update is completed → A notification is sent to the system administrator about the invalid user incident - [Prepare Log Message with Cargo Details]
The system needs to create an audit log entry → The system prepares a detailed log message containing cargo identification, processing context, and transaction details - [Include Security Information]
Security information needs to be captured for audit purposes → The system includes current user security context, authentication details, and access permissions in the log entry - [Gather Security Information]
Security information needs to be gathered for audit purposes → The system collects user ID, terminal ID, and security level and includes them in the log message structure - [Collect Transaction Details]
Transaction details need to be collected for the log message → The system captures transaction type, processing mode, and message source and formats them for inclusion in the log - [Format Cargo Processing Information]
Cargo information needs to be formatted for the log message → The system formats cargo ID information, status changes, and quantity details into the appropriate log message structure - [Include Disposition Code Details]
Disposition code details need to be included in the log message → The system includes the disposition code, its description, and the processing action taken in the log message - [Add Timestamp Information]
Timestamp information needs to be added to the log → The system adds processing date, processing time, and system timestamp to provide complete temporal context - [Set User and Terminal Context]
User and terminal context needs to be established → The system sets the user context and terminal context information in the log message structure - [Format Log Message Structure]
The log message structure needs to be formatted → The system formats all components into a standardized log message structure ready for transmission - [Set Message Priority and Type]
Message priority and type need to be assigned → The system sets the appropriate priority level and message type based on the transaction characteristics and business rules - [Prepare for GCT1051E Spawn]
The message needs to be prepared for GCT1051E spawn → The system prepares the message for GCT1051E transmission, excluding disposition codes 54 and 55 from the logging process - [Log Message Ready for Transmission]
The message readiness needs to be confirmed → The system confirms the log message is complete, properly formatted, and ready for transmission to the logging system - [Prepare Log Message]
The system prepares the log message with cargo information, disposition codes, and processing context → A complete audit log message is formatted with all required business information - [Set Security Information]
The system sets security information including user context and access credentials → Security information is properly assigned to the audit trail record - [Display 'No Waybill' Message]
The system processes the waybill display requirement → The system displays 'No Waybill' message in the waybill field - [Include in Report Output]
The system generates the report output → The waybill information is included in the report - [Log Code Not Found Warning]
The code is not found in the reference data → A warning message is logged indicating the missing code - [Capture Current System Date]
The system begins processing any segment or transaction → The current system date is captured and stored for timestamping purposes - [Capture Current System Time]
The system begins processing any segment or transaction → The current system time is captured and stored for timestamping purposes - [Add Timestamp to Segment Header]
The segment processing begins → The timestamp is added to the segment header for audit purposes - [Store Timestamp in Message Fields]
Message processing requires timestamp information → Timestamps are stored in the designated message fields - [Retrieve Broker Entry Number from X4 Segment]
The system needs to display quantity information for broker notification → The broker entry number is retrieved from the X4-04 field of the segment - [Generate Quantity Mismatch Message]
The final notification message needs to be generated → A complete mismatch message is generated containing entry number, manifest quantity, released quantity, and difference information - [Route Message to Broker Notification]
The message needs to be delivered to the broker → The message is routed to the broker notification system for delivery via the appropriate communication channel - [Get Message from Queue]
Message retrieval is requested → System attempts to get the next message from the queue - [Message Available?]
Message availability is checked → If message is available, proceed to process message; if no message available, close queue and complete processing - [Calculate Message Length]
Message length calculation is performed → Message length is calculated and stored for subsequent processing steps - [Determine Entry Count]
Entry count determination is required → Number of entries in the message is calculated based on message structure and length - [Message Valid?]
Message validity is evaluated → If message is valid, store in array and update counter; if invalid, handle message error and continue to next message - [Store Message in Array]
Message storage is required → Valid message is stored in the message processing array - [Update Message Counter]
Message counter update is required → Message processing counter is incremented to reflect successful message storage - [More Messages?]
Additional message check is performed → If more messages exist, continue reading from queue; if no more messages, proceed to close queue - [Close MQ Queue]
Queue closure is required → MQ queue is properly closed to release system resources - [Set Processing Complete Flag]
Processing completion status is required → Processing complete flag is set to indicate successful completion of queue reading - [Calculate Message Length]
The system needs to determine message structure for array initialization → The message length is calculated by subtracting 4 from the total message buffer length - [Calculate Number of EDI Segment Entries]
The system needs to initialize the message array structure → The number of EDI segment entries is calculated by dividing message length by 80 - [Set Array Entry Count]
The message array structure needs to be configured → The array entry count is set to the calculated number of EDI segment entries - [Message Source?]
If the message source type → The system identifies whether the message comes from MQ Queue or Direct Input source - [Set Train Operation Flags]
The system prepares for train operations → The system sets appropriate train operation flags for the current processing session - [Load M10 Manifest Segment]
The system processes train manifest data → The system loads M10 segment with train identification and manifest details - [Load V9 Event Detail Segment]
The system processes train event data → The system loads V9 segment with event details and status change information - [Train Arrival Message?]
If the event type in the V9 segment → The system identifies whether the message indicates a train arrival event (POD or AAD codes) - [Set Arrival Processing Mode]
The system prepares for arrival processing → The system sets arrival processing mode flags and configures arrival-specific processing parameters - [Train Cancellation Message?]
If the event type for cancellation indicators → The system identifies whether the message indicates a train cancellation event (COC code) - [Set Cancellation Processing Mode]
The system prepares for cancellation processing → The system sets cancellation processing mode flags and configures cancellation-specific processing parameters - [Set Default Train Processing Mode]
The system prepares for standard train processing → The system sets default train processing mode for standard train operations - [Message Valid?]
If validation results → The system determines whether the message structure is valid and contains all required data elements - [Set Message Ready Flag]
The system confirms message validity → The system sets message ready flag to indicate the train message is prepared for business processing - [Log Train Message Initialization]
The system completes train message initialization → The system logs the successful initialization with message details and processing mode information - [Establish MQ Connection]
MQ connection is initiated → Connection is established and ready for queue operations - [Get Message from Queue]
Message retrieval is initiated → Message is retrieved from queue for processing - [Message Available?]
Message availability is checked → If message is available, calculate message length; if no message available, check for more messages - [Calculate Message Length]
Message length calculation is performed → Message length is determined for proper processing - [Calculate Entry Count]
Entry count calculation is performed → Number of message entries is determined for array initialization - [Process Variable-Length Message]
Variable-length message processing is performed → Message content is parsed and stored in message array - [More Messages?]
Additional message availability is checked → If more messages exist, continue message retrieval; if no more messages, close queue - [Close MQ Queue]
Queue closure is initiated → Message queue is properly closed - [Calculate Message Length]
The system needs to determine message boundaries → Message length is calculated and validated for further processing - [Determine Number of EDI Segment Entries]
The system processes the message content → The number of EDI segment entries is determined based on message structure and length - [Calculate Entry Count Based on Structure]
The system analyzes message content for entry counting → Entry count is calculated based on message structure parameters and segment boundaries - [Process Variable-Length Message Content]
The system processes the message content → Variable-length content is processed appropriately regardless of actual message size - [Train Message Type?]
If message type indicators → Train-specific processing is initiated if message is train-related, otherwise standard processing applies - [Set M10 and V9 Segment Parameters]
The system sets up segment-specific parameters → M10 manifest segment and V9 event segment parameters are properly configured for train operations - [More Entries to Process?]
The system checks for remaining entries → Processing continues if more entries exist, otherwise array processing is completed - [Extract Next EDI Segment]
The system extracts the next segment → The next EDI segment is retrieved and prepared for validation and processing - [Segment Valid?]
If segment validity → Valid segments are queued for processing while invalid segments trigger error logging - [Add Segment to Processing Queue]
The system adds the segment to processing queue → Segment is queued for business processing and made available for subsequent operations - [Complete Array Processing]
The system completes array processing → Processing results are consolidated and prepared for return to calling process - [Return Processed Message Data]
The system returns processing results → Processed message data and status information are returned to the calling process - [Message Type?]
If the message type and processing requirements → The message is classified as multi-manifest, train operations, or standard processing based on message characteristics - [Multi-manifest Processing Required]
The message contains lead manifest information with associated follower manifests → The system initiates multi-manifest processing workflow - [Train Message Processing Required]
The message contains train arrival, cancellation, or status change information → The system routes the message to train-specific processing workflow - [Standard Message Processing Required]
The message is neither multi-manifest nor train operations type → The system routes the message to standard processing workflow - [Format EDI 350 Message for Each Follower]
The system prepares transaction messages for each follower → Each follower manifest gets an EDI 350 message with action code '350', disposition code, quantity, and entry number from the X4 segment - [Prepare Train Arrival/Cancellation Message]
The system prepares train arrival or cancellation parameters → Train message parameters are formatted with vessel name, event codes, and timing information - [Set Transaction Parameters]
The system sets transaction parameters for GCT0161E spawning → Transaction parameters are configured with message type, processing mode, and target transaction identifier - [Spawn GCT0161E Transaction]
The system attempts to spawn GCT0161E transaction → GCT0161E transaction is spawned with the prepared message parameters and processing begins - [Continue with Next Message]
The system is ready to process the next message → Processing continues with the next available message from the queue - [Receive EDI Shipment Request]
The system processes the message queue → The EDI shipment request is received and made available for processing - [Extract Shipment Root ID from EDI Message]
The system processes the EDI message content → The shipment root ID is extracted from the message and made available for database lookup - [Query Shipment Database]
The system performs a database lookup → The system searches for the corresponding shipment root record in the database - [Shiproot Active and Valid?]
If the status and validation criteria → The system determines if the shiproot is active and valid, allowing EDI processing to continue or triggering rejection - [Allow EDI Processing to Continue]
All validation checks pass successfully → The system allows EDI processing to continue with the validated shipment root - [Create U1 Segment with In-Bond Information]
The system processes the validated shipment root → A U1 segment is created with appropriate in-bond information for the shipment - [Log Shiproot Validation Success]
The U1 segment has been created → The system logs the successful validation event with appropriate details - [Reject EDI Processing Request]
The system determines the shipment cannot be processed → The EDI processing request is rejected and error handling is initiated - [Retrieve In-Bond Information]
The system needs to create U1 segment with in-bond information → The system should retrieve all required in-bond transportation details from the shipment record - [Map CPRAIL Type Codes to EDI 309 Values]
The system processes type codes for U1 segment creation → The system should map each CPRAIL type code to its corresponding EDI 309 standard value using the type code translation table - [Create U1 Segment Structure]
The system creates U1 segment structure → The system should initialize U1 segment with proper field structure and data formatting requirements - [Populate In-Bond Details]
The system populates in-bond details into U1 segment → The system should populate all required in-bond fields including mapped type codes, transportation details, and reference information - [Insert/Replace U1 Segment in Database]
The system stores U1 segment in database → The system should insert new U1 segment if none exists or replace existing U1 segment with updated information - [Update Shipment Record]
The system updates the shipment record → The system should update shipment record status to indicate U1 segment processing completion - [Log Segment Processing]
The system logs segment processing → The system should create audit log entry documenting successful SHIPMINU segment processing with relevant details - [Lookup EDI 309 Mapping Table]
The system searches the EDI 309 mapping table → If mapping is found, the EDI 309 value is retrieved, otherwise a default value is used - [Convert CPRAIL Code to EDI 309 Value]
The conversion process is executed → The CPRAIL code is converted to the corresponding EDI 309 value - [Update U1 Segment with EDI 309 Code]
The U1 segment update is performed → The U1 segment contains the EDI 309 in-bond type code for further processing - [Set Default EDI 309 Value]
The mapping lookup fails → A default EDI 309 value is assigned and a mapping error is logged - [Log Successful Conversion]
The conversion process completes successfully → A success log entry is created documenting the conversion - [Search for N9 Reference Segments]
The system searches for N9 reference segments within the records → The system identifies and locates all N9 reference segments present in the secondary records - [Extract Reference Information]
The system processes the N9 segments → The system extracts all reference information contained within the N9 segments - [No N9 References Found]
No N9 segments are found in the secondary cargo records → The system completes processing without updating cargo records with reference information - [Segment Type?]
If the segment type → The system routes to appropriate segment handler for S09 Status, Cargo Root, Table Data, Secondary, Shipment, or Transmission segments - [Status Segments - S09]
The system processes the S09 segment type → The system accesses the GCSUSS09 database for status segment operations - [Cargo Root Segments]
The system processes the cargo root segment type → The system accesses the GCCC-CARGO-ROOT database for cargo segment operations - [Table Segments - GCSTBRT]
The system processes the GCSTBRT segment type → The system accesses the GCSTBRT database for table segment operations - [Secondary Segments - GCSA2RT]
The system processes the GCSA2RT segment type → The system accesses the GCSA2RT database for secondary segment operations - [Shipment Segments - U1]
The system processes the U1 segment type → The system accesses the appropriate database for shipment segment operations - [Transmission Segments - A9RT/A9DP]
The system processes A9RT or A9DP segment types → The system accesses the A9RT/A9DP database for transmission segment operations - [Set Default Values]
The system sets default values → The system prepares segment data with appropriate default values before database insertion - [Replace Existing Segment]
The system replaces an existing segment → The system executes the database call to update the existing segment - [Fetch Segment by Key]
The system fetches a segment by key → The system loads the segment into working storage and validates retrieved data - [Create Cross-border Log Message]
The system creates cross-border log message → System generates log message containing cargo release details, equipment information, and cross-border coordination status - [Update Canadian System Notification]
The system updates Canadian system notification → System calls GCX105 logging system to record cargo release information for Canadian coordination - [Set EDI Message Tracking Information]
The system sets up EDI message tracking → Message tracking information is established with unique identifiers and control data - [Assign Transmission Sequence Number]
The system assigns transmission sequence number → A unique sequential number is assigned to identify this specific transmission - [Set Message Type and Format]
The system sets message type and format → Message type and format are defined according to EDI standards and business requirements - [Set Transmission Date and Time]
The system sets transmission date and time → Current system date and time are recorded as transmission timestamp - [Create A9RT Transmission Root Segment]
The system creates A9RT transmission root segment → A9RT segment is created with complete transmission control information ready for database storage - [Store Root Segment to Database]
The system stores root segment to database → A9RT transmission root segment is successfully stored in the database with all control information - [Update Transmission Status]
The system updates transmission status → Transmission status is updated to indicate successful root segment creation and storage - [Log Transmission Creation]
The system logs transmission creation → Transmission creation event is logged with relevant details for audit and monitoring purposes - [Return Success Status]
The system returns success status → Success status is returned to calling process indicating successful transmission root segment creation - [Set Transmission Control Information]
Transmission control information needs to be established → The system must copy transmission control data including interchange control numbers and functional group identifiers to the dependent segment - [Copy EDI 350 Message Data]
The system processes EDI 350 message content → All relevant EDI 350 message data must be copied to the dependent segment maintaining data integrity and format - [Set Dependent Segment Key]
A dependent segment key needs to be established → The system must generate and assign a unique key combining transmission control information and segment identifiers - [Set Segment Sequence Number]
Segment sequence numbering is required → The system must assign sequential numbers to dependent segments starting from 1 and incrementing for each additional segment - [Copy Message Content to Segment]
Message content needs to be stored in the segment → The system must copy the complete message content including all data elements and segments to the dependent segment structure - [Set Segment Length Information]
Segment length calculation is required → The system must calculate and store the actual length of the message content in the segment length field - [Write Dependent Segment to A9DP]
The dependent segment is ready for storage → The system must write the dependent segment to the A9DP database with all populated fields and proper key structure - [Update Transmission Control Counters]
Transmission control counter update is required → The system must increment the segment count and update transmission control counters to reflect the new segment - [Increment Segment Sequence]
Preparation for next segment is required → The system must increment the segment sequence number by 1 to ensure proper ordering of subsequent segments - [More EDI Data to Process?]
The system checks for additional EDI data to process → If more EDI data exists, the system must return to copy EDI 350 message data step, otherwise proceed to completion - [Complete Dependent Segment Creation]
The dependent segment creation process reaches completion → The system must complete the process by setting final status indicators and returning control to the calling process - [Check Disposition Code for KCSM]
If KCSM EDI transmission is required for the disposition code → The system should determine whether to proceed with KCSM EDI transaction spawning or skip KCSM processing - [Retrieve KCSM Broker Information]
The system needs to retrieve broker details for EDI message formatting → The system should fetch broker information from GCSTBRT broker tables and make it available for transmission setup - [Create Transmission Root Segment]
The system needs to establish the EDI message structure foundation → The system should create an A9RT transmission root segment with proper identification and control parameters - [Set Transmission Control Parameters]
The system needs to configure transmission control settings → The system should set appropriate transmission control parameters including message type, sequence numbers, and processing flags - [Create Dependent Segments with EDI Data]
The system needs to populate EDI message content with cargo and disposition data → The system should create A9DP dependent segments containing formatted EDI data including cargo details, disposition codes, and transaction information - [Format Equipment Details from N7 Segments]
The system needs to include equipment details in the EDI transmission → The system should extract and format equipment information from N7 segments including car numbers, equipment types, and related identifiers - [Build Complete EDI 350 Message Copy]
The system needs to create the final EDI message structure → The system should build a complete EDI 350 message copy containing all root segments, dependent segments, and formatted data ready for transmission - [Set KCSM Transmission Parameters]
The system needs to configure KCSM-specific transmission settings → The system should set KCSM transmission parameters using AECWRKTB work table including destination routing, priority settings, and integration flags - [Spawn GCT1091E Transaction]
The system needs to initiate the actual EDI transmission process → The system should spawn GCT1091E transaction with the prepared EDI message and transmission parameters - [Log Transmission Details]
The system needs to record transmission activity → The system should log transmission details including message identifiers, timestamps, broker information, and processing status - [Queue EDI Message for KCSM]
The system needs to queue the message for KCSM delivery → The system should place the EDI message in the appropriate queue for KCSM system processing with proper routing and priority - [Update Transaction Status]
The system needs to update processing status → The system should update transaction status to indicate successful KCSM EDI integration completion - [Copy EDI 350 Message Segments]
The system prepares the message for KCSM transmission → All message segments must be copied to the transmission buffer maintaining segment structure and data integrity - [Create Transmission Root Segment]
The system creates the transmission root segment → The root segment must be formatted with proper transmission identifiers and control information from A9RT data - [Create Transmission Dependent Segments]
The system creates transmission dependent segments → All dependent segments must be created with proper sequencing and data from A9DP segments - [Format EDI Message for KCSM]
The system formats the EDI message for KCSM → The message must be formatted according to KCSM EDI standards with proper segment delimiters and structure - [Prepare Message Queue Entry]
The system prepares the message queue entry → The queue entry must include message data, transmission parameters, and routing information - [Call WRITMSGL to Queue Message]
The system calls WRITMSGL to queue the message → WRITMSGL must be invoked with the prepared message data and queue parameters - [Queue Operation Successful?]
The system checks the queue operation result → If the operation is successful, proceed to logging; if failed, initiate error handling - [Log Transmission Parameters]
The system logs transmission parameters → Transmission details including message ID, timestamp, and routing information must be logged - [Update Transmission Status]
The system updates transmission status → The status must be updated to indicate successful queuing and readiness for transmission - [Retry Queue Operation]
The system retries the queue operation → The same message must be resubmitted to the queue with identical parameters - [Log Queue Failure]
The system logs the queue failure → Failure details including error codes, message data, and retry attempts must be logged for troubleshooting - [KCSM Processing Required?]
If KCSM logging is needed → KCSM processing is required if broker is configured for KCSM transmission and message type requires logging - [Retrieve KCSM Broker Information]
The system needs broker information for transmission setup → Broker KCSM configuration data is retrieved from broker master records - [Create Transmission Root Segment]
A transmission root segment needs to be created → A9RT transmission root segment is created with transmission ID, broker ID, and timestamp - [Log Transmission Parameters]
Transmission parameters need to be logged → Transmission parameters including broker configuration, message type, and processing flags are recorded in A9RT segment - [Create Transmission Dependent Segment]
Detailed transmission information needs to be stored → A9DP transmission dependent segment is created with message details and cargo information - [Log EDI Message Details]
EDI message details need to be logged → Message content, structure, and cargo details are recorded in A9DP segment - [Prepare GCT1091E Transaction]
KCSM transmission transaction needs to be prepared → GCT1091E transaction is prepared with transmission segments, broker information, and message data - [Log Transaction Spawn Parameters]
Transaction spawn parameters need to be logged → Spawn parameters including transaction ID, broker ID, and message parameters are recorded in AECWRKTB work table - [Execute KCSM Transaction Spawn]
KCSM transaction needs to be executed → GCT1091E transaction is spawned to process KCSM transmission - [Log Success Status]
Success status needs to be logged → Success status and completion timestamp are recorded in transmission records - [Update Transmission Status]
Transmission status needs to be updated → Overall transmission status is updated to reflect success or failure in A9RT and A9DP segments - [Log Final Transmission Status]
Final transmission status needs to be logged → Final status, completion timestamp, and summary information are recorded for audit trail - [VID Segments Available?]
The system checks for available VID segments in the message → If VID segments are available, proceed to read VID segments, otherwise complete equipment hold processing - [Read Next VID Segment]
The system processes VID segments sequentially → Read the next VID segment from the message queue - [Extract Equipment ID from VID Segment]
The system processes the VID segment content → Extract the equipment ID information from the VID segment data - [Format Equipment ID using GCCCARFM]
The system needs to format the equipment ID for validation → Call GCCCARFM to format the equipment ID into standard format - [More VID Segments?]
The system checks for remaining VID segments → If more VID segments exist, continue processing next segment, otherwise proceed to update train hold status - [Update Train Hold Status]
The system finalizes equipment hold processing → Update the train hold status based on the number of equipment units held - [VID Segment Following HRE Code Detected]
The system processes the message segments in sequence → VID segments following HRE codes are identified for equipment release processing - [Extract Equipment ID from VID Segment]
The system processes the VID segment → Equipment ID is extracted from the VID segment for further processing - [Format Equipment ID using GCCCARFM]
The system needs to format the equipment ID → GCCCARFM utility is called to format the equipment ID to standard format - [Log Equipment Not Found in Held List]
The system cannot locate equipment in held list → Equipment not found in held list error is logged and processing continues with next VID segment - [Extract Equipment ID from VID Segment]
The system processes the VID segment → Extract the equipment ID from the VID segment data for validation and seizure processing - [Check if More VID Segments]
The system checks for additional VID segments → Determine if more VID segments are available for processing additional equipment seizures - [More VID Segments?]
If VID segment availability → If more VID segments exist, continue processing them, otherwise proceed to update overall train seizure status - [Update Train Seizure Status]
The system updates train seizure status → Update the train's overall seizure status based on the number of equipment items seized - [VID Segments Available?]
The system checks for available VID segments to process equipment seizure release → If VID segments are available, proceed to process equipment seizure release, otherwise complete the seizure release process - [Extract Equipment ID from VID Segment]
The system processes the VID segment → Extract the equipment ID from the VID segment data - [Equipment Found in Seized List?]
The system searches for the equipment in the train's seized equipment list → If equipment is found in the seized list, proceed to release it from seizure, otherwise no action is required as equipment is not currently seized - [More VID Segments?]
The system checks for additional VID segments → If more VID segments exist, continue processing the next VID segment, otherwise proceed to check train overall seizure status - [Any Equipment Still Seized?]
If the train's overall seizure status → If any equipment is still seized, keep train in seized status, otherwise release train from seizure status - [HMI - Hold Equipment]
The system processes the HMI disposition code for equipment hold → The equipment is added to the hold list AND the held equipment counter is incremented AND the train status is set to HELD - [HRE - Release Equipment]
The system processes the HRE disposition code for equipment release → The equipment is removed from the hold list AND the held equipment counter is decremented - [Extract Equipment ID from VID Segment]
The system processes the VID segment for equipment hold or release → The equipment ID is extracted from the VID segment data - [Format Equipment ID Using GCCCARFM]
The system needs to format the equipment ID for processing → The GCCCARFM program is called to format the equipment ID - [VID Segment with SEI Disposition Code Received]
The system processes the VID segment → The equipment ID is extracted from the VID segment and seizure processing is initiated - [VID Segment with SER Disposition Code Received]
The system processes the VID segment → The equipment ID is extracted from the VID segment and seizure release processing is initiated - [Train Found?]
The search results are evaluated → If train is found, proceed with pre-arrival processing; if not found, generate error message - [Process Port Information from P4 Segment]
The system processes the P4 segment data → The system extracts port codes, locations, and routing information for export processing - [Extract Train Arrival Port from M10 Segment]
The system processes the M10 segment to extract port information → The train arrival port code is extracted and made available for port configuration lookup - [Lookup Port Configuration in System Tables]
The system looks up the port configuration in GCSTBRT port configuration tables → The port configuration settings are retrieved and made available for export processing determination - [Set Train Arrival Date and Time]
The system processes the arrival timestamp → Set the train arrival date and time from the V9 segment or system timestamp - [Generate AEI Arrival Notification]
The system prepares external notifications → Generate AEI arrival notification message for transmission to external systems - [Send Arrival Confirmation Message]
The system prepares confirmation notifications → Send arrival confirmation message to appropriate stakeholders and systems - [Disposition Code?]
If the disposition code in the V9 segment → The system identifies POD (Port of Discharge) or AAD (Arrived at Destination) codes as valid train arrival events and routes to appropriate processing - [Log AEI Notification Activity]
The system completes the notification transmission process → The system logs the AEI notification activity including train ID, equipment details, notification timestamp, and transmission status - [Train Arrival Event Detected]
The system processes the V9 segment for event details → The train arrival event is identified and flagged for processing - [POD - Proof of Delivery]
The POD event is processed → The system initiates train arrival processing workflow - [AAD - Arrival at Destination]
The AAD event is processed → The system initiates train arrival processing workflow - [Send Arrival Notification]
Arrival notifications are sent → The system sends arrival messages to relevant stakeholders and systems - [Is Port = Laredo?]
The system checks the port location in the message → If port equals 'Laredo', proceed to KCSM disposition code lookup, otherwise skip KCSM processing - [Disposition Code Found in KCSM Table?]
The disposition code lookup result is evaluated → If disposition code is found in KCSM table, proceed to create transmission file, otherwise skip KCSM processing - [BBFB0: Copy EDI 350 to Transmission File]
System initiates transmission file creation process → Copy the complete EDI 350 message content to the transmission file - [Create Transmission Root Segment A9RT]
System creates transmission control structures → Generate A9RT transmission root segment with appropriate control information - [Create Transmission Dependent Segment A9DP]
System creates dependent transmission segments → Generate A9DP transmission dependent segment with EDI message content - [Set KCSM Processing Flag]
System completes KCSM transmission file preparation → Set KCSM processing flag to indicate successful KCSM integration completion - [Query AECWRKTB DB2 Table]
The system searches AECWRKTB table for the disposition code configuration → The system returns whether KCSM processing is required for this disposition code - [Format Search Key with Disposition Code]
The system prepares to search AECWRKTB table → The disposition code is formatted into the proper search key structure for table lookup - [Check if KCSM Processing Required]
The system checks the AECWRKTB KCSM configuration table for the disposition code → The system determines if KCSM processing is required based on the configuration entry - [Copy Original EDI Message Header]
The system creates a copy for KCSM transmission → The original message header data is copied exactly to the transmission copy maintaining all header fields and values - [Process ST Transaction Set Header]
The system processes the message for KCSM transmission → The ST segment is copied to the transmission file with proper formatting and sequence control - [Copy M10 Manifest Information Segment]
The system creates KCSM transmission copy → The M10 segment with all manifest information is copied to the transmission file - [Copy P4 Port Information Segment]
The system creates KCSM transmission copy → The P4 segment with all port information is copied to the transmission file - [Copy V9 Event Detail Segment]
The system creates KCSM transmission copy → The V9 segment with all event detail information is copied to the transmission file - [VID Equipment Segments Present?]
If the message structure for VID segments → If VID equipment segments are present, they are processed and copied, otherwise the system continues to the next segment type - [Copy VID Equipment Information]
The system processes VID segments for KCSM transmission → All VID equipment information is copied to the transmission file maintaining equipment details and relationships - [Copy K1 Remarks Segments]
The system creates KCSM transmission copy → All K1 remarks segments with their associated information are copied to the transmission file - [Copy X4 Customs Release Information]
The system creates KCSM transmission copy → The X4 segment with all customs release information including disposition codes is copied to the transmission file - [Copy N7 Equipment Details]
The system creates KCSM transmission copy → The N7 segment with all equipment details and specifications is copied to the transmission file - [Copy SE Transaction Set Trailer]
The system completes KCSM transmission copy creation → The SE trailer segment is copied to the transmission file with proper segment count and control number - [Format Message for KCSM Transmission]
The system formats the message for KCSM transmission → The message is formatted according to KCSM specifications with proper delimiters, segment terminators, and transmission structure - [Create Transmission Root Segment]
The system creates transmission control structures → A transmission root segment (A9RT) is created with proper control information, sequence numbers, and transmission identifiers - [Create Transmission Dependent Segments]
The system creates transmission dependent segments → Transmission dependent segments (A9DP) are created containing the EDI message data with proper linkage to the root segment - [Store EDI Copy in Transmission File]
The system stores the EDI copy in the transmission file → The EDI message copy is stored in the transmission file with proper indexing and control information for KCSM retrieval - [Mark Message Ready for KCSM Transmission]
The system completes the KCSM copy creation process → The message is marked with appropriate status indicators showing it is ready for KCSM transmission - [Skip KCSM Processing]
The system checks KCSM configuration requirements → KCSM processing is skipped and the system continues with normal message processing without creating transmission copies - [Validate Disposition Code in KCSM Table]
The system performs a lookup in the AECWRKTB KCSM configuration table → The system determines if the disposition code is configured for KCSM transmission - [Code Configured for KCSM?]
If the code is configured for KCSM processing → If configured, proceed with KCSM message copying; if not configured, skip KCSM processing - [Skip KCSM Processing]
The system determines KCSM processing is not required → The system skips all KCSM message copying activities and continues with normal processing - [Copy Original EDI 350 Message Structure]
The system begins copying the original EDI 350 message → The system creates an exact structural copy of the original message for KCSM processing - [Create Transmission Root Segment]
The system creates the transmission control structure → The system generates a transmission root segment using A9RT data for KCSM message identification and control - [Create Transmission Dependent Segments]
The system creates dependent transmission segments → The system generates transmission dependent segments using A9DP data for proper KCSM message structure - [Copy ST Transaction Header]
The system copies EDI transaction segments → The system copies the ST transaction header segment maintaining all original data for KCSM transmission - [Copy M10 Manifest Information]
The system copies manifest data segments → The system copies the M10 manifest information segment preserving all manifest details for KCSM transmission - [Copy P4 Port Information]
The system copies port data segments → The system copies the P4 port information segment maintaining all port details for KCSM transmission - [Copy V9 Event Details]
The system copies event data segments → The system copies the V9 event details segment preserving all event information for KCSM transmission - [Copy X4 Customs Release Information]
The system copies customs release data segments → The system copies the X4 customs release information segment maintaining all customs data for KCSM transmission - [Copy N7 Equipment Details]
The system copies equipment data segments → The system copies the N7 equipment details segment preserving all equipment information for KCSM transmission - [Copy K1 Remarks]
The system copies remarks data segments → The system copies the K1 remarks segment maintaining all remark information for KCSM transmission - [Copy SE Transaction Trailer]
The system copies transaction trailer segments → The system copies the SE transaction trailer segment completing the EDI message structure for KCSM transmission - [Format Message for KCSM Transmission]
The system formats the message for KCSM transmission → The system applies KCSM-specific formatting rules and transmission standards to the copied message - [Queue Message for KCSM System]
The system queues the message for KCSM delivery → The system places the formatted message in the KCSM transmission queue for delivery to the KCSM system - [Log KCSM Transmission Details]
The system logs the transmission activity → The system records KCSM transmission details including message identification, timestamp, and disposition code for audit tracking - [Complete KCSM Message Copy]
The system completes the KCSM message copying process → The system finalizes all KCSM processing activities and returns control to the main EDI 350 message processing workflow - [Search database for disposition codes configured for KCSM processing]
The port is Laredo AND the disposition code exists in the AECWRKTB database table → Set KCSM processing flag to Yes and continue with EDI message processing - [Check if Port is Laredo]
The port is not Laredo → Set KCSM processing flag to No and continue with EDI message processing - [Disposition Code Requires KCSM?]
If the disposition code configuration → The system determines whether KCSM transmission processing is required for this disposition code - [Retrieve Disposition Code from DC Table]
The system looks up the disposition code in the DC table → The system retrieves disposition code details including KCSM processing requirements and Merlin message configuration - [KCSM Processing Required?]
If all KCSM processing requirements → The system decides whether to proceed with KCSM transmission file creation or skip processing - [Create Transmission Root Segment A9RT]
The system creates the transmission file structure → The system creates an A9RT root segment with transmission control information and unique identifiers - [Set Transmission Control Information]
The system sets up transmission control parameters → The system assigns transmission sequence numbers, control codes, and identification information for KCSM processing - [Copy EDI 350 Message Segments]
The system processes the original EDI 350 message → The system copies relevant message segments including X4, N7, and other required segments to the KCSM transmission structure - [Create Transmission Dependent Segment A9DP]
The system creates transmission dependent segments → The system creates A9DP segments containing the copied EDI segment data with proper sequencing and linkage to the root segment - [Store EDI Segment Data]
The system stores EDI segment data → The system stores each EDI segment with proper sequence numbers and maintains data integrity for KCSM processing - [Set Transmission File Properties]
The system sets transmission file properties → The system configures file status, creation timestamps, processing indicators, and other metadata required for KCSM integration - [Write Transmission Segments to Database]
The system writes transmission segments to the database → The system stores the A9RT root segment and all A9DP dependent segments to the database with proper relationships and indexing - [Prepare KCSM Integration Message]
The system prepares KCSM integration message → The system creates notification message containing transmission file identifiers and processing instructions for KCSM system - [Queue Message for KCSM System]
The system queues the message for KCSM system → The system places the message in the appropriate queue for KCSM system processing with proper priority and routing - [Log Transmission Details]
The system logs transmission details → The system records transmission file creation details including timestamps, segment counts, and processing status for audit trail - [Skip KCSM Processing]
The disposition code does not require KCSM processing:- KCSM is not configured for the port
- [Extract K1 Free-form Comment Text]
The system processes the K1 segment → The free-form comment text is extracted from the K1 segment - [Comment Valid?]
If comment validity → Processing continues if valid, otherwise the segment is skipped - [Is K1 Associated with X4 Segment?]
The system checks if the K1 segment is associated with an X4 customs release segment → The K1 segment is processed for cargo remarks if associated with X4, otherwise it is skipped as non-cargo related - [Extract Free-form Comment Text]
The system extracts the free-form comment text from the K1 segment → The comment text is extracted and prepared for storage in the cargo record - [Comment Count < 4?]
The system checks if the current comment count is less than 4 for the X4 segment → The comment is accepted for storage if count is less than 4, otherwise it is rejected with maximum comments exceeded error - [Store Comment in Cargo Record]
The system stores the comment in the cargo record → The comment is successfully stored in the cargo record and associated with the X4 segment - [Increment Comment Counter]
The system increments the comment counter for the X4 segment → The comment counter is increased by 1 to reflect the new comment count - [More K1 Segments?]
The system checks if there are more K1 segments to process → Processing continues with the next K1 segment if available, otherwise proceeds to associate all comments with the X4 segment - [Associate Comments with X4 Segment]
The system associates the collected comments with the X4 segment → All comments are linked to the X4 segment for cargo record updates - [Update Cargo Record with Remarks]
The system updates the cargo record with the remarks → The cargo record is updated with all K1 remarks for future reference and processing - [Log K1 Processing Complete]
The system logs the completion of K1 processing → A log entry is created indicating the completion status of K1 remarks processing - [Is Port = Laredo?]
The system checks the current port location → If the port equals Laredo, the system proceeds to KCSM configuration validation, otherwise it skips KCSM integration and continues with standard processing - [Search for Disposition Code in KCSM Table]
The system accesses the KCSM configuration table and searches for the disposition code → The system returns whether the disposition code is found in the KCSM configuration table - [Port is Laredo?]
The system validates the port location → KCSM processing continues only if the port is Laredo, otherwise processing is skipped - [Copy EDI 350 Message to Transmission File]
The system processes the EDI message for transmission → The EDI 350 message data is copied to the transmission file - [Create Transmission Root Segment A9RT]
The system creates transmission control structures → An A9RT transmission root segment is created with appropriate control information - [Set Transmission Control Information]
The system configures transmission parameters → Transmission control information including identifiers and parameters are set - [Create Transmission Dependent Segment A9DP]
The system creates dependent data structures → An A9DP transmission dependent segment is created to contain EDI segment data - [Copy EDI Segment Data to A9DP]
The system populates the segment with message data → EDI segment data is copied into the A9DP segment for transmission - [Lookup KCSM Broker Information]
The system requires broker information for transmission → KCSM broker information is retrieved from GCSTBRT broker tables - [Set Transmission Parameters]
The system configures transmission settings → Transmission parameters are set according to KCSM processing requirements - [Spawn GCT1091E Transaction for KCSM]
The system initiates KCSM processing transaction → GCT1091E transaction is spawned for KCSM message transmission - [Queue Message for KCSM Transmission]
The system queues the message for transmission → The message is queued for KCSM transmission processing - [Log Transmission Details]
The system completes transmission setup → Transmission details are logged for audit and tracking purposes - [Set KCSM System Identifier]
The system sets the KCSM system identifier → The transmission is tagged with the correct KCSM system identifier for message processing - [Generate Transmission Control Number]
The system generates a transmission control number → A unique transmission control number is created and assigned to the transmission - [Create A9RT Root Segment]
The system creates the A9RT root segment → A properly formatted A9RT root segment is created with all required fields - [Set Transmission Date/Time]
The system sets transmission date and time → Current system date and time are recorded in the transmission segment - [Set Source System Information]
The system configures source system information → Source system identifier and related information are properly set in the transmission segment - [Set Destination System Information]
The system configures destination system information → Destination system identifier and routing information are properly set in the transmission segment - [Set Message Type and Version]
The system sets message type and version → Correct message type and version identifiers are assigned to the transmission - [Store Root Segment to Database]
The system stores the root segment to database → The A9RT transmission segment is successfully stored in the AECWRKTB database table - [Log Transmission Creation]
The system logs transmission creation → Transmission creation event is recorded in system logs with relevant details - [Return Success Status]
The system completes the transmission creation process → Success status is returned to the calling process - [Retrieve EDI 350 Message Data]
The system initiates KCSM transmission dependent segment creation → The system retrieves EDI 350 message data from the message queue and loads it into the message array for processing - [Extract Transaction Set Header ST]
The system processes message segments sequentially → The system extracts ST segment information and sets header found flag for subsequent processing - [Extract Port Information P4]
The system encounters P4 segment during processing → The system extracts port information and processes it for customs release procedures - [Extract Event Details V9]
The system encounters V9 segment during processing → The system evaluates event codes (HMI, HRE, POD, AAD, RC, OCA, COC, LCK, ULC, SEI, SER) and applies corresponding train or cargo status changes - [Extract Equipment Information N7]
The system encounters N7 segment during processing → The system extracts equipment details, updates car ID information in cargo records, and handles multiple N7 segments per message - [Extract Customs Release Information X4]
The system encounters X4 segment during processing → The system validates disposition codes, determines processing type (by bond, by car/waybill, or individual), and processes cargo status changes based on disposition code rules - [Extract Remarks K1]
The system encounters K1 segment during processing → The system extracts remarks information, processes broker data, and includes remarks in Merlin messages when applicable - [Format Dependent Segment Data]
The system prepares to create dependent segments → The system formats the extracted data according to A9DP dependent segment specifications and ensures proper data structure - [Set Segment Length and Type]
The system creates the dependent segment structure → The system calculates and sets the segment length based on data content and assigns the appropriate segment type identifier - [Create A9DP Dependent Segment]
The system finalizes dependent segment creation → The system creates the A9DP dependent segment structure with all formatted EDI data and proper segment identifiers - [Link to Transmission Root Segment]
The system establishes segment relationships → The system links the dependent segment to the corresponding A9RT transmission root segment to maintain proper hierarchical structure - [Store Dependent Segment in Database]
The system persists segment data → The system stores the A9DP dependent segment in the database with proper key relationships and data integrity - [More EDI Segments?]
The system checks for additional segments in the message array → If more EDI segments exist, the system continues processing from segment extraction; otherwise, it proceeds to validation - [Update Transmission Status]
The system finalizes the transmission process → The system updates the transmission status to indicate successful completion of dependent segment creation for KCSM transmission - [Extract Equipment ID from N7 Segment]
The system processes the N7 segment → Equipment ID information is extracted from the N7 segment data - [Format Equipment ID using GCCCARFM Utility]
The system needs to format the equipment ID → GCCCARFM utility is called to standardize the equipment ID format - [KCSM Processing Required?]
If KCSM transmission requirements → System determines whether KCSM processing is required for this equipment - [Extract Equipment Details for KCSM]
The system extracts equipment details → All necessary equipment information is extracted for KCSM transmission - [Include N7 Segment in EDI 350 Message Copy]
The system creates EDI 350 message copy → N7 segment information is included in the EDI 350 message copy - [Add Equipment Information to Transmission File]
The system processes transmission file updates → Equipment information is added to the KCSM transmission file - [Create Transmission Dependent Segment with Equipment Data]
The system creates transmission dependent segments → Dependent segments are created with equipment data for KCSM transmission - [Queue Equipment Data for KCSM Transmission]
The system queues data for KCSM transmission → Equipment data is queued for transmission to KCSM system - [Log Equipment Processing for KCSM]
The system completes equipment processing → Equipment processing activities are logged for KCSM audit trail - [Extract Bond Control Number from X4 Segment]
The system needs to process cargo by bond number → The bond control number is extracted from the X4 segment and stored for cargo lookup operations - [Load Cargo Record Details]
The system prepares to process the cargo record → All cargo record details and associated status segments are loaded into working storage - [Apply Disposition Code to Cargo]
The system applies the disposition code to the cargo → The disposition code is processed according to customs rules and the appropriate action is determined for the cargo - [Update Cargo Status]
The system updates the cargo status → The cargo status is updated in the GCSUSS09 status segments and the cargo record is saved to the database - [Skip Bond Processing]
The system determines next processing steps → Bond processing is skipped and the system continues with other available processing options - [Generate Processing Messages]
The system generates processing messages → Appropriate messages are generated including Merlin notifications, broker notifications, and status change messages for the entire car and waybill group - [Cargo Records Found with Bond?]
The system searches cargo records using the bond control number as search criteria → If no cargo records are found with the bond number, generate bond not found message and skip bond-based processing, otherwise proceed to validate bond number against system tables - [Generate Bond Not Found Message]
The system completes cargo record search with no results → Generate bond not found message and skip bond-based processing - [Extract Waybill Number from Entry]
The system extracts waybill number from X4 segment entry → The waybill number is available for presence validation - [Process Each Follower Manifest]
The system prepares the message for cargo processing → The system sets special action code to '350' AND copies disposition code, quantity, and entry number from X4 segment - [Retrieve Current Cargo Record]
The system needs to access cargo data for bond clearing → The current cargo record is retrieved using the CCN key from the X4 segment - [Border Entry Processing Type Code '00']
The entry type code value is '00' → The system should clear bond information and process as border entry - [Master In-Bond Entry Types 61, 62, 63, 69]
The entry type code value is '61', '62', '63', or '69' → The system should process as master in-bond entry and map to appropriate transport type - [Standard In-Bond Entry Other Type Codes]
The entry type code value is not '00', '61', '62', '63', or '69' → The system should process as standard in-bond entry - [Map to Transport Type for Master In-Bond]
The system maps the EDI code to transport type → Entry type '61' maps to immediate transport, '62' maps to transport for export, '63' maps to immediate export, '69' maps to US-Canada-US movement - [Convert EDI Code to Internal CPRAIL Value]
The system converts the EDI code to internal format → The EDI code should be mapped to the corresponding internal CPRAIL value - [Entry Type 61 Master In-Bond]
The entry type code is 61 → Set master in-bond flag M1109 and configure for immediate transport processing - [Entry Type 63 Master In-Bond]
The entry type code is 63 → Set master in-bond flag M1109 and configure for immediate export processing - [Map Entry Type to Transport Type]
The entry type requires transport type determination → Map entry type 61 to immediate transport, 62 to transport export, 63 to immediate export, and 69 to US-Canada-US movement - [FDA Reference Qualifier?]
The system processes the N9 segment qualifier code → The system determines if the qualifier indicates an FDA-related reference number - [Extract FDA Reference Number]
The system processes the N9 reference number field → The FDA reference number is extracted and prepared for validation - [Update FDA Status in Status Array]
The system updates the cargo status array → FDA-related status codes are added to the GCSUSS09 status segments - [Skip Non-FDA Reference]
The qualifier does not indicate FDA-related reference information → The system skips FDA processing and continues to the next N9 segment - [Extract Bond Control Number from X4 Segment]
The system processes the X4 segment for bond number information → The bond control number is extracted from the X4 segment and made available for cargo grouping operations - [Cargo Records Found?]
If the search results → Processing continues to cargo processing if records are found, otherwise no cargo found message is generated - [Apply Disposition Code to All Bond Cargo]
The system applies the disposition code to each cargo record in the bond group → All cargo records in the bond group receive the same disposition code treatment for consistent processing - [More Cargo Records?]
The system checks if more cargo records in the bond group need processing → Processing continues with the next cargo record if more exist, otherwise proceeds to message generation - [Generate Bond Processing Messages]
The system generates processing messages for the bond operation → Messages are created documenting the disposition code application results for all cargo in the bond group - [Log Bond Processing Results]
The system logs the bond processing results → All bond processing activities and results are recorded in the system logs for audit trail purposes - [Generate No Cargo Found Message]
The system generates a no cargo found message → A message is created indicating that no cargo records exist for the specified bond number - [Format Equipment ID using GCCCARFM]
The system needs to format the equipment ID for database operations → The GCCCARFM formatting routine is called to standardize the equipment ID format - [Apply Disposition Code to Single Record]
The system applies the disposition code → The disposition code from the X4 segment is applied to the single cargo record - [Generate Multi-Cargo Release Messages]
The system generates release messages → Appropriate release messages are created for all eligible cargo records in the car-waybill group - [Update All Related Cargo Records]
The system updates cargo records → All related cargo records are updated with final status, disposition codes, and processing timestamps - [Extract Equipment ID from N7-01]
The system processes the N7 segment → The equipment ID is extracted from the N7-01 field for further processing - [Call GCCCARFM Utility for Formatting]
The system needs to format the equipment ID → The GCCCARFM utility is called to format and validate the equipment identifier - [Update Cargo Record with Car ID]
The system updates the cargo record → The cargo record is updated with the standardized car ID information from the N7 segment - [Prepare EDI 350 Message for Follower]
The system prepares the EDI message → The special action code is set to '350', disposition code is copied from X4 segment, quantity is transferred, and entry number is populated - [Spawn GCT0161E Transaction]
The system spawns the GCT0161E transaction → The follower manifest is submitted for independent cargo processing with the prepared message data - [Status Array Initialization]
The system needs to create status tracking for the cargo → An empty S09A status array is created and initialized with default values - [Status Array Population]
The system needs to load current status information → All S09 segments are fetched from GCSUSS09 IMS segment and loaded into the status array - [Status Array Population]
The system processes the fetched S09 segments → Each disposition code is loaded into the S09A array with its status flags, quantities, and location information - [Status Array Persistence]
The system needs to persist the status information to the database → The array data is moved to S09 segments with proper sequencing and key structure - [Status Array Persistence]
The system persists the changes to the database → The cargo records in GCCC-CARGO-ROOT IMS segment are updated with the new status information - [Extract Car ID from Equipment Information]
The system needs to extract car ID for cargo lookup → The car initial and car number are extracted from the N7 segment and combined to form the complete car ID - [Map Transport Type Codes]
The entry type code is '61' → Set transport classification to immediate transport - [Map Transport Type Codes]
The entry type code is '63' → Set transport classification to immediate export - [Prepare Log Message with Cargo Details]
The system needs to log cargo information for audit purposes → The system shall prepare a log message containing cargo ID, current status, processing context, and transaction details - [Include Disposition Code Information]
The system is preparing audit log information → The system shall include the disposition code, its description, and the associated processing action in the log message - [Add Cargo Quantities and Status]
The system is creating an audit log entry → The system shall include total quantities, released quantities, current cargo status, and any status changes in the log message - [Format Processing Timestamps]
The system needs to record timing information → The system shall format and include current processing timestamp, transaction start time, and any relevant date/time information in the log message - [Include Security Information]
The system is creating audit log entries → The system shall include user identification, security context, and authorization level information in the log message - [Add Transaction Audit Trail Data]
The system needs to create complete audit trail information → The system shall add transaction type, source system, processing context, and related audit trail data to the log message - [Set Log Message Parameters]
The system is ready to transmit the log message → The system shall set appropriate message parameters including priority level, destination queue, and formatting options - [Spawn GCT1051E Logging Transaction]
The system needs to record the audit log entry → The system shall spawn GCT1051E logging transaction excluding disposition codes 54 and 55 from logging - [K1 Segment Type?]
If the segment context and operational scope → The K1 segment is classified as either train-level processing or cargo-level processing based on the current processing context - [Extract Free-Form Comment Text]
The system processes the K1 segment content → The free-form comment text is extracted from the K1 segment data fields - [More K1 Segments?]
The system checks for additional K1 segments in the message → Processing continues with next K1 segment if more exist, or proceeds to comment count validation if no more segments - [Include Car ID and Waybill Information]
Car ID and waybill information is available from the cargo record → The system includes the car identification and waybill number in the error message content - [Add Disposition Code Information]
A disposition code was being processed for the missing cargo → The system includes the disposition code in the error message to identify what customs action was attempted - [Generate Train Not Arrived Warning Message]
The system needs to generate a warning notification → The system creates a warning message stating 'Re-arrive train or contact USCS' with train identification details - [Format Warning with Train Details]
The system formats the warning message → The message includes train vessel name, manifest information, and disposition code details in a structured format - [Route Warning to Operations Team]
The system routes the warning message → The message is sent through the Merlin system to operational teams and logged for tracking purposes - [Normal Train Processing]
The system processes the train request → Normal cargo processing operations proceed without generating warning messages - [Train Arrival Cancellation Request Received]
The system processes the V9 segment with cancellation event code → The system initiates train arrival cancellation processing workflow - [Generate Cancellation Warning Message]
The system processes the cancellation for an arrived train → The system generates a cancellation warning message with appropriate details - [Format Warning with Train Details]
The system formats the warning message → The message includes train identification, arrival details, and cancellation context - [Include Cancellation Reason Code]
The system includes the cancellation reason code → The message contains the specific reason code that triggered the cancellation - [Add CBP Reference Information]
The system adds CBP reference information → The message includes instructions to contact CBP and relevant reference numbers - [Route Warning to Operations Team]
The system routes the warning to the operations team → The operations team receives notification of the train arrival cancellation - [Retrieve Existing S09 Segments from Database]
The system needs to work with cargo status information → The system retrieves all existing S09 status segments for the cargo record - [Build S09 Segment from Array Element]
Building an S09 segment from the array element → Initialize a new S09 segment structure with the cargo CCN key and appropriate sequence number - [Set Disposition Code]
Building the S09 segment → Copy the disposition code from the array element to the S09 segment disposition code field - [Set Entry Number]
Building the S09 segment → Copy the entry number from the array element to the S09 segment entry number field - [Set Quantity Information]
Building the S09 segment → Copy the quantity values from the array element to the S09 segment quantity fields - [Set Release Status Flag]
Building the S09 segment → Copy the release status flag from the array element to the S09 segment release flag field - [Set Location Information]
Building the S09 segment → Copy the location data from the array element to the S09 segment location fields - [Set Date/Time Stamps]
Building the S09 segment → Copy the date and time stamps from the array element to the S09 segment date/time fields - [Insert S09 Segment to Database]
Inserting the S09 segment into the database → Write the S09 segment to the GCSUSS09 status segments database - [Increment Segment Counter]
Tracking the number of segments created → Increment the segment counter by one to reflect the new segment - [Update Cargo Root with New Status Count]
Updating the cargo root record → Set the status segment count in the cargo root to match the number of S09 segments created - [Log Status Array Update]
Completing the status array replacement process → Create a log entry documenting the successful status array update operation - [Format EDI 350 Message for Follower]
The system needs to create an EDI message for the follower → The system formats an EDI 350 message with follower-specific data and parameters - [Prepare Message Array for Follower]
The system needs to prepare the message for transaction spawning → The system populates the EDI message array with the formatted follower manifest data - [Set Follower Manifest Parameters]
The system needs to configure processing parameters → The system sets follower-specific parameters including manifest identifiers and processing flags - [Spawn GCT0161E Transaction]
The system is ready to process the follower manifest → The system spawns a GCT0161E transaction with the prepared message array and parameters - [S09 Status Segments Exist?]
The system checks for existing S09 status segments associated with the cargo record → The system identifies whether S09 segments exist and routes processing accordingly - [Fetch Existing S09 Segments from Database]
The system needs to load existing status information → The system fetches all S09 segments associated with the cargo record from GCSUSS09 IMS segment - [Call GCCUSIO to Get First S09 Status Segment]
The system needs to load status information → The system calls GCCUSIO to retrieve the first S09 status segment for the cargo - [Extract Status Information from S09 Segment]
The segment needs to be processed → The system extracts status info code, entry number, quantity, released flag, location code, and status description from the segment - [Populate S09A Array Element with: - Status Info Code - Entry Number - Quantity - Released Flag - Location Code - Status Description]
The array element needs to be populated → The system stores the status info code, entry number, quantity, released flag, location code, and status description in the current S09A array element - [Call GCCUSIO to Get Next S09 Status Segment]
Additional status segments need to be retrieved → The system calls GCCUSIO to get the next S09 status segment for the same cargo - [Set Total Array Count]
The status array population process is complete → The system sets the total array count to reflect the number of elements populated - [Status Array Population Complete]
The population process concludes → The system marks the status array population as complete and the array is ready for use - [Prepare S09 Segment Update]
The system prepares to update the S09 segment → Initialize S09 segment structure and prepare for data movement from status array - [Move S09A Array Data to Database Format]
The system moves data from S09A array to database format → Convert all status entries from array format to S09 segment structure maintaining proper sequence and occurrence numbers - [Replace GCSUSS09 Segment with Updated Status]
The system replaces the GCSUSS09 segment → Update the database with new status information maintaining proper key structure and sequence numbers - [Update Cargo Root Record Status Flags]
The system updates cargo root record status flags → Set appropriate status flags in the cargo root record based on the final status array analysis - [Extract Disposition Code from X4 Segment]
The system needs to process disposition code information → The disposition code is extracted from the X4 segment and stored in working storage - [Get Disposition Code Quantity]
The system needs to perform quantity calculations → The system extracts the quantity value from the disposition code message - [Priority: Border Hold Message]
The cargo is physically at border and has hold conditions → The system assigns priority to border hold message processing - [Priority: Destination Hold Message]
The cargo is physically at destination and has hold conditions → The system assigns priority to destination hold message processing - [Route to Border Processing]
The hold location equals 'Border' → The system routes the hold message to border processing workflow - [Route to Destination Processing]
The hold location equals 'Destination' → The system routes the hold message to destination processing workflow - [Route to Both Border and Destination]
The hold location equals 'Both' → The system routes the hold message to both border and destination processing workflows - [Generate Hold Message with Location Details]
The system generates the hold message → The system creates a hold message containing specific location details, disposition codes, and routing information - [Log Array Overflow Warning]
An overflow condition is detected → A warning message is logged indicating array overflow condition - [Set Overflow Flag]
The overflow flag is set → The flag indicates that subsequent processing should handle overflow condition - [Access Current Cargo Status Array S09A]
The system needs to access current cargo status information → Retrieve the S09A status array from GCSUSS09 segments for the cargo record - [Check Current Cargo Status]
The system reads the current cargo status from cargo records and status segments → The current status is retrieved and made available for hold status evaluation - [Generate Canadian Log Message]
The system processes the Canadian manifest coordination → A specialized log message is generated to GCX105 system documenting the cross-border cargo release - [Replace S09 Segments in Database]
The system needs to persist the changes → The system replaces the S09 segments in the database with the updated status array information - [Log Overflow Warning]
The system needs to notify operators of the capacity issue → A warning message is logged indicating the status array overflow condition - [Add Quantity to Release Amount]
The system processes the quantity action for cargo release → The system adds the X4-05 quantity to the current cargo release quantity - [Subtract Quantity from Release Amount]
The system processes the quantity action for cargo release → The system subtracts the X4-05 quantity from the current cargo release quantity - [Log Quantity Action in Message]
The system completes the quantity update processing → The system logs the quantity action details in the processing message for audit trail - [Format Quantity Action Display]
The system prepares user notification messages → The system formats the quantity action details for clear display showing before and after quantities - [Hold Message Generation Required]
The system determines that hold cargo messaging is needed → The hold message generation process is initiated - [Get Border Location Details]
The system needs border location information for message formatting → Border station details and location information are retrieved from location tables - [Get Destination Location Details]
The system needs destination location information for message formatting → Destination station details and location information are retrieved from location tables - [Format Hold Message with Location]
The system formats the hold message with location information → Hold message is formatted with appropriate location details and station information - [Include Disposition Code Details]
The system adds disposition code details to the message → Disposition code and its description are included in the hold message - [Add Cargo Information]
The system adds cargo information to the message → Car ID, waybill number, and cargo identifiers are included in the hold message - [Add Quantity Information]
The system adds quantity information to the message → Total quantities and affected quantities are included in the hold message - [Message Type Required?]
The system determines the specific message type needed → Message type is identified as border hold, destination hold, or combined hold message - [Generate Border Hold Message]
The system generates the border hold message → Border-specific hold message is created with border location details - [Generate Destination Hold Message]
The system generates the destination hold message → Destination-specific hold message is created with destination location details - [Route Message to Appropriate Users]
The system routes the message to appropriate recipients → Hold message is sent to relevant users, brokers, and notification systems - [Log Hold Message Details]
The system logs the hold message details → Hold message information is recorded in system logs with timestamp and recipient details - [Hold Message Generation Complete]
The hold message generation process completes → System returns successful completion status and control to the calling process - [Previously Released Cargo Detected]
The system processes a new disposition code message for this cargo → The system detects that this cargo was previously released and flags it for unrelease processing - [Analyze Disposition Codes]
The system looks up the disposition code in the DC table to determine its action type → The system identifies whether the code requires removal of release status, addition of hold status, or other status changes - [Re-establish Destination Index]
The cargo requires destination hold or routing information to be restored → The system re-establishes the destination index and routing information from the cargo's SD segment data - [Generate Unrelease Notification Message]
The system prepares notification messages for the unrelease action → The system generates Merlin messages containing cargo details, unrelease reason, and new status information for distribution to appropriate users - [Route Unrelease Message to Appropriate Users]
The system determines the appropriate recipients based on cargo location and broker information → The system routes the unrelease message to station-specific Merlin IDs, broker notification systems, and error handling destinations as appropriate - [Create Cross-Border Log Message]
The system creates audit documentation → The system should generate a cross-border log message documenting the coordination between US and Canadian cargo records - [Update Canadian CCN Status]
The system updates Canadian cargo status → The system should update the Canadian CCN status to reflect the cross-border coordination with US cargo release - [Border Date Available?]
The system checks for availability of border date in the message or cargo data → If border date is available and valid, use the provided border date, otherwise use current system date as border arrival date - [Use Current System Date]
The system needs to update border arrival date → Assign current system date as the border arrival date for the cargo record - [Use Provided Border Date]
The system updates border arrival date → Use the provided border date from the message as the border arrival date for the cargo record - [Generate Arrival Cancellation Message]
The system generates arrival cancellation message → The system creates a formatted arrival cancellation message with cargo details and cancellation information - [Update Status Array with Cancellation Code]
The system updates status array with cancellation code → The system adds the arrival cancellation disposition code to the cargo status array - [Generate Export Cancellation Message]
The system generates export cancellation message → A notification message is created documenting the export cancellation and status change - [Log Status Change for Audit]
The system logs the status change → An audit trail entry is created documenting the export cancellation, previous status, and new status - [Generate Canadian Log Message]
The system processes the Canadian manifest coordination → Generate Canadian log message with cargo release details including car ID, waybill, and release information - [Update Canadian Manifest Status]
The system coordinates with Canadian manifest system → Update Canadian manifest status to reflect the cargo release and maintain cross-border coordination - [Generate Manual Release Notification]
The system completes manual release processing → Generate manual release notification messages to inform relevant parties of the cargo release - [Generate Cross-Border Log Message]
The system generates a cross-border coordination log message → A detailed log message is created containing cargo release information, waybill details, and cross-border coordination data - [Update Canadian Manifest Status]
The system updates Canadian manifest status → Canadian cargo records are updated to reflect the cross-border coordination and US cargo release status - [Place Log Message on Canadian CCN]
The system places the log message on the Canadian CCN → The cross-border coordination log message is successfully placed on the Canadian cargo control number for integration with Canadian customs systems - [Generate Log Message for Canadian CCN]
The system confirms Canadian manifest record availability → A log message is generated containing the Canadian CCN information for audit purposes - [Update Canadian Manifest Status]
The system processes the Canadian manifest coordination → Canadian manifest status is updated to reflect the manual release action - [Generate Manual Release Notification]
The system completes manual release processing → Notification messages are generated and sent to appropriate recipients regarding the manual release - [Generate Hold Message with Piece Count Details]
The system generates a hold message → A hold message is created with specific piece count details indicating the partial release quantities - [Update Cargo Record with Partial Hold Status]
The system updates the cargo record → The cargo record is updated with partial hold status and all associated partial release information - [Generate Canadian Release Log Messages]
The system processes Canadian manifest coordination → Release log messages are generated for Canadian manifest tracking - [Generate Release Notification Messages]
The system processes release notifications → Release notification messages are generated for relevant stakeholders - [Call Integration Services for Release]
The system calls integration services → External integration services are invoked to complete the release processing workflow - [Process as Partial Release Instead]
The system redirects to partial release workflow → Cargo is processed through the partial release workflow instead of full release - [Generate Unrelease Notification Message]
The system formats the unrelease notification message → The system creates message with cargo details, disposition codes, and unrelease information - [Route Message to Brokers]
The system routes the message to brokers → The system sends notification via Merlin messaging system to broker destinations - [Route Message to Payer of Freight]
The system routes the message to payer of freight → The system sends notification via appropriate messaging channel to payer of freight - [Update Cargo Status Records]
The system updates cargo status records → The system modifies cargo status, updates S09 segments, and sets appropriate status descriptions - [Generate Canadian Log Messages]
The system processes Canadian manifest coordination → The system generates log messages to GCX105 system with cargo release information for Canadian coordination - [Prepare Hold Notification]
The system prepares hold notification with cargo identification and status details → Hold notification message is formatted for GCCIIS integration service call - [Prepare Release Notification]
The system prepares release notification with cargo identification and status details → Release notification message is formatted for GCCIIS integration service call - [Prepare Status Change Notification]
The system prepares status change notification with cargo identification and new status details → Status change notification message is formatted for GCCIIS integration service call - [Call GCCIIS Integration Service]
The system calls GCCIIS integration service with the notification message → Integration service processes the notification and returns success or failure status - [Cargo Release Status?]
If the cargo release status for message generation → The system proceeds with message generation only if cargo is in released status, otherwise terminates the process - [Format Car ID Information]
The system formats car ID information for release message → The system combines car initial and car number into properly formatted car identification string for message display - [Format Waybill Information]
The system formats waybill information for release message → The system includes formatted waybill number and associated transportation details in the message content - [Format US-CCN Status]
The system formats US-CCN status for release message → The system includes formatted US-CCN number and current status description in the message - [Format Disposition Code Details]
The system formats disposition code details for release message → The system includes disposition code value and corresponding description text in the formatted message - [Include Processing Timestamps]
The system includes processing timestamps in release message → The system adds formatted date and time information showing when cargo processing events occurred - [Add Quantity Information]
The system adds quantity information to release message → The system includes both total cargo quantity and current released quantity amounts in the message content - [Include Broker Entry Numbers]
The system includes broker entry numbers in release message → The system adds broker identification and related customs entry numbers to the message content - [K1 Comments Available?]
The system checks for K1 comment availability → The system determines if K1 comment segments exist and are available for inclusion in the release message - [Include Up to 4 K1 Comment Segments]
The system includes K1 comment segments in the message → The system adds up to four K1 comment segments to the release message content, respecting the maximum limit - [Broker Bond Message?]
The system determines if this is a broker bond message → The system identifies whether special broker bond message formatting rules should be applied - [Apply Special Broker Bond Formatting]
The system applies special broker bond formatting → The system formats the message using broker bond specific layout rules and includes required bond-related information - [Include Equipment Type Information]
The system includes equipment type information in release message → The system adds equipment type details including container or trailer specifications to the message content - [Map Internal Status to Description]
The system maps internal status to description → The system converts internal status codes to corresponding user-friendly description text for message readability - [Format Complete Release Message]
The system formats the complete release message → The system assembles all components into a properly structured, complete release message ready for transmission - [Route Message to Configured Users]
The system routes the message to configured users → The system sends the release message to all appropriate recipients based on message type and configured routing rules - [Log Message Generation Activity]
The system logs message generation activity → The system records message generation details including timestamp, message type, and routing information for audit purposes - [Export Operation Type?]
If the export operation type flag → The system routes to either standard export processing or export cancellation processing based on the flag value - [Set Export Message Type]
The system needs to set the message type for export processing → The system assigns the export message type flag to indicate standard export processing - [Set Export Cancellation Message Type]
The system needs to set the message type for cancellation processing → The system assigns the export cancellation message type flag to indicate cancellation processing - [Prepare Export Message Content]
The system prepares the export message content → The system formats the message with export-specific information and cargo details - [Prepare Cancellation Message Content]
The system prepares the cancellation message content → The system formats the message with cancellation-specific information and reason codes - [Include Cargo Details]
The system includes cargo details in the message → The system adds cargo identification, quantities, and export-related information to the message content - [Include Cancellation Reason]
The system includes cancellation reason information → The system adds the cancellation reason code and description to the message content - [Format USCS Export Message]
The system formats the message for USCS transmission → The system creates a properly formatted USCS export message with all required fields and structure - [Format USCS Cancellation Message]
The system formats the cancellation message for USCS transmission → The system creates a properly formatted USCS cancellation message with all required fields and structure - [Route to USEXP Basket]
The system routes the message for transmission → The system sends the export message to the USEXP basket for delivery to USCS systems - [Route to Cancellation Recipients]
The system routes the cancellation message for transmission → The system sends the cancellation message to designated cancellation recipients for processing - [Log Export Operation]
The system logs the export operation → The system records the export operation details including cargo information and timestamp for audit purposes - [Log Cancellation Operation]
The system logs the cancellation operation → The system records the cancellation operation details including reason and timestamp for audit purposes - [Set Arrival Message Type]
If the message type for arrival processing → The system sets the arrival message type flag to indicate standard arrival message generation - [Set Cancellation Message Type]
If the message type for cancellation processing → The system sets the cancellation message type flag to indicate arrival cancellation message generation - [Call Z110-PREP-EMCSEND for Message Preparation]
The system needs to prepare the message for transmission → The system calls Z110-PREP-EMCSEND service to handle message preparation and routing - [Format Arrival Message with Cargo Details]
The system formats the arrival message → The system includes cargo details, arrival date, time, and location information in the message format - [Format Cancellation Message with Reason]
The system formats the cancellation message → The system includes cancellation reason, original arrival details, and instructions for re-arrival in the message format - [Message Routing Required?]
If routing requirements → The system determines if the message needs to be routed to USCS operations or other destinations based on message type and content - [Route to USCS Operations]
The system routes the message → The system sends the message to USCS operations with appropriate priority and delivery confirmation - [Route to Export Baskets for Container Types]
If equipment type for additional routing → The system also routes the message to export baskets for container-specific processing - [Set Message Keywords for Categorization]
The system sets message categorization → The system assigns relevant keywords based on message type, cargo type, and operation type for proper filtering and processing - [Determine Destination Users]
The system determines destination users → The system identifies target users based on user configuration, message type, and operational requirements - [Send to Configured Users]
The system sends the message → The system delivers the message to all configured users with delivery confirmation and tracking - [Reroute to Default Users with Notification]
The system reroutes the message → The system sends the message to default users and generates a notification about the rerouting due to invalid user configuration - [Log Message Generation Activity]
The system logs the activity → The system records message generation details, delivery status, user information, and timestamps for audit trail - [Extract Manifest Information from M10 Segment]
Creating a new cargo record → Extract and populate vessel name, voyage number, manifest type, and related manifest fields into the cargo record - [Set SCAC Code and Transport Type]
Setting up cargo transportation details → Assign SCAC code from manifest and set appropriate transport type based on carrier information - [Extract X4 Segment Information]
Creating cargo record with customs data → Extract broker information, entry numbers, bond details, and disposition codes from X4 segment into cargo record - [Set Broker Information]
Setting up cargo broker details → Populate broker ID, name, and contact information from X4 segment into cargo record - [Set Bond Control Number]
Setting up customs bond details → Extract and assign bond control number from X4 segment to cargo record - [Set Entry Number and Type]
Setting up customs entry details → Extract entry number and entry type code from X4 segment and populate cargo record fields - [Map Entry Type to Transport Type]
Mapping entry type to transport classification → Set corresponding transport type: 61 maps to immediate transport, 62 to transport export, 63 to immediate export, 69 to US-Canada-US movement - [Map Entry Type to Transport Type]
The entry type code is '61' → Set transport type to immediate transport and configure appropriate bond processing parameters - [Map Entry Type to Transport Type]
The entry type code is '63' → Set transport type to immediate export and configure appropriate bond processing parameters - [Entry Type 61 - Master In-Bond]
The system processes the X4 segment for master in-bond entry → The system sets the transport type to immediate transport AND sets the master in-bond flag AND processes the bond control number - [Entry Type 62 - Master In-Bond]
The system processes the X4 segment for master in-bond entry → The system sets the transport type to transport for export AND sets the master in-bond flag AND processes the bond control number - [Entry Type 63 - Master In-Bond]
The system processes the X4 segment for master in-bond entry → The system sets the transport type to immediate export AND sets the master in-bond flag AND processes the bond control number - [Entry Type 69 - Master In-Bond]
The system processes the X4 segment for master in-bond entry → The system sets the transport type to US-Canada-US movement AND sets the master in-bond flag AND processes the bond control number - [Other Entry Types]
The system processes the X4 segment for master in-bond entry → The system sets the transport type to default border processing ('00') AND sets the master in-bond flag AND processes the bond control number - [Process Bond Control Number]
The system processes the entry number format → If the entry number starts with 'V' then place it in the entry number field, otherwise place it in the in-bond control number field - [Map Entry Type to Internal Transport Type]
The system maps the entry type to internal transport type → Entry type '61' maps to immediate transport, '62' maps to transport export, '63' maps to immediate export, '69' maps to US-Canada-US movement, and all others map to border processing ('00') - [Identify Canadian Pacific Entity]
The system checks the cargo SCAC code → The system identifies Canadian Pacific Railway entities (CPRS) for special bond message handling - [Detect Broker-Created Bond Pattern]
The disposition code is '95' and entry type is in ('61', '62', '63', '69') → The system identifies this as a broker-created bond message requiring special handling - [Apply Special Bond Message Formatting]
The system formats the message for broker notification → The system applies special bond message formatting including bond control information and broker entity details - [Include Bond Control Information]
The system prepares the message content → The system includes bond control number, entry number, and related bond identifiers in the message - [Add Broker Entity Details]
The system retrieves broker information from cargo records → The system adds broker short name, tax number, and entity identification to the message - [Format Disposition Code Information]
The system formats the disposition code for the message → The system includes disposition code, description, and related customs information in the broker message - [Include Quantity Information]
The system formats quantity information → The system includes total quantity, release quantity, and quantity impact information in the broker message - [Add K1 Comment Segments]
The system processes K1 segments for the message → The system includes K1 remarks and special comments in the broker notification message - [Set Special Routing Parameters]
The system determines routing parameters → The system sets special routing parameters including broker notification preferences and delivery methods - [Route to Broker Notification System]
The system routes the message → The system sends the message to the broker notification system using configured delivery methods (email or Merlin) - [Log Broker Bond Transaction]
The system completes the transaction → The system logs the broker bond transaction with timestamp, message details, and routing information for audit purposes - [Retrieve Current Cargo Status]
The system needs to process status changes for the cargo → The current cargo status information is retrieved from the GCSUSS09 status segments - [Status Array Exists?]
The system checks for existing S09 status segments → If S09 segments exist, load existing status array, otherwise create new status array - [Create New Status Array]
Status processing requires a status array → A new S09 status segment is created with cargo CCN key and sequence '0001' - [Load Existing Status Array]
Status processing begins → All S09 sequences and occurrences are loaded into the consolidated status array - [Update Final Status Array]
Final status array update is performed → The S09A status array is updated with all processed status changes and redistributed across S09 sequences - [Persist Status Changes to Database]
Database persistence is executed → Updated S09 status segments are written to the GCSUSS09 database and cargo status is updated - [Extract Equipment ID from N7-02]
The system processes the N7-02 field to extract equipment ID → The equipment ID is captured from N7-02 field for further processing - [Update Car ID in Cargo Record]
The system updates the car ID field in the cargo record → The cargo record car ID is updated with the formatted equipment ID from N7 segment - [Extract SCAC Code from M10]
The system processes the M10 segment → The SCAC code is extracted and stored for cargo record integration - [Extract Transport Type from M10]
The system processes the M10 segment → The transport type is extracted and prepared for cargo record update - [Extract Country Code from M10]
The system processes the M10 segment → The country code is extracted for cargo record integration - [Extract Vessel Name from M10]
The system processes the M10 segment → The vessel name is extracted and prepared for cargo record update - [Extract Flight/Voyage Number from M10]
The system processes the M10 segment → The flight/voyage number is extracted for cargo identification - [Extract Quantity from M10]
The system processes the M10 segment → The quantity is extracted and prepared for cargo record integration - [Extract Manifest Type Code from M10]
The system processes the M10 segment → The manifest type code is extracted for cargo classification - [Extract Condition Response Code from M10]
The system processes the M10 segment → The condition response code is extracted for cargo status determination - [Skip Manifest Integration]
The system determines that integration cannot proceed → The manifest integration process is skipped and processing continues with the next segment - [Check Message Type]
The disposition code type is Manual Release (MRL):- Auto Release (ARL)
- [Format Cargo Information]
Standard cargo details need to be included in the message → Format message with car initial, car number, waybill number, and US-CCN (customs control number) - [Add Disposition Code Details]
The disposition code type is NOT Manual Release AND NOT Auto Release → Include the disposition code and its corresponding Merlin message text in the formatted message - [Apply Special Broker Bond Formatting]
The message type is identified as a broker bond message → Apply special formatting rules including bond number, broker information, and enhanced cargo details specific to bond processing - [Include Release Quantity Changes]
Quantity changes need to be communicated in the Merlin message → Include current release quantity, planned quantity change, and resulting final quantity in the message format - [Add First K1 Comment]
The first K1 comment segment exists and contains data → Add the first K1 comment segment to the Merlin message format - [Add Additional K1 Comments Up to 4 Total]
Additional K1 comment segments exist AND the total count is less than 4 → Add the next available K1 comment segment to the message and continue checking for more comments until maximum of 4 is reached - [Format Final Message Structure]
The message formatting process is ready for finalization → Organize all components into the final Merlin message structure with proper formatting, spacing, and message layout - [Set Message Destination]
Message destination routing needs to be determined → Set the appropriate message destination based on message type, cargo location, and processing requirements - [Check Message Source]
The system checks the message source and cargo type → The system identifies if the message is from a Canadian Pacific entity based on CPRS cargo type designation - [Identify Bond Message Type]
If disposition codes for bond creation indicators → The system identifies broker-created bond messages when disposition codes are '1J', '69', or '55' indicating master in-bond processing - [Extract Bond Information]
The system processes the X4 segment containing bond information → The system extracts entry numbers, bond control numbers, and entry type codes for bond processing - [Apply Canadian Pacific Formatting Rules]
The system formats the bond message for processing → The system applies CPRS-specific formatting by setting cargo status to 'ERROR' and clearing car ID information for CPRS records - [Include Bond Control Numbers]
The system processes entry type codes '61', '62', '63', '69', or '00' → The system translates codes to immediate transport, transport export, immediate export, US-Canada-US movement, or default border processing respectively - [Add Broker Entry Information]
The system processes broker details for bond entries → The system extracts broker information, validates broker codes, and associates broker details with the bond entry for notification purposes - [Set Special Message Routing]
The system determines message routing based on message type and broker configuration → The system routes ERROR messages to both 'IN' and 'USERR' destinations, and routes other bond messages to station-specific Merlin IDs - [Complete Bond Message Formatting]
The system processes entry numbers with 'V' prefix or other formats → The system places V-prefixed entry numbers in the entry number field and places other formats in the in-bond control number field - [Retrieve Disposition Code Details]
The system needs disposition code details for message formatting → The system retrieves disposition code information including action type and description from the DC table - [Format ADD Operation Message]
The system formats the quantity action message → The system creates an ADD operation message showing the quantity increase to release amounts - [Format SUBTRACT Operation Message]
The system formats the quantity action message → The system creates a SUBTRACT operation message showing the quantity decrease from release amounts - [Add Quantity Action to Message]
The system adds quantity action to the message → The system incorporates the quantity action information into the message structure for transmission - [Include Disposition Code Description]
The system includes disposition code description → The system adds the disposition code description to provide context for the quantity action in the message - [Format Complete Quantity Action Message]
The system formats the complete quantity action message → The system assembles all message components including quantity action, disposition code description, and formatting into a complete message - [No Quantity Action Required]
The system determines no quantity action is required → The system bypasses quantity action message formatting and proceeds to message completion - [Check N101-01 Qualifier]
The system checks the N101-01 qualifier field → The system should determine if the qualifier equals 'PF' indicating payer of freight information - [Extract Payer of Freight Entity Information]
The system processes the payer of freight entity information → The system should extract the entity name from N101-02 field and store it in payer fields - [Check for Additional N101 Segments]
The system checks for additional N101 segments in the same record → The system should determine if more N101 segments exist for continued processing - [Extract Other Supplemental Information from N101]
The system processes the non-PF N101 segment → The system should extract other supplemental information and store it in working storage - [No Secondary Records Available - Continue]
No secondary cargo records are available in GCSA2RT segments → The system should continue processing without payer of freight information and proceed to the next step - [Route to Info Users]
The message type is INFO → The system routes the message to 'IN' destination and station-specific Merlin IDs for information distribution - [Route to Unrelease Baskets]
The message type is UNRLSE (unrelease) → The system routes the message to default Merlin IDs and cancel-specific Merlin IDs for unrelease processing - [Route to Release Users]
The message type is RLSE (release) → The system routes the message only to station-specific Merlin IDs for release notification - [Route to USEXP Baskets]
The container type is identified as a specific container type requiring special handling → The system routes the message to USEXP baskets for specialized container export processing - [Route to Standard Export]
The container type is not a specific container type requiring special handling → The system routes the message through standard export processing channels - [Reroute to Default Users]
The destination user validation fails → The system reroutes the message to default users to ensure proper message delivery - [Set Message Keywords]
The message is ready for final formatting and delivery → The system sets appropriate message keywords based on message type and content for proper categorization - [Format Subject Line]
The system prepares the final message format → The system formats the subject line with relevant business information including message type and key identifiers - [Send to Destination]
All routing validation and formatting is complete → The system sends the message to its final destination through the appropriate messaging channel - [Log Routing Action]
The message delivery is complete → The system logs the routing action including message type, destination, and delivery status for audit purposes - [Route to Original User]
The user ID validation passes → The message is routed to the original specified user without modification - [Identify Default User for Message Type]
The system needs to identify a default user → The system determines the default user based on the message type (Error, Info, Release, or Export) - [Route to Default Info User]
The message type is identified as Info → The message is routed to the default info user - [Route to Default Release User]
The message type is identified as Release → The message is routed to the default release user - [Route to Default Export User]
The message type is identified as Export → The message is routed to the default export user - [Generate Invalid User Notification]
The rerouting to default user is completed → A notification is generated indicating the invalid user ID and the rerouting action taken - [Update Message Routing History]
The system updates the message routing history → The routing history is updated with the rerouting event details including original destination, new destination, and reason for rerouting - [Send Message to New Destination]
The system sends the message to the new destination → The message is delivered to the default user with all original content intact - [Set Security Information]
Security information needs to be recorded → Current user ID and security context are captured and added to the log message - [Format Cargo Details]
Cargo details are being formatted → All cargo identification fields are properly formatted and included in the log message - [Add Processing Timestamps]
Timestamp information is required → Current date and time are captured and added to the log message - [Include Disposition Code Information]
Disposition code information needs to be logged → Disposition code, description, and related processing details are included in the log message - [Add Quantity Information]
Quantity information needs to be logged → All relevant quantity information including changes and current values are added to the log message - [Set Audit Trail Data]
Audit trail data is being prepared → Complete audit trail information including references and status is set in the log message - [Prepare Log Message Structure]
The final log message structure needs to be assembled → All components are properly structured into the required log message format - [Spawn GCT1051E Transaction]
The logging transaction is initiated → GCT1051E transaction is spawned with the prepared log message - [Retrieve Broker Entry Number from X4 Segment]
The system needs to retrieve broker entry number for quantity comparison → The broker entry number is extracted from the X4 segment and made available for display formatting - [Retrieve Broker Entry Quantity from X4 Segment]
The system needs to retrieve broker entry quantity for mismatch detection → The broker entry quantity is extracted from the X4 segment and made available for comparison - [Set Default User Codes]
Default user code setup is executed → Standard user codes are assigned for message routing destinations - [Set Info Message Routing]
Information message routing is configured → Message is routed to 'IN' destination and station-specific Merlin IDs - [Set Release Message Routing]
Release message routing is configured → Message is routed only to station-specific Merlin IDs - [Set Export Message Routing]
Export message routing is configured → Message routing is set with equipment type validation for containers and trailers - [Set Unrelease Message Routing]
Unrelease message routing is configured → Message is routed to default destinations and cancel-specific Merlin IDs - [Set Default Rerouting User]
Default rerouting is applied → System assigns default rerouting user for message delivery - [Set Message Keywords]
Message keyword assignment is performed → Appropriate keywords are assigned based on message type and content - [Set Subject Line Format]
Subject line formatting is applied → Subject line is formatted with standard message identification format - [Finalize Report Field Setup]
Report field setup finalization is performed → All report fields are validated and confirmed ready for message generation - [Set Train Operation Parameters]
Train operation parameters need to be established → System sets appropriate flags and counters for train message processing - [Process M10 Manifest Segment]
The segment type is identified as M10 manifest segment → The system routes the segment for train manifest processing - [Process V9 Event Detail Segment]
The segment type is identified as V9 event detail segment → The system routes the segment for train event processing - [Extract Disposition Code]
Disposition code extraction is required → System extracts the disposition code that indicates the specific train operation type - [Set Train Arrival Parameters]
The disposition code is POD (Port of Discharge) or AAD (Actual Arrival Date) → System sets train arrival processing parameters and flags - [Set Train Cancellation Parameters]
The disposition code is COC (Cancel on Condition) → System sets train cancellation processing parameters and flags - [Calculate Array Entry Count]
Array entry count calculation is required → System increments entry count and maintains accurate array index - [Store Segment Data in Array]
Data storage in message array is required → System stores segment data in the correct array entry with proper formatting - [More Segments?]
System checks for additional segments to process → System continues processing if more segments exist or proceeds to finalization if complete - [Finalize Array Structure]
Array structure finalization is required → System finalizes array structure and prepares for train operation execution - [Set Processing Flags]
Processing control flags need to be set → System sets flags indicating successful initialization and readiness for train operation processing - [Log Connection Success]
Logging connection success → Success message is recorded in system log - [Connection Ready for Message Processing]
Confirming readiness for message processing → System indicates MQ connection is ready for message operations - [Monitor Connection Health]
Monitoring connection health → System checks connection status periodically - [Continue Normal Processing]
Continuing normal processing → System proceeds with regular message processing operations - [Close MQ Connection]
Closing MQ connection → Connection is properly closed using MQ disconnect operation - [Set Queue Ready Status]
Queue open operation completes without errors → Queue status is set to ready for message processing - [Calculate Message Entry Counts]
System calculates message entry counts → Maximum message entry count is determined for processing capacity - [Get Message from Queue]
System attempts to get next message from queue → Message is retrieved from queue and made available for processing - [Calculate Message Length]
System processes the variable-length message → Message length is calculated and stored for entry count determination - [Determine Entry Count Based on Message Structure]
System analyzes message structure and content → Entry count is determined based on message segments and structure - [Process Variable-Length Message Array]
System processes the variable-length message array → Message array is processed and prepared for validation - [Message Valid?]
System evaluates overall message validity → If message is valid, store in processing array, otherwise handle processing error - [Store Message in Processing Array]
System stores message for processing → Message is stored in processing array and available for business logic processing - [Increment Message Counter]
System updates message tracking counters → Message counter is incremented to reflect successful message processing - [More Messages?]
System checks for additional messages in queue → If more messages available, continue retrieval, otherwise close queue and return results - [Close MQ Queue]
System completes message retrieval operations → MQ queue connection is properly closed - [Return Entry Count and Messages]
System completes message retrieval process → Entry count and processed messages are returned to calling program - [Get Message Length]
The system needs to determine the message processing requirements → The system retrieves and stores the total message length for subsequent processing - [Parse Message Structure]
The system begins message analysis → The message structure is parsed to identify individual EDI segments - [More Segments to Process?]
A segment has been processed → The system checks if more segments exist in the message for continued processing - [Identify Segment Type]
The system encounters a new segment → The segment type is identified based on the segment identifier - [Calculate Segment Length]
The system needs to process the segment → The segment length is calculated based on the segment structure and content - [Increment Entry Counter]
The segment processing is complete → The entry counter is incremented by one to track the total number of processed segments - [Move to Next Segment Position]
The system needs to continue processing → The message position pointer is moved to the start of the next segment - [Entry Count Valid?]
The system needs to determine processing success → The entry count is checked for validity and consistency with the message structure - [Set Final Entry Count]
Validation passes successfully → The final entry count is set for use in subsequent message processing - [Extract Shipment Identifier from EDI Segment]
The segment type is X4 (customs release) → The system extracts CCN key, car ID, waybill number, and disposition code from the segment - [Query Shipment Root Database]
The system searches for cargo records → It performs exact match search using CCN key first, then broader search if exact match fails, excluding deleted records - [Skip EDI Segment Processing]
Cargo not found flag is set → Skip further processing of the current EDI segment and continue to next segment - [Proceed with EDI Segment Processing]
Cargo found flag is set → Proceed with disposition code processing and cargo status updates - [Create U1 Segment with In-Bond Information]
Processing new cargo with in-bond requirements → Create master in-bond record with appropriate entry type classification and bond number validation - [Update Shipment Record with EDI Data]
Cargo status changes are required → Update cargo record with new status, release quantities, and disposition codes, and call GCCIIS for hold/release status changes if cargo status description changed - [Log Successful Processing]
Cargo record has been updated → Log cargo status changes and spawn GCT1051E logging transaction excluding disposition codes 54 and 55 - [Continue to Next EDI Segment]
More segments exist in the message queue → Continue processing next available segment until end of queue is reached - [Retrieve In-Bond Information]
The system processes U1 segment creation → The system should retrieve all relevant in-bond information from the shipment record for U1 population - [Convert CPRAIL Type Codes to EDI 309 Values]
The system creates U1 segment structure → The system should convert CPRAIL type codes to corresponding EDI 309 standard values using the type code mapping table - [Create U1 Segment Structure]
The system processes U1 segment creation → The system should create a properly formatted U1 segment structure with all required fields initialized - [Populate In-Bond Details]
The system populates in-bond details → The system should populate all in-bond fields including bond numbers, entry types, broker information, and customs data into the U1 segment - [Insert U1 Segment into Database]
The system attempts to store the U1 segment → The system should insert the U1 segment into the database and return success or failure status - [U1 Segment Created Successfully]
The database operation returns success status → The system should confirm U1 segment creation was successful and complete the process - [Access In-Bond Type Code Lookup Table]
The system accesses the GCSTBRT IMS segment lookup table → The lookup table is made available for code conversion processing - [Retrieve Corresponding EDI 309 Standard Value]
The system finds a matching entry in the lookup table → The corresponding EDI 309 standard value is retrieved for conversion - [Apply Default EDI 309 Value]
The system cannot find a matching entry in the lookup table → A default EDI 309 value is applied for the conversion process - [Convert CPRAIL Code to EDI 309 Format]
The system performs the format conversion from CPRAIL to EDI 309 → The CPRAIL code is converted to the appropriate EDI 309 format - [Update U1 Segment with EDI 309 Value]
The conversion validation passes → The U1 segment is updated with the converted EDI 309 value - [Use Original CPRAIL Value]
The EDI 309 conversion cannot be completed successfully → The system uses the original CPRAIL in-bond type code value - [Convert CPRAIL to EDI 309 Values]
The system processes the in-bond type codes for EDI transmission → CPRAIL codes are converted to their corresponding EDI 309 standard values - [Include In-Bond Details]
The system builds the segment structure → All relevant in-bond details including bond numbers, entry types, and customs information are included in the segment - [U1 Segment Exists?]
The system checks if a U1 segment already exists for the shipment → If segment exists, Execute replace operation, otherwise Execute insert operation - [Insert New U1 Segment]
The system performs database insert operation → A new U1 segment record is created with all in-bond details - [Replace Existing U1 Segment]
The system performs database replace operation → The existing U1 segment record is updated with current in-bond details - [Log Successful Update]
The system processes the successful operation → Success information is logged for audit trail and processing continues - [Access Secondary Cargo Records]
The system initiates N9 reference retrieval process → Secondary cargo records (GCSA2RT) are accessed to locate N9 segments - [Search for N9 Segments]
The system searches for N9 segments within the records → All available N9 segments are identified and flagged for processing - [N9 Segments Found?]
If the search results → If N9 segments are found, proceed to extract reference information, otherwise log no references found and continue processing - [Extract Reference Numbers]
The system processes each N9 segment → Reference numbers are extracted and stored for further validation - [Extract Reference Qualifiers]
The system processes the qualifier information in each N9 segment → Reference qualifiers are extracted and associated with their corresponding reference numbers - [Log No References Found]
No N9 segments are found in the records → The absence of N9 references is logged and shipment processing continues without reference information - [Generate Cross-Border Log Message]
Canadian cargo records are found and linked to US cargo → A log message is generated documenting the cross-border cargo release coordination - [Set Transmission Control Information]
Transmission control information is being set → Control information is configured for message routing and tracking purposes - [Generate Transmission ID]
A transmission ID is required → A unique transmission identifier is generated for message tracking - [Set Message Routing Information]
Message routing information is being configured → Routing information is set to determine message destination and delivery path - [Create A9RT Root Segment]
A9RT root segment creation is initiated → A9RT root segment is created with transmission control and routing information - [Set Tracking Information]
Tracking information is being set → Tracking information is established for monitoring transmission status and progress - [Validation Successful?]
Validation results are evaluated → System determines if validation was successful to proceed with storage or error handling - [Store Root Segment to Database]
Root segment storage is initiated → Validated root segment is stored to A9RT transmission segment database - [Log Transmission Creation]
Transmission creation logging is performed → Successful transmission creation is logged for audit and monitoring purposes - [Return Success Status]
Process completion status is returned → Success status is returned to indicate successful root segment creation - [Retrieve EDI 350 Message Data]
The system needs to process EDI 350 message data → The system retrieves the EDI 350 message data from the message queue for further processing - [Set Transmission Control Information]
The system needs to establish transmission control → The system sets transmission control information including sequence numbers and transmission identifiers in the dependent segment - [Copy EDI Segment Data to A9DP]
EDI segment data needs to be stored for transmission → The system copies the EDI segment data from the 350 message into the A9DP dependent segment - [More EDI Segments?]
The system checks for additional segments to process → The system evaluates if more EDI segments exist and continues processing if segments remain, or proceeds to transmission preparation if all segments are processed - [Create Next A9DP Segment]
The system needs to create another dependent segment → The system creates a new A9DP dependent segment for the next EDI segment data - [Set Segment Sequence Number]
The system needs to establish segment ordering → The system assigns a sequential sequence number to the dependent segment to maintain proper transmission order - [Store EDI Data in Dependent Segment]
EDI data needs to be stored in the dependent segment → The system stores the EDI data in the dependent segment with proper formatting and structure - [Link to Transmission Root Segment]
The dependent segment needs to be associated with its transmission root → The system links the A9DP dependent segment to the A9RT transmission root segment - [Insert A9DP Segment to Database]
The segment needs to be persisted for transmission → The system inserts the A9DP dependent segment into the database - [Log Transmission Details]
The system needs to maintain an audit trail → The system logs transmission details including segment information and processing status - [Prepare for KCSM Transmission]
The system is ready for transmission → The system prepares the dependent segments for KCSM transmission processing - [Complete Dependent Segment Creation]
The dependent segment creation process needs to be finalized → The system completes the dependent segment creation process and finalizes EDI transmission preparation - [Retrieve Broker Name for KCSM]
The system attempts to retrieve broker information from GCSTBRT broker tables → The broker name is successfully retrieved and made available for transmission processing - [Broker Name Found?]
The broker lookup operation completes → If broker name is found, proceed to transmission creation; if broker name is not found, handle broker lookup error and complete KCSM integration - [Create Transmission Root Segment]
The system creates the transmission root segment → A9RT transmission root segment is created with proper structure for EDI message transmission - [Set Transmission Control Information]
The system sets transmission control information → Transmission control parameters including routing, priority, and processing flags are established - [Create Dependent Segment with EDI Data]
The system creates the dependent segment with EDI data → A9DP dependent segment is created containing the formatted EDI message data for transmission - [Set Message Length and Entry Count]
The system calculates message parameters → Message length and entry count are calculated and set for transmission validation - [Transmission Created Successfully?]
The system validates transmission creation → If transmission created successfully, spawn GCT1091E transaction; if transmission creation failed, handle transmission creation error and complete KCSM integration - [Spawn GCT1091E Transaction]
The system spawns GCT1091E transaction → GCT1091E transaction is initiated for KCSM system integration processing - [GCT1091E Spawn Successful?]
The system checks spawn operation status → If GCT1091E spawn successful, pass transmission parameters; if spawn failed, handle spawn transaction error and complete KCSM integration - [Pass Transmission Parameters]
The system passes transmission parameters → Transmission parameters including root segment, dependent segment, and control information are passed to GCT1091E - [Log Transmission Details]
The system logs transmission details → Transmission details including broker information, message length, and timestamp are logged for audit purposes - [Queue EDI Message for Transmission]
The system queues EDI message for transmission → EDI message is placed in transmission queue for delivery to KCSM system - [Update Transaction Status]
The system updates transaction status → AECWRKTB work tables are updated with current transaction status and processing results
Structural Validations
- [3:Manifest Information Processing]
The vessel name does not start with 'TRAIN' → The system fetches train list and validates train existence in the system - [218:Disposition Code Table Lookup]
The system performs table lookup → The system retrieves disposition code details and sets found or not found flags with corresponding Merlin messages - [Ready for Message Processing]
The system completes initialization sequence → The system is ready to begin processing messages with all components properly initialized and configured - [Valid Transaction Set ID?]
The system validates the transaction set identifier → The system should accept valid EDI 350 transaction types and reject invalid identifier codes - [Generate Error Message]
The system processes the invalid identifier → The system should Throw error: and skip the transaction set processing - [Search Train List Database]
The system searches the train list database → The system determines if the train exists in the GCWTL-TRAIN-LIST database and sets appropriate found/not found flags - [Format Error Message with Train Details]
The system formats the error message → The system includes the SCAC code, equipment initial, equipment number, and other relevant train details in the error message using data from GCSTBRT error tables - [Send Error Notification to Operations]
The system sends the error notification → The system delivers the error notification to operations personnel through the designated notification channels - [Search GCWTL-TRAIN-LIST Database]
The system searches the GCWTL-TRAIN-LIST database for the train → The system determines if the train exists and sets appropriate validation flags - [Generate Train Not Found Error]
The system processes the train not found condition → Generate train not found error message and prepare error notification for operations - [Send Error Message to Operations]
The system processes the error notification requirement → Send error message to operations team with train identification details - [OCA - Train Not Arrived Notification]
The system processes the OCA disposition code → A train not arrived warning is generated with instructions to re-arrive the train or contact USCS - [Validate Equipment ID Format]
The system validates the equipment ID format → Equipment ID format is checked against validation criteria - [VID Segment Found?]
The system checks for the presence of a VID segment → If VID segment is found, continue with equipment processing, otherwise complete equipment release processing - [Equipment ID Valid?]
The system validates the formatted equipment ID → If equipment ID is valid, proceed with equipment lookup, otherwise log invalid equipment ID error and continue to next VID segment - [Log Invalid Equipment ID Error]
The system processes the invalid equipment ID condition → An error is logged indicating invalid equipment ID format and processing continues to next VID segment - [Validate Equipment ID Format]
The system validates the equipment ID format → The equipment ID is confirmed as valid or invalid based on format requirements - [Check if VID Segments Follow SER Code]
The system checks for VID segments following the SER code → The system identifies whether VID segments are present for equipment processing - [Validate Equipment ID Format]
The system validates the equipment ID format → The system determines if the equipment ID format is valid or invalid - [Log Invalid Equipment ID Error]
The equipment ID format validation fails → An error is logged indicating invalid equipment ID format - [Validate Train Exists in System]
The system processes the train hold request → The system validates the train exists in GCWTL-TRAIN-LIST and sets appropriate processing flags - [Generate Train Not Found Error Message]
The train is not found in the train list system → The system generates a train not found error message and stops further hold processing - [Validate Train Exists in System]
The system processes the M10 manifest segment to validate train existence → The system checks if the vessel name exists in GCWTL-TRAIN-LIST and sets appropriate found/not found flags - [Send Train Not Found Error Message]
The train is not found in GCWTL-TRAIN-LIST → The system generates a train not found error message and terminates HRE processing - [Validate Train Exists in System]
The system processes the train validation → The system checks if the train exists in the system and sets appropriate flags - [Generate Train Not Found Error Message]
The train is not found in the system → The system generates a train not found error message and routes it to the Merlin error system - [Send Error to Merlin System]
The system handles the error condition → The error message is sent to the Merlin system for appropriate handling - [Validate Train Exists in System]
The system validates the train existence in the GCWTL-TRAIN-LIST → The system determines if the train is found or not found and sets appropriate processing flags - [Generate Train Not Arrived Error Message]
The system processes the train not arrived condition → The system creates an error message indicating the train has not arrived and requires re-arrival or USCS contact - [Format Error Message with Train Details]
The system formats the warning message → The message includes instructions to re-arrive the train or contact USCS with train identification details - [Route Error Message to Multiple Destinations]
The system routes the message to destinations → The message is sent to both 'IN' and 'USERR' destinations as configured in the message routing tables - [Train Exists in System?]
The system checks if the train exists in GCWTL-TRAIN-LIST → If train does not exist, generate train not found error and stop processing, otherwise continue with COC validation - [Validate Train Exists in System]
The system validates the train information from M10 segment → The system checks if the train exists in GCWTL-TRAIN-LIST table - [Generate Train Not Found Error Message]
The train validation fails → The system generates a train not found error message AND terminates the lock processing - [Validate Train Exists in System]
The system processes the ULC request and checks the train list for the specified train → The system verifies train existence in GCWTL-TRAIN-LIST and sets appropriate validation flags - [Generate Train Not Found Error Message]
The train lookup validation fails and the train is not found in the system → The system generates a train not found error message and stops ULC processing without updating any train status - [Validate Train Exists in System]
The system validates the train against the train list using vessel name → The system determines if the train exists and sets appropriate processing flags - [Generate Train Not Found Error Message]
The train is not found in the system train list → The system generates a train not found error message and terminates seizure processing - [Validate Train Exists in System]
The system attempts to validate the train exists in the train list → The system checks the train list database and sets train found or not found status - [Generate Train Not Found Error Message]
The train is not found in the system → The system generates a train not found error message and stops processing - [Skip Invalid Equipment ID]
The system encounters an invalid equipment ID → The invalid equipment ID is skipped and processing continues with the next VID segment - [VID Segment Available?]
The system searches for VID segments in the message → The system determines if VID segments are available for processing or if no equipment identification is provided - [Validate Equipment ID Format]
The system validates the equipment ID format → The equipment ID is confirmed as valid format for seizure processing or marked as invalid - [Skip Invalid Equipment ID]
The system encounters invalid equipment ID → The invalid equipment ID is skipped and processing continues with the next VID segment if available - [VID Segments Available?]
The system checks for VID segments in the message → If VID segments are available, proceed to process each VID segment, otherwise update train seizure status directly - [X4 Segment Valid?]
The system validates the X4 segment structure and required fields → The segment is accepted for processing if valid, otherwise an error is generated - [Valid Disposition Code?]
The system validates the disposition code against the DC table → If the disposition code is valid and authorized, proceed with processing; otherwise generate an error - [Bond Number Available?]
The system checks for bond number availability in the X4 segment → Processing continues to bond extraction if bond number exists, otherwise skips bond processing - [Validate Bond Number Format]
The system validates the bond number format → Processing continues if format is valid, otherwise generates validation error - [218:Disposition Code Table Lookup]
The system looks up the disposition code in the GCSTBRT disposition code table → The system determines if the disposition code is valid and retrieves associated processing rules - [228:Disposition Code Error Handling]
The disposition code is not found in GCSTBRT table → The system generates an error message and stops processing for this disposition code - [Entry Number Present in X4-04?]
The system checks for entry number in X4-04 field → If entry number is present, continue with entry number validation, otherwise fail validation - [X4 Segment Available?]
The system checks for X4 segment availability → Processing continues if X4 segment is available, otherwise error handling is triggered - [Generate Cargo Not Found Error]
The system generates cargo not found error → Error message is created indicating cargo could not be located for processing - [US-CCN Matches?]
System compares the US-CCN key from the message with the cargo record US-CCN → If US-CCN keys match exactly, use the found cargo record, otherwise try broader search without US-CCN - [Validate Multiple Waybill Numbers]
System compares waybill numbers from message against found cargo records → If waybill validation passes, select best matching cargo record, otherwise create new foreign bill - [Generate Bond Validation Error]
Bond validation error is generated → An error message is created indicating invalid or inactive bond number and processing is directed to error handling - [Generate Compliance Error]
Compliance error is generated → An error message is created indicating specific compliance failure and processing is directed to error handling - [Validate SCAC Code Format]
The system validates the SCAC code format → The SCAC code is verified to meet standard format requirements or validation error is flagged - [Validate Transport Type]
The system validates the transport type → The transport type is verified against valid transportation modes or validation error is flagged - [Validate Country Code]
The system validates the country code → The country code is verified against valid country identifiers or validation error is flagged - [Generate Missing Data Error]
The system detects missing or invalid data → A missing data error is generated identifying the specific fields that are missing or invalid - [Disposition Code Found?]
The disposition code is not found in the DC table → An error message is generated indicating the code is not found - [Prevent Array Overflow]
The system attempts to add another status entry → The system prevents the addition and maintains array integrity without exceeding capacity limits - [Generate Overflow Error Message]
Processing the overflow condition → The system generates an appropriate error message indicating array capacity has been exceeded - [Format Equipment ID using GCCCARFM Utility]
The system applies GCCCARFM formatting utility → Equipment ID is formatted according to standard format rules and validated for correctness - [Validate SE Segment Structure]
The system validates the segment structure → The segment must contain transaction set control number and segment count in valid format - [Control Number Matches ST Segment?]
The control number is compared with the ST segment control number → If numbers match, proceed to segment count validation, otherwise log control number mismatch error - [Segment Count Matches Actual?]
The declared segment count is compared with actual processed segments → If counts match, mark transaction set complete, otherwise log segment count mismatch error - [Generate SE Validation Error]
The system generates a validation error → An error message is created indicating SE segment validation failure - [Bond Number Available?]
The system checks for bond number availability in the X4 segment → Processing continues to bond extraction if bond number exists, otherwise generates bond error message - [Validate Bond Number Format]
The system validates the bond number format → Processing continues if format is valid, otherwise generates bond error message - [Generate Bond Error Message]
The system generates bond error message → Error message is created indicating bond processing cannot proceed and includes relevant error details - [Log Bond Processing Error]
The system logs bond processing error → Error details are logged including bond number, error type, and processing context for system monitoring - [Set Invalid Disposition Code Flag]
The system determines the disposition code is invalid → The system sets invalid disposition code flag, generates error message, logs disposition code error, and continues processing with error status - [Validate 3W Disposition Code in DC Table]
The system validates the 3W disposition code against the DC table → The system confirms the code is valid and allows diversion processing to continue, or generates an error if the code is not found in the table - [Validate New Station Code in DS Table]
The system validates the station code against the DS table → The system confirms the station code is valid and allows the diversion to proceed, or generates an error if the station is not found - [Generate Error Message - Invalid 3W Code]
The 3W disposition code is not found in the DC table → The system generates an error message indicating invalid 3W disposition code and stops diversion processing - [Generate Error Message - Invalid Station]
The station code is not found in the DS table → The system generates an error message indicating invalid station code and stops diversion processing - [Generate Error Message for Invalid Code]
The system processes the invalid code → An error message is generated indicating the disposition code is not valid in the system - [Generate Error Message for Quantity Mismatch]
The system detects the quantity mismatch → An error message is generated indicating the quantity validation failure - [Validate Disposition Code]
The system looks up the disposition code in the DC table → If the code is found, processing continues; if not found, an error message is generated and processing stops - [Disposition Code = 66, 67, or 68?]
The disposition code is evaluated for hold and examination processing → The system should only process codes 66 (Hold for Examination), 67 (Intensive Examination), or 68 (X-Ray Examination) and skip all other codes - [Validate Cargo Record Exists]
The system searches for the cargo record using the CCN key from the X4 segment → The system should verify that a valid cargo record exists and is not marked as deleted - [Generate Error Message - Cargo Not Found]
The cargo record cannot be found in the system → The system should Throw error: indicating cargo not found, increment the error counter, and continue processing the next segment - [Code Already Exists?]
The system checks the cargo's status array for existing codes → If the same disposition code already exists in the status array, the system should skip processing and continue to the next segment - [218: Disposition Code Table Lookup]
The system performs disposition code table lookup → The system retrieves code properties and processing instructions from GCSTBRT table - [Error: Invalid DC 95]
The system attempts to process the invalid disposition code → The system generates an error message indicating invalid disposition code and stops processing - [Generate FDA Compliance Error]
FDA compliance cannot be validated or N9 segments are unavailable → The system generates FDA compliance error with specific details about the failure - [Validate Port is Laredo]
The system validates the port location → The system confirms the port is Laredo before allowing KCSM transmission - [Entry Number Present?]
The system checks the X4-04 entry number field → If entry number is not present, skip entry processing and continue to next segment - [Generate Entry Validation Error]
Format, length, or character validation fails → Generate entry validation error message and log the issue - [Entry Number Present in X4-04?]
The system checks for entry number presence in field X4-04 → If entry number is present, proceed to entry number validation, otherwise start in-bond broker processing directly - [Valid EDI Code?]
The system receives the EDI code for processing → The system validates if the EDI code exists in the recognized code list and sets validation status accordingly - [Generate Error Message]
The system cannot find the EDI code in the recognized code list → The system generates an error message indicating the EDI code is invalid or unrecognized - [Generate Error Message]
The system processes the rejection → An error message is generated indicating the FDA reference validation failure with specific details - [Bond Number Valid?]
The system validates the bond number → If bond number is empty or invalid, processing stops with error; if valid, processing continues - [Car ID and Waybill Valid?]
The system validates the extracted identification data → Processing continues if both car ID and waybill are valid, otherwise error handling is initiated - [Generate CPRS Cargo Not Found Error]
The CPRS cargo is not found in the system → The system increments the error counter AND creates error message with format 'USCS *ERROR** DC:' + disposition code + CCN key + '*NotFound*' AND sets cargo not found flag AND generates error report - [Invalid Hold Code Error]
The system determines the code is invalid → The system generates an appropriate error message and proceeds to completion without processing the hold - [Validate Disposition Code in DC Table]
The system looks up the disposition code in the DC table → If the code exists in DC table, processing continues; if not found, an error is generated - [Generate Error Message]
The system processes the validation failure → An error message is generated indicating the invalid disposition code - [Route Error to Merlin Users]
The system routes the error message → The error message is sent to designated Merlin users for appropriate action - [Broker Bond Information Available?]
System checks for broker bond information in K1 remarks segment → System identifies if bond control number is available from broker - [Generate Error Message]
System generates error notification → System creates error message indicating bond processing failure with cargo details and reason code - [Log PTT Error Message]
The system logs the error → Create detailed error log entry with PTT validation failure details and cargo information - [Valid Canadian Records?]
The system validates Canadian records → If records are valid, generate log message for Canadian CCN, otherwise exclude deleted or unusable records - [Handle Database Error]
The system handles the database error → Error information is logged, appropriate error messages are generated, and error recovery procedures are initiated - [Validate Container Type Against System Tables]
The system validates the container type against GCSTBRT container type tables → Container type is confirmed as valid or invalid based on table lookup results - [Generate Container Type Error Message]
The system generates container type error message → Error message is created indicating invalid container type and processing is directed to skip container processing - [Container Type Validation]
The system validates the container type → The system determines if the equipment type is a valid container for special routing - [Valid Destination User?]
The system validates the destination user from message routing tables → The system determines if the destination user is valid for receiving export notifications - [N101 Segment Found?]
No N101 segments are found in the secondary records → The system returns with no payer found status - [K1 Comments Available?]
The system checks for available K1 comments → The system determines whether K1 comment information exists and should be included in the message - [Disposition Code Has Quantity Action?]
The system checks if the disposition code has an associated quantity action in the DC table → The system determines whether quantity processing is required and proceeds accordingly - [Comment Count < 4?]
The system checks the current count of K1 comments already processed → If comment count is less than 4, the comment is added to the array, otherwise additional comments are skipped - [Skip Additional Comments]
If the comment for processing → The additional K1 comment is skipped and not included in the comment array - [N101 Segment Found?]
The system checks for N101 segment existence → The system determines if N101 segments are found for qualifier processing or continues searching for additional records - [Error Message Type]
The message type is identified as ERROR or ARRCANL (arrival cancellation) → The system should set error message keywords and route the message to both 'IN' and 'USERR' destinations - [Validate Destination User]
The destination user is validated as valid → The system should send the message directly to the validated user - [Validate Destination User]
The destination user is validated as invalid → The system should reroute the message to the default destination to ensure delivery - [Set Primary Destination User]
The system determines the message type and attempts to set the primary destination user → The primary destination user is identified and validated for message routing - [Is Primary User Valid?]
The system validates the primary user credentials and routing permissions → The system determines if the primary user is valid and can receive the message - [Route to Default Error User]
The system needs to route the error message → The error message is routed to the default error user destination - [Route to Standard Error Basket]
The system processes the standard routing requirement → The message is routed to the standard error basket for general error processing - [Set Error Message Keywords]
The system processes error messages for cargo not found or train processing failures → The system sets keywords 'CARGO_ERROR' for cargo-related errors and 'TRAIN_ERROR' for train-related errors to enable proper message routing - [Error Message Subject]
The message routing process is executed → The message is sent to both 'IN' and 'USERR' destinations with error-specific subject formatting - [Set Error Message Routing]
The system configures routing destinations → The message is set to route to both 'IN' destination and 'USERR' destination - [Set Export Message Routing]
The system configures routing destinations → Equipment type validation is performed before setting routing destinations - [User Code Valid?]
The system validates the user codes → Valid user codes proceed to primary destination routing and invalid user codes are handled by the invalid user handler - [Route to Invalid User Handler]
The system processes the invalid user code → A default user code is set and the message is routed to multiple destinations - [User Valid?]
The system processes each user in the configured user list → If user is valid and active, proceed to send message to user, otherwise route to default user with notification - [User ID Valid?]
If the user ID for routing → The system routes to the specified user if valid or to the default user if invalid - [Check Container Type]
If the container type from the cargo record → The container type is identified and categorized for routing decisions - [Check Destination User Valid?]
The system checks if the destination user ID is valid → The system determines whether the user exists in the system or not - [Route to Default Error Users]
The message type is determined to be an error message → The message is routed to the default error users - [Validate Message Completeness]
Message completeness needs to be validated → The system validates that all required fields are populated and the message structure is complete before proceeding - [Validate Message Structure]
Message structure validation is performed → Message structure is validated against expected format requirements - [Handle Message Error]
Message error handling is required → Message error is handled and processing continues with next available message - [Log Message Error]
Error logging is required → Message error details are logged and processing continues to check for more messages - [Validate Array Initialization]
The system needs to verify successful initialization → The array initialization is validated to ensure it is ready for EDI segment processing - [Validate Message Structure]
The system validates the train message structure → The system checks for required segments, proper formatting, and data completeness in the train message - [Generate Error Message]
The system detects invalid message structure or missing required data → The system generates appropriate error message describing the validation failure - [Set Error Flag]
The system handles validation failure → The system sets error flag to prevent further business processing of the invalid train message - [Handle Message Retrieval Error]
Message retrieval error handling is invoked → Message retrieval error is processed and operations are terminated - [Message Length Valid?]
The system validates message length requirements → Processing continues if length is valid, otherwise error handling is triggered - [Validate Segment Structure]
The system validates segment structure → Segment is confirmed as valid for processing or marked as invalid for error handling - [Log Invalid Segment Error]
The system processes the invalid segment → Error information is logged with segment details and processing continues with next entry - [Log Error and Continue]
The system processes the error condition → The error is logged with appropriate details and processing continues with the next message - [Validate Shiproot Status]
The system checks the shipment root status → The system validates that the shiproot is active and eligible for EDI processing - [Generate Shiproot Not Found Error]
The shipment root record does not exist or has invalid status → The system generates a shiproot not found error message with relevant details - [Verify Shiproot Existence]
The system attempts to verify shiproot existence → The system should validate shiproot record exists and is accessible for processing - [N9 Segments Found?]
If the search results → The system proceeds to extract reference information if N9 segments are found, otherwise completes processing without references - [Validate Reference Data]
The system validates the extracted reference data → The system verifies that the reference data meets required format and completeness criteria - [Invalid Reference Data Error]
The extracted reference data fails validation requirements → The system handles the invalid data error and completes processing without updating cargo records - [Key Valid?]
The system validates the segment key → The system proceeds with database operation if key is valid, otherwise handles database error - [Handle Database Error]
The system handles the database error → The system logs error details and returns error status - [Establish Sender/Receiver Information]
The system establishes sender and receiver information → Valid sender and receiver identifiers are set for message routing and delivery - [Validate Transmission Control Data]
The system validates transmission control data → All required fields are validated for completeness, format, and business rule compliance - [Handle Validation Error]
The system handles validation error → Validation error is processed and appropriate error handling procedures are initiated - [Return Error Status]
The system returns error status → Error status is returned to calling process indicating failed transmission root segment creation with error details - [Format Segment Header Information]
Segment header formatting is required → The system must format segment header with proper segment identifier, element separator, and component separator according to EDI standards - [Validate Segment Structure]
Segment structure validation is performed → The system must verify that all required fields are populated, segment length is valid, and structure conforms to EDI standards - [Handle Validation Error]
A validation error is detected → The system must handle the validation error by setting appropriate error flags and preparing error information for logging - [Log Error Information]
Error logging is required → The system must log detailed error information including segment data, validation failure reason, and transmission context - [Log Error Details]
The system needs to record error information → The system should log detailed error information including error codes, failure reasons, message content, and system state for troubleshooting purposes - [Validate KCSM Disposition Code]
The system validates the disposition code against AECWRKTB configuration table → The disposition code must be found in the KCSM authorized codes list to proceed with message queuing - [Handle Queue Error]
The system handles the queue error → Error details must be captured and retry logic must be initiated - [Log Error Status and Details]
Error status and details need to be logged → Error status, error codes, and failure details are recorded in transmission records - [Equipment ID Valid?]
The system validates the equipment ID → If equipment ID is valid, proceed to hold the equipment, otherwise skip this equipment and continue to next VID segment - [Skip Invalid Equipment ID]
The system encounters an invalid equipment ID → Skip hold processing for this equipment and continue to check for more VID segments - [Log Equipment ID Format Error]
The system encounters invalid equipment ID format → Equipment ID format error is logged and processing continues with next VID segment - [Log Train Not Found Error]
The system cannot find the train in the database → Train not found error is logged and processing continues with next VID segment - [VID Segment Available?]
The system checks for VID segments in the message → If VID segments are present, proceed to extract equipment information, otherwise complete seizure processing without equipment-specific actions - [Validate Equipment ID Format]
The system validates the equipment ID format → Verify the equipment ID conforms to standard format requirements for train equipment identification - [Skip Invalid Equipment ID]
The system processes the invalid equipment ID → Skip seizure processing for the invalid equipment ID and continue with next VID segment - [Equipment ID Valid?]
The system validates the equipment ID format → If the equipment ID format is valid, proceed to find equipment in seized list, otherwise skip this invalid equipment ID - [Skip Invalid Equipment]
The system encounters invalid equipment → The invalid equipment is skipped AND processing continues with the next VID segment - [Validate Equipment ID Format]
The system validates the equipment ID format → The equipment ID format is checked against validation criteria - [Validate Train Information from M10 Segment]
The system processes the M10 segment data → The system validates train name, route, and other essential train information for completeness and accuracy - [Check Train Existence in GCWTL-TRAIN-LIST]
The system searches the GCWTL-TRAIN-LIST table using the train identifier → The system confirms whether the train exists in the master train registry - [Validate Export Port Configuration]
The system checks the port configuration in GCSTBRT port tables → The system validates that the port is configured with proper export processing capabilities - [Send Train Not Found Error]
The system processes the train not found condition → The system generates and sends an error message indicating the train was not found in the system - [Validate Train Exists in System]
The system validates the train name against the train list → If train is not found in GCWTL-TRAIN-LIST, generate train not found error and route to operations - [Send Train Not Found Error]
The train validation fails because the train is not found in the train list database → The system generates a train not found error message and terminates AEI processing for this arrival event - [Check Disposition Code]
The disposition code is evaluated for arrival processing → The system determines if it is POD (Proof of Delivery) or AAD (Arrival at Destination) event - [Send Error Notification]
Error notifications are sent → The system sends error messages to relevant stakeholders with details about the failed train lookup - [Disposition Code Configured for KCSM?]
The system looks up the disposition code in the KCSM configuration table → If the disposition code is found and marked for KCSM processing, proceed with EDI message copy creation, otherwise skip KCSM processing - [Check Disposition Code for KCSM Processing]
The system checks if the disposition code requires KCSM transmission → The system validates the disposition code against the KCSM configuration table to determine processing requirements - [Look for Disposition Code Match]
The disposition code is not found in the AECWRKTB database table → Set KCSM processing flag to No and continue with EDI message processing - [Train Context Available?]
The system checks for available train context → Processing continues if train context exists, otherwise an error is logged - [Skip Invalid K1 Segment]
The system determines the comment is invalid → The invalid K1 segment is skipped and processing continues - [Log Error - No Train Context]
No train context is available → An error is logged indicating missing train context - [K1 Format Valid?]
The system validates the K1 segment format and structure → The K1 segment is accepted for comment extraction if format is valid, otherwise it is rejected with invalid format error - [Check if disposition codes are configured for KCSM system processing at Laredo port]
The system processes the X4 segment disposition code → The system extracts the disposition code, checks if the current port is Laredo, searches the KCSM configuration table for the disposition code, and sets KCSM integration flag if found, otherwise continues with standard processing - [Check Disposition Code in AECWRKTB Table]
The system checks the disposition code configuration in AECWRKTB table → The system determines if the disposition code is configured for KCSM transmission - [Validate Transmission Parameters]
The system validates transmission parameters → All required transmission parameters are verified for completeness and correctness - [Log Validation Error]
The system encounters validation errors → Validation error details are logged for troubleshooting and audit purposes - [Return Error Status]
The system cannot create valid transmission root segment → Error status is returned to the calling process indicating transmission creation failure - [Extract Manifest Information M10]
The system encounters M10 segment during processing → The system extracts manifest information, validates train name, and performs train lookup if vessel name does not start with 'TRAIN' - [Validate Segment Creation]
The system performs final validation → The system verifies that all required dependent segments have been created with proper data integrity and linkages - [Validate Bond Number Format]
The system validates the bond number format → The bond number must be non-blank and meet format requirements to proceed with processing - [Generate Error Message]
The system generates error notifications → An error message is created indicating bond number validation failure and appropriate corrective actions - [Car ID Available?]
The system checks for car ID availability in the N7 segment data → If car ID is not available, log 'No Car ID Available' and proceed to alternative cargo retrieval method - [Waybill Number Available?]
The system checks for waybill number availability in the X4 segment data → If waybill number is not available, log 'No Waybill Available' and proceed to alternative cargo retrieval method - [Validate Car ID Format]
The system validates the car ID format for proper structure and length → Car ID must meet required format specifications to proceed with cargo search - [Validate Waybill Number Format]
The system validates the waybill number format for proper structure and length → Waybill number must meet required format specifications to proceed with cargo search - [Bond Number Present?]
The system checks for bond control number presence in the X4 segment → If bond control number is empty or spaces, log bond validation error and skip bond-based processing, otherwise proceed to bond format validation - [Valid Bond Format?]
The system validates the bond number format against system requirements → If bond format is invalid, log invalid bond format error and skip bond-based processing, otherwise proceed to search cargo records by bond number - [Format Car ID using GCCCARFM Utility]
The system formats the car ID using GCCCARFM utility → The car ID is standardized to proper format for validation - [Call GCCCARFM Utility]
The system calls GCCCARFM utility to validate the equipment ID format → The system determines if the equipment ID format is valid or invalid - [Validate Disposition Code 95]
The disposition code is evaluated for bond clearing eligibility → The system validates the code is '95' and proceeds with bond clearing or rejects invalid codes - [Error: Invalid Disposition Code]
The disposition code is not '95' or is improperly formatted → An error is generated and the transaction continues with standard processing without bond clearing - [Generate Error Message Invalid Entry Type]
The entry type code is not found or is invalid → The system should Throw error: indicating invalid entry type - [Valid FDA Format?]
The system validates the reference number format → The system determines if the reference number meets FDA formatting requirements - [FDA Processing Error]
The system encounters invalid FDA reference formats or processing failures → The error is logged and processing continues to the next N9 segment without stopping the entire transaction - [Bond Number Present?]
The system checks for the presence of a bond control number → Processing continues to bond validation if bond number exists, otherwise bond number error processing is triggered - [Validate Bond Number Format]
The system validates the bond number format against customs requirements → Processing continues to cargo search if format is valid, otherwise bond number error processing is triggered - [Generate Bond Number Error Message]
The system generates an error message for the bond number issue → An appropriate error message is created indicating the specific bond number validation failure - [Car ID and Waybill Valid?]
The system validates the car-waybill combination → Processing continues if both values are valid, otherwise error handling is triggered - [Validate Release Eligibility Across All Cars]
The system validates release eligibility across all cars → Release eligibility is confirmed for all cargo records before proceeding with release message generation - [Handle Cargo Not Found Error]
The system handles the cargo not found condition → Error messages are generated and the system may create new cargo records or foreign bill records as appropriate - [Log Error Message]
The system receives failure notification → The system shall record error information about the logging failure and continue processing - [Validate Comment Length]
The system validates the comment text length → The comment is accepted if it meets length requirements or rejected if it exceeds maximum allowed length - [Check K1 Comment Count]
The system counts the total number of K1 comments collected → The comment count is evaluated against maximum allowed limit of 4 comments per cargo - [Log Error Message]
The system processes the rejection → An error message is logged documenting the K1 comment validation failure for audit purposes - [Generate CPRS Cargo Not Found Error Message]
The system needs to generate an error notification → The system creates a CPRS-specific 'cargo not found' error message and increments the error counter - [Format Error Message with Cargo Details]
The system formats the error message content → The system creates message format 'USCS *ERROR** DC:' + disposition code + CCN key + '*NotFound*' - [Set Error Message Type]
The system needs to classify the message for routing → The system sets the message type as 'ERROR' to ensure proper handling and routing - [Route Error Message to Multiple Destinations]
The system routes the error message → The system sends the message to both 'IN' destination and 'USERR' destination for comprehensive error notification - [Log Error for Audit Trail]
The system completes error processing → The system logs the error occurrence for audit trail and sets the cargo not found flag for downstream processing - [Skip Error Generation]
The cargo is determined to be non-CPRS cargo type → The system skips CPRS-specific error message generation and continues with standard processing - [Generate Error Message - Train Not Found]
The system cannot locate the train in the database → An error message is generated indicating the train was not found - [Route Error to System Administrator]
The system routes the error message → The system administrator receives the error for investigation and resolution - [Does Cargo Have Existing S09 Status Segments?]
The system checks for existing S09 status segments for the cargo → The system identifies whether status segments exist or need to be created - [Status Array Ready for Processing]
All array setup operations have been completed → The status array is ready for cargo status processing operations - [S09 Segment Found?]
The database call completes → The system determines if a valid S09 segment was found and proceeds accordingly - [Array Overflow - Log Warning]
Additional S09 segments are available but cannot be processed → The system logs a warning about array overflow and stops further population - [Status Entries Exist?]
The system checks if status entries exist → If status entries exist, proceed with S09 segment replacement, otherwise proceed directly to cargo record update - [Disposition Code Found in DC Table?]
The system searches for the disposition code in the DC table → The system determines if the disposition code exists and sets appropriate processing flags - [Status Info Match?]
The system compares the status information flags of the counterpart code with the removal criteria → The system either removes the counterpart code immediately or checks additional matching criteria - [Lookup Disposition Code in DC Table]
The system looks up the disposition code in the DC table → The system retrieves disposition code details and sets found flag if code exists in table - [Generate Error Message for Invalid Code]
The system needs to report the invalid code error → The system generates an error message containing the invalid disposition code details - [Log Disposition Code Error Details]
The system needs to record the error for audit purposes → The system logs the disposition code error details including the invalid code and context information - [Generate Error Message]
An error message is generated → The message indicates that disposition code could not be added due to array capacity limits - [Is Cargo CPRS?]
The system checks the cargo type in the cargo record → If cargo type is CPRS, processing continues; otherwise, the request is rejected with appropriate error message - [Reject - Not CPRS Cargo]
The system validates the cargo type → The request is rejected with an error message indicating manual release is only available for CPRS cargo - [Reject - Cargo Not Held]
If the hold status → The request is rejected with an error message indicating cargo must be held to qualify for manual release - [Analyze Current Disposition Codes]
The system processes disposition codes against the DC table → The system determines if current codes indicate an unrelease action - [Container Type Valid?]
The system validates container type for message inclusion → The system determines if the container type is valid for equipment information inclusion in the release message - [Container Type Valid?]
The system checks if the container type is valid for export operations → The system either proceeds with message generation for valid container types or handles invalid container type scenarios - [Handle Invalid Container Type]
The system handles the invalid container type → The system bypasses export message generation and completes the process without creating export messages - [Valid Users?]
The system validates user configuration → The system confirms that users are valid, active, and properly configured to receive the message type - [All Required Fields Present?]
The system validates the extracted data elements → If all required fields are present, processing continues; otherwise, an error is logged and integration is skipped - [Log Missing Field Error]
The system validates the extracted data elements → An error is logged indicating which required fields are missing - [Disposition Code Has Quantity Action?]
The system checks if the disposition code has quantity action requirements → The system determines whether to proceed with quantity action formatting or skip quantity processing - [Access Cargo Secondary Records GCSA2RT Segments]
The system attempts to access GCSA2RT secondary cargo records → The system should verify if secondary records are available and proceed accordingly - [Read N101 Segments from Secondary Records]
The system reads N101 segments from the secondary records → The system should determine if N101 segments exist and are accessible for processing - [Route to Error Destinations]
The message type is ERROR or ARRCANL (arrival cancellation) → The system routes the message to both 'IN' destination and 'USERR' destination for error processing - [Container Type Check]
The message type is EXPORT and container type validation is required → The system checks if the container type is a specific container type or other equipment type to determine routing path - [Valid User Check]
The system performs user validation for the destination → The system checks if the destination user is valid and authorized to receive this message type - [Check Destination User ID]
The system checks the destination user ID validity → The system determines if the user ID is valid or invalid for message routing - [Route to Default Error User]
The message type is identified as Error → The message is routed to the default error user - [Log Rerouting Action]
The invalid user notification is generated → The rerouting action is logged with original user ID, default user ID, message type, and timestamp - [Set Error Message Routing]
Error message routing is configured → Message is routed to both 'IN' destination and 'USERR' error destination - [Report Fields Ready for Message Generation]
Final readiness confirmation is performed → System confirms all fields are ready and message generation can proceed - [Extract Train Information]
Train information extraction is required → System extracts vessel name, train identifier, and related manifest data for validation - [Set Error Code and Message]
Setting error information → Error code and descriptive message are assigned based on failure reason - [MQ Queue Available?]
MQ queue connection status is evaluated → If queue is available, proceed to message retrieval, otherwise handle connection error - [Message Retrieved?]
Message retrieval operation completes → If message retrieved successfully, proceed to calculate length, otherwise check for more messages - [Validate Message Completeness]
System validates message completeness and format → Message completeness and integrity are verified - [Handle Message Processing Error]
System detects message processing error → Error is logged and processing continues with error handling - [Log Error and Continue]
System handles the error condition → Error is logged and system continues to check for more messages - [Validate Total Entries Against Message Length]
The system completes segment counting → The total entry count is validated against the expected count derived from message length - [Receive EDI Segment for Processing]
The system processes messages from the queue → Valid messages with backout count zero are accepted for processing and messages with non-zero backout count are skipped - [Log Shipment Root Not Found Error]
Processing CPRS cargo that is not found → Increment error counter and create error message with disposition code and CCN key marked as not found - [Send Error Notification to Business Users]
The error involves CPRS cargo processing → Send Merlin error message to business users with cargo details and not found status - [Validate Shipment Root Record]
The system checks for shipment root record existence → The system should validate the shipment root record exists and proceed with U1 creation, or log an error if not found - [Log Shiproot Not Found Error]
The shipment root record does not exist in the system → The system should log a shiproot not found error and terminate the U1 creation process - [Database Operation Successful?]
The database operation completes → The system should check if the database operation was successful and proceed accordingly or log an error if failed - [Log Database Error]
The database operation fails → The system should log the database error with relevant details and terminate the U1 creation process - [Validate Converted Code]
The system validates the converted code against EDI 309 standards → The system determines if the conversion is valid and sets appropriate processing path - [Log Conversion Error]
The conversion validation fails → The system logs the conversion error for audit and troubleshooting purposes - [Validate Shiproot Existence]
The system checks for shipment root existence in the database → If shipment root does not exist, processing stops with error handling, otherwise processing continues - [Operation Successful?]
The system checks the operation result status → If operation successful, log success and continue, otherwise handle database error - [Handle Database Error]
The system detects the operation failure → Error handling procedures are invoked and processing terminates with error status - [Validate FDA Reference Types]
The system validates the reference types against FDA requirements → References are classified as valid or invalid based on FDA compliance criteria - [Validate Segment Structure]
Segment structure validation is performed → Root segment structure is validated for data integrity and completeness - [Handle Creation Error]
Creation error handling is initiated → System handles errors that occurred during root segment creation process - [Return Error Status]
Error status is returned → Error status is returned to indicate failure in root segment creation process - [Database Insert Successful?]
The system needs to verify the insertion was successful → The system checks the database insert status and proceeds with logging if successful, or handles the error if unsuccessful - [Handle Broker Lookup Error]
The system handles broker lookup error → Error is logged and KCSM integration process is completed without transmission - [Handle Transmission Creation Error]
The system handles transmission creation error → Error is logged and KCSM integration process is completed without spawning transaction